@metamask/solana-wallet-snap 2.6.2 → 2.7.2

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.
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={33:(e,t,n)=>{var r=n(9968),o=n(9756),i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(e,t){return r(i,(function(n){var r="_."+n[0];t&n[1]&&!o(e,r)&&e.push(r)})),e.sort()}},88:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).get(e)}},125:(e,t,n)=>{var r=n(9032),o=n(5288);e.exports=function(e,t){return e&&r(t,o(t),e)}},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},195:(e,t,n)=>{var r=n(4882),o=n(8121),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},282:e=>{e.exports=a,a.default=a,a.stable=l,a.stableStringify=l;var t="[...]",n="[Circular]",r=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(e,t,n,a){var s;void 0===a&&(a=i()),c(e,"",0,[],void 0,0,a);try{s=0===o.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function s(e,t,n,i){var a=Object.getOwnPropertyDescriptor(i,n);void 0!==a.get?a.configurable?(Object.defineProperty(i,n,{value:e}),r.push([i,n,t,a])):o.push([t,n,e]):(i[n]=e,r.push([i,n,t]))}function c(e,r,o,i,a,u,l){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<i.length;d++)if(i[d]===e)return void s(n,e,r,a);if(void 0!==l.depthLimit&&u>l.depthLimit)return void s(t,e,r,a);if(void 0!==l.edgesLimit&&o+1>l.edgesLimit)return void s(t,e,r,a);if(i.push(e),Array.isArray(e))for(d=0;d<e.length;d++)c(e[d],d,d,i,e,u,l);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var h=f[d];c(e[h],h,d,i,e,u,l)}}i.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,n,a){void 0===a&&(a=i());var s,c=d(e,"",0,[],void 0,0,a)||e;try{s=0===o.length?JSON.stringify(c,t,n):JSON.stringify(c,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function d(e,o,i,a,c,l,f){var h;if(l+=1,"object"==typeof e&&null!==e){for(h=0;h<a.length;h++)if(a[h]===e)return void s(n,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&l>f.depthLimit)return void s(t,e,o,c);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void s(t,e,o,c);if(a.push(e),Array.isArray(e))for(h=0;h<e.length;h++)d(e[h],h,h,a,e,l,f);else{var p={},g=Object.keys(e).sort(u);for(h=0;h<g.length;h++){var m=g[h];d(e[m],m,h,a,e,l,f),p[m]=e[m]}if(void 0===c)return p;r.push([c,o,e]),c[o]=p}a.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(o.length>0)for(var r=0;r<o.length;r++){var i=o[r];if(i[1]===t&&i[0]===n){n=i[2],o.splice(r,1);break}}return e.call(this,t,n)}}},313:(e,t,n)=>{var r=n(1129),o=n(714);e.exports=function e(t,n,i,a,s){var c=-1,u=t.length;for(i||(i=o),s||(s=[]);++c<u;){var l=t[c];n>0&&i(l)?n>1?e(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},353:(e,t,n)=>{var r=n(1340),o=n(3934),i=n(8861),a=n(1182),s=n(8486),c=n(3142),u=n(5853),l=n(8666),d="[object Arguments]",f="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,g,m,y){var w=c(e),v=c(t),A=w?f:s(e),b=v?f:s(t),S=(A=A==d?h:A)==h,E=(b=b==d?h:b)==h,k=A==b;if(k&&u(e)){if(!u(t))return!1;w=!0,S=!1}if(k&&!S)return y||(y=new r),w||l(e)?o(e,t,n,g,m,y):i(e,t,A,n,g,m,y);if(!(1&n)){var T=S&&p.call(e,"__wrapped__"),I=E&&p.call(t,"__wrapped__");if(T||I){var x=T?e.value():e,_=I?t.value():t;return y||(y=new r),m(x,_,n,g,y)}}return!!k&&(y||(y=new r),a(e,t,n,g,m,y))}},358:(e,t,n)=>{var r=n(6137),o=n(3283),i=n(3142),a=n(5853),s=n(9632),c=n(8666),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),d=!n&&!l&&a(e),f=!n&&!l&&!d&&c(e),h=n||l||d||f,p=h?r(e.length,String):[],g=p.length;for(var m in e)!t&&!u.call(e,m)||h&&("length"==m||d&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||p.push(m);return p}},393:(e,t,n)=>{var r=n(8244),o=n(7979),i=n(1211);e.exports=function(e){return r(e,i,o)}},424:(e,t,n)=>{var r=n(8898),o=n(2480),i=n(8340),a=n(8069),s=n(2264);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return i(e);case"[object Symbol]":return a(e)}}},441:(e,t,n)=>{var r=n(7379),o=n(547),i=n(8360);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!i(e)}},528:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},674:(e,t,n)=>{var r=n(7379),o=n(5387),i=n(547),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[r(e)]}},714:(e,t,n)=>{var r=n(5650),o=n(3283),i=n(3142),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(a&&e&&e[a])}},777:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},796:(e,t,n)=>{var r=n(7403),o=n(3316)(r);e.exports=o},864:(e,t,n)=>{var r=n(8638),o=n(1439),i=o((function(e,t){return r(e,256,void 0,void 0,void 0,t)}));e.exports=i},961:(e,t,n)=>{var r=n(3476),o=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=r[t],i=o.call(r,t)?n.length:0;i--;){var a=n[i],s=a.func;if(null==s||s==e)return a.name}return t}},1048:(e,t,n)=>{"use strict";const r=n(7991),o=n(9318),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(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 d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(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(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(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 c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.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 l(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 d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(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,c.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(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 o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(o)return r?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function m(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 R(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){let i,a=1,s=e.length,c=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,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;i<s;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*a}else-1!==r&&(i-=i-r),r=-1}else for(n+c>s&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function A(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(J(r))return a;e[n+a]=r}return a}function b(e,t,n,r){return H(K(t,e.length-n),e,n,r)}function S(e,t,n,r){return H(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 E(e,t,n,r){return H(G(t),e,n,r)}function k(e,t,n,r){return H(function(e,t){let n,r,o;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=x));return n}(r)}c.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}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.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 o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.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)y(this,t,t+1);return this},c.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)y(this,t,t+3),y(this,t+1,t+2);return this},c.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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<s;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.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 o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function _(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function C(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function R(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Y[e[r]];return o}function P(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function N(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 B(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;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 O(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;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 z(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.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,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){W(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,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){W(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],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){W(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)})),c.prototype.readBigInt64BE=Q((function(e){W(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)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeBigInt64LE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.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 o=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),o},c.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&&!c.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 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{const i=c.isBuffer(e)?e:c.from(e,r),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%a]}return this};const L={};function D(e,t,n){L[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 F(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 $(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new L.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||q(t,e.length-(n+1))}(r,o,i)}function W(e,t){if("number"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,"number",e)}function q(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new L.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function K(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.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;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},1112:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},1129:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},1182:(e,t,n)=>{var r=n(393),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,a,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var d=l;d--;){var f=u[d];if(!(c?f in t:o.call(t,f)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var g=!0;s.set(e,t),s.set(t,e);for(var m=c;++d<l;){var y=e[f=u[d]],w=t[f];if(i)var v=c?i(w,y,f,t,e,s):i(y,w,f,e,t,s);if(!(void 0===v?y===w||a(y,w,n,i,s):v)){g=!1;break}m||(m="constructor"==f)}if(g&&!m){var A=e.constructor,b=t.constructor;A==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof A&&A instanceof A&&"function"==typeof b&&b instanceof b||(g=!1)}return s.delete(e),s.delete(t),g}},1187:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},1211:(e,t,n)=>{var r=n(358),o=n(195),i=n(6529);e.exports=function(e){return i(e)?r(e):o(e)}},1340:(e,t,n)=>{var r=n(1386),o=n(4103),i=n(1779),a=n(4162),s=n(7462),c=n(6638);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=o,u.prototype.delete=i,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,e.exports=u},1386:(e,t,n)=>{var r=n(2393),o=n(2049),i=n(7144),a=n(7452),s=n(3964);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},1439:(e,t,n)=>{var r=n(5857),o=n(5234),i=n(796);e.exports=function(e){return i(o(e,void 0,r),e+"")}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},1623:(e,t,n)=>{var r=n(8942).Uint8Array;e.exports=r},1779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},1877:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1935:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},1942:(e,t,n)=>{var r=n(528),o=n(1439),i=n(5196),a=n(961),s=n(3142),c=n(6648);e.exports=function(e){return o((function(t){var n=t.length,o=n,u=r.prototype.thru;for(e&&t.reverse();o--;){var l=t[o];if("function"!=typeof l)throw new TypeError("Expected a function");if(u&&!d&&"wrapper"==a(l))var d=new r([],!0)}for(o=d?o:n;++o<n;){l=t[o];var f=a(l),h="wrapper"==f?i(l):void 0;d=h&&c(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?d[a(h[0])].apply(d,h[3]):1==l.length&&c(l)?d[f]():d.thru(l)}return function(){var e=arguments,r=e[0];if(d&&1==e.length&&s(r))return d.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}},1950:(e,t,n)=>{var r=n(8942)["__core-js_shared__"];e.exports=r},2049:(e,t,n)=>{var r=n(7034),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}},2053:e=>{e.exports=function(e){return e}},2264:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},2291:(e,t,n)=>{var r=n(5650),o=n(5111),i=n(3142),a=n(1187),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(a(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},2306:(e,t,n)=>{e=n.nmd(e);var r=n(4967),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o&&r.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},2343:(e,t,n)=>{var r=n(4687),o=n(6123),i=n(7276),a=n(5187),s=n(7267),c=n(3904),u=n(6040);e.exports=function(e,t){return a(e)&&s(t)?c(u(e),t):function(n){var a=o(n,e);return void 0===a&&a===t?i(n,e):r(t,a,3)}}},2393:e=>{e.exports=function(){this.__data__=[],this.size=0}},2443:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(3504),a=n(4216),s=n(6850),c=n(8813),u=n(8942);e.exports=function(e,t,n){var l=o(e);return function o(){for(var d=arguments.length,f=Array(d),h=d,p=s(o);h--;)f[h]=arguments[h];var g=d<3&&f[0]!==p&&f[d-1]!==p?[]:c(f,p);return(d-=g.length)<n?a(e,t,i,o.placeholder,void 0,f,g,void 0,void 0,n-d):r(this&&this!==u&&this instanceof o?l:e,this,f)}}},2478:(e,t,n)=>{var r=n(7250),o=n(9454),i=n(7706);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},2480:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},2532:(e,t,n)=>{var r=n(4715),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},2590:(e,t,n)=>{var r=n(9334),o=n(3334);e.exports=function(e){return o("function"==typeof e?e:r(e,1))}},2613:(e,t,n)=>{var r=n(5111),o=n(4354),i=n(3142),a=n(1187),s=n(6493),c=n(6040),u=n(5243);e.exports=function(e){return i(e)?r(e,c):a(e)?[e]:o(s(u(e)))}},2619:e=>{e.exports=function(e){return function(){return e}}},2673:(e,t,n)=>{var r=n(3579),o=n(8055);e.exports=function(e,t,n){return r(o,e,t,n)}},2762:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},2784:(e,t,n)=>{var r=n(1580),o=n(4495),i=n(6131),a=Math.max,s=Math.min;e.exports=function(e,t,n){var c,u,l,d,f,h,p=0,g=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function w(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function v(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function A(){var e=o();if(v(e))return b(e);f=setTimeout(A,function(e){var n=t-(e-h);return m?s(n,l-(e-p)):n}(e))}function b(e){return f=void 0,y&&c?w(e):(c=u=void 0,d)}function S(){var e=o(),n=v(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(A,t),g?w(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(A,t),w(h)}return void 0===f&&(f=setTimeout(A,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,l=(m="maxWait"in n)?a(i(n.maxWait)||0,t):l,y="trailing"in n?!!n.trailing:y),S.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},S.flush=function(){return void 0===f?d:b(o())},S}},2846:(e,t,n)=>{var r=n(9334);e.exports=function(e){return r(e,4)}},2879:(e,t,n)=>{var r=n(1942)();e.exports=r},2945:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},2991:e=>{e.exports={}},3092:(e,t,n)=>{var r=n(2673)("flow",n(2879));r.placeholder=n(2991),e.exports=r},3103:(e,t,n)=>{var r=n(4715)(n(8942),"DataView");e.exports=r},3142:e=>{var t=Array.isArray;e.exports=t},3212:(e,t,n)=>{var r=n(8250),o=n(1877),i=n(8006);function a(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,e.exports=a},3282:(e,t,n)=>{var r=n(2762),o=n(8880),i=n(5187),a=n(6040);e.exports=function(e){return i(e)?r(a(e)):o(e)}},3283:(e,t,n)=>{var r=n(6027),o=n(547),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},3301:(e,t,n)=>{var r=n(6131),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},3305:(e,t,n)=>{var r=n(4497);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},3316:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var o=t(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},3321:(e,t,n)=>{var r=n(7553),o=n(528),i=n(5962),a=n(3142),s=n(547),c=n(3410),u=Object.prototype.hasOwnProperty;function l(e){if(s(e)&&!a(e)&&!(e instanceof r)){if(e instanceof o)return e;if(u.call(e,"__wrapped__"))return c(e)}return new o(e)}l.prototype=i.prototype,l.prototype.constructor=l,e.exports=l},3334:(e,t,n)=>{var r=n(6526),o=n(2343),i=n(2053),a=n(3142),s=n(3282);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):s(e)}},3410:(e,t,n)=>{var r=n(7553),o=n(528),i=n(4354);e.exports=function(e){if(e instanceof r)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},3422:(e,t,n)=>{var r=n(7073),o=n(6285),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},3476:e=>{e.exports={}},3504:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(3816),a=n(4364),s=n(4216),c=n(6850),u=n(6591),l=n(8813),d=n(8942);e.exports=function e(t,n,f,h,p,g,m,y,w,v){var A=128&n,b=1&n,S=2&n,E=24&n,k=512&n,T=S?void 0:a(t);return function I(){for(var x=arguments.length,_=Array(x),C=x;C--;)_[C]=arguments[C];if(E)var R=c(I),P=i(_,R);if(h&&(_=r(_,h,p,E)),g&&(_=o(_,g,m,E)),x-=P,E&&x<v){var N=l(_,R);return s(t,n,e,I.placeholder,f,_,N,y,w,v-x)}var B=b?f:this,M=S?B[t]:t;return x=_.length,y?_=u(_,y):k&&x>1&&_.reverse(),A&&w<x&&(_.length=w),this&&this!==d&&this instanceof I&&(M=T||a(M)),M.apply(B,_)}}},3526:(e,t,n)=>{var r=n(3142),o=n(5187),i=n(6493),a=n(5243);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(a(e))}},3546:(e,t,n)=>{var r=n(9032),o=n(7979);e.exports=function(e,t){return r(e,o(e),t)}},3565:(e,t)=>{t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},t.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},t.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},t.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},t.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,n=t.aliasToReal,r={};for(var o in n){var i=n[o];e.call(r,i)?r[i].push(o):r[i]=[o]}return r}(),t.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},t.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},t.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},3579:(e,t,n)=>{var r=n(3565),o=n(2991),i=Array.prototype.push;function a(e,t){return 2==t?function(t,n){return e(t,n)}:function(t){return e(t)}}function s(e){for(var t=e?e.length:0,n=Array(t);t--;)n[t]=e[t];return n}function c(e,t){return function(){var n=arguments.length;if(n){for(var r=Array(n);n--;)r[n]=arguments[n];var o=r[0]=t.apply(void 0,r);return e.apply(void 0,r),o}}}e.exports=function e(t,n,u,l){var d="function"==typeof n,f=n===Object(n);if(f&&(l=u,u=n,n=void 0),null==u)throw new TypeError;l||(l={});var h=!("cap"in l)||l.cap,p=!("curry"in l)||l.curry,g=!("fixed"in l)||l.fixed,m=!("immutable"in l)||l.immutable,y=!("rearg"in l)||l.rearg,w=d?u:o,v="curry"in l&&l.curry,A="fixed"in l&&l.fixed,b="rearg"in l&&l.rearg,S=d?u.runInContext():void 0,E=d?u:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isError:t.isError,isFunction:t.isFunction,isWeakMap:t.isWeakMap,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},k=E.ary,T=E.assign,I=E.clone,x=E.curry,_=E.forEach,C=E.isArray,R=E.isError,P=E.isFunction,N=E.isWeakMap,B=E.keys,M=E.rearg,O=E.toInteger,z=E.toPath,U=B(r.aryMethod),j={castArray:function(e){return function(){var t=arguments[0];return C(t)?e(s(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[1],n=e(arguments[0],t),r=n.length;return h&&"number"==typeof t?(t=t>2?t-2:1,r&&r<=t?n:a(n,t)):n}},mixin:function(e){return function(t){var n=this;if(!P(n))return e(n,Object(t));var r=[];return _(B(t),(function(e){P(t[e])&&r.push([e,n.prototype[e]])})),e(n,Object(t)),_(r,(function(e){var t=e[1];P(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]})),n}},nthArg:function(e){return function(t){var n=t<0?1:O(t)+1;return x(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return x(e(t,n),r)}},runInContext:function(n){return function(r){return e(t,n(r),l)}}};function L(e,t){if(h){var n=r.iterateeRearg[e];if(n)return function(e,t){return q(e,(function(e){var n=t.length;return function(e,t){return 2==t?function(t,n){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}}(M(a(e,n),t),n)}))}(t,n);var o=!d&&r.iterateeAry[e];if(o)return function(e,t){return q(e,(function(e){return"function"==typeof e?a(e,t):e}))}(t,o)}return t}function D(e,t,n){if(g&&(A||!r.skipFixed[e])){var o=r.methodSpread[e],a=o&&o.start;return void 0===a?k(t,n):function(e,t){return function(){for(var n=arguments.length,r=n-1,o=Array(n);n--;)o[n]=arguments[n];var a=o[t],s=o.slice(0,t);return a&&i.apply(s,a),t!=r&&i.apply(s,o.slice(t+1)),e.apply(this,s)}}(t,a)}return t}function F(e,t,n){return y&&n>1&&(b||!r.skipRearg[e])?M(t,r.methodRearg[e]||r.aryRearg[n]):t}function $(e,t){for(var n=-1,r=(t=z(t)).length,o=r-1,i=I(Object(e)),a=i;null!=a&&++n<r;){var s=t[n],c=a[s];null==c||P(c)||R(c)||N(c)||(a[s]=I(n==o?c:Object(c))),a=a[s]}return i}function W(t,n){var o=r.aliasToReal[t]||t,i=r.remap[o]||o,a=l;return function(t){var r=d?S:E,s=d?S[i]:n,c=T(T({},a),t);return e(r,o,s,c)}}function q(e,t){return function(){var n=arguments.length;if(!n)return e();for(var r=Array(n);n--;)r[n]=arguments[n];var o=y?0:n-1;return r[o]=t(r[o]),e.apply(void 0,r)}}function V(e,t,n){var o,i=r.aliasToReal[e]||e,a=t,u=j[i];return u?a=u(t):m&&(r.mutate.array[i]?a=c(t,s):r.mutate.object[i]?a=c(t,function(e){return function(t){return e({},t)}}(t)):r.mutate.set[i]&&(a=c(t,$))),_(U,(function(e){return _(r.aryMethod[e],(function(t){if(i==t){var n=r.methodSpread[i],s=n&&n.afterRearg;return o=s?D(i,F(i,a,e),e):F(i,D(i,a,e),e),o=function(e,t,n){return v||p&&n>1?x(t,n):t}(0,o=L(i,o),e),!1}})),!o})),o||(o=a),o==t&&(o=v?x(o,1):function(){return t.apply(this,arguments)}),o.convert=W(i,t),o.placeholder=t.placeholder=n,o}if(!f)return V(n,u,w);var K=u,G=[];return _(U,(function(e){_(r.aryMethod[e],(function(e){var t=K[r.remap[e]||e];t&&G.push([e,V(e,t,K)])}))})),_(B(K),(function(e){var t=K[e];if("function"==typeof t){for(var n=G.length;n--;)if(G[n][0]==e)return;t.convert=W(e,t),G.push([e,t])}})),_(G,(function(e){K[e[0]]=e[1]})),K.convert=function(e){return K.runInContext.convert(e)(void 0)},K.placeholder=K,_(B(K),(function(e){_(r.realToAlias[e]||[],(function(t){K[t]=K[e]}))})),K}},3636:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},3650:(e,t,n)=>{var r=n(8244),o=n(5832),i=n(5288);e.exports=function(e){return r(e,i,o)}},3655:(e,t,n)=>{var r=n(7379),o=n(1580);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},3766:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},3804:(e,t,n)=>{e.exports=n(3092)},3816:e=>{e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},3904:e=>{e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},3934:(e,t,n)=>{var r=n(3212),o=n(6465),i=n(5568);e.exports=function(e,t,n,a,s,c){var u=1&n,l=e.length,d=t.length;if(l!=d&&!(u&&d>l))return!1;var f=c.get(e),h=c.get(t);if(f&&h)return f==t&&h==e;var p=-1,g=!0,m=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++p<l;){var y=e[p],w=t[p];if(a)var v=u?a(w,y,p,t,e,c):a(y,w,p,e,t,c);if(void 0!==v){if(v)continue;g=!1;break}if(m){if(!o(t,(function(e,t){if(!i(m,t)&&(y===e||s(y,e,n,a,c)))return m.push(t)}))){g=!1;break}}else if(y!==w&&!s(y,w,n,a,c)){g=!1;break}}return c.delete(e),c.delete(t),g}},3943:(e,t,n)=>{var r=n(1935),o=n(9460),i=n(2306),a=i&&i.isSet,s=a?o(a):r;e.exports=s},3964:(e,t,n)=>{var r=n(7034);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},4103:(e,t,n)=>{var r=n(1386);e.exports=function(){this.__data__=new r,this.size=0}},4162:e=>{e.exports=function(e){return this.__data__.get(e)}},4216:(e,t,n)=>{var r=n(6648),o=n(5512),i=n(5620);e.exports=function(e,t,n,a,s,c,u,l,d,f){var h=8&t;t|=h?32:64,4&(t&=~(h?64:32))||(t&=-4);var p=[e,t,s,h?c:void 0,h?u:void 0,h?void 0:c,h?void 0:u,l,d,f],g=n.apply(void 0,p);return r(e)&&o(g,p),g.placeholder=a,i(g,e,t)}},4255:(e,t,n)=>{var r=n(2673)("debounce",n(2784));r.placeholder=n(2991),e.exports=r},4354:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},4364:(e,t,n)=>{var r=n(9747),o=n(1580);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=r(e.prototype),i=e.apply(n,t);return o(i)?i:n}}},4367:(e,t,n)=>{var r=n(7267),o=n(1211);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,r(a)]}return t}},4495:(e,t,n)=>{var r=n(8942);e.exports=function(){return r.Date.now()}},4497:(e,t,n)=>{var r=n(4715)(Object,"create");e.exports=r},4512:(e,t,n)=>{var r=n(4715)(n(8942),"Set");e.exports=r},4687:(e,t,n)=>{var r=n(353),o=n(547);e.exports=function e(t,n,i,a,s){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,a,e,s))}},4700:(e,t,n)=>{var r=n(9067);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},4715:(e,t,n)=>{var r=n(9624),o=n(155);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},4732:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).has(e)}},4733:(e,t,n)=>{var r=n(9032),o=n(5832);e.exports=function(e,t){return r(e,o(e),t)}},4759:(e,t,n)=>{var r,o=n(1950),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},4772:e=>{e.exports=function(){return!1}},4784:(e,t,n)=>{var r=n(3766)(Object.getPrototypeOf,Object);e.exports=r},4882:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},4943:(e,t,n)=>{var r=n(2053),o=n(6065),i=o?function(e,t){return o.set(e,t),e}:r;e.exports=i},4967:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4977:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=r.length,c=-1,u=n.length,l=t(a-s,0),d=Array(u+l),f=!o;++c<u;)d[c]=n[c];for(;++i<s;)(f||i<a)&&(d[r[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}},5071:(e,t,n)=>{var r=n(4497);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5098:(e,t,n)=>{var r=n(3305),o=n(9361),i=n(1112),a=n(5276),s=n(5071);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},5111:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},5187:(e,t,n)=>{var r=n(3142),o=n(1187),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(a.test(e)||!i.test(e)||null!=t&&e in Object(t))}},5196:(e,t,n)=>{var r=n(6065),o=n(9071),i=r?function(e){return r.get(e)}:o;e.exports=i},5234:(e,t,n)=>{var r=n(6912),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,s=o(i.length-t,0),c=Array(s);++a<s;)c[a]=i[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=i[a];return u[t]=n(c),r(e,this,u)}}},5243:(e,t,n)=>{var r=n(2291);e.exports=function(e){return null==e?"":r(e)}},5250:function(e,t,n){var r;e=n.nmd(e),function(){var o,i="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=16,u=32,l=64,d=128,f=256,h=1/0,p=9007199254740991,g=NaN,m=4294967295,y=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",l],["rearg",f]],w="[object Arguments]",v="[object Array]",A="[object Boolean]",b="[object Date]",S="[object Error]",E="[object Function]",k="[object GeneratorFunction]",T="[object Map]",I="[object Number]",x="[object Object]",_="[object Promise]",C="[object RegExp]",R="[object Set]",P="[object String]",N="[object Symbol]",B="[object WeakMap]",M="[object ArrayBuffer]",O="[object DataView]",z="[object Float32Array]",U="[object Float64Array]",j="[object Int8Array]",L="[object Int16Array]",D="[object Int32Array]",F="[object Uint8Array]",$="[object Uint8ClampedArray]",W="[object Uint16Array]",q="[object Uint32Array]",V=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,Z=/[&<>"']/g,J=RegExp(H.source),Y=RegExp(Z.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oe=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(oe.source),ae=/^\s+/,se=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,we=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ee=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Te="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ie="\\u2700-\\u27bf",xe="a-z\\xdf-\\xf6\\xf8-\\xff",_e="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pe="['’]",Ne="["+ke+"]",Be="["+Re+"]",Me="["+Te+"]",Oe="\\d+",ze="["+Ie+"]",Ue="["+xe+"]",je="[^"+ke+Re+Oe+Ie+xe+_e+"]",Le="\\ud83c[\\udffb-\\udfff]",De="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",We="["+_e+"]",qe="\\u200d",Ve="(?:"+Ue+"|"+je+")",Ke="(?:"+We+"|"+je+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",He="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Me+"|"+Le+")"+"?",Je="["+Ce+"]?",Ye=Je+Ze+("(?:"+qe+"(?:"+[De,Fe,$e].join("|")+")"+Je+Ze+")*"),Qe="(?:"+[ze,Fe,$e].join("|")+")"+Ye,Xe="(?:"+[De+Me+"?",Me,Fe,$e,Ne].join("|")+")",et=RegExp(Pe,"g"),tt=RegExp(Me,"g"),nt=RegExp(Le+"(?="+Le+")|"+Xe+Ye,"g"),rt=RegExp([We+"?"+Ue+"+"+Ge+"(?="+[Be,We,"$"].join("|")+")",Ke+"+"+He+"(?="+[Be,We+Ve,"$"].join("|")+")",We+"?"+Ve+"+"+Ge,We+"+"+He,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Qe].join("|"),"g"),ot=RegExp("["+qe+ke+Te+Ce+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,at=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],st=-1,ct={};ct[z]=ct[U]=ct[j]=ct[L]=ct[D]=ct[F]=ct[$]=ct[W]=ct[q]=!0,ct[w]=ct[v]=ct[M]=ct[A]=ct[O]=ct[b]=ct[S]=ct[E]=ct[T]=ct[I]=ct[x]=ct[C]=ct[R]=ct[P]=ct[B]=!1;var ut={};ut[w]=ut[v]=ut[M]=ut[O]=ut[A]=ut[b]=ut[z]=ut[U]=ut[j]=ut[L]=ut[D]=ut[T]=ut[I]=ut[x]=ut[C]=ut[R]=ut[P]=ut[N]=ut[F]=ut[$]=ut[W]=ut[q]=!0,ut[S]=ut[E]=ut[B]=!1;var lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,ft=parseInt,ht="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,pt="object"==typeof self&&self&&self.Object===Object&&self,gt=ht||pt||Function("return this")(),mt=t&&!t.nodeType&&t,yt=mt&&e&&!e.nodeType&&e,wt=yt&&yt.exports===mt,vt=wt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||vt&&vt.binding&&vt.binding("util")}catch(e){}}(),bt=At&&At.isArrayBuffer,St=At&&At.isDate,Et=At&&At.isMap,kt=At&&At.isRegExp,Tt=At&&At.isSet,It=At&&At.isTypedArray;function xt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function _t(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var a=e[o];t(r,a,n(a),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Pt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}function Bt(e,t){return!!(null==e?0:e.length)&&Wt(e,t,0)>-1}function Mt(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function Ot(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function zt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function Ut(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function jt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function Lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Dt=Gt("length");function Ft(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function $t(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function Wt(e,t,n){return t==t?function(e,t,n){var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):$t(e,Vt,n)}function qt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Vt(e){return e!=e}function Kt(e,t){var n=null==e?0:e.length;return n?Jt(e,t)/n:g}function Gt(e){return function(t){return null==t?o:t[e]}}function Ht(e){return function(t){return null==e?o:e[t]}}function Zt(e,t,n,r,o){return o(e,(function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)})),n}function Jt(e,t){for(var n,r=-1,i=e.length;++r<i;){var a=t(e[r]);a!==o&&(n=n===o?a:n+a)}return n}function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Qt(e){return e?e.slice(0,mn(e)+1).replace(ae,""):e}function Xt(e){return function(t){return e(t)}}function en(e,t){return Ot(t,(function(t){return e[t]}))}function tn(e,t){return e.has(t)}function nn(e,t){for(var n=-1,r=e.length;++n<r&&Wt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&Wt(t,e[n],0)>-1;);return n}var on=Ht({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),an=Ht({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function sn(e){return"\\"+lt[e]}function cn(e){return ot.test(e)}function un(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function ln(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n];a!==t&&a!==s||(e[n]=s,i[o++]=n)}return i}function fn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function hn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function pn(e){return cn(e)?function(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Dt(e)}function gn(e){return cn(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.split("")}(e)}function mn(e){for(var t=e.length;t--&&se.test(e.charAt(t)););return t}var yn=Ht({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var wn=function e(t){var n,r=(t=null==t?gt:wn.defaults(gt.Object(),t,wn.pick(gt,at))).Array,se=t.Date,ke=t.Error,Te=t.Function,Ie=t.Math,xe=t.Object,_e=t.RegExp,Ce=t.String,Re=t.TypeError,Pe=r.prototype,Ne=Te.prototype,Be=xe.prototype,Me=t["__core-js_shared__"],Oe=Ne.toString,ze=Be.hasOwnProperty,Ue=0,je=(n=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Le=Be.toString,De=Oe.call(xe),Fe=gt._,$e=_e("^"+Oe.call(ze).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),We=wt?t.Buffer:o,qe=t.Symbol,Ve=t.Uint8Array,Ke=We?We.allocUnsafe:o,Ge=ln(xe.getPrototypeOf,xe),He=xe.create,Ze=Be.propertyIsEnumerable,Je=Pe.splice,Ye=qe?qe.isConcatSpreadable:o,Qe=qe?qe.iterator:o,Xe=qe?qe.toStringTag:o,nt=function(){try{var e=hi(xe,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==gt.clearTimeout&&t.clearTimeout,lt=se&&se.now!==gt.Date.now&&se.now,ht=t.setTimeout!==gt.setTimeout&&t.setTimeout,pt=Ie.ceil,mt=Ie.floor,yt=xe.getOwnPropertySymbols,vt=We?We.isBuffer:o,At=t.isFinite,Dt=Pe.join,Ht=ln(xe.keys,xe),vn=Ie.max,An=Ie.min,bn=se.now,Sn=t.parseInt,En=Ie.random,kn=Pe.reverse,Tn=hi(t,"DataView"),In=hi(t,"Map"),xn=hi(t,"Promise"),_n=hi(t,"Set"),Cn=hi(t,"WeakMap"),Rn=hi(xe,"create"),Pn=Cn&&new Cn,Nn={},Bn=Li(Tn),Mn=Li(In),On=Li(xn),zn=Li(_n),Un=Li(Cn),jn=qe?qe.prototype:o,Ln=jn?jn.valueOf:o,Dn=jn?jn.toString:o;function Fn(e){if(ns(e)&&!Va(e)&&!(e instanceof Vn)){if(e instanceof qn)return e;if(ze.call(e,"__wrapped__"))return Di(e)}return new qn(e)}var $n=function(){function e(){}return function(t){if(!ts(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=o,n}}();function Wn(){}function qn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Kn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Hn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new Gn(e);this.size=t.size}function Yn(e,t){var n=Va(e),r=!n&&qa(e),o=!n&&!r&&Za(e),i=!n&&!r&&!o&&ls(e),a=n||r||o||i,s=a?Yt(e.length,Ce):[],c=s.length;for(var u in e)!t&&!ze.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ai(u,c))||s.push(u);return s}function Qn(e){var t=e.length;return t?e[Zr(0,t-1)]:o}function Xn(e,t){return zi(Po(e),cr(t,0,e.length))}function er(e){return zi(Po(e))}function tr(e,t,n){(n!==o&&!Fa(e[t],n)||n===o&&!(t in e))&&ar(e,t,n)}function nr(e,t,n){var r=e[t];ze.call(e,t)&&Fa(r,n)&&(n!==o||t in e)||ar(e,t,n)}function rr(e,t){for(var n=e.length;n--;)if(Fa(e[n][0],t))return n;return-1}function or(e,t,n,r){return hr(e,(function(e,o,i){t(r,e,n(e),i)})),r}function ir(e,t){return e&&No(t,Ns(t),e)}function ar(e,t,n){"__proto__"==t&&nt?nt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function sr(e,t){for(var n=-1,i=t.length,a=r(i),s=null==e;++n<i;)a[n]=s?o:xs(e,t[n]);return a}function cr(e,t,n){return e==e&&(n!==o&&(e=e<=n?e:n),t!==o&&(e=e>=t?e:t)),e}function ur(e,t,n,r,i,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=i?n(e,r,i,a):n(e)),s!==o)return s;if(!ts(e))return e;var d=Va(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Po(e,s)}else{var f=mi(e),h=f==E||f==k;if(Za(e))return To(e,c);if(f==x||f==w||h&&!i){if(s=u||h?{}:wi(e),!c)return u?function(e,t){return No(e,gi(e),t)}(e,function(e,t){return e&&No(t,Bs(t),e)}(s,e)):function(e,t){return No(e,pi(e),t)}(e,ir(s,e))}else{if(!ut[f])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case M:return Io(e);case A:case b:return new r(+e);case O:return function(e,t){var n=t?Io(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case z:case U:case j:case L:case D:case F:case $:case W:case q:return xo(e,n);case T:return new r;case I:case P:return new r(e);case C:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new r;case N:return o=e,Ln?xe(Ln.call(o)):{}}var o}(e,f,c)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),ss(e)?e.forEach((function(r){s.add(ur(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,o){s.set(o,ur(r,t,n,o,e,a))}));var g=d?o:(l?u?ai:ii:u?Bs:Ns)(e);return Ct(g||e,(function(r,o){g&&(r=e[o=r]),nr(s,o,ur(r,t,n,o,e,a))})),s}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=xe(e);r--;){var i=n[r],a=t[i],s=e[i];if(s===o&&!(i in e)||!a(s))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Re(i);return Ni((function(){e.apply(o,n)}),t)}function fr(e,t,n,r){var o=-1,i=Bt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Ot(t,Xt(n))),r?(i=Mt,a=!1):t.length>=200&&(i=tn,a=!1,t=new Zn(t));e:for(;++o<s;){var l=e[o],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var f=u;f--;)if(t[f]===d)continue e;c.push(l)}else i(t,d,r)||c.push(l)}return c}Fn.templateSettings={escape:Q,evaluate:X,interpolate:ee,variable:"",imports:{_:Fn}},Fn.prototype=Wn.prototype,Fn.prototype.constructor=Fn,qn.prototype=$n(Wn.prototype),qn.prototype.constructor=qn,Vn.prototype=$n(Wn.prototype),Vn.prototype.constructor=Vn,Kn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Kn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Kn.prototype.get=function(e){var t=this.__data__;if(Rn){var n=t[e];return n===a?o:n}return ze.call(t,e)?t[e]:o},Kn.prototype.has=function(e){var t=this.__data__;return Rn?t[e]!==o:ze.call(t,e)},Kn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rn&&t===o?a:t,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=rr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,!0)},Gn.prototype.get=function(e){var t=this.__data__,n=rr(t,e);return n<0?o:t[n][1]},Gn.prototype.has=function(e){return rr(this.__data__,e)>-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Kn,map:new(In||Gn),string:new Kn}},Hn.prototype.delete=function(e){var t=di(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return di(this,e).get(e)},Hn.prototype.has=function(e){return di(this,e).has(e)},Hn.prototype.set=function(e,t){var n=di(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Zn.prototype.add=Zn.prototype.push=function(e){return this.__data__.set(e,a),this},Zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var hr=Oo(br),pr=Oo(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function mr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],s=t(a);if(null!=s&&(c===o?s==s&&!us(s):n(s,c)))var c=s,u=a}return u}function yr(e,t){var n=[];return hr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function wr(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=vi),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?wr(s,t-1,n,r,o):zt(o,s):r||(o[o.length]=s)}return o}var vr=zo(),Ar=zo(!0);function br(e,t){return e&&vr(e,t,Ns)}function Sr(e,t){return e&&Ar(e,t,Ns)}function Er(e,t){return Nt(t,(function(t){return Qa(e[t])}))}function kr(e,t){for(var n=0,r=(t=bo(t,e)).length;null!=e&&n<r;)e=e[ji(t[n++])];return n&&n==r?e:o}function Tr(e,t,n){var r=t(e);return Va(e)?r:zt(r,n(e))}function Ir(e){return null==e?e===o?"[object Undefined]":"[object Null]":Xe&&Xe in xe(e)?function(e){var t=ze.call(e,Xe),n=e[Xe];try{e[Xe]=o;var r=!0}catch(e){}var i=Le.call(e);r&&(t?e[Xe]=n:delete e[Xe]);return i}(e):function(e){return Le.call(e)}(e)}function xr(e,t){return e>t}function _r(e,t){return null!=e&&ze.call(e,t)}function Cr(e,t){return null!=e&&t in xe(e)}function Rr(e,t,n){for(var i=n?Mt:Bt,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Ot(f,Xt(t))),l=An(f.length,l),u[c]=!n&&(t||a>=120&&f.length>=120)?new Zn(c&&f):o}f=e[0];var h=-1,p=u[0];e:for(;++h<a&&d.length<l;){var g=f[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(p?tn(p,m):i(d,m,n))){for(c=s;--c;){var y=u[c];if(!(y?tn(y,m):i(e[c],m,n)))continue e}p&&p.push(m),d.push(g)}}return d}function Pr(e,t,n){var r=null==(e=Ci(e,t=bo(t,e)))?e:e[ji(Yi(t))];return null==r?o:xt(r,e,n)}function Nr(e){return ns(e)&&Ir(e)==w}function Br(e,t,n,r,i){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,n,r,i,a){var s=Va(e),c=Va(t),u=s?v:mi(e),l=c?v:mi(t),d=(u=u==w?x:u)==x,f=(l=l==w?x:l)==x,h=u==l;if(h&&Za(e)){if(!Za(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Jn),s||ls(e)?ri(e,t,n,r,i,a):function(e,t,n,r,o,i,a){switch(n){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case M:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case A:case b:case I:return Fa(+e,+t);case S:return e.name==t.name&&e.message==t.message;case C:case P:return e==t+"";case T:var s=un;case R:var c=1&r;if(s||(s=fn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=ri(s(e),s(t),r,o,i,a);return a.delete(e),l;case N:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(e,t,u,n,r,i,a);if(!(1&n)){var p=d&&ze.call(e,"__wrapped__"),g=f&&ze.call(t,"__wrapped__");if(p||g){var m=p?e.value():e,y=g?t.value():t;return a||(a=new Jn),i(m,y,n,r,a)}}if(!h)return!1;return a||(a=new Jn),function(e,t,n,r,i,a){var s=1&n,c=ii(e),u=c.length,l=ii(t),d=l.length;if(u!=d&&!s)return!1;var f=u;for(;f--;){var h=c[f];if(!(s?h in t:ze.call(t,h)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);var y=s;for(;++f<u;){var w=e[h=c[f]],v=t[h];if(r)var A=s?r(v,w,h,t,e,a):r(w,v,h,e,t,a);if(!(A===o?w===v||i(w,v,n,r,a):A)){m=!1;break}y||(y="constructor"==h)}if(m&&!y){var b=e.constructor,S=t.constructor;b==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof S&&S instanceof S||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,r,i,a)}(e,t,n,r,Br,i))}function Mr(e,t,n,r){var i=n.length,a=i,s=!r;if(null==e)return!a;for(e=xe(e);i--;){var c=n[i];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<a;){var u=(c=n[i])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===o&&!(u in e))return!1}else{var f=new Jn;if(r)var h=r(l,d,u,e,t,f);if(!(h===o?Br(d,l,3,r,f):h))return!1}}return!0}function Or(e){return!(!ts(e)||(t=e,je&&je in t))&&(Qa(e)?$e:we).test(Li(e));var t}function zr(e){return"function"==typeof e?e:null==e?oc:"object"==typeof e?Va(e)?$r(e[0],e[1]):Fr(e):hc(e)}function Ur(e){if(!Ti(e))return Ht(e);var t=[];for(var n in xe(e))ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function jr(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in xe(e))t.push(n);return t}(e);var t=Ti(e),n=[];for(var r in e)("constructor"!=r||!t&&ze.call(e,r))&&n.push(r);return n}function Lr(e,t){return e<t}function Dr(e,t){var n=-1,o=Ga(e)?r(e.length):[];return hr(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}function Fr(e){var t=fi(e);return 1==t.length&&t[0][2]?xi(t[0][0],t[0][1]):function(n){return n===e||Mr(n,e,t)}}function $r(e,t){return Si(e)&&Ii(t)?xi(ji(e),t):function(n){var r=xs(n,e);return r===o&&r===t?_s(n,e):Br(t,r,3)}}function Wr(e,t,n,r,i){e!==t&&vr(t,(function(a,s){if(i||(i=new Jn),ts(a))!function(e,t,n,r,i,a,s){var c=Ri(e,n),u=Ri(t,n),l=s.get(u);if(l)return void tr(e,n,l);var d=a?a(c,u,n+"",e,t,s):o,f=d===o;if(f){var h=Va(u),p=!h&&Za(u),g=!h&&!p&&ls(u);d=u,h||p||g?Va(c)?d=c:Ha(c)?d=Po(c):p?(f=!1,d=To(u,!0)):g?(f=!1,d=xo(u,!0)):d=[]:is(u)||qa(u)?(d=c,qa(c)?d=ws(c):ts(c)&&!Qa(c)||(d=wi(u))):f=!1}f&&(s.set(u,d),i(d,u,r,a,s),s.delete(u));tr(e,n,d)}(e,t,s,n,Wr,r,i);else{var c=r?r(Ri(e,s),a,s+"",e,t,i):o;c===o&&(c=a),tr(e,s,c)}}),Bs)}function qr(e,t){var n=e.length;if(n)return Ai(t+=t<0?n:0,n)?e[t]:o}function Vr(e,t,n){t=t.length?Ot(t,(function(e){return Va(e)?function(t){return kr(t,1===e.length?e[0]:e)}:e})):[oc];var r=-1;t=Ot(t,Xt(li()));var o=Dr(e,(function(e,n,o){var i=Ot(t,(function(t){return t(e)}));return{criteria:i,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){var r=-1,o=e.criteria,i=t.criteria,a=o.length,s=n.length;for(;++r<a;){var c=_o(o[r],i[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Kr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=kr(e,a);n(s,a)&&eo(i,bo(a,e),s)}return i}function Gr(e,t,n,r){var o=r?qt:Wt,i=-1,a=t.length,s=e;for(e===t&&(t=Po(t)),n&&(s=Ot(e,Xt(n)));++i<a;)for(var c=0,u=t[i],l=n?n(u):u;(c=o(s,l,c,r))>-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Hr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;Ai(o)?Je.call(e,o,1):ho(e,o)}}return e}function Zr(e,t){return e+mt(En()*(t-e+1))}function Jr(e,t){var n="";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Bi(_i(e,t,oc),e+"")}function Qr(e){return Qn(Fs(e))}function Xr(e,t){var n=Fs(e);return zi(n,cr(t,0,n.length))}function eo(e,t,n,r){if(!ts(e))return e;for(var i=-1,a=(t=bo(t,e)).length,s=a-1,c=e;null!=c&&++i<a;){var u=ji(t[i]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=s){var d=c[u];(l=r?r(d,u,c):o)===o&&(l=ts(d)?d:Ai(t[i+1])?[]:{})}nr(c,u,l),c=c[u]}return e}var to=Pn?function(e,t){return Pn.set(e,t),e}:oc,no=nt?function(e,t){return nt(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:oc;function ro(e){return zi(Fs(e))}function oo(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=r(i);++o<i;)a[o]=e[o+t];return a}function io(e,t){var n;return hr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function ao(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,a=e[i];null!==a&&!us(a)&&(n?a<=t:a<t)?r=i+1:o=i}return o}return so(e,t,oc,n)}function so(e,t,n,r){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=us(t),l=t===o;i<a;){var d=mt((i+a)/2),f=n(e[d]),h=f!==o,p=null===f,g=f==f,m=us(f);if(s)var y=r||g;else y=l?g&&(r||h):c?g&&h&&(r||!p):u?g&&h&&!p&&(r||!m):!p&&!m&&(r?f<=t:f<t);y?i=d+1:a=d}return An(a,4294967294)}function co(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Fa(s,c)){var c=s;i[o++]=0===a?0:a}}return i}function uo(e){return"number"==typeof e?e:us(e)?g:+e}function lo(e){if("string"==typeof e)return e;if(Va(e))return Ot(e,lo)+"";if(us(e))return Dn?Dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function fo(e,t,n){var r=-1,o=Bt,i=e.length,a=!0,s=[],c=s;if(n)a=!1,o=Mt;else if(i>=200){var u=t?null:Yo(e);if(u)return fn(u);a=!1,o=tn,c=new Zn}else c=t?[]:s;e:for(;++r<i;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(l)}else o(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ho(e,t){return null==(e=Ci(e,t=bo(t,e)))||delete e[ji(Yi(t))]}function po(e,t,n,r){return eo(e,t,n(kr(e,t)),r)}function go(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?oo(e,r?0:i,r?i+1:o):oo(e,r?i+1:0,r?o:i)}function mo(e,t){var n=e;return n instanceof Vn&&(n=n.value()),Ut(t,(function(e,t){return t.func.apply(t.thisArg,zt([e],t.args))}),n)}function yo(e,t,n){var o=e.length;if(o<2)return o?fo(e[0]):[];for(var i=-1,a=r(o);++i<o;)for(var s=e[i],c=-1;++c<o;)c!=i&&(a[i]=fr(a[i]||s,e[c],t,n));return fo(wr(a,1),t,n)}function wo(e,t,n){for(var r=-1,i=e.length,a=t.length,s={};++r<i;){var c=r<a?t[r]:o;n(s,e[r],c)}return s}function vo(e){return Ha(e)?e:[]}function Ao(e){return"function"==typeof e?e:oc}function bo(e,t){return Va(e)?e:Si(e,t)?[e]:Ui(vs(e))}var So=Yr;function Eo(e,t,n){var r=e.length;return n=n===o?r:n,!t&&n>=r?e:oo(e,t,n)}var ko=ot||function(e){return gt.clearTimeout(e)};function To(e,t){if(t)return e.slice();var n=e.length,r=Ke?Ke(n):new e.constructor(n);return e.copy(r),r}function Io(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function xo(e,t){var n=t?Io(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function _o(e,t){if(e!==t){var n=e!==o,r=null===e,i=e==e,a=us(e),s=t!==o,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||c&&n&&i||!s&&i||!u)return-1}return 0}function Co(e,t,n,o){for(var i=-1,a=e.length,s=n.length,c=-1,u=t.length,l=vn(a-s,0),d=r(u+l),f=!o;++c<u;)d[c]=t[c];for(;++i<s;)(f||i<a)&&(d[n[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}function Ro(e,t,n,o){for(var i=-1,a=e.length,s=-1,c=n.length,u=-1,l=t.length,d=vn(a-c,0),f=r(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=t[u];for(;++s<c;)(h||i<a)&&(f[p+n[s]]=e[i++]);return f}function Po(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function No(e,t,n,r){var i=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=r?r(n[c],e[c],c,n,e):o;u===o&&(u=e[c]),i?ar(n,c,u):nr(n,c,u)}return n}function Bo(e,t){return function(n,r){var o=Va(n)?_t:or,i=t?t():{};return o(n,e,li(r,2),i)}}function Mo(e){return Yr((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:o,s=i>2?n[2]:o;for(a=e.length>3&&"function"==typeof a?(i--,a):o,s&&bi(n[0],n[1],s)&&(a=i<3?o:a,i=1),t=xe(t);++r<i;){var c=n[r];c&&e(t,c,r,a)}return t}))}function Oo(e,t){return function(n,r){if(null==n)return n;if(!Ga(n))return e(n,r);for(var o=n.length,i=t?o:-1,a=xe(n);(t?i--:++i<o)&&!1!==r(a[i],i,a););return n}}function zo(e){return function(t,n,r){for(var o=-1,i=xe(t),a=r(t),s=a.length;s--;){var c=a[e?s:++o];if(!1===n(i[c],c,i))break}return t}}function Uo(e){return function(t){var n=cn(t=vs(t))?gn(t):o,r=n?n[0]:t.charAt(0),i=n?Eo(n,1).join(""):t.slice(1);return r[e]()+i}}function jo(e){return function(t){return Ut(Qs(qs(t).replace(et,"")),e,"")}}function Lo(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=$n(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Do(e){return function(t,n,r){var i=xe(t);if(!Ga(t)){var a=li(n,3);t=Ns(t),n=function(e){return a(i[e],e,i)}}var s=e(t,n,r);return s>-1?i[a?t[s]:s]:o}}function Fo(e){return oi((function(t){var n=t.length,r=n,a=qn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Re(i);if(a&&!c&&"wrapper"==ci(s))var c=new qn([],!0)}for(r=c?r:n;++r<n;){var u=ci(s=t[r]),l="wrapper"==u?si(s):o;c=l&&Ei(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ci(l[0])].apply(c,l[3]):1==s.length&&Ei(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&Va(r))return c.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}function $o(e,t,n,i,a,s,c,u,l,f){var h=t&d,p=1&t,g=2&t,m=24&t,y=512&t,w=g?o:Lo(e);return function d(){for(var v=arguments.length,A=r(v),b=v;b--;)A[b]=arguments[b];if(m)var S=ui(d),E=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(A,S);if(i&&(A=Co(A,i,a,m)),s&&(A=Ro(A,s,c,m)),v-=E,m&&v<f){var k=dn(A,S);return Zo(e,t,$o,d.placeholder,n,A,k,u,l,f-v)}var T=p?n:this,I=g?T[e]:e;return v=A.length,u?A=function(e,t){var n=e.length,r=An(t.length,n),i=Po(e);for(;r--;){var a=t[r];e[r]=Ai(a,n)?i[a]:o}return e}(A,u):y&&v>1&&A.reverse(),h&&l<v&&(A.length=l),this&&this!==gt&&this instanceof d&&(I=w||Lo(I)),I.apply(T,A)}}function Wo(e,t){return function(n,r){return function(e,t,n,r){return br(e,(function(e,o,i){t(r,n(e),o,i)})),r}(n,e,t(r),{})}}function qo(e,t){return function(n,r){var i;if(n===o&&r===o)return t;if(n!==o&&(i=n),r!==o){if(i===o)return r;"string"==typeof n||"string"==typeof r?(n=lo(n),r=lo(r)):(n=uo(n),r=uo(r)),i=e(n,r)}return i}}function Vo(e){return oi((function(t){return t=Ot(t,Xt(li())),Yr((function(n){var r=this;return e(t,(function(e){return xt(e,r,n)}))}))}))}function Ko(e,t){var n=(t=t===o?" ":lo(t)).length;if(n<2)return n?Jr(t,e):t;var r=Jr(t,pt(e/pn(t)));return cn(t)?Eo(gn(r),0,e).join(""):r.slice(0,e)}function Go(e){return function(t,n,i){return i&&"number"!=typeof i&&bi(t,n,i)&&(n=i=o),t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n,o){for(var i=-1,a=vn(pt((t-e)/(n||1)),0),s=r(a);a--;)s[o?a:++i]=e,e+=n;return s}(t,n,i=i===o?t<n?1:-1:ps(i),e)}}function Ho(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Zo(e,t,n,r,i,a,s,c,d,f){var h=8&t;t|=h?u:l,4&(t&=~(h?l:u))||(t&=-4);var p=[e,t,i,h?a:o,h?s:o,h?o:a,h?o:s,c,d,f],g=n.apply(o,p);return Ei(e)&&Pi(g,p),g.placeholder=r,Mi(g,e,t)}function Jo(e){var t=Ie[e];return function(e,n){if(e=ys(e),(n=null==n?0:An(gs(n),292))&&At(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yo=_n&&1/fn(new _n([,-0]))[1]==h?function(e){return new _n(e)}:uc;function Qo(e){return function(t){var n=mi(t);return n==T?un(t):n==R?hn(t):function(e,t){return Ot(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xo(e,t,n,a,h,p,g,m){var y=2&t;if(!y&&"function"!=typeof e)throw new Re(i);var w=a?a.length:0;if(w||(t&=-97,a=h=o),g=g===o?g:vn(gs(g),0),m=m===o?m:gs(m),w-=h?h.length:0,t&l){var v=a,A=h;a=h=o}var b=y?o:si(e),S=[e,t,n,a,h,v,A,p,g,m];if(b&&function(e,t){var n=e[1],r=t[1],o=n|r,i=o<131,a=r==d&&8==n||r==d&&n==f&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!i&&!a)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?Co(u,c,t[4]):c,e[4]=u?dn(e[3],s):t[4]}(c=t[5])&&(u=e[5],e[5]=u?Ro(u,c,t[6]):c,e[6]=u?dn(e[5],s):t[6]);(c=t[7])&&(e[7]=c);r&d&&(e[8]=null==e[8]?t[8]:An(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=o}(S,b),e=S[0],t=S[1],n=S[2],a=S[3],h=S[4],!(m=S[9]=S[9]===o?y?0:e.length:vn(S[9]-w,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||t==c?function(e,t,n){var i=Lo(e);return function a(){for(var s=arguments.length,c=r(s),u=s,l=ui(a);u--;)c[u]=arguments[u];var d=s<3&&c[0]!==l&&c[s-1]!==l?[]:dn(c,l);return(s-=d.length)<n?Zo(e,t,$o,a.placeholder,o,c,d,o,o,n-s):xt(this&&this!==gt&&this instanceof a?i:e,this,c)}}(e,t,m):t!=u&&33!=t||h.length?$o.apply(o,S):function(e,t,n,o){var i=1&t,a=Lo(e);return function t(){for(var s=-1,c=arguments.length,u=-1,l=o.length,d=r(l+c),f=this&&this!==gt&&this instanceof t?a:e;++u<l;)d[u]=o[u];for(;c--;)d[u++]=arguments[++s];return xt(f,i?n:this,d)}}(e,t,n,a);else var E=function(e,t,n){var r=1&t,o=Lo(e);return function t(){return(this&&this!==gt&&this instanceof t?o:e).apply(r?n:this,arguments)}}(e,t,n);return Mi((b?to:Pi)(E,S),e,t)}function ei(e,t,n,r){return e===o||Fa(e,Be[n])&&!ze.call(r,n)?t:e}function ti(e,t,n,r,i,a){return ts(e)&&ts(t)&&(a.set(t,e),Wr(e,t,o,ti,a),a.delete(t)),e}function ni(e){return is(e)?o:e}function ri(e,t,n,r,i,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Zn:o;for(a.set(e,t),a.set(t,e);++f<c;){var g=e[f],m=t[f];if(r)var y=s?r(m,g,f,t,e,a):r(g,m,f,e,t,a);if(y!==o){if(y)continue;h=!1;break}if(p){if(!Lt(t,(function(e,t){if(!tn(p,t)&&(g===e||i(g,e,n,r,a)))return p.push(t)}))){h=!1;break}}else if(g!==m&&!i(g,m,n,r,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function oi(e){return Bi(_i(e,o,Ki),e+"")}function ii(e){return Tr(e,Ns,pi)}function ai(e){return Tr(e,Bs,gi)}var si=Pn?function(e){return Pn.get(e)}:uc;function ci(e){for(var t=e.name+"",n=Nn[t],r=ze.call(Nn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function ui(e){return(ze.call(Fn,"placeholder")?Fn:e).placeholder}function li(){var e=Fn.iteratee||ic;return e=e===ic?zr:e,arguments.length?e(arguments[0],arguments[1]):e}function di(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function fi(e){for(var t=Ns(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Ii(o)]}return t}function hi(e,t){var n=function(e,t){return null==e?o:e[t]}(e,t);return Or(n)?n:o}var pi=yt?function(e){return null==e?[]:(e=xe(e),Nt(yt(e),(function(t){return Ze.call(e,t)})))}:mc,gi=yt?function(e){for(var t=[];e;)zt(t,pi(e)),e=Ge(e);return t}:mc,mi=Ir;function yi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var a=ji(t[r]);if(!(i=null!=e&&n(e,a)))break;e=e[a]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&es(o)&&Ai(a,o)&&(Va(e)||qa(e))}function wi(e){return"function"!=typeof e.constructor||Ti(e)?{}:$n(Ge(e))}function vi(e){return Va(e)||qa(e)||!!(Ye&&e&&e[Ye])}function Ai(e,t){var n=typeof e;return!!(t=null==t?p:t)&&("number"==n||"symbol"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!("number"==r?Ga(n)&&Ai(t,n.length):"string"==r&&t in n)&&Fa(n[t],e)}function Si(e,t){if(Va(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!us(e))||(ne.test(e)||!te.test(e)||null!=t&&e in xe(t))}function Ei(e){var t=ci(e),n=Fn[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=si(n);return!!r&&e===r[0]}(Tn&&mi(new Tn(new ArrayBuffer(1)))!=O||In&&mi(new In)!=T||xn&&mi(xn.resolve())!=_||_n&&mi(new _n)!=R||Cn&&mi(new Cn)!=B)&&(mi=function(e){var t=Ir(e),n=t==x?e.constructor:o,r=n?Li(n):"";if(r)switch(r){case Bn:return O;case Mn:return T;case On:return _;case zn:return R;case Un:return B}return t});var ki=Me?Qa:yc;function Ti(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Be)}function Ii(e){return e==e&&!ts(e)}function xi(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==o||e in xe(n)))}}function _i(e,t,n){return t=vn(t===o?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=vn(o.length-t,0),s=r(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=r(t+1);++i<t;)c[i]=o[i];return c[t]=n(s),xt(e,this,c)}}function Ci(e,t){return t.length<2?e:kr(e,oo(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Pi=Oi(to),Ni=ht||function(e,t){return gt.setTimeout(e,t)},Bi=Oi(no);function Mi(e,t,n){var r=t+"";return Bi(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ct(y,(function(n){var r="_."+n[0];t&n[1]&&!Bt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Oi(e){var t=0,n=0;return function(){var r=bn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function zi(e,t){var n=-1,r=e.length,i=r-1;for(t=t===o?r:t;++n<t;){var a=Zr(n,i),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var Ui=function(e){var t=Oa(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(re,(function(e,n,r,o){t.push(r?o.replace(he,"$1"):n||e)})),t}));function ji(e){if("string"==typeof e||us(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Li(e){if(null!=e){try{return Oe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Di(e){if(e instanceof Vn)return e.clone();var t=new qn(e.__wrapped__,e.__chain__);return t.__actions__=Po(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fi=Yr((function(e,t){return Ha(e)?fr(e,wr(t,1,Ha,!0)):[]})),$i=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,wr(t,1,Ha,!0),li(n,2)):[]})),Wi=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,wr(t,1,Ha,!0),o,n):[]}));function qi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=vn(r+o,0)),$t(e,li(t,3),o)}function Vi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return n!==o&&(i=gs(n),i=n<0?vn(r+i,0):An(i,r-1)),$t(e,li(t,3),i,!0)}function Ki(e){return(null==e?0:e.length)?wr(e,1):[]}function Gi(e){return e&&e.length?e[0]:o}var Hi=Yr((function(e){var t=Ot(e,vo);return t.length&&t[0]===e[0]?Rr(t):[]})),Zi=Yr((function(e){var t=Yi(e),n=Ot(e,vo);return t===Yi(n)?t=o:n.pop(),n.length&&n[0]===e[0]?Rr(n,li(t,2)):[]})),Ji=Yr((function(e){var t=Yi(e),n=Ot(e,vo);return(t="function"==typeof t?t:o)&&n.pop(),n.length&&n[0]===e[0]?Rr(n,o,t):[]}));function Yi(e){var t=null==e?0:e.length;return t?e[t-1]:o}var Qi=Yr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var ea=oi((function(e,t){var n=null==e?0:e.length,r=sr(e,t);return Hr(e,Ot(t,(function(e){return Ai(e,n)?+e:e})).sort(_o)),r}));function ta(e){return null==e?e:kn.call(e)}var na=Yr((function(e){return fo(wr(e,1,Ha,!0))})),ra=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),fo(wr(e,1,Ha,!0),li(t,2))})),oa=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,fo(wr(e,1,Ha,!0),o,t)}));function ia(e){if(!e||!e.length)return[];var t=0;return e=Nt(e,(function(e){if(Ha(e))return t=vn(e.length,t),!0})),Yt(t,(function(t){return Ot(e,Gt(t))}))}function aa(e,t){if(!e||!e.length)return[];var n=ia(e);return null==t?n:Ot(n,(function(e){return xt(t,o,e)}))}var sa=Yr((function(e,t){return Ha(e)?fr(e,t):[]})),ca=Yr((function(e){return yo(Nt(e,Ha))})),ua=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),yo(Nt(e,Ha),li(t,2))})),la=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,yo(Nt(e,Ha),o,t)})),da=Yr(ia);var fa=Yr((function(e){var t=e.length,n=t>1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,aa(e,n)}));function ha(e){var t=Fn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ga=oi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return sr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Vn&&Ai(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[i],thisArg:o}),new qn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(i)}));var ma=Bo((function(e,t,n){ze.call(e,n)?++e[n]:ar(e,n,1)}));var ya=Do(qi),wa=Do(Vi);function va(e,t){return(Va(e)?Ct:hr)(e,li(t,3))}function Aa(e,t){return(Va(e)?Rt:pr)(e,li(t,3))}var ba=Bo((function(e,t,n){ze.call(e,n)?e[n].push(t):ar(e,n,[t])}));var Sa=Yr((function(e,t,n){var o=-1,i="function"==typeof t,a=Ga(e)?r(e.length):[];return hr(e,(function(e){a[++o]=i?xt(t,e,n):Pr(e,t,n)})),a})),Ea=Bo((function(e,t,n){ar(e,n,t)}));function ka(e,t){return(Va(e)?Ot:Dr)(e,li(t,3))}var Ta=Bo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Ia=Yr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,wr(t,1),[])})),xa=lt||function(){return gt.Date.now()};function _a(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Xo(e,d,o,o,o,o,t)}function Ca(e,t){var n;if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Ra=Yr((function(e,t,n){var r=1;if(n.length){var o=dn(n,ui(Ra));r|=u}return Xo(e,r,t,n,o)})),Pa=Yr((function(e,t,n){var r=3;if(n.length){var o=dn(n,ui(Pa));r|=u}return Xo(t,r,e,n,o)}));function Na(e,t,n){var r,a,s,c,u,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof e)throw new Re(i);function g(t){var n=r,i=a;return r=a=o,d=t,c=e.apply(i,n)}function m(e){var n=e-l;return l===o||n>=t||n<0||h&&e-d>=s}function y(){var e=xa();if(m(e))return w(e);u=Ni(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function w(e){return u=o,p&&r?g(e):(r=a=o,c)}function v(){var e=xa(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===o)return function(e){return d=e,u=Ni(y,t),f?g(e):c}(l);if(h)return ko(u),u=Ni(y,t),g(l)}return u===o&&(u=Ni(y,t)),c}return t=ys(t)||0,ts(n)&&(f=!!n.leading,s=(h="maxWait"in n)?vn(ys(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),v.cancel=function(){u!==o&&ko(u),d=0,r=l=a=u=o},v.flush=function(){return u===o?c:w(xa())},v}var Ba=Yr((function(e,t){return dr(e,1,t)})),Ma=Yr((function(e,t,n){return dr(e,ys(t)||0,n)}));function Oa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Re(i);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Oa.Cache||Hn),n}function za(e){if("function"!=typeof e)throw new Re(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Oa.Cache=Hn;var Ua=So((function(e,t){var n=(t=1==t.length&&Va(t[0])?Ot(t[0],Xt(li())):Ot(wr(t,1),Xt(li()))).length;return Yr((function(r){for(var o=-1,i=An(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return xt(e,this,r)}))})),ja=Yr((function(e,t){var n=dn(t,ui(ja));return Xo(e,u,o,t,n)})),La=Yr((function(e,t){var n=dn(t,ui(La));return Xo(e,l,o,t,n)})),Da=oi((function(e,t){return Xo(e,f,o,o,o,t)}));function Fa(e,t){return e===t||e!=e&&t!=t}var $a=Ho(xr),Wa=Ho((function(e,t){return e>=t})),qa=Nr(function(){return arguments}())?Nr:function(e){return ns(e)&&ze.call(e,"callee")&&!Ze.call(e,"callee")},Va=r.isArray,Ka=bt?Xt(bt):function(e){return ns(e)&&Ir(e)==M};function Ga(e){return null!=e&&es(e.length)&&!Qa(e)}function Ha(e){return ns(e)&&Ga(e)}var Za=vt||yc,Ja=St?Xt(St):function(e){return ns(e)&&Ir(e)==b};function Ya(e){if(!ns(e))return!1;var t=Ir(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Qa(e){if(!ts(e))return!1;var t=Ir(e);return t==E||t==k||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==gs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=Et?Xt(Et):function(e){return ns(e)&&mi(e)==T};function os(e){return"number"==typeof e||ns(e)&&Ir(e)==I}function is(e){if(!ns(e)||Ir(e)!=x)return!1;var t=Ge(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==De}var as=kt?Xt(kt):function(e){return ns(e)&&Ir(e)==C};var ss=Tt?Xt(Tt):function(e){return ns(e)&&mi(e)==R};function cs(e){return"string"==typeof e||!Va(e)&&ns(e)&&Ir(e)==P}function us(e){return"symbol"==typeof e||ns(e)&&Ir(e)==N}var ls=It?Xt(It):function(e){return ns(e)&&es(e.length)&&!!ct[Ir(e)]};var ds=Ho(Lr),fs=Ho((function(e,t){return e<=t}));function hs(e){if(!e)return[];if(Ga(e))return cs(e)?gn(e):Po(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=mi(e);return(t==T?un:t==R?fn:Fs)(e)}function ps(e){return e?(e=ys(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function ms(e){return e?cr(gs(e),0,m):0}function ys(e){if("number"==typeof e)return e;if(us(e))return g;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qt(e);var n=ye.test(e);return n||ve.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function ws(e){return No(e,Bs(e))}function vs(e){return null==e?"":lo(e)}var As=Mo((function(e,t){if(Ti(t)||Ga(t))No(t,Ns(t),e);else for(var n in t)ze.call(t,n)&&nr(e,n,t[n])})),bs=Mo((function(e,t){No(t,Bs(t),e)})),Ss=Mo((function(e,t,n,r){No(t,Bs(t),e,r)})),Es=Mo((function(e,t,n,r){No(t,Ns(t),e,r)})),ks=oi(sr);var Ts=Yr((function(e,t){e=xe(e);var n=-1,r=t.length,i=r>2?t[2]:o;for(i&&bi(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],s=Bs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===o||Fa(d,Be[l])&&!ze.call(e,l))&&(e[l]=a[l])}return e})),Is=Yr((function(e){return e.push(o,ti),xt(Os,o,e)}));function xs(e,t,n){var r=null==e?o:kr(e,t);return r===o?n:r}function _s(e,t){return null!=e&&yi(e,t,Cr)}var Cs=Wo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Le.call(t)),e[t]=n}),tc(oc)),Rs=Wo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Le.call(t)),ze.call(e,t)?e[t].push(n):e[t]=[n]}),li),Ps=Yr(Pr);function Ns(e){return Ga(e)?Yn(e):Ur(e)}function Bs(e){return Ga(e)?Yn(e,!0):jr(e)}var Ms=Mo((function(e,t,n){Wr(e,t,n)})),Os=Mo((function(e,t,n,r){Wr(e,t,n,r)})),zs=oi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Ot(t,(function(t){return t=bo(t,e),r||(r=t.length>1),t})),No(e,ai(e),n),r&&(n=ur(n,7,ni));for(var o=t.length;o--;)ho(n,t[o]);return n}));var Us=oi((function(e,t){return null==e?{}:function(e,t){return Kr(e,t,(function(t,n){return _s(e,n)}))}(e,t)}));function js(e,t){if(null==e)return{};var n=Ot(ai(e),(function(e){return[e]}));return t=li(t),Kr(e,n,(function(e,n){return t(e,n[0])}))}var Ls=Qo(Ns),Ds=Qo(Bs);function Fs(e){return null==e?[]:en(e,Ns(e))}var $s=jo((function(e,t,n){return t=t.toLowerCase(),e+(n?Ws(t):t)}));function Ws(e){return Ys(vs(e).toLowerCase())}function qs(e){return(e=vs(e))&&e.replace(be,on).replace(tt,"")}var Vs=jo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ks=jo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gs=Uo("toLowerCase");var Hs=jo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Zs=jo((function(e,t,n){return e+(n?" ":"")+Ys(t)}));var Js=jo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ys=Uo("toUpperCase");function Qs(e,t,n){return e=vs(e),(t=n?o:t)===o?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Xs=Yr((function(e,t){try{return xt(e,o,t)}catch(e){return Ya(e)?e:new ke(e)}})),ec=oi((function(e,t){return Ct(t,(function(t){t=ji(t),ar(e,t,Ra(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Fo(),rc=Fo(!0);function oc(e){return e}function ic(e){return zr("function"==typeof e?e:ur(e,1))}var ac=Yr((function(e,t){return function(n){return Pr(n,e,t)}})),sc=Yr((function(e,t){return function(n){return Pr(e,n,t)}}));function cc(e,t,n){var r=Ns(t),o=Er(t,r);null!=n||ts(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Er(t,Ns(t)));var i=!(ts(n)&&"chain"in n&&!n.chain),a=Qa(e);return Ct(o,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Po(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,zt([this.value()],arguments))})})),e}function uc(){}var lc=Vo(Ot),dc=Vo(Pt),fc=Vo(Lt);function hc(e){return Si(e)?Gt(ji(e)):function(e){return function(t){return kr(t,e)}}(e)}var pc=Go(),gc=Go(!0);function mc(){return[]}function yc(){return!1}var wc=qo((function(e,t){return e+t}),0),vc=Jo("ceil"),Ac=qo((function(e,t){return e/t}),1),bc=Jo("floor");var Sc,Ec=qo((function(e,t){return e*t}),1),kc=Jo("round"),Tc=qo((function(e,t){return e-t}),0);return Fn.after=function(e,t){if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},Fn.ary=_a,Fn.assign=As,Fn.assignIn=bs,Fn.assignInWith=Ss,Fn.assignWith=Es,Fn.at=ks,Fn.before=Ca,Fn.bind=Ra,Fn.bindAll=ec,Fn.bindKey=Pa,Fn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Va(e)?e:[e]},Fn.chain=ha,Fn.chunk=function(e,t,n){t=(n?bi(e,t,n):t===o)?1:vn(gs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=r(pt(i/t));a<i;)c[s++]=oo(e,a,a+=t);return c},Fn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},Fn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return zt(Va(n)?Po(n):[n],wr(t,1))},Fn.cond=function(e){var t=null==e?0:e.length,n=li();return e=t?Ot(e,(function(e){if("function"!=typeof e[1])throw new Re(i);return[n(e[0]),e[1]]})):[],Yr((function(n){for(var r=-1;++r<t;){var o=e[r];if(xt(o[0],this,n))return xt(o[1],this,n)}}))},Fn.conforms=function(e){return function(e){var t=Ns(e);return function(n){return lr(n,e,t)}}(ur(e,1))},Fn.constant=tc,Fn.countBy=ma,Fn.create=function(e,t){var n=$n(e);return null==t?n:ir(n,t)},Fn.curry=function e(t,n,r){var i=Xo(t,8,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.curryRight=function e(t,n,r){var i=Xo(t,c,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.debounce=Na,Fn.defaults=Ts,Fn.defaultsDeep=Is,Fn.defer=Ba,Fn.delay=Ma,Fn.difference=Fi,Fn.differenceBy=$i,Fn.differenceWith=Wi,Fn.drop=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=n||t===o?1:gs(t))<0?0:t,r):[]},Fn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,0,(t=r-(t=n||t===o?1:gs(t)))<0?0:t):[]},Fn.dropRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0,!0):[]},Fn.dropWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0):[]},Fn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&bi(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=gs(n))<0&&(n=-n>i?0:i+n),(r=r===o||r>i?i:gs(r))<0&&(r+=i),r=n>r?0:ms(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Fn.filter=function(e,t){return(Va(e)?Nt:yr)(e,li(t,3))},Fn.flatMap=function(e,t){return wr(ka(e,t),1)},Fn.flatMapDeep=function(e,t){return wr(ka(e,t),h)},Fn.flatMapDepth=function(e,t,n){return n=n===o?1:gs(n),wr(ka(e,t),n)},Fn.flatten=Ki,Fn.flattenDeep=function(e){return(null==e?0:e.length)?wr(e,h):[]},Fn.flattenDepth=function(e,t){return(null==e?0:e.length)?wr(e,t=t===o?1:gs(t)):[]},Fn.flip=function(e){return Xo(e,512)},Fn.flow=nc,Fn.flowRight=rc,Fn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},Fn.functions=function(e){return null==e?[]:Er(e,Ns(e))},Fn.functionsIn=function(e){return null==e?[]:Er(e,Bs(e))},Fn.groupBy=ba,Fn.initial=function(e){return(null==e?0:e.length)?oo(e,0,-1):[]},Fn.intersection=Hi,Fn.intersectionBy=Zi,Fn.intersectionWith=Ji,Fn.invert=Cs,Fn.invertBy=Rs,Fn.invokeMap=Sa,Fn.iteratee=ic,Fn.keyBy=Ea,Fn.keys=Ns,Fn.keysIn=Bs,Fn.map=ka,Fn.mapKeys=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,t(e,r,o),e)})),n},Fn.mapValues=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,r,t(e,r,o))})),n},Fn.matches=function(e){return Fr(ur(e,1))},Fn.matchesProperty=function(e,t){return $r(e,ur(t,1))},Fn.memoize=Oa,Fn.merge=Ms,Fn.mergeWith=Os,Fn.method=ac,Fn.methodOf=sc,Fn.mixin=cc,Fn.negate=za,Fn.nthArg=function(e){return e=gs(e),Yr((function(t){return qr(t,e)}))},Fn.omit=zs,Fn.omitBy=function(e,t){return js(e,za(li(t)))},Fn.once=function(e){return Ca(2,e)},Fn.orderBy=function(e,t,n,r){return null==e?[]:(Va(t)||(t=null==t?[]:[t]),Va(n=r?o:n)||(n=null==n?[]:[n]),Vr(e,t,n))},Fn.over=lc,Fn.overArgs=Ua,Fn.overEvery=dc,Fn.overSome=fc,Fn.partial=ja,Fn.partialRight=La,Fn.partition=Ta,Fn.pick=Us,Fn.pickBy=js,Fn.property=hc,Fn.propertyOf=function(e){return function(t){return null==e?o:kr(e,t)}},Fn.pull=Qi,Fn.pullAll=Xi,Fn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,li(n,2)):e},Fn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,o,n):e},Fn.pullAt=ea,Fn.range=pc,Fn.rangeRight=gc,Fn.rearg=Da,Fn.reject=function(e,t){return(Va(e)?Nt:yr)(e,za(li(t,3)))},Fn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=li(t,3);++r<i;){var a=e[r];t(a,r,e)&&(n.push(a),o.push(r))}return Hr(e,o),n},Fn.rest=function(e,t){if("function"!=typeof e)throw new Re(i);return Yr(e,t=t===o?t:gs(t))},Fn.reverse=ta,Fn.sampleSize=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),(Va(e)?Xn:Xr)(e,t)},Fn.set=function(e,t,n){return null==e?e:eo(e,t,n)},Fn.setWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:eo(e,t,n,r)},Fn.shuffle=function(e){return(Va(e)?er:ro)(e)},Fn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&bi(e,t,n)?(t=0,n=r):(t=null==t?0:gs(t),n=n===o?r:gs(n)),oo(e,t,n)):[]},Fn.sortBy=Ia,Fn.sortedUniq=function(e){return e&&e.length?co(e):[]},Fn.sortedUniqBy=function(e,t){return e&&e.length?co(e,li(t,2)):[]},Fn.split=function(e,t,n){return n&&"number"!=typeof n&&bi(e,t,n)&&(t=n=o),(n=n===o?m:n>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=lo(t))&&cn(e)?Eo(gn(e),0,n):e.split(t,n):[]},Fn.spread=function(e,t){if("function"!=typeof e)throw new Re(i);return t=null==t?0:vn(gs(t),0),Yr((function(n){var r=n[t],o=Eo(n,0,t);return r&&zt(o,r),xt(e,this,o)}))},Fn.tail=function(e){var t=null==e?0:e.length;return t?oo(e,1,t):[]},Fn.take=function(e,t,n){return e&&e.length?oo(e,0,(t=n||t===o?1:gs(t))<0?0:t):[]},Fn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=r-(t=n||t===o?1:gs(t)))<0?0:t,r):[]},Fn.takeRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!1,!0):[]},Fn.takeWhile=function(e,t){return e&&e.length?go(e,li(t,3)):[]},Fn.tap=function(e,t){return t(e),e},Fn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Re(i);return ts(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Na(e,t,{leading:r,maxWait:t,trailing:o})},Fn.thru=pa,Fn.toArray=hs,Fn.toPairs=Ls,Fn.toPairsIn=Ds,Fn.toPath=function(e){return Va(e)?Ot(e,ji):us(e)?[e]:Po(Ui(vs(e)))},Fn.toPlainObject=ws,Fn.transform=function(e,t,n){var r=Va(e),o=r||Za(e)||ls(e);if(t=li(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ts(e)&&Qa(i)?$n(Ge(e)):{}}return(o?Ct:br)(e,(function(e,r,o){return t(n,e,r,o)})),n},Fn.unary=function(e){return _a(e,1)},Fn.union=na,Fn.unionBy=ra,Fn.unionWith=oa,Fn.uniq=function(e){return e&&e.length?fo(e):[]},Fn.uniqBy=function(e,t){return e&&e.length?fo(e,li(t,2)):[]},Fn.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?fo(e,o,t):[]},Fn.unset=function(e,t){return null==e||ho(e,t)},Fn.unzip=ia,Fn.unzipWith=aa,Fn.update=function(e,t,n){return null==e?e:po(e,t,Ao(n))},Fn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:po(e,t,Ao(n),r)},Fn.values=Fs,Fn.valuesIn=function(e){return null==e?[]:en(e,Bs(e))},Fn.without=sa,Fn.words=Qs,Fn.wrap=function(e,t){return ja(Ao(t),e)},Fn.xor=ca,Fn.xorBy=ua,Fn.xorWith=la,Fn.zip=da,Fn.zipObject=function(e,t){return wo(e||[],t||[],nr)},Fn.zipObjectDeep=function(e,t){return wo(e||[],t||[],eo)},Fn.zipWith=fa,Fn.entries=Ls,Fn.entriesIn=Ds,Fn.extend=bs,Fn.extendWith=Ss,cc(Fn,Fn),Fn.add=wc,Fn.attempt=Xs,Fn.camelCase=$s,Fn.capitalize=Ws,Fn.ceil=vc,Fn.clamp=function(e,t,n){return n===o&&(n=t,t=o),n!==o&&(n=(n=ys(n))==n?n:0),t!==o&&(t=(t=ys(t))==t?t:0),cr(ys(e),t,n)},Fn.clone=function(e){return ur(e,4)},Fn.cloneDeep=function(e){return ur(e,5)},Fn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:o)},Fn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:o)},Fn.conformsTo=function(e,t){return null==t||lr(e,t,Ns(t))},Fn.deburr=qs,Fn.defaultTo=function(e,t){return null==e||e!=e?t:e},Fn.divide=Ac,Fn.endsWith=function(e,t,n){e=vs(e),t=lo(t);var r=e.length,i=n=n===o?r:cr(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Fn.eq=Fa,Fn.escape=function(e){return(e=vs(e))&&Y.test(e)?e.replace(Z,an):e},Fn.escapeRegExp=function(e){return(e=vs(e))&&ie.test(e)?e.replace(oe,"\\$&"):e},Fn.every=function(e,t,n){var r=Va(e)?Pt:gr;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.find=ya,Fn.findIndex=qi,Fn.findKey=function(e,t){return Ft(e,li(t,3),br)},Fn.findLast=wa,Fn.findLastIndex=Vi,Fn.findLastKey=function(e,t){return Ft(e,li(t,3),Sr)},Fn.floor=bc,Fn.forEach=va,Fn.forEachRight=Aa,Fn.forIn=function(e,t){return null==e?e:vr(e,li(t,3),Bs)},Fn.forInRight=function(e,t){return null==e?e:Ar(e,li(t,3),Bs)},Fn.forOwn=function(e,t){return e&&br(e,li(t,3))},Fn.forOwnRight=function(e,t){return e&&Sr(e,li(t,3))},Fn.get=xs,Fn.gt=$a,Fn.gte=Wa,Fn.has=function(e,t){return null!=e&&yi(e,t,_r)},Fn.hasIn=_s,Fn.head=Gi,Fn.identity=oc,Fn.includes=function(e,t,n,r){e=Ga(e)?e:Fs(e),n=n&&!r?gs(n):0;var o=e.length;return n<0&&(n=vn(o+n,0)),cs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Wt(e,t,n)>-1},Fn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=vn(r+o,0)),Wt(e,t,o)},Fn.inRange=function(e,t,n){return t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n){return e>=An(t,n)&&e<vn(t,n)}(e=ys(e),t,n)},Fn.invoke=Ps,Fn.isArguments=qa,Fn.isArray=Va,Fn.isArrayBuffer=Ka,Fn.isArrayLike=Ga,Fn.isArrayLikeObject=Ha,Fn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Ir(e)==A},Fn.isBuffer=Za,Fn.isDate=Ja,Fn.isElement=function(e){return ns(e)&&1===e.nodeType&&!is(e)},Fn.isEmpty=function(e){if(null==e)return!0;if(Ga(e)&&(Va(e)||"string"==typeof e||"function"==typeof e.splice||Za(e)||ls(e)||qa(e)))return!e.length;var t=mi(e);if(t==T||t==R)return!e.size;if(Ti(e))return!Ur(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0},Fn.isEqual=function(e,t){return Br(e,t)},Fn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:o)?n(e,t):o;return r===o?Br(e,t,o,n):!!r},Fn.isError=Ya,Fn.isFinite=function(e){return"number"==typeof e&&At(e)},Fn.isFunction=Qa,Fn.isInteger=Xa,Fn.isLength=es,Fn.isMap=rs,Fn.isMatch=function(e,t){return e===t||Mr(e,t,fi(t))},Fn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,Mr(e,t,fi(t),n)},Fn.isNaN=function(e){return os(e)&&e!=+e},Fn.isNative=function(e){if(ki(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},Fn.isNil=function(e){return null==e},Fn.isNull=function(e){return null===e},Fn.isNumber=os,Fn.isObject=ts,Fn.isObjectLike=ns,Fn.isPlainObject=is,Fn.isRegExp=as,Fn.isSafeInteger=function(e){return Xa(e)&&e>=-9007199254740991&&e<=p},Fn.isSet=ss,Fn.isString=cs,Fn.isSymbol=us,Fn.isTypedArray=ls,Fn.isUndefined=function(e){return e===o},Fn.isWeakMap=function(e){return ns(e)&&mi(e)==B},Fn.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Ir(e)},Fn.join=function(e,t){return null==e?"":Dt.call(e,t)},Fn.kebabCase=Vs,Fn.last=Yi,Fn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return n!==o&&(i=(i=gs(n))<0?vn(r+i,0):An(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):$t(e,Vt,i,!0)},Fn.lowerCase=Ks,Fn.lowerFirst=Gs,Fn.lt=ds,Fn.lte=fs,Fn.max=function(e){return e&&e.length?mr(e,oc,xr):o},Fn.maxBy=function(e,t){return e&&e.length?mr(e,li(t,2),xr):o},Fn.mean=function(e){return Kt(e,oc)},Fn.meanBy=function(e,t){return Kt(e,li(t,2))},Fn.min=function(e){return e&&e.length?mr(e,oc,Lr):o},Fn.minBy=function(e,t){return e&&e.length?mr(e,li(t,2),Lr):o},Fn.stubArray=mc,Fn.stubFalse=yc,Fn.stubObject=function(){return{}},Fn.stubString=function(){return""},Fn.stubTrue=function(){return!0},Fn.multiply=Ec,Fn.nth=function(e,t){return e&&e.length?qr(e,gs(t)):o},Fn.noConflict=function(){return gt._===this&&(gt._=Fe),this},Fn.noop=uc,Fn.now=xa,Fn.pad=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Ko(mt(o),n)+e+Ko(pt(o),n)},Fn.padEnd=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?e+Ko(t-r,n):e},Fn.padStart=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?Ko(t-r,n)+e:e},Fn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Sn(vs(e).replace(ae,""),t||0)},Fn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&bi(e,t,n)&&(t=n=o),n===o&&("boolean"==typeof t?(n=t,t=o):"boolean"==typeof e&&(n=e,e=o)),e===o&&t===o?(e=0,t=1):(e=ps(e),t===o?(t=e,e=0):t=ps(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=En();return An(e+i*(t-e+dt("1e-"+((i+"").length-1))),t)}return Zr(e,t)},Fn.reduce=function(e,t,n){var r=Va(e)?Ut:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,hr)},Fn.reduceRight=function(e,t,n){var r=Va(e)?jt:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,pr)},Fn.repeat=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),Jr(vs(e),t)},Fn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fn.result=function(e,t,n){var r=-1,i=(t=bo(t,e)).length;for(i||(i=1,e=o);++r<i;){var a=null==e?o:e[ji(t[r])];a===o&&(r=i,a=n),e=Qa(a)?a.call(e):a}return e},Fn.round=kc,Fn.runInContext=e,Fn.sample=function(e){return(Va(e)?Qn:Qr)(e)},Fn.size=function(e){if(null==e)return 0;if(Ga(e))return cs(e)?pn(e):e.length;var t=mi(e);return t==T||t==R?e.size:Ur(e).length},Fn.snakeCase=Hs,Fn.some=function(e,t,n){var r=Va(e)?Lt:io;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.sortedIndex=function(e,t){return ao(e,t)},Fn.sortedIndexBy=function(e,t,n){return so(e,t,li(n,2))},Fn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ao(e,t);if(r<n&&Fa(e[r],t))return r}return-1},Fn.sortedLastIndex=function(e,t){return ao(e,t,!0)},Fn.sortedLastIndexBy=function(e,t,n){return so(e,t,li(n,2),!0)},Fn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=ao(e,t,!0)-1;if(Fa(e[n],t))return n}return-1},Fn.startCase=Zs,Fn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:cr(gs(n),0,e.length),t=lo(t),e.slice(n,n+t.length)==t},Fn.subtract=Tc,Fn.sum=function(e){return e&&e.length?Jt(e,oc):0},Fn.sumBy=function(e,t){return e&&e.length?Jt(e,li(t,2)):0},Fn.template=function(e,t,n){var r=Fn.templateSettings;n&&bi(e,t,n)&&(t=o),e=vs(e),t=Ss({},t,r,ei);var i,a,s=Ss({},t.imports,r.imports,ei),c=Ns(s),u=en(s,c),l=0,d=t.interpolate||Se,f="__p += '",h=_e((t.escape||Se).source+"|"+d.source+"|"+(d===ee?pe:Se).source+"|"+(t.evaluate||Se).source+"|$","g"),p="//# sourceURL="+(ze.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++st+"]")+"\n";e.replace(h,(function(t,n,r,o,s,c){return r||(r=o),f+=e.slice(l,c).replace(Ee,sn),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(a=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var g=ze.call(t,"variable")&&t.variable;if(g){if(fe.test(g))throw new ke("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(a?f.replace(V,""):f).replace(K,"$1").replace(G,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Xs((function(){return Te(c,p+"return "+f).apply(o,u)}));if(m.source=f,Ya(m))throw m;return m},Fn.times=function(e,t){if((e=gs(e))<1||e>p)return[];var n=m,r=An(e,m);t=li(t),e-=m;for(var o=Yt(r,t);++n<e;)t(n);return o},Fn.toFinite=ps,Fn.toInteger=gs,Fn.toLength=ms,Fn.toLower=function(e){return vs(e).toLowerCase()},Fn.toNumber=ys,Fn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},Fn.toString=vs,Fn.toUpper=function(e){return vs(e).toUpperCase()},Fn.trim=function(e,t,n){if((e=vs(e))&&(n||t===o))return Qt(e);if(!e||!(t=lo(t)))return e;var r=gn(e),i=gn(t);return Eo(r,nn(r,i),rn(r,i)+1).join("")},Fn.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===o))return e.slice(0,mn(e)+1);if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,0,rn(r,gn(t))+1).join("")},Fn.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===o))return e.replace(ae,"");if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,nn(r,gn(t))).join("")},Fn.truncate=function(e,t){var n=30,r="...";if(ts(t)){var i="separator"in t?t.separator:i;n="length"in t?gs(t.length):n,r="omission"in t?lo(t.omission):r}var a=(e=vs(e)).length;if(cn(e)){var s=gn(e);a=s.length}if(n>=a)return e;var c=n-pn(r);if(c<1)return r;var u=s?Eo(s,0,c).join(""):e.slice(0,c);if(i===o)return u+r;if(s&&(c+=u.length-c),as(i)){if(e.slice(c).search(i)){var l,d=u;for(i.global||(i=_e(i.source,vs(ge.exec(i))+"g")),i.lastIndex=0;l=i.exec(d);)var f=l.index;u=u.slice(0,f===o?c:f)}}else if(e.indexOf(lo(i),c)!=c){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Fn.unescape=function(e){return(e=vs(e))&&J.test(e)?e.replace(H,yn):e},Fn.uniqueId=function(e){var t=++Ue;return vs(e)+t},Fn.upperCase=Js,Fn.upperFirst=Ys,Fn.each=va,Fn.eachRight=Aa,Fn.first=Gi,cc(Fn,(Sc={},br(Fn,(function(e,t){ze.call(Fn.prototype,t)||(Sc[t]=e)})),Sc),{chain:!1}),Fn.VERSION="4.17.21",Ct(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Fn[e].placeholder=Fn})),Ct(["drop","take"],(function(e,t){Vn.prototype[e]=function(n){n=n===o?1:vn(gs(n),0);var r=this.__filtered__&&!t?new Vn(this):this.clone();return r.__filtered__?r.__takeCount__=An(n,r.__takeCount__):r.__views__.push({size:An(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ct(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:li(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ct(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}})),Ct(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}})),Vn.prototype.compact=function(){return this.filter(oc)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Yr((function(e,t){return"function"==typeof e?new Vn(this):this.map((function(n){return Pr(n,e,t)}))})),Vn.prototype.reject=function(e){return this.filter(za(li(e)))},Vn.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(m)},br(Vn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Fn[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(Fn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Vn,u=s[0],l=c||Va(t),d=function(e){var t=i.apply(Fn,zt([e],s));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=a&&!f,g=c&&!h;if(!a&&l){t=g?t:new Vn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:o}),new qn(m,f)}return p&&g?e.apply(this,s):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),Ct(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Fn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Va(o)?o:[],e)}return this[n]((function(n){return t.apply(Va(n)?n:[],e)}))}})),br(Vn.prototype,(function(e,t){var n=Fn[t];if(n){var r=n.name+"";ze.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[$o(o,2).name]=[{name:"wrapper",func:o}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Po(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Po(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Po(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Va(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=An(t,e+a);break;case"takeRight":e=vn(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=i.start,s=i.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,f=0,h=An(c,this.__takeCount__);if(!n||!r&&o==c&&h==c)return mo(e,this.__actions__);var p=[];e:for(;c--&&f<h;){for(var g=-1,m=e[u+=t];++g<d;){var y=l[g],w=y.iteratee,v=y.type,A=w(m);if(2==v)m=A;else if(!A){if(1==v)continue e;break e}}p[f++]=m}return p},Fn.prototype.at=ga,Fn.prototype.chain=function(){return ha(this)},Fn.prototype.commit=function(){return new qn(this.value(),this.__chain__)},Fn.prototype.next=function(){this.__values__===o&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},Fn.prototype.plant=function(e){for(var t,n=this;n instanceof Wn;){var r=Di(n);r.__index__=0,r.__values__=o,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Fn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:o}),new qn(t,this.__chain__)}return this.thru(ta)},Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=function(){return mo(this.__wrapped__,this.__actions__)},Fn.prototype.first=Fn.prototype.head,Qe&&(Fn.prototype[Qe]=function(){return this}),Fn}();gt._=wn,(r=function(){return wn}.call(t,n,t,e))===o||(e.exports=r)}.call(this)},5276:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},5288:(e,t,n)=>{var r=n(358),o=n(7200),i=n(6529);e.exports=function(e){return i(e)?r(e,!0):o(e)}},5353:(e,t,n)=>{var r=n(8638);e.exports=function(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,r(e,128,void 0,void 0,void 0,void 0,t)}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},5512:(e,t,n)=>{var r=n(4943),o=n(3316)(r);e.exports=o},5568:e=>{e.exports=function(e,t){return e.has(t)}},5620:(e,t,n)=>{var r=n(8788),o=n(9141),i=n(796),a=n(33);e.exports=function(e,t,n){var s=t+"";return i(e,o(s,a(r(s),n)))}},5650:(e,t,n)=>{var r=n(8942).Symbol;e.exports=r},5681:(e,t,n)=>{var r=n(4700);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},5755:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=-1,c=r.length,u=-1,l=n.length,d=t(a-c,0),f=Array(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=n[u];for(;++s<c;)(h||i<a)&&(f[p+r[s]]=e[i++]);return f}},5832:(e,t,n)=>{var r=n(1129),o=n(4784),i=n(7979),a=n(9306),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:a;e.exports=s},5853:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=n(4772),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,s=a&&a.exports===i?r.Buffer:void 0,c=(s?s.isBuffer:void 0)||o;e.exports=c},5857:(e,t,n)=>{var r=n(313);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},5894:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},5899:(e,t,n)=>{var r=n(3526),o=n(3283),i=n(3142),a=n(9632),s=n(5387),c=n(6040);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,d=!1;++u<l;){var f=c(t[u]);if(!(d=null!=e&&n(e,f)))break;e=e[f]}return d||++u!=l?d:!!(l=null==e?0:e.length)&&s(l)&&a(f,l)&&(i(e)||o(e))}},5962:e=>{e.exports=function(){}},5964:(e,t,n)=>{var r=n(9747),o=n(4784),i=n(4882);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},6027:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},6040:(e,t,n)=>{var r=n(1187);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},6065:(e,t,n)=>{var r=n(9270),o=r&&new r;e.exports=o},6123:(e,t,n)=>{var r=n(7923);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},6131:(e,t,n)=>{var r=n(6403),o=n(1580),i=n(1187),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):a.test(e)?NaN:+e}},6137:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},6285:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},6341:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(8942);e.exports=function(e,t,n,a){var s=1&t,c=o(e);return function t(){for(var o=-1,u=arguments.length,l=-1,d=a.length,f=Array(d+u),h=this&&this!==i&&this instanceof t?c:e;++l<d;)f[l]=a[l];for(;u--;)f[l++]=arguments[++o];return r(h,s?n:this,f)}}},6403:(e,t,n)=>{var r=n(2945),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},6465:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},6493:(e,t,n)=>{var r=n(6853),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=a},6526:(e,t,n)=>{var r=n(8330),o=n(4367),i=n(3904);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},6529:(e,t,n)=>{var r=n(3655),o=n(5387);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},6591:(e,t,n)=>{var r=n(4354),o=n(9632),i=Math.min;e.exports=function(e,t){for(var n=e.length,a=i(t.length,n),s=r(e);a--;){var c=t[a];e[a]=o(c,n)?s[c]:void 0}return e}},6638:(e,t,n)=>{var r=n(1386),o=n(9770),i=n(8250);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},6648:(e,t,n)=>{var r=n(7553),o=n(5196),i=n(961),a=n(3321);e.exports=function(e){var t=i(e),n=a[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;var s=o(n);return!!s&&e===s[0]}},6713:(e,t,n)=>{var r=n(4364),o=n(8942);e.exports=function(e,t,n){var i=1&t,a=r(e);return function t(){return(this&&this!==o&&this instanceof t?a:e).apply(i?n:this,arguments)}}},6850:e=>{e.exports=function(e){return e.placeholder}},6853:(e,t,n)=>{var r=n(9011);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},6912:e=>{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},7028:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(8813),a="__lodash_placeholder__",s=128,c=Math.min;e.exports=function(e,t){var n=e[1],u=t[1],l=n|u,d=l<131,f=u==s&&8==n||u==s&&256==n&&e[7].length<=t[8]||384==u&&t[7].length<=t[8]&&8==n;if(!d&&!f)return e;1&u&&(e[2]=t[2],l|=1&n?0:4);var h=t[3];if(h){var p=e[3];e[3]=p?r(p,h,t[4]):h,e[4]=p?i(e[3],a):t[4]}return(h=t[5])&&(p=e[5],e[5]=p?o(p,h,t[6]):h,e[6]=p?i(e[5],a):t[6]),(h=t[7])&&(e[7]=h),u&s&&(e[8]=null==e[8]?t[8]:c(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l,e}},7034:(e,t,n)=>{var r=n(6285);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},7073:(e,t,n)=>{var r=n(2532);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},7099:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},7144:(e,t,n)=>{var r=n(7034);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},7200:(e,t,n)=>{var r=n(1580),o=n(4882),i=n(8546),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},7250:e=>{e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},7267:(e,t,n)=>{var r=n(1580);e.exports=function(e){return e==e&&!r(e)}},7276:(e,t,n)=>{var r=n(3636),o=n(5899);e.exports=function(e,t){return null!=e&&o(e,t,r)}},7336:(e,t,n)=>{var r=n(8638);function o(e,t,n){var i=r(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=o.placeholder,i}o.placeholder={},e.exports=o},7350:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},7379:(e,t,n)=>{var r=n(5650),o=n(8870),i=n(9005),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},7403:(e,t,n)=>{var r=n(2619),o=n(2532),i=n(2053),a=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=a},7452:(e,t,n)=>{var r=n(7034);e.exports=function(e){return r(this.__data__,e)>-1}},7462:e=>{e.exports=function(e){return this.__data__.has(e)}},7553:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},7642:(e,t,n)=>{var r=n(3301);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},7681:(e,t,n)=>{var r=n(777),o=n(9460),i=n(2306),a=i&&i.isMap,s=a?o(a):r;e.exports=s},7706:e=>{e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},7769:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object WeakMap]"==r(e)}},7923:(e,t,n)=>{var r=n(3526),o=n(6040);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},7930:(e,t,n)=>{var r=n(9032),o=n(1211);e.exports=function(e,t){return e&&r(t,o(t),e)}},7979:(e,t,n)=>{var r=n(9847),o=n(9306),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),r(a(e),(function(t){return i.call(e,t)})))}:o;e.exports=s},7991:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,u=r-o;s<u;s+=a)i.push(c(e,s,s+a>u?u:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(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 c(e,t,r){for(var o,i,a=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8006:e=>{e.exports=function(e){return this.__data__.has(e)}},8055:(e,t,n)=>{e.exports={ary:n(5353),assign:n(7930),clone:n(2846),curry:n(7336),forEach:n(9968),isArray:n(3142),isError:n(441),isFunction:n(3655),isWeakMap:n(7769),iteratee:n(2590),keys:n(195),rearg:n(864),toInteger:n(7642),toPath:n(2613)}},8069:(e,t,n)=>{var r=n(5650),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},8121:(e,t,n)=>{var r=n(3766)(Object.keys,Object);e.exports=r},8244:(e,t,n)=>{var r=n(1129),o=n(3142);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},8250:(e,t,n)=>{var r=n(9753),o=n(5681),i=n(88),a=n(4732),s=n(9068);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},8330:(e,t,n)=>{var r=n(1340),o=n(4687);e.exports=function(e,t,n,i){var a=n.length,s=a,c=!i;if(null==e)return!s;for(e=Object(e);a--;){var u=n[a];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a<s;){var l=(u=n[a])[0],d=e[l],f=u[1];if(c&&u[2]){if(void 0===d&&!(l in e))return!1}else{var h=new r;if(i)var p=i(d,f,l,e,t,h);if(!(void 0===p?o(f,d,3,i,h):p))return!1}}return!0}},8340:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},8360:(e,t,n)=>{var r=n(7379),o=n(4784),i=n(547),a=Function.prototype,s=Object.prototype,c=a.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},8486:(e,t,n)=>{var r=n(3103),o=n(9770),i=n(9413),a=n(4512),s=n(9270),c=n(7379),u=n(4066),l="[object Map]",d="[object Promise]",f="[object Set]",h="[object WeakMap]",p="[object DataView]",g=u(r),m=u(o),y=u(i),w=u(a),v=u(s),A=c;(r&&A(new r(new ArrayBuffer(1)))!=p||o&&A(new o)!=l||i&&A(i.resolve())!=d||a&&A(new a)!=f||s&&A(new s)!=h)&&(A=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case g:return p;case m:return l;case y:return d;case w:return f;case v:return h}return t}),e.exports=A},8546:e=>{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},8638:(e,t,n)=>{var r=n(4943),o=n(6713),i=n(2443),a=n(3504),s=n(6341),c=n(5196),u=n(7028),l=n(5512),d=n(5620),f=n(7642),h=Math.max;e.exports=function(e,t,n,p,g,m,y,w){var v=2&t;if(!v&&"function"!=typeof e)throw new TypeError("Expected a function");var A=p?p.length:0;if(A||(t&=-97,p=g=void 0),y=void 0===y?y:h(f(y),0),w=void 0===w?w:f(w),A-=g?g.length:0,64&t){var b=p,S=g;p=g=void 0}var E=v?void 0:c(e),k=[e,t,n,p,g,b,S,m,y,w];if(E&&u(k,E),e=k[0],t=k[1],n=k[2],p=k[3],g=k[4],!(w=k[9]=void 0===k[9]?v?0:e.length:h(k[9]-A,0))&&24&t&&(t&=-25),t&&1!=t)T=8==t||16==t?i(e,t,w):32!=t&&33!=t||g.length?a.apply(void 0,k):s(e,t,n,p);else var T=o(e,t,n);return d((E?r:l)(T,k),e,t)}},8666:(e,t,n)=>{var r=n(674),o=n(9460),i=n(2306),a=i&&i.isTypedArray,s=a?o(a):r;e.exports=s},8788:e=>{var t=/\{\n\/\* \[wrapped with (.+)\] \*/,n=/,? & /;e.exports=function(e){var r=e.match(t);return r?r[1].split(n):[]}},8813:e=>{var t="__lodash_placeholder__";e.exports=function(e,n){for(var r=-1,o=e.length,i=0,a=[];++r<o;){var s=e[r];s!==n&&s!==t||(e[r]=t,a[i++]=r)}return a}},8861:(e,t,n)=>{var r=n(5650),o=n(1623),i=n(6285),a=n(3934),s=n(5894),c=n(9828),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,d,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var p=1&r;if(h||(h=c),e.size!=t.size&&!p)return!1;var g=f.get(e);if(g)return g==t;r|=2,f.set(e,t);var m=a(h(e),h(t),r,u,d,f);return f.delete(e),m;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},8870:(e,t,n)=>{var r=n(5650),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[s]=n:delete e[s]),o}},8880:(e,t,n)=>{var r=n(7923);e.exports=function(e){return function(t){return r(t,e)}}},8898:(e,t,n)=>{var r=n(1623);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},8942:(e,t,n)=>{var r=n(4967),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9011:(e,t,n)=>{var r=n(8250);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},9032:(e,t,n)=>{var r=n(3422),o=n(7073);e.exports=function(e,t,n,i){var a=!n;n||(n={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=i?i(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),a?o(n,u,l):r(n,u,l)}return n}},9067:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},9068:(e,t,n)=>{var r=n(4700);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},9071:e=>{e.exports=function(){}},9141:e=>{var t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,n){var r=n.length;if(!r)return e;var o=r-1;return n[o]=(r>1?"& ":"")+n[o],n=n.join(r>2?", ":" "),e.replace(t,"{\n/* [wrapped with "+n+"] */\n")}},9270:(e,t,n)=>{var r=n(4715)(n(8942),"WeakMap");e.exports=r},9306:e=>{e.exports=function(){return[]}},9318:(e,t)=>{t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=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*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*g}},9334:(e,t,n)=>{var r=n(1340),o=n(9968),i=n(3422),a=n(7930),s=n(125),c=n(7099),u=n(4354),l=n(3546),d=n(4733),f=n(393),h=n(3650),p=n(8486),g=n(7350),m=n(424),y=n(5964),w=n(3142),v=n(5853),A=n(7681),b=n(1580),S=n(3943),E=n(1211),k=n(5288),T="[object Arguments]",I="[object Function]",x="[object Object]",_={};_[T]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object DataView]"]=_["[object Boolean]"]=_["[object Date]"]=_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Map]"]=_["[object Number]"]=_[x]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object Symbol]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_["[object Error]"]=_[I]=_["[object WeakMap]"]=!1,e.exports=function e(t,n,C,R,P,N){var B,M=1&n,O=2&n,z=4&n;if(C&&(B=P?C(t,R,P,N):C(t)),void 0!==B)return B;if(!b(t))return t;var U=w(t);if(U){if(B=g(t),!M)return u(t,B)}else{var j=p(t),L=j==I||"[object GeneratorFunction]"==j;if(v(t))return c(t,M);if(j==x||j==T||L&&!P){if(B=O||L?{}:y(t),!M)return O?d(t,s(B,t)):l(t,a(B,t))}else{if(!_[j])return P?t:{};B=m(t,j,M)}}N||(N=new r);var D=N.get(t);if(D)return D;N.set(t,B),S(t)?t.forEach((function(r){B.add(e(r,n,C,r,t,N))})):A(t)&&t.forEach((function(r,o){B.set(o,e(r,n,C,o,t,N))}));var F=U?void 0:(z?O?h:f:O?k:E)(t);return o(F||t,(function(r,o){F&&(r=t[o=r]),i(B,o,e(r,n,C,o,t,N))})),B}},9361:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},9413:(e,t,n)=>{var r=n(4715)(n(8942),"Promise");e.exports=r},9454:e=>{e.exports=function(e){return e!=e}},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},9624:(e,t,n)=>{var r=n(3655),o=n(4759),i=n(1580),a=n(4066),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,d=u.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?f:s).test(a(e))}},9632:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n}},9747:(e,t,n)=>{var r=n(1580),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},9753:(e,t,n)=>{var r=n(5098),o=n(1386),i=n(9770);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},9756:(e,t,n)=>{var r=n(2478);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},9770:(e,t,n)=>{var r=n(4715)(n(8942),"Map");e.exports=r},9828:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},9847:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}},9968:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{onActive:()=>yI,onAssetHistoricalPrice:()=>dI,onAssetsConversion:()=>uI,onAssetsLookup:()=>cI,onAssetsMarketData:()=>AI,onClientRequest:()=>fI,onCronjob:()=>sI,onInactive:()=>wI,onInstall:()=>mI,onKeyringRequest:()=>iI,onNameLookup:()=>vI,onProtocolRequest:()=>lI,onRpcRequest:()=>oI,onStart:()=>pI,onUpdate:()=>gI,onUserInput:()=>aI,onWebSocketEvent:()=>hI});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";(()=>{const e=Array(256).fill(-1);for(let n=0;n<58;++n)e[t.charCodeAt(n)]=n})();var o,i,a=e=>{if(!e||"string"!=typeof e)throw new Error(`Expected base58 string but got “${e}”`);if(e.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character “${e.match(/[IOl0]/gmu)}”`);const n=e.match(/^1+/gmu),r=n?n[0].length:0,o=(e.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(r),...e.match(/.{1}/gmu).map((e=>t.indexOf(e))).reduce(((e,t)=>e.map((e=>{const n=58*e+t;return t=n>>8,n}))),new Uint8Array(o)).reverse().filter((i=!1,e=>i=i||e))]);var i},s=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let e=0;e<32;e++){const t=n.charAt(e);r[t]=e}function o(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function i(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=o(t)^r>>5}t=o(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=o(t)^31&r}return t}function a(e,t,n,r){let o=0,i=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(o=o<<t|e[r],i+=t;i>=n;)i-=n,s.push(o>>i&a);if(r)i>0&&s.push(o<<n-i&a);else{if(i>=t)return"Excess padding";if(o<<n-i&a)return"Non-zero padding"}return s}function s(e){return a(e,8,5,!0)}function c(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function l(e){let t;function a(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const a=e.toLowerCase(),s=e.toUpperCase();if(e!==a&&e!==s)return"Mixed-case string "+e;const c=(e=a).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let d=i(u);if("string"==typeof d)return d;const f=[];for(let e=0;e<l.length;++e){const t=l.charAt(e),n=r[t];if(void 0===n)return"Unknown character "+t;d=o(d)^n,e+6>=l.length||f.push(n)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const n=a(e,t);if("object"==typeof n)return n},decode:function(e,t){const n=a(e,t);if("object"==typeof n)return n;throw new Error(n)},encode:function(e,r,a){if(a=a||90,e.length+7+r.length>a)throw new TypeError("Exceeds length limit");let s=i(e=e.toLowerCase());if("string"==typeof s)throw new Error(s);let c=e+"1";for(let e=0;e<r.length;++e){const t=r[e];if(t>>5)throw new Error("Non 5-bit word");s=o(s)^t,c+=n.charAt(t)}for(let e=0;e<6;++e)s=o(s);s^=t;for(let e=0;e<6;++e)c+=n.charAt(s>>5*(5-e)&31);return c},toWords:s,fromWordsUnsafe:c,fromWords:u}}t.bech32=l("bech32"),t.bech32m=l("bech32m")}(o={exports:{}},o.exports),o.exports);(i=s)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")&&i.default;var c=s.bech32m,u=s.bech32;const l=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class d{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!h||p>=8e3)&&(h=new ArrayBuffer(8e3),p=0),this._byte=new Uint8Array(h,p,80),this._word=new Int32Array(h,p,20),p+=80}update(e){if("string"==typeof e)return this._utf8(e);if(null==e)throw new TypeError("Invalid type: "+typeof e);const t=e.byteOffset,n=e.byteLength;let r=n/64|0,o=0;if(r&&!(3&t)&&!(this._size%64)){const n=new Int32Array(e.buffer,t,16*r);for(;r--;)this._int32(n,o>>2),o+=64;this._size+=o}if(1!==e.BYTES_PER_ELEMENT&&e.buffer){const r=new Uint8Array(e.buffer,t+o,n-o);return this._uint8(r)}return o===n?this:this._uint8(e,o)}_uint8(e,t){const{_byte:n,_word:r}=this,o=e.length;for(t|=0;t<o;){const i=this._size%64;let a=i;for(;t<o&&a<64;)n[a++]=e[t++];a>=64&&this._int32(r),this._size+=a-i}return this}_utf8(e){const{_byte:t,_word:n}=this,r=e.length;let o=this._sp;for(let i=0;i<r;){const a=this._size%64;let s=a;for(;i<r&&s<64;){let n=0|e.charCodeAt(i++);n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<55296||n>57343?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):o?(n=((1023&o)<<10)+(1023&n)+65536,t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n,o=0):o=n}s>=64&&(this._int32(n),n[0]=n[16]),this._size+=s-a}return this._sp=o,this}_int32(e,t){let{A:n,B:r,C:o,D:i,E:a,F:s,G:c,H:u}=this,d=0;for(t|=0;d<16;)f[d++]=m(e[t++]);for(d=16;d<64;d++)f[d]=S(f[d-2])+f[d-7]+b(f[d-15])+f[d-16]|0;for(d=0;d<64;d++){const e=u+A(a)+y(a,s,c)+l[d]+f[d]|0,t=v(n)+w(n,r,o)|0;u=c,c=s,s=a,a=i+e|0,i=o,o=r,r=n,n=e+t|0}this.A=n+this.A|0,this.B=r+this.B|0,this.C=o+this.C|0,this.D=i+this.D|0,this.E=a+this.E|0,this.F=s+this.F|0,this.G=c+this.G|0,this.H=u+this.H|0}digest(e){const{_byte:t,_word:n}=this;let r=this._size%64|0;for(t[r++]=128;3&r;)t[r++]=0;if(r>>=2,r>14){for(;r<16;)n[r++]=0;r=0,this._int32(n)}for(;r<16;)n[r++]=0;const o=8*this._size,i=(4294967295&o)>>>0,a=(o-i)/4294967296;return a&&(n[14]=m(a)),i&&(n[15]=m(i)),this._int32(n),"hex"===e?this._hex():this._bin()}_hex(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s}=this;return g(e)+g(t)+g(n)+g(r)+g(o)+g(i)+g(a)+g(s)}_bin(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s,_byte:c,_word:u}=this;return u[0]=m(e),u[1]=m(t),u[2]=m(n),u[3]=m(r),u[4]=m(o),u[5]=m(i),u[6]=m(a),u[7]=m(s),c.slice(0,32)}}const f=new Int32Array(64);let h,p=0;const g=e=>(e+4294967296).toString(16).substr(-8),m=254===new Uint8Array(new Uint16Array([65279]).buffer)[0]?e=>e:e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255,y=(e,t,n)=>n^e&(t^n),w=(e,t,n)=>e&t|n&(e|t),v=e=>(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),A=e=>(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7),b=e=>(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,S=e=>(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10;var E,k,T=function(e){return(new d).update(e).digest()};!function(e){e.mainnet="mainnet",e.testnet="testnet",e.regtest="regtest"}(E||(E={})),function(e){e.p2pkh="p2pkh",e.p2sh="p2sh",e.p2wpkh="p2wpkh",e.p2wsh="p2wsh",e.p2tr="p2tr"}(k||(k={}));var I={0:{type:k.p2pkh,network:E.mainnet},111:{type:k.p2pkh,network:E.testnet},5:{type:k.p2sh,network:E.mainnet},196:{type:k.p2sh,network:E.testnet}},x=function(t){var n,r=t.substr(0,2).toLowerCase();if("bc"===r||"tb"===r)return function(e){var t;try{t=e.startsWith("bc1p")||e.startsWith("tb1p")||e.startsWith("bcrt1p")?c.decode(e):u.decode(e)}catch(e){throw new Error("Invalid address")}var n={bc:E.mainnet,tb:E.testnet,bcrt:E.regtest}[t.prefix];if(void 0===n)throw new Error("Invalid address");var r=t.words[0];if(r<0||r>16)throw new Error("Invalid address");return{bech32:!0,network:n,address:e,type:20===u.fromWords(t.words.slice(1)).length?k.p2wpkh:1===r?k.p2tr:k.p2wsh}}(t);try{n=a(t)}catch(e){throw new Error("Invalid address")}var o=n.length;if(25!==o)throw new Error("Invalid address");var i=n[0],s=n.slice(o-4,o),l=n.slice(0,o-4),d=T(T(l)).slice(0,4);if(s.some((function(e,t){return e!==d[t]})))throw new Error("Invalid address");if(!Object.keys(I).map(Number).includes(i))throw new Error("Invalid address");return e(e({},I[i]),{address:t,bech32:!1})};class _ extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function C(e){return"object"==typeof e&&null!==e}function R(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function P(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function N(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${P(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*B(e,t,n,r){(function(e){return C(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=N(o,t,n,r);e&&(yield e)}}function*M(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&C(t.schema)&&C(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=M(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):C(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class O{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>B(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>B(o(e,t),t,this,e):()=>[]}assert(e,t){return j(e,this,t)}create(e,t){return L(e,this,t)}is(e){return D(e,this)}mask(e,t){return function(e,t,n){const r=F(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return F(e,this,t)}}const z="EXACT_OPTIONAL";class U extends O{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=z}static isExactOptional(e){return C(e)&&"brand"in e&&e.brand===z}}function j(e,t,n){const r=F(e,t,{message:n});if(r[0])throw r[0]}function L(e,t,n){const r=F(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function D(e,t){return!F(e,t)[0]}function F(e,t,n={}){const r=M(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new _(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function $(){return ae("any",(()=>!0))}function W(e){return new O({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${P(e)}`})}function q(){return ae("boolean",(e=>"boolean"==typeof e))}function V(e){const t={},n=e.map((e=>P(e))).join();for(const n of e)t[n]=n;return new O({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${P(t)}`})}function K(){return ae("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${P(e)}`))}function G(e){const t=P(e),n=typeof e;return new O({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${P(n)}`})}function H(){return ae("never",(()=>!1))}function Z(e){return new O({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function J(){return ae("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${P(e)}`))}function Y(e){const t=e?Object.keys(e):[],n=H();return new O({type:"object",schema:e??null,*entries(r){if(e&&C(r)){const o=new Set(Object.keys(r));for(const n of t){o.delete(n);const t=e[n];U.isExactOptional(t)&&!Object.prototype.hasOwnProperty.call(r,n)||(yield[n,r[n],e[n]])}for(const e of o)yield[e,r[e],n]}},validator:e=>C(e)||`Expected an object, but received: ${P(e)}`,coercer:e=>C(e)?{...e}:e})}function Q(e){return new O({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function X(e,t){return new O({type:"record",schema:null,*entries(n){if(C(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>C(e)||`Expected an object, but received: ${P(e)}`})}function ee(){return ae("string",(e=>"string"==typeof e||`Expected a string, but received: ${P(e)}`))}function te(e){const t=H();return new O({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${P(e)}`})}function ne(e){const t=Object.keys(e);return new O({type:"type",schema:e,*entries(n){if(C(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>C(e)||`Expected an object, but received: ${P(e)}`,coercer:e=>C(e)?{...e}:e})}function re(e){const t=e.map((e=>e.type)).join(" | ");return new O({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const o=[];for(const t of e){const[...e]=M(n,t,r),[i]=e;if(!i?.[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${P(n)}`,...o]}})}function oe(){return ae("unknown",(()=>!0))}function ie(...e){const t="type"===e[0]?.type,n=e.map((({schema:e})=>e)),r=Object.assign({},...n);return t?ne(r):Y(r)}function ae(e,t){return new O({type:e,schema:null,validator:t})}function se(e,t){return ae(e,(e=>"string"==typeof e&&t.test(e)))}const ce=se("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),ue=ce,le=ae("Url",(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})),de=se("StringNumber",/^\d+(\.\d+)?$/u);function fe(e){return Y(e)}function he(e){return e.path[e.path.length-1]in e.branch[e.branch.length-2]}function pe(e){return new O({...e,validator:(t,n)=>!he(n)||e.validator(t,n),refiner:(t,n)=>!he(n)||e.refiner(t,n)})}function ge(e){return new O({type:"union",schema:null,*entries(t,n){yield*e(t).entries(t,n)},*refiner(t,n){yield*e(t).refiner(t,n)},coercer:(t,n)=>e(t).coercer(t,n),validator:(t,n)=>e(t).validator(t,n)})}function me(e,t,n){return new O({...e,coercer:(r,o)=>D(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function ye(e){return e instanceof Map||e instanceof Set?e.size:e.length}function we(e,t,n={}){const{exclusive:r}=n;return be(e,"min",(n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))}function ve(e){return be(e,"nonempty",(t=>ye(t)>0||`Expected a nonempty ${e.type} but received an empty one`))}function Ae(e,t){return be(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function be(e,t,n){return new O({...e,*refiner(r,o){yield*e.refiner(r,o);const i=B(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}var Se;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Se=Se||(Se={}));const Ee=e=>Y(e);function ke({path:e,branch:t}){const n=e[e.length-1];return r=t[t.length-2],o=n,Object.hasOwnProperty.call(r,o);var r,o}function Te(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!ke(n)||e.validator(t,n),refiner:(t,n)=>!ke(n)||e.refiner(t,n)})}function Ie(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Ie(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Ie(n[e][1])){t=!1;break}return t}return!1}const xe=ae("JSON",(e=>Ie(e))),_e=me(xe,be($(),"JSON",(e=>D(e,xe))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Ce=G("2.0"),Re=Z(re([J(),ee()])),Pe=Ee({code:K(),message:ee(),data:Te(_e),stack:Te(ee())}),Ne=re([X(ee(),_e),W(_e)]);Ee({id:Re,jsonrpc:Ce,method:ee(),params:Te(Ne)}),Ee({jsonrpc:Ce,method:ee(),params:Te(Ne)});Y({id:Re,jsonrpc:Ce,result:Q(oe()),error:Q(Pe)});const Be=Ee({id:Re,jsonrpc:Ce,result:_e}),Me=Ee({id:Re,jsonrpc:Ce,error:Pe});re([Be,Me]);const Oe=fe({jsonrpc:G("2.0"),id:re([ee(),J(),G(null)]),method:ee(),params:pe(re([W(_e),X(ee(),_e)]))});var ze;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(ze=ze||(ze={}));function Ue(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}const je=e=>Y(e);function Le({path:e,branch:t}){const n=e[e.length-1];return r=t[t.length-2],o=n,Object.hasOwnProperty.call(r,o);var r,o}function De(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Le(n)||e.validator(t,n),refiner:(t,n)=>!Le(n)||e.refiner(t,n)})}function Fe(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Fe(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Fe(n[e][1])){t=!1;break}return t}return!1}const $e=ae("JSON",(e=>Fe(e))),We=me($e,be($(),"JSON",(e=>D(e,$e))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const qe=G("2.0"),Ve=Z(re([J(),ee()])),Ke=je({code:K(),message:ee(),data:De(We),stack:De(ee())}),Ge=re([X(ee(),We),W(We)]);je({id:Ve,jsonrpc:qe,method:ee(),params:De(Ge)}),je({jsonrpc:qe,method:ee(),params:De(Ge)});Y({id:Ve,jsonrpc:qe,result:Q(oe()),error:Q(Ke)});const He=je({id:Ve,jsonrpc:qe,result:We}),Ze=je({id:Ve,jsonrpc:qe,error:Ke});re([He,Ze]);var Je;!function(e){e.Mnemonic="mnemonic",e.PrivateKey="private-key"}(Je||(Je={}));const Ye=Y({type:G(`${Je.Mnemonic}`),id:ee(),derivationPath:ee(),groupIndex:J()}),Qe=Y({type:G(`${Je.PrivateKey}`)}),Xe=ge((e=>Ue(e)&&e.type===Je.PrivateKey?Qe:Ye)),et=(tt=[X(ee(),We),(nt={entropy:pe(Xe),exportable:pe(q())},ne(nt))],new O({type:"intersection",schema:null,*entries(e,t){for(const{entries:n}of tt)yield*n(e,t)},*validator(e,t){for(const{validator:n}of tt)yield*n(e,t)},*refiner(e,t){for(const{refiner:n}of tt)yield*n(e,t)}}));var tt,nt;function rt(e,t){return ae(e,(e=>"string"==typeof e&&t.test(e)))}const ot=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,it=/^[-a-z0-9]{3,8}$/u,at=/^[-_a-zA-Z0-9]{1,32}$/u,st=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,ct=/^[-.%a-zA-Z0-9]{1,128}$/u,ut=/^[-a-z0-9]{3,8}$/u,lt=/^[-.%a-zA-Z0-9]{1,128}$/u,dt=/^[-.%a-zA-Z0-9]{1,78}$/u,ft=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,ht=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,pt=rt("CaipChainId",ot),gt=(rt("CaipNamespace",it),rt("CaipReference",at),rt("CaipAccountId",st)),mt=(rt("CaipAccountAddress",ct),rt("CaipAssetNamespace",ut),rt("CaipAssetReference",lt),rt("CaipTokenId",dt),rt("CaipAssetType",ft)),yt=rt("CaipAssetId",ht),wt=rt("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var vt,At,bt,St,Et,kt;!function(e){e.Bip122="bip122",e.Solana="solana",e.Tron="tron",e.Eip155="eip155",e.Wallet="wallet"}(vt=vt||(vt={})),function(e){e.Eoa="eip155:eoa",e.Erc4337="eip155:erc4337"}(At||(At={})),function(e){e.P2pkh="bip122:p2pkh",e.P2sh="bip122:p2sh",e.P2wpkh="bip122:p2wpkh",e.P2tr="bip122:p2tr"}(bt||(bt={})),function(e){e.DataAccount="solana:data-account"}(St||(St={})),function(e){e.Eoa="tron:eoa"}(Et||(Et={})),function(e){e.Account="any:account"}(kt||(kt={}));const Tt=fe({id:ue,type:V([`${At.Eoa}`,`${At.Erc4337}`,`${bt.P2pkh}`,`${bt.P2sh}`,`${bt.P2wpkh}`,`${bt.P2tr}`,`${St.DataAccount}`,`${Et.Eoa}`,`${kt.Account}`]),address:ee(),scopes:ve(W(pt)),options:et,methods:W(ee())}),It=(Y({address:gt}),fe({unit:ee(),amount:de})),xt=fe({fungible:G(!0),type:mt,...It.schema}),_t=fe({fungible:G(!1),id:yt}),Ct=ge((e=>Ue(e)&&!e.fungible?_t:xt)),Rt=fe({amount:de,unit:ee()}),Pt=rt("DerivationPath",/^m(?:\/\d+'?)+$/u);var Nt;!function(e){e.Bip44="bip44"}(Nt||(Nt={}));const Bt=Y({type:G(`${Nt.Bip44}`),scopes:W(pt),derivationPath:Pt}),Mt=(X(ee(),We),fe({id:ce,scope:ee(),account:ce,origin:ee(),request:fe({method:ee(),params:pe(re([W(We),X(ee(),We)]))})})),Ot=(re([fe({pending:G(!0),redirect:pe(fe({message:pe(ee()),url:pe(ee())}))}),fe({pending:G(!1),result:We})]),fe({address:ee(),asset:Z(Ct)}));var zt;!function(e){e.Base="base",e.Priority="priority"}(zt||(zt={}));const Ut=fe({type:V([`${zt.Base}`,`${zt.Priority}`]),asset:Ct});var jt,Lt;!function(e){e.Submitted="submitted",e.Unconfirmed="unconfirmed",e.Confirmed="confirmed",e.Failed="failed"}(jt||(jt={})),function(e){e.Send="send",e.Receive="receive",e.Swap="swap",e.BridgeSend="bridge:send",e.BridgeReceive="bridge:receive",e.Unknown="unknown"}(Lt||(Lt={}));const Dt=fe({status:V([`${jt.Submitted}`,`${jt.Unconfirmed}`,`${jt.Confirmed}`,`${jt.Failed}`]),timestamp:Z(J())}),Ft=fe({id:ee(),chain:pt,account:ce,status:V([`${jt.Submitted}`,`${jt.Unconfirmed}`,`${jt.Confirmed}`,`${jt.Failed}`]),timestamp:Z(J()),type:V([`${Lt.Send}`,`${Lt.Receive}`,`${Lt.Swap}`,`${Lt.BridgeSend}`,`${Lt.BridgeReceive}`,`${Lt.Unknown}`]),from:W(Ot),to:W(Ot),fees:W(Ut),events:W(Dt)}),$t=(fe({data:W(Ft),next:Z(ee())}),fe({limit:J(),next:pe(Z(ee()))})),Wt=fe({metamask:pe(fe({correlationId:ce}))});var qt;!function(e){e.Mainnet="bip122:000000000019d6689c085ae165831e93",e.Testnet="bip122:000000000933ea01ad0ee984209779ba",e.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",e.Signet="bip122:00000008819873e925422c1ff0f99f7c",e.Regtest="bip122:regtest"}(qt||(qt={}));const Vt=(e,t)=>{try{return x(e).type===t||new Error(`Invalid ${t} address`)}catch(e){return new Error(`Failed to decode ${t} address: ${e.message}`)}},Kt=be(ee(),"BtcP2pkhAddressStruct",(e=>Vt(e,k.p2pkh))),Gt=be(ee(),"BtcP2shAddressStruct",(e=>Vt(e,k.p2sh))),Ht=be(ee(),"BtcP2wpkhAddressStruct",(e=>Vt(e,k.p2wpkh))),Zt=be(ee(),"BtcP2trAddressStruct",(e=>Vt(e,k.p2tr)));var Jt;!function(e){e.SignPsbt="signPsbt",e.ComputeFee="computeFee",e.FillPsbt="fillPsbt",e.BroadcastPsbt="broadcastPsbt",e.SendTransfer="sendTransfer",e.GetUtxo="getUtxo",e.ListUtxos="listUtxos",e.PublicDescriptor="publicDescriptor",e.SignMessage="signMessage"}(Jt||(Jt={}));const Yt=fe({...Tt.schema,scopes:ve(W(pt)),methods:W(V(Object.values(Jt)))});fe({...Yt.schema,address:Kt,type:G(`${bt.P2pkh}`)}),fe({...Yt.schema,address:Gt,type:G(`${bt.P2sh}`)}),fe({...Yt.schema,address:Ht,type:G(`${bt.P2wpkh}`)}),fe({...Yt.schema,address:Zt,type:G(`${bt.P2tr}`)});var Qt;!function(e){e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Qt||(Qt={}));const Xt=rt("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var en;!function(e){e.SendAndConfirmTransaction="sendAndConfirmTransaction",e.SignAndSendTransaction="signAndSendTransaction",e.SignTransaction="signTransaction",e.SignMessage="signMessage",e.SignIn="signIn"}(en||(en={}));fe({...Tt.schema,address:Xt,type:G(`${St.DataAccount}`),scopes:ve(W(pt)),methods:W(V(Object.values(en)))});var tn;!function(e){e.Eoa="eip155:0",e.Mainnet="eip155:1",e.Testnet="eip155:11155111"}(tn||(tn={}));const nn=rt("EthBytes",/^0x[0-9a-f]*$/iu),rn=rt("EthAddress",/^0x[0-9a-f]{40}$/iu),on=rt("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu);var an;!function(e){e.PersonalSign="personal_sign",e.Sign="eth_sign",e.SignTransaction="eth_signTransaction",e.SignTypedDataV1="eth_signTypedData_v1",e.SignTypedDataV3="eth_signTypedData_v3",e.SignTypedDataV4="eth_signTypedData_v4",e.PrepareUserOperation="eth_prepareUserOperation",e.PatchUserOperation="eth_patchUserOperation",e.SignUserOperation="eth_signUserOperation"}(an||(an={}));fe({...Tt.schema,address:rn,type:G(`${At.Eoa}`),scopes:ve(W(G(tn.Eoa))),methods:W(V([`${an.PersonalSign}`,`${an.Sign}`,`${an.SignTransaction}`,`${an.SignTypedDataV1}`,`${an.SignTypedDataV3}`,`${an.SignTypedDataV4}`]))}),fe({...Tt.schema,address:rn,type:G(`${At.Erc4337}`),scopes:ve(W(pt)),methods:W(V([`${an.PersonalSign}`,`${an.Sign}`,`${an.SignTypedDataV1}`,`${an.SignTypedDataV3}`,`${an.SignTypedDataV4}`,`${an.PrepareUserOperation}`,`${an.PatchUserOperation}`,`${an.SignUserOperation}`]))}),fe({sender:rn,nonce:on,initCode:nn,callData:nn,callGasLimit:on,verificationGasLimit:on,preVerificationGas:on,maxFeePerGas:on,maxPriorityFeePerGas:on,paymasterAndData:nn,signature:nn}),fe({to:rn,value:on,data:nn}),fe({nonce:on,initCode:nn,callData:nn,gasLimits:pe(fe({callGasLimit:on,verificationGasLimit:on,preVerificationGas:on})),dummyPaymasterAndData:nn,dummySignature:nn,bundlerUrl:le}),fe({paymasterAndData:nn,callGasLimit:pe(on),verificationGasLimit:pe(on),preVerificationGas:pe(on)});var sn;!function(e){e.Mainnet="tron:728126428",e.Nile="tron:3448148188",e.Shasta="tron:2494104990"}(sn||(sn={}));const cn=rt("TrxAddress",/^T[1-9A-HJ-NP-Za-km-z]{33}$/iu);var un;!function(e){e.SignMessageV2="signMessageV2",e.VerifyMessageV2="verifyMessageV2"}(un||(un={}));fe({...Tt.schema,address:cn,type:G(`${Et.Eoa}`),scopes:ve(W(pt)),methods:W(V(Object.values(un)))});var ln;!function(e){e.ListAccounts="keyring_listAccounts",e.GetAccount="keyring_getAccount",e.CreateAccount="keyring_createAccount",e.DiscoverAccounts="keyring_discoverAccounts",e.ListAccountAssets="keyring_listAccountAssets",e.ListAccountTransactions="keyring_listAccountTransactions",e.GetAccountBalances="keyring_getAccountBalances",e.ResolveAccountAddress="keyring_resolveAccountAddress",e.FilterAccountChains="keyring_filterAccountChains",e.UpdateAccount="keyring_updateAccount",e.DeleteAccount="keyring_deleteAccount",e.ExportAccount="keyring_exportAccount",e.ListRequests="keyring_listRequests",e.GetRequest="keyring_getRequest",e.SubmitRequest="keyring_submitRequest",e.ApproveRequest="keyring_approveRequest",e.RejectRequest="keyring_rejectRequest",e.SetSelectedAccounts="keyring_setSelectedAccounts"}(ln||(ln={}));const dn={jsonrpc:G("2.0"),id:re([ee(),J(),G(null)])},fn=fe({...dn,method:G("keyring_listAccounts")}),hn=(W(Tt),fe({...dn,method:G("keyring_getAccount"),params:fe({id:ce})})),pn=fe({...dn,method:G("keyring_createAccount"),params:fe({options:X(ee(),We)})}),gn=fe({...dn,method:G("keyring_setSelectedAccounts"),params:fe({accounts:W(ee())})}),mn=(G(null),fe({...dn,method:G("keyring_discoverAccounts"),params:fe({scopes:W(pt),entropySource:ee(),groupIndex:J()})})),yn=(W(Bt),fe({...dn,method:G("keyring_listAccountTransactions"),params:fe({id:ce,pagination:$t})})),wn=fe({...dn,method:G("keyring_listAccountAssets"),params:fe({id:ce})}),vn=W(wt),An=fe({...dn,method:G(`${ln.GetAccountBalances}`),params:fe({id:ce,assets:W(mt)})}),bn=(X(mt,Rt),fe({...dn,method:G("keyring_resolveAccountAddress"),params:fe({scope:pt,request:Oe})})),Sn=(Z(fe({address:gt})),fe({...dn,method:G("keyring_filterAccountChains"),params:fe({id:ce,chains:W(ee())})})),En=(W(ee()),fe({...dn,method:G("keyring_updateAccount"),params:fe({account:Tt})})),kn=(G(null),fe({...dn,method:G("keyring_deleteAccount"),params:fe({id:ce})})),Tn=(G(null),fe({...dn,method:G("keyring_exportAccount"),params:fe({id:ce})})),In=fe({...dn,method:G("keyring_listRequests")}),xn=(W(Mt),fe({...dn,method:G("keyring_getRequest"),params:fe({id:ce})})),_n=fe({...dn,method:G("keyring_submitRequest"),params:Mt}),Cn=fe({...dn,method:G("keyring_approveRequest"),params:fe({id:ce,data:X(ee(),We)})}),Rn=(G(null),fe({...dn,method:G("keyring_rejectRequest"),params:fe({id:ce})}));G(null);var Pn;!function(e){e.AccountCreated="notify:accountCreated",e.AccountUpdated="notify:accountUpdated",e.AccountDeleted="notify:accountDeleted",e.RequestApproved="notify:requestApproved",e.RequestRejected="notify:requestRejected",e.AccountBalancesUpdated="notify:accountBalancesUpdated",e.AccountAssetListUpdated="notify:accountAssetListUpdated",e.AccountTransactionsUpdated="notify:accountTransactionsUpdated"}(Pn||(Pn={}));fe({method:G(`${Pn.AccountCreated}`),params:fe({account:Tt,accountNameSuggestion:pe(ee()),displayConfirmation:pe(q()),displayAccountNameSuggestion:pe(q()),...Wt.schema})}),fe({method:G(`${Pn.AccountUpdated}`),params:fe({account:Tt})}),fe({method:G(`${Pn.AccountDeleted}`),params:fe({id:ce})}),fe({method:G(`${Pn.RequestApproved}`),params:fe({id:ce,result:We})}),fe({method:G(`${Pn.RequestRejected}`),params:fe({id:ce})}),fe({method:G(`${Pn.AccountBalancesUpdated}`),params:fe({balances:X(ue,X(mt,It))})}),fe({method:G(`${Pn.AccountTransactionsUpdated}`),params:fe({transactions:X(ue,W(Ft))})}),fe({method:G(`${Pn.AccountAssetListUpdated}`),params:fe({assets:X(ue,fe({added:W(wt),removed:W(wt)}))})});class Nn extends Error{constructor(e){super(`Method not supported: ${e}`)}}async function Bn(e,t){try{return await async function(e,t){switch(j(t,Oe),t.method){case`${ln.ListAccounts}`:return j(t,fn),e.listAccounts();case`${ln.GetAccount}`:return j(t,hn),e.getAccount(t.params.id);case`${ln.CreateAccount}`:return j(t,pn),e.createAccount(t.params.options);case`${ln.DiscoverAccounts}`:if(void 0===e.discoverAccounts)throw new Nn(t.method);return j(t,mn),e.discoverAccounts(t.params.scopes,t.params.entropySource,t.params.groupIndex);case`${ln.ListAccountTransactions}`:if(void 0===e.listAccountTransactions)throw new Nn(t.method);return j(t,yn),e.listAccountTransactions(t.params.id,t.params.pagination);case`${ln.ListAccountAssets}`:if(void 0===e.listAccountAssets)throw new Nn(t.method);return j(t,wn),e.listAccountAssets(t.params.id);case`${ln.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new Nn(t.method);return j(t,An),e.getAccountBalances(t.params.id,t.params.assets);case`${ln.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new Nn(t.method);return j(t,bn),e.resolveAccountAddress(t.params.scope,t.params.request);case`${ln.SetSelectedAccounts}`:if(void 0===e.setSelectedAccounts)throw new Nn(t.method);return j(t,gn),e.setSelectedAccounts(t.params.accounts);case`${ln.FilterAccountChains}`:return j(t,Sn),e.filterAccountChains(t.params.id,t.params.chains);case`${ln.UpdateAccount}`:return j(t,En),e.updateAccount(t.params.account);case`${ln.DeleteAccount}`:return j(t,kn),e.deleteAccount(t.params.id);case`${ln.ExportAccount}`:if(void 0===e.exportAccount)throw new Nn(t.method);return j(t,Tn),e.exportAccount(t.params.id);case`${ln.ListRequests}`:if(void 0===e.listRequests)throw new Nn(t.method);return j(t,In),e.listRequests();case`${ln.GetRequest}`:if(void 0===e.getRequest)throw new Nn(t.method);return j(t,xn),e.getRequest(t.params.id);case`${ln.SubmitRequest}`:return j(t,_n),e.submitRequest(t.params);case`${ln.ApproveRequest}`:if(void 0===e.approveRequest)throw new Nn(t.method);return j(t,Cn),e.approveRequest(t.params.id,t.params.data);case`${ln.RejectRequest}`:if(void 0===e.rejectRequest)throw new Nn(t.method);return j(t,Rn),e.rejectRequest(t.params.id);default:throw new Nn(t.method)}}(e,t)}catch(e){const t=e instanceof Error&&"string"==typeof e.message?e.message:"An unknown error occurred while handling the keyring request";throw new Error(t)}}var Mn;!function(e){e.GetSelectedAccounts="getSelectedAccounts"}(Mn||(Mn={}));Y({method:G(Mn.GetSelectedAccounts)});const On=W(ee());async function zn(e,t,n){await e.request({method:"snap_manageAccounts",params:{method:t,params:{...n}}})}async function Un(e){const t=await e.request({method:"snap_manageAccounts",params:{method:Mn.GetSelectedAccounts}});return j(t,On),t}function jn(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const Ln=(e,t)=>Object.hasOwnProperty.call(e,t);var Dn;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Dn=Dn||(Dn={}));var Fn=n(282);const $n=e=>Y(e);function Wn({path:e,branch:t}){const n=e[e.length-1];return Ln(t[t.length-2],n)}function qn(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Wn(n)||e.validator(t,n),refiner:(t,n)=>!Wn(n)||e.refiner(t,n)})}function Vn(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Vn(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Vn(n[e][1])){t=!1;break}return t}return!1}const Kn=ae("JSON",(e=>Vn(e))),Gn=me(Kn,be($(),"JSON",(e=>D(e,Kn))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Hn(e){try{return function(e){L(e,Gn)}(e),!0}catch{return!1}}const Zn=G("2.0"),Jn=Z(re([J(),ee()])),Yn=$n({code:K(),message:ee(),data:qn(Gn),stack:qn(ee())}),Qn=re([X(ee(),Gn),W(Gn)]);$n({id:Jn,jsonrpc:Zn,method:ee(),params:qn(Qn)}),$n({jsonrpc:Zn,method:ee(),params:qn(Qn)});Y({id:Jn,jsonrpc:Zn,result:Q(oe()),error:Q(Yn)});const Xn=$n({id:Jn,jsonrpc:Zn,result:Gn}),er=$n({id:Jn,jsonrpc:Zn,error:Yn});re([Xn,er]);const tr={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},nr={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},rr={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},or=tr.internal,ir=(ar(or),"Unspecified server error.");function ar(e,t="Unspecified error message. This is a bug, please report it."){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(Ln(rr,t))return rr[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return ir}return t}function sr(e){return Array.isArray(e)?e.map((e=>Hn(e)?e:jn(e)?cr(e):null)):jn(e)?cr(e):Hn(e)?e:null}function cr(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Hn(r)&&(t[n]=r),t}),{})}const ur=function(e){return e?.__esModule?e.default:e}(Fn);class lr extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return jn(e)&&Ln(e,"cause")&&jn(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),Ln(this,"cause")||Object.assign(this,{cause:n.cause})),void 0!==n&&(this.data=n),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=sr(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return ur(this.serialize(),fr,2)}}class dr extends lr{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function fr(e,t){if("[Circular]"!==t)return t}const hr=e=>Cr(tr.parse,e),pr=e=>Cr(tr.invalidRequest,e),gr=e=>Cr(tr.invalidParams,e),mr=e=>Cr(tr.methodNotFound,e),yr=e=>Cr(tr.internal,e),wr=e=>Cr(tr.invalidInput,e),vr=e=>Cr(tr.resourceNotFound,e),Ar=e=>Cr(tr.resourceUnavailable,e),br=e=>Cr(tr.transactionRejected,e),Sr=e=>Cr(tr.methodNotSupported,e),Er=e=>Cr(tr.limitExceeded,e),kr=e=>Rr(nr.userRejectedRequest,e),Tr=e=>Rr(nr.unauthorized,e),Ir=e=>Rr(nr.unsupportedMethod,e),xr=e=>Rr(nr.disconnected,e),_r=e=>Rr(nr.chainDisconnected,e);function Cr(e,t){const[n,r]=Pr(t);return new lr(e,n??ar(e),r)}function Rr(e,t){const[n,r]=Pr(t);return new dr(e,n??ar(e),r)}function Pr(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}const Nr=(e,t)=>Object.hasOwnProperty.call(e,t);var Br;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Br=Br||(Br={}));const Mr=e=>Y(e);function Or({path:e,branch:t}){const n=e[e.length-1];return Nr(t[t.length-2],n)}function zr(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Or(n)||e.validator(t,n),refiner:(t,n)=>!Or(n)||e.refiner(t,n)})}function Ur(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Ur(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Ur(n[e][1])){t=!1;break}return t}return!1}const jr=ae("JSON",(e=>Ur(e))),Lr=me(jr,be($(),"JSON",(e=>D(e,jr))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Dr(e){try{return function(e){L(e,Lr)}(e),!0}catch{return!1}}const Fr=G("2.0"),$r=Z(re([J(),ee()])),Wr=Mr({code:K(),message:ee(),data:zr(Lr),stack:zr(ee())}),qr=re([X(ee(),Lr),W(Lr)]);Mr({id:$r,jsonrpc:Fr,method:ee(),params:zr(qr)}),Mr({jsonrpc:Fr,method:ee(),params:zr(qr)});Y({id:$r,jsonrpc:Fr,result:Q(oe()),error:Q(Wr)});const Vr=Mr({id:$r,jsonrpc:Fr,result:Lr}),Kr=Mr({id:$r,jsonrpc:Fr,error:Wr});re([Vr,Kr]);function Gr(e,t,n=null){return r=e,Boolean(r)&&"object"==typeof r&&!Array.isArray(r)&&Nr(e,t)?e[t]:n;var r}function Hr(e,t,n=String(e)){const r=Gr(e,t);return"string"==typeof r?r:n}function Zr(e){return Hr(e,"message")}function Jr(e){return Hr(e,"stack",null)}function Yr(e){return Hr(e,"name",e instanceof Error?e.name:"Error")}function Qr(e){const t=Gr(e,"data");return null!==t&&Dr(t)&&!Array.isArray(t)?t:{}}class Xr extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=Zr(e);super(n),this.#t=n,this.#e=function(e){const t=Gr(e,"code");return"number"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Qr(e),...t};Object.keys(r).length>0&&(this.#n=r),this.#r=super.stack}get name(){return"SnapError"}get code(){return this.#e}get message(){return this.#t}get data(){return this.#n}get stack(){return this.#r}toJSON(){return{code:-31002,message:"Snap Error",data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}}function eo(e){if("string"==typeof e)return{name:"Error",message:e,stack:null,cause:null};if(D(e,Wr))return{name:"JsonRpcError",message:Zr(e),stack:Jr(e)??Jr(e.data)??null,cause:null};const t=function(e){return Gr(e,"cause")}(e);return{name:Yr(e),message:Zr(e),stack:Jr(e)??null,cause:null===t?null:eo(t)}}function to(e){return class extends Xr{constructor(t,n){if("object"==typeof t){const n=e();return void super({code:n.code,message:n.message,data:t})}const r=e(t);super({code:r.code,message:r.message,data:n})}}}const no=to(yr),ro=to(wr),oo=to(gr),io=to(pr),ao=to(Er),so=to(mr),co=to(Sr),uo=to(hr),lo=to(vr),fo=to(Ar),ho=to(br),po=to(_r),go=to(xr),mo=to(Tr),yo=to(Ir),wo=to(kr);var vo=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ao=Math.ceil,bo=Math.floor,So="[BigNumber Error] ",Eo=So+"Number primitive has more than 15 significant digits: ",ko=1e14,To=14,Io=9007199254740991,xo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],_o=1e7,Co=1e9;function Ro(e){var t=0|e;return e>0||e===t?t:t-1}function Po(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=To-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function No(e,t){var n,r,o=e.c,i=t.c,a=e.s,s=t.s,c=e.e,u=t.e;if(!a||!s)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=a<0,r=c==u,!o||!i)return r?0:!o^n?1:-1;if(!r)return c>u^n?1:-1;for(s=(c=o.length)<(u=i.length)?c:u,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function Bo(e,t,n,r){if(e<t||e>n||e!==bo(e))throw Error(So+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Ro(e.e/To)==t&&e.c[t]%2!=0}function Oo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function zo(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(++t>(r=e.length)){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Uo=function e(t){var n,r,o,i,a,s,c,u,l,d,f=I.prototype={constructor:I,toString:null,valueOf:null},h=new I(1),p=20,g=4,m=-7,y=21,w=-1e7,v=1e7,A=!1,b=1,S=0,E={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function I(e,t){var n,i,a,s,c,u,l,d,f=this;if(!(f instanceof I))return new I(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>v?f.c=f.e=null:e.e<w?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>v?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!vo.test(d=String(e)))return o(f,d,u);f.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(Bo(t,2,k.length,"Base"),10==t&&T)return R(f=new I(e),p+f.e+1,g);if(d=String(e),u="number"==typeof e){if(0*e!=0)return o(f,d,u,t);if(f.s=1/e<0?(d=d.slice(1),-1):1,I.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(Eo+e)}else f.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=k.slice(0,t),s=c=0,l=d.length;c<l;c++)if(n.indexOf(i=d.charAt(c))<0){if("."==i){if(c>s){s=l;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return o(f,String(e),u,t)}u=!1,(s=(d=r(d,t,10,f.s)).indexOf("."))>-1?d=d.replace(".",""):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(l=d.length;48===d.charCodeAt(--l););if(d=d.slice(c,++l)){if(l-=c,u&&I.DEBUG&&l>15&&(e>Io||e!==bo(e)))throw Error(Eo+f.s*e);if((s=s-c-1)>v)f.c=f.e=null;else if(s<w)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%To,s<0&&(c+=To),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=To;c<l;)f.c.push(+d.slice(c,c+=To));c=To-(d=d.slice(c)).length}else c-=l;for(;c--;d+="0");f.c.push(+d)}}else f.c=[f.e=0]}function x(e,t,n,r){var o,i,a,s,c;if(null==n?n=g:Bo(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)c=Po(e.c),c=1==r||2==r&&(a<=m||a>=y)?Oo(c,a):zo(c,a,"0");else if(i=(e=R(new I(e),t,n)).e,s=(c=Po(e.c)).length,1==r||2==r&&(t<=i||i<=m)){for(;s<t;c+="0",s++);c=Oo(c,i)}else if(t-=a,c=zo(c,i,"0"),i+1>s){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-s)>0)for(i+1==s&&(c+=".");t--;c+="0");return e.s<0&&o?"-"+c:c}function _(e,t){for(var n,r,o=1,i=new I(e[0]);o<e.length;o++)(!(r=new I(e[o])).s||(n=No(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function C(e,t,n){for(var r=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,r++);return(n=r+n*To-1)>v?e.c=e.e=null:n<w?e.c=[e.e=0]:(e.e=n,e.c=t),e}function R(e,t,n,r){var o,i,a,s,c,u,l,d=e.c,f=xo;if(d){e:{for(o=1,s=d[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=To,a=t,c=d[u=0],l=bo(c/f[o-a-1]%10);else if((u=Ao((i+1)/To))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,o=1,a=(i%=To)-To+1}else{for(c=s=d[u],o=1;s>=10;s/=10,o++);l=(a=(i%=To)-To+o)<0?0:bo(c/f[o-a-1]%10)}if(r=r||t<0||null!=d[u+1]||(a<0?c:c%f[o-a-1]),r=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(i>0?a>0?c/f[o-a]:0:d[u-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,r?(t-=e.e+1,d[0]=f[(To-t%To)%To],e.e=-t||0):d[0]=e.e=0,e;if(0==i?(d.length=u,s=1,u--):(d.length=u+1,s=f[To-i],d[u]=a>0?bo(c/f[o-a]%f[a])*s:0),r)for(;;){if(0==u){for(i=1,a=d[0];a>=10;a/=10,i++);for(a=d[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(e.e++,d[0]==ko&&(d[0]=1));break}if(d[u]+=s,d[u]!=ko)break;d[u--]=0,s=1}for(i=d.length;0===d[--i];d.pop());}e.e>v?e.c=e.e=null:e.e<w&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=Po(e.c),t=n<=m||n>=y?Oo(t,n):zo(t,n,"0"),e.s<0?"-"+t:t)}return I.clone=e,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(So+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(Bo(n=e[t],0,Co,t),p=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(Bo(n=e[t],0,8,t),g=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(Bo(n[0],-Co,0,t),Bo(n[1],0,Co,t),m=n[0],y=n[1]):(Bo(n,-Co,Co,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)Bo(n[0],-Co,-1,t),Bo(n[1],1,Co,t),w=n[0],v=n[1];else{if(Bo(n,-Co,Co,t),!n)throw Error(So+t+" cannot be zero: "+n);w=-(v=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(So+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(So+"crypto unavailable");A=n}else A=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(Bo(n=e[t],0,9,t),b=n),e.hasOwnProperty(t="POW_PRECISION")&&(Bo(n=e[t],0,Co,t),S=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(So+t+" not an object: "+n);E=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(So+t+" invalid: "+n);T="0123456789"==n.slice(0,10),k=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[w,v],CRYPTO:A,MODULO_MODE:b,POW_PRECISION:S,FORMAT:E,ALPHABET:k}},I.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!I.DEBUG)return!0;var t,n,r=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-Co&&o<=Co&&o===bo(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%To)<1&&(t+=To),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ko||n!==bo(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(So+"Invalid BigNumber: "+e)},I.maximum=I.max=function(){return _(arguments,-1)},I.minimum=I.min=function(){return _(arguments,1)},I.random=(i=9007199254740992,a=Math.random()*i&2097151?function(){return bo(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,i,s=0,c=[],u=new I(h);if(null==e?e=p:Bo(e,0,Co),o=Ao(e/To),A)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));s<o;)(i=131072*t[s]+(t[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[s]=n[0],t[s+1]=n[1]):(c.push(i%1e14),s+=2);s=o/2}else{if(!crypto.randomBytes)throw A=!1,Error(So+"crypto unavailable");for(t=crypto.randomBytes(o*=7);s<o;)(i=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(c.push(i%1e14),s+=7);s=o/7}if(!A)for(;s<o;)(i=a())<9e15&&(c[s++]=i%1e14);for(o=c[--s],e%=To,o&&e&&(i=xo[To-e],c[s]=bo(o/i)*i);0===c[s];c.pop(),s--);if(s<0)c=[r=0];else{for(r=-1;0===c[0];c.splice(0,1),r-=To);for(s=1,i=c[0];i>=10;i/=10,s++);s<To&&(r-=To-s)}return u.e=r,u.c=c,u}),I.sum=function(){for(var e=1,t=arguments,n=new I(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var o,i,a=[0],s=0,c=e.length;s<c;){for(i=a.length;i--;a[i]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),o=0;o<a.length;o++)a[o]>n-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/n|0,a[o]%=n)}return a.reverse()}return function(r,o,i,a,s){var c,u,l,d,f,h,m,y,w=r.indexOf("."),v=p,A=g;for(w>=0&&(d=S,S=0,r=r.replace(".",""),h=(y=new I(o)).pow(r.length-w),S=d,y.c=t(zo(Po(h.c),h.e,"0"),10,i,e),y.e=y.c.length),l=d=(m=t(r,o,i,s?(c=k,e):(c=e,k))).length;0==m[--d];m.pop());if(!m[0])return c.charAt(0);if(w<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,v,A,i)).c,f=h.r,l=h.e),w=m[u=l+v+1],d=i/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=w||f)&&(0==A||A==(h.s<0?3:2)):w>d||w==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?zo(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(m.length=u,f)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(d=m.length;!m[--d];);for(w=0,r="";w<=d;r+=c.charAt(m[w++]));r=zo(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,o,i,a,s=0,c=e.length,u=t%_o,l=t/_o|0;for(e=e.slice();c--;)s=((o=u*(i=e[c]%_o)+(r=l*i+(a=e[c]/_o|0)*u)%_o*_o+s)/n|0)+(r/_o|0)+l*a,e[c]=o%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function n(e,t,n,r){for(var o=0;n--;)e[n]-=o,o=e[n]<t[n]?1:0,e[n]=o*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,i,a,s){var c,u,l,d,f,h,p,g,m,y,w,v,A,b,S,E,k,T=r.s==o.s?1:-1,x=r.c,_=o.c;if(!(x&&x[0]&&_&&_[0]))return new I(r.s&&o.s&&(x?!_||x[0]!=_[0]:_)?x&&0==x[0]||!_?0*T:T/0:NaN);for(m=(g=new I(T)).c=[],T=i+(u=r.e-o.e)+1,s||(s=ko,u=Ro(r.e/To)-Ro(o.e/To),T=T/To|0),l=0;_[l]==(x[l]||0);l++);if(_[l]>(x[l]||0)&&u--,T<0)m.push(1),d=!0;else{for(b=x.length,E=_.length,l=0,T+=2,(f=bo(s/(_[0]+1)))>1&&(_=e(_,f,s),x=e(x,f,s),E=_.length,b=x.length),A=E,w=(y=x.slice(0,E)).length;w<E;y[w++]=0);k=_.slice(),k=[0].concat(k),S=_[0],_[1]>=s/2&&S++;do{if(f=0,(c=t(_,y,E,w))<0){if(v=y[0],E!=w&&(v=v*s+(y[1]||0)),(f=bo(v/S))>1)for(f>=s&&(f=s-1),p=(h=e(_,f,s)).length,w=y.length;1==t(h,y,p,w);)f--,n(h,E<p?k:_,p,s),p=h.length,c=1;else 0==f&&(c=f=1),p=(h=_.slice()).length;if(p<w&&(h=[0].concat(h)),n(y,h,w,s),w=y.length,-1==c)for(;t(_,y,E,w)<1;)f++,n(y,E<w?k:_,w,s),w=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[w++]=x[A]||0:(y=[x[A]],w=1)}while((A++<b||null!=y[0])&&T--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==ko){for(l=1,T=m[0];T>=10;T/=10,l++);R(g,i+(g.e=l+u*To-1)+1,a,d)}else g.e=u,g.r=+d;return g}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,d=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,n,r){var o,i=n?t:t.replace(d,"");if(l.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(s,(function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t})),r&&(o=r,i=i.replace(c,"$1").replace(u,"0.$1")),t!=i))return new I(i,o);if(I.DEBUG)throw Error(So+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new I(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return No(this,new I(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,o,i=this;if(null!=e)return Bo(e,0,Co),null==t?t=g:Bo(t,0,8),R(new I(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-Ro(this.e/To))*To,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},f.dividedBy=f.div=function(e,t){return n(this,new I(e,t),p,g)},f.dividedToIntegerBy=f.idiv=function(e,t){return n(this,new I(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,t){var n,r,o,i,a,s,c,u,l=this;if((e=new I(e)).c&&!e.isInteger())throw Error(So+"Exponent not an integer: "+P(e));if(null!=t&&(t=new I(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new I(Math.pow(+P(l),a?e.s*(2-Mo(e)):+P(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new I(NaN);(r=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return i=l.s<0&&Mo(e)?-0:0,l.e>-1&&(i=1/i),new I(s?1/i:i);S&&(i=Ao(S/To+2))}for(a?(n=new I(.5),s&&(e.s=1),c=Mo(e)):c=(o=Math.abs(+P(e)))%2,u=new I(h);;){if(c){if(!(u=u.times(l)).c)break;i?u.c.length>i&&(u.c.length=i):r&&(u=u.mod(t))}if(o){if(0===(o=bo(o/2)))break;c=o%2}else if(R(e=e.times(n),e.e+1,1),e.e>14)c=Mo(e);else{if(0===(o=+P(e)))break;c=o%2}l=l.times(l),i?l.c&&l.c.length>i&&(l.c.length=i):r&&(l=l.mod(t))}return r?u:(s&&(u=h.div(u)),t?u.mod(t):i?R(u,S,g,undefined):u)},f.integerValue=function(e){var t=new I(this);return null==e?e=g:Bo(e,0,8),R(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===No(this,new I(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return No(this,new I(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=No(this,new I(e,t)))||0===t},f.isInteger=function(){return!!this.c&&Ro(this.e/To)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return No(this,new I(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=No(this,new I(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var n,r,o,i,a=this,s=a.s;if(t=(e=new I(e,t)).s,!s||!t)return new I(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/To,u=e.e/To,l=a.c,d=e.c;if(!c||!u){if(!l||!d)return l?(e.s=-t,e):new I(d?a:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new I(l[0]?a:3==g?-0:0)}if(c=Ro(c),u=Ro(u),l=l.slice(),s=c-u){for((i=s<0)?(s=-s,o=l):(u=c,o=d),o.reverse(),t=s;t--;o.push(0));o.reverse()}else for(r=(i=(s=l.length)<(t=d.length))?s:t,s=t=0;t<r;t++)if(l[t]!=d[t]){i=l[t]<d[t];break}if(i&&(o=l,l=d,d=o,e.s=-e.s),(t=(r=d.length)-(n=l.length))>0)for(;t--;l[n++]=0);for(t=ko-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=ko}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?C(e,l,u):(e.s=3==g?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var r,o,i=this;return e=new I(e,t),!i.c||!e.s||e.c&&!e.c[0]?new I(NaN):!e.c||i.c&&!i.c[0]?new I(i):(9==b?(o=e.s,e.s=1,r=n(i,e,0,3),e.s=o,r.s*=o):r=n(i,e,0,b),(e=i.minus(r.times(e))).c[0]||1!=b||(e.s=i.s),e)},f.multipliedBy=f.times=function(e,t){var n,r,o,i,a,s,c,u,l,d,f,h,p,g,m,y=this,w=y.c,v=(e=new I(e,t)).c;if(!(w&&v&&w[0]&&v[0]))return!y.s||!e.s||w&&!w[0]&&!v||v&&!v[0]&&!w?e.c=e.e=e.s=null:(e.s*=y.s,w&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=Ro(y.e/To)+Ro(e.e/To),e.s*=y.s,(c=w.length)<(d=v.length)&&(p=w,w=v,v=p,o=c,c=d,d=o),o=c+d,p=[];o--;p.push(0));for(g=ko,m=_o,o=d;--o>=0;){for(n=0,f=v[o]%m,h=v[o]/m|0,i=o+(a=c);i>o;)n=((u=f*(u=w[--a]%m)+(s=h*u+(l=w[a]/m|0)*f)%m*m+p[i]+n)/g|0)+(s/m|0)+h*l,p[i--]=u%g;p[i]=n}return n?++r:p.splice(0,1),C(e,p,r)},f.negated=function(){var e=new I(this);return e.s=-e.s||null,e},f.plus=function(e,t){var n,r=this,o=r.s;if(t=(e=new I(e,t)).s,!o||!t)return new I(NaN);if(o!=t)return e.s=-t,r.minus(e);var i=r.e/To,a=e.e/To,s=r.c,c=e.c;if(!i||!a){if(!s||!c)return new I(o/0);if(!s[0]||!c[0])return c[0]?e:new I(s[0]?r:0*o)}if(i=Ro(i),a=Ro(a),s=s.slice(),o=i-a){for(o>0?(a=i,n=c):(o=-o,n=s),n.reverse();o--;n.push(0));n.reverse()}for((o=s.length)-(t=c.length)<0&&(n=c,c=s,s=n,t=o),o=0;t;)o=(s[--t]=s[t]+c[t]+o)/ko|0,s[t]=ko===s[t]?0:s[t]%ko;return o&&(s=[o].concat(s),++a),C(e,s,a)},f.precision=f.sd=function(e,t){var n,r,o,i=this;if(null!=e&&e!==!!e)return Bo(e,1,Co),null==t?t=g:Bo(t,0,8),R(new I(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*To+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},f.shiftedBy=function(e){return Bo(e,-9007199254740991,Io),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,r,o,i,a=this,s=a.c,c=a.s,u=a.e,l=p+4,d=new I("0.5");if(1!==c||!s||!s[0])return new I(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+P(a)))||c==1/0?(((t=Po(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=Ro((u+1)/2)-(u<0||u%2),r=new I(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new I(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=d.times(i.plus(n(a,i,l,1))),Po(i.c).slice(0,c)===(t=Po(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(R(r,r.e+p+2,1),e=!r.times(r).eq(a));break}if(!o&&(R(i,i.e+p+2,0),i.times(i).eq(a))){r=i;break}l+=4,c+=4,o=1}return R(r,r.e+p+1,g,e)},f.toExponential=function(e,t){return null!=e&&(Bo(e,0,Co),e++),x(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(Bo(e,0,Co),e=e+this.e+1),x(this,e,t)},f.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=E;else if("object"!=typeof n)throw Error(So+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var i,a=r.split("."),s=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",l=a[0],d=a[1],f=o.s<0,h=f?l.slice(1):l,p=h.length;if(c&&(i=s,s=c,c=i,p-=i),s>0&&p>0){for(i=p%s||s,l=h.substr(0,i);i<p;i+=s)l+=u+h.substr(i,s);c>0&&(l+=u+h.slice(i)),f&&(l="-"+l)}r=d?l+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):l}return(n.prefix||"")+r+(n.suffix||"")},f.toFraction=function(e){var t,r,o,i,a,s,c,u,l,d,f,p,m=this,y=m.c;if(null!=e&&(!(c=new I(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(So+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+P(c));if(!y)return new I(m);for(t=new I(h),l=r=new I(h),o=u=new I(h),p=Po(y),a=t.e=p.length-m.e-1,t.c[0]=xo[(s=a%To)<0?To+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=v,v=1/0,c=new I(p),u.c[0]=0;d=n(c,t,0,1),1!=(i=r.plus(d.times(o))).comparedTo(e);)r=o,o=i,l=u.plus(d.times(i=l)),u=i,t=c.minus(d.times(i=t)),c=i;return i=n(e.minus(r),o,0,1),u=u.plus(i.times(l)),r=r.plus(i.times(o)),u.s=l.s=m.s,f=n(l,o,a*=2,g).minus(m).abs().comparedTo(n(u,r,a,g).minus(m).abs())<1?[l,o]:[u,r],v=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&Bo(e,1,Co),x(this,e,t,2)},f.toString=function(e){var t,n=this,o=n.s,i=n.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=m||i>=y?Oo(Po(n.c),i):zo(Po(n.c),i,"0"):10===e&&T?t=zo(Po((n=R(new I(n),p+i+1,g)).c),n.e,"0"):(Bo(e,2,k.length,"Base"),t=r(zo(Po(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(t="-"+t)),t},f.valueOf=f.toJSON=function(){return P(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=t&&I.set(t),I}();const jo=Uo;function Lo(e,t){return ae(e,(e=>"string"==typeof e&&t.test(e)))}const Do=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Fo=/^[-a-z0-9]{3,8}$/u,$o=/^[-_a-zA-Z0-9]{1,32}$/u,Wo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,qo=/^[-.%a-zA-Z0-9]{1,128}$/u,Vo=/^[-a-z0-9]{3,8}$/u,Ko=/^[-.%a-zA-Z0-9]{1,128}$/u,Go=/^[-.%a-zA-Z0-9]{1,78}$/u,Ho=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,Zo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,Jo=(Lo("CaipChainId",Do),Lo("CaipNamespace",Fo),Lo("CaipReference",$o),Lo("CaipAccountId",Wo),Lo("CaipAccountAddress",qo),Lo("CaipAssetNamespace",Vo),Lo("CaipAssetReference",Ko),Lo("CaipTokenId",Go),Lo("CaipAssetType",Ho));Lo("CaipAssetId",Zo),Lo("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var Yo;function Qo(e){const t=Ho.exec(e);if(!t?.groups)throw new Error("Invalid CAIP asset type.");return{assetNamespace:t.groups.assetNamespace,assetReference:t.groups.assetReference,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}function Xo(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(Yo=Yo||(Yo={}));class ei extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function ti(e,t="Assertion failed.",n=ei){if(!e){if(t instanceof Error)throw t;throw Xo(n,t)}}var ni=-32700,ri=-32603,oi=-32602,ii=-32601,ai=-32600,si=-32015,ci=-32014,ui=-32012,li=-32010,di=-32009,fi=-32007,hi=-32006,pi=-32004,gi=-32002,mi=-32001,yi=28e5,wi=2800001,vi=2800003,Ai=2800006,bi=2800007,Si=2800008,Ei=2800009,ki=323e4,Ti=32300001,Ii=3230002,xi=3230004,_i=361e4,Ci=3610001,Ri=3610003,Pi=3610005,Ni=3610006,Bi=3610007,Mi=3704001,Oi=3704002,zi=3704003,Ui=4615e3,ji=4615026,Li=4615045,Di=5508e3,Fi=5663e3,$i=5663001,Wi=5663004,qi=5663005,Vi=5663006,Ki=5663007,Gi=5663008,Hi=5663009,Zi=5663012,Ji=5663015,Yi=5663016,Qi=5663017,Xi=5663018,ea=5663019,ta=705e4,na=7050030,ra=7050031,oa=7050035,ia=8078e3,aa=8078001,sa=8078002,ca=8078004,ua=8078005,la=8078006,da=8078007,fa=8078008,ha=8078010,pa=8078011,ga=8078012,ma=8078013,ya=8078014,wa=8078017,va=8078018,Aa=8078022,ba=81e5,Sa=8100002,Ea=8100003,ka=9900003;function Ta(e){if(Array.isArray(e)){return"%5B"+e.map(Ta).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function Ia([e,t]){return`${e}=${Ta(t)}`}function xa(e,t={}){{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${function(e){const t=Object.entries(e).map(Ia).join("&");return btoa(t)}(t)}'`),`${n}\``}}function _a(e,t){return!!(e instanceof Error&&"SolanaError"===e.name)&&(void 0===t||e.context.__code===t)}var Ca=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;if(t){const{cause:e,...o}=t;e&&(r={cause:e}),Object.keys(o).length>0&&(n=o)}super(xa(e,n),r),this.context={__code:e,...n},this.name="SolanaError"}};function Ra(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function Pa({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:n,rpcEnumError:r},o){let i,a;"string"==typeof r?i=r:(i=Object.keys(r)[0],a=r[i]);const s=e+n.indexOf(i),c=t(s,i,a),u=new Ca(s,c);return Ra(u,o),u}var Na=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"];function Ba(e,t){const n=Number(e);return Pa({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===Ui?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===ji?{code:Number(r),index:n}:e===Li?{encodedData:r,index:n}:{index:n},orderedErrorNames:Na,rpcEnumError:t},Ba)}var Ma=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function Oa(e){return"object"==typeof e&&"InstructionError"in e?Ba(...e.InstructionError):Pa({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===ta?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===na?{index:Number(n)}:e===ra||e===oa?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:Ma,rpcEnumError:e},Oa)}function za(e){let t;if("object"==typeof(n=e)&&null!==n&&"code"in n&&"message"in n&&("number"==typeof n.code||"bigint"==typeof n.code)&&"string"==typeof n.message){const{code:n,data:r,message:o}=e,i=Number(n);if(i===gi){const{err:e,...n}=r,o=e?{cause:Oa(e)}:null;t=new Ca(gi,{...n,...o})}else{let e;switch(i){case ri:case oi:case ai:case ii:case ni:case ui:case mi:case pi:case ci:case li:case di:case fi:case hi:case si:e={__serverMessage:o};break;default:"object"!=typeof r||Array.isArray(r)||(e=r)}t=new Ca(i,e)}}else{const n="object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:"Malformed JSON-RPC error with no message attribute";t=new Ca(10,{error:e,message:n})}var n;return Ra(t,za),t}var Ua=(e,t)=>((e,t)=>{if(e.length>=t)return e;const n=new Uint8Array(t).fill(0);return n.set(e),n})(e.length<=t?e:e.slice(0,t),t);function ja(e,t,n){const r=0===n&&e.length===t.length?e:e.slice(n,n+t.length);return r.length===t.length&&t.every(((e,t)=>e===r[t]))}function La(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function Da(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(La(t,e));return e.write(t,n,0),n}})}function Fa(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function $a(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function Wa(e){if(!$a(e))throw new Ca(sa)}function qa(e){return!$a(e)}function Va(e,t){if($a(e)!==$a(t))throw new Ca(ca);if($a(e)&&$a(t)&&e.fixedSize!==t.fixedSize)throw new Ca(ua,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!$a(e)&&!$a(t)&&e.maxSize!==t.maxSize)throw new Ca(la,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function Ka(e,t,n,r=0){const o=n.length-r;if(o<t)throw new Ca(aa,{bytesLength:o,codecDescription:e,expected:t})}function Ga(e,t,n){if(t<0||t>n)throw new Ca(ya,{bytesLength:n,codecDescription:e,offset:t})}function Ha(e,t){const n=(n,r,o)=>{const i=e.encode(n);return o=t.write(i.length,r,o),r.set(i,o),o+i.length};if($a(t)&&$a(e))return Da({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=$a(t)?t.fixedSize:t.maxSize??null,o=$a(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Da({...e,...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=La(n,e);return La(r,t)+r},write:n})}function Za(e,t){const n=(n,r)=>{const[o,i]=t.read(n,r),a=Number(o);return((r=i)>0||n.length>a)&&(n=n.slice(r,r+a)),Ka("addDecoderSizePrefix",a,n),[e.decode(n),r+a]};if($a(t)&&$a(e))return Fa({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=$a(t)?t.fixedSize:t.maxSize??null,o=$a(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Fa({...e,...null!==i?{maxSize:i}:{},read:n})}function Ja(e,t){return Da({fixedSize:t,write:(n,r,o)=>{const i=e.encode(n),a=i.length>t?i.slice(0,t):i;return r.set(a,o),o+t}})}function Ya(e,t){return Fa({fixedSize:t,read:(n,r)=>{Ka("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),$a(e)&&(n=Ua(n,e.fixedSize));const[o]=e.read(n,0);return[o,r+t]}})}function Qa(e,t){return Da({...e,write:(n,r,o)=>{const i=e=>es(e,r.length),a=t.preOffset?t.preOffset({bytes:r,preOffset:o,wrapBytes:i}):o;Ga("offsetEncoder",a,r.length);const s=e.write(n,r,a),c=t.postOffset?t.postOffset({bytes:r,newPreOffset:a,postOffset:s,preOffset:o,wrapBytes:i}):s;return Ga("offsetEncoder",c,r.length),c}})}function Xa(e,t){return Fa({...e,read:(n,r)=>{const o=e=>es(e,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Ga("offsetDecoder",i,n.length);const[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return Ga("offsetDecoder",c,n.length),[a,c]}})}function es(e,t){return 0===t?0:(e%t+t)%t}function ts(e,t){if($a(e)){const n=t(e.fixedSize);if(n<0)throw new Ca(ma,{bytesLength:n,codecDescription:"resizeEncoder"});return Da({...e,fixedSize:n})}return Da({...e,getSizeFromValue:n=>{const r=t(e.getSizeFromValue(n));if(r<0)throw new Ca(ma,{bytesLength:r,codecDescription:"resizeEncoder"});return r}})}function ns(e,t){if($a(e)){const n=t(e.fixedSize);if(n<0)throw new Ca(ma,{bytesLength:n,codecDescription:"resizeDecoder"});return Fa({...e,fixedSize:n})}return e}function rs(e,t){return Qa(ts(e,(e=>e+t)),{preOffset:({preOffset:e})=>e+t})}function os(e,t){return Xa(ns(e,(e=>e+t)),{postOffset:({postOffset:e})=>e+t})}function is(e,t){return Da({...qa(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function as(e,t){return Fa({...e,read:(n,r)=>{const[o,i]=e.read(n,r);return[t(o,n,r),i]}})}function ss(e,t,n,r){if(r<t||r>n)throw new Ca(pa,{codecDescription:e,max:n,min:t,value:r})}var cs,us=((cs=us||{})[cs.Little=0]="Little",cs[cs.Big=1]="Big",cs);function ls(e){return 1!==e?.endian}function ds(e){return Da({fixedSize:e.size,write(t,n,r){e.range&&ss(e.name,e.range[0],e.range[1],t);const o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,ls(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function fs(e){return Fa({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Ca(ia,{codecDescription:e})}(e.name,t,n),Ka(e.name,e.size,t,n);const r=new DataView(function(e,t,n){const r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}(t,n,e.size));return[e.get(r,ls(e.config)),n+e.size]}})}var hs=(e={})=>fs({config:e,get:(e,t)=>e.getFloat64(0,t),name:"f64",size:8}),ps=(e={})=>fs({config:e,get:(e,t)=>e.getInt16(0,t),name:"i16",size:2}),gs=(e={})=>fs({config:e,get:(e,t)=>e.getBigInt64(0,t),name:"i64",size:8}),ms=()=>fs({get:e=>e.getInt8(0),name:"i8",size:1}),ys=()=>Da({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{ss("shortU16",0,65535,e);const r=[0];for(let t=0;;t+=1){const n=Number(e)>>7*t;if(0===n)break;const o=127&n;r[t]=o,t>0&&(r[t-1]|=128)}return t.set(r,n),n+r.length}}),ws=()=>Fa({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){const o=r-1,i=e[t+o];if(n|=(127&i)<<7*o,!(128&i))break}return[n,t+r]}}),vs=(e={})=>fs({config:e,get:(e,t)=>e.getUint16(0,t),name:"u16",size:2}),As=(e={})=>ds({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),bs=(e={})=>fs({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),Ss=(e={})=>ds({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),Es=(e={})=>fs({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}),ks=()=>ds({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),Ts=()=>fs({get:e=>e.getUint8(0),name:"u8",size:1});var Is,xs=((Is=xs||{})[Is.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",Is[Is.READONLY_SIGNER=2]="READONLY_SIGNER",Is[Is.WRITABLE=1]="WRITABLE",Is[Is.READONLY=0]="READONLY",Is);function _s(e){return e>=2}function Cs(e){return!!(1&e)}function Rs(e,t){return e|t}function Ps(e){return 2|e}function Ns(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Ca(ga,{alphabet:e,base:e.length,value:n})}var Bs=e=>Da({getSizeFromValue:t=>{const[n,r]=zs(t,e[0]);if(!r)return t.length;const o=Us(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Ns(e,t),""===t)return r;const[o,i]=zs(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=Us(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),Ms=e=>Fa({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}}),Os=e=>Va(Bs(e),Ms(e));function zs(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function Us(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var js="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ls=()=>Bs(js),Ds=()=>Ms(js),Fs=()=>Os(js);var $s,Ws,qs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vs=()=>Da({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Ca(ga,{alphabet:qs,base:64,value:e})}},write(e,t,n){try{const r=atob(e).split("").map((e=>e.charCodeAt(0)));return t.set(r,n),r.length+n}catch{throw new Ca(ga,{alphabet:qs,base:64,value:e})}}}),Ks=()=>Fa({read(e,t=0){const n=e.slice(t);return[btoa(String.fromCharCode(...n)),e.length]}}),Gs=()=>Va(Vs(),Ks()),Hs=e=>e.replace(/\u0000/g,""),Zs=globalThis.TextDecoder,Js=globalThis.TextEncoder,Ys=()=>{let e;return Fa({read(t,n){const r=(e||=new Zs).decode(t.slice(n));return[Hs(r),t.length]}})},Qs=()=>Va((()=>{let e;return Da({getSizeFromValue:t=>(e||=new Js).encode(t).length,write:(t,n,r)=>{const o=(e||=new Js).encode(t);return n.set(o,r),r+o.length}})})(),Ys());function Xs(){if(!globalThis.isSecureContext)throw new Ca(_i)}function ec(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new Ca(Ri)}function tc(){return $s||($s=Ls()),$s}function nc(e){if(e.length<32||e.length>44)return!1;const t=tc();try{return 32===t.encode(e).byteLength}catch{return!1}}function rc(e){if(e.length<32||e.length>44)throw new Ca(wi,{actualLength:e.length});const t=tc().encode(e).byteLength;if(32!==t)throw new Ca(yi,{actualLength:t})}function oc(e){return rc(e),e}function ic(){return is(Ja(tc(),32),(e=>oc(e)))}function ac(){return Ya((Ws||(Ws=Ds()),Ws),32)}function sc(){return Va(ic(),ac())}function cc(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var uc=57896044618658097711785492504343953926634992332820282019728792003956564819949n,lc=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function dc(e){const t=e%uc;return t>=0n?t:uc+t}function fc(e,t){let n=e;for(;t-- >0n;)n*=n,n%=uc;return n}function hc(e,t){const n=dc(t*t*t),r=function(e){const t=e*e%uc*e%uc,n=fc(t,2n)*t%uc,r=fc(n,1n)*e%uc,o=fc(r,5n)*r%uc,i=fc(o,10n)*o%uc,a=fc(i,20n)*i%uc,s=fc(a,40n)*a%uc,c=fc(s,80n)*s%uc,u=fc(c,80n)*s%uc,l=fc(u,10n)*o%uc;return fc(l,2n)*e%uc}(e*dc(n*n*t));let o=dc(e*n*r);const i=dc(t*o*o),a=o,s=dc(o*lc),c=i===e,u=i===dc(-e),l=i===dc(-e*lc);return c&&(o=a),(u||l)&&(o=s),1n==(1n&dc(o))&&(o=dc(-o)),c||u?o:null}function pc(e){if(32!==e.byteLength)return!1;const t=function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(e);return function(e,t){const n=dc(e*e),r=hc(dc(n-1n),dc(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}(t,e[31])}var gc=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function mc({programAddress:e,seeds:t}){if(function(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new Ca(Ci)}(),t.length>16)throw new Ca(Ai,{actual:t.length,maxSeeds:16});let n;const r=t.reduce(((e,t,r)=>{const o="string"==typeof t?(n||=new TextEncoder).encode(t):t;if(o.byteLength>32)throw new Ca(bi,{actual:o.byteLength,index:r,maxSeedLength:32});return e.push(...o),e}),[]),o=sc(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...gc])),s=new Uint8Array(a);if(pc(s))throw new Ca(Si);return o.decode(s)}async function yc({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await mc({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!_a(e,Si))throw e;n--}throw new Ca(Ei)}async function wc(e){if(ec(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new Ca(vi);const t=await crypto.subtle.exportKey("raw",e);return ac().decode(new Uint8Array(t))}var vc,Ac=Object.freeze({name:"Ed25519"});async function bc(e,t){const n=e.byteLength;if(32!==n)throw new Ca(Mi,{actualLength:n});const r=function(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}(e);return await crypto.subtle.importKey("pkcs8",r,Ac,t??!1,["sign"])}async function Sc(e,t){!function(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new Ca(Pi)}();const n=await crypto.subtle.sign(Ac,e,t);return new Uint8Array(n)}function Ec(e){return function(e){if(vc||(vc=Ls()),e.length<64||e.length>88)throw new Ca(zi,{actualLength:e.length});const t=vc.encode(e).byteLength;if(64!==t)throw new Ca(Oi,{actualLength:t})}(e),e}async function kc(e,t,n){return function(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new Ca(Ni)}(),await crypto.subtle.verify(Ac,e,t,n)}async function Tc(e,t=!1){const n=bc(e,t),[r,o]=await Promise.all([(t?n:bc(e,!0)).then((async e=>await async function(e,t=!1){if(ec(),!1===e.extractable)throw new Ca(Bi,{key:e});const n=await crypto.subtle.exportKey("jwk",e);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:t,key_ops:["verify"],kty:"OKP",x:n.x},"Ed25519",t,["verify"])}(e,!0))),n]);return{privateKey:o,publicKey:r}}function Ic(e,t,n){if(t!==n)throw new Ca(da,{actual:n,codecDescription:e,expected:t})}function xc(e){return e.reduce(((e,t)=>null===e||null===t?null:e+t),0)}function _c(e){return $a(e)?e.fixedSize:null}function Cc(e){return $a(e)?e.fixedSize:e.maxSize??null}function Rc(e,t={}){const n=t.size??As(),r=Nc(n,_c(e)),o=Nc(n,Cc(e))??void 0;return Da({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>("object"==typeof n?La(t.length,n):0)+[...t].reduce(((t,n)=>t+La(n,e)),0),maxSize:o},write:(t,r,o)=>("number"==typeof n&&Ic("array",n,t.length),"object"==typeof n&&(o=n.write(t.length,r,o)),t.forEach((t=>{o=e.write(t,r,o)})),o)})}function Pc(e,t={}){const n=t.size??bs(),r=_c(e),o=Nc(n,r),i=Nc(n,Cc(e))??void 0;return Fa({...null!==o?{fixedSize:o}:{maxSize:i},read:(t,r)=>{const o=[];if("object"==typeof n&&0===t.slice(r).length)return[o,r];if("remainder"===n){for(;r<t.length;){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}const[i,a]="number"==typeof n?[n,r]:n.read(t,r);r=a;for(let n=0;n<i;n+=1){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}})}function Nc(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function Bc(e={}){return is(e.size??ks(),(e=>e?1:0))}function Mc(e={}){return as(e.size??Ts(),(e=>1===Number(e)))}function Oc(){return Da({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function zc(){return Fa({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}function Uc(e){return Da({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function jc(e){return Fa({fixedSize:e.length,read:(t,n)=>{const r=Fa({read(e,t){const n=e.slice(t).reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"");return[n,e.length]}});if(!ja(t,e,n))throw new Ca(va,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function Lc(e){const t=xc(e.map(_c)),n=xc(e.map(Cc))??void 0;return Da({...null===t?{getSizeFromValue:t=>e.map(((e,n)=>La(t[n],e))).reduce(((e,t)=>e+t),0),maxSize:n}:{fixedSize:t},write:(t,n,r)=>(Ic("tuple",e.length,t.length),e.forEach(((e,o)=>{r=e.write(t[o],n,r)})),r)})}function Dc(e){const t=xc(e.map(_c)),n=xc(e.map(Cc))??void 0;return Fa({...null===t?{maxSize:n}:{fixedSize:t},read:(t,n)=>{const r=[];return e.forEach((e=>{const[o,i]=e.read(t,n);r.push(o),n=i})),[r,n]}})}function Fc(e,t){const n=qc(e),r=(n,r,o)=>{const i=t(n);return Wc(e,i),e[i].write(n,r,o)};if(null!==n)return Da({fixedSize:n,write:r});const o=Vc(e);return Da({...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=t(n);return Wc(e,r),La(n,e[r])},write:r})}function $c(e,t){const n=qc(e),r=(n,r)=>{const o=t(n,r);return Wc(e,o),e[o].read(n,r)};if(null!==n)return Fa({fixedSize:n,read:r});const o=Vc(e);return Fa({...null!==o?{maxSize:o}:{},read:r})}function Wc(e,t){if(void 0===e[t])throw new Ca(wa,{maxRange:e.length-1,minRange:0,variant:t})}function qc(e){if(0===e.length)return 0;if(!$a(e[0]))return null;const t=e[0].fixedSize;return e.every((e=>$a(e)&&e.fixedSize===t))?t:null}function Vc(e){return e.map((e=>Cc(e))).reduce(((e,t)=>null===e||null===t?null:Math.max(e,t)),0)}function Kc(e,t={}){const n=t.discriminator??"__kind",r=t.size??Ts();return $c(e.map((([e,t])=>as(Dc([r,t]),(([,t])=>({[n]:e,...t}))))),((e,t)=>Number(r.read(e,t)[0])))}function Gc(e){const t=[...new Set(Object.values(e).filter((e=>"number"==typeof e)))].sort(),n=Object.fromEntries(Object.entries(e).slice(t.length)),r=Object.keys(n),o=Object.values(n),i=[...new Set([...r,...o.filter((e=>"string"==typeof e))])];return{enumKeys:r,enumRecord:n,enumValues:o,numericalValues:t,stringValues:i}}function Hc(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function Zc(e){if(0===e.length)return"";let t=[e[0],e[0]];const n=[];for(let r=1;r<e.length;r++){const o=e[r];t[1]+1===o?t[1]=o:(n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),t=[o,o])}return n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),n.join(", ")}function Jc(e,t={}){const n=t.size??ks(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=Gc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Ca(Aa,{stringValues:i.filter((e=>"string"==typeof e))});return is(n,(e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=Hc(t,(e=>e===n));return r>=0?r:e.findIndex((e=>e===n))}({enumKeys:o,enumValues:i,variant:e});if(t<0)throw new Ca(ha,{formattedNumericalValues:Zc(a),numericalValues:a,stringValues:s,variant:e});return r?i[t]:t}))}function Yc(e,t={}){const n=t.size??Ts(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a}=Gc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Ca(Aa,{stringValues:i.filter((e=>"string"==typeof e))});return as(n,(e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?Hc(n,(t=>t===e)):e>=0&&e<t.length?e:-1}({discriminator:t,enumKeys:o,enumValues:i,useValuesAsDiscriminators:r});if(n<0){const e=r?a:[...Array(o.length).keys()];throw new Ca(fa,{discriminator:t,formattedValidDiscriminators:Zc(e),validDiscriminators:e})}return i[n]}))}var Qc;function Xc(e,t){return as(Dc([...t,e]),(e=>e[e.length-1]))}function eu(e,t,n={}){return as(Pc(Dc([e,t]),n),(e=>new Map(e)))}function tu(){return Da({fixedSize:0,write:(e,t,n)=>n})}function nu(){return Fa({fixedSize:0,read:(e,t)=>[void 0,t]})}function ru(e){const t=e.map((([,e])=>e)),n=xc(t.map(_c)),r=xc(t.map(Cc))??void 0;return Da({...null===n?{getSizeFromValue:t=>e.map((([e,n])=>La(t[e],n))).reduce(((e,t)=>e+t),0),maxSize:r}:{fixedSize:n},write:(t,n,r)=>(e.forEach((([e,o])=>{r=o.write(t[e],n,r)})),r)})}function ou(e){const t=e.map((([,e])=>e)),n=xc(t.map(_c)),r=xc(t.map(Cc))??void 0;return Fa({...null===n?{maxSize:r}:{fixedSize:n},read:(t,n)=>{const r={};return e.forEach((([e,o])=>{const[i,a]=o.read(t,n);n=a,r[e]=i})),[r,n]}})}function iu(){return Qc||(Qc=Ls()),Qc}function au(e){if(e.length<32||e.length>44)throw new Ca(4,{actualLength:e.length});const t=iu().encode(e).byteLength;if(32!==t)throw new Ca(5,{actualLength:t})}function su(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new Ca(ka,{unexpectedValue:e})}}var cu=18446744073709551615n;function uu(e){return function(e){if(e<0||e>cu)throw new Ca(6)}(e),e}function lu(e,...t){return t.reduce(((e,t)=>t(e)),e)}function du(e){if(!("lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight))return!1;try{return au(e.lifetimeConstraint.blockhash),!0}catch{return!1}}function fu(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;const n={...t,lifetimeConstraint:Object.freeze(e)};return Object.freeze(n),n}var hu=e=>Da({getSizeFromValue:t=>{const[n,r]=gu(t,e[0]);if(!r)return t.length;const o=mu(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(function(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Ca(ga,{alphabet:e,base:e.length,value:n})}(e,t),""===t)return r;const[o,i]=gu(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=mu(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),pu=e=>Fa({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}});function gu(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function mu(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var yu,wu,vu,Au,bu,Su,Eu="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function ku(){return vu||(vu=ks()),vu}function Tu(){return Au||(Au=Ts()),Au}function Iu(){return Da({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,n)=>{if("legacy"===e)return n;if(e<0||e>127)throw new Ca(Wi,{actualVersion:e});return t.set([128|e],n),n+1}})}function xu(){return Fa({maxSize:1,read:(e,t)=>{const n=e[t];if(128&n){return[128^n,t+1]}return["legacy",t]}})}function _u(){return ru(Ru())}function Cu(){return is(ru([...Ru(),["addressTableLookups",Rc((yu||(yu=ru([["lookupTableAddress",ic()],["writableIndices",Rc(ks(),{size:ys()})],["readableIndices",Rc(ks(),{size:ys()})]])),yu),{size:ys()})]]),(e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]}))}function Ru(){return[["version",Iu()],["header",ru([["numSignerAccounts",ku()],["numReadonlySignerAccounts",ku()],["numReadonlyNonSignerAccounts",ku()]])],["staticAccounts",Rc(ic(),{size:ys()})],["lifetimeToken",Ja(hu(Eu),32)],["instructions",Rc((bu||(bu=is(ru([["programAddressIndex",ks()],["accountIndices",Rc(ks(),{size:ys()})],["data",Ha(Oc(),ys())]]),(e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)}))),bu),{size:ys()})]]}function Pu(){return Da({getSizeFromValue:e=>"legacy"===e.version?_u().getSizeFromValue(e):Cu().getSizeFromValue(e),write:(e,t,n)=>"legacy"===e.version?_u().write(e,t,n):Cu().write(e,t,n)})}function Nu(){return as(ou([["version",xu()],["header",ou([["numSignerAccounts",Tu()],["numReadonlySignerAccounts",Tu()],["numReadonlyNonSignerAccounts",Tu()]])],["staticAccounts",Pc(ac(),{size:ws()})],["lifetimeToken",Ya(pu(Eu),32)],["instructions",Pc((Su||(Su=as(ou([["programAddressIndex",Ts()],["accountIndices",Pc(Ts(),{size:ws()})],["data",Za(zc(),ws())]]),(e=>{if(e.accountIndices.length&&e.data.byteLength)return e;const{accountIndices:t,data:n,...r}=e;return{...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}}))),Su),{size:ws()})],["addressTableLookups",Pc((wu||(wu=ou([["lookupTableAddress",ac()],["writableIndices",Pc(Ts(),{size:ws()})],["readableIndices",Pc(Ts(),{size:ws()})]])),wu),{size:ws()})]]),(({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t))}function Bu(e,t,n){e[t]=n(e[t]??{role:xs.READONLY})}var Mu=Symbol("AddressMapTypeProperty");function Ou(e){const t={};for(const n of e){if(!("lookupTableAddress"in n))continue;const e=t[n.lookupTableAddress]||={readableIndices:[],writableIndices:[]};n.role===xs.WRITABLE?e.writableIndices.push(n.addressIndex):e.readableIndices.push(n.addressIndex)}return Object.keys(t).sort(cc()).map((e=>({lookupTableAddress:e,...t[e]})))}function zu(e){let t=0,n=0,r=0;for(const o of e){if("lookupTableAddress"in o)break;const e=Cs(o.role);_s(o.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Uu(e,t){const n=function(e){const t={};for(const[n,r]of e.entries())t[r.address]=n;return t}(t);return e.map((({accounts:e,data:t,programAddress:r})=>({programAddressIndex:n[r],...e?{accountIndices:e.map((({address:e})=>n[e]))}:null,...t?{data:t}:null})))}function ju(e){const t=e.findIndex((e=>"lookupTableAddress"in e));return(-1===t?e:e.slice(0,t)).map((({address:e})=>e))}function Lu(e){const t=function(e){let t;const n=Object.entries(e).sort((([e,n],[r,o])=>{if(n[Mu]!==o[Mu]){if(0===n[Mu])return-1;if(0===o[Mu])return 1;if(2===n[Mu])return-1;if(2===o[Mu])return 1}const i=_s(n.role);if(i!==_s(o.role))return i?-1:1;const a=Cs(n.role);return a!==Cs(o.role)?a?-1:1:(t||=cc(),1===n[Mu]&&1===o[Mu]&&n.lookupTableAddress!==o.lookupTableAddress?t(n.lookupTableAddress,o.lookupTableAddress):t(e,r))})).map((([e,t])=>({address:e,...t})));return n}(function(e,t){const n={[e]:{[Mu]:0,role:xs.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(Bu(n,e.programAddress,(t=>{if(r.add(e.programAddress),Mu in t){if(Cs(t.role)){if(0===t[Mu])throw new Ca(Fi,{programAddress:e.programAddress});throw new Ca($i,{programAddress:e.programAddress})}if(2===t[Mu])return t}return{[Mu]:2,role:xs.READONLY}})),e.accounts)for(const o of e.accounts)Bu(n,o.address,(e=>{const{address:n,...i}=o;if(Mu in e)switch(e[Mu]){case 0:return e;case 1:{const n=Rs(e.role,i.role);if("lookupTableAddress"in i){if(e.lookupTableAddress!==i.lookupTableAddress&&(t||=cc())(i.lookupTableAddress,e.lookupTableAddress)<0)return{[Mu]:1,...i,role:n}}else if(_s(i.role))return{[Mu]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=Rs(e.role,i.role);if(r.has(o.address)){if(Cs(i.role))throw new Ca($i,{programAddress:o.address});return e.role!==t?{...e,role:t}:e}return"lookupTableAddress"in i&&!_s(e.role)?{...i,[Mu]:1,role:t}:e.role!==t?{...e,role:t}:e}}return"lookupTableAddress"in i?{...i,[Mu]:1}:{...i,[Mu]:2}}))}return n}(e.feePayer.address,e.instructions));return{..."legacy"!==e.version?{addressTableLookups:Ou(t)}:null,header:zu(t),instructions:Uu(e.instructions,t),lifetimeToken:(n=e.lifetimeConstraint,"nonce"in n?n.nonce:n.blockhash),staticAccounts:ju(t),version:e.version};var n}function Du({version:e}){return Object.freeze({instructions:Object.freeze([]),version:e})}var Fu,$u="SysvarRecentB1ockHashes11111111111111111111",Wu="11111111111111111111111111111111";function qu(e,t){return{accounts:[{address:e,role:xs.WRITABLE},{address:$u,role:xs.READONLY},{address:t,role:xs.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Wu}}function Vu(e){return e.programAddress===Wu&&null!=e.data&&(4===(t=e.data).byteLength&&4===t[0]&&0===t[1]&&0===t[2]&&0===t[3])&&3===e.accounts?.length&&null!=e.accounts[0].address&&e.accounts[0].role===xs.WRITABLE&&e.accounts[1].address===$u&&e.accounts[1].role===xs.READONLY&&null!=e.accounts[2].address&&_s(e.accounts[2].role);var t}function Ku(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&Vu(e.instructions[0])}function Gu(e,t){if("feePayer"in t&&e===t.feePayer?.address&&function(e){return!!e&&"address"in e&&"string"==typeof e.address&&1===Object.keys(e).length}(t.feePayer))return t;const n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function Hu(e,t){return Zu([e],t)}function Zu(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Ju(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Yu(e,t){const n=e.staticAccounts[0];if(!n)throw new Ca(Gi);const r=[...function(e){const{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[];let i=0;for(let t=0;t<n;t++)o.push({address:e.staticAccounts[i],role:xs.WRITABLE_SIGNER}),i++;for(let n=0;n<t.numReadonlySignerAccounts;n++)o.push({address:e.staticAccounts[i],role:xs.READONLY_SIGNER}),i++;for(let t=0;t<r;t++)o.push({address:e.staticAccounts[i],role:xs.WRITABLE}),i++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)o.push({address:e.staticAccounts[i],role:xs.READONLY}),i++;return o}(e),..."addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?function(e,t){const n=e.map((e=>e.lookupTableAddress)).filter((e=>void 0===t[e]));if(n.length>0)throw new Ca(qi,{lookupTableAddresses:n});const r=[],o=[];for(const n of e){const e=t[n.lookupTableAddress],i=Math.max(...n.readableIndices,...n.writableIndices);if(i>=e.length)throw new Ca(Vi,{highestKnownIndex:e.length-1,highestRequestedIndex:i,lookupTableAddress:n.lookupTableAddress});const a=n.readableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:xs.READONLY})));r.push(...a);const s=n.writableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:xs.WRITABLE})));o.push(...s)}return[...o,...r]}(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[]],o=e.instructions.map((e=>function(e,t){const n=t[e.programAddressIndex]?.address;if(!n)throw new Ca(Ki,{index:e.programAddressIndex});const r=e.accountIndices?.map((e=>t[e])),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}(e,r))),i=o[0],a=function(e,t,n){if(t&&Vu(t)){const n=t.accounts[0].address;rc(n);const r=t.accounts[2].address;return rc(r),{nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}(e.lifetimeToken,i,t?.lastValidBlockHeight);return lu(Du({version:e.version}),(e=>Gu(n,e)),(e=>o.reduce(((e,t)=>Hu(t,e)),e)),(e=>"blockhash"in a?fu(a,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o;const i=r.instructions[0];if(i&&Vu(i))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(i,t,n)){if(Ku(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)]}else o=[Object.freeze(qu(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(qu(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}(a,e)))}function Qu(e){const t=Object.values(e);if(0===t.length)throw new Ca(Yi);return t.map((e=>e||new Uint8Array(64).fill(0)))}function Xu(){return ru([["signatures",is(Rc(Ja(Oc(),64),{size:ys()}),Qu)],["messageBytes",Oc()]])}function el(){return as(ou([["signatures",Pc(Ya(zc(),64),{size:ws()})],["messageBytes",zc()]]),tl)}function tl(e){const{messageBytes:t,signatures:n}=e,r=Dc([xu(),os(Ts(),2),Pc(ac(),{size:ws()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new Ca(Qi,{numRequiredSignatures:i,signaturesLength:n.length,signerAddresses:s});const c={};return s.forEach(((e,t)=>{const r=n[t];r.every((e=>0===e))?c[e]=null:c[e]=r})),{messageBytes:t,signatures:Object.freeze(c)}}function nl(e){const t=Lu(e),n=Pu().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(const e of r)o[e]=null;let i;i=du(e)?{blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:{nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address};const a={lifetimeConstraint:i,messageBytes:n,signatures:Object.freeze(o)};return Object.freeze(a)}function rl(e){Fu||(Fu=Ds());const t=Object.values(e.signatures)[0];if(!t)throw new Ca(Zi);return Fu.decode(t)}async function ol(e,t){let n,r;if(await Promise.all(e.map((async e=>{const o=await wc(e.publicKey),i=t.signatures[o];if(void 0===i)return r||=new Set,void r.add(o);if(r)return;const a=await Sc(e.privateKey,t.messageBytes);var s,c;null!==i&&(c=i,(s=a).length===c.length&&s.every(((e,t)=>e===c[t])))||(n||={},n[o]=a)}))),r&&r.size>0){const e=Object.keys(t.signatures);throw new Ca(Ji,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function il(e){const t=[];if(Object.entries(e.signatures).forEach((([e,n])=>{n||t.push(e)})),t.length>0)throw new Ca(Hi,{addresses:t})}function al(e){const t=Xu().encode(e);return Ks().decode(t)}function sl(e){const t={};return e.forEach((e=>{if(t[e.address]){if(t[e.address]!==e)throw new Ca(Di,{address:e.address})}else t[e.address]=e})),Object.values(t)}function cl(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function ul(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function ll(e){return"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function dl(e){return ul(e)||cl(e)||ll(e)}function fl(e){return sl((e.accounts??[]).flatMap((e=>"signer"in e?e.signer:[])))}function hl(e){return sl([...e.feePayer&&dl(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(fl)])}function pl(e,t){const n=(r=t)&&"feePayer"in r&&r.feePayer&&"string"==typeof r.feePayer.address&&!dl(r.feePayer)?e.find((e=>e.address===t.feePayer.address)):void 0;var r;return n||0!==t.instructions.length?Object.freeze({...t,...n?{feePayer:n}:null,instructions:t.instructions.map((t=>function(e,t){if(!t.accounts||0===t.accounts.length)return t;const n=new Map(sl(e).map((e=>[e.address,e])));return Object.freeze({...t,accounts:t.accounts.map((e=>{const t=n.get(e.address);return _s(e.role)&&!("signer"in e)&&t?Object.freeze({...e,signer:t}):e}))})}(e,t)))}):t}async function gl(e){const t=await wc(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map((async n=>Object.freeze({[t]:await Sc(e.privateKey,n.content)})))),signTransactions:n=>Promise.all(n.map((async n=>{const r=await ol([e],n);return Object.freeze({[t]:r.signatures[t]})})))};return Object.freeze(n)}async function ml(e,t){return await gl(await Tc(e,t))}function yl(e){const t={address:e,signMessages:e=>Promise.resolve(e.map((()=>Object.freeze({})))),signTransactions:e=>Promise.resolve(e.map((()=>Object.freeze({}))))};return Object.freeze(t)}async function wl(e,t){const{partialSigners:n,modifyingSigners:r}=vl(sl(hl(e).filter(dl)),{identifySendingSigner:!1});return await Al(e,r,n,t)}function vl(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(ll);if(0===t.length)return null;const n=t.filter((e=>!cl(e)&&!ul(e)));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter((e=>e!==n&&(cl(e)||ul(e)))),o=function(e){const t=e.filter(cl);if(0===t.length)return[];const n=t.filter((e=>!ul(e)));return n.length>0?n:[t[0]]}(r),i=r.filter(ul).filter((e=>!o.includes(e)));return Object.freeze({modifyingSigners:o,partialSigners:i,sendingSigner:n})}async function Al(e,t=[],n=[],r){const o=nl(e),i=await t.reduce((async(e,t)=>{r?.abortSignal?.throwIfAborted();const[n]=await t.modifyAndSignTransactions([await e],r);return Object.freeze(n)}),Promise.resolve(o));r?.abortSignal?.throwIfAborted();const a=await Promise.all(n.map((async e=>{const[t]=await e.signTransactions([i],r);return t}))),s={...i,signatures:Object.freeze(a.reduce(((e,t)=>({...e,...t})),i.signatures??{}))};return Object.freeze(s)}var bl=globalThis.TextEncoder;var Sl,El=((Sl=El||{})[Sl.Uninitialized=0]="Uninitialized",Sl[Sl.Initialized=1]="Initialized",Sl);var kl,Tl=((kl=Tl||{})[kl.Legacy=0]="Legacy",kl[kl.Current=1]="Current",kl);var Il,xl,_l="11111111111111111111111111111111",Cl=((Il=Cl||{})[Il.Nonce=0]="Nonce",Il),Rl=((xl=Rl||{})[xl.CreateAccount=0]="CreateAccount",xl[xl.Assign=1]="Assign",xl[xl.TransferSol=2]="TransferSol",xl[xl.CreateAccountWithSeed=3]="CreateAccountWithSeed",xl[xl.AdvanceNonceAccount=4]="AdvanceNonceAccount",xl[xl.WithdrawNonceAccount=5]="WithdrawNonceAccount",xl[xl.InitializeNonceAccount=6]="InitializeNonceAccount",xl[xl.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",xl[xl.Allocate=8]="Allocate",xl[xl.AllocateWithSeed=9]="AllocateWithSeed",xl[xl.AssignWithSeed=10]="AssignWithSeed",xl[xl.TransferSolWithSeed=11]="TransferSolWithSeed",xl[xl.UpgradeNonceAccount=12]="UpgradeNonceAccount",xl);function Pl(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function Nl(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:xs.READONLY});const n=t.isWritable?xs.WRITABLE:xs.READONLY;return Object.freeze({address:Pl(t.value),role:Bl(t.value)?Ps(n):n,...Bl(t.value)?{signer:t.value}:{}})}}function Bl(e){return!!e&&"object"==typeof e&&"address"in e&&dl(e)}function Ml(){return ou([["discriminator",bs()]])}function Ol(){return ou([["discriminator",bs()],["space",Es()]])}function zl(){return ou([["discriminator",bs()],["base",ac()],["seed",Za(Ys(),Es())],["space",Es()],["programAddress",ac()]])}function Ul(){return ou([["discriminator",bs()],["programAddress",ac()]])}function jl(){return ou([["discriminator",bs()],["base",ac()],["seed",Za(Ys(),Es())],["programAddress",ac()]])}function Ll(){return ou([["discriminator",bs()],["newNonceAuthority",ac()]])}function Dl(){return ou([["discriminator",bs()],["lamports",Es()],["space",Es()],["programAddress",ac()]])}function Fl(){return ou([["discriminator",bs()],["base",ac()],["seed",Za(Ys(),Es())],["amount",Es()],["space",Es()],["programAddress",ac()]])}function $l(){return ou([["discriminator",bs()],["nonceAuthority",ac()]])}function Wl(){return is(ru([["discriminator",As()],["amount",Ss()]]),(e=>({...e,discriminator:2})))}function ql(){return ou([["discriminator",bs()],["amount",Es()]])}function Vl(){return ou([["discriminator",bs()],["amount",Es()],["fromSeed",Za(Ys(),Es())],["fromOwner",ac()]])}function Kl(){return ou([["discriminator",bs()]])}function Gl(){return ou([["discriminator",bs()],["withdrawAmount",Es()]])}const Hl={log:(console.log,(...e)=>{}),info:(console.info,(...e)=>{}),warn:(console.warn,(...e)=>{}),debug:(console.debug,(...e)=>{}),error:(console.error,(...e)=>{})};const Zl={log:()=>{},info:()=>{},warn:()=>{},debug:()=>{},error:()=>{}},Jl=(e,t)=>new Proxy(e,{get(e,n){const r=e[n];return"function"==typeof r?(n,...o)=>r.call(e,t,n,...o):r}}),Yl=Hl;const Ql=(e,t)=>`${e}:${t.map((e=>JSON.stringify(e))).join(":")}`,Xl=(e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:o})=>{const i=o??Ql,a=r??e.name??"anonymousFunction";return async(...r)=>{const o=i(a,r);try{const e=await t.get(o);if(void 0!==e)return e}catch(e){Yl.error(`Cache get error for key "${o}":`,e)}const s=await e(...r);return t.set(o,s,n).catch((e=>{Yl.error(`Cache set error for key "${o}":`,e)})),s}},ed=1000000n,td=1e9,nd="metamask";var rd=function(e){return e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",e.Localnet="solana:123456789abcdef",e}({}),od=function(e){return e.SolMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",e.SolDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",e.SolTestnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",e.SolLocalnet="solana:123456789abcdef/slip44:501",e.UsdcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.UsdcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",e.UsdcLocalnet="solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.EurcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcLocalnet="solana:123456789abcdef/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.Ai16zMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC",e}({});Ae(ee(),/^solana:[a-zA-Z0-9]+\/slip44:501$/u);const id=Ae(ee(),/^solana:[a-zA-Z0-9]+\/token:[a-zA-Z0-9]+$/u),ad=(Ae(ee(),/^solana:[a-zA-Z0-9]+\/nft:[a-zA-Z0-9]+$/u),ae("TokenCaipAssetTypeFromString",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;const[t]=id.validate(e);return t||!0})));var sd=function(e){return e.SOL="slip44:501",e}({});const cd={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501":{symbol:"SOL",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501":{symbol:"SOL",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501":{symbol:"SOL",caip19Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:123456789abcdef/slip44:501":{symbol:"SOL",caip19Id:"solana:123456789abcdef/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",decimals:6},"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6}},ud={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":{caip2Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",cluster:"mainnet",name:"Solana Mainnet",nativeToken:cd["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501"]},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":{caip2Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",cluster:"devnet",name:"Solana Devnet",nativeToken:cd["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501"]},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":{caip2Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",cluster:"testnet",name:"Solana Testnet",nativeToken:cd["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501"]},"solana:123456789abcdef":{caip2Id:"solana:123456789abcdef",cluster:"local",name:"Solana Localnet",nativeToken:cd["solana:123456789abcdef/slip44:501"]}},ld=Ae(ee(),/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),dd=Ae(ee(),/^(?!0\d)(\d+(\.\d+)?)$/u),fd=be(ee(),"safe-url",(e=>{try{const t=new URL(e),n=["http:","https:","wss:"];if(!n.includes(t.protocol))return`URL must use one of the following protocols: ${n}`;if(!e.match(/^(https?|wss):\/\/[^/]+\/?/u))return"Malformed URL - incorrect protocol format";const r=t.hostname.toLowerCase();if(!("localhost"===r||r.includes(".")&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/u.test(r)))return"Invalid hostname format";const o=decodeURIComponent(e.toLowerCase());if(e.includes("\\")||e.includes("@")||o.includes("\\")||o.includes("@")||e.toLowerCase().includes("%2f@")||e.toLowerCase().includes("%5c@"))return"URL contains protocol pollution attempts";const i=decodeURIComponent(r);if(r.includes("\\")||r.includes("@")||i.includes("/")||r.toLowerCase().includes("%2f"))return"Invalid hostname characters detected";if(e.includes("../")||e.includes("..%2f")||e.includes("..%2F"))return"Directory traversal attempts are not allowed";const a=[/<[^>]*>/u,/javascript:/u,/data:/u,/\\[@\\]/u,/%2f@/u,/[^\x20-\x7E]/u,/\$\{.*?\}/u,/#\{.*?\}/u,/[|;]/u,/%0[acd]|%0[acd]/u,/\/\/\w+@/u,/(?:[^a-z]|^)(?:union\s+(?:all\s+)?select|select\s+(?:.*\s+)?from|insert\s+into|update\s+.*\s+set|delete\s+from|drop\s+table|alter\s+table|create\s+table|exec(?:ute)?|union|where\s+[\d\w]\s*=\s*[\d\w]|\bor\b\s*[\d\w]\s*=\s*[\d\w])/iu,/'.*?(?:OR|UNION|SELECT|FROM|WHERE).*?'/iu,/%27.*?(?:OR|UNION|SELECT|FROM|WHERE).*?(?:%27|')/iu,/%20(?:OR|UNION|SELECT|FROM|WHERE)%20/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=(?:[^&]*\/\/|https?:)/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=%(?:[^&]*\/\/|https?:)/iu];for(const e of a)if(e.test(o))return"URL contains potentially malicious patterns";return!(t.port&&!/^\d+$/u.test(t.port))||"Invalid port number"}catch(e){return"Invalid URL format"}})),hd=Y({accountId:ld}),pd=Y({accountId:ld}),gd=Y({accountId:ld}),md=Y({accountId:ld,assets:W(mt)}),yd=Y({accountId:ld,pagination:Y({limit:K(),next:Q(Z(ee()))})}),wd=X(mt,Y({amount:dd,unit:ee()})),vd=(W(mt),V(Object.values(en)),V(Object.values(rd))),Ad=(V(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","usd","aed","ars","aud","bdt","bhd","bmd","brl","cad","chf","clp","cny","czk","dkk","eur","gbp","gel","hkd","huf","idr","ils","inr","jpy","krw","kwd","lkr","mmk","mxn","myr","ngn","nok","nzd","php","pkr","pln","rub","sar","sek","sgd","thb","try","twd","uah","vef","vnd","zar","xdr","xag","xau","bits","sats"]),Y({transaction:ee(),scope:V(Object.values(rd))})),bd=Y({value:Z(dd)}),Sd=ae("Base58",(e=>"string"!=typeof e?"Expected a string, but received: "+typeof e:!!/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(e)||"Expected a Base58 encoded string, but received a string with invalid characters")),Ed=Ae(ee(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),kd=Ae(ee(),/^m\/44'\/501'/u),Td=(Ae(ee(),/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/u),ae("SolanaAddress",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;try{return oc(e),!0}catch(e){return"Invalid Solana address"}})));function Id(e){return e&&"string"==typeof e?e.replace(/[\u0000-\u0008\u000A-\u001F\u007F]/gu,""):""}function xd(e,t=1e3){if(!e||"string"!=typeof e)return"";let n=Id(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function _d(e){if(!e||"string"!=typeof e)return"";const t=Id(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?"":t:""}function Cd(e){if(!e||"string"!=typeof e)return"";const t=Id(e);try{const e=new URL(t);return["http:","https:","wss:","ipfs:"].includes(e.protocol)?t.length>2048?"":t:""}catch{return""}}function Rd(e){const{baseUrl:t,path:n,pathParams:r,queryParams:o,encodePathParams:i=!0}=e,a=Cd(t);if(""===a)throw new Error("Invalid URL format");j(a,fd);const s=n.replace(/\{(\w+)\}/gu,((e,t)=>{const n=r?.[t];if(void 0===n)throw new Error(`Path parameter ${t} is undefined`);const o=Id(n);return i?encodeURIComponent(o):o})).replace(/^\/+/u,"").replace(/\/+/gu,"/").replace(/\/+$/u,""),c=new URL(s,a);Object.entries(o??{}).filter((([e,t])=>void 0!==t)).filter((([e,t])=>null!==t)).forEach((([e,t])=>{if(t){const n=Id(t);c.searchParams.append(e,n)}}));const u=c.toString();return j(u,fd),u}var Pd=n(5250);const Nd=re([V(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","bits","sats","sol","sei","sonic"]),V(["usd","aed","amd","ars","aud","bam","bdt","bhd","bmd","brl","cad","chf","clp","cny","cop","crc","czk","dkk","dop","eur","gbp","gel","gtq","hkd","hnl","huf","idr","ils","inr","jpy","kes","krw","kwd","lbp","lkr","mmk","mxn","myr","ngn","nok","nzd","pen","php","pkr","pln","ron","rub","sar","sek","sgd","svc","thb","try","twd","uah","vef","vnd","xdr","zar","zmw"]),V(["xag","xau"])]),Bd=Y({id:ee(),price:we(J(),0),marketCap:Q(Z(we(J(),0))),allTimeHigh:Q(Z(we(J(),0))),allTimeLow:Q(Z(we(J(),0))),totalVolume:Q(Z(we(J(),0))),high1d:Q(Z(we(J(),0))),low1d:Q(Z(we(J(),0))),circulatingSupply:Q(Z(we(J(),0))),dilutedMarketCap:Q(Z(we(J(),0))),marketCapPercentChange1d:Q(Z(J())),priceChange1d:Q(Z(J())),pricePercentChange1h:Q(Z(J())),pricePercentChange1d:Q(Z(J())),pricePercentChange7d:Q(Z(J())),pricePercentChange14d:Q(Z(J())),pricePercentChange30d:Q(Z(J())),pricePercentChange200d:Q(Z(J())),pricePercentChange1y:Q(Z(J())),bondingCurveProgressPercent:Q(Z(J())),liquidity:Q(Z(J())),totalSupply:Q(Z(J())),holderCount:Q(Z(J())),isMutable:Q(Z(q()))}),Md=X(Jo,Z(Bd)),Od=Nd,zd=Y({assetType:Jo,timePeriod:Q(Ae(ee(),/^[1-9][0-9]*[dmy]$/u)),from:Q(we(J(),0)),to:Q(we(J(),0)),vsCurrency:Q(Od)}),Ud=Y({prices:W(te([J(),J()])),marketCaps:W(te([J(),J()])),totalVolumes:W(te([J(),J()]))}),jd={prices:[],marketCaps:[],totalVolumes:[]};const Ld=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const r=e.charAt(n),o=r.charCodeAt(0);if(255!==t[o])throw new TypeError(r+" is ambiguous");t[o]=n}const n=e.length,r=e.charAt(0),o=Math.log(n)/Math.log(256),i=Math.log(256)/Math.log(n);function a(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let i=0,a=0,s=0;for(;e[i]===r;)a++,i++;const c=(e.length-i)*o+1>>>0,u=new Uint8Array(c);for(;e[i];){let r=t[e.charCodeAt(i)];if(255===r)return;let o=0;for(let e=c-1;(0!==r||o<s)&&-1!==e;e--,o++)r+=n*u[e]>>>0,u[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");s=o,i++}let l=c-s;for(;l!==c&&0===u[l];)l++;const d=new Uint8Array(a+(c-l));let f=a;for(;l!==c;)d[f++]=u[l++];return d}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"";let o=0,a=0,s=0;const c=t.length;for(;s!==c&&0===t[s];)s++,o++;const u=(c-s)*i+1>>>0,l=new Uint8Array(u);for(;s!==c;){let e=t[s],r=0;for(let t=u-1;(0!==e||r<a)&&-1!==t;t--,r++)e+=256*l[t]>>>0,l[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");a=r,s++}let d=u-a;for(;d!==u&&0===l[d];)d++;let f=r.repeat(o);for(;d<u;++d)f+=e.charAt(l[d]);return f},decodeUnsafe:a,decode:function(e){const t=a(e);if(t)return t;throw new Error("Non-base"+n+" character")}}};const Dd=Ld("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Fd=n(1048).hp;const $d={[rd.Mainnet]:"mainnet",[rd.Devnet]:"devnet",[rd.Testnet]:"testnet",[rd.Localnet]:"localnet"};const Wd=W(Y({decimals:K(),assetId:ad,name:Q(ee()),symbol:Q(ee()),iconUrl:Q(fd)})),qd={name:"UNKNOWN",symbol:"UNKNOWN",fungible:!0,iconUrl:"",units:[{name:"UNKNOWN",symbol:"UNKNOWN",decimals:9}]};class Vd{#o;#i;#a;#s;#c;static supportedNetworks=[rd.Mainnet,rd.Devnet];constructor(e,t=globalThis.fetch,n=Yl){this.#o=t,this.#i=n;const{tokenApi:r,staticApi:o}=e.get(),{baseUrl:i,chunkSize:a}=r;j(i,fd),this.#a=i,this.#s=a,this.#c=o.baseUrl}async#u(e){j(e,W(id));const t=Rd({baseUrl:this.#a,path:"/v3/assets",queryParams:{assetIds:e.join(",")}}),n=await this.#o(t);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=await n.json();return j(r,Wd),r}async getTokensMetadata(e){try{j(e,W(Jo));const t=e.filter((e=>{const{chainId:t}=Qo(e);return Vd.supportedNetworks.includes(t)}));t.length!==e.length&&this.#i.warn(`[TokenApiClient] Received some asset types on networks that the Token API doesn't support. They will be ignored. Supported networks: ${Vd.supportedNetworks.join(", ")}`);const n=[];for(let e=0;e<t.length;e+=this.#s)n.push(t.slice(e,e+this.#s));const r=(await Promise.all(n.map((async e=>this.#u(e))))).flat(),o=new Map(r.map((e=>[e.assetId,e]))),i=new Map;return e.forEach((e=>{const t=o.get(e),n=this.#l(t,e);i.set(e,n)})),Object.fromEntries(i)}catch(e){throw this.#i.error(e,"Error fetching token metadata"),e}}#d(e){return Rd({baseUrl:this.#c,path:"/api/v2/tokenIcons/assets/{assetType}.png",pathParams:{assetType:e.replace(/:/gu,"/")},encodePathParams:!1})}#l(e,t){const n=this.#d(t);if(!e)return this.#i.warn(`No metadata for ${t}. Returning default values.`),{...qd,iconUrl:n};const r=e.name??qd.name,o=e.symbol??qd.symbol,i=e.decimals??9;return{name:r,symbol:o,fungible:!0,iconUrl:e.iconUrl??n,units:[{name:r,symbol:o,decimals:i}]}}}var Kd,Gd="ComputeBudget111111111111111111111111111111",Hd=((Kd=Hd||{})[Kd.RequestUnits=0]="RequestUnits",Kd[Kd.RequestHeapFrame=1]="RequestHeapFrame",Kd[Kd.SetComputeUnitLimit=2]="SetComputeUnitLimit",Kd[Kd.SetComputeUnitPrice=3]="SetComputeUnitPrice",Kd[Kd.SetLoadedAccountsDataSizeLimit=4]="SetLoadedAccountsDataSizeLimit",Kd);function Zd(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;if(ja(t,ks().encode(3),0))return 3;if(ja(t,ks().encode(4),0))return 4;throw new Error("The provided instruction could not be identified as a computeBudget instruction.")}function Jd(){return ou([["discriminator",Ts()],["bytes",bs()]])}function Yd(){return ou([["discriminator",Ts()],["units",bs()],["additionalFee",bs()]])}function Qd(){return is(ru([["discriminator",ks()],["units",As()]]),(e=>({...e,discriminator:2})))}function Xd(){return ou([["discriminator",Ts()],["units",bs()]])}function ef(e,t){const n={...e};return{programAddress:t?.programAddress??Gd,data:Qd().encode(n)}}function tf(e){return{programAddress:e.programAddress,data:Xd().decode(e.data)}}function nf(){return is(ru([["discriminator",ks()],["microLamports",Ss()]]),(e=>({...e,discriminator:3})))}function rf(){return ou([["discriminator",Ts()],["microLamports",Es()]])}function of(e,t){const n={...e};return{programAddress:t?.programAddress??Gd,data:nf().encode(n)}}function af(e){return{programAddress:e.programAddress,data:rf().decode(e.data)}}function sf(){return ou([["discriminator",Ts()],["accountDataSizeLimit",bs()]])}var cf=e=>({__option:"Some",value:e}),uf=e=>!!(e&&"object"==typeof e&&"__option"in e&&("Some"===e.__option&&"value"in e||"None"===e.__option)),lf=e=>"Some"===e.__option;function df(e,t={}){const n=null===t.prefix?is(tu(),(e=>{})):Bc({size:t.prefix??ks()});return Fc([is(Lc([n,"zeroes"===t.noneValue?(Wa(e),Ja(tu(),e.fixedSize)):t.noneValue?Uc(t.noneValue):tu()]),(e=>[!1,void 0])),is(Lc([n,e]),(e=>[!0,uf(e)&&lf(e)?e.value:e]))],(e=>{const t=uf(e)?e:(e=>null!==e?cf(e):{__option:"None"})(e);return Number(lf(t))}))}function ff(e,t={}){const n=null===t.prefix?as(nu(),(()=>!1)):Mc({size:t.prefix??Ts()}),r="zeroes"===t.noneValue?(Wa(e),Ya(nu(),e.fixedSize)):t.noneValue?jc(t.noneValue):nu();return $c([as(Dc([n,r]),(()=>({__option:"None"}))),as(Dc([n,e]),(([,e])=>cf(e)))],((e,o)=>{if(null===t.prefix&&!t.noneValue)return Number(o<e.length);if(null===t.prefix&&null!=t.noneValue){return ja(e,"zeroes"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,o)?0:1}return Number(n.read(e,o)[0])}))}var hf,pf=((hf=pf||{})[hf.Uninitialized=0]="Uninitialized",hf[hf.Initialized=1]="Initialized",hf[hf.Frozen=2]="Frozen",hf);var gf,mf=((gf=mf||{})[gf.MintTokens=0]="MintTokens",gf[gf.FreezeAccount=1]="FreezeAccount",gf[gf.AccountOwner=2]="AccountOwner",gf[gf.CloseAccount=3]="CloseAccount",gf);function yf(){return Yc(mf)}var wf,vf="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",Af=((wf=Af||{})[wf.CreateAssociatedToken=0]="CreateAssociatedToken",wf[wf.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",wf[wf.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",wf);var bf,Sf="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Ef=((bf=Ef||{})[bf.Mint=0]="Mint",bf[bf.Token=1]="Token",bf[bf.Multisig=2]="Multisig",bf);var kf,Tf=((kf=Tf||{})[kf.InitializeMint=0]="InitializeMint",kf[kf.InitializeAccount=1]="InitializeAccount",kf[kf.InitializeMultisig=2]="InitializeMultisig",kf[kf.Transfer=3]="Transfer",kf[kf.Approve=4]="Approve",kf[kf.Revoke=5]="Revoke",kf[kf.SetAuthority=6]="SetAuthority",kf[kf.MintTo=7]="MintTo",kf[kf.Burn=8]="Burn",kf[kf.CloseAccount=9]="CloseAccount",kf[kf.FreezeAccount=10]="FreezeAccount",kf[kf.ThawAccount=11]="ThawAccount",kf[kf.TransferChecked=12]="TransferChecked",kf[kf.ApproveChecked=13]="ApproveChecked",kf[kf.MintToChecked=14]="MintToChecked",kf[kf.BurnChecked=15]="BurnChecked",kf[kf.InitializeAccount2=16]="InitializeAccount2",kf[kf.SyncNative=17]="SyncNative",kf[kf.InitializeAccount3=18]="InitializeAccount3",kf[kf.InitializeMultisig2=19]="InitializeMultisig2",kf[kf.InitializeMint2=20]="InitializeMint2",kf[kf.GetAccountDataSize=21]="GetAccountDataSize",kf[kf.InitializeImmutableOwner=22]="InitializeImmutableOwner",kf[kf.AmountToUiAmount=23]="AmountToUiAmount",kf[kf.UiAmountToAmount=24]="UiAmountToAmount",kf);function If(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function xf(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:xs.READONLY});const n=t.isWritable?xs.WRITABLE:xs.READONLY;return Object.freeze({address:If(t.value),role:_f(t.value)?Ps(n):n,..._f(t.value)?{signer:t.value}:{}})}}function _f(e){return!!e&&"object"==typeof e&&"address"in e&&dl(e)}function Cf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Rf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Pf(){return is(ru([["discriminator",ks()],["amount",Ss()],["decimals",ks()]]),(e=>({...e,discriminator:13})))}function Nf(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Bf(e,t){const n=t?.programAddress??Sf,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},delegate:{value:e.delegate??null,isWritable:!1},owner:{value:e.owner??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=xf(n);return{accounts:[a(r.source),a(r.mint),a(r.delegate),a(r.owner),...i],programAddress:n,data:Pf().encode(o)}}function Mf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Of(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function zf(){return ou([["discriminator",Ts()]])}async function Uf(e,t={}){const{programAddress:n="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=t;return await yc({programAddress:n,seeds:[ic().encode(e.owner),ic().encode(e.tokenProgram),ic().encode(e.mint)]})}function jf(){return is(ru([["discriminator",ks()]]),(e=>({...e,discriminator:1})))}function Lf(e,t){const n=t?.programAddress??vf,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),r.systemProgram.value||(r.systemProgram.value="11111111111111111111111111111111");const o=xf(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:jf().encode({})}}function Df(){return ou([["discriminator",Ts()]])}function Ff(){return ou([["discriminator",Ts()]])}function $f(){return ou([["discriminator",Ts()]])}function Wf(){return ou([["discriminator",Ts()],["owner",ac()]])}function qf(){return ou([["discriminator",Ts()],["owner",ac()]])}function Vf(){return ou([["discriminator",Ts()]])}function Kf(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Gf(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Hf(){return ou([["discriminator",Ts()],["m",Ts()]])}function Zf(){return ou([["discriminator",Ts()],["m",Ts()]])}function Jf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Yf(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Qf(){return ou([["discriminator",Ts()]])}function Xf(){return ou([["discriminator",Ts()],["authorityType",yf()],["newAuthority",ff(ac())]])}function eh(){return ou([["discriminator",Ts()]])}function th(){return ou([["discriminator",Ts()]])}function nh(){return ou([["discriminator",Ts()],["amount",Es()]])}function rh(){return is(ru([["discriminator",ks()],["amount",Ss()],["decimals",ks()]]),(e=>({...e,discriminator:12})))}function oh(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function ih(e,t){const n=t?.programAddress??Sf,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=xf(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:rh().encode(o)}}function ah(){return ou([["discriminator",Ts()],["uiAmount",Ys()]])}function sh(e){return!("exists"in e)||"exists"in e&&e.exists}function ch(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Vs().encode(t.data[0]);return Object.freeze({...lh(t),address:e,data:n,exists:!0})}function uh(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info;return Object.freeze({...lh(t),address:e,data:n,exists:!0})}function lh(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function dh(e,t,n={}){const{abortSignal:r,...o}=n;return ch(t,(await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r})).value)}async function fh(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map(((e,n)=>ch(t[n],e)))}function hh(e){if(!e.exists)throw new Ca(ki,{address:e.address})}var ph=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(ph||{});function gh(){return Yc(ph)}var mh=(e=>(e[e.MintTokens=0]="MintTokens",e[e.FreezeAccount=1]="FreezeAccount",e[e.AccountOwner=2]="AccountOwner",e[e.CloseAccount=3]="CloseAccount",e[e.TransferFeeConfig=4]="TransferFeeConfig",e[e.WithheldWithdraw=5]="WithheldWithdraw",e[e.CloseMint=6]="CloseMint",e[e.InterestRate=7]="InterestRate",e[e.PermanentDelegate=8]="PermanentDelegate",e[e.ConfidentialTransferMint=9]="ConfidentialTransferMint",e[e.TransferHookProgramId=10]="TransferHookProgramId",e[e.ConfidentialTransferFeeConfig=11]="ConfidentialTransferFeeConfig",e[e.MetadataPointer=12]="MetadataPointer",e[e.GroupPointer=13]="GroupPointer",e[e.GroupMemberPointer=14]="GroupMemberPointer",e[e.ScaledUiAmount=15]="ScaledUiAmount",e[e.Pause=16]="Pause",e))(mh||{});function yh(){return Yc(mh)}function wh(){return Ya(zc(),36)}function vh(){return Ya(zc(),64)}function Ah(){return Kc([["Uninitialized",nu()],["TransferFeeConfig",Za(ou([["transferFeeConfigAuthority",ac()],["withdrawWithheldAuthority",ac()],["withheldAmount",Es()],["olderTransferFee",Th()],["newerTransferFee",Th()]]),vs())],["TransferFeeAmount",Za(ou([["withheldAmount",Es()]]),vs())],["MintCloseAuthority",Za(ou([["closeAuthority",ac()]]),vs())],["ConfidentialTransferMint",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Mc()],["auditorElgamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["ConfidentialTransferAccount",Za(ou([["approved",Mc()],["elgamalPubkey",ac()],["pendingBalanceLow",vh()],["pendingBalanceHigh",vh()],["availableBalance",vh()],["decryptableAvailableBalance",wh()],["allowConfidentialCredits",Mc()],["allowNonConfidentialCredits",Mc()],["pendingBalanceCreditCounter",Es()],["maximumPendingBalanceCreditCounter",Es()],["expectedPendingBalanceCreditCounter",Es()],["actualPendingBalanceCreditCounter",Es()]]),vs())],["DefaultAccountState",Za(ou([["state",gh()]]),vs())],["ImmutableOwner",Za(ou([]),vs())],["MemoTransfer",Za(ou([["requireIncomingTransferMemos",Mc()]]),vs())],["NonTransferable",Za(ou([]),vs())],["InterestBearingConfig",Za(ou([["rateAuthority",ac()],["initializationTimestamp",Es()],["preUpdateAverageRate",ps()],["lastUpdateTimestamp",Es()],["currentRate",ps()]]),vs())],["CpiGuard",Za(ou([["lockCpi",Mc()]]),vs())],["PermanentDelegate",Za(ou([["delegate",ac()]]),vs())],["NonTransferableAccount",Za(ou([]),vs())],["TransferHook",Za(ou([["authority",ac()],["programId",ac()]]),vs())],["TransferHookAccount",Za(ou([["transferring",Mc()]]),vs())],["ConfidentialTransferFee",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["elgamalPubkey",ac()],["harvestToMintEnabled",Mc()],["withheldAmount",vh()]]),vs())],["ConfidentialTransferFeeAmount",Za(ou([["withheldAmount",vh()]]),vs())],["MetadataPointer",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["TokenMetadata",Za(ou([["updateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["mint",ac()],["name",Za(Ys(),bs())],["symbol",Za(Ys(),bs())],["uri",Za(Ys(),bs())],["additionalMetadata",eu(Za(Ys(),bs()),Za(Ys(),bs()))]]),vs())],["GroupPointer",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["groupAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["TokenGroup",Za(ou([["updateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["mint",ac()],["size",Es()],["maxSize",Es()]]),vs())],["GroupMemberPointer",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["memberAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["TokenGroupMember",Za(ou([["mint",ac()],["group",ac()],["memberNumber",Es()]]),vs())],["ConfidentialMintBurn",nu()],["ScaledUiAmountConfig",Za(ou([["authority",ac()],["multiplier",hs()],["newMultiplierEffectiveTimestamp",Es()],["newMultiplier",hs()]]),vs())],["PausableConfig",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["paused",Mc()]]),vs())],["PausableAccount",nu()]],{size:vs()})}var bh,Sh=((bh=Sh||{})[bh.Uninitialized=0]="Uninitialized",bh[bh.TransferFeeConfig=1]="TransferFeeConfig",bh[bh.TransferFeeAmount=2]="TransferFeeAmount",bh[bh.MintCloseAuthority=3]="MintCloseAuthority",bh[bh.ConfidentialTransferMint=4]="ConfidentialTransferMint",bh[bh.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",bh[bh.DefaultAccountState=6]="DefaultAccountState",bh[bh.ImmutableOwner=7]="ImmutableOwner",bh[bh.MemoTransfer=8]="MemoTransfer",bh[bh.NonTransferable=9]="NonTransferable",bh[bh.InterestBearingConfig=10]="InterestBearingConfig",bh[bh.CpiGuard=11]="CpiGuard",bh[bh.PermanentDelegate=12]="PermanentDelegate",bh[bh.NonTransferableAccount=13]="NonTransferableAccount",bh[bh.TransferHook=14]="TransferHook",bh[bh.TransferHookAccount=15]="TransferHookAccount",bh[bh.ConfidentialTransferFee=16]="ConfidentialTransferFee",bh[bh.ConfidentialTransferFeeAmount=17]="ConfidentialTransferFeeAmount",bh[bh.ScaledUiAmountConfig=18]="ScaledUiAmountConfig",bh[bh.PausableConfig=19]="PausableConfig",bh[bh.PausableAccount=20]="PausableAccount",bh[bh.MetadataPointer=21]="MetadataPointer",bh[bh.TokenMetadata=22]="TokenMetadata",bh[bh.GroupPointer=23]="GroupPointer",bh[bh.TokenGroup=24]="TokenGroup",bh[bh.GroupMemberPointer=25]="GroupMemberPointer",bh[bh.TokenGroupMember=26]="TokenGroupMember",bh);function Eh(){return Yc(Sh,{size:vs()})}function kh(){return Kc([["Name",nu()],["Symbol",nu()],["Uri",nu()],["Key",ou([["fields",Dc([Za(Ys(),bs())])]])]])}function Th(){return ou([["epoch",Es()],["maximumFee",Es()],["transferFeeBasisPoints",vs()]])}function Ih(){return ou([["mintAuthority",ff(ac(),{prefix:bs(),noneValue:"zeroes"})],["supply",Es()],["decimals",Ts()],["isInitialized",Mc()],["freezeAuthority",ff(ac(),{prefix:bs(),noneValue:"zeroes"})],["extensions",ff(Xc(Pc(Ah(),{size:"remainder"}),[jc(rs(ks(),83).encode(1))]),{prefix:null})]])}function xh(e){return function(e,t){try{return"exists"in e&&!e.exists?e:Object.freeze({...e,data:t.decode(e.data)})}catch{throw new Ca(Ii,{address:e.address})}}(e,Ih())}async function _h(e,t,n){const r=await async function(e,t,n){const r=await dh(e,t,n);return xh(r)}(e,t,n);return hh(r),r}var Ch="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",Rh=(e=>(e[e.CreateAssociatedToken=0]="CreateAssociatedToken",e[e.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",e[e.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",e))(Rh||{});var Ph,Nh="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",Bh=((Ph=Bh||{})[Ph.Mint=0]="Mint",Ph[Ph.Token=1]="Token",Ph[Ph.Multisig=2]="Multisig",Ph);var Mh,Oh=((Mh=Oh||{})[Mh.InitializeMint=0]="InitializeMint",Mh[Mh.InitializeAccount=1]="InitializeAccount",Mh[Mh.InitializeMultisig=2]="InitializeMultisig",Mh[Mh.Transfer=3]="Transfer",Mh[Mh.Approve=4]="Approve",Mh[Mh.Revoke=5]="Revoke",Mh[Mh.SetAuthority=6]="SetAuthority",Mh[Mh.MintTo=7]="MintTo",Mh[Mh.Burn=8]="Burn",Mh[Mh.CloseAccount=9]="CloseAccount",Mh[Mh.FreezeAccount=10]="FreezeAccount",Mh[Mh.ThawAccount=11]="ThawAccount",Mh[Mh.TransferChecked=12]="TransferChecked",Mh[Mh.ApproveChecked=13]="ApproveChecked",Mh[Mh.MintToChecked=14]="MintToChecked",Mh[Mh.BurnChecked=15]="BurnChecked",Mh[Mh.InitializeAccount2=16]="InitializeAccount2",Mh[Mh.SyncNative=17]="SyncNative",Mh[Mh.InitializeAccount3=18]="InitializeAccount3",Mh[Mh.InitializeMultisig2=19]="InitializeMultisig2",Mh[Mh.InitializeMint2=20]="InitializeMint2",Mh[Mh.GetAccountDataSize=21]="GetAccountDataSize",Mh[Mh.InitializeImmutableOwner=22]="InitializeImmutableOwner",Mh[Mh.AmountToUiAmount=23]="AmountToUiAmount",Mh[Mh.UiAmountToAmount=24]="UiAmountToAmount",Mh[Mh.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",Mh[Mh.InitializeTransferFeeConfig=26]="InitializeTransferFeeConfig",Mh[Mh.TransferCheckedWithFee=27]="TransferCheckedWithFee",Mh[Mh.WithdrawWithheldTokensFromMint=28]="WithdrawWithheldTokensFromMint",Mh[Mh.WithdrawWithheldTokensFromAccounts=29]="WithdrawWithheldTokensFromAccounts",Mh[Mh.HarvestWithheldTokensToMint=30]="HarvestWithheldTokensToMint",Mh[Mh.SetTransferFee=31]="SetTransferFee",Mh[Mh.InitializeConfidentialTransferMint=32]="InitializeConfidentialTransferMint",Mh[Mh.UpdateConfidentialTransferMint=33]="UpdateConfidentialTransferMint",Mh[Mh.ConfigureConfidentialTransferAccount=34]="ConfigureConfidentialTransferAccount",Mh[Mh.ApproveConfidentialTransferAccount=35]="ApproveConfidentialTransferAccount",Mh[Mh.EmptyConfidentialTransferAccount=36]="EmptyConfidentialTransferAccount",Mh[Mh.ConfidentialDeposit=37]="ConfidentialDeposit",Mh[Mh.ConfidentialWithdraw=38]="ConfidentialWithdraw",Mh[Mh.ConfidentialTransfer=39]="ConfidentialTransfer",Mh[Mh.ApplyConfidentialPendingBalance=40]="ApplyConfidentialPendingBalance",Mh[Mh.EnableConfidentialCredits=41]="EnableConfidentialCredits",Mh[Mh.DisableConfidentialCredits=42]="DisableConfidentialCredits",Mh[Mh.EnableNonConfidentialCredits=43]="EnableNonConfidentialCredits",Mh[Mh.DisableNonConfidentialCredits=44]="DisableNonConfidentialCredits",Mh[Mh.ConfidentialTransferWithFee=45]="ConfidentialTransferWithFee",Mh[Mh.InitializeDefaultAccountState=46]="InitializeDefaultAccountState",Mh[Mh.UpdateDefaultAccountState=47]="UpdateDefaultAccountState",Mh[Mh.Reallocate=48]="Reallocate",Mh[Mh.EnableMemoTransfers=49]="EnableMemoTransfers",Mh[Mh.DisableMemoTransfers=50]="DisableMemoTransfers",Mh[Mh.CreateNativeMint=51]="CreateNativeMint",Mh[Mh.InitializeNonTransferableMint=52]="InitializeNonTransferableMint",Mh[Mh.InitializeInterestBearingMint=53]="InitializeInterestBearingMint",Mh[Mh.UpdateRateInterestBearingMint=54]="UpdateRateInterestBearingMint",Mh[Mh.EnableCpiGuard=55]="EnableCpiGuard",Mh[Mh.DisableCpiGuard=56]="DisableCpiGuard",Mh[Mh.InitializePermanentDelegate=57]="InitializePermanentDelegate",Mh[Mh.InitializeTransferHook=58]="InitializeTransferHook",Mh[Mh.UpdateTransferHook=59]="UpdateTransferHook",Mh[Mh.InitializeConfidentialTransferFee=60]="InitializeConfidentialTransferFee",Mh[Mh.WithdrawWithheldTokensFromMintForConfidentialTransferFee=61]="WithdrawWithheldTokensFromMintForConfidentialTransferFee",Mh[Mh.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=62]="WithdrawWithheldTokensFromAccountsForConfidentialTransferFee",Mh[Mh.HarvestWithheldTokensToMintForConfidentialTransferFee=63]="HarvestWithheldTokensToMintForConfidentialTransferFee",Mh[Mh.EnableHarvestToMint=64]="EnableHarvestToMint",Mh[Mh.DisableHarvestToMint=65]="DisableHarvestToMint",Mh[Mh.WithdrawExcessLamports=66]="WithdrawExcessLamports",Mh[Mh.InitializeMetadataPointer=67]="InitializeMetadataPointer",Mh[Mh.UpdateMetadataPointer=68]="UpdateMetadataPointer",Mh[Mh.InitializeGroupPointer=69]="InitializeGroupPointer",Mh[Mh.UpdateGroupPointer=70]="UpdateGroupPointer",Mh[Mh.InitializeGroupMemberPointer=71]="InitializeGroupMemberPointer",Mh[Mh.UpdateGroupMemberPointer=72]="UpdateGroupMemberPointer",Mh[Mh.InitializeScaledUiAmountMint=73]="InitializeScaledUiAmountMint",Mh[Mh.UpdateMultiplierScaledUiMint=74]="UpdateMultiplierScaledUiMint",Mh[Mh.InitializePausableConfig=75]="InitializePausableConfig",Mh[Mh.Pause=76]="Pause",Mh[Mh.Resume=77]="Resume",Mh[Mh.InitializeTokenMetadata=78]="InitializeTokenMetadata",Mh[Mh.UpdateTokenMetadataField=79]="UpdateTokenMetadataField",Mh[Mh.RemoveTokenMetadataKey=80]="RemoveTokenMetadataKey",Mh[Mh.UpdateTokenMetadataUpdateAuthority=81]="UpdateTokenMetadataUpdateAuthority",Mh[Mh.EmitTokenMetadata=82]="EmitTokenMetadata",Mh[Mh.InitializeTokenGroup=83]="InitializeTokenGroup",Mh[Mh.UpdateTokenGroupMaxSize=84]="UpdateTokenGroupMaxSize",Mh[Mh.UpdateTokenGroupUpdateAuthority=85]="UpdateTokenGroupUpdateAuthority",Mh[Mh.InitializeTokenGroupMember=86]="InitializeTokenGroupMember",Mh);function zh(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function Uh(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:xs.READONLY});const n=t.isWritable?xs.WRITABLE:xs.READONLY;return Object.freeze({address:zh(t.value),role:jh(t.value)?Ps(n):n,...jh(t.value)?{signer:t.value}:{}})}}function jh(e){return!!e&&"object"==typeof e&&"address"in e&&dl(e)}function Lh(){return ou([["discriminator",Ts()],["amount",Es()]])}function Dh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["expectedPendingBalanceCreditCounter",Es()],["newDecryptableAvailableBalance",wh()]])}function Fh(){return ou([["discriminator",Ts()],["amount",Es()]])}function $h(){return is(ru([["discriminator",ks()],["amount",Ss()],["decimals",ks()]]),(e=>({...e,discriminator:13})))}function Wh(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function qh(e,t){const n=t?.programAddress??Nh,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},delegate:{value:e.delegate??null,isWritable:!1},owner:{value:e.owner??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=Uh(n);return{accounts:[a(r.source),a(r.mint),a(r.delegate),a(r.owner),...i],programAddress:n,data:$h().encode(o)}}function Vh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function Kh(){return ou([["discriminator",Ts()],["amount",Es()]])}function Gh(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Hh(){return ou([["discriminator",Ts()]])}function Zh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Jh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["newSourceDecryptableAvailableBalance",wh()],["equalityProofInstructionOffset",ms()],["ciphertextValidityProofInstructionOffset",ms()],["rangeProofInstructionOffset",ms()]])}function Yh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["newSourceDecryptableAvailableBalance",wh()],["equalityProofInstructionOffset",ms()],["transferAmountCiphertextValidityProofInstructionOffset",ms()],["feeSigmaProofInstructionOffset",ms()],["feeCiphertextValidityProofInstructionOffset",ms()],["rangeProofInstructionOffset",ms()]])}function Qh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["amount",Es()],["decimals",Ts()],["newDecryptableAvailableBalance",wh()],["equalityProofInstructionOffset",ms()],["rangeProofInstructionOffset",ms()]])}function Xh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["decryptableZeroBalance",wh()],["maximumPendingBalanceCreditCounter",Es()],["proofInstructionOffset",ms()]])}function ep(){return ou([["discriminator",Ts()]])}function tp(){return is(ru([["discriminator",ks()]]),(e=>({...e,discriminator:1})))}function np(){return ou([["discriminator",Ts()]])}function rp(e,t){const n=t?.programAddress??Ch,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),r.systemProgram.value||(r.systemProgram.value="11111111111111111111111111111111");const o=Uh(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:tp().encode({})}}function op(){return ou([["discriminator",Ts()]])}function ip(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function ap(){return ou([["discriminator",Ts()],["cpiGuardDiscriminator",Ts()]])}function sp(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()]])}function cp(){return ou([["discriminator",Ts()],["memoTransfersDiscriminator",Ts()]])}function up(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}new Uint8Array([250,166,180,250,13,12,184,70]);function lp(){return ou([["discriminator",zc()],["start",ff(Es())],["end",ff(Es())]])}function dp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["proofInstructionOffset",ms()]])}function fp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function hp(){return ou([["discriminator",Ts()],["cpiGuardDiscriminator",Ts()]])}function pp(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()]])}function gp(){return ou([["discriminator",Ts()],["memoTransfersDiscriminator",Ts()]])}function mp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function yp(){return ou([["discriminator",Ts()]])}function wp(){return ou([["discriminator",Ts()]])}function vp(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()]])}function Ap(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()]])}function bp(){return ou([["discriminator",Ts()]])}function Sp(){return ou([["discriminator",Ts()],["owner",ac()]])}function Ep(){return ou([["discriminator",Ts()],["owner",ac()]])}function kp(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["withdrawWithheldAuthorityElGamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Tp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Mc()],["auditorElgamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Ip(){return ou([["discriminator",Ts()],["defaultAccountStateDiscriminator",Ts()],["state",gh()]])}function xp(){return ou([["discriminator",Ts()],["groupMemberPointerDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["memberAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function _p(){return ou([["discriminator",Ts()],["groupPointerDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["groupAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Cp(){return ou([["discriminator",Ts()]])}function Rp(){return ou([["discriminator",Ts()],["interestBearingMintDiscriminator",Ts()],["rateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["rate",ps()]])}function Pp(){return ou([["discriminator",Ts()],["metadataPointerDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Np(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Bp(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Mp(){return ou([["discriminator",Ts()],["closeAuthority",ff(ac())]])}function Op(){return ou([["discriminator",Ts()],["m",Ts()]])}function zp(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:Op().decode(e.data)}}function Up(){return ou([["discriminator",Ts()]])}function jp(){return ou([["discriminator",Ts()],["pausableDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Lp(){return ou([["discriminator",Ts()],["delegate",ac()]])}function Dp(){return ou([["discriminator",Ts()],["scaledUiAmountMintDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["multiplier",hs()]])}new Uint8Array([121,113,108,39,54,51,0,4]);function Fp(){return ou([["discriminator",zc()],["updateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["maxSize",Es()]])}new Uint8Array([152,32,222,176,223,237,116,134]);function $p(){return ou([["discriminator",zc()]])}new Uint8Array([210,225,30,162,88,184,77,141]);function Wp(){return ou([["discriminator",zc()],["name",Za(Ys(),bs())],["symbol",Za(Ys(),bs())],["uri",Za(Ys(),bs())]])}function qp(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["transferFeeConfigAuthority",ff(ac())],["withdrawWithheldAuthority",ff(ac())],["transferFeeBasisPoints",vs()],["maximumFee",Es()]])}function Vp(){return ou([["discriminator",Ts()],["transferHookDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["programId",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Kp(){return ou([["discriminator",Ts()],["amount",Es()]])}function Gp(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Hp(){return ou([["discriminator",Ts()],["pausableDiscriminator",Ts()]])}function Zp(){return ou([["discriminator",Ts()],["newExtensionTypes",Pc(Eh(),{size:"remainder"})]])}function Jp(){return ou([["discriminator",Ts()]])}new Uint8Array([234,18,32,56,89,141,37,181]);function Yp(){return ou([["discriminator",zc()],["idempotent",Mc()],["key",Za(Ys(),bs())]])}function Qp(){return ou([["discriminator",Ts()],["pausableDiscriminator",Ts()]])}function Xp(){return ou([["discriminator",Ts()]])}function eg(){return ou([["discriminator",Ts()],["authorityType",yh()],["newAuthority",ff(ac())]])}function tg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["transferFeeBasisPoints",vs()],["maximumFee",Es()]])}function ng(){return ou([["discriminator",Ts()]])}function rg(){return ou([["discriminator",Ts()]])}function og(){return ou([["discriminator",Ts()],["amount",Es()]])}function ig(){return is(ru([["discriminator",ks()],["amount",Ss()],["decimals",ks()]]),(e=>({...e,discriminator:12})))}function ag(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function sg(e,t){const n=t?.programAddress??Nh,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=Uh(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:ig().encode(o)}}function cg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["amount",Es()],["decimals",Ts()],["fee",Es()]])}function ug(){return ou([["discriminator",Ts()],["uiAmount",Ys()]])}function lg(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["autoApproveNewAccounts",Mc()],["auditorElgamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function dg(){return ou([["discriminator",Ts()],["defaultAccountStateDiscriminator",Ts()],["state",gh()]])}function fg(){return ou([["discriminator",Ts()],["groupMemberPointerDiscriminator",Ts()],["memberAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function hg(){return ou([["discriminator",Ts()],["groupPointerDiscriminator",Ts()],["groupAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function pg(){return ou([["discriminator",Ts()],["metadataPointerDiscriminator",Ts()],["metadataAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function gg(){return ou([["discriminator",Ts()],["scaledUiAmountMintDiscriminator",Ts()],["multiplier",hs()],["effectiveTimestamp",gs()]])}function mg(){return ou([["discriminator",Ts()],["interestBearingMintDiscriminator",Ts()],["rate",ps()]])}new Uint8Array([108,37,171,143,248,30,18,110]);function yg(){return ou([["discriminator",zc()],["maxSize",Es()]])}new Uint8Array([161,105,88,1,237,221,216,203]);function wg(){return ou([["discriminator",zc()],["newUpdateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}new Uint8Array([221,233,49,45,181,202,220,200]);function vg(){return ou([["discriminator",zc()],["field",kh()],["value",Za(Ys(),bs())]])}new Uint8Array([215,228,166,228,84,100,86,123]);function Ag(){return ou([["discriminator",zc()],["newUpdateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function bg(){return ou([["discriminator",Ts()],["transferHookDiscriminator",Ts()],["programId",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Sg(){return ou([["discriminator",Ts()]])}function Eg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["numTokenAccounts",Ts()]])}function kg(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()],["numTokenAccounts",Ts()],["proofInstructionOffset",ms()],["newDecryptableAvailableBalance",wh()]])}function Tg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()]])}function Ig(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()],["proofInstructionOffset",ms()],["newDecryptableAvailableBalance",wh()]])}function xg(e,t,n){const r=t-e;if(r<0)throw new Error("Invalid timespan: end time before start time");const o=n*r/31556736e4;return Math.exp(o)}function _g({currentTimestamp:e,lastUpdateTimestamp:t,initializationTimestamp:n,preUpdateAverageRate:r,currentRate:o}){return xg(n,t,r)*xg(t,e,o)}function Cg(e){return Math.pow(10,e)}function Rg(e,t,n,r,o,i,a){const s=parseFloat(e)*Cg(t)/_g({currentTimestamp:n,lastUpdateTimestamp:r,initializationTimestamp:o,preUpdateAverageRate:i,currentRate:a});return BigInt(Math.trunc(s))}function Pg(e,t,n){const r=parseFloat(e)*Cg(t)/n;return BigInt(Math.trunc(r))}var Ng="ComputeBudget111111111111111111111111111111",Bg={blockhash:"11111111111111111111111111111111",lastValidBlockHeight:0n};function Mg(e){return function(e,t){return e.programAddress===t}(e,Ng)&&function(e){return void 0!==e.data}(e)&&2===e.data[0]}async function Og({abortSignal:e,rpc:t,transactionMessage:n,...r}){const o=Ku(n);let i;i=o||du(n)?n:fu(Bg,n);const a=n.instructions.findIndex(Mg),s=function(e){const t=new Uint8Array(5);return t[0]=2,As().write(e,t,1),Object.freeze({data:t,programAddress:Ng})}(14e5);if(-1===a)i=Hu(s,i);else{const e=[...i.instructions];e.splice(a,1,s),i=Object.freeze({...i,instructions:e})}const c=al(nl(i));try{const{value:{err:n,unitsConsumed:i}}=await t.simulateTransaction(c,{...r,encoding:"base64",replaceRecentBlockhash:!o,sigVerify:!1}).send({abortSignal:e});if(null==i)throw new Ca(Xi);const a=i>4294967295n?4294967295:Number(i);if(n)throw new Ca(ea,{cause:n,unitsConsumed:a});return a}catch(e){if(_a(e,ea))throw e;throw new Ca(Xi,{cause:e})}}async function zg(e,t,n){if(0===e.length)return{};const r=await async function(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map(((e,n)=>e&&"object"==typeof e&&"parsed"in e.data?uh(t[n],e):ch(t[n],e)))}(t,e,n);return function(e){const t=e.filter((e=>sh(e)&&e.data instanceof Uint8Array));if(t.length>0){const e=t.map((e=>e.address));throw new Ca(xi,{addresses:e})}}(r),function(e){const t=e.filter((e=>!e.exists));if(t.length>0){const e=t.map((e=>e.address));throw new Ca(Ti,{addresses:e})}}(r),r.reduce(((e,t)=>({...e,[t.address]:t.data.addresses})),{})}async function Ug(e,t,n){const r=("addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?e.addressTableLookups:[]).map((e=>e.lookupTableAddress)),{lastValidBlockHeight:o,...i}=n??{};return Yu(e,{addressesByLookupTableAddress:r.length>0?await zg(r,t,i):{},lastValidBlockHeight:o})}function jg(e,t){return!t?.preflightCommitment&&function(e,t){return e===t?0:su(e)<su(t)?-1:1}(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function Lg({abortSignal:e,commitment:t,rpc:n,transaction:r,...o}){const i=al(r);return await n.sendTransaction(i,{...jg(t,o),encoding:"base64"}).send({abortSignal:e})}const Dg=async(e,t,n)=>lu(e,Vs().encode,Nu().decode,(async e=>Ug(e,t,n))),Fg=async(e,t,n)=>lu(e,Nu().decode,(async e=>Ug(e,t,n))),$g=e=>lu(e,Xu().encode,Ks().decode),Wg=async e=>lu(e,Vs().encode,el().decode),qg=async(e,t,n)=>(async e=>new Promise(((t,n)=>{if(0===e.length)return void n(new AggregateError([],"No promises to resolve"));let r=0;const o=[];e.forEach(((i,a)=>{Promise.resolve(i).then((e=>t(e)),(t=>{o[a]=t,r+=1,r===e.length&&n(new AggregateError(o,"All promises rejected"))}))}))})))([Wg(e),Dg(e,t,n)]),Vg=oc("KeccakSecp256k11111111111111111111111111111"),Kg=oc("Secp256r1SigVerify1111111111111111111111111");var Gg=function(e){return e[e.Verify=0]="Verify",e}({});const Hg=e=>0,Zg=e=>e.programAddress===Vg,Jg=e=>e.programAddress===Kg,Yg=()=>{return e=[["numSignatures",Va(ks(),Ts())]],Va(ru(e),ou(e));var e},Qg=e=>({programAddress:e.programAddress,data:Yg().decode(e.data??new Uint8Array)});const Xg={[_l]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,As().encode(0),0))return 0;if(ja(t,As().encode(1),0))return 1;if(ja(t,As().encode(2),0))return 2;if(ja(t,As().encode(3),0))return 3;if(ja(t,As().encode(4),0))return 4;if(ja(t,As().encode(5),0))return 5;if(ja(t,As().encode(6),0))return 6;if(ja(t,As().encode(7),0))return 7;if(ja(t,As().encode(8),0))return 8;if(ja(t,As().encode(9),0))return 9;if(ja(t,As().encode(10),0))return 10;if(ja(t,As().encode(11),0))return 11;if(ja(t,As().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")},instructionEnum:Rl,typeToParserMap:{[Rl.Assign]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ul().decode(e.data)}},[Rl.TransferSol]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n()},data:ql().decode(e.data)}},[Rl.CreateAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n()},data:Dl().decode(e.data)}},[Rl.CreateAccountWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n(),baseAccount:n()},data:Fl().decode(e.data)}},[Rl.AdvanceNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),nonceAuthority:n()},data:Ml().decode(e.data)}},[Rl.WithdrawNonceAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recipientAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n(),nonceAuthority:n()},data:Gl().decode(e.data)}},[Rl.InitializeNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n()},data:$l().decode(e.data)}},[Rl.AuthorizeNonceAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),nonceAuthority:n()},data:Ll().decode(e.data)}},[Rl.Allocate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{newAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ol().decode(e.data)}},[Rl.AllocateWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{newAccount:n(),baseAccount:n()},data:zl().decode(e.data)}},[Rl.AssignWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),baseAccount:n()},data:jl().decode(e.data)}},[Rl.TransferSolWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),baseAccount:n(),destination:n()},data:Vl().decode(e.data)}},[Rl.UpgradeNonceAccount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{nonceAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Kl().decode(e.data)}}}},[Gd]:{identifier:Zd,instructionEnum:Hd,typeToParserMap:{[Hd.RequestUnits]:function(e){return{programAddress:e.programAddress,data:Yd().decode(e.data)}},[Hd.RequestHeapFrame]:function(e){return{programAddress:e.programAddress,data:Jd().decode(e.data)}},[Hd.SetComputeUnitPrice]:af,[Hd.SetComputeUnitLimit]:tf,[Hd.SetLoadedAccountsDataSizeLimit]:function(e){return{programAddress:e.programAddress,data:sf().decode(e.data)}}}},[Sf]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;if(ja(t,ks().encode(3),0))return 3;if(ja(t,ks().encode(4),0))return 4;if(ja(t,ks().encode(5),0))return 5;if(ja(t,ks().encode(6),0))return 6;if(ja(t,ks().encode(7),0))return 7;if(ja(t,ks().encode(8),0))return 8;if(ja(t,ks().encode(9),0))return 9;if(ja(t,ks().encode(10),0))return 10;if(ja(t,ks().encode(11),0))return 11;if(ja(t,ks().encode(12),0))return 12;if(ja(t,ks().encode(13),0))return 13;if(ja(t,ks().encode(14),0))return 14;if(ja(t,ks().encode(15),0))return 15;if(ja(t,ks().encode(16),0))return 16;if(ja(t,ks().encode(17),0))return 17;if(ja(t,ks().encode(18),0))return 18;if(ja(t,ks().encode(19),0))return 19;if(ja(t,ks().encode(20),0))return 20;if(ja(t,ks().encode(21),0))return 21;if(ja(t,ks().encode(22),0))return 22;if(ja(t,ks().encode(23),0))return 23;if(ja(t,ks().encode(24),0))return 24;throw new Error("The provided instruction could not be identified as a token instruction.")},instructionEnum:Tf,typeToParserMap:{[Tf.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Kf().decode(e.data)}},[Tf.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:$f().decode(e.data)}},[Tf.InitializeMultisig]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:Hf().decode(e.data)}},[Tf.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:nh().decode(e.data)}},[Tf.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Rf().decode(e.data)}},[Tf.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:Qf().decode(e.data)}},[Tf.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:Xf().decode(e.data)}},[Tf.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Jf().decode(e.data)}},[Tf.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Mf().decode(e.data)}},[Tf.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:zf().decode(e.data)}},[Tf.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:Df().decode(e.data)}},[Tf.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:th().decode(e.data)}},[Tf.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:oh().decode(e.data)}},[Tf.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Nf().decode(e.data)}},[Tf.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Yf().decode(e.data)}},[Tf.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Of().decode(e.data)}},[Tf.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Wf().decode(e.data)}},[Tf.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:eh().decode(e.data)}},[Tf.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:qf().decode(e.data)}},[Tf.InitializeMultisig2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{multisig:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Zf().decode(e.data)}},[Tf.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Gf().decode(e.data)}},[Tf.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ff().decode(e.data)}},[Tf.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vf().decode(e.data)}},[Tf.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cf().decode(e.data)}},[Tf.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ah().decode(e.data)}}}},[Nh]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;if(ja(t,ks().encode(3),0))return 3;if(ja(t,ks().encode(4),0))return 4;if(ja(t,ks().encode(5),0))return 5;if(ja(t,ks().encode(6),0))return 6;if(ja(t,ks().encode(7),0))return 7;if(ja(t,ks().encode(8),0))return 8;if(ja(t,ks().encode(9),0))return 9;if(ja(t,ks().encode(10),0))return 10;if(ja(t,ks().encode(11),0))return 11;if(ja(t,ks().encode(12),0))return 12;if(ja(t,ks().encode(13),0))return 13;if(ja(t,ks().encode(14),0))return 14;if(ja(t,ks().encode(15),0))return 15;if(ja(t,ks().encode(16),0))return 16;if(ja(t,ks().encode(17),0))return 17;if(ja(t,ks().encode(18),0))return 18;if(ja(t,ks().encode(19),0))return 19;if(ja(t,ks().encode(20),0))return 20;if(ja(t,ks().encode(21),0))return 21;if(ja(t,ks().encode(22),0))return 22;if(ja(t,ks().encode(23),0))return 23;if(ja(t,ks().encode(24),0))return 24;if(ja(t,ks().encode(25),0))return 25;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(0),1))return 26;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(1),1))return 27;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(2),1))return 28;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(3),1))return 29;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(4),1))return 30;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(5),1))return 31;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(0),1))return 32;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(1),1))return 33;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(2),1))return 34;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(3),1))return 35;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(4),1))return 36;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(5),1))return 37;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(6),1))return 38;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(7),1))return 39;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(8),1))return 40;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(9),1))return 41;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(10),1))return 42;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(11),1))return 43;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(12),1))return 44;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(13),1))return 45;if(ja(t,ks().encode(28),0)&&ja(t,ks().encode(0),1))return 46;if(ja(t,ks().encode(28),0)&&ja(t,ks().encode(1),1))return 47;if(ja(t,ks().encode(29),0))return 48;if(ja(t,ks().encode(30),0)&&ja(t,ks().encode(0),1))return 49;if(ja(t,ks().encode(30),0)&&ja(t,ks().encode(1),1))return 50;if(ja(t,ks().encode(31),0))return 51;if(ja(t,ks().encode(32),0))return 52;if(ja(t,ks().encode(33),0)&&ja(t,ks().encode(0),1))return 53;if(ja(t,ks().encode(33),0)&&ja(t,ks().encode(1),1))return 54;if(ja(t,ks().encode(34),0)&&ja(t,ks().encode(0),1))return 55;if(ja(t,ks().encode(34),0)&&ja(t,ks().encode(1),1))return 56;if(ja(t,ks().encode(35),0))return 57;if(ja(t,ks().encode(36),0)&&ja(t,ks().encode(0),1))return 58;if(ja(t,ks().encode(36),0)&&ja(t,ks().encode(1),1))return 59;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(0),1))return 60;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(1),1))return 61;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(2),1))return 62;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(3),1))return 63;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(4),1))return 64;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(5),1))return 65;if(ja(t,ks().encode(38),0))return 66;if(ja(t,ks().encode(39),0)&&ja(t,ks().encode(0),1))return 67;if(ja(t,ks().encode(39),0)&&ja(t,ks().encode(1),1))return 68;if(ja(t,ks().encode(40),0)&&ja(t,ks().encode(0),1))return 69;if(ja(t,ks().encode(40),0)&&ja(t,ks().encode(1),1))return 70;if(ja(t,ks().encode(41),0)&&ja(t,ks().encode(0),1))return 71;if(ja(t,ks().encode(41),0)&&ja(t,ks().encode(1),1))return 72;if(ja(t,ks().encode(43),0)&&ja(t,ks().encode(0),1))return 73;if(ja(t,ks().encode(43),0)&&ja(t,ks().encode(1),1))return 74;if(ja(t,ks().encode(44),0)&&ja(t,ks().encode(0),1))return 75;if(ja(t,ks().encode(44),0)&&ja(t,ks().encode(1),1))return 76;if(ja(t,ks().encode(44),0)&&ja(t,ks().encode(2),1))return 77;if(ja(t,new Uint8Array([210,225,30,162,88,184,77,141]),0))return 78;if(ja(t,new Uint8Array([221,233,49,45,181,202,220,200]),0))return 79;if(ja(t,new Uint8Array([234,18,32,56,89,141,37,181]),0))return 80;if(ja(t,new Uint8Array([215,228,166,228,84,100,86,123]),0))return 81;if(ja(t,new Uint8Array([250,166,180,250,13,12,184,70]),0))return 82;if(ja(t,new Uint8Array([121,113,108,39,54,51,0,4]),0))return 83;if(ja(t,new Uint8Array([108,37,171,143,248,30,18,110]),0))return 84;if(ja(t,new Uint8Array([161,105,88,1,237,221,216,203]),0))return 85;if(ja(t,new Uint8Array([152,32,222,176,223,237,116,134]),0))return 86;throw new Error("The provided instruction could not be identified as a token-2022 instruction.")},instructionEnum:Oh,typeToParserMap:{[Oh.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Np().decode(e.data)}},[Oh.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:bp().decode(e.data)}},[Oh.InitializeMultisig]:zp,[Oh.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:og().decode(e.data)}},[Oh.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Fh().decode(e.data)}},[Oh.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:Xp().decode(e.data)}},[Oh.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:eg().decode(e.data)}},[Oh.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Kp().decode(e.data)}},[Oh.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Kh().decode(e.data)}},[Oh.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:Hh().decode(e.data)}},[Oh.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:yp().decode(e.data)}},[Oh.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:rg().decode(e.data)}},[Oh.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:ag().decode(e.data)}},[Oh.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Wh().decode(e.data)}},[Oh.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Gp().decode(e.data)}},[Oh.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Gh().decode(e.data)}},[Oh.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Sp().decode(e.data)}},[Oh.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ng().decode(e.data)}},[Oh.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:Ep().decode(e.data)}},[Oh.InitializeMultisig2]:zp,[Oh.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Bp().decode(e.data)}},[Oh.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:wp().decode(e.data)}},[Oh.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cp().decode(e.data)}},[Oh.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lh().decode(e.data)}},[Oh.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ug().decode(e.data)}},[Oh.InitializeMintCloseAuthority]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Mp().decode(e.data)}},[Oh.InitializeTransferFeeConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:qp().decode(e.data)}},[Oh.TransferCheckedWithFee]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:cg().decode(e.data)}},[Oh.WithdrawWithheldTokensFromMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:Tg().decode(e.data)}},[Oh.WithdrawWithheldTokensFromAccounts]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:Eg().decode(e.data)}},[Oh.HarvestWithheldTokensToMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:vp().decode(e.data)}},[Oh.SetTransferFee]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),transferFeeConfigAuthority:n()},data:tg().decode(e.data)}},[Oh.InitializeConfidentialTransferMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Tp().decode(e.data)}},[Oh.UpdateConfidentialTransferMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:lg().decode(e.data)}},[Oh.ConfigureConfidentialTransferAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:Xh().decode(e.data)}},[Oh.ApproveConfidentialTransferAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Vh().decode(e.data)}},[Oh.EmptyConfidentialTransferAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:dp().decode(e.data)}},[Oh.ConfidentialDeposit]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Zh().decode(e.data)}},[Oh.ConfidentialWithdraw]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Nh?void 0:e};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvar:r(),equalityRecord:r(),rangeRecord:r(),authority:n()},data:Qh().decode(e.data)}},[Oh.ConfidentialTransfer]:function(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Nh?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),ciphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:Jh().decode(e.data)}},[Oh.ApplyConfidentialPendingBalance]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Dh().decode(e.data)}},[Oh.EnableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:fp().decode(e.data)}},[Oh.DisableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:ip().decode(e.data)}},[Oh.EnableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:mp().decode(e.data)}},[Oh.DisableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:up().decode(e.data)}},[Oh.ConfidentialTransferWithFee]:function(e){if(e.accounts.length<10)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Nh?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),transferAmountCiphertextValidityRecord:r(),feeSigmaRecord:r(),feeCiphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:Yh().decode(e.data)}},[Oh.InitializeDefaultAccountState]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ip().decode(e.data)}},[Oh.UpdateDefaultAccountState]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),freezeAuthority:n()},data:dg().decode(e.data)}},[Oh.Reallocate]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),payer:n(),systemProgram:n(),owner:n()},data:Zp().decode(e.data)}},[Oh.EnableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:gp().decode(e.data)}},[Oh.DisableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:cp().decode(e.data)}},[Oh.CreateNativeMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),nativeMint:n(),systemProgram:n()},data:op().decode(e.data)}},[Oh.InitializeNonTransferableMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Up().decode(e.data)}},[Oh.InitializeInterestBearingMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rp().decode(e.data)}},[Oh.UpdateRateInterestBearingMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rateAuthority:n()},data:mg().decode(e.data)}},[Oh.EnableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:hp().decode(e.data)}},[Oh.DisableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:ap().decode(e.data)}},[Oh.InitializePermanentDelegate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lp().decode(e.data)}},[Oh.InitializeTransferHook]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vp().decode(e.data)}},[Oh.UpdateTransferHook]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:bg().decode(e.data)}},[Oh.InitializeConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:kp().decode(e.data)}},[Oh.WithdrawWithheldTokensFromMintForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:Ig().decode(e.data)}},[Oh.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:kg().decode(e.data)}},[Oh.HarvestWithheldTokensToMintForConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ap().decode(e.data)}},[Oh.EnableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:pp().decode(e.data)}},[Oh.DisableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:sp().decode(e.data)}},[Oh.WithdrawExcessLamports]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{sourceAccount:n(),destinationAccount:n(),authority:n()},data:Sg().decode(e.data)}},[Oh.InitializeMetadataPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Pp().decode(e.data)}},[Oh.UpdateMetadataPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),metadataPointerAuthority:n()},data:pg().decode(e.data)}},[Oh.InitializeGroupPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:_p().decode(e.data)}},[Oh.UpdateGroupPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupPointerAuthority:n()},data:hg().decode(e.data)}},[Oh.InitializeGroupMemberPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:xp().decode(e.data)}},[Oh.UpdateGroupMemberPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupMemberPointerAuthority:n()},data:fg().decode(e.data)}},[Oh.InitializeScaledUiAmountMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Dp().decode(e.data)}},[Oh.UpdateMultiplierScaledUiMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:gg().decode(e.data)}},[Oh.InitializePausableConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:jp().decode(e.data)}},[Oh.Pause]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Hp().decode(e.data)}},[Oh.Resume]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Qp().decode(e.data)}},[Oh.InitializeTokenMetadata]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n(),mint:n(),mintAuthority:n()},data:Wp().decode(e.data)}},[Oh.UpdateTokenMetadataField]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:vg().decode(e.data)}},[Oh.RemoveTokenMetadataKey]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:Yp().decode(e.data)}},[Oh.UpdateTokenMetadataUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:Ag().decode(e.data)}},[Oh.EmitTokenMetadata]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{metadata:(()=>{const n=e.accounts[t];return t+=1,n})()},data:lp().decode(e.data)}},[Oh.InitializeTokenGroup]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),mint:n(),mintAuthority:n()},data:Fp().decode(e.data)}},[Oh.UpdateTokenGroupMaxSize]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:yg().decode(e.data)}},[Oh.UpdateTokenGroupUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:wg().decode(e.data)}},[Oh.InitializeTokenGroupMember]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{member:n(),memberMint:n(),memberMintAuthority:n(),group:n(),groupUpdateAuthority:n()},data:$p().decode(e.data)}}}},[vf]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;throw new Error("The provided instruction could not be identified as a associatedToken instruction.")},instructionEnum:Rh,typeToParserMap:{[Rh.CreateAssociatedToken]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:ep().decode(e.data)}},[Rh.CreateAssociatedTokenIdempotent]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:np().decode(e.data)}},[Rh.RecoverNestedAssociatedToken]:function(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nestedAssociatedAccountAddress:n(),nestedTokenMintAddress:n(),destinationAssociatedAccountAddress:n(),ownerAssociatedAccountAddress:n(),ownerTokenMintAddress:n(),walletAddress:n(),tokenProgram:n()},data:Jp().decode(e.data)}}}},[Vg]:{identifier:Hg,instructionEnum:Gg,typeToParserMap:{[Gg.Verify]:Qg}},[Kg]:{identifier:Hg,instructionEnum:Gg,typeToParserMap:{[Gg.Verify]:Qg}}},em=e=>{const{programAddress:t}=e,n={...e,dataBase58:Fs().decode(e.data??new Uint8Array)};try{const r=Xg[t];if(!r)throw new Error("Unsupported program address");const{identifier:o,typeToParserMap:i,instructionEnum:a}=r,s=o(e),c=a[s],u=i[s];if(!u)throw new Error("Unsupported instruction type");return{type:c,encoded:n,parsed:u(e)}}catch(e){return{type:"Unknown",encoded:n,parsed:null}}},tm=(e,t)=>{const n=e.accounts.filter((e=>e<t.transaction.message.accountKeys.length)).map((e=>({address:t.transaction.message.accountKeys[e],role:0}))),r=t.transaction.message.accountKeys[e.programIdIndex];if(!r)throw new Error("Program address not found");return{accounts:n,data:Fs().encode(e.data),programAddress:r}};function nm(e){const{type:t,id:n,address:r,options:o,methods:i,scopes:a}=e;return{type:t,id:n,address:r,options:o,methods:i,scopes:a}}const rm={accountSubscribe:"accountUnsubscribe",programSubscribe:"programUnsubscribe",signatureSubscribe:"signatureUnsubscribe"},om=V(["processed","confirmed","finalized"]),im=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:Gu(e,t),am=e=>e.programAddress===Gd&&Zd({data:new Uint8Array,...e})===Hd.SetComputeUnitPrice,sm=e=>e.instructions.filter(Boolean).some(am),cm=e=>e.programAddress===Gd&&Zd({data:new Uint8Array,...e})===Hd.SetComputeUnitLimit,um=e=>e.instructions.filter(Boolean).some(cm),lm=async(e,t,n)=>{try{const r=e.instructions.filter(Boolean),o=function({rpc:e}){return async function(t,n){return await Og({...n,rpc:e,transactionMessage:t})}}({rpc:t}),i=await o(e,n?.getComputeUnitEstimateConfig).catch((e=>{if(_a(e,ea))return e.context.unitsConsumed;throw e}));return{...(0,Pd.cloneDeep)(e),instructions:[...r.filter((e=>!cm(e))),ef({units:i},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}};class dm extends Error{constructor(e){super(e),this.name="FeeCalculatorError"}}class fm extends dm{constructor(e){super(e),this.name="FeeCalculatorUnsupportedInputTypeError"}}const hm=e=>({ed25519Signatures:["signature"],instructions:e.instructions.map((t=>({accounts:[],data:t.data??new Uint8Array,programAddress:e.staticAccounts[t.programAddressIndex]})))}),pm=e=>({...lu(e.messageBytes,Nu().decode,hm),ed25519Signatures:Object.values(e.signatures)}),gm=e=>lu(e,Vs().encode,el().decode,pm),mm=e=>lu(e,Vs().encode,Nu().decode,hm);class ym{static calculateFee(e){const t=this.#f(e),{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i}=this.#h(t),a=this.#p(i),s=this.#g(t),c=this.#m(t),u=this.#y(s,c);return{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i,baseFee:a,computeUnitLimit:s,computeUnitPriceMicroLamportsPerComputeUnit:c,priorityFee:u,totalFee:uu(a+u)}}static#p(e){return uu(5000n*BigInt(e))}static#g(e){const{instructions:t}=e,n=t.find(cm);return n?tf(n).data.units:0}static#m(e){const{instructions:t}=e,n=t.find(am);return n?af(n).data.microLamports:0n}static#y(e,t){return lu(e,(e=>jo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(ed.toString())),(e=>e.toString()),BigInt,uu)}static#h(e){const{ed25519Signatures:t,instructions:n}=e,r=t.length,o=n.filter(Zg).map(em).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0),i=n.filter(Jg).map(em).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0);return{ed25519SignaturesCount:r,secp256k1SignaturesCount:o,secp256r1SignaturesCount:i,totalSignaturesCount:r+o+i}}static#f(e){if(this.#w(e))return gm(e);if(this.#v(e))return mm(e);if(this.#A(e))return hm(e);if(this.#b(e))return pm(e);if(this.#S(e))return(e=>({ed25519Signatures:e.transaction.signatures,instructions:e.transaction.message.instructions.map((t=>tm(t,e)))}))(e);throw new fm("The fee calculator could not recognize the input type. It supports SolanaTransactions, kit Transactions, and base64 strings.")}static#w(e){try{return"string"==typeof e&&(gm(e),!0)}catch(e){return!1}}static#v(e){try{return"string"==typeof e&&(mm(e),!0)}catch(e){return!1}}static#A(e){return"object"==typeof e&&"instructions"in e&&"staticAccounts"in e}static#S(e){return"object"==typeof e&&"transaction"in e&&"object"==typeof e.transaction&&"message"in e.transaction&&"object"==typeof e.transaction.message&&"accountKeys"in e.transaction.message&&"object"==typeof e.transaction.message.accountKeys&&"instructions"in e.transaction.message&&"object"==typeof e.transaction.message.instructions&&"signatures"in e.transaction&&"object"==typeof e.transaction.signatures}static#b(e){return"object"==typeof e&&"messageBytes"in e&&"object"==typeof e.messageBytes&&"signatures"in e}}const wm=e=>jo(e.toString()).dividedBy(td),vm=e=>jo(e.toString()).multipliedBy(td).integerValue(jo.ROUND_DOWN);var Am=function(e){return e.SignAndSendTransactionWithoutConfirmation="signAndSendTransactionWithoutConfirmation",e.ConfirmSend="confirmSend",e.SignAndSendTransaction="signAndSendTransaction",e.ComputeFee="computeFee",e.OnAddressInput="onAddressInput",e.OnAmountInput="onAmountInput",e.SignRewardsMessage="signRewardsMessage",e.SignCardMessage="signCardMessage",e.ApproveCardAmount="approveCardAmount",e}({});function bm(e){return ae(JSON.stringify(e),G(e).validator)}function Sm(e){return null==e}var Em;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Em=Em||(Em={}));const km=e=>Y(e);function Tm({path:e,branch:t}){const n=e[e.length-1];return r=t[t.length-2],o=n,Object.hasOwnProperty.call(r,o);var r,o}function Im(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Tm(n)||e.validator(t,n),refiner:(t,n)=>!Tm(n)||e.refiner(t,n)})}function xm(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!xm(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!xm(n[e][1])){t=!1;break}return t}return!1}const _m=ae("JSON",(e=>xm(e))),Cm=me(_m,be($(),"JSON",(e=>D(e,_m))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Rm=G("2.0"),Pm=Z(re([J(),ee()])),Nm=km({code:K(),message:ee(),data:Im(Cm),stack:Im(ee())}),Bm=re([X(ee(),Cm),W(Cm)]);km({id:Pm,jsonrpc:Rm,method:ee(),params:Im(Bm)}),km({jsonrpc:Rm,method:ee(),params:Im(Bm)});Y({id:Pm,jsonrpc:Rm,result:Q(oe()),error:Q(Nm)});const Mm=km({id:Pm,jsonrpc:Rm,result:Cm}),Om=km({id:Pm,jsonrpc:Rm,error:Nm});re([Mm,Om]);function zm(e){return D(e,Om)}var Um=function(e){return e.Required="Required",e.Invalid="Invalid",e.InsufficientBalanceToCoverFee="InsufficientBalanceToCoverFee",e.InsufficientBalance="InsufficientBalance",e}({});const jm=V(Object.values(rd)),Lm=ne({address:me(ee(),ee(),(e=>{if(!e||""===e)throw new Error("Account address is required");const t=_d(e);if(""===t)throw new Error("Invalid Solana address format");return t}))}),Dm=G("ed25519"),Fm=me(ee(),ee(),(e=>{const t=function(e){if(!e||"string"!=typeof e)return"";let t=Id(e);const n=t.match(/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+)/u);return n?.[1]&&(t=n[1]),/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+$/u.test(t)?t.length>253?"":t.toLowerCase():""}(e);if(""===t)throw new Error("Invalid domain format");return t})),$m=me(ee(),ee(),(e=>{const t=_d(e);if(""===t)throw new Error("Invalid Solana address format");return t})),Wm=me(ee(),ee(),(e=>{const t=xd(e,1e3);if(""===t)throw new Error("Statement cannot be empty. Control characters and excessive whitespace are removed for security. Please use plain text only.");return t})),qm=me(ee(),ee(),(e=>Cd(e))),Vm=me(ee(),ee(),(e=>xd(e,10))),Km=me(ee(),ee(),(e=>xd(e,50))),Gm=me(ee(),ee(),(e=>xd(e,100))),Hm=me(ee(),ee(),(e=>function(e){if(!e||"string"!=typeof e)return"";const t=Id(e);if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/u.test(t))return"";const n=new Date(t);return isNaN(n.getTime())?"":t}(e))),Zm=me(ee(),ee(),(e=>xd(e,100))),Jm=me(W(ee()),W(ee()),(e=>{var t;return t=e,Array.isArray(t)?t.filter((e=>"string"==typeof e)).map((e=>Cd(e))).filter((e=>""!==e)):[]})),Ym=ne({domain:Q(Fm),address:Q($m),statement:Q(Wm),uri:Q(qm),version:Q(Vm),chainId:Q(Km),nonce:Q(Gm),issuedAt:Q(Hm),expirationTime:Q(Hm),notBefore:Q(Hm),requestId:Q(Zm),resources:Q(Jm)}),Qm=ne({account:Lm,message:Ed}),Xm=V(["processed","confirmed","finalized"]),ey=ne({preflightCommitment:Q(Xm),minContextSlot:Q(J())}),ty=ne({account:Lm,transaction:Ed,scope:jm,options:Q(ey)}),ny=ne({...ey.schema,commitment:Q(Xm),skipPreflight:Q(q()),maxRetries:Q(J())}),ry=ne({...ty.schema,scope:jm,options:Q(ny)}),oy=Y({method:V([en.SignAndSendTransaction]),params:ry}),iy=Y({method:V([en.SignIn]),params:Ym}),ay=Y({method:V([en.SignMessage]),params:Qm}),sy=Y({method:V([en.SignTransaction]),params:ty}),cy=Y({signature:Sd}),uy=Y({signedTransaction:Ed}),ly=Y({signature:Sd,signedMessage:Ed,signatureType:Dm}),dy=Y({account:Lm,...ly.schema}),fy=re([oy,iy,ay,sy]),hy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignAndSendTransactionWithoutConfirmation),params:ry}),py=Y({transaction:Ed,accountId:ld,scope:jm,options:Q(ny)}),gy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignAndSendTransaction),params:py}),my=Y({transactionId:Sd}),yy=Y({fromAccountId:ld,toAddress:Td,amount:dd,assetId:Jo}),wy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.ConfirmSend),params:yy}),vy=Y({value:ee(),scope:function(e,t,n={}){return me(e,oe(),(e=>{const r="function"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&R(e)&&R(r)){const t={...e};let n=!1;for(const e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e}))}(jm,rd.Mainnet)}),Ay=Y({jsonrpc:Rm,id:Pm,method:bm(Am.OnAddressInput),params:vy}),by=Y({value:dd,accountId:ld,assetId:Jo}),Sy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.OnAmountInput),params:by});function Ey(e){const t=lu(e,Gs().encode,Qs().decode);if(!t.startsWith("rewards,"))throw new Error('Message must start with "rewards,"');const n=t.split(",");if(3!==n.length)throw new Error("Message must have exactly 3 parts: rewards,{address},{timestamp}");const[r,o,i]=n;if("rewards"!==r)throw new Error('Message must start with "rewards"');if(!D(o,Td))throw new Error("Invalid Solana address");if(!D(i,dd))throw new Error("Invalid timestamp format");if(i.includes("."))throw new Error("Invalid timestamp");const a=parseInt(i,10);if(a<=0)throw new Error("Invalid timestamp");return{address:o,timestamp:a}}const ky=be(Ed,"RewardsMessage",(e=>{try{return Ey(e),!0}catch(e){return e instanceof Error?e.message:"Invalid rewards message"}})),Ty=Y({accountId:ld,message:ky}),Iy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignRewardsMessage),params:Ty});function xy(e){const t=lu(e,Gs().encode,Qs().decode).match(/^(.+) wants you to sign in with your Solana account: ([1-9A-HJ-NP-Za-km-z]{32,44}) (.+) URI: (.+) Version: (\d+) Chain ID: (\d+) Nonce: ([a-zA-Z0-9]+) Issued At: (.+) Expiration Time: (.+)$/u);if(!t)throw new Error('Invalid card message format. Expected format: "{domain} wants you to sign in with your Solana account: {address} {statement} URI: {uri} Version: {version} Chain ID: {chainId} Nonce: {nonce} Issued At: {issuedAt} Expiration Time: {expirationTime}"');const[,n,r,o,i,a,s,c,u,l]=t;if(!n||""===n.trim())throw new Error("Invalid domain in card message");if(!D(r,Td))throw new Error("Invalid Solana address in card message");try{if(!new URL(i).protocol)throw new Error("Invalid URI")}catch{throw new Error("Invalid URI in card message")}const d=new Date(u);if(isNaN(d.getTime()))throw new Error("Invalid Issued At date in card message");const f=new Date(l);if(isNaN(f.getTime()))throw new Error("Invalid Expiration Time date in card message");return{domain:n,address:r,statement:o,uri:i,version:a,chainId:s,nonce:c,issuedAt:u,expirationTime:l}}const _y=be(Ed,"CardMessage",(e=>{try{return xy(e),!0}catch(e){return e instanceof Error?e.message:"Invalid card message"}})),Cy=Y({accountId:ld,message:_y}),Ry=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignCardMessage),params:Cy}),Py=Y({accountId:ld,amount:dd,mint:Td,delegate:Td,scope:jm}),Ny=Y({jsonrpc:Rm,id:Pm,method:bm(Am.ApproveCardAmount),params:Py}),By=Y({signature:Sd}),My=Y({valid:q(),errors:W(Y({code:V(Object.values(Um))}))}),Oy=Y({transaction:Ed,accountId:ld,scope:jm}),zy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.ComputeFee),params:Oy}),Uy=W(Y({type:V(Object.values(zt)),asset:Ct}));const jy=Ae(ee(),/^(?:0x)?[0-9a-f]+$/iu);Ae(ee(),/^0x[0-9a-f]+$/iu),Ae(ee(),/^0x[0-9a-f]{40}$/u),Ae(ee(),/^0x[0-9a-fA-F]{40}$/u);function Ly(e){ti(function(e){return D(e,jy)}(e),"Value must be a hexadecimal string.")}function Dy(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}n(1048).hp;!function(){const e=[]}();function Fy(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;Ly(e);const t=Dy(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++){const t=n.charCodeAt(2*e),o=n.charCodeAt(2*e+1),i=t-(t<58?48:87),a=o-(o<58?48:87);r[e]=16*i+a}return r}async function $y({entropySource:e,derivationPath:t}){Yl.log({derivationPath:t},"Generating solana wallet"),j(t,kd);const n=t.split("/");try{const t=await async function({entropySource:e,path:t,curve:n}){return await snap.request({method:"snap_getBip32Entropy",params:{path:t,curve:n,...e?{source:e}:{}}})}({entropySource:e,path:n,curve:"ed25519"});if(!t.privateKey||!t.publicKey)throw new Error("Unable to derive private key");return{privateKeyBytes:Fy(t.privateKey),publicKeyBytes:Fy(t.publicKey)}}catch(e){throw Yl.error({error:e},"Error deriving keypair"),new Error(e)}}const Wy=e=>JSON.parse(JSON.stringify(e),((e,t)=>t?"undefined"!==t.__type?"BigNumber"===t.__type?new jo(t.value):"bigint"===t.__type?BigInt(t.value):"Uint8Array"===t.__type?Gs().encode(t.value):t:void 0:t)),qy=e=>(0,Pd.cloneDeepWith)(e,(e=>void 0===e?{__type:"undefined"}:e instanceof jo?{__type:"BigNumber",value:e.toString()}:"bigint"==typeof e?{__type:"bigint",value:e.toString()}:e instanceof Uint8Array?{__type:"Uint8Array",value:Gs().decode(e)}:void 0)),Vy="send-form",Ky="confirm-sign-and-send-transaction";async function Gy(e,t){const n=qy(t);return snap.request({method:"snap_createInterface",params:{ui:e,context:n}})}async function Hy(e,t,n){const r=qy(n);return snap.request({method:"snap_updateInterface",params:{id:e,ui:t,context:r}})}async function Zy(e,t){return snap.request({method:"snap_resolveInterface",params:{id:e,value:t}})}async function Jy(e){return snap.request({method:"snap_dialog",params:{id:e}})}async function Yy(){return snap.request({method:"snap_getPreferences"})}async function Qy(e){const t=await async function(e){const t=await snap.request({method:"snap_getInterfaceContext",params:{id:e}});return t?Wy(t):null}(e);if(!t)throw new Error("Interface context not found");return t}async function Xy(){return await snap.request({method:"snap_getClientStatus"})}var ew,tw=function(e){return e.StartSendTransactionFlow="startSendTransactionFlow",e.GetFeeForTransaction="getFeeForTransaction",e}({}),nw=function(e){return e.ListWebSockets="listWebSockets",e.ListSubscriptions="listSubscriptions",e.TestOnStart="testOnStart",e.TestOnInstall="testOnInstall",e.TestOnUpdate="testOnUpdate",e.SynchronizeAccounts="synchronizeAccounts",e.SetAccountSelected="setAccountSelected",e.ConfirmSend="confirmSend",e.SignRewardsMessage="signRewardsMessage",e}({});!function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(ew=ew||(ew={}));const rw=[rd.Mainnet,rd.Devnet],ow={production:[rd.Mainnet],local:[rd.Mainnet],test:[rd.Localnet]},iw=me(W(fd),ee(),(e=>e.split(","))),aw=me(W(ee()),ee(),(e=>e.split(","))),sw=Y({ENVIRONMENT:V(["local","test","production"]),RPC_URL_MAINNET_LIST:iw,RPC_URL_DEVNET_LIST:iw,RPC_URL_TESTNET_LIST:iw,RPC_URL_LOCALNET_LIST:aw,RPC_WEB_SOCKET_URL_MAINNET:fd,RPC_WEB_SOCKET_URL_DEVNET:fd,RPC_WEB_SOCKET_URL_TESTNET:fd,RPC_WEB_SOCKET_URL_LOCALNET:fd,EXPLORER_BASE_URL:fd,PRICE_API_BASE_URL:fd,TOKEN_API_BASE_URL:fd,STATIC_API_BASE_URL:fd,SECURITY_ALERTS_API_BASE_URL:fd,NFT_API_BASE_URL:fd,LOCAL_API_BASE_URL:ee()});class cw{#E;#k;constructor(){const e=this.#T();this.#E=this.#I(e),this.#k=[]}#T(){return L({ENVIRONMENT:"production",RPC_URL_MAINNET_LIST:"https://solana-mainnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_DEVNET_LIST:"https://solana-devnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_TESTNET_LIST:"https://api.testnet.solana.com",RPC_URL_LOCALNET_LIST:"http://localhost:8899",RPC_WEB_SOCKET_URL_MAINNET:"wss://solana-mainnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_DEVNET:"wss://solana-devnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_TESTNET:"wss://api.testnet.solana.com",RPC_WEB_SOCKET_URL_LOCALNET:"wss://localhost:8899",EXPLORER_BASE_URL:"https://solscan.io",PRICE_API_BASE_URL:"https://price.api.cx.metamask.io",TOKEN_API_BASE_URL:"https://tokens.api.cx.metamask.io",STATIC_API_BASE_URL:"https://static.cx.metamask.io",SECURITY_ALERTS_API_BASE_URL:"https://security-alerts.api.cx.metamask.io",LOCAL_API_BASE_URL:"http://localhost:8899",NFT_API_BASE_URL:"https://nft.api.cx.metamask.io"},sw)}#I(e){return{environment:e.ENVIRONMENT,networks:[{...ud[rd.Mainnet],rpcUrls:e.RPC_URL_MAINNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_MAINNET},{...ud[rd.Devnet],rpcUrls:e.RPC_URL_DEVNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_DEVNET},{...ud[rd.Testnet],rpcUrls:e.RPC_URL_TESTNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_TESTNET},{...ud[rd.Localnet],rpcUrls:e.RPC_URL_LOCALNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_LOCALNET}],explorerBaseUrl:e.EXPLORER_BASE_URL,priceApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.PRICE_API_BASE_URL,chunkSize:50,cacheTtlsMilliseconds:{fiatExchangeRates:ew.Minute,spotPrices:ew.Minute,historicalPrices:ew.Minute}},tokenApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.TOKEN_API_BASE_URL,chunkSize:50},staticApi:{baseUrl:e.STATIC_API_BASE_URL},transactions:{storageLimit:10},securityAlertsApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.SECURITY_ALERTS_API_BASE_URL},nftApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.NFT_API_BASE_URL,cacheTtlsMilliseconds:{listAddressSolanaNfts:ew.Minute,getNftMetadata:ew.Minute}},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:ew.Second,closeConnectionsGracePeriodMilliseconds:5*ew.Minute}}}get(){return this.#E}getNetworkBy(e,t){const n=this.get().networks.find((n=>n[e]===t));if(!n)throw new Error(`Network ${e} not found`);return n}async getActiveNetworks(){if(this.#k.length>0)return this.#k;const e=(0,Pd.uniq)([rd.Mainnet,...ow[this.#E.environment]??[]]);try{const{clientVersion:t}=await Xy(),n=t.includes("flask")?[rd.Devnet]:[],r=(0,Pd.uniq)([...e,...n]);return this.#k=r,this.#k}catch(t){return e}}}const uw=(new cw).get(),lw=["local","test"].includes(uw.environment),dw=lw?["http://localhost:3000"]:["https://portfolio.metamask.io"],fw=lw?new Set([ln.ListAccounts,ln.GetAccount,ln.CreateAccount,ln.FilterAccountChains,ln.DeleteAccount,ln.DiscoverAccounts,ln.GetAccountBalances,ln.SubmitRequest,ln.ListAccountTransactions,ln.ListAccountAssets,ln.SetSelectedAccounts,tw.StartSendTransactionFlow,tw.GetFeeForTransaction,nw.ListWebSockets,nw.ListSubscriptions,nw.TestOnStart,nw.TestOnInstall,nw.TestOnUpdate,nw.SynchronizeAccounts,nw.SetAccountSelected,nw.ConfirmSend,nw.SignRewardsMessage]):new Set([]),hw=new Set([ln.ListAccounts,ln.GetAccount,ln.CreateAccount,ln.DeleteAccount,ln.DiscoverAccounts,ln.GetAccountBalances,ln.SubmitRequest,ln.ListAccountTransactions,ln.ListAccountAssets,ln.ResolveAccountAddress,ln.SetSelectedAccounts,tw.StartSendTransactionFlow,tw.GetFeeForTransaction,Am.SignAndSendTransactionWithoutConfirmation]),pw=new Map([]);for(const e of dw)pw.set(e,fw);pw.set("metamask",hw);const gw=(e,t)=>{if(!e)throw new mo("Origin not found");if(!pw.get(e)?.has(t))throw new mo("Permission denied")};function mw(e,t){try{j(e,t)}catch(e){throw new oo(e.message)}}function yw(e,t){try{j(e,t)}catch(e){throw new Xr("Invalid Response")}}const ww=Y({...Mt.schema,scope:vd,request:fy}),vw=Y({scopes:ve(W(vd)),entropySource:ee(),groupIndex:we(J(),0)});Error;function Aw(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:null==e?"":String(e)}(e).replace(/\.$/u,"")}function bw(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class Sw extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Ew(e,t="Assertion failed.",n=Sw){if(!e){if(t instanceof Error)throw t;throw bw(n,t)}}function kw(e,t,n="Assertion failed",r=Sw){try{j(e,t)}catch(e){throw bw(r,`${n}: ${Aw(e)}.`)}}function Tw(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function Iw(e,...t){if(!Tw(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function xw(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function _w(e){if("function"!=typeof e)throw new Error("function expected");return!0}function Cw(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function Rw(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Pw(e){if(!Array.isArray(e))throw new Error("array expected")}function Nw(e,t){if(!xw(!0,t))throw new Error(`${e}: array of strings expected`)}function Bw(e,t){if(!xw(!1,t))throw new Error(`${e}: array of numbers expected`)}function Mw(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map((e=>e.encode)).reduceRight(n,t),decode:e.map((e=>e.decode)).reduce(n,t)}}function Ow(e){const t="string"==typeof e?e.split(""):e,n=t.length;Nw("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(Pw(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]}))),decode:t=>(Pw(t),t.map((t=>{Cw("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})))}}function zw(e=""){return Cw("join",e),{encode:t=>(Nw("join.decode",t),t.join(e)),decode:t=>(Cw("join.decode",t),t.split(e))}}function Uw(e,t="="){return Rw(e),Cw("padding",t),{encode(n){for(Nw("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){Nw("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--){if((r-1)*e%8==0)throw new Error("padding: invalid, string has too much padding")}return n.slice(0,r)}}}function jw(e){return _w(e),{encode:e=>e,decode:t=>e(t)}}function Lw(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(Pw(e),!e.length)return[];let r=0;const o=[],i=Array.from(e,(e=>{if(Rw(e),e<0||e>=t)throw new Error(`invalid integer: ${e}`);return e})),a=i.length;for(;;){let e=0,s=!0;for(let o=r;o<a;o++){const a=i[o],c=t*e,u=c+a;if(!Number.isSafeInteger(u)||c/t!==e||u-a!==c)throw new Error("convertRadix: carry overflow");const l=u/n;e=u%n;const d=Math.floor(l);if(i[o]=d,!Number.isSafeInteger(d)||d*n+e!==u)throw new Error("convertRadix: carry overflow");s&&(d?s=!1:r=o)}if(o.push(e),s)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}const Dw=(e,t)=>0===t?e:Dw(t,e%t),Fw=(e,t)=>e+(t-Dw(e,t)),$w=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function Ww(e,t,n,r){if(Pw(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Fw(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Fw(t,n)}`);let o=0,i=0;const a=$w[t],s=$w[n]-1,c=[];for(const r of e){if(Rw(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);const e=$w[i];if(void 0===e)throw new Error("invalid carry");o&=e-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function qw(e){Rw(e);return{encode:t=>{if(!Tw(t))throw new Error("radix.encode input should be Uint8Array");return Lw(Array.from(t),256,e)},decode:t=>(Bw("radix.decode",t),Uint8Array.from(Lw(t,e,256)))}}function Vw(e,t=!1){if(Rw(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Fw(8,e)>32||Fw(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!Tw(n))throw new Error("radix2.encode input should be Uint8Array");return Ww(Array.from(n),8,e,!t)},decode:n=>(Bw("radix2.decode",n),Uint8Array.from(Ww(n,e,8,t)))}}function Kw(e){return _w(e),function(...t){try{return e.apply(null,t)}catch(e){}}}const Gw=Mw(Vw(4),Ow("0123456789ABCDEF"),zw("")),Hw=Mw(Vw(5),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Uw(5),zw("")),Zw=(Mw(Vw(5),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),zw("")),Mw(Vw(5),Ow("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Uw(5),zw("")),Mw(Vw(5),Ow("0123456789ABCDEFGHIJKLMNOPQRSTUV"),zw("")),Mw(Vw(5),Ow("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),zw(""),jw((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64),Jw=(e,t)=>{Cw("base64",e);const n=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,r=t?"base64url":"base64";if(e.length>0&&!n.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},Yw=Zw?{encode:e=>(Iw(e),e.toBase64()),decode:e=>Jw(e,!1)}:Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Uw(6),zw("")),Qw=(Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),zw("")),Zw?{encode:e=>(Iw(e),e.toBase64({alphabet:"base64url"})),decode:e=>Jw(e,!0)}:Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Uw(6),zw(""))),Xw=(Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),zw("")),e=>Mw(qw(58),Ow(e),zw(""))),ev=Xw("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),tv=(Xw("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Xw("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),[0,2,3,5,6,7,9,10,11]),nv={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=ev.encode(r).padStart(tv[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),o=tv.indexOf(r.length),i=ev.decode(r);for(let e=0;e<i.length-o;e++)if(0!==i[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}},rv=Mw(Ow("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),zw("")),ov=[996825010,642813549,513874426,1027748829,705979059];function iv(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<ov.length;e++)1==(t>>e&1)&&(n^=ov[e]);return n}function av(e,t,n=1){const r=e.length;let o=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);o=iv(o)^n>>5}o=iv(o);for(let t=0;t<r;t++)o=iv(o)^31&e.charCodeAt(t);for(let e of t)o=iv(o)^e;for(let e=0;e<6;e++)o=iv(o);return o^=n,rv.encode(Ww([o%$w[30]],30,5,!1))}function sv(e){const t="bech32"===e?1:734539939,n=Vw(5),r=n.decode,o=n.encode,i=Kw(r);function a(e,n,r=90){Cw("bech32.encode prefix",e),Tw(n)&&(n=Array.from(n)),Bw("bech32.encode",n);const o=e.length;if(0===o)throw new TypeError(`Invalid prefix length ${o}`);const i=o+7+n.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);const a=e.toLowerCase(),s=av(a,n,t);return`${a}1${rv.encode(n)}${s}`}function s(e,n=90){Cw("bech32.decode input",e);const r=e.length;if(r<8||!1!==n&&r>n)throw new TypeError(`invalid string length: ${r} (${e}). Expected (8..${n})`);const o=e.toLowerCase();if(e!==o&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=o.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const a=o.slice(0,i),s=o.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const c=rv.decode(s).slice(0,-6),u=av(a,c,t);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected "${u}"`);return{prefix:a,words:c}}return{encode:a,decode:s,encodeFromBytes:function(e,t){return a(e,o(t))},decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:Kw(s),fromWords:r,fromWordsUnsafe:i,toWords:o}}sv("bech32"),sv("bech32m");const cv={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)};"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex||Mw(Vw(4),Ow("0123456789abcdef"),zw(""),jw((e=>{if("string"!=typeof e||e.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));n(1048).hp;!function(){const e=[]}();function uv(e){return e instanceof Uint8Array}function lv(e){Ew(uv(e),"Value must be a Uint8Array.")}var dv;!function(e){e.Copyable="copyable",e.Divider="divider",e.Heading="heading",e.Panel="panel",e.Spinner="spinner",e.Text="text",e.Image="image",e.Row="row",e.Address="address",e.Button="button",e.Input="input",e.Form="form"}(dv||(dv={}));const fv=Y({type:ee()}),hv=(ie(fv,Y({value:oe()})),ie(fv,Y({type:bm(dv.Image),value:be(ee(),"SVG",(e=>!!e.includes("<svg")||"Value is not a valid SVG."))}))),pv=function(e,t,n=[]){return(...r)=>{if(1===r.length&&function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(r[0])){const n={...r[0],type:e};return kw(n,t,`Invalid ${e} component`),n}const o=n.reduce(((e,t,n)=>void 0!==r[n]?{...e,[t]:r[n]}:e),{type:e});return kw(o,t,`Invalid ${e} component`),o}}(dv.Image,hv,["value"]);async function gv(e,t){const n=await async function(e,t){if("function"!=typeof fetch)throw new Error(`Failed to fetch image data from "${e}": Using this function requires the "endowment:network-access" permission.`);return fetch(e,t).then((async t=>{if(!t.ok)throw new Error(`Failed to fetch image data from "${e}": ${t.status} ${t.statusText}`);const n=await t.blob();return Ew("image/jpeg"===n.type||"image/png"===n.type,"Expected image data to be a JPEG or PNG image."),n}))}(e,t),r=new Uint8Array(await n.arrayBuffer());return`data:${n.type};base64,${function(e){return lv(e),Yw.encode(e)}(r)}`}const mv='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48">\n <path fill="#999999" d="M42.75 24c0 10.59375-8.53125 19.21875-19.125 19.21875-10.6875 0-19.21875-8.625-19.21875-19.21875 0-10.59375 8.53125-19.21875 19.21875-19.21875 10.59375 0 19.125 8.625 19.125 19.21875zM23.625 14.0625c-3.09375 0-5.90625 2.25-5.90625 5.4375 0 0.84375 0.75 1.59375 1.59375 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375 0-1.125 1.03125-2.25 2.71875-2.25 1.59375 0 2.625 1.125 2.625 2.25 0 0.5625-0.375 1.03125-1.3125 1.59375l0 0c-1.125 0.75-3 1.96875-3 4.5l0 0.46875c0 0.84375 0.75 1.59375 1.6875 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375l0-0.46875c0-0.65625 0.28125-1.125 1.40625-1.78125 1.03125-0.65625 2.8125-1.875 2.8125-4.3125 0-3.1875-2.8125-5.4375-5.8125-5.4375zM23.53125 31.875c-0.84375 0-1.59375 0.65625-1.59375 1.59375 0 0.84375 0.75 1.59375 1.59375 1.59375l0.09375 0c0.84375 0 1.59375-0.75 1.59375-1.59375 0-0.9375-0.75-1.59375-1.59375-1.59375z"/>\n</svg>';function yv(e,t){return new jo(e.toString()).div(10**t).toFixed()}function wv(e){return e.split("/")[0]}function vv(e,t){return`${e}/token:${t}`}class Av{#i;#x;#_;#C;#R;#P;#N;#B;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*ew.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,tokenApiClient:o,tokenPricesService:i,cache:a,nftApiClient:s}){this.#i=Jl(t,"[🪙 AssetsService]"),this.#x=e,this.#_=n,this.#C=r,this.#P=o,this.#R=i,this.#N=a,this.#B=s}#M(e){return{nativeAssetTypes:e.filter((e=>e.endsWith(sd.SOL))),tokenAssetTypes:e.filter((e=>e.includes("/token:"))),nftAssetTypes:e.filter((e=>e.includes("/nft:")))}}#O(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:o,assetReference:i}=Qo(n);t[n]={name:"Solana",symbol:"SOL",fungible:!0,iconUrl:`${this.#_.get().staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${o}/${i}.png`,units:[{name:"Solana",symbol:"SOL",decimals:9}]}}return t}async#z(e){const t=await this.#B.getNftsMetadata(e.map((e=>{const{assetReference:t}=Qo(e);return t}))),n={};return e.forEach(((e,r)=>{const o=t[r];if(!o)return;const i={name:o.name,symbol:o.name,imageUrl:o.imageUrl,description:o.description,fungible:!1,isPossibleSpam:!1,attributes:Object.fromEntries(o.attributes.map((e=>[e.key,e.value]))),collection:{name:o.collectionName,address:o.onchainCollectionAddress,symbol:o.collectionSymbol,tokenCount:o.collectionCount,creator:"",imageUrl:o.collectionImageUrl??""}};n[e]=i})),n}async getAssetsMetadata(e){this.#i.log("Fetching metadata for assets",e);const{nativeAssetTypes:t,tokenAssetTypes:n,nftAssetTypes:r}=this.#M(e),[o,i]=await Promise.all([this.#O(t),this.#P.getTokensMetadata(n)]);return{...o,...i}}async#U(e,t=[Sf,Nh],n=[rd.Mainnet]){if(0===t.length||0===n.length)return[];const r=e.flatMap((e=>t.flatMap((t=>n.map((n=>({account:e,programId:t,scope:n}))))))),o=Xl(this.#j.bind(this),this.#N,{functionName:"AssetsService:fetchTokenAccounts",ttlMilliseconds:Av.cacheTtlsMilliseconds.tokenAccountsByOwner,generateCacheKey:(e,t)=>{const[n,r,o]=t;return`${e}:${n.id}:${r}:${o}`}});return(await Promise.allSettled(r.map((async({account:e,programId:t,scope:n})=>await o(e,t,n))))).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#j(e,t=Sf,n=rd.Mainnet){return(await this.#x.getRpc(n).getTokenAccountsByOwner(oc(e.address),{programId:t},{encoding:"jsonParsed"}).send()).value.map((t=>({token:t,scope:n,assetType:vv(n,t.account.data.parsed.info.mint),keyringAccount:e})))}async fetch(e){const[t,n]=await Promise.all([this.#L(e),this.#U([e],[Sf,Nh],await this.#_.getActiveNetworks())]),r=n.map((e=>e.assetType)),o=await this.#P.getTokensMetadata(r);return[...t,...n.filter((e=>e.assetType.includes("/token:"))).map((e=>{const{assetType:t}=e,{decimals:n,amount:r,uiAmountString:i}=e.token.account.data.parsed.info.tokenAmount;return{assetType:t,keyringAccountId:e.keyringAccount.id,network:e.scope,mint:e.token.account.data.parsed.info.mint,pubkey:e.token.pubkey,symbol:o[t]?.symbol??"UNKNOWN",decimals:n,rawAmount:r,uiAmount:i??yv(r,n)}}))]}async getNativeAssetTypes(){return(await this.#_.getActiveNetworks()).map((e=>`${e}/${sd.SOL}`))}async#L(e){const t=await this.getNativeAssetTypes(),n=oc(e.address),r=t.map((async t=>{const r=await this.#x.getRpc(wv(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:wv(t),address:n,symbol:"SOL",decimals:9,rawAmount:r.value.toString(),uiAmount:yv(r.value,9)}}));return(await Promise.allSettled(r)).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#D(e,t){const n=oc(e.address),r=await this.#B.listAddressSolanaNfts(n),o={};for(const e of t){const{assetReference:t}=Qo(e),n=r.find((e=>e.tokenAddress===t));n&&(o[e]={unit:n.nftToken.name,amount:n.balance.toString()})}return o}async fetchAssetsMarketData(e){this.#i.info("Fetching market data for assets",e);return await this.#R.getMultipleTokensMarketData(e)}async save(e){await this.saveMany([e])}async saveMany(e){this.#i.info("Saving assets",e);const t=e=>"0"===e.rawAmount||"0"===e.uiAmount;await this.getAll();await this.#C.saveMany(e);const n=e=>t(e)&&!(e=>e.assetType.includes(sd.SOL))(e),r=e=>!n(e)&&!0,o=e.reduce(((e,t)=>({...e,[t.keyringAccountId]:{added:[...e[t.keyringAccountId]?.added??[],...r(t)?[t.assetType]:[]],removed:[...e[t.keyringAccountId]?.removed??[],...n(t)?[t.assetType]:[]]}})),{});Object.values(o).map((e=>e.added.length+e.removed.length)).every((e=>0===e))||await zn(snap,Pn.AccountAssetListUpdated,{assets:o});const i=e.filter((()=>!0)).reduce(((e,t)=>({...e,[t.keyringAccountId]:{...e[t.keyringAccountId]??{},[t.assetType]:{unit:t.symbol,amount:t.uiAmount}}})),{});Object.values(i).map((e=>Object.keys(e).length)).some((e=>e>0))&&await zn(snap,Pn.AccountBalancesUpdated,{balances:i})}static hasChanged(e,t){const n=t.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType));if(!n)return!0;const r=n.rawAmount!==e.rawAmount,o=n.uiAmount!==e.uiAmount;return r||o}async getAll(){return this.#C.getAll()}async findByAccount(e){const{id:t,address:n}=e,r=await this.#C.findByKeyringAccountId(t),o=await this.getNativeAssetTypes(),i=[];for(const t of o){if(!r.some((e=>e.assetType===t))){const r=wv(t);i.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:"SOL",decimals:9,rawAmount:"0",uiAmount:"0"})}}return[...r,...i]}static maxSvgSizeBytes=512e3;static generateImageComponent=async(e,t=48,n=48,r)=>e?async function(e,{width:t,height:n=t,request:r}){Ew("number"==typeof t&&t>0,"Expected width to be a number greater than 0."),Ew("number"==typeof n&&n>0,"Expected height to be a number greater than 0.");const o=await gv(e,r),i=`width="${t}" height="${n}"`;return pv(`<svg ${i.trim()} xmlns="http://www.w3.org/2000/svg"><image ${i.trim()} href="${o}" /></svg>`)}(e,{width:t,height:n}).then((t=>{const n=(new TextEncoder).encode(t.value).length;if(n>Av.maxSvgSizeBytes){const t=(n/1024).toFixed(2),o=`SVG too large (${t}KB), using fallback icon`;return r&&r.warn(o,{imageUrl:e,svgSizeKB:t}),mv}return t.value})).catch((()=>mv)):mv}const bv=uu(5000n);class Sv{#F;constructor(e){this.#F=e}#$(){const e=this.#F.getComputeUnitLimit(),t=this.#F.getComputeUnitPriceMicroLamportsPerComputeUnit();return lu(e,(e=>jo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(ed.toString())),(e=>e.toString()),BigInt,uu)}getFee(){const e=this.#$();return uu(bv+e)}}const Ev="Sending to this address may result in permanent loss of funds.";class kv extends Error{constructor(e,t){super(e,t),this.name="RecipientClassificationError"}}class Tv extends kv{constructor(){super(`Cannot send to this address. This appears to be a mint account, program data account, metadata account, or PDA. ${Ev} Only wallet addresses and token accounts are supported.`),this.name="RecipientUnsupportedError"}}class Iv extends kv{constructor(){super(`Cannot send to this address. This is a token account for a different token than the one you're trying to send. ${Ev}`),this.name="RecipientTokenAccountMintMismatchError"}}class xv{#W;#q;#x;#i;#V=4e4;#K=10000n;constructor(e,t,n,r){this.#W=e,this.#q=t,this.#x=n,this.#i=Jl(r,"[📩 SendSplTokenBuilder]")}async buildTransactionMessage(e){this.#i.log("Build transfer SPL token transaction message");const{from:{entropySource:t,derivationPath:n},to:r,mint:o,amount:i,network:a}=e;ti(o,"Mint is required");const s=await this.#q.classify(r,a);if("UNSUPPORTED"===s.type)throw new Tv;const[c,u,{privateKeyBytes:l},d]=await Promise.all([this.#x.fetchMint(o,a),this.#W.uiAmountToAmountForMint(o,a,i.toString()),$y({entropySource:t,derivationPath:n}),this.#x.getLatestBlockhash(a)]),{programAddress:f,data:{decimals:h}}=c,p=await ml(l),g=await xv.deriveAssociatedTokenAccountAddress({mint:o,owner:p.address,tokenProgram:f}),m=[],y=f===Nh,w=y?rp:Lf,v=y?sg:ih;switch(s.type){case"SYSTEM":{const e=await xv.deriveAssociatedTokenAccountAddress({mint:o,owner:r,tokenProgram:f});m.push(w({mint:o,payer:p,tokenProgram:f,owner:r,ata:e})),m.push(v({source:g,mint:o,destination:e,authority:p,amount:u,decimals:h}));break}case"TOKEN_ACCOUNT":if(s.mint!==o)throw new Iv;m.push(v({source:g,mint:o,destination:r,authority:p,amount:u,decimals:h}));break;default:throw new Tv}const A=lu(Du({version:0}),(e=>Gu(p.address,e)),(e=>fu(d,e)),(e=>Zu(m,e)));return Ju([ef({units:this.#V}),of({microLamports:this.#K})],A)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await Uf({mint:e,owner:t,tokenProgram:n}))[0]}getComputeUnitLimit(){return this.#V}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#K}}class _v{#x;#i;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#x=e,this.#i=Jl(t,"[🖋️ Signer]")}async partiallySignBase64String(e,t,n,r){this.#i.log("Partially sign base64 string",{base64String:e,account:t,network:n,config:r});const o=this.#x.getRpc(n),i=await qg(e,o,r);if("instructions"in i)return this.#G(i,t,n);if(Object.values(i.signatures).every((e=>!e))){const{messageBytes:e}=i,a=await Fg(e,o,r);return this.#G(a,t,n)}return this.#H(i,t)}async#G(e,t,n){const r=du(e)?e.lifetimeConstraint:await this.#x.getLatestBlockhash(n),o=sm(e),i=_v.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,a=!um(e)||!o,{privateKeyBytes:s}=await $y({entropySource:t.entropySource,derivationPath:t.derivationPath}),c=await ml(s),u=await lu(e,(e=>im(c.address,e)),(e=>{return t=r,du(n=e)?n:fu(t,n);var t,n}),(e=>((e,t,n)=>sm(e)?e:Ju([of(t,n)],e))(e,{microLamports:i})),(async e=>a?lm(e,this.#x.getRpc(n)):e)),l=pl([c],u);return await wl(l)}async#H(e,t){const{privateKeyBytes:n}=await $y({entropySource:t.entropySource,derivationPath:t.derivationPath});return ol([await Tc(n)],e)}}const Cv=(e,t)=>{const{to:n,type:r,status:o}=e,{address:i}=t;if(!(r===Lt.Receive||o===jt.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce(((e,t)=>t.address!==i||!t.asset?.fungible||t.asset.type!==od.SolMainnet&&t.asset.type!==od.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)}),{hasReceivedSOL:!1,receivedSOLAmount:new jo(0)});return a&&s.isLessThan(.001)};function Rv(e,t){return[Cv].some((n=>n(e,t)))}class Pv{#Z;#J;#Y;#Q;#X;#W;#_;#i;#ee=[Sf,Nh];constructor(e,t,n,r,o,i,a,s){this.#Z=e,this.#J=t,this.#Y=n,this.#Q=r,this.#X=o,this.#W=i,this.#_=a,this.#i=Jl(s,"[🗝️ KeyringAccountMonitor]"),this.#te()}#te(){this.#i.info("Binding handlers"),rw.forEach((e=>{this.#Z.registerNotificationHandler("accountSubscribe",e,this.#ne.bind(this)),this.#Z.registerNotificationHandler("programSubscribe",e,this.#re.bind(this))})),rw.forEach((e=>{this.#Z.registerConnectionRecoveryHandler(e,this.#oe.bind(this))}))}async setMonitoredAccounts(e){this.#i.info("Setting monitored accounts",e);const[t,n,r]=await Promise.all([this.#J.getAll(),this.#Z.getAll(),this.#_.getActiveNetworks()]),o=t.filter((e=>n.some((t=>e.address===(0,Pd.get)(t,"params[0]")||e.address===(0,Pd.get)(t,"params[1].filters[0].memcmp.bytes"))))),i=o.filter((t=>!e.includes(t.id))),a=t.filter((t=>e.includes(t.id))).filter((e=>!o.includes(e)));await Promise.allSettled([this.#ie(i,n),this.#ae(a,r)])}async#ae(e,t){try{this.#i.log("Monitoring keyring accounts",e);const n=this.#X.synchronize(e),r=e.flatMap((e=>{const n=t=>e.scopes.includes(t);return[...t.filter(n).map((async t=>this.#se(e,t))),...t.filter(n).map((async t=>{await Promise.all(this.#ee.map((async n=>this.#ce(e,n,t))))}))]}));await Promise.allSettled([...r,n])}catch(e){throw this.#i.error("Error monitoring keyring account",e),e}}async#ie(e,t){this.#i.log("Stopping to monitor accounts",e);const n=e.map((e=>e.address)),r=t.filter((e=>Pv.#ue(e)||Pv.#le(e))).filter((e=>n.includes(Pv.#de(e))));await Promise.allSettled(r.map((async e=>this.#Z.unsubscribe(e.id))))}async#se(e,t){this.#i.log("Monitoring native asset balance",{account:e,network:t});const{address:n}=e;await this.#Z.subscribe({method:"accountSubscribe",network:t,params:[n,{commitment:"confirmed",encoding:"jsonParsed"}]})}async#ce(e,t,n){this.#i.log("Monitoring token program by owner",{account:e,tokenProgramAddress:t,network:n});const{address:r}=e;await this.#Z.subscribe({method:"programSubscribe",network:n,params:[t,{commitment:"confirmed",encoding:"jsonParsed",filters:[{memcmp:{offset:32,bytes:r,encoding:"base58"}}]}]})}async#ne(e,t){this.#i.info("Account notification received",{notification:e,subscription:t});const{network:n}=t,r=(0,Pd.get)(t,"params[0]");j(r,ee());const o=await this.#J.findByAddress(r);if(!o)throw new Error(`No keyring account found for address: ${r}`);const{lamports:i}=e.params.result.value;j(i,J());await Promise.all([this.#Y.save({assetType:`${n}/${sd.SOL}`,keyringAccountId:o.id,network:n,address:r,symbol:"SOL",decimals:9,rawAmount:i.toString(),uiAmount:yv(i,9)}),this.#fe(o,n,r)])}async#re(e,t){this.#i.info("Handling program notification",{notification:e,subscription:t});const{network:n}=t,r=(0,Pd.get)(t,"params[0]");if(j(r,ee()),r!==Sf&&r!==Nh)throw new Error(`Program not supported: ${r}`);const{owner:o}=e.params.result.value.account.data.parsed.info;j(o,ee());const{mint:i}=e.params.result.value.account.data.parsed.info;j(i,ee());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;j(a,ee()),j(s,J()),j(c,ee());const{pubkey:u}=e.params.result.value;j(u,ee());const l=vv(n,i),d=await this.#J.findByAddress(o);if(!d)throw new Error(`No keyring account found with address: ${o}`);const f=await this.#W.amountToUiAmountForMint(i,n,uu(BigInt(a))).catch((e=>(this.#i.error("Error converting amount to uiAmount",e),c))),h=(await this.#Y.getAssetsMetadata([l]))[l];await Promise.all([this.#Y.save({assetType:l,keyringAccountId:d.id,network:n,mint:i,pubkey:u,symbol:h?.symbol??"UNKNOWN",decimals:s,rawAmount:a,uiAmount:f}),this.#fe(d,n,u)])}async#fe(e,t,n){const r=(await this.#Q.fetchLatestSignatures(t,oc(n),{limit:1}))?.[0];if(!r)throw new Error("No signature found");const o=await this.#Q.fetchBySignature(r,e,t);if(!o)throw new Error("No transaction found");Rv(o,e)?this.#i.info(`Transaction ${r} is spam. Skipping.`):await this.#Q.save(o)}async#oe(e){this.#i.info("Handling connection recovery",{network:e});const[t,n]=await Promise.all([this.#J.getAll(),this.#Z.getAll()]),r=n.filter((e=>Pv.#ue(e)||Pv.#le(e))),o=(0,Pd.uniq)(r.map((e=>Pv.#de(e)))),i=t.filter((e=>o.includes(e.address)));i.length?await this.#X.synchronize(i):this.#i.info("No monitored accounts found. Skipping connection recovery.")}static#ue(e){return"accountSubscribe"===e.method}static#le(e){return"programSubscribe"===e.method}static#de(e){if(this.#ue(e))return(0,Pd.get)(e,"params[0]");if(this.#le(e))return(0,Pd.get)(e,"params[1].filters[0].memcmp.bytes");throw new Error("Invalid subscription")}}class Nv{#he;#pe;#ge;#i;#me=new Map;constructor(e,t,n,r){this.#he=e,this.#pe=t,this.#ge=n,this.#i=Jl(r,"[🔔 SubscriptionService]"),this.#te()}#te(){this.#ge.on("onInactive",this.#ye.bind(this)),this.#ge.on("onWebSocketEvent",this.#we.bind(this)),this.#ge.on("onListSubscriptions",this.#ve.bind(this)),rw.forEach((e=>{this.#he.onConnectionRecovery(e,this.#Ae.bind(this))}))}registerNotificationHandler(e,t,n){this.#i.info("Registering notification handler",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#me.has(r)||this.#me.set(r,new Set),this.#me.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#he.onConnectionRecovery(e,t)}async subscribe(e){this.#i.info("New subscription request",e);const{method:t,params:n,network:r,expiryMilliseconds:o}=e,i=await this.#be(e),a=await this.#pe.getById(i);if(a){if("confirmed"===a.status)return i;await this.#pe.delete(i)}const s={...e,id:i,status:"pending",requestId:i,createdAt:(new Date).toISOString(),...o?{expiresAt:new Date(Date.now()+o).toISOString()}:{}};await this.#pe.save(s);const c=await this.#he.findByNetwork(r),u=async e=>{const r={jsonrpc:"2.0",id:i,method:t,params:n};e&&await this.#Se(e,r)};return c&&await u(c.id),s.id}async unsubscribe(e){this.#i.info("Unsubscribing from",e);const t=await this.#pe.getById(e);if(!t)return void this.#i.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:o}=t,i=rm[o];if(await this.#pe.delete(n),"confirmed"===t.status){const e=await this.#he.findByNetwork(r);e&&await this.#Se(e.id,{jsonrpc:"2.0",id:globalThis.crypto.randomUUID(),method:i,params:[t.rpcSubscriptionId]})}}async getAll(){return this.#pe.getAll()}async#we(e){if("message"!==e.type)return;const t=(e=>{const{data:t}=e;let n;if(t&&"object"==typeof t&&"type"in t)if("text"===t.type)n="string"==typeof t.message?JSON.parse(t.message):t.message;else{if("binary"!==t.type)throw new Error("Unknown message data");{const e=t.message,r=String.fromCharCode(...e);n=JSON.parse(r)}}else n="string"==typeof t?JSON.parse(t):t;return n})(e),n=await this.#he.findById(e.id);if(n)switch(this.#i.info("Received message",e),t.method){case"accountNotification":case"programNotification":case"signatureNotification":await this.#Ee(t,n.network);break;default:this.#ke(t)?await this.#Te(t):this.#Ie(t)?await this.#xe(t):zm(t)?await this.#_e(t):this.#i.warn("Received unknown message",t)}}async#Ee(e,t){const{subscription:n}=e.params,r=await this.#pe.findBy("rpcSubscriptionId",n);if(!r)return void this.#i.warn("No subscription found for RPC ID:",n);const o=`${r.method}:${t}`,i=this.#me.get(o);if(i&&i.size>0){(await Promise.allSettled(Array.from(i).map((async t=>t(e,r))))).forEach((e=>{"rejected"===e.status&&this.#i.error(`Handler failed for ${r.method}:`,e.reason)}))}}async#Se(e,t){this.#i.info(`Sending message to connection ${e}`,t),await snap.request({method:"snap_sendWebSocketMessage",params:{id:e,message:JSON.stringify(t)}})}#ke(e){return"jsonrpc"in e&&"2.0"===e.jsonrpc&&"id"in e&&"result"in e&&"number"==typeof e.result}#Ie(e){return"jsonrpc"in e&&"id"in e&&"result"in e&&!0===e.result}async#Te(e){const{id:t,result:n}=e,r=await this.#pe.getById(String(t));r?(await this.#pe.update({...r,status:"confirmed",rpcSubscriptionId:n,confirmedAt:(new Date).toISOString()}),this.#i.info(`Subscription confirmed: request ID: ${t} -> RPC ID: ${n}`)):this.#i.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#xe(e){this.#i.info("Received unsubscription confirmation",e)}async#_e(e){if("id"in e&&void 0!==e.id){const t=await this.#pe.getById(String(e.id));"pending"===t?.status?(await this.#pe.delete(t.id),this.#i.error(`Subscription establishment failed for ${t.id}:`,e.error)):this.#i.error(`Received error for request ID: ${e.id}`,e.error)}else this.#i.error("Connection-level error:",e.error)}async#be(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#Ce(t),r=(new TextEncoder).encode(n),o=await globalThis.crypto.subtle.digest("SHA-256",r),i=Array.from(new Uint8Array(o)).map((e=>e.toString(16).padStart(2,"0"))).join("");return i}#Ce(e){if(null==e)return JSON.stringify(e);if("object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map((e=>this.#Ce(e))).join(",")}]`;const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));return`{${t.map((t=>`"${t}":${this.#Ce(e[t])}`)).join(",")}}`}async#ve(){const e=await this.#pe.getAll();this.#i.info("Subscriptions",{subscriptions:e,notificationHandlers:this.#me})}#Re(e){return{method:e.method,params:e.params,network:e.network,...e.expiryMilliseconds?{expiryMilliseconds:e.expiryMilliseconds}:{},...e.metadata?{metadata:e.metadata}:{}}}async#Ae(e){this.#i.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#pe.getAll()).filter((t=>t.network===e)).filter(Nv.#Pe),n=t.map((e=>e.id));await this.#pe.deleteMany(n),await Promise.allSettled(t.map((async e=>{await this.subscribe(this.#Re(e))})))}async#ye(){this.#i.info("Client became inactive"),await this.#Ne()}async#Ne(){this.#i.info("Removing expired subscriptions");const e=(await this.#pe.getAll()).filter(Nv.#Be);await Promise.allSettled(e.map((async e=>{await this.unsubscribe(e.id)})))}static#Be(e){const t=new Date;return Boolean(e.expiresAt&&new Date(e.expiresAt)<t)}static#Pe(e){return!Nv.#Be(e)}}function Bv(e,t,n){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...t,key:n})}function Mv(e,t,n){return Bv(e,t,n)}const Ov='<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><image width="16" height="16" href="data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUFBQUFBQUGBgUICAcICAsKCQkKCxEMDQwNDBEaEBMQEBMQGhcbFhUWGxcpIBwcICkvJyUnLzkzMzlHREddXX0BBQUFBQUFBQYGBQgIBwgICwoJCQoLEQwNDA0MERoQExAQExAaFxsWFRYbFykgHBwgKS8nJScvOTMzOUdER11dff/CABEIAPoA+gMBIgACEQEDEQH/xAA1AAEAAwEBAQEBAAAAAAAAAAAAAQIHBggEBQMBAQADAQEBAQAAAAAAAAAAAAACAwQBBQYH/9oADAMBAAIQAxAAAADxkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACx204cU3mdnnYLG+IQwNvsxhgLfrRh5/egLRh59egkYefXoRCPn6mv5BH2ajuwAAAACZdFZz6/SvzfofWfLWtS2jw7WpNGO01mjJaas+P+k0tRjtNbUY38Leccnq/DxFq5f2ao7cAAAAB+36W8/9p7+DZZxp6nl7LOM3qzbLOMqs2zzjF6suyzjNqqNlnGrU5NkY7zlHP75Wjzv0mg5pAAAAAAs6jqdsMuajacMsam5HLGqORytqkxjlTVbc5lLVpjDKGsfhQlwdb1p3QAAAAAADofSXk7q/cp9MT8n0/cebe1Jpx2tS2fJNqTRkvNLUY7TWaMdqXZ8vnHPvZHmrw/u+JTGL6EAAAAABMDuvQvkLQfo6PQU55P0WLRJztTl0Sc7U5tFnOppzaOzmacujTnSrLo3x8NNFOM8zsuM+H99Aq2AAAAAATMfpWPznbNXOJdqjHi47Wec4l2jnOLdo5zi57JFxrsp5HjadRy9d0CMgAAAAJPqm+j0X8fW/oV82rPvUWRNGObUmjHe1LUZLIUY7TDPk/opk2CP5uPy+U+1qKrwAAAAPo3zPdc+23fu2/BfYXdA/AmjL+/bn1GToZ55Tl6KedmjJ0c87anL0LnuZyUTgH9fm+Q9+Bk0AAAAAAWVdWVFlRZUWVFpo4uoLxV0HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH//EAEEQAAECAwQHBAgDBgcBAAAAAAECBAADBgURF1UQMUFRkpPSEiFSohYgIjBAYaPiBzLBEyRUYnCRFBVDRYGhstH/2gAIAQEAAT8A/qXdF0XRd8ou9a4R3aOz8AO+KUo95Uc1SyoyGcs+3OIvvPhQDrMYUWPmbzhRGFFj5m74URhRY2Zu+FEYT2NmbvhRGE1jZm84URhNY2ZvOFEYTWNmjzhRGEti5o84URhLYuaPP7IjCWxc0ecKIwksXM3nCiMJLFzN5wojCSxczd/2RGEliZm8/siKt/DthYNkTLRbWlNUqWtIKJwA7Xa8JHwFK0w6qN6EJvQ1lkGfO2AeEb1HZDRq2YNpLVrJTLkyk9lCAO4D9TtJ2nQIv0C/QDAOgGL9Lp22Yt5rl1NTLky03rWrUB+p+W2KyqubUr72SpDOSSJEonzKHiPv6dsB7UT1LduLkJuM2afyy0bzvO4RZdmtbIZSGTRHZlS069qlbVK3k6AYGkQDA0DQDonTpTaVMnTpqUSkJKlrUbkhI1kmK3rJdQuRIaKUiz5BPYB7jMV41CD3++sWx3ltv5LNqm9au9Sj+VCRrUo7hFg2IzsBhLZthftmzCO+Yvao7vkNA0AxfA0A6RAMCCpKUqJUAALySbgBFeVsLXUuzbPWQxQr25m2coH/AMiFa/f0rVK6ZmO1hkiemehIIKuwoFBvFyrjGLByIc89MYsnIxz/ALIxZORjn/ZGLJyMc89MYspyP6/2xi0nIvr/AGxi2nI/r/bGLYyL6/2xi5LyM8/7Yxbl5Gef9sYuSsjPPHTGLkrI1c8dMYuSMjXzh0xi63yRfOHTFR/iO9tpktk1bBpJWLpp7fbWtPh1CCTBJPwN3udfqk6vgKcph7Ui3KW02VKEhIK1zL9atQFwJjCu1szZ+fpjCy18zZ+fpjCu1syZefpjCu1syZefpjCq18yZ+fpjCq18yZ+fpjCm18zZ+fpjCi1s0Z+fpjCe1szZ+fpjCe1s0Z+fpjCa180Z+fpjCa1szZ+fpjCa1szZefpjCW1s0Zefpi36Etan2gdrVKcSAblqlX+wTvBAMKB7ou9/T9vPKffJctriki6bLP5Vo3H9DFl2m1tdlIetV9qXMGralW1KtxGgGAYvgQDoBi+L9A0TZUtxKmSp0tK5cwFK0K7wUnWCIrWjlU+4DltethOPsE95lK8CjB+ApipnVPPAtN62yyBPk7FDeNyhsMNHbZ+2kum04TJMxPaSobR+hG0bIEXwDpB0AwIHqO2rZ+2nNXMlM2TMR2VoVqI/Q7jsisKWn049ISVTGc4kyJvy1lCvmII9+DdFH1VNsB0JThalMJyh+1RrKD40jeIkzpLiVLnSZqZkqYkKQtJvSUnUQdAOi+BF+gHQNA0WjZzO1Wc5m8lCZKmC4jaDsUk7FDYYqWnHtOv1t56SqUq8yJwHctH/ANG2B78G4xR1ZKsLttXiVzGSzeAk3mUraUg6wdojEum9zzkp64xMprc85KeuMTKa8Lzkp64xMprwvOSnrjE2mvC85KeuMTaa8LzlJ64xNprwveSnrjE6mvC95KeuMT6Z3POSnrjE+mdzzlJ6oxOpnc85Q6oxPpjc85SeqMT6YOx5yU9cYn0xue8lPXFY1tYFuWKtk1kT1zzNQpCpqAkIuPeoHtHX8APWv9S+L4vGjVo/4+Bs6zHtquA3ZN1TphBNydgG0k9wEYfVR/Ao5qIw9qj+BRzURh/VWXDmojD6qsuHNRGH1VZcOaiMPqqy4c1EYf1Xlf1ZfVGH9WZX9VHVGH1WZX9WX1Rh9VeWfVl9UYf1blJ5qOqMP6tyo81HVGH1W5T9VHVGH1XZSeajqi0qSt+yGxdPrPXLkhQSV9pKgCd/ZJ+As6z3dpu5LVrKMybMNwA/7JOwDaYpun29PMBIRcufMuLib41bh/KNnq3iL4ECO6Bd6m0d0fiBWMp6ldj2esKkBX7xOGpage5Cd6RtPvhDRrPeOJTeRKVMnTFBKEDWSYpSmJNPNSVkLezUj9rM2Aa+wn5DadI9QQDovgQNAivK2S2TPsezZl80jsOZwP5AdaE/PeYJJ99KlrmrQhAJWSAABeSdwikaTRYklLp0Ap/MRcdolJOwfPeY1QDov0iBoBi+AdNb1l/k6FWcwX+/LR7ax/oAjZ/OYUpSiSSSSbyT3kn39BubFZv5860ZqJc5KB/h1zPyJO0/JW6PSanh/vTXjj0mp7OmvHAqens6a8celFO501449Kacztrxx6U05nbXjj0ppzPGnHHpTTeeNOOPSqnM8accelVN54044FVU3njTjj0rprPWnHAqums8accelVNZ4044qav7PYNDLsp0hy7mC4LR3oljxE7VbhE+dNcTVzpswrmLUVKUokqJOsknWfgAbovMXnfF/wAzHai+L4vMdo747R3x2jvgKO+O18zHa+cXnfBJ/rX/AP/EADQRAAEDAQUFBAkFAAAAAAAAAAIAAQQDBRIUU5IREzBCVBUjMkMGICExM0RQUqIQImFyof/aAAgBAgEBPwD6pTpnVK6A3iT2fJ+z/U8GQ3InhyG5FhqzcqehUbkW7qfYnE25eBTA6piADeIlCgNFD2/ELxIhRCiFEKIUQqq93gWXXs+NT3lQu+/qitWC/m/i6e04b+annxcxFOi5iKZGfmRSo78yORS2ftJETk+1+BRgTK4bylQMhT2XO6U12ZOb5c12dMyDTwJWQawUnKNYORlIo9YG2vS4NkWoUM92fwS/H+UziY3hRCiFEKIUQog2+9S4z0ivD4eDY9rYd9xXLu+UvtRWlA6oEVowepBFPhZ4IpsPPBFMiZ4IpUbNBHXjG2x6oKsICbsBXh4AAVQhAAvES7Om9Kel1gJnSnpdYGY3y56Vg5TeQelYSVkHpWGkZJ6Vh6+UaISF9hD64iREIj73Vh2Jg6bSKw98X4ohRCiFEKIUQqVWCPTvEq1YqxuRev6Nw4Aji5MgN5yARN7EU6D1YamRTYXVBqZFMh9QGpkUqJ1AamRSonUBqZFJi54amVaXGpgRb0FKlHKqXn8PLwNqvOrzra6vP+u36t//xAA2EQABBAEBAwkECwEAAAAAAAACAAEDBAWiEjFDBhETFDAyQkRSICFBkhYjM1BTVGBhcrHB0f/aAAgBAwEBPwD70llCGMpJC2RT5jHtxtLp85jm42l0/KDFtvsaXT8pMS3mdLp+U+HbzOl0/KvCN5vS6+l+Cbfb0uqOQq5KBp6x7Ufd7rt/ftkTA3O+5ZC0dk9lvsxRgjBGCMEYI41hMBLl7PpgDvn/AIq1aGpBHBCGzGDcw+3binmbZDuosbYfwo8VbfhosNdfhamR4PIPwtTIsBkX4GpkfJzKPug1MoOSuSmmAZI+jDxntMqVOvQrhBCGyI6v3fsHkAX95J7ELeNPbr/GVddqNxl1+m3HBPk6Db7QJ8tjvjaBRZOhNIMYWgci7GWPbZHGjBGCMFJGjBOxCTEKwmYG4HQTF9cOrsZYtv3sjryP4UdSV+EjpWH4SPH2X3QGjxlx+AaPE338qaHFZSIwOOuYkKoS2ZawPZi6OT4/97F3ZOYN4l0sbeNl08P4oJ7EDcUF1mv+YD5l1uq3mA+ZkMkcjc4GxD2DROze9GCMFICMEYIwVelJbl2B3KtWjqxDFHub260cXNtmYI3i9aNg9aMWRx86OE/Qjry+hdSnM+ZgVatHWjYQb+X6F//Z" /></svg>';function zv(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function Uv(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:zv(r),key:n}}}const jv=Uv("Container"),Lv=Uv("Box"),Dv=Uv("Heading"),Fv=Uv("Text"),$v=Uv("Section"),Wv=Uv("Row"),qv=Uv("Address"),Vv=Uv("Image"),Kv=Uv("Footer"),Gv=Uv("Button"),Hv=Uv("Link");function Zv(e,t,n){const{cluster:r}=ud[e];return Rd({baseUrl:"https://solscan.io",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const Jv=({domain:e,scope:t,address:n})=>Bv(Lv,{direction:"horizontal",alignment:"center",children:Bv(Hv,{href:Zv(t,"address",n),children:e})});function Yv(e,t){return`${e}:${t}`}const Qv=JSON.parse('{"D":{"send.title":{"message":"Send"},"send.balance":{"message":"Balance"},"send.maxButton":{"message":"Max"},"send.cancelButton":{"message":"Cancel"},"send.continueButton":{"message":"Continue"},"send.fromField":{"message":"From"},"send.toField":{"message":"To"},"send.amountField":{"message":"Amount"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Enter public address or domain name"},"send.fromRequiredError":{"message":"Account is required"},"send.amountRequiredError":{"message":"Amount is required"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"Amount must be greater than {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Insufficient SOL balance to cover the transaction fee"},"send.toRequiredError":{"message":"To address is required"},"send.toInvalidError":{"message":"Invalid Solana address or domain name"},"send.toInvalidErrorDomain":{"message":"Unable to resolve domain name"},"send.toDomainResolutionStatus.initial":{"message":"Domain"},"send.toDomainResolutionStatus.fetching":{"message":"Resolving domain name..."},"send.toDomainResolutionStatus.fetched":{"message":"Domain name resolved."},"send.toDomainResolutionStatus.error":{"message":"Unable to resolve domain name."},"send.insufficientBalance":{"message":"Insufficient balance"},"send.simulationTitleAPIError":{"message":"Because of an error, we couldn\'t check for security alerts."},"send.simulationMessageAPIError":{"message":"Only continue if you trust every address involved."},"send.simulationTitleError":{"message":"Transaction simulation failed"},"send.simulationMessageError":{"message":"This transaction was reverted during simulation."},"send.selectedTokenPriceNotAvailable":{"message":"Prices for tokens in {currency} are currently not available. You are still able to send tokens."},"send.confirmation.title":{"message":"Review"},"send.confirmation.from":{"message":"From"},"send.confirmation.recipient":{"message":"Recipient"},"send.confirmation.network":{"message":"Network"},"send.confirmation.transactionSpeed":{"message":"Transaction speed"},"send.confirmation.fee":{"message":"Network fee"},"send.confirmation.sendButton":{"message":"Send"},"send.confirmation.cancelButton":{"message":"Cancel"},"send.confirmation.viewTransaction":{"message":"View transaction"},"send.send-pending.title":{"message":"Sending..."},"send.send-pending.subtitle":{"message":"Your transaction was submitted."},"send.transaction-success.title":{"message":"Sent"},"send.transaction-success.subtitle":{"message":"{amount} {tokenSymbol} was successfully sent"},"send.transaction-failure.title":{"message":"Transaction failed"},"send.transaction-failure.subtitle":{"message":"Unable to send {amount} {tokenSymbol}"},"confirmation.account":{"message":"Account"},"confirmation.network":{"message":"Network"},"confirmation.estimatedChanges":{"message":"Estimated changes"},"confirmation.estimatedChanges.send":{"message":"You send"},"confirmation.estimatedChanges.receive":{"message":"You receive"},"confirmation.estimatedChanges.notAvailable":{"message":"Not available"},"confirmation.estimatedChanges.noChanges":{"message":"No changes"},"confirmation.estimatedChanges.tooltip":{"message":"Estimated changes are what might happen if you go through with this transaction. This is just a prediction, not a guarantee."},"confirmation.advanced.show":{"message":"Show advanced"},"confirmation.advanced.hide":{"message":"Hide advanced"},"confirmation.cancelButton":{"message":"Cancel"},"confirmation.confirmButton":{"message":"Confirm"},"confirmation.signAndSendTransaction.title":{"message":"Transaction request"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Unknown"},"confirmation.advanced.programId":{"message":"Program ID"},"confirmation.advanced.data":{"message":"Data"},"confirmation.fee":{"message":"Network fee"},"confirmation.feeError":{"message":"Unable to estimate fee"},"confirmation.origin":{"message":"Request from"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"This transaction was reverted during simulation."},"confirmation.simulationErrorSubtitle":{"message":"{reason}"},"confirmation.validationErrorTitle":{"message":"This is a deceptive request"},"confirmation.validationErrorSubtitle":{"message":"If you approve this request, a third party known for scams will take all your assets."},"confirmation.validationErrorLearnMore":{"message":"Learn more"},"confirmation.validationErrorSecurityAdviced":{"message":"Security advice by"},"confirmation.signMessage.title":{"message":"Sign message"},"confirmation.signMessage.message":{"message":"Message"},"confirmation.signIn.title":{"message":"Sign-in request"},"confirmation.signIn.description":{"message":"A site wants you to sign in to prove you own this account."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Unknown domain"},"confirmation.signIn.signingInWith":{"message":"Signing in with"},"confirmation.signIn.badAccount":{"message":"This site is asking you to sign in using the wrong account."},"confirmation.signIn.message":{"message":"Message"},"confirmation.signIn.statement":{"message":"Statement"},"confirmation.signIn.version":{"message":"Version"},"confirmation.signIn.chainId":{"message":"Chain ID"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Issued at"},"confirmation.signIn.expirationTime":{"message":"Expiration time"},"confirmation.signIn.notBefore":{"message":"Not before"},"confirmation.signIn.requestId":{"message":"Request ID"},"confirmation.signIn.resources":{"message":"Resources"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"An account with the same address already exists."},"transactionScan.errors.insufficientSol":{"message":"Account does not have enough SOL to perform the operation."},"transactionScan.errors.slippageToleranceExceeded":{"message":"The transaction was reverted because the slippage tolerance was exceeded."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),Xv=JSON.parse('{"D":{"send.title":{"message":"Enviar"},"send.balance":{"message":"Saldo"},"send.maxButton":{"message":"Máx."},"send.cancelButton":{"message":"Cancelar"},"send.continueButton":{"message":"Continuar"},"send.fromField":{"message":"De"},"send.toField":{"message":"Para"},"send.amountField":{"message":"Monto"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Introduzca la dirección pública"},"send.fromRequiredError":{"message":"La cuenta es obligatoria"},"send.amountRequiredError":{"message":"El monto es obligatorio"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"El valor debe ser superior a {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Saldo de SOL insuficiente para cubrir la tarifa de transacción"},"send.toRequiredError":{"message":"La dirección del destinatario es obligatoria"},"send.toInvalidError":{"message":"Dirección de Solana no válida"},"send.insufficientBalance":{"message":"Saldo insuficiente"},"send.simulationTitleAPIError":{"message":"Debido a un error, no pudimos verificar las alertas de seguridad."},"send.simulationMessageAPIError":{"message":"Continúa solo si confías en todas las direcciones involucradas."},"send.simulationTitleError":{"message":"Simulación de transacción fallida"},"send.simulationMessageError":{"message":"Esta transacción se revirtió durante la simulación."},"send.selectedTokenPriceNotAvailable":{"message":"Los precios de los tokens en {currency} no están disponibles actualmente. Aún puede enviar tokens."},"send.confirmation.title":{"message":"Revisar"},"send.confirmation.from":{"message":"De"},"send.confirmation.recipient":{"message":"Destinatario"},"send.confirmation.network":{"message":"Red"},"send.confirmation.transactionSpeed":{"message":"Velocidad de la transacción"},"send.confirmation.fee":{"message":"Tarifa de red"},"send.confirmation.sendButton":{"message":"Enviar"},"send.confirmation.cancelButton":{"message":"Cancelar"},"send.confirmation.viewTransaction":{"message":"Ver transacción"},"send.send-pending.title":{"message":"Enviando..."},"send.send-pending.subtitle":{"message":"Se envió su transacción."},"send.transaction-success.title":{"message":"Enviado"},"send.transaction-success.subtitle":{"message":"El envío de {amount} {tokenSymbol} se realizó correctamente"},"send.transaction-failure.title":{"message":"Transacción fallida"},"send.transaction-failure.subtitle":{"message":"Error al enviar {amount} {tokenSymbol}"},"confirmation.account":{"message":"Cuenta"},"confirmation.network":{"message":"Red"},"confirmation.estimatedChanges":{"message":"Cambios estimados"},"confirmation.estimatedChanges.send":{"message":"Usted envía"},"confirmation.estimatedChanges.receive":{"message":"Usted recibe"},"confirmation.estimatedChanges.notAvailable":{"message":"No disponible"},"confirmation.estimatedChanges.noChanges":{"message":"Sin cambios"},"confirmation.estimatedChanges.tooltip":{"message":"Los cambios estimados son los que podrían producirse si sigue adelante con esta transacción. Esto es solo una predicción, no una garantía."},"confirmation.advanced.show":{"message":"Mostrar avanzadas"},"confirmation.advanced.hide":{"message":"Ocultar avanzadas"},"confirmation.cancelButton":{"message":"Cancelar"},"confirmation.confirmButton":{"message":"Confirmar"},"confirmation.signAndSendTransaction.title":{"message":"Solicitud de transacción"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Desconocida"},"confirmation.advanced.programId":{"message":"ID del programa"},"confirmation.advanced.data":{"message":"Datos"},"confirmation.fee":{"message":"Tarifa de red"},"confirmation.feeError":{"message":"No se puede calcular la tarifa"},"confirmation.origin":{"message":"Solicitud de"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"Esta transacción se revirtió durante la simulación."},"confirmation.simulationErrorSubtitle":{"message":"Motivo: {reason}"},"confirmation.validationErrorTitle":{"message":"Esta es una solicitud engañosa"},"confirmation.validationErrorSubtitle":{"message":"Si aprueba esta solicitud, un tercero conocido por sus estafas se quedará con todos sus activos."},"confirmation.validationErrorLearnMore":{"message":"Conozca más"},"confirmation.validationErrorSecurityAdviced":{"message":"Asesoramiento de seguridad por"},"confirmation.signMessage.title":{"message":"Firmar mensaje"},"confirmation.signMessage.message":{"message":"Mensaje"},"confirmation.signIn.title":{"message":"Solicitud de inicio de sesión"},"confirmation.signIn.description":{"message":"Un sitio quiere que inicie sesión para demostrar que usted es el titular de esta cuenta."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Dominio desconocido"},"confirmation.signIn.signingInWith":{"message":"Iniciar sesión con"},"confirmation.signIn.badAccount":{"message":"Este sitio le pide que inicie sesión con la cuenta incorrecta."},"confirmation.signIn.message":{"message":"Mensaje"},"confirmation.signIn.statement":{"message":"Declaración"},"confirmation.signIn.version":{"message":"Versión"},"confirmation.signIn.chainId":{"message":"ID de cadena"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Emitido a las"},"confirmation.signIn.expirationTime":{"message":"Hora de caducidad"},"confirmation.signIn.notBefore":{"message":"No antes de"},"confirmation.signIn.requestId":{"message":"ID de solicitud"},"confirmation.signIn.resources":{"message":"Recursos"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"Ya existe una cuenta con la misma dirección."},"transactionScan.errors.insufficientSol":{"message":"La cuenta no tiene suficiente SOL para realizar la operación."},"transactionScan.errors.slippageToleranceExceeded":{"message":"La transacción se revirtió porque se superó la tolerancia de deslizamiento."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),eA={en:Qv.D,es:Xv.D};function tA(e){const t=eA[e]??eA.en;return(e,n)=>{let r=t?.[e]?.message??e;return n&&r&&Object.keys(n).forEach((e=>{const t=new RegExp(`\\{${e}\\}`,"gu");r=r.replace(t,n[e]??"")})),r}}function nA(e){if(e===nd)return"MetaMask";try{return new URL(e).hostname}catch(e){throw new Error("Invalid URL")}}const rA=({label:e,value:t})=>null!=t?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:e}),Bv(Fv,{children:t})]}):null,oA=1e-6,iA=new jo(oA).decimalPlaces();function aA(e,t){const[n]=t.split("_");try{const r=new jo(e);if(r.isNaN())return"0";if(r.isZero())return"0";if(r.abs().lt(oA))return`<${function(e,t){const n=new jo(t),r=n.decimalPlaces(),o=n.toFixed(r??0),[i]=e.split("_"),[a,s]=o.split("."),c=new Intl.NumberFormat(i).format(a);return s?`${c}.${s}`:c}(t,oA)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:3}).format(Number(r.toFixed(iA??0)));const o=r.abs().integerValue().toString().length,i=Math.max(0,3-o+1);return new Intl.NumberFormat(t,{maximumFractionDigits:i}).format(r.toFixed(i))}catch(e){return Yl.error(e),"0"}}function sA(e,t,n){const r=new jo(e).toNumber(),[o]=n.split("_");return r.toLocaleString(o,{style:"currency",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const cA=({asset:e,preferences:t})=>{const n=e.type;return Mv(Lv,{direction:"vertical",crossAlignment:"end",children:[Mv(Lv,{direction:"horizontal",alignment:"center",children:[Mv(Fv,{color:"in"===n?"success":"error",children:["in"===n?"+":"-",aA(e.value??0,t.locale)]}),e.imageSvg?Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"full",src:e.imageSvg})}):null,Bv(Fv,{children:e.symbol??""})]}),e.price?Bv(Fv,{color:"muted",children:sA(e.price.toString(),t.currency,t.locale)}):null]})},uA=Uv("Tooltip");var lA;!function(e){e.Accessibility="accessibility",e.Activity="activity",e.AddCard="add-card",e.AddCircle="add-circle",e.AddSquare="add-square",e.Add="add",e.Ai="ai",e.AlternateEmail="alternate-email",e.Apple="apple",e.Apps="apps",e.Arrow2Down="arrow-2-down",e.Arrow2Left="arrow-2-left",e.Arrow2Right="arrow-2-right",e.Arrow2UpRight="arrow-2-up-right",e.Arrow2Up="arrow-2-up",e.ArrowCircleDown="arrow-circle-down",e.ArrowCircleUp="arrow-circle-up",e.ArrowDoubleLeft="arrow-double-left",e.ArrowDoubleRight="arrow-double-right",e.ArrowDown="arrow-down",e.ArrowDropDownCircle="arrow-drop-down-circle",e.ArrowLeft="arrow-left",e.ArrowRight="arrow-right",e.ArrowUp="arrow-up",e.Attachment="attachment",e.Ban="ban",e.BankAssured="bank-assured",e.Bank="bank",e.Bold="bold",e.Book="book",e.Bookmark="bookmark",e.Bridge="bridge",e.Briefcase="briefcase",e.Bulb="bulb",e.BuySell="buy-sell",e.Cake="cake",e.Calculator="calculator",e.Calendar="calendar",e.Call="call",e.Camera="camera",e.Campaign="campaign",e.CardPos="card-pos",e.Card="card",e.Cash="cash",e.Category="category",e.Chart="chart",e.CheckBold="check-bold",e.Check="check",e.CircleX="circle-x",e.ClockFilled="clock-filled",e.Clock="clock",e.Close="close",e.CloudDownload="cloud-download",e.CloudUpload="cloud-upload",e.Cloud="cloud",e.CodeCircle="code-circle",e.Code="code",e.Coin="coin",e.Collapse="collapse",e.Confirmation="confirmation",e.Connect="connect",e.CopySuccess="copy-success",e.Copy="copy",e.CreditCheck="credit-check",e.CurrencyFranc="currency-franc",e.CurrencyLira="currency-lira",e.CurrencyPound="currency-pound",e.CurrencyYuan="currency-yuan",e.Customize="customize",e.Danger="danger",e.DarkFilled="dark-filled",e.Dark="dark",e.Data="data",e.Description="description",e.Details="details",e.Diagram="diagram",e.DocumentCode="document-code",e.Download="download",e.Draft="draft",e.EcoLeaf="eco-leaf",e.EditSquare="edit-square",e.Edit="edit",e.EncryptedAdd="encrypted-add",e.Eraser="eraser",e.Error="error",e.Ethereum="ethereum",e.Exchange="exchange",e.ExpandVertical="expand-vertical",e.Expand="expand",e.ExploreFilled="explore-filled",e.Explore="explore",e.Export="export",e.Extension="extension",e.EyeSlash="eye-slash",e.Eye="eye",e.FaceId="face-id",e.Feedback="feedback",e.File="file",e.Filter="filter",e.Fingerprint="fingerprint",e.Fire="fire",e.FirstPage="first-page",e.Flag="flag",e.FlashSlash="flash-slash",e.Flash="flash",e.Flask="flask",e.Flower="flower",e.Folder="folder",e.Forest="forest",e.FullCircle="full-circle",e.Gas="gas",e.Gift="gift",e.GlobalSearch="global-search",e.Global="global",e.Graph="graph",e.Hardware="hardware",e.HashTag="hash-tag",e.HeartFilled="heart-filled",e.Heart="heart",e.Hierarchy="hierarchy",e.HomeFilled="home-filled",e.Home="home",e.Image="image",e.Info="info",e.Inventory="inventory",e.Joystick="joystick",e.KeepFilled="keep-filled",e.Keep="keep",e.Key="key",e.LastPage="last-page",e.LightFilled="light-filled",e.Light="light",e.Link="link",e.Loading="loading",e.Location="location",e.LockSlash="lock-slash",e.Lock="lock",e.LockedFilled="locked-filled",e.Login="login",e.Logout="logout",e.Mail="mail",e.Map="map",e.Menu="menu",e.MessageQuestion="message-question",e.Messages="messages",e.Mic="mic",e.MinusBold="minus-bold",e.MinusSquare="minus-square",e.Minus="minus",e.Mobile="mobile",e.MoneyBag="money-bag",e.Money="money",e.Monitor="monitor",e.MoreHorizontal="more-horizontal",e.MoreVertical="more-vertical",e.MountainFlag="mountain-flag",e.MusicNote="music-note",e.Notification="notification",e.PageInfo="page-info",e.Palette="palette",e.PasswordCheck="password-check",e.Pending="pending",e.People="people",e.PersonCancel="person-cancel",e.Pin="pin",e.Plant="plant",e.Plug="plug",e.PlusAndMinus="plus-and-minus",e.PolicyAlert="policy-alert",e.Print="print",e.PriorityHigh="priority-high",e.PrivacyTip="privacy-tip",e.ProgrammingArrows="programming-arrows",e.Publish="publish",e.QrCode="qr-code",e.Question="question",e.Receive="receive",e.Received="received",e.Refresh="refresh",e.RemoveMinus="remove-minus",e.Report="report",e.Rocket="rocket",e.SaveFilled="save-filled",e.Save="save",e.Saving="saving",e.ScanBarcode="scan-barcode",e.ScanFocus="scan-focus",e.Scan="scan",e.Search="search",e.SecurityAlert="security-alert",e.SecurityCross="security-cross",e.SecurityKey="security-key",e.SecuritySearch="security-search",e.SecuritySlash="security-slash",e.SecurityTick="security-tick",e.SecurityTime="security-time",e.SecurityUser="security-user",e.Security="security",e.Send="send",e.SentimentDissatisfied="sentiment-dissatisfied",e.SentimentNeutral="sentiment-neutral",e.SentimentSatisfied="sentiment-satisfied",e.SentimentVerySatisfied="sentiment-very-satisfied",e.SettingFilled="setting-filled",e.Setting="setting",e.Share="share",e.ShieldLock="shield-lock",e.ShoppingBag="shopping-bag",e.ShoppingCart="shopping-cart",e.SignalCellular="signal-cellular",e.Slash="slash",e.Sms="sms",e.SnapsMobile="snaps-mobile",e.SnapsPlus="snaps-plus",e.SnapsRound="snaps-round",e.Snaps="snaps",e.SortByAlpha="sort-by-alpha",e.Sort="sort",e.Sparkle="sparkle",e.Speed="speed",e.Speedometer="speedometer",e.Square="square",e.Stake="stake",e.StarFilled="star-filled",e.Star="star",e.Start="start",e.Storefront="storefront",e.Student="student",e.SwapHorizontal="swap-horizontal",e.SwapVertical="swap-vertical",e.TabClose="tab-close",e.TableRow="table-row",e.Tablet="tablet",e.Tag="tag",e.ThumbDownFilled="thumb-down-filled",e.ThumbDown="thumb-down",e.ThumbUpFilled="thumb-up-filled",e.ThumbUp="thumb-up",e.Tint="tint",e.Tooltip="tooltip",e.Translate="translate",e.Trash="trash",e.TrendDown="trend-down",e.TrendUp="trend-up",e.TriangleUp="triangle-up",e.TriangleDown="triangle-down",e.Undo="undo",e.Unfold="unfold",e.UnlockedFilled="unlocked-filled",e.Unpin="unpin",e.UploadFile="upload-file",e.Upload="upload",e.Usb="usb",e.UserCheck="user-check",e.UserCircleAdd="user-circle-add",e.UserCircleRemove="user-circle-remove",e.UserCircle="user-circle",e.User="user",e.VerifiedFilled="verified-filled",e.Verified="verified",e.Videocam="videocam",e.ViewColumn="view-column",e.ViewInAr="view-in-ar",e.VolumeOff="volume-off",e.VolumeUp="volume-up",e.WalletFilled="wallet-filled",e.Wallet="wallet",e.Warning="warning",e.WebTraffic="web-traffic",e.Widgets="widgets",e.WifiOff="wifi-off",e.Wifi="wifi",e.X="x"}(lA||(lA={}));const dA=Uv("Icon"),fA=({preferences:e})=>{const t=tA(e.locale);return Mv(Lv,{direction:"horizontal",center:!0,children:[Bv(Fv,{fontWeight:"medium",children:t("confirmation.estimatedChanges")}),Bv(uA,{content:t("confirmation.estimatedChanges.tooltip"),children:Bv(dA,{name:"info"})})]})},hA=Uv("Skeleton"),pA=({preferences:e})=>{const t=tA(e.locale);return Mv($v,{direction:"vertical",children:[Bv(fA,{preferences:e}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.send")}),Bv(Lv,{children:Mv(Lv,{direction:"vertical",crossAlignment:"end",children:[Bv(hA,{width:100,height:20}),Bv(hA,{width:40,height:20})]})})]}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.receive")}),Bv(Lv,{children:Mv(Lv,{direction:"vertical",crossAlignment:"end",children:[Bv(hA,{width:100,height:20}),Bv(hA,{width:40,height:20})]})})]})]})},gA=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const o=tA(t.locale),i="fetched"===n,a="error"===n;if("fetching"===n)return Bv(pA,{preferences:t});if(a||i&&"ERROR"===r)return Mv($v,{direction:"vertical",children:[Bv(fA,{preferences:t}),Bv(Fv,{color:"alternative",children:o("confirmation.estimatedChanges.notAvailable")})]});const s=e?.assets.filter((e=>"out"===e.type))??[],c=e?.assets.filter((e=>"in"===e.type))??[],u=s.length>0||c.length>0;return Mv($v,i&&!u?{direction:"vertical",children:[Bv(fA,{preferences:t}),Bv(Fv,{color:"alternative",children:o("confirmation.estimatedChanges.noChanges")})]}:{children:[Bv(fA,{preferences:t}),s?.length>0?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.send")}),Bv(Lv,{children:Bv(Lv,{children:s?.map((e=>Bv(cA,{asset:e,preferences:t})))})})]}):null,Bv(Lv,{children:null}),c?.length>0?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.receive")}),Bv(Lv,{children:Bv(Lv,{children:c?.map((e=>Bv(cA,{asset:e,preferences:t})))})})]}):null]})};var mA=function(e){return e.Cancel="confirm-sign-in-cancel",e.Confirm="confirm-sign-in-confirm",e}({});const yA={"confirm-sign-in-cancel":async function({id:e}){await Zy(e,!1)},"confirm-sign-in-confirm":async function({id:e}){await Zy(e,!0)}},wA=({params:e,origin:t,account:n,accountDomain:r,scope:o,preferences:i,networkImage:a})=>{const s=tA(i.locale),c=t?nA(t):null,{domain:u,statement:l,uri:d,version:f,chainId:h,nonce:p,issuedAt:g,expirationTime:m,notBefore:y,requestId:w,resources:v,address:A}=e,b=Yv(o,n.address),S=A?Yv(o,A):null,E=S!==b,k=u!==c;return Mv(jv,{children:[Mv(Lv,{children:[Mv(Lv,{alignment:"center",center:!0,children:[Bv(Lv,{children:null}),Bv(Dv,{size:"lg",children:s("confirmation.signIn.title")}),Bv(Fv,{color:"muted",alignment:"center",children:s("confirmation.signIn.description")})]}),i.simulateOnChainActions?Bv(gA,{changes:null,scanStatus:null,preferences:i,scanFetchStatus:"fetched"}):null,Mv($v,{children:[c?Bv(Wv,{label:s("confirmation.origin"),tooltip:s("confirmation.origin.tooltip"),children:Bv(Fv,{children:c})}):null,Bv(Wv,{variant:k?"critical":"default",label:s("confirmation.signIn.domain"),tooltip:k?s("confirmation.signIn.badDomain"):void 0,children:Bv(Fv,{children:u??s("confirmation.signIn.unknownDomain")})}),Bv(Wv,{label:s("confirmation.signIn.signingInWith"),tooltip:E?s("confirmation.signIn.badAccount"):void 0,variant:E?"warning":"default",children:r?Bv(Jv,{domain:r,scope:o,address:n.address}):Bv(qv,{address:b,truncate:!0,displayName:!0,avatar:!0})})]}),Mv($v,{children:[Bv(Fv,{fontWeight:"medium",children:s("confirmation.signIn.message")}),Bv(Fv,{children:l??""}),Bv(rA,{label:"URL",value:d??""}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.network")}),Mv(Lv,{direction:"horizontal",alignment:"center",children:[Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"medium",src:a??Ov})}),Bv(Fv,{children:ud[o].name})]})]}),S?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.account")}),Bv(qv,{address:S,truncate:!0,displayName:!0,avatar:!0})]}):null,Bv(rA,{label:s("confirmation.signIn.version"),value:f??""}),Bv(rA,{label:s("confirmation.signIn.chainId"),value:h??""}),Bv(rA,{label:s("confirmation.signIn.nonce"),value:p??""}),Bv(rA,{label:s("confirmation.signIn.issuedAt"),value:g??""}),Bv(rA,{label:s("confirmation.signIn.expirationTime"),value:m??""}),Bv(rA,{label:s("confirmation.signIn.notBefore"),value:y??""}),Bv(rA,{label:s("confirmation.signIn.requestId"),value:w??""}),v&&v.length>0?Mv(Lv,{alignment:"space-between",direction:"vertical",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.signIn.resources")}),Bv(Lv,{direction:"vertical",children:v.map((e=>Bv(Fv,{children:e},e)))})]}):null]})]}),Mv(Kv,{children:[Bv(Gv,{name:mA.Cancel,children:s("confirmation.cancelButton")}),Bv(Gv,{name:mA.Confirm,variant:k?"destructive":"primary",children:s("confirmation.confirmButton")})]})]})};var vA=function(e){return e.Cancel="confirm-sign-message-cancel",e.Confirm="confirm-sign-message-confirm",e}({});const AA={"confirm-sign-message-cancel":async function({id:e}){await Zy(e,!1)},"confirm-sign-message-confirm":async function({id:e}){await Zy(e,!0)}},bA=({message:e,account:t,accountDomain:n,scope:r,locale:o,networkImage:i,origin:a})=>{const s=tA(o),{address:c}=t,u=a?nA(a):null,l=Yv(r,c);return Mv(jv,{children:[Mv(Lv,{children:[Mv(Lv,{alignment:"center",center:!0,children:[Bv(Lv,{children:null}),Bv(Dv,{size:"lg",children:s("confirmation.signMessage.title")})]}),Mv($v,{children:[Bv(Lv,{direction:"horizontal",center:!0,children:Bv(Fv,{fontWeight:"medium",children:s("confirmation.signMessage.message")})}),Bv(Lv,{alignment:"space-between",children:Bv(Fv,{children:e})})]}),Mv($v,{children:[u?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Mv(Lv,{alignment:"space-between",direction:"horizontal",center:!0,children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.origin")}),Bv(uA,{content:s("confirmation.origin.tooltip"),children:Bv(dA,{name:"question",color:"muted"})})]}),Bv(Fv,{children:u})]}):null,Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.account")}),n?Bv(Jv,{domain:n,scope:r,address:c}):Bv(qv,{address:l,truncate:!0,displayName:!0,avatar:!0})]}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.network")}),Mv(Lv,{direction:"horizontal",alignment:"center",children:[Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"medium",src:i??Ov})}),Bv(Fv,{children:ud[r].name})]})]})]})]}),Mv(Kv,{children:[Bv(Gv,{name:vA.Cancel,children:s("confirmation.cancelButton")}),Bv(Gv,{name:vA.Confirm,children:s("confirmation.confirmButton")})]})]})};var SA=function(e){return e.ShowAdvanced="confirm-sign-and-send-transaction-show-advanced",e.Cancel="confirm-sign-and-send-transaction-cancel",e.Confirm="confirm-sign-and-send-transaction-confirm",e}({});const EA={"confirm-sign-and-send-transaction-show-advanced":async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await Hy(e,Bv(zA,{context:n}),n)},"confirm-sign-and-send-transaction-cancel":async function({id:e}){await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Ky}`)},"confirm-sign-and-send-transaction-confirm":async function({id:e}){await Zy(e,!0),await AE.deleteKey(`mapInterfaceNameToId.${Ky}`)}},kA=e=>e.replace(/([A-Z])/gu," $1").trim().replace(/^./u,(e=>e.toUpperCase())),TA=({address:e,scope:t})=>Bv(Hv,{href:Zv(t,"address",e),children:Bv(qv,{avatar:!1,address:Yv(t,e),truncate:!0})}),IA=({instruction:e,scope:t,locale:n})=>{const r=tA(n),{type:o,encoded:i,parsed:a}=e,{programAddress:s,dataBase58:c}=i,u=null!==a,l=kA(o);return Mv($v,{alignment:"start",children:[Bv(Fv,{color:"alternative",fontWeight:"bold",children:l}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",alignment:"start",children:r("confirmation.advanced.programId")}),Bv(TA,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map((([e,n])=>Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",children:kA(e)}),nc(n.address)?Bv(TA,{address:n.address,scope:t}):Bv(Fv,{children:Wy(n.address)?.toString()??""})]}))),u&&Object.entries(a.data).map((([e,n])=>Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",children:kA(e)}),nc(n)?Bv(TA,{address:n,scope:t}):Bv(Fv,{children:Wy(n)?.toString()??""})]}))),!u&&Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",children:r("confirmation.advanced.data")}),Bv(Fv,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},xA=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const o=tA(n),i=t?"hide":"show",a=t?"arrow-up":"arrow-down";return Mv(Lv,{alignment:"start",children:[Mv(Gv,{name:SA.ShowAdvanced,children:[o(`confirmation.advanced.${i}`),"&nbsp;",Bv(dA,{name:a,color:"primary"})]}),t&&Bv(Lv,{children:e.map((e=>Bv(IA,{locale:n,scope:r,instruction:e})))})]})},_A=Uv("Banner"),CA={AccountAlreadyInUse:"transactionScan.errors.accountAlreadyInUse",ResultWithNegativeLamports:"transactionScan.errors.insufficientSol",SlippageToleranceExceeded:"transactionScan.errors.slippageToleranceExceeded",ExceededDesiredSlippageLimit:"transactionScan.errors.slippageToleranceExceeded"};function RA(e,t){const n=tA(t.locale),{code:r}=e;return n((r&&CA[r])??"transactionScan.errors.unknownError")}const PA={Malicious:"danger",Warning:"warning"},NA=({preferences:e,validation:t,error:n,scanFetchStatus:r})=>{const o=tA(e.locale);if("error"===r)return Bv(_A,{title:o("send.simulationTitleAPIError"),severity:"danger",children:Bv(Fv,{children:o("send.simulationMessageAPIError")})});if(!n&&!t)return Bv(Lv,{children:null});if(n)return Bv(_A,{title:o("confirmation.simulationErrorTitle"),severity:"warning",children:Bv(Fv,{children:o("confirmation.simulationErrorSubtitle",{reason:RA(n,e)})})});if(!t)return Bv(Lv,{children:null});const i=t?.type?PA[t.type]:void 0;return i?Mv(_A,{title:o("confirmation.validationErrorTitle"),severity:i,children:[Bv(Fv,{children:o("confirmation.validationErrorSubtitle")}),Bv(Fv,{size:"sm",children:Bv(Hv,{href:"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/",children:o("confirmation.validationErrorLearnMore")})}),Mv(Fv,{size:"sm",children:[Bv(dA,{color:"primary",name:"security-tick"})," ",o("confirmation.validationErrorSecurityAdviced")," ",Bv(Hv,{href:"https://www.blockaid.io",children:"Blockaid"})]})]}):Bv(Lv,{children:null})};function BA(e,t,n){return`${aA(e,n)} ${t}`}function MA(e,t){return new jo(e).multipliedBy(t).toString()}const OA=({origin:e,accountAddress:t,accountDomain:n,scope:r,feeInSol:o,nativePrice:i,fetchingPricesStatus:a,preferences:s,networkImage:c})=>{const{currency:u,locale:l}=s,d=tA(l),f=e?nA(e):null,h="fetching"===a,p=o&&i&&!("error"===a)?sA(MA(o,i),u,l):"";return Mv($v,{children:[f?Mv(Lv,{children:[Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Mv(Lv,{alignment:"space-between",direction:"horizontal",center:!0,children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.origin")}),Bv(uA,{content:d("confirmation.origin.tooltip"),children:Bv(dA,{name:"question",color:"muted"})})]}),Bv(Fv,{children:f})]}),Bv(Lv,{children:null})]}):null,Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.account")}),n&&t?Bv(Jv,{domain:n,scope:r,address:t}):null,!n&&t?Bv(qv,{address:Yv(r,t),truncate:!0,displayName:!0,avatar:!0}):null]}),Bv(Lv,{children:null}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.network")}),Mv(Lv,{direction:"horizontal",alignment:"center",children:[Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"medium",src:c??""})}),Bv(Fv,{children:ud[r].name})]})]}),Bv(Lv,{children:null}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.fee")}),o?Mv(Lv,{direction:"horizontal",alignment:"center",children:[h?Bv(hA,{width:80}):Bv(Fv,{color:"muted",children:p}),Bv(Fv,{children:BA(o,ud[r].nativeToken.symbol,l)})]}):Bv(uA,{content:d("confirmation.feeError"),children:Bv(dA,{name:"warning"})})]})]})},zA=({context:e})=>{const t=tA(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=ud[e.scope],o=e.tokenPrices[r.caip19Id]?.price??null,i="fetching"===e.scanFetchStatus||"ERROR"===e.scan?.status;return Mv(jv,{children:[Mv(Lv,{children:[e.preferences.useSecurityAlerts?Bv(NA,{scanFetchStatus:e.scanFetchStatus,validation:e.scan?.validation??null,error:e.scan?.error??null,preferences:e.preferences}):null,Mv(Lv,{alignment:"center",center:!0,children:[Bv(Lv,{children:null}),Bv(Dv,{size:"lg",children:t(`confirmation.${e.method}.title`)}),Bv(Lv,{children:null})]}),e.preferences.simulateOnChainActions?Bv(gA,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,Bv(OA,{accountAddress:e.account?.address??null,accountDomain:e.accountDomain??null,scope:e.scope,feeInSol:n,nativePrice:o,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),Bv(xA,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),Mv(Kv,{children:[Bv(Gv,{name:SA.Cancel,children:t("confirmation.cancelButton")}),Bv(Gv,{name:SA.Confirm,disabled:i,children:t("confirmation.confirmButton")})]})]})},UA={method:en.SignAndSendTransaction,scope:rd.Mainnet,networkImage:Ov,account:null,accountDomain:null,transaction:"",scan:null,scanFetchStatus:"fetching",feeEstimatedInSol:"0",tokenPrices:{},tokenPricesFetchStatus:"fetching",origin:"",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},advanced:{shown:!1,instructions:[]}};async function jA(e){const t={...UA,...e},n=Yy().then((e=>{t.preferences=e})).catch((()=>{t.preferences=UA.preferences})),r=(async(e,t)=>{const n=await qg(t,e),r="instructions"in n?n:await Fg(n.messageBytes,e),{instructions:o}=r;return o.map(em)})(kE.getRpc(t.scope),t.transaction).then((e=>{t.advanced.instructions=e})).catch((e=>{Yl.error(e),t.advanced.instructions=[]})),o=t.account?.address?jE.resolveAddress(t.scope,t.account.address).then((e=>{t.accountDomain=e})):Promise.resolve().then((()=>{t.accountDomain=null}));await Promise.all([n,r,o]);const{currency:i,useExternalPricingData:a,useSecurityAlerts:s,simulateOnChainActions:c}=t.preferences,u=await Gy(Bv(zA,{context:t}),t),l=Jy(u),d={...t},f=[ud[t.scope].nativeToken.caip19Id];a?await ME.getMultipleSpotPrices(f,i).then((e=>{d.tokenPrices=e,d.tokenPricesFetchStatus="fetched"})).catch((()=>{d.tokenPricesFetchStatus="error"})):(d.tokenPricesFetchStatus="fetched",d.tokenPrices={});let h=null;try{const{totalFee:e}=ym.calculateFee(t.transaction);h=wm(e).toString()}catch{h=null}d.feeEstimatedInSol=h,await Hy(u,Bv(zA,{context:d}),d);const p={...d},g=[];if(c&&g.push("simulation"),s&&g.push("validation"),c||s){const e=GE.scanTransaction({method:p.method,accountAddress:p.account?.address??"",transaction:p.transaction,scope:p.scope,origin:p.origin,options:g}).then((async e=>{p.scan=e,p.scanFetchStatus=e?"fetched":"error"})).catch((()=>{p.scan=null,p.scanFetchStatus="error"}));await Promise.all([e])}else p.scanFetchStatus="fetched",p.scan=null;return await Hy(u,Bv(zA,{context:p}),p),await AE.setKey(`mapInterfaceNameToId.${Ky}`,u),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}}),l}var LA=function(e){return e.OnTransactionAdded="onTransactionAdded",e.OnTransactionApproved="onTransactionApproved",e.OnTransactionRejected="onTransactionRejected",e.RefreshSend="refreshSend",e.RefreshConfirmationEstimation="refreshConfirmationEstimation",e.CloseWebSocketConnections="closeWebSocketConnections",e}({});function DA(e){return JSON.parse(function(e){const t=[];let n=!1;for(let r=0;r<e.length;r++){let o=!1;if("\\"===e[r]&&(t.push(e[r++]),o=!o),'"'!==e[r]){if(!n){const n=FA(e,r);if(n?.length){r+=n.length-1,n.match(/\.|[eE]-/)?t.push(n):t.push($A(n));continue}}t.push(e[r])}else t.push(e[r]),o||(n=!n)}return t.join("")}(e),((e,t)=>function(e){return!!e&&"object"==typeof e&&"$n"in e&&"string"==typeof e.$n}(t)?function({$n:e}){if(e.match(/[eE]/)){const[t,n]=e.split(/[eE]/);return BigInt(t)*BigInt(10)**BigInt(n)}return BigInt(e)}(t):t))}function FA(e,t){if(!e[t]?.match(/[-\d]/))return null;const n=e.slice(t).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);return n?n[0]:null}function $A(e){return`{"$n":"${e}"}`}var WA=0n;function qA(){const e=WA;return WA++,e.toString()}function VA(e){return function(e){return new Proxy(e.api,{defineProperty:()=>!1,deleteProperty:()=>!1,get:(t,n,r)=>function(...o){const i=n.toString(),a=Reflect.get(t,i,r);if(!a)throw new Ca(Ea,{method:i,params:o});const s=a(...o);return function({transport:e},t){return{send:async n=>await t.execute({signal:n?.abortSignal,transport:e})}}(e,s)}})}(e)}function KA(e){return new Proxy({},{defineProperty:()=>!1,deleteProperty:()=>!1,get(...t){const[n,r]=t,o=r.toString();return function(...t){const n=Object.freeze({methodName:o,params:t}),r=e?.requestTransformer?e?.requestTransformer(n):n;return Object.freeze({execute:async({signal:t,transport:n})=>{const o=function(e){return{id:qA(),jsonrpc:"2.0",method:e.methodName,params:e.params}}(r),i=await n({payload:o,signal:t});return e?.responseTransformer?e.responseTransformer(i,r):i}})}}})}function GA(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)&&("jsonrpc"in e&&"2.0"===e.jsonrpc&&"method"in e&&"string"==typeof e.method&&"params"in e)}var HA={};function ZA(e){return function t(n,r){if(Array.isArray(n))return n.map(((e,n)=>{const o={...r,keyPath:[...r.keyPath,n]};return t(e,o)}));if("object"==typeof n&&null!==n){const e={};for(const o in n){if(!Object.prototype.hasOwnProperty.call(n,o))continue;const i={...r,keyPath:[...r.keyPath,o]};e[o]=t(n[o],i)}return e}return e.reduce(((e,t)=>t(e,r)),n)}}function JA(e,t){return n=>{const r=ZA(e);return Object.freeze({...n,params:r(n.params,t)})}}function YA(e){return"bigint"==typeof e?Number(e):e}function QA({commitmentPropertyName:e,params:t,optionsObjectPositionInParams:n,overrideCommitment:r}){const o=t[n];if(void 0===o||o&&"object"==typeof o&&!Array.isArray(o))if(o&&e in o){if(!o[e]||"finalized"===o[e]){const r=[...t],{[e]:i,...a}=o;return Object.keys(a).length>0?r[n]=a:n===r.length-1?r.length--:r[n]=void 0,r}}else if("finalized"!==r){const i=[...t];return i[n]={...o,[e]:r},i}return t}function XA(e){return(t,{keyPath:n})=>("bigint"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var eb={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function tb(e){const t=e?.onIntegerOverflow;return n=>{return lu(n,t?(r=t,e=>JA([XA(((...t)=>r(e,...t)))],{keyPath:[]})(e)):e=>e,JA([YA],{keyPath:[]}),function({defaultCommitment:e,optionsObjectPositionByMethod:t}){return n=>{const{params:r,methodName:o}=n;if(!Array.isArray(r))return n;const i=t[o];return null==i?n:Object.freeze({methodName:o,params:QA({commitmentPropertyName:"sendTransaction"===o?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:eb}));var r}}function nb(e){return t=[rb(e)],n={keyPath:[]},e=>ZA(t)(e,n);var t,n}function rb(e){return function(t,{keyPath:n}){return"number"==typeof t&&Number.isInteger(t)||"bigint"==typeof t?function(e,t){return t.some((t=>{if(t.length!==e.length)return!1;for(let n=e.length-1;n>=0;n--){const r=e[n],o=t[n];if(o!==r&&(o!==HA||"number"!=typeof r))return!1}return!0}))}(n,e)?Number(t):BigInt(t):t}}function ob(e){return(t,n)=>{const r=n.methodName,o=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return lu(t,(e=>(e=>{const t=e;if("error"in t)throw za(t.error);return t})(e)),(e=>e.result),(e=>nb(o??[])(e,n)))}}var ib,ab=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",HA,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",HA,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",HA,"state","preUpdateAverageRate"],["data","parsed","info","extensions",HA,"state","currentRate"]],sb=[...ab,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",HA,"confirmationCount"]],cb=[["index"],["instructions",HA,"accounts",HA],["instructions",HA,"programIdIndex"],["instructions",HA,"stackHeight"]],ub=[["addressTableLookups",HA,"writableIndexes",HA],["addressTableLookups",HA,"readonlyIndexes",HA],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",HA,"accounts",HA],["instructions",HA,"programIdIndex"],["instructions",HA,"stackHeight"]];function lb(e){return KA({requestTransformer:tb(e),responseTransformer:ob({allowedNumericKeyPaths:db()})})}function db(){return ib||(ib={getAccountInfo:sb.map((e=>["value",...e])),getBlock:[["transactions",HA,"meta","preTokenBalances",HA,"accountIndex"],["transactions",HA,"meta","preTokenBalances",HA,"uiTokenAmount","decimals"],["transactions",HA,"meta","postTokenBalances",HA,"accountIndex"],["transactions",HA,"meta","postTokenBalances",HA,"uiTokenAmount","decimals"],["transactions",HA,"meta","rewards",HA,"commission"],...cb.map((e=>["transactions",HA,"meta","innerInstructions",HA,...e])),...ub.map((e=>["transactions",HA,"transaction","message",...e])),["rewards",HA,"commission"]],getClusterNodes:[[HA,"featureSet"],[HA,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[HA,"commission"]],getMultipleAccounts:sb.map((e=>["value",HA,...e])),getProgramAccounts:sb.flatMap((e=>[["value",HA,"account",...e],[HA,"account",...e]])),getRecentPerformanceSamples:[[HA,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:ab.map((e=>["value",HA,"account",...e])),getTokenAccountsByOwner:ab.map((e=>["value",HA,"account",...e])),getTokenLargestAccounts:[["value",HA,"decimals"],["value",HA,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",HA,"accountIndex"],["meta","preTokenBalances",HA,"uiTokenAmount","decimals"],["meta","postTokenBalances",HA,"accountIndex"],["meta","postTokenBalances",HA,"uiTokenAmount","decimals"],["meta","rewards",HA,"commission"],...cb.map((e=>["meta","innerInstructions",HA,...e])),...ub.map((e=>["transaction","message",...e]))],getVersion:[["feature-set"]],getVoteAccounts:[["current",HA,"commission"],["delinquent",HA,"commission"]],simulateTransaction:[...sb.map((e=>["value","accounts",HA,...e])),...cb.map((e=>["value","innerInstructions",HA,...e]))]}),ib}Object.assign({"accept-charset":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,"permissions-policy":!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,via:!0},{"accept-encoding":!0});var fb=["getAccountInfo","getBalance","getBlock","getBlockCommitment","getBlockHeight","getBlockProduction","getBlocks","getBlocksWithLimit","getBlockTime","getClusterNodes","getEpochInfo","getEpochSchedule","getFeeForMessage","getFirstAvailableBlock","getGenesisHash","getHealth","getHighestSnapshotSlot","getIdentity","getInflationGovernor","getInflationRate","getInflationReward","getLargestAccounts","getLatestBlockhash","getLeaderSchedule","getMaxRetransmitSlot","getMaxShredInsertSlot","getMinimumBalanceForRentExemption","getMultipleAccounts","getProgramAccounts","getRecentPerformanceSamples","getRecentPrioritizationFees","getSignaturesForAddress","getSignatureStatuses","getSlot","getSlotLeader","getSlotLeaders","getStakeMinimumDelegation","getSupply","getTokenAccountBalance","getTokenAccountsByDelegate","getTokenAccountsByOwner","getTokenLargestAccounts","getTokenSupply","getTransaction","getTransactionCount","getVersion","getVoteAccounts","index","isBlockhashValid","minimumLedgerSlot","requestAirdrop","sendTransaction","simulateTransaction"];function hb(e){return GA(e)&&fb.includes(e.method)}function pb(e){return function(e){const{fromJson:t,headers:n,toJson:r,url:o}=e,i=n&&function(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}(n);return async function({payload:e,signal:n}){const a=r?r(e):JSON.stringify(e),s={body:a,headers:{...i,accept:"application/json","content-length":a.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:n},c=await fetch(o,s);if(!c.ok)throw new Ca(Sa,{headers:c.headers,message:c.statusText,statusCode:c.status});return t?t(await c.text(),e):await c.json()}}({...e,fromJson:(e,t)=>hb(t)?DA(e):JSON.parse(e),toJson:e=>{return hb(e)?(t=e,function(e){return e.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g,"$1")}(JSON.stringify(t,((e,t)=>"bigint"==typeof t?function(e){return{$n:`${e}`}}(t):t),n))):JSON.stringify(e);var t,n}})}var gb=Object.prototype.toString,mb=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function yb(e,t){let n,r,o,i,a,s,c;if(!0===e)return"true";if(!1===e)return"false";switch(typeof e){case"object":if(null===e)return null;if("toJSON"in e&&"function"==typeof e.toJSON)return yb(e.toJSON(),t);if(c=gb.call(e),"[object Array]"===c){for(o="[",r=e.length-1,n=0;n<r;n++)o+=yb(e[n],!0)+",";return r>-1&&(o+=yb(e[n],!0)),o+"]"}if("[object Object]"===c){for(i=mb(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=yb(e[a],!1),void 0!==s&&(o&&(o+=","),o+=JSON.stringify(a)+":"+s),n++;return"{"+o+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"bigint":return`${e.toString()}n`;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}function wb(e){const t=yb(e,!1);if(void 0!==t)return""+t}function vb(e,t,n){let r="";if("number"==typeof t[0]){const e=t[0]+1,n=e%10,o=e%100;r=1==n&&11!=o?e+"st":2==n&&12!=o?e+"nd":3==n&&13!=o?e+"rd":e+"th"}else r=`\`${t[0].toString()}\``;const o=t.length>1?t.slice(1).map((e=>"number"==typeof e?`[${e}]`:e)).join("."):void 0,i=new Ca(ba,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...void 0!==o?{path:o}:void 0});return Ra(i,vb),i}var Ab,bb={defaultCommitment:"confirmed",onIntegerOverflow(e,t,n){throw vb(e.methodName,t,n)}},Sb=globalThis.AbortController;function Eb(e){return GA(e)?wb([e.method,e.params]):void 0}function kb(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function Tb(e){return lu(pb({...e,headers:{...e.headers?kb(e.headers):void 0,"solana-client":"js/2.1.0"}}),(e=>function(e,t){let n;return async function(r){const{payload:o,signal:i}=r,a=t(o);if(void 0===a)return await e(r);if(n||(queueMicrotask((()=>{n=void 0})),n={}),null==n[a]){const t=new Sb,o=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(Ab||={}))return;throw e}})();n[a]={abortController:t,numConsumers:0,responsePromise:o}}const s=n[a];if(s.numConsumers++,i){const e=s.responsePromise;return await new Promise(((t,n)=>{const r=e=>{i.removeEventListener("abort",r),s.numConsumers-=1,queueMicrotask((()=>{0===s.numConsumers&&s.abortController.abort(Ab||={})})),n(e.target.reason)};i.addEventListener("abort",r),e.then(t).catch(n).finally((()=>{i.removeEventListener("abort",r)}))}))}return await s.responsePromise}}(e,Eb)))}function Ib(e){return VA({api:lb(bb),transport:e})}const xb=Zl,_b=["getTransaction","getSignaturesForAddress"],Cb=e=>{const t=Tb({url:e}),n=Tb({url:e,headers:{"x-bigtable":"disabled"}});return async(...e)=>{const{payload:r}=e[0],{method:o}=r,i=_b.includes(o);return xb.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${o}. ${i?"Enabling":"Disabling"} BigTable lookups.`),i?t(...e):n(...e)}},Rb=Zl;async function Pb(e){try{await snap.request({method:"snap_trackError",params:{error:eo(new Error(JSON.stringify(e)))}}),Rb.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){Rb.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}function Nb(e){return!(!D(e,Nm)&&!zm(e))||!!_a(e)}const Bb=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{Rb.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const o=await e(...t);if(Nb(o)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(o)}`,responseData:o,requestParams:n};return await Pb(e),o}return o}catch(e){const t=function(e,t){const n={method:t,errorMessage:"Unknown error"};return e?.currentUrl&&(n.url=e.currentUrl),e instanceof Error?(n.errorMessage=e.message,n.errorStack=e.stack):"string"==typeof e?n.errorMessage=e:e?.message?n.errorMessage=e.message:e?.error&&(n.errorMessage="string"==typeof e.error?e.error:JSON.stringify(e.error)),e?.status?n.statusCode=e.status:e?.statusCode&&(n.statusCode=e.statusCode),e?.response?n.responseData=e.response:e?.data&&(n.responseData=e.data),n}(e,r);throw await Pb(t),e instanceof Error?e:new Error(t.errorMessage)}},Mb=Zl;async function Ob(e){return new Promise((t=>setTimeout(t,e)))}const zb=Zl;const Ub=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;let o;for(let n=0;n<4;n++)try{return zb.info(`[🚌 RetryingTransport] Attempt "${r}" ${n+1} of 4`),await e(...t)}catch(e){if(zb.error(`[🚌 RetryingTransport] Error during attempt "${r}" ${n+1} of 4: ${e}`),o=e,n<3){const e=(i=n,Math.min(400*Math.pow(2,i),1500));zb.info(`[🚌 RetryingTransport] Sleeping for ${e}ms`),await Ob(e)}}var i;throw o},jb=e=>{return lu(e,(t=Cb,e=>e.map(t)),(t=>((e,t)=>async(...n)=>{let r;const o=e.length;for(const[i,a]of e.entries())try{const e=t[i];return Mb.info(`[🚌 FailoverTransport] Attempting to use transport ${i+1} of ${o} (URL: ${e})`),await a(...n)}catch(e){const n=t[i];r=e;const a=i===o-1;Mb.error(`[🚌 FailoverTransport] Transport failed (URL: ${n}): ${e}. ${a?"No more transports to try.":"Trying next transport..."}`),e instanceof Error&&(e.currentUrl=n)}throw r})(t,e)),Ub,(e=>Bb(e)));var t};var Lb,Db=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Fb=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var n=t.substring(1),r=parseInt(n)/8;this.resize_if_necessary(r);var o="f"===t[0]?"setFloat".concat(n):"i"===t[0]?"setInt".concat(n):"setUint".concat(n);this.view[o](this.offset,e,!0),this.offset+=r},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),$b=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),n=parseInt(t)/8;this.assert_enough_buffer(n);var r="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[r](this.offset,!0);return this.offset+=n,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),Wb=(Lb=function(e,t){return Lb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Lb(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Lb(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function qb(e,t,n){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}function Vb(e,t,n){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(n.join(".")))}var Kb=Db.concat(["bool","string"]),Gb=["option","enum","array","set","map","struct"],Hb=function(e){function t(t,n){var r="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return e.call(this,r)||this}return Wb(t,e),t}(Error);function Zb(e){if("string"!=typeof e||!Kb.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&Gb.includes(t[0])){var n=t[0];if("option"===n)return Zb(e[n]);if("enum"===n)return function(e){if(!Array.isArray(e))throw new Hb(e,"Array");for(var t=0,n=e;t<n.length;t++){var r=n[t];if("object"!=typeof r||!("struct"in r))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof r.struct||1!==Object.keys(r.struct).length)throw new Error('The "struct" in each enum must have a single key');Zb({struct:r.struct})}}(e[n]);if("array"===n)return function(e){if("object"!=typeof e)throw new Hb(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return Zb(e.type);throw new Hb(e,"{ type, len? }")}(e[n]);if("set"===n)return Zb(e[n]);if("map"===n)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new Hb(e,"{ key, value }");Zb(e.key),Zb(e.value)}(e[n]);if("struct"===n)return function(e){if("object"!=typeof e)throw new Hb(e,"object");for(var t in e)Zb(e[t])}(e[n])}}throw new Hb(e,Gb.join(", ")+" or "+Kb.join(", "))}}!function(){function e(e){this.encoded=new Fb,this.fieldPath=["value"],this.checkTypes=e}e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(Db.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var n=parseInt(t.substring(1));n<=32||"f64"==t?(this.checkTypes&&qb(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),n))},e.prototype.encode_bigint=function(e,t){for(var n=t/8,r=new Uint8Array(n),o=0;o<n;o++)r[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(r))},e.prototype.encode_string=function(e){this.checkTypes&&qb(e,"string",this.fieldPath);for(var t=e,n=[],r=0;r<t.length;r++){var o=t.charCodeAt(r);o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<55296||o>=57344?n.push(224|o>>12,128|o>>6&63,128|63&o):(r++,o=65536+((1023&o)<<10|1023&t.charCodeAt(r)),n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o))}this.encoded.store_value(n.length,"u32"),this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_boolean=function(e){this.checkTypes&&qb(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var n=Object.keys(e)[0],r=0;r<t.enum.length;r++){var o=t.enum[r];if(n===Object.keys(o.struct)[0])return this.encoded.store_value(r,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(n,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?Vb(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var n=0;n<e.length;n++)this.encode_value(e[n],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?Vb(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&qb(e,"object",this.fieldPath);var n=e instanceof Set?Array.from(e.values()):Object.values(e);this.encoded.store_value(n.length,"u32");for(var r=0,o=n;r<o.length;r++){var i=o[r];this.encode_value(i,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&qb(e,"object",this.fieldPath);var n=e instanceof Map,r=n?Array.from(e.keys()):Object.keys(e);this.encoded.store_value(r.length,"u32");for(var o=0,i=r;o<i.length;o++){var a=i[o];this.encode_value(a,t.map.key),this.encode_value(n?e.get(a):e[a],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&qb(e,"object",this.fieldPath);for(var n=0,r=Object.keys(t.struct);n<r.length;n++){var o=r[n];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}}}();var Jb=function(){function e(e){this.buffer=new $b(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(Db.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var n=e/8,r=new Uint8Array(this.buffer.consume_bytes(n)),o=r.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&r[n-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){for(var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e)),n=[],r=0;r<e;++r){var o=t[r];if(o<128)n.push(o);else if(o<224)n.push((31&o)<<6|63&t[++r]);else if(o<240)n.push((15&o)<<12|(63&t[++r])<<6|63&t[++r]);else{var i=(7&o)<<18|(63&t[++r])<<12|(63&t[++r])<<6|63&t[++r];n.push(i)}}return String.fromCodePoint.apply(String,n)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,n=this.buffer.consume_value("u8");if(n>e.enum.length)throw new Error("Enum option ".concat(n," is not available"));var r=e.enum[n].struct,o=Object.keys(r)[0];return(t={})[o]=this.decode_value(r[o]),t},e.prototype.decode_array=function(e){for(var t=[],n=e.array.len?e.array.len:this.decode_integer("u32"),r=0;r<n;++r)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),n=new Set,r=0;r<t;++r)n.add(this.decode_value(e.set));return n},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),n=new Map,r=0;r<t;++r){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);n.set(o,i)}return n},e.prototype.decode_struct=function(e){var t={};for(var n in e.struct)t[n]=this.decode_value(e.struct[n]);return t},e}();function Yb(e,t,n){return void 0===n&&(n=!0),n&&Zb(e),new Jb(t).decode(e)}var Qb=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Qb||{});const Xb=sc(),eS=(Fs(),Gs()),tS=Qs(),nS=Va(ru([["mint",ic()],["owner",ic()],["amount",Ss()],["delegate",df(ic(),{prefix:As(),noneValue:"zeroes"})],["state",Jc(Qb)],["isNative",df(Ss(),{prefix:As(),noneValue:"zeroes"})],["delegatedAmount",Ss()],["closeAuthority",df(ic(),{prefix:As(),noneValue:"zeroes"})]]),ou([["mint",ac()],["owner",ac()],["amount",Es()],["delegate",ff(ac(),{prefix:bs(),noneValue:"zeroes"})],["state",Yc(Qb)],["isNative",ff(Es(),{prefix:bs(),noneValue:"zeroes"})],["delegatedAmount",Es()],["closeAuthority",ff(ac(),{prefix:bs(),noneValue:"zeroes"})]]));var rS;!function(e){e.SymbolNotFound="SymbolNotFound",e.InvalidSubdomain="InvalidSubdomain",e.PrimaryDomainNotFound="PrimaryDomainNotFound",e.MissingParentOwner="MissingParentOwner",e.U32Overflow="U32Overflow",e.InvalidBufferLength="InvalidBufferLength",e.U64Overflow="U64Overflow",e.NoRecordData="NoRecordData",e.InvalidRecordData="InvalidRecordData",e.UnsupportedRecord="UnsupportedRecord",e.InvalidEvmAddress="InvalidEvmAddress",e.InvalidInjectiveAddress="InvalidInjectiveAddress",e.InvalidARecord="InvalidARecord",e.InvalidAAAARecord="InvalidAAAARecord",e.InvalidRecordInput="InvalidRecordInput",e.InvalidSignature="InvalidSignature",e.AccountDoesNotExist="AccountDoesNotExist",e.MultipleRegistries="MultipleRegistries",e.InvalidReverseTwitter="InvalidReverseTwitter",e.NoAccountData="NoAccountData",e.InvalidInput="InvalidInput",e.InvalidDomain="InvalidDomain",e.InvalidCustomBg="InvalidCustomBackground",e.UnsupportedSignature="UnsupportedSignature",e.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",e.RecordIsNotSigned="RecordIsNotSigned",e.UnsupportedSignatureType="UnsupportedSignatureType",e.InvalidSolRecordV2="InvalidSolRecordV2",e.MissingVerifier="MissingVerifier",e.PythFeedNotFound="PythFeedNotFound",e.InvalidRoA="InvalidRoA",e.InvalidPda="InvalidPda",e.InvalidParent="InvalidParent",e.NftAccountNotFound="NftRecordNotFound",e.PdaOwnerNotAllowed="PdaOwnerNotAllowed",e.DomainDoesNotExist="DomainDoesNotExist",e.RecordMalformed="RecordMalformed",e.CouldNotFindNftOwner="CouldNotFindNftOwner",e.InvalidValidation="InvalidValidation",e.InvalidSerializedData="InvalidSerializedData"}(rS||(rS={}));class oS extends Error{type;constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,oS)}}class iS extends oS{constructor(e){super(rS.PrimaryDomainNotFound,e)}}class aS extends oS{constructor(e){super(rS.NoRecordData,e)}}class sS extends oS{constructor(e){super(rS.AccountDoesNotExist,e)}}class cS extends oS{constructor(e){super(rS.NoAccountData,e)}}class uS extends oS{constructor(e){super(rS.InvalidInput,e)}}class lS extends oS{constructor(e){super(rS.InvalidRoA,e)}}class dS extends oS{constructor(e){super(rS.NftAccountNotFound,e)}}class fS extends oS{constructor(e){super(rS.PdaOwnerNotAllowed,e)}}class hS extends oS{constructor(e){super(rS.DomainDoesNotExist,e)}}class pS extends oS{constructor(e){super(rS.RecordMalformed,e)}}class gS extends oS{constructor(e){super(rS.CouldNotFindNftOwner,e)}}class mS extends oS{constructor(e){super(rS.InvalidValidation,e)}}class yS extends oS{constructor(e){super(rS.InvalidSerializedData,e)}}class wS{static HEADER_LEN=96;parentName;owner;class;data;static schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};constructor(e){this.parentName=Xb.decode(e.parentName),this.owner=Xb.decode(e.owner),this.class=Xb.decode(e.class)}static deserialize(e){try{const t=new wS(Yb(this.schema,e));return t.data=e?.slice(this.HEADER_LEN),t}catch{throw new Error("Failed to deserialize RegistryState data")}}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new sS("The domain account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await fh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}}const vS="58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx",AS="nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk",bS="33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z",SS="2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo",ES=async(e,t,n)=>{const r=await(async e=>{const t=tS.encode("SPL Name Service"+e),n=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(n)})(e);return await(async(e,t,n)=>{const r=[e];r.push(n?Xb.encode(n):new Uint8Array(32)),r.push(t?Xb.encode(t):new Uint8Array(32));const[o]=await yc({programAddress:"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX",seeds:r});return o})(r,t,n)};var kS;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(kS||(kS={}));class TS{tag;nonce;nameAccount;owner;nftMint;static LEN=98;static schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=Xb.decode(e.nameAccount),this.owner=Xb.decode(e.owner),this.nftMint=Xb.decode(e.nftMint)}static deserialize(e){try{return new TS(Yb(this.schema,e))}catch{throw new yS("Failed to deserialize NftState data")}}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new dS(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(AS,{encoding:"base64",filters:[{dataSize:BigInt(TS.LEN)},{memcmp:{offset:BigInt(0),bytes:"3",encoding:"base58"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:"base58"}}]}).send();if(1!==n.length)throw new dS(`NFT not found: ${t}`);return this.deserialize(eS.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await yc({programAddress:AS,seeds:[tS.encode("nft_record"),Xb.encode(e)]});return t}}const IS=tS.encode("tokenized_name"),xS=async(e,t)=>{try{const n=await(async e=>{const[t]=await yc({programAddress:AS,seeds:[IS,Xb.encode(e)]});return t})(t),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const o=await dh(e,r.value[0].address);if(!o.exists)return null;const i=nS.decode(o.data);return"1"===i.amount.toString()?i.owner:null}catch(e){if(_a(e,oi))return null;throw e}};class _S{tag;nameAccount;static schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=Xb.decode(e.nameAccount)}static deserialize(e){try{return new _S(Yb(this.schema,e))}catch{throw new yS("Failed to deserialize PrimaryDomainState data")}}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new iS("The favourite account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await fh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}static async getAddress(e,t){const[n]=await yc({programAddress:e,seeds:[tS.encode("favourite_domain"),Xb.encode(t)]});return n}}async function CS(e,t,n){const r=await(async(e,t)=>await ES(e,t,bS))(t,n),o=await wS.retrieve(e,r);if(!o.data)throw new cS("The registry data is empty");return function(e,t=!1){if(!e)return;const n=new DataView(e.buffer).getUint32(0,!0);return tS.decode(e.subarray(4,4+n)).replace(/^\0/,t?"":"\0")}(o.data,!!n)}var RS;!function(e){e.IPFS="IPFS",e.ARWV="ARWV",e.SOL="SOL",e.ETH="ETH",e.BTC="BTC",e.LTC="LTC",e.DOGE="DOGE",e.Email="email",e.Url="url",e.Discord="discord",e.Github="github",e.Reddit="reddit",e.Twitter="twitter",e.Telegram="telegram",e.Pic="pic",e.SHDW="SHDW",e.POINT="POINT",e.BSC="BSC",e.Injective="INJ",e.Backpack="backpack",e.A="A",e.AAAA="AAAA",e.CNAME="CNAME",e.TXT="TXT",e.Background="background",e.BASE="BASE",e.IPNS="IPNS"}(RS||(RS={}));new Map([[RS.SOL,96],[RS.ETH,20],[RS.BSC,20],[RS.Injective,20],[RS.A,4],[RS.AAAA,16],[RS.Background,32]]);var PS;!function(e){e[e.V1=1]="V1",e[e.V2=2]="V2"}(PS||(PS={}));const NS=async(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const n=t===PS.V2?SS:void 0,r={[PS.V2]:"",[PS.V1]:""}[t]||"\0",o=e.split(".");if(2===o.length){const e=await ES(o[1],vS);return{address:await ES(r+o[0],e,n),parentAddress:e,isSub:!0}}if(3===o.length&&t){const e=await ES(o[2],vS),t=await ES("\0"+o[1],e);return{address:await ES(r+o[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(o.length>=3)throw new uS("The domain is malformed");return{address:await ES(e,vS),isSub:!1}};function BS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function MS(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function OS(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function zS(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function US(e){if(!Array.isArray(e))throw new Error("array expected")}function jS(e,t){if(!MS(!0,t))throw new Error(`${e}: array of strings expected`)}function LS(e,t){if(!MS(!1,t))throw new Error(`${e}: array of numbers expected`)}const DS=(e,t)=>0===t?e:DS(t,e%t),FS=(e,t)=>e+(t-DS(e,t)),$S=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function WS(e,t,n,r){if(US(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(FS(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${FS(t,n)}`);let o=0,i=0;const a=$S[t],s=$S[n]-1,c=[];for(const r of e){if(zS(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);const e=$S[i];if(void 0===e)throw new Error("invalid carry");o&=e-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function qS(e){return function(e){if("function"!=typeof e)throw new Error("function expected")}(e),function(...t){try{return e.apply(null,t)}catch(e){}}}const VS=function(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map((e=>e.encode)).reduceRight(n,t),decode:e.map((e=>e.decode)).reduce(n,t)}}(function(e){const t=e.split(""),n=t.length;jS("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(US(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]}))),decode:t=>(US(t),t.map((t=>{OS("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})))}}("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),function(e=""){return OS("join",e),{encode:t=>(jS("join.decode",t),t.join(e)),decode:t=>(OS("join.decode",t),t.split(e))}}("")),KS=[996825010,642813549,513874426,1027748829,705979059];function GS(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<KS.length;e++)1==(t>>e&1)&&(n^=KS[e]);return n}function HS(e,t,n=1){const r=e.length;let o=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);o=GS(o)^n>>5}o=GS(o);for(let t=0;t<r;t++)o=GS(o)^31&e.charCodeAt(t);for(let e of t)o=GS(o)^e;for(let e=0;e<6;e++)o=GS(o);return o^=n,VS.encode(WS([o%$S[30]],30,5,!1))}!function(){const e=function(e,t=!1){if(zS(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(FS(8,e)>32||FS(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!BS(n))throw new Error("radix2.encode input should be Uint8Array");return WS(Array.from(n),8,e,!t)},decode:n=>(LS("radix2.decode",n),Uint8Array.from(WS(n,e,8,t)))}}(5),t=e.decode,n=e.encode,r=qS(t);function o(e,t,n=90){OS("bech32.encode prefix",e),BS(t)&&Array.from(t),LS("bech32.encode",t);const r=e.length;if(0===r)throw new TypeError(`Invalid prefix length ${r}`);const o=r+7+t.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),a=HS(i,t,1);return`${i}1${VS.encode(t)}${a}`}function i(e,t=90){OS("bech32.decode input",e);const n=e.length;if(n<8||!1!==t&&n>t)throw new TypeError(`invalid string length: ${n} (${e}). Expected (8..${t})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=r.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=r.slice(0,o),a=r.slice(o+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=VS.decode(a).slice(0,-6),c=HS(i,s,1);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:s}}qS(i)}();var ZS,JS={exports:{}},YS=JS.exports;!function(){return ZS||(ZS=1,e=JS,function(t){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${a})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let n,r,o=0,i=-1,a=(e.match(c.zoneIndex)||[])[0];for(a&&(a=a.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)o++;if("::"===e.substr(0,2)&&o--,"::"===e.substr(-2,2)&&o--,o>t)return null;for(r=t-o,n=":";r--;)n+="0:";return":"===(e=e.replace("::",n))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n}(),zoneId:a}}function l(e,t,n,r){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;r>0;){if(o=n-r,o<0&&(o=0),e[i]>>o!=t[i]>>o)return!1;r-=n,i+=1}return!0}function d(e){if(i.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(o.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}const h={};h.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,o,i;for(r=3;r>=0;r-=1){if(o=this.octets[r],!(o in n))return null;if(i=n[o],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),h.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<4;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(e){return null!==this.parser(e)},h.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},h.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv4.isValidFourPartDecimal=function(e){return!(!h.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<4;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},h.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(e){let t,n,o;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r}();if(t=e.match(r.longValue)){if(o=d(t[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(o>>t&255);return e}().reverse()}return(t=e.match(r.twoOctet))?function(){const e=t.slice(1,4),n=[];if(o=d(e[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(o>>16&255),n.push(o>>8&255),n.push(255&o),n}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),n=[];if(o=d(e[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(d(e[1])),n.push(o>>8&255),n.push(255&o),n}():null},h.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.IPv6=function(){function e(e,t){let n,r;if(16===e.length)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let r,o;for(let i=7;i>=0;i-=1){if(r=this.parts[i],!(r in n))return null;if(o=n[r],t&&0!==o)return null;16!==o&&(t=!0),e+=o}return 128-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],n=e[1];return new h.IPv4([t>>8,255&t,n>>8,255&n])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let n,r=0,o=-1;for(;n=e.exec(t);)n[0].length>o&&(r=n.index,o=n[0].length);return o<0?t:`${t.substring(0,r)}::${t.substring(r+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),h.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<16;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.isIPv6=function(e){return null!==this.parser(e)},h.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},h.IPv6.isValidCIDR=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv6.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<16;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},h.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(e){let t,n,r,o,i,a;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return u(e,8);if((r=e.match(c.transitional))&&(a=r[6]||"",t=r[1],r[1].endsWith("::")||(t=t.slice(0,-1)),t=u(t+a,6),t.parts)){for(i=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<i.length;n++)if(o=i[n],!(0<=o&&o<=255))return null;return t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.fromByteArray=function(e){const t=e.length;if(4===t)return new h.IPv4(e);if(16===t)return new h.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(e){return h.IPv6.isValid(e)||h.IPv4.isValid(e)},h.isValidCIDR=function(e){return h.IPv6.isValidCIDR(e)||h.IPv4.isValidCIDR(e)},h.parse=function(e){if(h.IPv6.isValid(e))return h.IPv6.parse(e);if(h.IPv4.isValid(e))return h.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(e){try{return h.IPv6.parseCIDR(e)}catch(t){try{return h.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},h.subnetMatch=function(e,t,n){let r,o,i,a;for(o in null==n&&(n="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,o))for(i=t[o],!i[0]||i[0]instanceof Array||(i=[i]),r=0;r<i.length;r++)if(a=i[r],e.kind()===a[0].kind()&&e.match.apply(e,a))return o;return n},e.exports?e.exports=h:t.ipaddr=h}(YS)),JS.exports;var e}();Math.floor,String.fromCharCode;new Map([[RS.CNAME,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"],[RS.Url,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"]]),new Set([RS.BASE,RS.BSC,RS.ETH,RS.Injective]),new Set([RS.BASE,RS.BSC,RS.ETH]),new Set([RS.ARWV,RS.Backpack,RS.BTC,RS.CNAME,RS.Discord,RS.DOGE,RS.Email,RS.Github,RS.IPFS,RS.IPNS,RS.LTC,RS.Pic,RS.POINT,RS.Reddit,RS.SHDW,RS.Telegram,RS.Twitter,RS.TXT,RS.Url]),new Set([RS.BASE,RS.BSC,RS.ETH,RS.Injective,RS.SOL]);new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]],["6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",[135,149,81,2,24,83,238,199,167,220,130,117,120,232,230,157,167,228,250,129,72,51,154,160,211,213,41,100,5,190,75,26]]]);var QS;!function(e){e[e.None=0]="None",e[e.Solana=1]="Solana",e[e.Ethereum=2]="Ethereum",e[e.UnverifiedSolana=3]="UnverifiedSolana"}(QS||(QS={}));const XS=e=>{switch(e){case QS.None:return 0;case QS.Ethereum:return 20;case QS.Solana:case QS.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class eE{stalenessValidation;rightOfAssociationValidation;contentLength;static LEN=8;static schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new eE(Yb(this.schema,e,!0))}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new Error("Record header account not found");return this.deserialize(n.data.slice(96,96+this.LEN))}}class tE{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=eE.deserialize(e.slice(96,96+eE.LEN));return new tE(t,e.slice(96+eE.LEN))}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new aS("Record account not found");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await fh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}getContent(){const e=XS(this.header.stalenessValidation)+XS(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){const e=XS(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=XS(this.header.stalenessValidation),t=e+XS(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}const nE=57896044618658097711785492504343953926634992332820282019728792003956564819949n,rE=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function oE(e){const t=e%nE;return t>=0n?t:nE+t}function iE(e,t){let n=e;for(;t-- >0n;)n*=n,n%=nE;return n}function aE(e,t){const n=oE(e*e),r=function(e,t){const n=oE(t*t*t),r=function(e){const t=e*e%nE*e%nE,n=iE(t,2n)*t%nE,r=iE(n,1n)*e%nE,o=iE(r,5n)*r%nE,i=iE(o,10n)*o%nE,a=iE(i,20n)*i%nE,s=iE(a,40n)*a%nE,c=iE(s,80n)*s%nE,u=iE(c,80n)*s%nE,l=iE(u,10n)*o%nE;return iE(l,2n)*e%nE}(e*oE(n*n*t));let o=oE(e*n*r);const i=oE(t*o*o),a=o,s=oE(o*rE),c=i===e,u=i===oE(-e),l=i===oE(-e*rE);return c&&(o=a),(u||l)&&(o=s),1n==(1n&oE(o))&&(o=oE(-o)),c||u?o:null}(oE(n-1n),oE(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}const sE=async(e,t,n={allowPda:!1})=>{const{address:r}=await NS(t),o=await TS.getAddress(r),i=await(async(e,t)=>{const{address:n}=await NS(t+"."+e,PS.V1);return n})(t,RS.SOL),a=await(async(e,t)=>{const{address:n}=await NS(e);return await ES(`${t}`,n,SS)})(t,RS.SOL),[s,c,u,l]=await fh(e,[r,o,i,a]);if(!s.exists)throw new hS(`Domain ${t} does not exist`);const d=wS.deserialize(s.data);if(c.exists&&TS.deserialize(c.data).tag===kS.ActiveRecord){const t=await xS(e,r);if(!t)throw new gS;return t}e:if(l.exists){const e=tE.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new pS("Record is malformed");if(e.header.rightOfAssociationValidation!==QS.Solana||e.header.stalenessValidation!==QS.Solana)throw new mS;if(d.owner!==Xb.decode(t))break e;if(((e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])))(n,r))return Xb.decode(r);throw new lS(`The RoA ID shoudl be ${Xb.decode(r)} but is ${Xb.decode(n)} `)}if(u.exists){const e=new Uint8Array([...u.data.slice(wS.HEADER_LEN,wS.HEADER_LEN+32),...Xb.encode(i)]),t=u.data.slice(wS.HEADER_LEN+32,wS.HEADER_LEN+32+64),n=await(async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=ic().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!0,["verify"])}(n),o=tS.encode((e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""))(e));return await crypto.subtle.verify({name:"Ed25519"},r,t,o)})({data:e,signature:t,address:d.owner});if(n)return Xb.decode(u.data.slice(wS.HEADER_LEN,wS.HEADER_LEN+32))}if(!function(e){const t=Xb.encode(e);if(32!==t.byteLength)return!1;return aE(function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(t),t[31])}(d.owner)){if("any"===n.allowPda)return d.owner;if(n.allowPda){const t=await dh(e,d.owner);if(!t.exists)throw new fS("Invalid domain owner account");const r=n.programIds?.some((e=>t.programAddress===e));if(r)return d.owner;throw new fS(`The program ${t.programAddress} is not allowed`)}throw new fS}return d.owner};new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked");const cE=new Error("request for lock canceled");var uE=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};class lE{constructor(e,t=cE){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((n,r)=>{const o={resolve:n,reject:r,weight:e,priority:t},i=dE(this._queue,(e=>t<=e.priority));-1===i&&e<=this._value?this._dispatchItem(o):this._queue.splice(i+1,0,o)}))}runExclusive(e){return uE(this,arguments,void 0,(function*(e,t=1,n=0){const[r,o]=yield this.acquire(t,n);try{return yield e(r)}finally{o()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const n=dE(e,(e=>t.priority<=e.priority));e.splice(n+1,0,t)}(this._weightedWaiters[e-1],{resolve:n,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const n=this._weightedWaiters[t-1];if(!n)continue;const r=n.findIndex((t=>t.priority<=e));(-1===r?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function dE(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var fE=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};class hE{constructor(e){this._semaphore=new lE(1,e)}acquire(){return fE(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class pE{#Me=new hE;#Oe=new hE;#ze=0;#Ue=null;async#je(){this.#Oe.isLocked()||(this.#Ue=await this.#Oe.acquire())}async wrapRegularStateOperation(e){await Promise.all([this.#Me.waitForUnlock(),this.#je()]);try{return this.#ze+=1,await e()}finally{this.#ze-=1,0===this.#ze&&this.#Ue&&this.#Ue()}}async wrapManageStateOperation(e){return await this.#Oe.waitForUnlock(),await this.#Me.runExclusive(e)}}function gE(e){return e.includes("swift:0/iso4217:")}var mE=function(e){return e.Benign="Benign",e.Warning="Warning",e.Malicious="Malicious",e}({}),yE=function(e){return e.SUCCESS="SUCCESS",e.ERROR="ERROR",e}({});const wE=new cw,vE=new class{#i;#Le=new Map;constructor(e){this.#i=Jl(e,"[⚡ EventEmitter]")}on(e,t){this.#i.info(`Adding listener for event ${e}`),this.#Le.has(e)||this.#Le.set(e,new Set),this.#Le.get(e)?.add(t)}off(e,t){this.#i.info(`Removing listener for event ${e}`);const n=this.#Le.get(e);n&&(n.delete(t),0===n.size&&this.#Le.delete(e))}async emitSync(e,t){this.#i.info(`Emitting event ${e}`);const n=this.#Le.get(e);if(n){const e=Array.from(n).map((async e=>await e(t)));await Promise.allSettled(e)}}removeAllListeners(e){e?(this.#i.info(`Removing all listeners for event ${e}`),this.#Le.delete(e)):(this.#i.info("Removing all listeners for all events"),this.#Le.clear())}listenerCount(e){const t=this.#Le.get(e);return t?t.size:0}eventNames(){return Array.from(this.#Le.keys())}}(Yl),AE=new class{#De=new pE;#E;constructor(e,t){this.#E=t,e.on("onStart",this.#Fe.bind(this)),e.on("onUpdate",this.#Fe.bind(this)),e.on("onInstall",this.#Fe.bind(this))}async#Fe(){await this.update((e=>(0,Pd.omit)(e,["assets"])))}async#$e(){const e=await snap.request({method:"snap_getState",params:{encrypted:this.#E.encrypted}}),t=Wy(e??{});var n,r;return n=this.#E.defaultState,r=t,{...n,...Object.fromEntries(Object.entries(r).filter((([e,t])=>null!=t&&(!t||"object"!=typeof t||Object.keys(t).length>0))))}}async get(){return this.#De.wrapRegularStateOperation((async()=>this.#$e()))}async getKey(e){return this.#De.wrapRegularStateOperation((async()=>{const t=await snap.request({method:"snap_getState",params:{key:e,encrypted:this.#E.encrypted}});if(null!==t)return Wy(t)}))}async setKey(e,t){await this.#De.wrapRegularStateOperation((async()=>{await snap.request({method:"snap_setState",params:{key:e,value:qy(t),encrypted:this.#E.encrypted}})}))}async update(e){return await this.#De.wrapManageStateOperation((async()=>{const t=await this.#$e(),n=e(t);return await snap.request({method:"snap_manageState",params:{operation:"update",newState:qy(n),encrypted:this.#E.encrypted}}),n}))}async deleteKey(e){return this.setKey(e,void 0)}async deleteKeys(e){await this.update((t=>(e.forEach((e=>{(0,Pd.unset)(t,e)})),t)))}}(vE,{encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},tokenPrices:{},subscriptions:{},webSocketConnections:{closeWebSocketConnectionsBackgroundEventId:null}}}),bE=new class{#We;prefix;logger;constructor(e,t=console,n="__cache__default"){this.#We=e,this.logger=t,this.prefix=n}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#qe(n),await this.#We.setKey(`${this.prefix}.${e}`,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}#qe(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){await this.#We.setKey(this.prefix,{})}async has(e){return void 0!==await this.get(e)}async keys(){const e=await this.#We.getKey(this.prefix);return Object.keys(e??{})}async size(){const e=await this.#We.getKey(this.prefix);return Object.keys(e??{}).length}async peek(e){const t=await this.#We.getKey(this.prefix),n=t?.[e];return n?.value}async mget(e){const t=await this.#We.getKey(this.prefix),n=Object.entries(t??{}).filter((([t])=>e.includes(t))),r=n.filter((([e,t])=>t&&t.expiresAt<Date.now()));return await this.mdelete(r.map((([e])=>e))),n.reduce(((e,[t,n])=>void 0===n?(this.logger.info(`[StateCache] ❌ Cache miss for key "${t}"`),e):(n.expiresAt<Date.now()?(this.logger.info(`[StateCache] ⌛ Cache expired for key "${t}"`),e[t]=void 0):(this.logger.info(`[StateCache] 🎉 Cache hit for key "${t}"`),e[t]=n.value),e)),{})}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#qe(e)})),await this.#We.update((t=>{const n=t[this.prefix]??{};return e.forEach((({key:e,value:t,ttlMilliseconds:r})=>{void 0!==t&&(n[e]={value:t,expiresAt:Math.min(Date.now()+(r??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})})),t[this.prefix]=n,t}));else{ti(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){const t={};return await this.#We.update((n=>{const r=n[this.prefix]??{};return e.forEach((e=>{void 0===r[e]?t[e]=!1:(delete r[e],t[e]=!0)})),n[this.prefix]=r,n})),t}}(AE,Yl),SE=new class{#N=new Map;logger;constructor(e){this.logger=Jl(e,"[💾 InMemoryCache]")}#qe(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}#Be(e){return e.expiresAt<Date.now()}async#Ve(){const e=[];for(const[t,n]of this.#N.entries())this.#Be(n)&&e.push(t);await this.mdelete(e)}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#qe(n),this.#N.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){this.#N.clear()}async has(e){const t=this.#N.get(e);return!!t&&(!this.#Be(t)||(this.#N.delete(e),!1))}async keys(){return await this.#Ve(),Array.from(this.#N.keys())}async size(){return await this.#Ve(),this.#N.size}async peek(e){const t=this.#N.get(e);if(t){if(!this.#Be(t))return t.value;this.#N.delete(e)}}async mget(e){await this.#Ve();const t={};for(const n of e){const e=this.#N.get(n);e?(this.logger.info(`🎉 Cache hit for key "${n}"`),t[n]=e.value):(this.logger.info(`❌ Cache miss for key "${n}"`),t[n]=void 0)}return t}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#qe(e)})),e.forEach((({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#N.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}));else{ti(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){return Object.fromEntries(e.map((e=>[e,this.#N.delete(e)])))}}(Zl),EE=new class{#i;constructor(e=Yl){this.#i=Jl(e,"[📣 AnalyticsService]")}async#Ke(e,t){try{this.#i.log(`Tracking event ${e}`),await snap.request({method:"snap_trackEvent",params:{event:{event:e,properties:t}}})}catch(n){this.#i.warn("Error tracking event",{error:n,event:e,properties:t})}}async trackEventTransactionAdded(e,t){await this.#Ke("Transaction Added",{message:"Snap transaction added",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventTransactionApproved(e,t){await this.#Ke("Transaction Approved",{message:"Snap transaction approved",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventTransactionSubmitted(e,t,n){await this.#Ke("Transaction Submitted",{message:"Snap transaction submitted",origin:n.origin,account_type:e.type,chain_id_caip:n.scope})}async trackEventTransactionFinalized(e,t,n){await this.#Ke("Transaction Finalized",{message:"Snap transaction finalized",origin:n.origin,account_type:e.type,chain_id_caip:t.chain,transaction_status:t.status,transaction_type:t.type})}async trackEventTransactionRejected(e,t){await this.#Ke("Transaction Rejected",{message:"Snap transaction rejected",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventSecurityAlertDetected(e,t,n,r,o,i){await this.#Ke("Security Alert Detected",{message:"Snap security alert detected",origin:t,account_type:e.type,chain_id_caip:n,security_alert_response:r,security_alert_reason:o,security_alert_description:i})}async trackEventSecurityScanCompleted(e,t,n,r,o){await this.#Ke("Security Scan Completed",{message:"Snap security scan completed",origin:t,account_type:e.type,chain_id_caip:n,scan_status:r,has_security_alerts:o})}async trackEventWebSocketConnectionClosedNotCleanly(e,t,n){await this.#Ke("WebSocket Connection Closed Not Cleanly",{message:"Snap WebSocket connection closed not cleanly",origin:e,code:t,reason:n})}}(Yl),kE=new class{#_;#N;#Ge={fetchMint:ew.Minute,fetchJsonParsedAccount:ew.Minute};#He=new Map;constructor(e,t){this.#_=e,this.#N=t}#Ze(e){const t=this.#_.getNetworkBy("caip2Id",e),n=Ib(jb(t.rpcUrls));return this.#He.set(e,n),n}getRpc(e){return j(e,vd),this.#He.get(e)??this.#Ze(e)}async fetchJsonParsedAccount(e,t,n){const r=Xl((async(e,t,n)=>async function(e,t,n={}){const{abortSignal:r,...o}=n,{value:i}=await e.getAccountInfo(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r});return i&&"object"==typeof i&&"parsed"in i.data?uh(t,i):ch(t,i)}(this.getRpc(t),oc(e),n)),this.#N,{ttlMilliseconds:this.#Ge.fetchJsonParsedAccount,functionName:"SolanaConnection::fetchJsonParsedAccount"});return r(e,t,n)}async fetchMint(e,t,n){return Xl((async(r,o,i)=>_h(this.getRpc(t),oc(e),n)),this.#N,{ttlMilliseconds:this.#Ge.fetchMint,functionName:"SolanaConnection::fetchMint"})(oc(e),t,n)}async getLatestBlockhash(e){return(await this.getRpc(e).getLatestBlockhash().send()).value}}(wE,SE),TE=new class{#_;constructor(e){this.#_=e}async getAll(){return(await snap.request({method:"snap_getWebSockets"})).map((e=>({...e,network:this.#Je(e.url)})))}async getById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByNetwork(e){return(await this.getAll()).find((t=>t.network===e))??null}async save(e){const{url:t,protocols:n}=e,r=await snap.request({method:"snap_openWebSocket",params:{url:t,...n?{protocols:n}:{}}});return{...e,id:r}}async delete(e){await snap.request({method:"snap_closeWebSocket",params:{id:e}})}#Je(e){const t=this.#_.getNetworkBy("webSocketUrl",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(wE),IE=new class{#Ye;#Qe;#_;#We;#ge;#i;#Xe;#et;#tt=new Map;#nt=new Map;#rt;#ot="webSocketConnections";constructor(e,t,n,r,o,i){const{maxReconnectAttempts:a,reconnectDelayMilliseconds:s,closeConnectionsGracePeriodMilliseconds:c}=n.get().subscriptions;this.#Ye=e,this.#Qe=t,this.#_=n,this.#We=r,this.#ge=o,this.#i=Jl(i,"[🔌 WebSocketConnectionService]"),this.#Xe=a,this.#et=s,this.#rt=c,this.#te()}#te(){const e=this.#it.bind(this),t=this.#at.bind(this),n=this.#ye.bind(this),r=this.#st.bind(this),o=this.#we.bind(this);this.#ge.on("onStart",e),this.#ge.on("onUpdate",e),this.#ge.on("onInstall",e),this.#ge.on("onActive",t),this.#ge.on("onInactive",n),this.#ge.on("onWebSocketEvent",o),this.#ge.on("onListWebSockets",r)}async#it(){this.#i.log("Setting up connections");const{active:e}=await Xy();e?await this.#ct():await this.closeAllConnections()}async#ct(){this.#i.log("Opening connections for active networks");const e=await this.#_.getActiveNetworks();this.#nt.clear(),await Promise.allSettled(e.map((async e=>{await this.openConnection(e)})))}async openConnection(e){this.#i.log(`Opening connection for network ${e}`);const t=this.#_.getNetworkBy("caip2Id",e),{webSocketUrl:n}=t;await this.#Ye.findByNetwork(e)?this.#i.log(`✅ Connection for network ${e} already exists`):await this.#Ye.save({network:e,url:n,protocols:[]})}async closeAllConnections(){this.#i.log("Closing all connections");const e=await this.#Ye.getAll();await Promise.allSettled(e.map(this.#ut.bind(this))),await this.#We.setKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`,null)}async#ut(e){this.#i.log(`Closing connection for network ${e.network}`),await this.#Ye.delete(e.id)}onConnectionRecovery(e,t){const n=this.#tt.get(e)??[];this.#tt.set(e,[...n,t])}async findByNetwork(e){return await this.#Ye.findByNetwork(e)??null}async findById(e){return this.#Ye.getById(e)}async#we(e){if("open"!==e.type&&"close"!==e.type)return;const{id:t,type:n}=e;switch(this.#i.log(`Handling connection event "${n}" for ${t}`,e),n){case"open":await this.#lt(e);break;case"close":await this.#dt(e);break;default:this.#i.warn(`Unknown connection event type: ${n}`)}}async#lt(e){const{id:t}=e,n=await this.#Ye.getById(t);if(!n)return void this.#i.warn(`No connection found with id: ${t}`);this.#i.log(`✅ Connected to ${t}`,e);const{network:r}=n;this.#nt.delete(r);const o=this.#tt.get(r)??[];this.#i.log(`Triggering ${o.length} connection recovery handlers`,r);const i=o.map((async e=>{try{await e(r)}catch(e){this.#i.error("Error in connection recovery handler",e)}}))??[];await Promise.allSettled(i)}async#dt(e){const{wasClean:t,origin:n,code:r,reason:o}=e;if(t)return void this.#i.log("✅ Connection closed cleanly",e);const{networks:i}=this.#_.get(),a=i.find((e=>e.webSocketUrl.startsWith(n)));a?(await this.#Qe.trackEventWebSocketConnectionClosedNotCleanly(n,r,o),await this.#ft(a.caip2Id)):this.#i.warn("No network found for origin",n)}async#ft(e){const t=this.#nt.get(e)??0,n=t+1;if(this.#nt.set(e,n),n>this.#Xe)return void this.#i.error(`❌ Failed to reconnect to ${e} after ${this.#Xe}/${this.#Xe} attempts. Giving up.`);const r=this.#et*Math.pow(2,t);this.#i.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#Xe})`),await new Promise((t=>{setTimeout((()=>{this.openConnection(e).catch((t=>{this.#i.info(`Error opening connection for ${e}`,t)})).finally((()=>t()))}),r)}))}async#st(){const e=await this.#Ye.getAll();this.#i.log("All connections",{connections:e,connectionRecoveryHandlers:this.#tt})}async#at(){this.#i.log("Client became active"),await this.#ht(),await this.#ct()}async#ye(){this.#i.log("Client became inactive"),await this.#ht();const e=Math.floor(this.#rt/1e3),t=await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:`PT${e}S`,request:{method:"closeWebSocketConnections"}}});await this.#We.setKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`,t),this.#i.log(`Scheduled background event to close connections after ${e}s`,t)}async#ht(){try{const e=await this.#We.getKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`);if(!e)return;await snap.request({method:"snap_cancelBackgroundEvent",params:{id:e}}),this.#i.log("🫸 Cancelled background event to close connections",e)}catch(e){this.#i.warn("Failed to cancel background event",e)}finally{await this.#We.setKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`,null)}}}(TE,EE,wE,AE,vE,Yl),xE=new class{#We;#ot="subscriptions";constructor(e){this.#We=e}async getAll(){const e=await this.#We.getKey(`${this.#ot}`);return Object.values(e??{})}async getById(e){return await this.#We.getKey(`${this.#ot}.${e}`)}async save(e){await this.#We.setKey(`${this.#ot}.${e.id}`,e)}async delete(e){await this.#We.deleteKey(`${this.#ot}.${e}`)}async deleteMany(e){const t=e.map((e=>`${this.#ot}.${e}`));await this.#We.deleteKeys(t)}async update(e){await this.#We.setKey(`${this.#ot}.${e.id}`,e)}async findBy(e,t){const n=await this.getAll();if(0!==n.length)return n.find((n=>e in n&&n[e]===t))}async clear(){await this.#We.deleteKey(`${this.#ot}`)}}(AE),_E=new Nv(IE,xE,vE,Yl),CE=new class{#x;constructor(e){this.#x=e}async uiAmountToAmountForMint(e,t,n){const r=await this.#x.fetchMint(e,t);return this.#pt(r,n)}async amountToUiAmountForMint(e,t,n){const r=await this.#x.fetchMint(e,t);return this.#gt(r,n)}#pt(e,t){try{const o=(n=e.data?.extensions,lf(n)?n.value:r?r():null),{decimals:i}=e.data??{},a=o?.find((e=>"InterestBearingConfig"===e.__kind)),s=o?.find((e=>"ScaledUiAmountConfig"===e.__kind));if(!a&&!s)return uu(BigInt(jo(t).multipliedBy(10**i).toFixed(0)));const c=Date.now()/1e3;if(a){return uu(Rg(t,i,Number(c),Number(a.lastUpdateTimestamp),Number(a.initializationTimestamp),a.preUpdateAverageRate,a.currentRate))}if(s){let{multiplier:e}=s;c>=s.newMultiplierEffectiveTimestamp&&(e=s.newMultiplier);return uu(Pg(t,i,e))}throw new Error("Unknown mint extension type")}catch(n){const r=e?.data?.decimals??9;return uu(BigInt(jo(t).multipliedBy(10**r).toFixed(0)))}var n,r}#gt(e,t){try{const n=1000000000n,r=jo(this.#pt(e,n.toString()).toString()).dividedBy(n.toString());return jo(t.toString()).dividedBy(r).toString()}catch(n){const r=e.data?.decimals??9;return jo(t.toString()).dividedBy(10**r).toString()}}}(kE),RE=new _v(kE,Yl),PE=new class{#x;#i;#V=450;#K=10000n;constructor(e,t){this.#x=e,this.#i=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:o}=e,i=oc(t.address),a=BigInt(vm(r).toString()),s=await this.#x.getLatestBlockhash(o),c=lu(Du({version:0}),(e=>Gu(i,e)),(e=>fu(s,e)),(e=>Hu(function(e,t){const n=t?.programAddress??_l,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},o={...e},i=Nl(n);return{accounts:[i(r.source),i(r.destination)],programAddress:n,data:Wl().encode(o)}}({amount:a,destination:n,source:yl(i)}),e)));return Ju([ef({units:this.#V}),of({microLamports:this.#K})],c)}catch(e){throw this.#i.error({error:e},"Error building transaction message"),e}}getComputeUnitLimit(){return this.#V}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#K}}(kE,Yl),NE=new class{#x;#i;constructor(e,t){this.#x=e,this.#i=Jl(t,"[👀 RecipientClassifier]")}async classify(e,t){this.#i.info("Classifying recipient",{recipientAddress:e,network:t});const n=await this.#x.fetchJsonParsedAccount(e,t);try{hh(n)}catch(e){return{type:"SYSTEM"}}const{programAddress:r}=n;if(r===_l)return{type:"SYSTEM"};const o=(0,Pd.get)(n,"data.mint"),i=(0,Pd.get)(n,"data.owner");return(r===Sf||r===Nh)&&o&&i?{type:"TOKEN_ACCOUNT",mint:o}:{type:"UNSUPPORTED"}}}(kE,Yl),BE=new xv(CE,NE,kE,Yl),ME=new class{#o;#i;#a;#s;#N;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=Yl){const{baseUrl:o,chunkSize:i,cacheTtlsMilliseconds:a}=e.get().priceApi;j(o,fd),this.#o=n,this.#i=r,this.#a=o,this.#s=i,this.cacheTtlsMilliseconds=a,this.#N=t}async getFiatExchangeRates(){return Xl(this.#mt.bind(this),this.#N,{functionName:"PriceApiClient:getFiatExchangeRates",ttlMilliseconds:this.cacheTtlsMilliseconds.fiatExchangeRates})()}async#mt(){try{const e=await this.#o(`${this.#a}/v1/exchange-rates/fiat`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){throw this.#i.error(e,"Error fetching fiat exchange rates"),e}}async#yt(e,t="usd"){try{if(j(e,W(Jo)),j(t,Od),0===e.length)return{};const n=[...new Set(e)],r=[];for(let e=0;e<n.length;e+=this.#s)r.push(n.slice(e,e+this.#s));const o=await Promise.all(r.map((async e=>{const n=Rd({baseUrl:this.#a,path:"/v3/spot-prices",queryParams:{vsCurrency:t,assetIds:e.join(","),includeMarketData:"true"}}),r=await this.#o(n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return j(o,Md),o}))),i=o.reduce(((e,t)=>({...e,...t})),{});return await this.#N.mset(e.map((e=>({key:`PriceApiClient:getMultipleSpotPrices:${e}:${t}`,value:i[e],ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),i}catch(e){throw this.#i.error(e,"Error fetching spot prices"),e}}async#wt(e,t="usd"){const n=[...new Set(e)],r="PriceApiClient:getMultipleSpotPrices",o=e=>`${r}:${e}:${t}`,i=await this.#N.mget(n.map(o)),a=(0,Pd.mapKeys)(i,((e,t)=>(e=>{const t=new RegExp(`^${r}:(.+):(.+)$`,"u"),n=e.match(t);if(!n)throw new Error("Invalid cache key");return n})(t)[1])),s=n.filter((e=>void 0===a[e]));if(0===s.length)return a;const c=await this.#yt(s,t);return await this.#N.mset(Object.entries(c).map((([e,t])=>({key:o(e),value:t,ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),{...a,...c}}async getMultipleSpotPrices(e,t="usd"){return this.#wt(e,t)}async#vt(e){j(e,zd);const t=Rd({baseUrl:this.#a,path:"/v3/historical-prices/{assetType}",pathParams:{assetType:e.assetType},encodePathParams:!1,queryParams:{...e.timePeriod&&{timePeriod:e.timePeriod},...e.from&&{from:e.from.toString()},...e.to&&{to:e.to.toString()},...e.vsCurrency&&{vsCurrency:e.vsCurrency}}}),n=await this.#o(t),r=await n.json();return j(r,Ud),r}async getHistoricalPrices(e){return Xl(this.#vt.bind(this),this.#N,{functionName:"PriceApiClient:getHistoricalPrices",ttlMilliseconds:this.cacheTtlsMilliseconds.historicalPrices})(e)}}(wE,SE),OE=new Vd(wE),zE=new class{#o;#i;#a;#N;#Ge;constructor(e,t,n=globalThis.fetch,r=Yl){const{baseUrl:o,cacheTtlsMilliseconds:i}=e.get().nftApi;j(o,fd),this.#o=n,this.#i=r,this.#a=o,this.#Ge=i,this.#N=t}#At(e){return{cursor:e.cursor,error:e.error,items:e.items.map((e=>({chain:e.chain,address:e.address,tokenAddress:e.token_address,tokenId:e.token_id,balance:e.balance,acquiredAt:e.acquired_at,isSpam:e.isSpam,nftToken:this.#bt(e.nft_token)})))}}async#St(e){let t,n=[];do{const r=Rd({baseUrl:this.#a,path:`/users/${e}/solana-tokens`,queryParams:t?{cursor:t}:void 0}),o=await this.#o(r,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),i=await o.json(),a=this.#At(i);n=[...n,...a.items],t=a.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return Xl(this.#St.bind(this),this.#N,{functionName:"NftApiClient:listAddressSolanaNfts",ttlMilliseconds:this.#Ge.listAddressSolanaNfts})(e)}#bt(e){return{address:e.address,tokenId:e.token_id,tokenStandard:e.token_standard,name:e.name,description:e.description,metadata:e.metadata,imageUrl:e.image_url,mediaUrl:e.media_url,externalUrl:e.external_url,attributes:e.attributes.map((e=>({key:e.key,value:e.value}))),tokenAccountAddress:e.token_account_address,creators:e.creators.map((e=>({address:e.address,share:e.share,verified:e.verified}))),collectionName:e.collection_name,collectionSymbol:e.collection_symbol,collectionCount:e.collection_count,collectionImageUrl:e.collection_image_url,onchainCollectionAddress:e.onchain_collection_address,floorPrice:e.floor_price?{asset:{type:e.floor_price.asset.type,name:e.floor_price.asset.name,symbol:e.floor_price.asset.symbol,decimals:e.floor_price.asset.decimals,tokenId:e.floor_price.asset.token_id},amount:{rawAmount:e.floor_price.amount.raw_amount,amount:e.floor_price.amount.amount}}:null,lastSalePrice:e.last_sale_price?{asset:{type:e.last_sale_price.asset.type,name:e.last_sale_price.asset.name,symbol:e.last_sale_price.asset.symbol,decimals:e.last_sale_price.asset.decimals,tokenId:e.last_sale_price.asset.token_id},amount:{rawAmount:e.last_sale_price.amount.raw_amount,amount:e.last_sale_price.amount.amount}}:null,rarity:e.rarity?{ranking:{source:e.rarity.ranking.source,value:e.rarity.ranking.value},metadata:{howrare:{rank:e.rarity.metadata.howrare.rank},moonrank:{rank:e.rarity.metadata.moonrank.rank}}}:null}}async#Et(e){try{const t=Rd({baseUrl:this.#a,path:`/nfts/contracts/solana/${e}/1`}),n=await this.#o(t,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),r=await n.json();return this.#bt(r)}catch(e){return null}}async getNftMetadata(e){return Xl(this.#Et.bind(this),this.#N,{functionName:"NftApiClient:getNftMetadata",ttlMilliseconds:this.#Ge.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map((async e=>this.getNftMetadata(e))))}}(wE,SE),UE=new class{#kt;#i;cacheTtlsMilliseconds;constructor({configProvider:e,priceApiClient:t,logger:n}){this.#kt=t,this.#i=n;const{cacheTtlsMilliseconds:r}=e.get().priceApi;this.cacheTtlsMilliseconds=r}#Tt(e){if(!gE(e))throw new Error("Passed caipAssetType is not a fiat asset");return Qo(e).assetReference.toLowerCase()}async#It(e){const t=e.filter((e=>!gE(e))),[n,r]=await Promise.all([this.#kt.getFiatExchangeRates(),this.#kt.getMultipleSpotPrices(t,"usd")]);return{fiatExchangeRates:n,cryptoPrices:r}}async getMultipleTokenConversions(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.from,e.to])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#It(t),o={};return e.forEach((e=>{const{from:t,to:i}=e;let a,s;if(o[t]||(o[t]={}),gE(t)){const e=n[this.#Tt(t)]?.value;if(!e)return void(o[t][i]=null);a=new jo(1).dividedBy(e)}else a=new jo(r[t]?.price??0);if(gE(i)){const e=n[this.#Tt(i)]?.value;if(!e)return void(o[t][i]=null);s=new jo(1).dividedBy(e)}else s=new jo(r[i]?.price??0);if(a.isZero()||s.isZero())return void(o[t][i]=null);const c=a.dividedBy(s).toString(),u=Date.now();o[t][i]={rate:c,conversionTime:u,expirationTime:u+this.cacheTtlsMilliseconds.historicalPrices}})),o}#xt(e,t){const n=(0,Pd.pick)(e,["marketCap","totalVolume","circulatingSupply","allTimeHigh","allTimeLow","pricePercentChange1h","pricePercentChange1d","pricePercentChange7d","pricePercentChange14d","pricePercentChange30d","pricePercentChange200d","pricePercentChange1y"]),r=e=>null==e?"":new jo(e).dividedBy(t).toString(),o=(e,t)=>null==t?{}:{[e]:t},i={...o("PT1H",n.pricePercentChange1h),...o("P1D",n.pricePercentChange1d),...o("P7D",n.pricePercentChange7d),...o("P14D",n.pricePercentChange14d),...o("P30D",n.pricePercentChange30d),...o("P200D",n.pricePercentChange200d),...o("P1Y",n.pricePercentChange1y)};return{fungible:!0,marketCap:r(n.marketCap),totalVolume:r(n.totalVolume),circulatingSupply:(n.circulatingSupply??0).toString(),allTimeHigh:r(n.allTimeHigh),allTimeLow:r(n.allTimeLow),...Object.keys(i).length>0?{pricePercentChange:i}:{}}}async getMultipleTokensMarketData(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.asset,e.unit])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#It(t),o={};return e.forEach((e=>{const{asset:t,unit:i}=e;if(!r[t])return;let a;if(gE(i)){const e=n[this.#Tt(i)]?.value;if(!e)return;a=new jo(1).dividedBy(e)}else a=new jo(r[i]?.price??0);a.isZero()||(o[t]||(o[t]={}),o[t][i]=this.#xt(r[t],a))})),o}async getHistoricalPrice(e,t){j(e,mt),j(t,mt);const n=Qo(t).assetReference.toLowerCase();j(n,Od);const r=["1d","7d","1m","3m","1y","1000y"].map((async r=>this.#kt.getHistoricalPrices({assetType:e,timePeriod:r,vsCurrency:n}).then((e=>({timePeriod:r,response:e}))).catch((n=>(this.#i.warn(`Error fetching historical prices for ${e} to ${t} with time period ${r}. Returning null object.`,n),{timePeriod:r,response:jd}))))),o=(await Promise.all(r)).reduce(((e,{timePeriod:t,response:n})=>(e[`P${t.toUpperCase()}`]=n.prices.map((e=>[e[0],e[1].toString()])),e)),{}),i=Date.now();return{intervals:o,updateTime:i,expirationTime:i+this.cacheTtlsMilliseconds.historicalPrices}}}({configProvider:wE,priceApiClient:ME,logger:Yl}),jE=new class{#x;#i;tld=".sol";constructor(e,t){this.#x=e,this.#i=t}async resolveDomain(e,t){const n=this.#x.getRpc(e);return sE(n,t)}async resolveAddress(e,t){try{const n=this.#x.getRpc(e);return`${(await(async(e,t)=>{const n=await _S.getAddress("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29",t),r=await _S.retrieve(e,n),[o,i]=await Promise.all([wS.retrieve(e,r.nameAccount),xS(e,r.nameAccount)]),a=i||o.owner,s=o.parentName!==vS,c=[CS(e,r.nameAccount,s?o.parentName:void 0)];s&&c.push(CS(e,o.parentName));const u=(await Promise.all(c)).join(".");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})(n,oc(t))).domainName}.sol`}catch(e){return this.#i.error("Error resolving address",e),null}}}(kE,Yl),LE=new class{#We;constructor(e){this.#We=e}async findByKeyringAccountId(e){return await this.#We.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#We.getKey("assetEntities")??{};return Object.values(e).flat()}async saveMany(e){await this.#We.update((t=>{const n=(0,Pd.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,Pd.cloneDeep)(n.assetEntities[e]??[]),o=r.findIndex((e=>e.assetType===t.assetType&&e.keyringAccountId===t.keyringAccountId));-1===o?r.push(t):r[o]=t,n.assetEntities[e]=r}return n}))}}(AE),DE=new Av({connection:kE,logger:Yl,configProvider:wE,assetsRepository:LE,tokenApiClient:OE,cache:SE,tokenPricesService:UE,nftApiClient:zE}),FE=new class{#We;constructor(e){this.#We=e}async getAll(){const e=await this.#We.getKey("keyringAccounts");return Object.values(e??{})}async findById(e){return await this.#We.getKey(`keyringAccounts.${e}`)??null}async findByAddress(e){return(await this.getAll()).find((t=>t.address===e))??null}async save(e){await this.#We.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#We.deleteKey(`keyringAccounts.${e}`)}}(AE),$E=new class{#_t;constructor(e){this.#_t=e}async getAll(){return this.#_t.getAll()}async getAllSelected(){const[e,t]=await Promise.all([this.#_t.getAll(),Un(snap)]);return e.filter((e=>t.includes(e.id)))}async findById(e){return this.#_t.findById(e)}async findByAddress(e){return this.#_t.findByAddress(e)}async save(e){return this.#_t.save(e)}async delete(e){return this.#_t.delete(e)}}(FE),WE=new class{#We;#ot="transactions";constructor(e){this.#We=e}async getAll(){const e=await this.#We.getKey(this.#ot);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#We.getKey(`${this.#ot}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#We.update((t=>{const n=t[this.#ot];return e.forEach((e=>{const r=e.id,o=e.account,i=n[o]??[],a=i.findIndex((e=>e.id===r));-1!==a&&(i[a]=e);const s=(0,Pd.chain)([...i,e]).uniqBy("id").sortBy((e=>-(e.timestamp??0))).value();t[this.#ot][o]=s})),t}))}}(AE),qE=new class{#W;#Y;#i;constructor(e,t,n){this.#W=e,this.#Y=t,this.#i=n}async mapRpcTransaction(e,t,n,r){try{const{blockTime:o}=e,{id:i,address:a}=t,s=e.transaction.signatures[0];if(!s)throw new Error("Transaction ID is required");const c=Number(o),u=this.#Ct(e);let l=[],d=[],f=[];const h=(u===jt.Failed?this.#Rt.bind(this):this.#Pt.bind(this))({scope:n,transactionData:e});l=h.fees,d=h.from,f=h.to;const{from:p,to:g}=await this.#Nt({scope:n,transactionData:e});let m=[...p,...d],y=[...g,...f];const w=this.#Bt({address:oc(a),status:u,from:m,to:y});w===Lt.Swap&&(m=m.filter((e=>e.address===a)),y=y.filter((e=>e.address===a))),w===Lt.Receive&&(y=y.filter((e=>e.address===a)),l=[]);const v=[...new Set([...m,...y].filter((e=>e.asset?.fungible)).map((e=>e.asset.type)))],A=r??await this.#Y.getAssetsMetadata(v);return m.forEach((e=>{e.asset?.fungible&&A[e.asset.type]&&(e.asset.unit=A[e.asset.type]?.symbol??"UNKNOWN")})),y.forEach((e=>{e.asset?.fungible&&A[e.asset.type]&&(e.asset.unit=A[e.asset.type]?.symbol??"UNKNOWN")})),{id:s,account:i,timestamp:c,chain:n,status:u,type:w,from:m,to:y,fees:l,events:[{status:u,timestamp:c}]}}catch(e){return this.#i.warn(e,"Error mapping transaction"),null}}#Ct(e){return e.meta?.err||e.meta?.status&&"Err"in e.meta.status?jt.Failed:jt.Confirmed}#Bt({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===jt.Failed)return Lt.Unknown;const o=n.filter((t=>t.address===e)),i=r.filter((t=>t.address===e)),a=o.length>0,s=i.length>0,c=n.every((t=>r.some((n=>n.address===e&&!0===t.asset?.fungible&&!0===n.asset?.fungible&&t.asset.type===n.asset.type)))),u=r.every((t=>n.some((n=>n.address===e&&!0===n.asset?.fungible&&!0===t.asset?.fungible&&n.asset.type===t.asset.type))));return c&&u?Lt.Send:a&&s?Lt.Swap:a?Lt.Send:Lt.Receive}#Pt({scope:e,transactionData:t}){const n=this.#Mt({scope:e,transactionData:t}),r=[],o=[],i=new Map(t.meta?.preBalances?.map(((e,t)=>[t,new jo(e.toString())]))??[]),a=new Map(t.meta?.postBalances?.map(((e,t)=>[t,new jo(e.toString())]))??[]),s=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],c=new Set([...Array.from(i.keys()),...Array.from(a.keys())]);for(const n of c){const c=s[n]?.toString();if(!c)continue;const u=i.get(n)??new jo(0),l=a.get(n)??new jo(0),d=0===n?wm(t.meta?.fee??0):new jo(0),f=u.minus(l).dividedBy(new jo(td)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();u.isGreaterThan(l)&&r.push({address:c,asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:h}}),u.isLessThan(l)&&o.push({address:c,asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:h}})}const u=this.#Ot({scope:e,transactionData:t});return u.from.length>0&&r.push(...u.from),u.to.length>0&&o.push(...u.to),{fees:n,from:r,to:o}}#Rt({scope:e,transactionData:t}){const n=this.#Mt({scope:e,transactionData:t}),r=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],o=[],i=[],{instructions:a}=t.transaction.message;a.forEach((t=>{const{accounts:n,data:a,programIdIndex:s}=t;if(r[s]!==_l)return;const[c,u]=n;if(void 0===c||void 0===u)return;const l=r[c],d=r[u];if(!l||!d)return;const f=Dd.decode(a);if(2!==this.#zt(f))return;const h=this.#Ut(f);o.push({address:l,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}}),i.push({address:d,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}})}));return{fees:n,from:this.#jt(o),to:this.#jt(i)}}#Ot({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===_l));return-1===i||n.forEach((n=>{const{accounts:a,data:s,programIdIndex:c}=n;if(c!==i)return;const[u,l]=a;if(void 0===u||void 0===l||u!==l)return;const d=t.transaction.message.accountKeys[u],f=t.transaction.message.accountKeys[l];if(!d||!f||d!==f)return;const h=this.#Ut(Dd.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}}),o.push({address:f,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}})})),{from:r,to:o}}async#Nt({scope:e,transactionData:t}){const n=[],r=[],o=new Map(t.meta?.preTokenBalances?.map((e=>[e.accountIndex,new jo(e.uiTokenAmount.amount)]))??[]),i=new Map(t.meta?.postTokenBalances?.map((e=>[e.accountIndex,new jo(e.uiTokenAmount.amount)]))??[]),a=new Set([...t.meta?.preTokenBalances?.map((e=>e.accountIndex))??[],...t.meta?.postTokenBalances?.map((e=>e.accountIndex))??[]]);for(const s of a){const a=o.get(s)??new jo(0),c=(i.get(s)??new jo(0)).minus(a);if(c.isZero())continue;const u=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??t.meta?.postTokenBalances?.find((e=>e.accountIndex===s));if(!u)continue;const{mint:l,owner:d}=u;if(!d)continue;const f=vv(e,l),h=c.absoluteValue().toString(),p=(await this.#W.amountToUiAmountForMint(l,e,uu(BigInt(h)))).toString();c.isNegative()&&n.push({address:d,asset:{fungible:!0,type:f,unit:"",amount:p}}),c.isPositive()&&r.push({address:d,asset:{fungible:!0,type:f,unit:"",amount:p}})}const s=this.#Lt({scope:e,transactionData:t});return s.from.length>0&&n.push(...s.from),s.to.length>0&&r.push(...s.to),{from:n,to:r}}#Lt({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[];return n.map((e=>tm(e,t))).map(em).filter(this.#Dt.bind(this)).forEach((n=>{const i=(0,Pd.get)(n,"parsed.accounts.authority.address"),a=(0,Pd.get)(n,"parsed.accounts.source.address");if(!i||!a)return;const s=t.transaction.message.accountKeys.indexOf(oc(a)),{mint:c,uiTokenAmount:{decimals:u}={}}=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??{};if(!c||void 0===u)return;const l=n.parsed?.data.amount,d=jo(l).dividedBy(new jo(10).pow(u)).toString(),f=vv(e,c);r.push({address:i,asset:{amount:d,fungible:!0,type:f,unit:""}}),o.push({address:i,asset:{amount:d,fungible:!0,type:f,unit:""}})})),{from:r,to:o}}#Mt({scope:e,transactionData:t}){const n=this.#Ft(t),r=this.#$t(t),o=n.minus(r),i=[{type:"base",asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:r.toString()}}];return o?.isGreaterThan(0)&&i.push({type:"priority",asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:o.toString()}}),i}#Ft(e){return new jo(e.meta?.fee?.toString()??"0").dividedBy(td)}#$t(e){const t=e.transaction.signatures.length;return jo(5e3).dividedBy(td).multipliedBy(t)}#jt(e){return e.reduce(((e,t)=>{const n=e.find((e=>!0===e?.asset?.fungible&&!0===t.asset?.fungible&&e.asset.type===t.asset.type&&e.address===t.address));if(n&&!0===n.asset?.fungible&&!0===t.asset?.fungible){const e=new jo(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e}),[])}#zt(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}#Ut(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return jo(t.toString()).dividedBy(td)}#Dt(e){if("Transfer"!==e.type&&"TransferChecked"!==e.type)return!1;if(!e.parsed)return!1;const{source:t,destination:n,authority:r}=e.parsed.accounts??{};return!!(t&&n&&r)&&t.address===n.address}}(CE,DE,Yl),VE=new class{#Wt;#qt;#Vt;#Y;#x;#i;constructor(e,t,n,r,o,i){this.#Wt=e,this.#qt=t,this.#Vt=n,this.#Y=r,this.#x=o,this.#i=Jl(i,"[💱 TransactionsService]")}async fetchBySignature(e,t,n){const r=await this.#x.getRpc(n).getTransaction(Ec(e),{maxSupportedTransactionVersion:0}).send();return r?this.#qt.mapRpcTransaction(r,t,n):null}async fetchAssetsTransactions(e,t){const n=await this.#Vt.getAll(),r=e.map((e=>e.assetType)),o=await this.#Y.getAssetsMetadata(r),i=await this.#Wt.getAll(),a=(await Promise.all(e.map((async e=>{const{network:t}=e,n="pubkey"in e?e.pubkey:e.address,r=await(async e=>{const{network:t}=e,n="mint"in e?e.mint:e.address,r=i.sort(((e,t)=>(t.timestamp??0)-(e.timestamp??0))).find((e=>e.from.some((e=>vv(t,n)===(0,Pd.get)(e,"asset.type")))||e.to.some((e=>vv(t,n)===(0,Pd.get)(e,"asset.type")))));return r||null})(e),o=r?Ec(r?.id):void 0;return(await this.#x.getRpc(t).getSignaturesForAddress(oc(n),{limit:5,...o?{until:o}:{}}).send()).map((t=>({signatureResponse:{signature:t.signature,blockTime:Number(t.blockTime??0)},asset:e})))})))).flat(),s=t?.limit?a.sort(((e,t)=>(t.signatureResponse.blockTime??0)-(e.signatureResponse.blockTime??0))).slice(0,t.limit):a,c=(await Promise.all(s.map((async e=>{try{const{signatureResponse:t,asset:n}=e;return{transaction:await this.#x.getRpc(n.network).getTransaction(Ec(t.signature),{maxSupportedTransactionVersion:0}).send(),asset:n}}catch(e){return null}})))).filter((e=>null!==e)),u=e=>n.find((t=>t.id===e));return(await Promise.all(c.map((async e=>{const{transaction:t,asset:n}=e;if(!t)return null;const r=u(n.keyringAccountId);return r?this.#qt.mapRpcTransaction(t,r,n.network,o):null})))).filter((e=>null!==e)).filter((e=>{const t=u(e.account);return!!t&&!Rv(e,t)}))}async fetchLatestSignatures(e,t,n){return(await this.#x.getRpc(e).getSignaturesForAddress(t,n).send()).map((({signature:e})=>e))}async findByAccounts(e){return(await Promise.all(e.map((async e=>this.#Wt.findByAccountId(e.id))))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#Wt.saveMany(e);const t=(0,Pd.groupBy)(e,"account");await zn(snap,Pn.AccountTransactionsUpdated,{transactions:t})}}(WE,qE,$E,DE,kE,Yl),KE=new class{#Vt;#Y;#Q;#i;constructor(e,t,n,r){this.#Vt=e,this.#Y=t,this.#Q=n,this.#i=Jl(r,"[🔄 AccountsSynchronizer]")}async synchronize(e){const t=e??await this.#Vt.getAll();this.#i.info("Synchronizing accounts",t);const n=(await Promise.allSettled(t.map((async e=>this.#Y.fetch(e))))).map((e=>"fulfilled"===e.status?e.value:[])).flat();await this.#Y.saveMany(n);const r=await this.#Q.fetchAssetsTransactions(n,{limit:20});await this.#Q.saveMany(r)}}($E,DE,VE,Yl),GE=new class{#Kt;#i;#Qe;constructor(e,t,n){this.#Kt=e,this.#Qe=t,this.#i=n}async scanTransaction({method:e,accountAddress:t,transaction:n,scope:r,origin:o,options:i=["simulation","validation"],account:a}){try{const s=await this.#Kt.scanTransactions({method:e,accountAddress:t,transactions:[n],scope:r,origin:o===nd?"https://metamask.io":o,options:i}),c=this.#Gt(s);if(!c?.status)return this.#i.warn("Invalid scan result received from security alerts API"),a&&await this.#Qe.trackEventSecurityScanCompleted(a,o,r,yE.ERROR,!1),null;if(a){const e=Object.values(yE).includes(c.status)?c.status:yE.ERROR,t=Boolean(c.validation?.type&&c.validation.type!==mE.Benign),n=[this.#Qe.trackEventSecurityScanCompleted(a,o,r,e,t)];if(t){const e=Object.values(mE).includes(c.validation.type)?c.validation.type:mE.Warning;n.push(this.#Qe.trackEventSecurityAlertDetected(a,o,r,e,c.validation.reason??"unknown",this.#Ht(c.validation)))}await Promise.all(n)}if(!c?.estimatedChanges?.assets)return null;const u={...c},l=c.estimatedChanges.assets.map((async(e,t)=>{const{logo:n}=e;if(n)return Av.generateImageComponent(n,16,16,this.#i).then((e=>{e&&u?.estimatedChanges?.assets?.[t]&&(u.estimatedChanges.assets[t].imageSvg=e)})).catch((()=>null))}));return await Promise.all(l??[]),u}catch(e){return this.#i.error(e),a&&await this.#Qe.trackEventSecurityScanCompleted(a,o,r,yE.ERROR,!1),null}}#Ht(e){if(!e?.reason)return"Security alert: Unknown reason";return{unfair_trade:"Unfair trade of assets, without adequate compensation to the owner's account",transfer_farming:"Substantial transfer of the account's assets to untrusted entities",writable_accounts_farming:"Transaction exposes unused writable account, can be utilized in BIT-FLIP attacks patterns",native_ownership_change:"The account transferred ownership of its native SOL to untrusted entities",spl_token_ownership_change:"The account transferred ownership of its SPL tokens to untrusted entities",exposure_farming:"The account delegates ownership, thereby exposing its assets to untrusted spenders",known_attacker:"A known attacker's account is involved in the transaction",invalid_signature:"One of the transactions provided contains non valid signatures, that can lead misleading simulation results",honeypot:"The account invests funds in a token that is part of an orchestrated honeypot scheme",other:"The transaction was marked as malicious for other reason, further details would be described in features field"}[e.reason]??`Security alert: ${e.reason}`}#Gt(e){return e?{status:"SUCCESS"===e.status||"ERROR"===e.status?e.status:"ERROR",estimatedChanges:{assets:e.result?.simulation?.account_summary?.account_assets_diff?.map((e=>({type:e.in?"in":"out",symbol:"symbol"in e.asset?e.asset.symbol:e.asset_type,name:"name"in e.asset?e.asset.name:e.asset_type,logo:"logo"in e.asset?e.asset.logo:null,value:e.in?.value??e.out?.value??null,price:e.in?.usd_price??e.out?.usd_price??null,imageSvg:null})))??[]},validation:{type:e.result?.validation?.result_type??null,reason:e.result?.validation?.reason??null},error:e?.error_details?{type:"type"in e.error_details?e.error_details.type:null,code:"code"in e.error_details?e.error_details.code:null}:null}:null}}(new class{#o;#i;#a;constructor(e,t=globalThis.fetch,n=Yl){const{baseUrl:r}=e.get().securityAlertsApi;this.#o=t,this.#i=n,this.#a=r}async scanTransactions({method:e,accountAddress:t,transactions:n,scope:r,origin:o,options:i}){const a=Fd.from(Dd.decode(t)).toString("base64");this.#i.info("Scanning transaction");return(await this.#o(`${this.#a}/solana/message/scan`,{headers:{"Content-Type":"application/json",accept:"application/json"},method:"POST",body:JSON.stringify({method:e,encoding:"base64",account_address:a,metadata:{url:o},chain:$d[r],transactions:n,options:i})})).json()}}(wE),EE,Yl),HE=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case en.SignAndSendTransaction:case en.SignTransaction:return this.#Zt(e,t);case en.SignMessage:return this.#Jt(e,t);case en.SignIn:return this.#Yt(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#Zt(e,t){j(e.request,re([oy,sy]));const{request:{method:n,params:{transaction:r}},scope:o,account:i,origin:a}=e;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionAdded,params:{accountId:i,metadata:{scope:o,origin:a}}}}});return await jA({...UA,scope:o,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionApproved,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!0):(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionRejected,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!1)}async#Jt(e,t){const n=await async function(e,t){j(e.request,ay);const{request:{params:{message:n}},scope:r,origin:o}=e,i=Gs().encode(n),a=Qs().decode(i),[s,c]=await Promise.all([Yy().then((e=>e.locale)).catch((()=>"en")),jE.resolveAddress(r,t.address)]);return Jy(await Gy(Bv(bA,{message:a,account:t,accountDomain:c,scope:r,locale:s,networkImage:Ov,origin:o}),{}))}(e,t);return Boolean(n)}async#Yt(e,t){const n=await async function(e,t){j(e.request,iy);const{request:{params:n},scope:r,origin:o}=e,[i,a]=await Promise.all([Yy(),jE.resolveAddress(r,t.address)]);return Jy(await Gy(Bv(wA,{params:n,account:t,accountDomain:a,scope:r,preferences:i,networkImage:Ov,origin:o}),{}))}(e,t);return Boolean(n)}},ZE=new class{#Z;#J;#Q;#Qe;#x;#_;#i;#Qt=new Map;#Xt=10*ew.Minute;constructor(e,t,n,r,o,i,a){this.#Z=e,this.#J=t,this.#Q=n,this.#Qe=r,this.#x=o,this.#_=i,this.#i=Jl(a,"[✍️ SignatureMonitor]"),this.#te()}#te(){rw.forEach((e=>{this.#Z.registerNotificationHandler("signatureSubscribe",e,this.#en.bind(this)),this.#Z.registerConnectionRecoveryHandler(e,this.#oe.bind(this))}))}async monitor(e,t,n,r,o){this.#i.info("Monitoring signature",{signature:e,accountId:t,commitment:n,network:r,origin:o});const i={method:"signatureSubscribe",network:r,expiryMilliseconds:this.#Xt,params:[e,{commitment:n,enableReceivedNotification:!1}],metadata:{accountId:t,origin:o}},a=await this.#Z.subscribe(i);this.#Qt.set(a,i)}async#en(e,t){try{const{network:e}=t,n=(0,Pd.get)(t,"params[0]");j(n,ee());const r=(0,Pd.get)(t,"params[1].commitment");j(r,om);const o=t.metadata?.accountId;j(o,ee());const i=t.metadata?.origin;j(i,ee());const a=await this.#J.findById(o);if(!a)throw new Error(`Account not found: ${o}`);const s=await this.#Q.fetchBySignature(n,a,e);if(!s)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(r){case"processed":await this.#Q.save(s),await this.#Qe.trackEventTransactionSubmitted(a,n,{scope:e,origin:i});break;case"confirmed":case"finalized":await this.#Q.save(s),await this.#Qe.trackEventTransactionFinalized(a,s,{scope:e,origin:i});break;default:this.#i.warn(`⚠️ Commitment ${r} not supported`)}}catch(e){this.#i.error("Error handling signature notification",e)}finally{await this.#Z.unsubscribe(t.id),this.#Qt.delete(t.id)}}async#oe(){this.#i.info("Handling connection recovery"),await Promise.all(Array.from(this.#Qt.entries()).map((async([e,t])=>{await this.#tn(t,e)})))}async#tn(e,t){try{const{network:n}=e;j(n,ee());const r=(0,Pd.get)(e,"params[0]");j(r,ee());const o=(0,Pd.get)(e,"params[1].commitment");j(o,om);const i=await this.#nn(r,n);if(!i)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#rn(i,o))return void this.#i.info("Signature did not reach the desired commitment while connection was down. Skipping.");const a={jsonrpc:"2.0",method:"signatureNotification",params:{subscription:1,result:{context:{slot:BigInt(0)},value:{err:null}}}},s={...e,id:t};await this.#en(a,s),this.#Qt.delete(t)}catch(e){this.#i.error("Error handling connection recovery",e)}}async#nn(e,t){const n=await this.#x.getRpc(t).getSignatureStatuses([Ec(e)],{searchTransactionHistory:!0}).send(),r=n.value[0]?.confirmationStatus;if(!r)throw new Error(`Signature ${e} not found via HTTP fetch during connection recovery`);return r}#rn(e,t){return t===e||"processed"===t&&("confirmed"===e||"finalized"===e)||"confirmed"===t&&"finalized"===e}}(_E,$E,VE,EE,kE,wE,Yl),JE=new Pv(_E,$E,DE,VE,KE,CE,wE,Yl),YE=(new class{#Vt;#on;#ge;#i;constructor(e,t,n,r){this.#Vt=e,this.#on=t,this.#ge=n,this.#i=Jl(r,"[🥾 MonitoredAccountsInitializer]"),this.#te()}#te(){this.#ge.on("onActive",this.#in.bind(this))}async#in(){this.#i.info("Starting to monitor the selected accounts");const e=await this.#Vt.getAllSelected();await this.#on.setMonitoredAccounts(e.map((e=>e.id)))}}($E,JE,vE,Yl),new class{#x;#an;#sn;#i;constructor(e,t,n,r=Yl){this.#x=e,this.#an=t,this.#sn=n,this.#i=Jl(r,"[👛 WalletService]")}async resolveAccountAddress(e,t,n){this.#i.log("Resolving account address",{keyringAccounts:e,scope:t,request:n});const{method:r,params:o}=n,i=e.filter((e=>e.scopes.includes(t)));if(0===i.length)throw new Error("No accounts with this scope");let a;switch(r){case en.SignIn:{const{address:e}=o;if(!e)throw new Error("No address");a=e;break}case en.SignAndSendTransaction:case en.SignMessage:case en.SignTransaction:{const{account:e}=o;a=e.address;break}default:throw this.#i.warn({method:r},"Unsupported method"),new Error("Unsupported method")}if(!i.find((e=>e.address===a)))throw new Error("Account not found");return Yv(t,a)}async signTransaction(e,t,n,r,o){this.#i.log("Signing transaction",{account:e,transaction:t,scope:n,options:o});const i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#an.partiallySignBase64String(t,e,n,i),s={signedTransaction:$g(a)};j(s,uy);try{il(a);const t=rl(a);await this.#sn.monitor(t,e.id,"confirmed",n,r)}catch(e){this.#i.warn("Transaction is not fully signed, skipping monitoring",{error:e})}return s}async signAndSendTransaction(e,t,n,r,o){this.#i.log("Signing and sending transaction",e);const i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#an.partiallySignBase64String(t,e,n,i),s=rl(a),c=function({rpc:e}){return async function(t,n){await Lg({...n,rpc:e,transaction:t})}}({rpc:this.#x.getRpc(n)}),u=Zv(n,"tx",s);this.#i.info(`Sending transaction: ${u}`),il(a);const l={...o?.preflightCommitment?{preflightCommitment:o.preflightCommitment}:{},...o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:{},...o?.maxRetries?{maxRetries:BigInt(o.maxRetries)}:{},skipPreflight:o?.skipPreflight??!0,commitment:"confirmed"};await c(a,l),await this.#sn.monitor(s,e.id,o?.commitment??"confirmed",n,r);const d={signature:s};return j(d,cy),d}async signMessage(e,t){this.#i.log("Signing message",e,t);const{address:n,entropySource:r,derivationPath:o}=e,i=oc(n),a=Gs().encode(t),s=function(e,t={}){return Object.freeze({content:"string"==typeof e?(new bl).encode(e):e,signatures:Object.freeze({...t})})}(Qs().decode(a)),{privateKeyBytes:c}=await $y({entropySource:r,derivationPath:o}),u=await ml(c),[l]=await u.signMessages([s]);j(l,Y());const d=l[i];var f;j(d,(f=Uint8Array,ae("instance",(e=>e instanceof f||`Expected a \`${f.name}\` instance, but received: ${P(e)}`))));const h={signature:Ds().decode(d),signedMessage:t,signatureType:"ed25519"};return j(h,ly),h}async signIn(e,t){this.#i.log("Signing in",e,t);const{address:n}=e,r=this.#cn(t),o=Qs().encode(r),i=Gs().decode(o),a={account:{address:n},...await this.signMessage(e,i)};return j(a,dy),a}async verifySignature(e,t,n){this.#i.log("Verifying signature",{account:e,signatureBase58:t,messageBase64:n}),j(t,Sd),j(n,Ed);const r=Fs().encode(t),o=Gs().encode(n),{privateKeyBytes:i}=await $y({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await ml(i);return await kc(a.keyPair.publicKey,r,o)}#cn(e){const{domain:t,address:n,statement:r,uri:o,version:i,chainId:a,nonce:s,issuedAt:c,expirationTime:u,notBefore:l,requestId:d,resources:f}=e;let h=`${t??""} wants you to sign in with your Solana account:\n`;h+=`${n??""}`,r&&(h+=`\n\n${r}`);const p=[];if(o&&p.push(`URI: ${o}`),i&&p.push(`Version: ${i}`),a&&p.push(`Chain ID: ${a}`),s&&p.push(`Nonce: ${s}`),c&&p.push(`Issued At: ${c}`),u&&p.push(`Expiration Time: ${u}`),l&&p.push(`Not Before: ${l}`),d&&p.push(`Request ID: ${d}`),f&&f.length>0){p.push("Resources:");for(const e of f)p.push(`- ${e}`)}return p.length&&(h+=`\n\n${p.join("\n")}`),h}}(kE,RE,ZE,Yl)),QE=new class{#We;#i;#Q;#Y;#un;#ln;#on;#dn="Create Solana Account";constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:o,confirmationHandler:i,keyringAccountMonitor:a}){this.#We=e,this.#i=Jl(t,"[🔑 Keyring]"),this.#Q=n,this.#Y=r,this.#un=o,this.#ln=i,this.#on=a}async listAccounts(){return(await this.#fn()).map(nm)}async#fn(){try{const e=await this.#We.getKey("keyringAccounts")??{};return(0,Pd.sortBy)(Object.values(e),["entropySource","index"])}catch(e){throw this.#i.error({error:e},"Error listing accounts"),new Error("Error listing accounts")}}async getAccount(e){try{mw({accountId:e},hd);const t=await this.#hn(e);return t?nm(t):void 0}catch(e){throw this.#i.error({error:e},"Error getting account"),new Xr(e)}}async getAccountOrThrow(e){const t=await this.#hn(e);if(!t)throw new Error(`Account "${e}" not found`);return t}async#hn(e){try{return await this.#We.getKey(`keyringAccounts.${e}`)}catch(e){throw this.#i.error({error:e},"Error getting account"),new Xr(e)}}#pn(e,t){return function(e){if(0===e.length)return 0;const t=e.map((e=>e.index)).sort(((e,t)=>e-t));let n=0;for(const e of t){if(e!==n)break;n+=1}return n}(e.filter((e=>e.entropySource===t)))}#gn(e){return`m/44'/501'/${e}'/0'`}#mn(e){const t=e.split("/")[3];if(!t)throw new Error("Invalid derivation path");const n=parseInt(t.replace("'",""),10);return j(n,K()),n}async#yn(){const e=(await async function(){return await snap.request({method:"snap_listEntropySources"})}()).find((({primary:e})=>e));if(!e)throw new Error("No default entropy source found - this can never happen");return e.id}async createAccount(e){const t=globalThis.crypto.randomUUID();try{await async function(e){try{return await snap.request({method:"snap_startTrace",params:{name:e}})}catch(e){return null}}(this.#dn);const n=await this.#fn(),r=e?.entropySource??await this.#yn(),o=e?.derivationPath?this.#mn(e.derivationPath):this.#pn(n,r),i=e?.derivationPath?e.derivationPath:this.#gn(o),a=n.find((e=>e.derivationPath===i&&e.entropySource===r));if(a)return this.#i.warn("An account already exists with the same derivation path and entropy source. Skipping account creation."),nm(a);const{publicKeyBytes:s}=await $y({entropySource:r,derivationPath:i}),c=ac().decode(s.slice(1)),{importedAccount:u,accountNameSuggestion:l,metamask:d,...f}=e??{},h={id:t,entropySource:r,derivationPath:i,index:o,type:St.DataAccount,address:c,scopes:[Qt.Mainnet,Qt.Testnet,Qt.Devnet],options:{...f,entropySource:r,derivationPath:i,index:o},methods:[en.SignAndSendTransaction,en.SignTransaction,en.SignMessage,en.SignIn]};await this.#We.setKey(`keyringAccounts.${h.id}`,h);const p=nm(h);return await this.emitEvent(Pn.AccountCreated,{account:p,accountNameSuggestion:l??`Solana Account ${o+1}`,displayAccountNameSuggestion:!l,displayConfirmation:!1,...d?{metamask:d}:{}}),await async function(e){try{return await snap.request({method:"snap_endTrace",params:{name:e}})}catch(e){return null}}(this.#dn),p}catch(e){throw this.#i.error({error:e},"Error creating account"),await this.#wn(t),new Error(`Error creating account: ${e.message}`)}}async#wn(e){await Promise.all([this.#We.deleteKey(`keyringAccounts.${e}`),this.#We.deleteKey(`transactions.${e}`),this.#We.deleteKey(`assets.${e}`)])}async deleteAccount(e){try{mw({accountId:e},pd),await this.emitEvent(Pn.AccountDeleted,{id:e}),await this.#wn(e)}catch(e){throw this.#i.error({error:e},"Error deleting account"),e}}async listAccountAssets(e){try{mw({accountId:e},gd);const t=await this.getAccountOrThrow(e),n=(await this.#Y.findByAccount(t)).filter((e=>e.assetType.endsWith(sd.SOL)||Number(e.rawAmount)>0)).map((e=>e.assetType));return yw(n,vn),n}catch(e){throw this.#i.error({error:e},"Error listing account assets"),e}}async getAccountBalances(e,t){try{mw({accountId:e,assets:t},md);const n=await this.getAccountOrThrow(e),r=(await this.#Y.findByAccount(n)).filter((e=>t.includes(e.assetType))).filter((e=>e.assetType.endsWith(sd.SOL)||Number(e.rawAmount)>0)).reduce(((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e)),{});return yw(r,wd),r}catch(e){throw this.#i.error({error:e},"Error getting account balances"),e}}async emitEvent(e,t){await zn(snap,e,t)}async filterAccountChains(e,t){throw new Error(`Implement me! ${e} ${t.toString()}`)}async updateAccount(e){throw new Error(`Implement me! ${JSON.stringify(e)}`)}async submitRequest(e){return{pending:!1,result:await this.#vn(e)}}async#vn(e){j(e,ww);const{request:{method:t,params:n},scope:r,account:o,origin:i}=e,a=await this.getAccountOrThrow(o);if(!a.scopes.includes(r))throw new Error(`Scope "${r}" is not allowed for this account`);if(!a.methods.includes(t))throw new Error(`Method "${t}" is not allowed for this account`);if("scope"in n&&r!==n.scope)throw new Error(`Scope "${r}" does not match "${n.scope}" in request.params`);j(r,vd);if(!await this.#ln.handleKeyringRequest(e,a))throw new wo;switch(t){case en.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#un.signAndSendTransaction(a,e,r,i,t)}case en.SignTransaction:{this.#An(a,e);const{transaction:t,options:o}=n;return this.#un.signTransaction(a,t,r,i,o)}case en.SignMessage:{this.#An(a,e);const{message:t}=n;return this.#un.signMessage(a,t)}case en.SignIn:return this.#un.signIn(a,n);default:throw new so(`Unsupported method: ${t}`)}}#An(e,t){const{address:n}=e,{account:r}=t.request.params;try{oc(r.address)}catch{throw new Error("Invalid Solana address format")}if(r.address!==n)throw new Error("The requested account and/or method has not been authorized by the user.")}async listAccountTransactions(e,t){try{mw({accountId:e,pagination:t},yd);const{limit:n,next:r}=t,o=await this.#hn(e);if(!o)throw new Error("Account not found");const i=await this.#Q.findByAccounts([o]),a=r?i.findIndex((e=>e.id===r)):0,s=i.slice(a,a+n),c=a+t.limit<i.length;return{data:s,next:c?i[a+t.limit]?.id??null:null}}catch(e){throw this.#i.error({error:e},"Error listing account transactions"),e}}async resolveAccountAddress(e,t){try{j(e,vd);const{method:n,params:r}=t,o={method:n,params:r};j(o,fy);const i=await this.#fn();return{address:await this.#un.resolveAccountAddress(i,e,o)}}catch(e){return this.#i.error({error:e},"Error resolving account address"),null}}async discoverAccounts(e,t,n){try{j({scopes:e,entropySource:t,groupIndex:n},vw);const r=this.#gn(n),{publicKeyBytes:o}=await $y({entropySource:t,derivationPath:r}),i=ac().decode(o.slice(1)),a=[];for(const t of e)a.push(this.#Q.fetchLatestSignatures(t,i,{limit:1}));const s=await Promise.all(a);return s.some((e=>e.length>0))?[{type:"bip44",scopes:e,derivationPath:r}]:[]}catch(e){throw this.#i.error({error:e},"Error discovering accounts"),e}}async setSelectedAccounts(e){mw(e,W(ld)),await this.#on.setMonitoredAccounts(e)}}({state:AE,transactionsService:VE,logger:Yl,assetsService:DE,walletService:YE,confirmationHandler:HE,keyringAccountMonitor:JE}),XE=new class{#x;#i;constructor(e,t=Yl){this.#x=e,this.#i=t}static isMaybeNonFungible(e){const{tokenAmount:t}=e,{decimals:n}=t;return!1}}(kE,Yl),ek=new class{#x;#bn;#i;#N;#q;#Sn;#En;#Y;#Ge={minimumBalanceForRentExemption:5*ew.Minute};constructor(e,t,n,r,o,i,a,s){this.#x=e,this.#bn=t,this.#N=r,this.#i=Jl(n,"[📬 SendService]"),this.#q=o,this.#Sn=i,this.#En=a,this.#Y=s}async#kn(e){return Xl((async t=>this.#x.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>Uo(e.toString())))),this.#N,{functionName:"SendService:getMinimumBalanceForRentExemption",ttlMilliseconds:this.#Ge.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){this.#i.log("Confirming send transaction",e);const{fromAccountId:t,toAddress:n,amount:r,assetId:o}=e.params,i=await this.#bn.getAccountOrThrow(t),{chainId:a,assetReference:s}=Qo(o),c=a,u=o===ud[c].nativeToken.caip19Id,l=u?this.#Sn:this.#En,d={from:i,to:oc(n),amount:r,network:c,...u?{}:{mint:oc(s)}},f=nl(await l.buildTransactionMessage(d)),h=$g(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:nd,request:{method:en.SignAndSendTransaction,params:{account:{address:i.address},transaction:h,scope:c}}};return this.#i.log("Submitting keyring request",p),this.#bn.submitRequest(p)}async onAddressInput(e,t){if(""===e)return{valid:!1,errors:[{code:Um.Required}]};try{oc(e);if("UNSUPPORTED"===(await this.#q.classify(e,t)).type)throw new Error("Unsupported recipient");return{valid:!0,errors:[]}}catch(e){return{valid:!1,errors:[{code:Um.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e,o=await this.#bn.getAccountOrThrow(n),{chainId:i}=Qo(r),a=i,s=ud[a].nativeToken.caip19Id,c=r===s,u=await this.#Y.findByAccount(o),l=u.find((e=>e.assetType===r)),d=u.find((e=>e.assetType===s));if(!l)throw new Error(`Balance not found for asset ${r} and account ${n}`);if(""===t)return{valid:!1,errors:[{code:Um.Required}]};const f=vm(l.uiAmount??"0"),h=vm(d?.uiAmount??"0"),p=vm(t),g=await this.#kn(a),m=c?this.#Sn:this.#En,y=new Sv(m).getFee(),w=Uo(y.toString());if(h.isZero())return{valid:!1,errors:[{code:Um.InsufficientBalance}]};if(c){if(p.gt(h))return{valid:!1,errors:[{code:Um.InsufficientBalance}]};if(p.plus(w).plus(g).gt(h))return{valid:!1,errors:[{code:Um.InsufficientBalanceToCoverFee}]}}else{if(p.gt(f))return{valid:!1,errors:[{code:Um.InsufficientBalance}]};if(w.plus(g).gt(h))return{valid:!1,errors:[{code:Um.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(kE,QE,Yl,SE,NE,PE,BE,DE),tk=new class{#x;#W;#i;#V=1e4;#K=10000n;constructor(e,t,n){this.#x=e,this.#W=t,this.#i=Jl(n,"[🔐 ApproveTokenService]")}async buildApprovalTransactionMessage(e){this.#i.log("Building token approval transaction",{mint:e.mint,delegate:e.delegate,amount:e.amount,network:e.network});const{account:{entropySource:t,derivationPath:n},mint:r,delegate:o,amount:i,network:a}=e,[s,c,{privateKeyBytes:u}]=await Promise.all([this.#x.fetchMint(r,a),this.#x.getLatestBlockhash(a),$y({entropySource:t,derivationPath:n})]),{programAddress:l,data:{decimals:d}}=s,f=await ml(u),h=await this.#W.uiAmountToAmountForMint(r,a,i),p=(await Uf({mint:r,owner:f.address,tokenProgram:l}))[0],g=(l===Nh?qh:Bf)({source:p,mint:r,delegate:o,owner:f,amount:h,decimals:d}),m=lu(Du({version:0}),(e=>Gu(f.address,e)),(e=>fu(c,e)),(e=>Hu(g,e)));return Ju([ef({units:this.#V}),of({microLamports:this.#K})],m)}}(kE,CE,Yl),nk=new class{#Vt;#un;#i;#Tn;#In;constructor(e,t,n,r,o){this.#Vt=e,this.#un=t,this.#i=Jl(n,"[👋 ClientRequestHandler]"),this.#Tn=r,this.#In=o}async handle(e){this.#i.log("Handling client request",e);const{method:t}=e;switch(t){case Am.SignAndSendTransactionWithoutConfirmation:return this.#xn(e);case Am.ConfirmSend:return this.#_n(e);case Am.SignAndSendTransaction:return this.#Cn(e);case Am.ComputeFee:return this.#Rn(e);case Am.OnAddressInput:return this.#Pn(e);case Am.OnAmountInput:return this.#Nn(e);case Am.SignRewardsMessage:return this.#Bn(e);case Am.SignCardMessage:return this.#Mn(e);case Am.ApproveCardAmount:return this.#On(e);default:throw new so}}async#xn(e){try{j(e,hy)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:o}}=e,i=await this.#Vt.findByAddress(r);if(!i)throw new oo(`Account not found: ${r}`);return this.#un.signAndSendTransaction(i,t,o,nd,n)}async#Cn(e){try{j(e,gy)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:o}}=e,i=await this.#Vt.findById(r);if(!i)throw new oo(`Account not found: ${r}`);const{signature:a}=await this.#un.signAndSendTransaction(i,t,o,nd,n),s={transactionId:a};return j(s,my),s}async#_n(e){try{j(e,wy)}catch(e){const t=new oo;throw t.cause=e,t}return await this.#Tn.confirmSend(e)}async#Rn(e){try{j(e,zy)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,{baseFee:r,priorityFee:o}=ym.calculateFee(t),i=ud[n].nativeToken.symbol,a=ud[n].nativeToken.caip19Id,s=[{type:zt.Base,asset:{unit:i,type:a,amount:wm(r).toString(),fungible:!0}},{type:zt.Priority,asset:{unit:i,type:a,amount:wm(o).toString(),fungible:!0}}];return j(s,Uy),s}async#Pn(e){let t;try{t=L(e,Ay)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{value:n,scope:r}}=t,o=await this.#Tn.onAddressInput(n,r);return j(o,My),o}async#Nn(e){try{j(e,Sy)}catch(e){const t=new oo;throw t.cause=e,t}const t=await this.#Tn.onAmountInput(e);return j(t,My),t}async#Bn(e){j(e,Iy);const{params:{accountId:t,message:n}}=e,r=await this.#Vt.findById(t);if(!r)throw new oo(`Account not found: ${t}`);const{address:o}=Ey(n);if(o!==r.address)throw new oo(`Address in rewards message (${o}) does not match signing account address (${r.address})`);return await this.#un.signMessage(r,n)}async#Mn(e){try{j(e,Ry)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{accountId:t,message:n}}=e,r=await this.#Vt.findById(t);if(!r)throw new oo(`Account not found: ${t}`);const{address:o}=xy(n);if(o!==r.address)throw new oo(`Address in card message (${o}) does not match signing account address (${r.address})`);return await this.#un.signMessage(r,n)}async#On(e){try{j(e,Ny)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{accountId:t,amount:n,mint:r,delegate:o,scope:i}}=e,a=await this.#Vt.findById(t);if(!a)throw new oo(`Account not found: ${t}`);const s=i,c=nl(await this.#In.buildApprovalTransactionMessage({account:a,mint:oc(r),delegate:oc(o),amount:n,network:s})),u=$g(c),{signature:l}=await this.#un.signAndSendTransaction(a,u,s,nd),d={signature:l};return j(d,By),d}}($E,YE,Yl,ek,tk),rk={configProvider:wE,connection:kE,keyring:QE,priceApiClient:ME,state:AE,cache:bE,assetsService:DE,tokenPricesService:UE,signer:RE,transactionsService:VE,sendSolBuilder:PE,sendSplTokenBuilder:BE,walletService:YE,transactionScanService:GE,analyticsService:EE,confirmationHandler:HE,nftService:XE,clientRequestHandler:nk,webSocketConnectionService:IE,subscriptionService:_E,eventEmitter:vE,nameResolutionService:jE,accountsService:$E,accountsSynchronizer:KE,tokenHelper:CE},ok=Y({id:ee(),jsonrpc:G("2.0"),method:G(LA.OnTransactionAdded),params:Y({accountId:ld,metadata:Y({scope:vd,origin:ee()})})}),ik=Y({id:ee(),jsonrpc:G("2.0"),method:G(LA.OnTransactionApproved),params:Y({accountId:ld,metadata:Y({scope:vd,origin:ee()})})}),ak=Y({id:ee(),jsonrpc:G("2.0"),method:G(LA.OnTransactionRejected),params:Y({accountId:ld,metadata:Y({scope:vd,origin:ee()})})}),sk=Uv("Form"),ck=Uv("Field"),uk=Uv("AccountSelector"),lk=Uv("AssetSelector"),dk=({title:e,backButtonName:t})=>Mv(Lv,{direction:"horizontal",alignment:"space-between",center:!0,children:[t?Bv(Gv,{name:t,children:Bv(dA,{name:"arrow-left",color:"primary",size:"md"})}):null,Bv(Dv,{size:"sm",children:e}),Mv(Lv,{direction:"horizontal",children:[Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null})]})]}),fk=Uv("Input");var hk=function(e){return e.Form="send-form",e.DestinationAccountInput="send-to",e.BackButton="send-back-button",e.SourceAccountSelector="send-account-selector",e.AmountInput="send-amount-input",e.AssetSelector="send-asset-selector",e.SwapCurrencyButton="send-swap-currency",e.MaxAmountButton="send-amount-input-max",e.CancelButton="send-cancel-button",e.SendButton="send-submit-button",e.ClearButton="send-clear-button",e.CloseButton="send-close-button",e}({}),pk=function(e){return e.TOKEN="TOKEN",e.FIAT="USD",e}({});const gk=({name:e,value:t,tokenSymbol:n,currency:r,currencyType:o,locale:i,swapCurrencyButtonDisabled:a=!1})=>{const s=tA(i),c=o===pk.FIAT?r.toUpperCase():n;return Mv(ck,{label:s("send.amountField"),children:[Bv(fk,{name:e,type:"number",min:0,placeholder:"0",step:.01,value:t??void 0}),Mv(Lv,{direction:"horizontal",center:!0,children:[Bv(Lv,{direction:"vertical",alignment:"center",children:Bv(Fv,{size:"sm",children:c})}),Bv(Gv,{name:hk.SwapCurrencyButton,disabled:a,children:Bv(dA,{name:"swap-vertical",color:a?"muted":"primary",size:"md"})})]})]})},mk={initial:null,fetching:"default",fetched:"success",error:null},yk=({name:e,value:t,error:n,locale:r,showClearButton:o,disabled:i,domainResolutionStatus:a})=>{const s=tA(r);return Mv(Lv,{children:[Mv(ck,{label:s("send.toField"),error:n,children:[Bv(fk,{name:e,placeholder:i?"":s("send.toPlaceholder"),value:t??void 0,disabled:i}),o?Bv(Lv,{children:Bv(Gv,{name:hk.ClearButton,children:Bv(dA,{name:lA.Close,color:"primary"})})}):null]}),a&&null!==mk[a]&&Bv(Fv,{size:"sm",color:mk[a],children:s(`send.toDomainResolutionStatus.${a}`)})]})},wk=e=>{const{amount:t,tokenPrices:n,tokenCaipId:r,currencyType:o}=e,i=n?.[r]?.price;if(o===pk.TOKEN)return t;if(void 0===i)throw new Error("Token price is undefined, cannot convert to fiat amount.");return null===t?null:jo(t).dividedBy(jo(i)).toString()},vk=e=>{const{selectedTokenMetadata:t}=e;return{...t??{},tokenSymbol:t?.symbol??"UNKNOWN",tokenImage:t?.imageSvg??mv}},Ak=e=>{const{tokenCaipId:t,tokenPrices:n}=e;return n?.[t]?.price},bk=e=>{const{balances:t,fromAccountId:n,tokenCaipId:r}=e;return t?.[n]?.[r]?.amount??"0"},Sk=e=>{const{tokenCaipId:t,scope:n}=e;return t===ud[n]?.nativeToken?.caip19Id},Ek=Uv("Spinner"),kk=({title:e,subtitle:t,iconSrc:n,isLoading:r})=>Mv(Lv,{alignment:"center",center:!0,children:[Mv(Lv,{direction:"horizontal",center:!0,children:[r?Bv(Ek,{}):null,n&&!r?Bv(Vv,{borderRadius:"full",src:n}):null]}),Bv(Dv,{size:"lg",children:e}),t?Bv(Fv,{color:"muted",children:t}):null]}),Tk=Uv("Value"),Ik=({context:e})=>{const{scope:t,fromAccountId:n,toAddress:r,accounts:o,feeEstimatedInSol:i,preferences:{locale:a,currency:s},transaction:c,feePaidInSol:u,tokenPrices:l,fromDomain:d,toDomain:f}=e,h=tA(a),p=ud[t],g=o.find((e=>e.id===n))?.address,m=Yv(t,g),y=p.name,w=p.nativeToken.symbol,v=l[p.nativeToken.caip19Id]?.price,A=c?u:i,b=A?BA(A,w,a):"",S=void 0===v||null===A?"":sA(MA(A,v),s,a);return Mv(Lv,{children:[Mv($v,{children:[Bv(Wv,{label:h("send.confirmation.from"),children:d?Bv(Jv,{domain:d,scope:t,address:g}):Bv(Hv,{href:Zv(t,"address",g),children:Bv(qv,{address:m,displayName:!0})})}),r?Bv(Wv,{label:h("send.confirmation.recipient"),children:f?Bv(Jv,{domain:f,scope:t,address:r}):Bv(Hv,{href:Zv(t,"address",r),children:Bv(qv,{address:Yv(t,r),displayName:!0})})}):null]}),Mv($v,{children:[Bv(Wv,{label:h("send.confirmation.network"),children:Bv(Fv,{children:y})}),Bv(Wv,{label:h("send.confirmation.transactionSpeed"),children:Bv(Fv,{children:"<1s"})}),Bv(Wv,{label:h("send.confirmation.fee"),children:Bv(Tk,{extra:S,value:b})})]})]})};var xk=function(e){return e.BackButton="transaction-confirmation-back-button",e.CancelButton="transaction-confirmation-cancel-button",e.ConfirmButton="transaction-confirmation-submit-button",e}({});const _k={"send-form":({context:e,inputToAddress:t,inputAmount:n})=>{const{accounts:r,fromAccountId:o,amount:i,destinationAddressOrDomain:a,domainResolutionStatus:s,validation:c,currencyType:u,tokenCaipId:l,scope:d,balances:f,tokenPricesFetchStatus:h,buildingTransaction:p,error:g,loading:m,transactionMessage:y,preferences:{locale:w,currency:v}}=e,A=tA(w),b=f[o]?.[l],S=b?.amount,E=b?.unit??"",k=void 0!==S,T=r.find((e=>e.id===o)),I=T?.address?Yv(d,T.address):void 0,x=Ak(e),_=void 0===S||"0"===S,C=void 0===x,R="error"===h||"fetched"===h&&C,P=(k?{[pk.FIAT]:sA(MA(S,x??0),v,w),[pk.TOKEN]:BA(S,E,w)}:{[pk.FIAT]:"",[pk.TOKEN]:""})[u],N=o.length>0&&!!a&&a.length>0&&Sm(c?.[hk.DestinationAccountInput]),B=!Sm(y)&&""!==y,M=Boolean(a&&a.length>0),O=Boolean(c?.[hk.AmountInput]?.message),z=O?c?.[hk.AmountInput]?.message??"":`${A("send.balance")}: ${P}`,U=o.length>0&&!!i&&i.length>0&&!!a&&a.length>0&&Object.values(c).every(Sm)&&k&&!p&&B;return Mv(jv,{backgroundColor:"alternative",children:[Mv(Lv,{children:[Bv(dk,{title:A("send.title"),backButtonName:hk.BackButton}),Mv(sk,{name:hk.Form,children:[R&&Bv(_A,{title:"",severity:"info",children:Bv(Fv,{children:A("send.selectedTokenPriceNotAvailable",{currency:v})})}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(ck,{label:A("send.fromField"),error:c?.[hk.SourceAccountSelector]?.message??"",children:Bv(uk,{name:hk.SourceAccountSelector,chainIds:[d],value:I??void 0,hideExternalAccounts:!0,switchGlobalAccount:!0})}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(yk,{locale:w,disabled:m,name:hk.DestinationAccountInput,value:t??null,showClearButton:M,domainResolutionStatus:s,error:c?.[hk.DestinationAccountInput]?.message??""}),N&&Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Mv(Lv,{direction:"horizontal",children:[Bv(ck,{label:A("send.assetField"),children:Bv(lk,{chainIds:[d],value:l,name:hk.AssetSelector,addresses:I?[I]:[]})}),Bv(gk,{name:hk.AmountInput,currencyType:u,tokenSymbol:E,currency:v,value:n??null,locale:w,swapCurrencyButtonDisabled:C||_})]}),Mv(Lv,{direction:"horizontal",alignment:"space-between",crossAlignment:"start",children:[Bv(Lv,{direction:"vertical",alignment:"start",children:Bv(Fv,{size:"sm",color:O?"error":"muted",children:z})}),Bv(Gv,{size:"sm",name:hk.MaxAmountButton,disabled:_,children:A("send.maxButton")})]})]}),g&&Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(_A,{title:A(g.title),severity:"warning",children:Bv(Fv,{children:A(g.message)})})]})]})]}),Mv(Kv,{children:[Bv(Gv,{name:hk.CancelButton,children:A("send.cancelButton")}),Bv(Gv,{name:hk.SendButton,disabled:!U,loading:p,children:A("send.continueButton")})]})]})},"transaction-confirmation":({context:e})=>{const{preferences:{currency:t,locale:n}}=e,r=tA(n),{tokenImage:o,tokenSymbol:i}=vk(e),a=wk(e),s=Ak(e),c=void 0===s?"":sA(MA(a??"0",s),t,n);return Mv(jv,{children:[Mv(Lv,{children:[Bv(dk,{title:r("send.confirmation.title"),backButtonName:"transaction-confirmation-back-button"}),Bv(kk,{title:BA(a??"0",i,n),subtitle:c,iconSrc:o}),Bv(Ik,{context:e})]}),Mv(Kv,{children:[Bv(Gv,{name:"transaction-confirmation-cancel-button",children:r("send.confirmation.cancelButton")}),Bv(Gv,{name:"transaction-confirmation-submit-button",loading:e.loading,disabled:e.loading,children:r("send.confirmation.sendButton")})]})]})},"send-pending":({context:e})=>{const t=tA(e.preferences.locale);return Bv(jv,{children:Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(kk,{title:t("send.send-pending.title"),subtitle:t("send.send-pending.subtitle"),isLoading:!0}),Bv(Ik,{context:e})]})})},"transaction-success":({context:e})=>{const{preferences:t,transaction:n,scope:r}=e,o=tA(t.locale),{tokenSymbol:i}=vk(e),a=wk(e);return Bv(jv,{children:Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(kk,{title:o("send.transaction-success.title"),subtitle:o("send.transaction-success.subtitle",{amount:aA(a??"0",t.locale),tokenSymbol:i}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.0002 3.99902C12.9802 3.99902 4.00024 12.979 4.00024 23.999C4.00024 35.019 12.9802 43.999 24.0002 43.999C35.0202 43.999 44.0002 35.019 44.0002 23.999C44.0002 12.979 35.0202 3.99902 24.0002 3.99902ZM33.5602 19.399L22.2202 30.739C21.9402 31.019 21.5602 31.179 21.1602 31.179C20.7602 31.179 20.3802 31.019 20.1002 30.739L14.4402 25.079C13.8602 24.499 13.8602 23.539 14.4402 22.959C15.0202 22.379 15.9802 22.379 16.5602 22.959L21.1602 27.559L31.4402 17.279C32.0202 16.699 32.9802 16.699 33.5602 17.279C34.1402 17.859 34.1402 18.799 33.5602 19.399Z" fill="#1C8234"/>\n</svg>\n'}),Bv(Ik,{context:e}),n?.signature?Bv(Lv,{alignment:"center",center:!0,children:Bv(Hv,{href:Zv(r,"tx",n?.signature),children:o("send.confirmation.viewTransaction")})}):null]})})},"transaction-failure":({context:e})=>{const{preferences:t}=e,n=tA(t.locale),{tokenSymbol:r}=vk(e),o=wk(e);return Bv(jv,{children:Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(kk,{title:n("send.transaction-failure.title"),subtitle:n("send.transaction-failure.subtitle",{amount:o??"0",tokenSymbol:r}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M40.8277 29.5283L29.7931 8.40143C28.3104 5.55884 26.2586 4 24 4C21.7414 4 19.6896 5.55884 18.2069 8.40143L7.17228 29.5283C5.77572 32.2241 5.62055 34.81 6.74125 36.8456C7.86194 38.8813 10.0689 40 12.9654 40H35.0346C37.9311 40 40.1381 38.8813 41.2588 36.8456C42.3795 34.81 42.2243 32.2058 40.8277 29.5283ZM22.7069 16.8375C22.7069 16.0856 23.2931 15.462 24 15.462C24.7069 15.462 25.2931 16.0856 25.2931 16.8375V26.0071C25.2931 26.759 24.7069 27.3826 24 27.3826C23.2931 27.3826 22.7069 26.759 22.7069 26.0071V16.8375ZM25.2241 32.811C25.1379 32.8844 25.0517 32.9577 24.9655 33.0311C24.8621 33.1044 24.7586 33.1595 24.6552 33.1961C24.5517 33.2511 24.4483 33.2878 24.3276 33.3062C24.2241 33.3245 24.1034 33.3428 24 33.3428C23.8965 33.3428 23.7759 33.3245 23.6552 33.3062C23.5517 33.2878 23.4483 33.2511 23.3448 33.1961C23.2414 33.1595 23.1379 33.1044 23.0345 33.0311C22.9483 32.9577 22.8621 32.8844 22.7759 32.811C22.4655 32.4626 22.2758 31.9857 22.2758 31.5089C22.2758 31.0321 22.4655 30.5553 22.7759 30.2068C22.8621 30.1335 22.9483 30.0601 23.0345 29.9868C23.1379 29.9134 23.2414 29.8584 23.3448 29.8217C23.4483 29.7667 23.5517 29.73 23.6552 29.7117C23.8793 29.6567 24.1207 29.6567 24.3276 29.7117C24.4483 29.73 24.5517 29.7667 24.6552 29.8217C24.7586 29.8584 24.8621 29.9134 24.9655 29.9868C25.0517 30.0601 25.1379 30.1335 25.2241 30.2068C25.5345 30.5553 25.7241 31.0321 25.7241 31.5089C25.7241 31.9857 25.5345 32.4626 25.2241 32.811Z" fill="#BF5208"/>\n</svg>\n'}),Bv(Ik,{context:e})]})})}},Ck=({context:e,inputToAddress:t,inputAmount:n})=>{const r=e.stage??"send-form";return Bv(_k[r],{context:e,inputToAddress:t,inputAmount:n})};function Rk(e){if(!e)return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.sol$/u.test(e)}function Pk(e,t,n){return n[e]?n[e]?.map((e=>e(t))).find((e=>null!==e))??null:null}function Nk(e){const t=Uk(e),n={[hk.SourceAccountSelector]:e.fromAccountId,[hk.AmountInput]:e.amount,[hk.DestinationAccountInput]:e.toAddress};return Object.entries(t).every((([e,t])=>{const r=n[e];return!!r&&t.every((e=>null===e(r)))}))}const Bk=(e,t)=>{const n=tA(t);return t=>{const r=""===t?{message:n(e),value:t}:null;return r?{message:r.message,value:t}:null}},Mk=(e,t)=>{const n=tA(t);return t=>{try{return Rk(t)||oc(t),null}catch{return{message:n(e),value:t}}}},Ok=e=>{const{minimumBalanceForRentExemptionSol:t,preferences:{locale:n},feeEstimatedInSol:r,selectedTokenMetadata:o}=e,i=tA(n);return n=>{if(""===n)return{message:"",value:n};const a=wk({...e,amount:n}),s=vm(a??"0"),c=bk(e),u=vm(c),l=vm(r??"0"),d=vm(t??"0"),f=(e=>bk({...e,tokenCaipId:ud[e.scope].nativeToken.caip19Id}))(e),h=vm(f),p=Sk(e);if(s.gt(u))return{message:`${i("send.insufficientBalance")}: ${c} ${o?.symbol??""}`,value:n};if(p){if(s.lt(d))return{message:i("send.amountGreatherThanMinimumBalanceForRentExemptionError",{minimumValue:t}),value:n};if(s.plus(l).plus(d).gt(u))return{message:i("send.insuffientSolToCoverFee"),value:n}}else{if(l.plus(d).gt(h))return{message:i("send.insuffientSolToCoverFee"),value:n}}return s.isZero()?{message:"",value:n}:h.isZero()?{message:i("send.insuffientSolToCoverFee"),value:n}:null}},zk=Y({scope:V([...Object.values(rd)]),account:ld,assetId:Q(Jo)}),Uk=e=>({[hk.SourceAccountSelector]:[Bk("send.fromRequiredError",e.preferences.locale)],[hk.AmountInput]:[Ok(e),Bk("send.amountRequiredError",e.preferences.locale)],[hk.DestinationAccountInput]:[Bk("send.toRequiredError",e.preferences.locale),Mk("send.toInvalidError",e.preferences.locale)]}),jk={scope:rd.Mainnet,fromAccountId:"",fromDomain:null,amount:"",destinationAddressOrDomain:null,toDomain:null,toAddress:null,domainResolutionStatus:null,feeEstimatedInSol:"0",feePaidInSol:"0",tokenCaipId:od.SolMainnet,accounts:[],currencyType:pk.TOKEN,validation:{},balances:{},assets:[],tokenPrices:{},selectedTokenMetadata:null,tokenPricesFetchStatus:"initial",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},error:null,buildingTransaction:!1,transactionMessage:null,transaction:null,stage:"send-form",minimumBalanceForRentExemptionSol:"0.002",loading:!0},Lk={[LA.OnTransactionAdded]:async({request:e})=>{try{Yl.info("[onTransactionAdded] Cronjob triggered",e),j(e,ok);const{accountId:t,metadata:n}=e.params,r=await QE.getAccountOrThrow(t);await EE.trackEventTransactionAdded(r,n)}catch(e){throw Yl.error(e),new no(e)}},[LA.OnTransactionApproved]:async({request:e})=>{try{Yl.info("[onTransactionApproved] Cronjob triggered",e),j(e,ik);const{accountId:t,metadata:n}=e.params,r=await QE.getAccountOrThrow(t);await EE.trackEventTransactionApproved(r,n)}catch(e){throw Yl.error(e),new no(e)}},[LA.OnTransactionRejected]:async({request:e})=>{try{Yl.info("[onTransactionRejected] Cronjob triggered",e),j(e,ak);const{accountId:t,metadata:n}=e.params,r=await QE.getAccountOrThrow(t);await EE.trackEventTransactionRejected(r,n)}catch(e){throw Yl.error(e),new no(e)}},[LA.RefreshSend]:async()=>{const e=Jl(Yl,"[refreshSend]");e.info("Background event triggered");const[t,n,r]=await Promise.all([DE.getAll(),AE.getKey("mapInterfaceNameToId"),Yy().catch((()=>jk.preferences))]),o=t.flatMap((e=>e.assetType)),i=n?.[Vy];if(!i)return void e.info("No send form interface found");const a=await Qy(i),s=await ME.getMultipleSpotPrices(o,r.currency);await AE.setKey("tokenPrices",s);const c={...a,tokenPrices:{...a.tokenPrices,...s}};await Hy(i,Bv(Ck,{context:c}),c),e.info("✅ Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}})},[LA.RefreshConfirmationEstimation]:async()=>{const e=Jl(Yl,"[refreshConfirmationEstimation]");e.info("Background event triggered");const t=(await AE.getKey("mapInterfaceNameToId")??{})[Ky];if(!t)return void e.info("No interface context found");const n=await Qy(t);try{if(!(n.account?.address&&n.transaction&&n.scope&&n.method))return void e.info("Context is missing required fields");if(!n.preferences?.simulateOnChainActions)return void e.info("Transaction simulation is disabled in preferences");const r={...n,scanFetchStatus:"fetching"};await Hy(t,Bv(zA,{context:qy(r)}),r);const[o,i]=await Promise.all([GE.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}),Qy(t)]),a={...i,scanFetchStatus:"fetched",scan:o};e.info("New scan fetched"),await Hy(t,Bv(zA,{context:qy(a)}),a),e.info("Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}})}catch(n){const r={...await Qy(t),scanFetchStatus:"fetched"};await Hy(t,Bv(zA,{context:qy(r)}),r),e.warn({error:n},"Could not update the interface. But rolled back status to fetched.")}},[LA.CloseWebSocketConnections]:async()=>{Yl.info("Closing all WebSocket connections via background event"),await IE.closeAllConnections()}},Dk={...Lk};var Fk={};const $k=Y({chainId:vd,domain:Q(ee()),address:Q(ee())}),Wk="Solana Name Service";var qk=function(e){return e.GetGenesisHash="getGenesisHash",e.GetLatestBlockhash="getLatestBlockhash",e.GetMinimumBalanceForRentExemption="getMinimumBalanceForRentExemption",e}({});const Vk=Y({jsonrpc:Rm,id:Pm,method:G("getGenesisHash"),params:Q(W())}),Kk=Y({jsonrpc:Rm,id:Pm,method:G("getLatestBlockhash")}),Gk=Y({jsonrpc:Rm,id:Pm,method:G("getMinimumBalanceForRentExemption"),params:te([J(),Q(Y())])}),Hk={[tw.GetFeeForTransaction]:async({request:e})=>{j(e.params,Ad);const{transaction:t}=e.params;try{const{totalFee:e}=ym.calculateFee(t),n={value:e.toString()};return j(n,bd),n}catch(e){throw Yl.error(e),new no(e)}},[tw.StartSendTransactionFlow]:async({request:e})=>{const{params:t}=e;j(t,zk);const{scope:n,account:r}=t,o=t.assetId??ud[n].nativeToken.caip19Id,i={...jk,scope:n,fromAccountId:r,tokenCaipId:o,loading:!0},[a,s,c,u]=await Promise.all([DE.getAll(),$E.getAll(),AE.getKey("tokenPrices"),Yy().catch((()=>jk.preferences))]);i.balances=function(e,t){return t.filter((t=>{const n=t.assetType===ud[e].nativeToken.caip19Id,r=t.assetType.startsWith(e),o="0"!==t.rawAmount;return n||r&&o})).reduce(((e,t)=>(e[t.keyringAccountId]={...e[t.keyringAccountId],[t.assetType]:{unit:t.symbol,amount:t.uiAmount}},e)),{})}(n,a),i.assets=a.map((e=>e.assetType)),i.accounts=s,i.preferences=u,i.tokenPrices=c??{};const l=await Gy(Bv(Ck,{context:i}),i),d=Jy(l),f=DE.getAssetsMetadata([i.tokenCaipId]).then((e=>{const t=e[i.tokenCaipId];t?.symbol&&t?.name&&(i.selectedTokenMetadata={symbol:t.symbol,name:t.name,asset:i.tokenCaipId,imageSvg:null})})).catch((()=>null));let h;i.preferences.useExternalPricingData?h=ME.getMultipleSpotPrices(i.assets,i.preferences.currency).then((e=>{i.tokenPrices={...i.tokenPrices,...e},i.tokenPricesFetchStatus="fetched"})).catch((()=>{i.tokenPricesFetchStatus="error"})):i.tokenPricesFetchStatus="fetched";const p=kE.getRpc(n).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>{i.minimumBalanceForRentExemptionSol=wm(e).toString()})).catch((()=>{}));return i.loading=!0,await Hy(l,Bv(Ck,{context:i}),i),i.loading=!1,await Promise.all([h,f,p]),await Hy(l,Bv(Ck,{context:i}),i),await AE.setKey(`mapInterfaceNameToId.${Vy}`,l),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}}),d},[nw.ListWebSockets]:async()=>(await vE.emitSync("onListWebSockets"),null),[nw.ListSubscriptions]:async()=>(await vE.emitSync("onListSubscriptions"),null),[nw.TestOnStart]:async()=>(await vE.emitSync("onStart"),null),[nw.TestOnInstall]:async()=>(await vE.emitSync("onInstall"),null),[nw.TestOnUpdate]:async()=>(await vE.emitSync("onUpdate"),null),[nw.SynchronizeAccounts]:async()=>(await KE.synchronize(),null),[nw.SetAccountSelected]:async({request:e})=>(await QE.setSelectedAccounts(e.params.accountIds),null),[nw.ConfirmSend]:async({request:e})=>(await nk.handle(e),null),[nw.SignRewardsMessage]:async({request:e})=>nk.handle({...e,method:Am.SignRewardsMessage})};const Zk=async e=>{try{return await e()}catch(e){const t=function(e){return[Xr,so,wo,co,so,uo,lo,fo,ho,po,go,mo,yo,no,ro,oo,io,ao].some((t=>e instanceof t))}(e)?e:new Xr(e);throw Yl.error({error:t},`[SnapError] ${JSON.stringify(t.toJSON(),null,2)}`),t}};var Jk=n(4255),Yk=n.n(Jk),Qk=n(3804),Xk=n.n(Qk);class eT extends Error{constructor(e="Operation cancelled"){super(e),this.name="CancellationError"}}const tT=async e=>{const{fromAccountId:t,tokenCaipId:n,scope:r,toAddress:o}=e,i=wk(e),a=await QE.getAccountOrThrow(t);if(!o||!i)throw new Error("Invalid transaction parameters");const s=n===ud[r].nativeToken.caip19Id,c=s?PE:BE,u=new Sv(c),l={from:a,to:oc(o),amount:i,network:r,...s?{}:{mint:oc(Qo(n).assetReference)}},d=await c.buildTransactionMessage(l),f=await(async e=>lu(e,Lu,Pu().encode,Ks().decode))(d);return{feeInLamports:u.getFee(),base64EncodedTransactionMessage:f}},nT=Xk()((async(e,t)=>{try{if(!Nk(t))return;const n={buildingTransaction:!0,transactionMessage:null,feeEstimatedInSol:null};await Hy(e,Bv(Ck,{context:{...t,...n}}),{...t,...n});const{feeInLamports:r,base64EncodedTransactionMessage:o}=await tT(t),i={transactionMessage:o,feeEstimatedInSol:r?wm(r).toString():null,buildingTransaction:!1},a=await Qy(e);await Hy(e,Bv(Ck,{context:{...a,...i}}),{...a,...i})}catch(t){Yl.error("Could not build the send transaction",t);const n={error:{title:"send.simulationTitleError",message:"send.simulationMessageError"},transactionMessage:null,feeEstimatedInSol:null,buildingTransaction:!1},r=await Qy(e);await Hy(e,Bv(Ck,{context:{...r,...n}}),{...r,...n})}}),(function(e){const t=(e=>(...t)=>{const n=new AbortController,r=[...t];r.some((e=>e instanceof AbortSignal))||r.push(n.signal);const o=Promise.race([e(...r),new Promise(((e,t)=>{n.signal.addEventListener("abort",(()=>{t(new eT)}))}))]);return o.cancel=()=>n.abort(),o})(e);let n=null;return async(...e)=>{if(n&&"function"==typeof n.cancel){const e="Cancelling previous task";Yl.warn(e),n.cancel()}const r=t(...e);n=r;try{return await r}finally{n===r&&(n=null)}}}),Yk()(500));const rT={[hk.BackButton]:async function({id:e}){await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)},[hk.SourceAccountSelector]:async function({id:e,event:t,context:n}){const r=t.value;n.fromAccountId=r.accountId,n.error=null,n.validation[hk.SourceAccountSelector]=Pk(hk.SourceAccountSelector,n.fromAccountId,Uk(n)),n.amount&&(n.validation[hk.AmountInput]=Pk(hk.AmountInput,n.amount,Uk(n))),await Hy(e,Bv(Ck,{context:n}),n),await nT(e,n)},[hk.AmountInput]:async function({id:e,event:t,context:n}){const r={...n};r.amount=t.value,r.error=null;const o=Pk(hk.AmountInput,r.amount,Uk(r));if(o&&r.validation[hk.AmountInput]?.message!==o?.message)return r.validation[hk.AmountInput]=o,void await Hy(e,Bv(Ck,{context:r}),r);null===o&&(r.validation[hk.AmountInput]=null,await Hy(e,Bv(Ck,{context:r}),r),await nT(e,r))},[hk.AssetSelector]:async function({id:e,event:t,context:n}){if("object"!=typeof t.value||!t.value||!("asset"in t.value))return;const r=t.value.asset;if(n.tokenCaipId===r)return;const o=r===ud[n.scope].nativeToken.caip19Id?PE:BE,i=new Sv(o).getFee(),a={tokenCaipId:r,feeEstimatedInSol:wm(i).toString(),selectedTokenMetadata:{symbol:t.value.symbol,name:t.value.name,asset:t.value.asset,imageSvg:null},amount:"",error:null},s=(0,Pd.merge)(n,a);await Hy(e,Bv(Ck,{context:s,inputAmount:""}),s),await nT(e,n)},[hk.SwapCurrencyButton]:async function({id:e,context:t}){if(t.error=null,t.currencyType=t.currencyType===pk.TOKEN?pk.FIAT:pk.TOKEN,!t.amount)return void await Hy(e,Bv(Ck,{context:t}),t);const n=jo(t.amount??"0"),{price:r}=t.tokenPrices[t.tokenCaipId]??{price:0};t.currencyType===pk.TOKEN&&(t.amount=n.dividedBy(r).toString()),t.currencyType===pk.FIAT&&(t.amount=n.multipliedBy(r).toString()),await Hy(e,Bv(Ck,{context:t,inputAmount:t.amount}),t)},[hk.MaxAmountButton]:async function({id:e,context:t}){const{currencyType:n,minimumBalanceForRentExemptionSol:r,tokenCaipId:o,tokenPrices:i}=t,a={...t},s=bk(t);if(Sk(t)){const e=vm(s),t=new Sv(PE).getFee().toString(),n=vm(r),o=e.minus(t).minus(n).minus(1),i=jo.maximum(o,o.isNegative()?e:jo(0)),c=wm(i);a.amount=c.toString()}else a.amount=s;if(n===pk.FIAT){const{price:e}=i[o]??{price:0};a.amount=MA(a.amount,e)}a.error=null,a.validation[hk.AmountInput]=Pk(hk.AmountInput,a.amount,Uk(a)),await Hy(e,Bv(Ck,{context:a,inputAmount:a.amount}),a),await nT(e,a)},[hk.DestinationAccountInput]:async function({id:e,event:t,context:n}){const r={...n};r.destinationAddressOrDomain=t.value,r.domainResolutionStatus=null,r.error=null;const o=Pk(hk.DestinationAccountInput,r.destinationAddressOrDomain,Uk(r));r.validation[hk.DestinationAccountInput]=o,Rk(r?.destinationAddressOrDomain)?(r.domainResolutionStatus="fetching",await Hy(e,Bv(Ck,{context:r}),r),r.toAddress=await jE.resolveDomain(r.scope,r.destinationAddressOrDomain).catch((()=>{const e=tA(r.preferences.locale);return r.validation[hk.DestinationAccountInput]={message:e("send.toInvalidErrorDomain"),value:r.destinationAddressOrDomain??""},null})),r.domainResolutionStatus=r.toAddress?"fetched":"error"):r.toAddress=r.destinationAddressOrDomain,await Hy(e,Bv(Ck,{context:r}),r),null===o&&await nT(e,r)},[hk.ClearButton]:async function({id:e,context:t}){t.destinationAddressOrDomain="",t.toAddress="",t.domainResolutionStatus=null,t.error=null,t.validation[hk.DestinationAccountInput]=null,await Hy(e,Bv(Ck,{context:t,inputToAddress:t.toAddress}),t)},[hk.CancelButton]:async function({id:e}){await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)},[hk.SendButton]:async function({id:e,context:t}){if(!Nk(t))return;const n={...t};n.stage="transaction-confirmation",n.loading=!0,await Hy(e,Bv(Ck,{context:n}),n);const r=t.accounts.find((e=>e.id===t.fromAccountId))?.address,[o,i,a,s]=await Promise.all([r?jE.resolveAddress(t.scope,r):null,t.toAddress?jE.resolveAddress(t.scope,t.toAddress):null,ME.getMultipleSpotPrices(t.assets,t.preferences.currency).then((e=>e)).catch((()=>null)),t.selectedTokenMetadata?Av.generateImageComponent(Rd({baseUrl:wE.get().staticApi.baseUrl,path:"/api/v2/tokenIcons/assets/{assetId}.png",pathParams:{assetId:t.selectedTokenMetadata?.asset.replace(/:/gu,"/")},encodePathParams:!1})):null]);n.fromDomain=o,n.toDomain=i,a&&(n.tokenPrices=a),s&&t.selectedTokenMetadata&&(n.selectedTokenMetadata={...t.selectedTokenMetadata,imageSvg:s}),n.loading=!1,await Hy(e,Bv(Ck,{context:n}),n),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionAdded,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:nd}}}}})}};const oT={[xk.BackButton]:async function({id:e,context:t}){const n={...t,stage:"send-form"};await Hy(e,Bv(Ck,{context:n,inputAmount:t.amount??"",inputToAddress:t.destinationAddressOrDomain??""}),n)},[xk.CancelButton]:async function({id:e,context:t}){const{fromAccountId:n,transactionMessage:r,scope:o}=t;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionRejected,params:{accountId:n,metadata:{scope:o,origin:nd}}}}}),await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)},[xk.ConfirmButton]:async function({id:e,context:t}){const{scope:n,fromAccountId:r,feeEstimatedInSol:o,transactionMessage:i}=t;if(t.error=null,!i)return t.stage="send-form",void await Hy(e,Bv(Ck,{context:t}),t);await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionApproved,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:nd}}}}});const a={...t,stage:"send-pending"};await Hy(e,Bv(Ck,{context:a}),a);let s=null;try{const e=await QE.getAccountOrThrow(r);s=(await YE.signAndSendTransaction(e,i,n,nd)).signature}catch(e){Yl.error({error:e},"Error submitting request")}const c={...t,stage:s?"transaction-success":"transaction-failure",feePaidInSol:o,transaction:{result:s?"success":"failure",signature:s}};await Hy(e,Bv(Ck,{context:c}),c),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)}};const iT=2n**255n-19n,aT=2n**252n+27742317777372353535851937790883648493n,sT=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,cT=0x6666666666666666666666666666666666666666666666666666666666666658n,uT={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:iT,n:aT,h:8,Gx:sT,Gy:cT},lT=(e="")=>{throw new Error(e)},dT=e=>"string"==typeof e,fT=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name)(e)||"number"==typeof t&&t>0&&e.length!==t?lT("Uint8Array of valid length expected"):e,hT=e=>new Uint8Array(e),pT=(e,t)=>fT(dT(e)?ST(e):hT(fT(e)),t),gT=(e,t=iT)=>{let n=e%t;return n>=0n?n:t+n},mT=e=>e instanceof yT?e:lT("Point expected");class yT{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new yT(e.x,e.y,1n,gT(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=uT,r=(e=pT(e,32)).slice(),o=e[31];r[31]=-129&o;const i=kT(r);!t||0n<=i&&i<2n**256n||lT("bad y coord 1"),t||0n<=i&&i<iT||lT("bad y coord 2");const a=gT(i*i),s=gT(a-1n),c=gT(n*a+1n);let{isValid:u,value:l}=CT(s,c);u||lT("bad y coordinate 3");const d=1n==(1n&l),f=!!(128&o);return!t&&0n===l&&f&&lT("bad y coord 3"),f!==d&&(l=gT(-l)),new yT(l,i,1n,gT(l*i))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{ex:t,ey:n,ez:r}=this,{ex:o,ey:i,ez:a}=mT(e),s=gT(t*a),c=gT(o*r),u=gT(n*a),l=gT(i*r);return s===c&&u===l}is0(){return this.equals(vT)}negate(){return new yT(gT(-this.ex),this.ey,this.ez,gT(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=uT,o=gT(e*e),i=gT(t*t),a=gT(2n*gT(n*n)),s=gT(r*o),c=e+t,u=gT(gT(c*c)-o-i),l=s+i,d=l-a,f=s-i,h=gT(u*d),p=gT(l*f),g=gT(u*f),m=gT(d*l);return new yT(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:o}=this,{ex:i,ey:a,ez:s,et:c}=mT(e),{a:u,d:l}=uT,d=gT(t*i),f=gT(n*a),h=gT(o*l*c),p=gT(r*s),g=gT((t+n)*(i+a)-d-f),m=gT(p-h),y=gT(p+h),w=gT(f-u*d),v=gT(g*m),A=gT(y*w),b=gT(g*w),S=gT(m*y);return new yT(v,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?lT("cannot multiply by 0"):vT;if("bigint"==typeof e&&0n<e&&e<aT||lT("invalid scalar, must be < L"),!t&&this.is0()||1n===e)return this;if(this.equals(wT))return KT(e).p;let n=vT,r=wT;for(let o=this;e>0n;o=o.double(),e>>=1n)1n&e?n=n.add(o):t&&(r=r.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(uT.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(aT/2n,!1).double();return e=e.add(this),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(vT))return{x:0n,y:1n};const r=IT(n);return 1n!==gT(n*r)&&lT("invalid inverse"),{x:gT(e*r),y:gT(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=ET(t);return n[31]|=1n&e?128:0,n}toHex(){return bT(this.toRawBytes())}}yT.BASE=new yT(sT,cT,1n,gT(sT*cT)),yT.ZERO=new yT(0n,1n,1n,0n);const{BASE:wT,ZERO:vT}=yT,AT=(e,t)=>e.toString(16).padStart(t,"0"),bT=e=>Array.from(e).map((e=>AT(e,2))).join(""),ST=e=>{const t=e.length;(!dT(e)||t%2)&&lT("hex invalid 1");const n=hT(t/2);for(let t=0;t<n.length;t++){const r=2*t,o=e.slice(r,r+2),i=Number.parseInt(o,16);(Number.isNaN(i)||i<0)&&lT("hex invalid 2"),n[t]=i}return n},ET=e=>ST(AT(e,64)).reverse(),kT=e=>BigInt("0x"+bT(hT(fT(e)).reverse())),TT=(...e)=>{const t=hT(e.reduce(((e,t)=>e+fT(t).length),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.length})),t},IT=(e,t=iT)=>{(0n===e||t<=0n)&&lT("no inverse n="+e+" mod="+t);let n=gT(e,t),r=t,o=0n,i=1n,a=1n,s=0n;for(;0n!==n;){const e=r/n,t=r%n,c=o-a*e,u=i-s*e;r=n,n=t,o=a,i=s,a=c,s=u}return 1n===r?gT(o,t):lT("no inverse")},xT=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=iT;return n},_T=19681161376707505956807079304988542015446066515923890162744021073123829784752n,CT=(e,t)=>{const n=gT(t*t*t),r=(e=>{const t=e*e%iT*e%iT,n=xT(t,2n)*t%iT,r=xT(n,1n)*e%iT,o=xT(r,5n)*r%iT,i=xT(o,10n)*o%iT,a=xT(i,20n)*i%iT,s=xT(a,40n)*a%iT,c=xT(s,80n)*s%iT,u=xT(c,80n)*s%iT,l=xT(u,10n)*o%iT;return{pow_p_5_8:xT(l,2n)*e%iT,b2:t}})(e*gT(n*n*t)).pow_p_5_8;let o=gT(e*n*r);const i=gT(t*o*o),a=o,s=gT(o*_T),c=i===e,u=i===gT(-e),l=i===gT(-e*_T);return c&&(o=a),(u||l)&&(o=s),1n==(1n&gT(o))&&(o=gT(-o)),{isValid:c||u,value:o}},RT=e=>gT(kT(e),aT);let PT;const NT=(...e)=>WT.sha512Async(...e),BT=(...e)=>"function"==typeof PT?PT(...e):lT("etc.sha512Sync not set"),MT=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=RT(t),o=wT.mul(r),i=o.toRawBytes();return{head:t,prefix:n,scalar:r,point:o,pointBytes:i}},OT=e=>NT(pT(e,32)).then(MT),zT=e=>MT(BT(pT(e,32))),UT=e=>OT(e).then((e=>e.pointBytes));function jT(e,t){return e?NT(t.hashable).then(t.finish):t.finish(BT(t.hashable))}const LT=(e,t,n)=>{const{pointBytes:r,scalar:o}=e,i=RT(t),a=wT.mul(i).toRawBytes();return{hashable:TT(a,r,n),finish:e=>{const t=gT(i+RT(e)*o,aT);return fT(TT(a,ET(t)),64)}}},DT={zip215:!0},FT=(e,t,n,r=DT)=>{t=pT(t),e=pT(e,64);const{zip215:o}=r;let i,a,s,c,u=new Uint8Array;try{i=yT.fromHex(n,o),a=yT.fromHex(e.slice(0,32),o),s=kT(e.slice(32,64)),c=wT.mul(s,!1),u=TT(a.toRawBytes(),i.toRawBytes(),t)}catch(e){}return{hashable:u,finish:e=>{if(null==c)return!1;if(!o&&i.isSmallOrder())return!1;const t=RT(e);return a.add(i.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},$T=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,WT={bytesToHex:bT,hexToBytes:ST,concatBytes:TT,mod:gT,invert:IT,randomBytes:(e=32)=>{const t=$T();return t&&t.getRandomValues||lT("crypto.getRandomValues must be defined"),t.getRandomValues(hT(e))},sha512Async:async(...e)=>{const t=$T();t&&t.subtle||lT("crypto.subtle or etc.sha512Async must be defined");const n=TT(...e);return hT(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(WT,{sha512Sync:{configurable:!1,get:()=>PT,set(e){PT||(PT=e)}}});const qT={getExtendedPublicKeyAsync:OT,getExtendedPublicKey:zT,randomPrivateKey:()=>WT.randomBytes(32),precompute:(e=8,t=wT)=>(t.multiply(3n),t)};let VT;const KT=e=>{const t=VT||(VT=(()=>{const e=[];let t=wT,n=t;for(let r=0;r<33;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e})()),n=(e,t)=>{let n=t.negate();return e?n:t};let r=vT,o=wT;const i=BigInt(255),a=BigInt(8);for(let s=0;s<33;s++){const c=128*s;let u=Number(e&i);e>>=a,u>128&&(u-=256,e+=1n);const l=c,d=c+Math.abs(u)-1,f=s%2!=0,h=u<0;0===u?o=o.add(n(f,t[l])):r=r.add(n(h,t[d]))}return{p:r,f:o}};function GT(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var HT=n(1048).hp;const ZT="8d9df0f7-1363-4d2c-8152-ce4ed78f27d8",JT=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function YT(e){return HT.from(e).toString("base64").replace(/\+/gu,"-").replace(/\//gu,"_").replace(/[=]/gu,"")}function QT(e){const t=e.replace(/-/gu,"+").replace(/_/gu,"/");return new Uint8Array(HT.from(t,"base64"))}async function XT(e,t,n){if("private"!==t.type)throw new DOMException("Key is not private","NotAllowedError");if(!t.usages.includes("sign"))throw new DOMException("Key usage not allowed","NotAllowedError");const r=GT(n),o=t[ZT],i=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(await(async(e,t)=>{const n=pT(e),r=await OT(t),o=await NT(r.prefix,n);return jT(!0,LT(r,o,n))})(r,o));return i}async function eI(e,t,n,r){if("public"!==t.type)throw new DOMException("Key is not public","NotAllowedError");if(!t.usages.includes("verify"))throw new DOMException("Key usage not allowed","NotAllowedError");const o=GT(n),i=GT(r),a=t[ZT];return await(async(e,t,n,r=DT)=>jT(!0,FT(e,t,n,r)))(o,i,a)}function tI(e){return"Ed25519"===e||"object"==typeof e&&"Ed25519"===e.name}function nI(){const{subtle:e}=globalThis.crypto;Object.defineProperty(globalThis,"isSecureContext",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,"generateKey",{value:async(...e)=>tI(e[0])?await async function(e,t,n){const r=qT.randomPrivateKey(),o=await UT(r),i=Array.from(n);return{privateKey:{algorithm:{name:"Ed25519"},extractable:t,type:"private",usages:i,[ZT]:r},publicKey:{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i,[ZT]:o}}}(...e):await globalThis.crypto.subtle.generateKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"exportKey",{value:async(...e)=>tI(e[1].algorithm)?await async function(e,t){if(!t.extractable)throw new DOMException("key is not extractable","InvalidAccessException");const n=t[ZT];switch(e){case"raw":if("public"!==t.type)throw new DOMException("Unable to export a raw Ed25519 private key","InvalidAccessError");return n.buffer;case"pkcs8":if("private"!==t.type)throw new DOMException("Unable to export a pkcs8 Ed25519 public key","InvalidAccessError");return new Uint8Array([...JT,...n]).buffer;case"jwk":{const e={crv:"Ed25519",ext:t.extractable,key_ops:t.usages,kty:"OKP"};if("private"===t.type){const t=await UT(n);return Object.freeze({...e,d:YT(n),x:YT(t)})}return Object.freeze({...e,x:YT(n)})}case"spki":{if("public"!==t.type)throw new DOMException("Only public keys can be exported as SPKI","InvalidAccessError");const e=new Uint8Array([48,5,6,3,43,101,112]),r=new Uint8Array([3,n.length+1,0,...n]);return new Uint8Array([48,e.length+r.length,...e,...r]).buffer}default:throw new Error(`Unsupported export format: ${e}`)}}(...e):await globalThis.crypto.subtle.exportKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"sign",{value:async(...e)=>{const[t,n]=e;return tI(t)&&tI(n.algorithm)?await XT(...e):await globalThis.crypto.subtle.sign(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"verify",{value:async(...e)=>{const[t,n]=e;return tI(t)&&tI(n.algorithm)?await eI(...e):await globalThis.crypto.subtle.verify(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"importKey",{value:async(...e)=>tI(e[2])?await async function(e,t,n,r,o){const i=Array.from(o);switch(e){case"raw":{const e=GT(t);if(32!==e.length)throw new DOMException("Ed25519 raw keys must be exactly 32-bytes","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"public",usages:i.filter((e=>"verify"===e)),[ZT]:e}}case"pkcs8":{const e=GT(t);if(48!==e.length)throw new DOMException("Invalid PKCS8 key data length","DataError");if(!e.slice(0,16).every(((e,t)=>e===JT[t])))throw new DOMException("Invalid PKCS8 header","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"private",usages:i.filter((e=>"sign"===e)),[ZT]:e.slice(16)}}case"jwk":{const e=t;if("OKP"!==e.kty||"Ed25519"!==e.crv)throw new DOMException("Invalid Ed25519 JWK","DataError");const n="d"in e?"private":"public";if("public"===n&&!e.x)throw new DOMException("Ed25519 JWK is missing public key","DataError");if(!("private"!==n||e.d&&e.x))throw new DOMException("Ed25519 JWK is missing key data","DataError");const o="private"===n?e.d:e.x;return{algorithm:{name:"Ed25519"},extractable:r,type:n,usages:i.filter((e=>"private"===n?"sign"===e:"verify"===e)),[ZT]:QT(o)}}case"spki":{const e=GT(t);if(48!==e[0])throw new DOMException("Invalid SPKI format","DataError");const n=2;if(48!==e[n]||6!==e[n+2]||3!==e[n+3]||43!==e[n+4]||101!==e[n+5]||112!==e[n+6])throw new DOMException("Not an Ed25519 key","DataError");const r=n+7+2;return{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i.filter((e=>"verify"===e)),[ZT]:e.slice(r)}}default:throw new Error(`Unsupported import format: ${e}`)}}(...e):await globalThis.crypto.subtle.importKey(...e),writable:!0,configurable:!0})}const rI=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,"DOMException",{value:Error,writable:!0,configurable:!0,enumerable:!0}),nI(),Object.defineProperty(globalThis,"queueMicrotask",{value:rI,writable:!0,configurable:!0,enumerable:!0}),jo.config({EXPONENTIAL_AT:16});const oI=async({origin:e,request:t})=>{Yl.log("[🔄 onRpcRequest]",t.method,t);const{method:n}=t;gw(e,n);const r=Hk[n];if(!r)throw new so(`RpcRequest method ${n} not found. Available methods: ${Object.values(tw).toString()}`);return await Zk((async()=>r({origin:e,request:t})))??null},iI=async({origin:e,request:t})=>{Yl.log("[🔑 onKeyringRequest]",t.method,t),gw(e,t.method),t.method===ln.SubmitRequest&&t.params&&!("origin"in t.params)&&(t.params.origin="https://metamask.io");return await Zk((async()=>Bn(QE,t)))??null},aI=async({id:e,event:t,context:n})=>{if(Yl.log("[👇 onUserInput]",e,t),!t.name)return;const r={...rT,...oT,...EA,...AA,...yA}[t.name];r&&await Zk((async()=>r({id:e,event:t,context:n,snapContext:rk})))},sI=async({request:e})=>{const t=Jl(Yl,"[⏱️ onCronjob]");t.log(e.method,e);const{method:n}=e;j(n,V([...Object.values(Fk),...Object.values(LA)]));return await Zk((async()=>{t.log("Running cronjob",{method:n});const r=Dk[n];if(!r)throw new so(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${Object.values([...Object.values(Fk),...Object.values(LA)]).toString()}`);return r({request:e})}))??null},cI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[🔍 onAssetsLookup]",e);const{assets:t}=e,n=t.filter((e=>{const{assetNamespace:t}=Qo(e);return"token"===t||"slip44"===t}));return{assets:await DE.getAssetsMetadata(n)}})(e)));return t??null},uI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[💱 onAssetsConversion]",e);const{conversions:t}=e;return{conversionRates:await UE.getMultipleTokenConversions(t)}})(e)));return t??null},lI=async e=>await Zk((async()=>(async({scope:e,request:t})=>{switch(j(e,vd),t.method){case qk.GetGenesisHash:return j(t,Vk),kE.getRpc(e).getGenesisHash().send();case qk.GetLatestBlockhash:return j(t,Kk),(await kE.getLatestBlockhash(e)).blockhash;case qk.GetMinimumBalanceForRentExemption:return j(t,Gk),(await kE.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)))??null,dI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[📈 onAssetHistoricalPrice]",e);const{from:t,to:n}=e;return j(t,Jo),j(n,Jo),{historicalPrice:await UE.getHistoricalPrice(t,n)}})(e)));return t??null},fI=async({request:e})=>await Zk((async()=>nk.handle(e)))??null,hI=async({event:e})=>Zk((async()=>{await vE.emitSync("onWebSocketEvent",e)})),pI=async()=>Zk((async()=>{await vE.emitSync("onStart")})),gI=async()=>Zk((async()=>{await vE.emitSync("onUpdate")})),mI=async()=>Zk((async()=>{await vE.emitSync("onInstall")})),yI=async()=>Zk((async()=>{await vE.emitSync("onActive")})),wI=async()=>Zk((async()=>{await vE.emitSync("onInactive")})),vI=async e=>{const t=await Zk((async()=>(async e=>{j(e,$k);const{chainId:t,domain:n,address:r}=e,o=new RegExp(`^.+\\${jE.tld}$`,"u");if(n&&o.test(n)){const e=await jE.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:Wk,domainName:n}]}}if(r){const e=await jE.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:Wk}]}}return null})(e)));return t??null},AI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[💰 onAssetsMarketData]",e);const{assets:t}=e;return{marketData:await DE.fetchAssetsMarketData(t)}})(e)));return t??null}})(),module.exports=r})();
1
+ (()=>{var e={33:(e,t,n)=>{var r=n(9968),o=n(9756),i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(e,t){return r(i,(function(n){var r="_."+n[0];t&n[1]&&!o(e,r)&&e.push(r)})),e.sort()}},88:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).get(e)}},125:(e,t,n)=>{var r=n(9032),o=n(5288);e.exports=function(e,t){return e&&r(t,o(t),e)}},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},195:(e,t,n)=>{var r=n(4882),o=n(8121),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},282:e=>{e.exports=a,a.default=a,a.stable=l,a.stableStringify=l;var t="[...]",n="[Circular]",r=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(e,t,n,a){var s;void 0===a&&(a=i()),c(e,"",0,[],void 0,0,a);try{s=0===o.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function s(e,t,n,i){var a=Object.getOwnPropertyDescriptor(i,n);void 0!==a.get?a.configurable?(Object.defineProperty(i,n,{value:e}),r.push([i,n,t,a])):o.push([t,n,e]):(i[n]=e,r.push([i,n,t]))}function c(e,r,o,i,a,u,l){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<i.length;d++)if(i[d]===e)return void s(n,e,r,a);if(void 0!==l.depthLimit&&u>l.depthLimit)return void s(t,e,r,a);if(void 0!==l.edgesLimit&&o+1>l.edgesLimit)return void s(t,e,r,a);if(i.push(e),Array.isArray(e))for(d=0;d<e.length;d++)c(e[d],d,d,i,e,u,l);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var h=f[d];c(e[h],h,d,i,e,u,l)}}i.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,n,a){void 0===a&&(a=i());var s,c=d(e,"",0,[],void 0,0,a)||e;try{s=0===o.length?JSON.stringify(c,t,n):JSON.stringify(c,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function d(e,o,i,a,c,l,f){var h;if(l+=1,"object"==typeof e&&null!==e){for(h=0;h<a.length;h++)if(a[h]===e)return void s(n,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&l>f.depthLimit)return void s(t,e,o,c);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void s(t,e,o,c);if(a.push(e),Array.isArray(e))for(h=0;h<e.length;h++)d(e[h],h,h,a,e,l,f);else{var p={},g=Object.keys(e).sort(u);for(h=0;h<g.length;h++){var m=g[h];d(e[m],m,h,a,e,l,f),p[m]=e[m]}if(void 0===c)return p;r.push([c,o,e]),c[o]=p}a.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(o.length>0)for(var r=0;r<o.length;r++){var i=o[r];if(i[1]===t&&i[0]===n){n=i[2],o.splice(r,1);break}}return e.call(this,t,n)}}},313:(e,t,n)=>{var r=n(1129),o=n(714);e.exports=function e(t,n,i,a,s){var c=-1,u=t.length;for(i||(i=o),s||(s=[]);++c<u;){var l=t[c];n>0&&i(l)?n>1?e(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},353:(e,t,n)=>{var r=n(1340),o=n(3934),i=n(8861),a=n(1182),s=n(8486),c=n(3142),u=n(5853),l=n(8666),d="[object Arguments]",f="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,g,m,y){var w=c(e),v=c(t),A=w?f:s(e),b=v?f:s(t),S=(A=A==d?h:A)==h,E=(b=b==d?h:b)==h,k=A==b;if(k&&u(e)){if(!u(t))return!1;w=!0,S=!1}if(k&&!S)return y||(y=new r),w||l(e)?o(e,t,n,g,m,y):i(e,t,A,n,g,m,y);if(!(1&n)){var T=S&&p.call(e,"__wrapped__"),I=E&&p.call(t,"__wrapped__");if(T||I){var x=T?e.value():e,_=I?t.value():t;return y||(y=new r),m(x,_,n,g,y)}}return!!k&&(y||(y=new r),a(e,t,n,g,m,y))}},358:(e,t,n)=>{var r=n(6137),o=n(3283),i=n(3142),a=n(5853),s=n(9632),c=n(8666),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),d=!n&&!l&&a(e),f=!n&&!l&&!d&&c(e),h=n||l||d||f,p=h?r(e.length,String):[],g=p.length;for(var m in e)!t&&!u.call(e,m)||h&&("length"==m||d&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||p.push(m);return p}},393:(e,t,n)=>{var r=n(8244),o=n(7979),i=n(1211);e.exports=function(e){return r(e,i,o)}},424:(e,t,n)=>{var r=n(8898),o=n(2480),i=n(8340),a=n(8069),s=n(2264);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return i(e);case"[object Symbol]":return a(e)}}},441:(e,t,n)=>{var r=n(7379),o=n(547),i=n(8360);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!i(e)}},528:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},674:(e,t,n)=>{var r=n(7379),o=n(5387),i=n(547),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[r(e)]}},714:(e,t,n)=>{var r=n(5650),o=n(3283),i=n(3142),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(a&&e&&e[a])}},777:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},796:(e,t,n)=>{var r=n(7403),o=n(3316)(r);e.exports=o},864:(e,t,n)=>{var r=n(8638),o=n(1439),i=o((function(e,t){return r(e,256,void 0,void 0,void 0,t)}));e.exports=i},961:(e,t,n)=>{var r=n(3476),o=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=r[t],i=o.call(r,t)?n.length:0;i--;){var a=n[i],s=a.func;if(null==s||s==e)return a.name}return t}},1048:(e,t,n)=>{"use strict";const r=n(7991),o=n(9318),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(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 d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(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(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(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 c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.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 l(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 d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(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,c.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(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 o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(o)return r?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function m(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 R(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){let i,a=1,s=e.length,c=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,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;i<s;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*a}else-1!==r&&(i-=i-r),r=-1}else for(n+c>s&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function A(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(J(r))return a;e[n+a]=r}return a}function b(e,t,n,r){return H(K(t,e.length-n),e,n,r)}function S(e,t,n,r){return H(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 E(e,t,n,r){return H(G(t),e,n,r)}function k(e,t,n,r){return H(function(e,t){let n,r,o;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=x));return n}(r)}c.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}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.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 o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.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)y(this,t,t+1);return this},c.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)y(this,t,t+3),y(this,t+1,t+2);return this},c.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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<s;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.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 o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function _(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function C(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function R(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Y[e[r]];return o}function P(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function N(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 B(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;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 O(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;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 z(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.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,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){W(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,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){W(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],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){W(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)})),c.prototype.readBigInt64BE=Q((function(e){W(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)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(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},c.prototype.writeBigInt64LE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.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 o=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),o},c.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&&!c.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 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{const i=c.isBuffer(e)?e:c.from(e,r),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%a]}return this};const L={};function D(e,t,n){L[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 F(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 $(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new L.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||q(t,e.length-(n+1))}(r,o,i)}function W(e,t){if("number"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,"number",e)}function q(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new L.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function K(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.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;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},1112:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},1129:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},1182:(e,t,n)=>{var r=n(393),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,a,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var d=l;d--;){var f=u[d];if(!(c?f in t:o.call(t,f)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var g=!0;s.set(e,t),s.set(t,e);for(var m=c;++d<l;){var y=e[f=u[d]],w=t[f];if(i)var v=c?i(w,y,f,t,e,s):i(y,w,f,e,t,s);if(!(void 0===v?y===w||a(y,w,n,i,s):v)){g=!1;break}m||(m="constructor"==f)}if(g&&!m){var A=e.constructor,b=t.constructor;A==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof A&&A instanceof A&&"function"==typeof b&&b instanceof b||(g=!1)}return s.delete(e),s.delete(t),g}},1187:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},1211:(e,t,n)=>{var r=n(358),o=n(195),i=n(6529);e.exports=function(e){return i(e)?r(e):o(e)}},1340:(e,t,n)=>{var r=n(1386),o=n(4103),i=n(1779),a=n(4162),s=n(7462),c=n(6638);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=o,u.prototype.delete=i,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,e.exports=u},1386:(e,t,n)=>{var r=n(2393),o=n(2049),i=n(7144),a=n(7452),s=n(3964);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},1439:(e,t,n)=>{var r=n(5857),o=n(5234),i=n(796);e.exports=function(e){return i(o(e,void 0,r),e+"")}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},1623:(e,t,n)=>{var r=n(8942).Uint8Array;e.exports=r},1779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},1877:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1935:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},1942:(e,t,n)=>{var r=n(528),o=n(1439),i=n(5196),a=n(961),s=n(3142),c=n(6648);e.exports=function(e){return o((function(t){var n=t.length,o=n,u=r.prototype.thru;for(e&&t.reverse();o--;){var l=t[o];if("function"!=typeof l)throw new TypeError("Expected a function");if(u&&!d&&"wrapper"==a(l))var d=new r([],!0)}for(o=d?o:n;++o<n;){l=t[o];var f=a(l),h="wrapper"==f?i(l):void 0;d=h&&c(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?d[a(h[0])].apply(d,h[3]):1==l.length&&c(l)?d[f]():d.thru(l)}return function(){var e=arguments,r=e[0];if(d&&1==e.length&&s(r))return d.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}},1950:(e,t,n)=>{var r=n(8942)["__core-js_shared__"];e.exports=r},2049:(e,t,n)=>{var r=n(7034),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}},2053:e=>{e.exports=function(e){return e}},2264:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},2291:(e,t,n)=>{var r=n(5650),o=n(5111),i=n(3142),a=n(1187),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(a(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},2306:(e,t,n)=>{e=n.nmd(e);var r=n(4967),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o&&r.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},2343:(e,t,n)=>{var r=n(4687),o=n(6123),i=n(7276),a=n(5187),s=n(7267),c=n(3904),u=n(6040);e.exports=function(e,t){return a(e)&&s(t)?c(u(e),t):function(n){var a=o(n,e);return void 0===a&&a===t?i(n,e):r(t,a,3)}}},2393:e=>{e.exports=function(){this.__data__=[],this.size=0}},2443:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(3504),a=n(4216),s=n(6850),c=n(8813),u=n(8942);e.exports=function(e,t,n){var l=o(e);return function o(){for(var d=arguments.length,f=Array(d),h=d,p=s(o);h--;)f[h]=arguments[h];var g=d<3&&f[0]!==p&&f[d-1]!==p?[]:c(f,p);return(d-=g.length)<n?a(e,t,i,o.placeholder,void 0,f,g,void 0,void 0,n-d):r(this&&this!==u&&this instanceof o?l:e,this,f)}}},2478:(e,t,n)=>{var r=n(7250),o=n(9454),i=n(7706);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},2480:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},2532:(e,t,n)=>{var r=n(4715),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},2590:(e,t,n)=>{var r=n(9334),o=n(3334);e.exports=function(e){return o("function"==typeof e?e:r(e,1))}},2613:(e,t,n)=>{var r=n(5111),o=n(4354),i=n(3142),a=n(1187),s=n(6493),c=n(6040),u=n(5243);e.exports=function(e){return i(e)?r(e,c):a(e)?[e]:o(s(u(e)))}},2619:e=>{e.exports=function(e){return function(){return e}}},2673:(e,t,n)=>{var r=n(3579),o=n(8055);e.exports=function(e,t,n){return r(o,e,t,n)}},2762:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},2784:(e,t,n)=>{var r=n(1580),o=n(4495),i=n(6131),a=Math.max,s=Math.min;e.exports=function(e,t,n){var c,u,l,d,f,h,p=0,g=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function w(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function v(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function A(){var e=o();if(v(e))return b(e);f=setTimeout(A,function(e){var n=t-(e-h);return m?s(n,l-(e-p)):n}(e))}function b(e){return f=void 0,y&&c?w(e):(c=u=void 0,d)}function S(){var e=o(),n=v(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(A,t),g?w(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(A,t),w(h)}return void 0===f&&(f=setTimeout(A,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,l=(m="maxWait"in n)?a(i(n.maxWait)||0,t):l,y="trailing"in n?!!n.trailing:y),S.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},S.flush=function(){return void 0===f?d:b(o())},S}},2846:(e,t,n)=>{var r=n(9334);e.exports=function(e){return r(e,4)}},2879:(e,t,n)=>{var r=n(1942)();e.exports=r},2945:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},2991:e=>{e.exports={}},3092:(e,t,n)=>{var r=n(2673)("flow",n(2879));r.placeholder=n(2991),e.exports=r},3103:(e,t,n)=>{var r=n(4715)(n(8942),"DataView");e.exports=r},3142:e=>{var t=Array.isArray;e.exports=t},3212:(e,t,n)=>{var r=n(8250),o=n(1877),i=n(8006);function a(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,e.exports=a},3282:(e,t,n)=>{var r=n(2762),o=n(8880),i=n(5187),a=n(6040);e.exports=function(e){return i(e)?r(a(e)):o(e)}},3283:(e,t,n)=>{var r=n(6027),o=n(547),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},3301:(e,t,n)=>{var r=n(6131),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},3305:(e,t,n)=>{var r=n(4497);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},3316:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var o=t(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},3321:(e,t,n)=>{var r=n(7553),o=n(528),i=n(5962),a=n(3142),s=n(547),c=n(3410),u=Object.prototype.hasOwnProperty;function l(e){if(s(e)&&!a(e)&&!(e instanceof r)){if(e instanceof o)return e;if(u.call(e,"__wrapped__"))return c(e)}return new o(e)}l.prototype=i.prototype,l.prototype.constructor=l,e.exports=l},3334:(e,t,n)=>{var r=n(6526),o=n(2343),i=n(2053),a=n(3142),s=n(3282);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):s(e)}},3410:(e,t,n)=>{var r=n(7553),o=n(528),i=n(4354);e.exports=function(e){if(e instanceof r)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},3422:(e,t,n)=>{var r=n(7073),o=n(6285),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},3476:e=>{e.exports={}},3504:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(3816),a=n(4364),s=n(4216),c=n(6850),u=n(6591),l=n(8813),d=n(8942);e.exports=function e(t,n,f,h,p,g,m,y,w,v){var A=128&n,b=1&n,S=2&n,E=24&n,k=512&n,T=S?void 0:a(t);return function I(){for(var x=arguments.length,_=Array(x),C=x;C--;)_[C]=arguments[C];if(E)var R=c(I),P=i(_,R);if(h&&(_=r(_,h,p,E)),g&&(_=o(_,g,m,E)),x-=P,E&&x<v){var N=l(_,R);return s(t,n,e,I.placeholder,f,_,N,y,w,v-x)}var B=b?f:this,M=S?B[t]:t;return x=_.length,y?_=u(_,y):k&&x>1&&_.reverse(),A&&w<x&&(_.length=w),this&&this!==d&&this instanceof I&&(M=T||a(M)),M.apply(B,_)}}},3526:(e,t,n)=>{var r=n(3142),o=n(5187),i=n(6493),a=n(5243);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(a(e))}},3546:(e,t,n)=>{var r=n(9032),o=n(7979);e.exports=function(e,t){return r(e,o(e),t)}},3565:(e,t)=>{t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},t.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},t.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},t.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},t.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,n=t.aliasToReal,r={};for(var o in n){var i=n[o];e.call(r,i)?r[i].push(o):r[i]=[o]}return r}(),t.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},t.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},t.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},3579:(e,t,n)=>{var r=n(3565),o=n(2991),i=Array.prototype.push;function a(e,t){return 2==t?function(t,n){return e(t,n)}:function(t){return e(t)}}function s(e){for(var t=e?e.length:0,n=Array(t);t--;)n[t]=e[t];return n}function c(e,t){return function(){var n=arguments.length;if(n){for(var r=Array(n);n--;)r[n]=arguments[n];var o=r[0]=t.apply(void 0,r);return e.apply(void 0,r),o}}}e.exports=function e(t,n,u,l){var d="function"==typeof n,f=n===Object(n);if(f&&(l=u,u=n,n=void 0),null==u)throw new TypeError;l||(l={});var h=!("cap"in l)||l.cap,p=!("curry"in l)||l.curry,g=!("fixed"in l)||l.fixed,m=!("immutable"in l)||l.immutable,y=!("rearg"in l)||l.rearg,w=d?u:o,v="curry"in l&&l.curry,A="fixed"in l&&l.fixed,b="rearg"in l&&l.rearg,S=d?u.runInContext():void 0,E=d?u:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isError:t.isError,isFunction:t.isFunction,isWeakMap:t.isWeakMap,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},k=E.ary,T=E.assign,I=E.clone,x=E.curry,_=E.forEach,C=E.isArray,R=E.isError,P=E.isFunction,N=E.isWeakMap,B=E.keys,M=E.rearg,O=E.toInteger,z=E.toPath,U=B(r.aryMethod),j={castArray:function(e){return function(){var t=arguments[0];return C(t)?e(s(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[1],n=e(arguments[0],t),r=n.length;return h&&"number"==typeof t?(t=t>2?t-2:1,r&&r<=t?n:a(n,t)):n}},mixin:function(e){return function(t){var n=this;if(!P(n))return e(n,Object(t));var r=[];return _(B(t),(function(e){P(t[e])&&r.push([e,n.prototype[e]])})),e(n,Object(t)),_(r,(function(e){var t=e[1];P(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]})),n}},nthArg:function(e){return function(t){var n=t<0?1:O(t)+1;return x(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return x(e(t,n),r)}},runInContext:function(n){return function(r){return e(t,n(r),l)}}};function L(e,t){if(h){var n=r.iterateeRearg[e];if(n)return function(e,t){return q(e,(function(e){var n=t.length;return function(e,t){return 2==t?function(t,n){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}}(M(a(e,n),t),n)}))}(t,n);var o=!d&&r.iterateeAry[e];if(o)return function(e,t){return q(e,(function(e){return"function"==typeof e?a(e,t):e}))}(t,o)}return t}function D(e,t,n){if(g&&(A||!r.skipFixed[e])){var o=r.methodSpread[e],a=o&&o.start;return void 0===a?k(t,n):function(e,t){return function(){for(var n=arguments.length,r=n-1,o=Array(n);n--;)o[n]=arguments[n];var a=o[t],s=o.slice(0,t);return a&&i.apply(s,a),t!=r&&i.apply(s,o.slice(t+1)),e.apply(this,s)}}(t,a)}return t}function F(e,t,n){return y&&n>1&&(b||!r.skipRearg[e])?M(t,r.methodRearg[e]||r.aryRearg[n]):t}function $(e,t){for(var n=-1,r=(t=z(t)).length,o=r-1,i=I(Object(e)),a=i;null!=a&&++n<r;){var s=t[n],c=a[s];null==c||P(c)||R(c)||N(c)||(a[s]=I(n==o?c:Object(c))),a=a[s]}return i}function W(t,n){var o=r.aliasToReal[t]||t,i=r.remap[o]||o,a=l;return function(t){var r=d?S:E,s=d?S[i]:n,c=T(T({},a),t);return e(r,o,s,c)}}function q(e,t){return function(){var n=arguments.length;if(!n)return e();for(var r=Array(n);n--;)r[n]=arguments[n];var o=y?0:n-1;return r[o]=t(r[o]),e.apply(void 0,r)}}function V(e,t,n){var o,i=r.aliasToReal[e]||e,a=t,u=j[i];return u?a=u(t):m&&(r.mutate.array[i]?a=c(t,s):r.mutate.object[i]?a=c(t,function(e){return function(t){return e({},t)}}(t)):r.mutate.set[i]&&(a=c(t,$))),_(U,(function(e){return _(r.aryMethod[e],(function(t){if(i==t){var n=r.methodSpread[i],s=n&&n.afterRearg;return o=s?D(i,F(i,a,e),e):F(i,D(i,a,e),e),o=function(e,t,n){return v||p&&n>1?x(t,n):t}(0,o=L(i,o),e),!1}})),!o})),o||(o=a),o==t&&(o=v?x(o,1):function(){return t.apply(this,arguments)}),o.convert=W(i,t),o.placeholder=t.placeholder=n,o}if(!f)return V(n,u,w);var K=u,G=[];return _(U,(function(e){_(r.aryMethod[e],(function(e){var t=K[r.remap[e]||e];t&&G.push([e,V(e,t,K)])}))})),_(B(K),(function(e){var t=K[e];if("function"==typeof t){for(var n=G.length;n--;)if(G[n][0]==e)return;t.convert=W(e,t),G.push([e,t])}})),_(G,(function(e){K[e[0]]=e[1]})),K.convert=function(e){return K.runInContext.convert(e)(void 0)},K.placeholder=K,_(B(K),(function(e){_(r.realToAlias[e]||[],(function(t){K[t]=K[e]}))})),K}},3636:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},3650:(e,t,n)=>{var r=n(8244),o=n(5832),i=n(5288);e.exports=function(e){return r(e,i,o)}},3655:(e,t,n)=>{var r=n(7379),o=n(1580);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},3766:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},3804:(e,t,n)=>{e.exports=n(3092)},3816:e=>{e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},3904:e=>{e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},3934:(e,t,n)=>{var r=n(3212),o=n(6465),i=n(5568);e.exports=function(e,t,n,a,s,c){var u=1&n,l=e.length,d=t.length;if(l!=d&&!(u&&d>l))return!1;var f=c.get(e),h=c.get(t);if(f&&h)return f==t&&h==e;var p=-1,g=!0,m=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++p<l;){var y=e[p],w=t[p];if(a)var v=u?a(w,y,p,t,e,c):a(y,w,p,e,t,c);if(void 0!==v){if(v)continue;g=!1;break}if(m){if(!o(t,(function(e,t){if(!i(m,t)&&(y===e||s(y,e,n,a,c)))return m.push(t)}))){g=!1;break}}else if(y!==w&&!s(y,w,n,a,c)){g=!1;break}}return c.delete(e),c.delete(t),g}},3943:(e,t,n)=>{var r=n(1935),o=n(9460),i=n(2306),a=i&&i.isSet,s=a?o(a):r;e.exports=s},3964:(e,t,n)=>{var r=n(7034);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},4103:(e,t,n)=>{var r=n(1386);e.exports=function(){this.__data__=new r,this.size=0}},4162:e=>{e.exports=function(e){return this.__data__.get(e)}},4216:(e,t,n)=>{var r=n(6648),o=n(5512),i=n(5620);e.exports=function(e,t,n,a,s,c,u,l,d,f){var h=8&t;t|=h?32:64,4&(t&=~(h?64:32))||(t&=-4);var p=[e,t,s,h?c:void 0,h?u:void 0,h?void 0:c,h?void 0:u,l,d,f],g=n.apply(void 0,p);return r(e)&&o(g,p),g.placeholder=a,i(g,e,t)}},4255:(e,t,n)=>{var r=n(2673)("debounce",n(2784));r.placeholder=n(2991),e.exports=r},4354:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},4364:(e,t,n)=>{var r=n(9747),o=n(1580);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=r(e.prototype),i=e.apply(n,t);return o(i)?i:n}}},4367:(e,t,n)=>{var r=n(7267),o=n(1211);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,r(a)]}return t}},4495:(e,t,n)=>{var r=n(8942);e.exports=function(){return r.Date.now()}},4497:(e,t,n)=>{var r=n(4715)(Object,"create");e.exports=r},4512:(e,t,n)=>{var r=n(4715)(n(8942),"Set");e.exports=r},4687:(e,t,n)=>{var r=n(353),o=n(547);e.exports=function e(t,n,i,a,s){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,a,e,s))}},4700:(e,t,n)=>{var r=n(9067);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},4715:(e,t,n)=>{var r=n(9624),o=n(155);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},4732:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).has(e)}},4733:(e,t,n)=>{var r=n(9032),o=n(5832);e.exports=function(e,t){return r(e,o(e),t)}},4759:(e,t,n)=>{var r,o=n(1950),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},4772:e=>{e.exports=function(){return!1}},4784:(e,t,n)=>{var r=n(3766)(Object.getPrototypeOf,Object);e.exports=r},4882:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},4943:(e,t,n)=>{var r=n(2053),o=n(6065),i=o?function(e,t){return o.set(e,t),e}:r;e.exports=i},4967:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4977:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=r.length,c=-1,u=n.length,l=t(a-s,0),d=Array(u+l),f=!o;++c<u;)d[c]=n[c];for(;++i<s;)(f||i<a)&&(d[r[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}},5071:(e,t,n)=>{var r=n(4497);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5098:(e,t,n)=>{var r=n(3305),o=n(9361),i=n(1112),a=n(5276),s=n(5071);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},5111:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},5187:(e,t,n)=>{var r=n(3142),o=n(1187),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(a.test(e)||!i.test(e)||null!=t&&e in Object(t))}},5196:(e,t,n)=>{var r=n(6065),o=n(9071),i=r?function(e){return r.get(e)}:o;e.exports=i},5234:(e,t,n)=>{var r=n(6912),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,s=o(i.length-t,0),c=Array(s);++a<s;)c[a]=i[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=i[a];return u[t]=n(c),r(e,this,u)}}},5243:(e,t,n)=>{var r=n(2291);e.exports=function(e){return null==e?"":r(e)}},5250:function(e,t,n){var r;e=n.nmd(e),function(){var o,i="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=16,u=32,l=64,d=128,f=256,h=1/0,p=9007199254740991,g=NaN,m=4294967295,y=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",l],["rearg",f]],w="[object Arguments]",v="[object Array]",A="[object Boolean]",b="[object Date]",S="[object Error]",E="[object Function]",k="[object GeneratorFunction]",T="[object Map]",I="[object Number]",x="[object Object]",_="[object Promise]",C="[object RegExp]",R="[object Set]",P="[object String]",N="[object Symbol]",B="[object WeakMap]",M="[object ArrayBuffer]",O="[object DataView]",z="[object Float32Array]",U="[object Float64Array]",j="[object Int8Array]",L="[object Int16Array]",D="[object Int32Array]",F="[object Uint8Array]",$="[object Uint8ClampedArray]",W="[object Uint16Array]",q="[object Uint32Array]",V=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,Z=/[&<>"']/g,J=RegExp(H.source),Y=RegExp(Z.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oe=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(oe.source),ae=/^\s+/,se=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,we=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ee=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Te="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ie="\\u2700-\\u27bf",xe="a-z\\xdf-\\xf6\\xf8-\\xff",_e="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pe="['’]",Ne="["+ke+"]",Be="["+Re+"]",Me="["+Te+"]",Oe="\\d+",ze="["+Ie+"]",Ue="["+xe+"]",je="[^"+ke+Re+Oe+Ie+xe+_e+"]",Le="\\ud83c[\\udffb-\\udfff]",De="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",We="["+_e+"]",qe="\\u200d",Ve="(?:"+Ue+"|"+je+")",Ke="(?:"+We+"|"+je+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",He="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Me+"|"+Le+")"+"?",Je="["+Ce+"]?",Ye=Je+Ze+("(?:"+qe+"(?:"+[De,Fe,$e].join("|")+")"+Je+Ze+")*"),Qe="(?:"+[ze,Fe,$e].join("|")+")"+Ye,Xe="(?:"+[De+Me+"?",Me,Fe,$e,Ne].join("|")+")",et=RegExp(Pe,"g"),tt=RegExp(Me,"g"),nt=RegExp(Le+"(?="+Le+")|"+Xe+Ye,"g"),rt=RegExp([We+"?"+Ue+"+"+Ge+"(?="+[Be,We,"$"].join("|")+")",Ke+"+"+He+"(?="+[Be,We+Ve,"$"].join("|")+")",We+"?"+Ve+"+"+Ge,We+"+"+He,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Qe].join("|"),"g"),ot=RegExp("["+qe+ke+Te+Ce+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,at=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],st=-1,ct={};ct[z]=ct[U]=ct[j]=ct[L]=ct[D]=ct[F]=ct[$]=ct[W]=ct[q]=!0,ct[w]=ct[v]=ct[M]=ct[A]=ct[O]=ct[b]=ct[S]=ct[E]=ct[T]=ct[I]=ct[x]=ct[C]=ct[R]=ct[P]=ct[B]=!1;var ut={};ut[w]=ut[v]=ut[M]=ut[O]=ut[A]=ut[b]=ut[z]=ut[U]=ut[j]=ut[L]=ut[D]=ut[T]=ut[I]=ut[x]=ut[C]=ut[R]=ut[P]=ut[N]=ut[F]=ut[$]=ut[W]=ut[q]=!0,ut[S]=ut[E]=ut[B]=!1;var lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,ft=parseInt,ht="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,pt="object"==typeof self&&self&&self.Object===Object&&self,gt=ht||pt||Function("return this")(),mt=t&&!t.nodeType&&t,yt=mt&&e&&!e.nodeType&&e,wt=yt&&yt.exports===mt,vt=wt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||vt&&vt.binding&&vt.binding("util")}catch(e){}}(),bt=At&&At.isArrayBuffer,St=At&&At.isDate,Et=At&&At.isMap,kt=At&&At.isRegExp,Tt=At&&At.isSet,It=At&&At.isTypedArray;function xt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function _t(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var a=e[o];t(r,a,n(a),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Pt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}function Bt(e,t){return!!(null==e?0:e.length)&&Wt(e,t,0)>-1}function Mt(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function Ot(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function zt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function Ut(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function jt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function Lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Dt=Gt("length");function Ft(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function $t(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function Wt(e,t,n){return t==t?function(e,t,n){var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):$t(e,Vt,n)}function qt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Vt(e){return e!=e}function Kt(e,t){var n=null==e?0:e.length;return n?Jt(e,t)/n:g}function Gt(e){return function(t){return null==t?o:t[e]}}function Ht(e){return function(t){return null==e?o:e[t]}}function Zt(e,t,n,r,o){return o(e,(function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)})),n}function Jt(e,t){for(var n,r=-1,i=e.length;++r<i;){var a=t(e[r]);a!==o&&(n=n===o?a:n+a)}return n}function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Qt(e){return e?e.slice(0,mn(e)+1).replace(ae,""):e}function Xt(e){return function(t){return e(t)}}function en(e,t){return Ot(t,(function(t){return e[t]}))}function tn(e,t){return e.has(t)}function nn(e,t){for(var n=-1,r=e.length;++n<r&&Wt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&Wt(t,e[n],0)>-1;);return n}var on=Ht({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),an=Ht({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function sn(e){return"\\"+lt[e]}function cn(e){return ot.test(e)}function un(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function ln(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n];a!==t&&a!==s||(e[n]=s,i[o++]=n)}return i}function fn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function hn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function pn(e){return cn(e)?function(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Dt(e)}function gn(e){return cn(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.split("")}(e)}function mn(e){for(var t=e.length;t--&&se.test(e.charAt(t)););return t}var yn=Ht({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var wn=function e(t){var n,r=(t=null==t?gt:wn.defaults(gt.Object(),t,wn.pick(gt,at))).Array,se=t.Date,ke=t.Error,Te=t.Function,Ie=t.Math,xe=t.Object,_e=t.RegExp,Ce=t.String,Re=t.TypeError,Pe=r.prototype,Ne=Te.prototype,Be=xe.prototype,Me=t["__core-js_shared__"],Oe=Ne.toString,ze=Be.hasOwnProperty,Ue=0,je=(n=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Le=Be.toString,De=Oe.call(xe),Fe=gt._,$e=_e("^"+Oe.call(ze).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),We=wt?t.Buffer:o,qe=t.Symbol,Ve=t.Uint8Array,Ke=We?We.allocUnsafe:o,Ge=ln(xe.getPrototypeOf,xe),He=xe.create,Ze=Be.propertyIsEnumerable,Je=Pe.splice,Ye=qe?qe.isConcatSpreadable:o,Qe=qe?qe.iterator:o,Xe=qe?qe.toStringTag:o,nt=function(){try{var e=hi(xe,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==gt.clearTimeout&&t.clearTimeout,lt=se&&se.now!==gt.Date.now&&se.now,ht=t.setTimeout!==gt.setTimeout&&t.setTimeout,pt=Ie.ceil,mt=Ie.floor,yt=xe.getOwnPropertySymbols,vt=We?We.isBuffer:o,At=t.isFinite,Dt=Pe.join,Ht=ln(xe.keys,xe),vn=Ie.max,An=Ie.min,bn=se.now,Sn=t.parseInt,En=Ie.random,kn=Pe.reverse,Tn=hi(t,"DataView"),In=hi(t,"Map"),xn=hi(t,"Promise"),_n=hi(t,"Set"),Cn=hi(t,"WeakMap"),Rn=hi(xe,"create"),Pn=Cn&&new Cn,Nn={},Bn=Li(Tn),Mn=Li(In),On=Li(xn),zn=Li(_n),Un=Li(Cn),jn=qe?qe.prototype:o,Ln=jn?jn.valueOf:o,Dn=jn?jn.toString:o;function Fn(e){if(ns(e)&&!Va(e)&&!(e instanceof Vn)){if(e instanceof qn)return e;if(ze.call(e,"__wrapped__"))return Di(e)}return new qn(e)}var $n=function(){function e(){}return function(t){if(!ts(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=o,n}}();function Wn(){}function qn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Kn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Hn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new Gn(e);this.size=t.size}function Yn(e,t){var n=Va(e),r=!n&&qa(e),o=!n&&!r&&Za(e),i=!n&&!r&&!o&&ls(e),a=n||r||o||i,s=a?Yt(e.length,Ce):[],c=s.length;for(var u in e)!t&&!ze.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ai(u,c))||s.push(u);return s}function Qn(e){var t=e.length;return t?e[Zr(0,t-1)]:o}function Xn(e,t){return zi(Po(e),cr(t,0,e.length))}function er(e){return zi(Po(e))}function tr(e,t,n){(n!==o&&!Fa(e[t],n)||n===o&&!(t in e))&&ar(e,t,n)}function nr(e,t,n){var r=e[t];ze.call(e,t)&&Fa(r,n)&&(n!==o||t in e)||ar(e,t,n)}function rr(e,t){for(var n=e.length;n--;)if(Fa(e[n][0],t))return n;return-1}function or(e,t,n,r){return hr(e,(function(e,o,i){t(r,e,n(e),i)})),r}function ir(e,t){return e&&No(t,Ns(t),e)}function ar(e,t,n){"__proto__"==t&&nt?nt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function sr(e,t){for(var n=-1,i=t.length,a=r(i),s=null==e;++n<i;)a[n]=s?o:xs(e,t[n]);return a}function cr(e,t,n){return e==e&&(n!==o&&(e=e<=n?e:n),t!==o&&(e=e>=t?e:t)),e}function ur(e,t,n,r,i,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=i?n(e,r,i,a):n(e)),s!==o)return s;if(!ts(e))return e;var d=Va(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Po(e,s)}else{var f=mi(e),h=f==E||f==k;if(Za(e))return To(e,c);if(f==x||f==w||h&&!i){if(s=u||h?{}:wi(e),!c)return u?function(e,t){return No(e,gi(e),t)}(e,function(e,t){return e&&No(t,Bs(t),e)}(s,e)):function(e,t){return No(e,pi(e),t)}(e,ir(s,e))}else{if(!ut[f])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case M:return Io(e);case A:case b:return new r(+e);case O:return function(e,t){var n=t?Io(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case z:case U:case j:case L:case D:case F:case $:case W:case q:return xo(e,n);case T:return new r;case I:case P:return new r(e);case C:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new r;case N:return o=e,Ln?xe(Ln.call(o)):{}}var o}(e,f,c)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),ss(e)?e.forEach((function(r){s.add(ur(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,o){s.set(o,ur(r,t,n,o,e,a))}));var g=d?o:(l?u?ai:ii:u?Bs:Ns)(e);return Ct(g||e,(function(r,o){g&&(r=e[o=r]),nr(s,o,ur(r,t,n,o,e,a))})),s}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=xe(e);r--;){var i=n[r],a=t[i],s=e[i];if(s===o&&!(i in e)||!a(s))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Re(i);return Ni((function(){e.apply(o,n)}),t)}function fr(e,t,n,r){var o=-1,i=Bt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Ot(t,Xt(n))),r?(i=Mt,a=!1):t.length>=200&&(i=tn,a=!1,t=new Zn(t));e:for(;++o<s;){var l=e[o],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var f=u;f--;)if(t[f]===d)continue e;c.push(l)}else i(t,d,r)||c.push(l)}return c}Fn.templateSettings={escape:Q,evaluate:X,interpolate:ee,variable:"",imports:{_:Fn}},Fn.prototype=Wn.prototype,Fn.prototype.constructor=Fn,qn.prototype=$n(Wn.prototype),qn.prototype.constructor=qn,Vn.prototype=$n(Wn.prototype),Vn.prototype.constructor=Vn,Kn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Kn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Kn.prototype.get=function(e){var t=this.__data__;if(Rn){var n=t[e];return n===a?o:n}return ze.call(t,e)?t[e]:o},Kn.prototype.has=function(e){var t=this.__data__;return Rn?t[e]!==o:ze.call(t,e)},Kn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rn&&t===o?a:t,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=rr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,!0)},Gn.prototype.get=function(e){var t=this.__data__,n=rr(t,e);return n<0?o:t[n][1]},Gn.prototype.has=function(e){return rr(this.__data__,e)>-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Kn,map:new(In||Gn),string:new Kn}},Hn.prototype.delete=function(e){var t=di(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return di(this,e).get(e)},Hn.prototype.has=function(e){return di(this,e).has(e)},Hn.prototype.set=function(e,t){var n=di(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Zn.prototype.add=Zn.prototype.push=function(e){return this.__data__.set(e,a),this},Zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var hr=Oo(br),pr=Oo(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function mr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],s=t(a);if(null!=s&&(c===o?s==s&&!us(s):n(s,c)))var c=s,u=a}return u}function yr(e,t){var n=[];return hr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function wr(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=vi),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?wr(s,t-1,n,r,o):zt(o,s):r||(o[o.length]=s)}return o}var vr=zo(),Ar=zo(!0);function br(e,t){return e&&vr(e,t,Ns)}function Sr(e,t){return e&&Ar(e,t,Ns)}function Er(e,t){return Nt(t,(function(t){return Qa(e[t])}))}function kr(e,t){for(var n=0,r=(t=bo(t,e)).length;null!=e&&n<r;)e=e[ji(t[n++])];return n&&n==r?e:o}function Tr(e,t,n){var r=t(e);return Va(e)?r:zt(r,n(e))}function Ir(e){return null==e?e===o?"[object Undefined]":"[object Null]":Xe&&Xe in xe(e)?function(e){var t=ze.call(e,Xe),n=e[Xe];try{e[Xe]=o;var r=!0}catch(e){}var i=Le.call(e);r&&(t?e[Xe]=n:delete e[Xe]);return i}(e):function(e){return Le.call(e)}(e)}function xr(e,t){return e>t}function _r(e,t){return null!=e&&ze.call(e,t)}function Cr(e,t){return null!=e&&t in xe(e)}function Rr(e,t,n){for(var i=n?Mt:Bt,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Ot(f,Xt(t))),l=An(f.length,l),u[c]=!n&&(t||a>=120&&f.length>=120)?new Zn(c&&f):o}f=e[0];var h=-1,p=u[0];e:for(;++h<a&&d.length<l;){var g=f[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(p?tn(p,m):i(d,m,n))){for(c=s;--c;){var y=u[c];if(!(y?tn(y,m):i(e[c],m,n)))continue e}p&&p.push(m),d.push(g)}}return d}function Pr(e,t,n){var r=null==(e=Ci(e,t=bo(t,e)))?e:e[ji(Yi(t))];return null==r?o:xt(r,e,n)}function Nr(e){return ns(e)&&Ir(e)==w}function Br(e,t,n,r,i){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,n,r,i,a){var s=Va(e),c=Va(t),u=s?v:mi(e),l=c?v:mi(t),d=(u=u==w?x:u)==x,f=(l=l==w?x:l)==x,h=u==l;if(h&&Za(e)){if(!Za(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Jn),s||ls(e)?ri(e,t,n,r,i,a):function(e,t,n,r,o,i,a){switch(n){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case M:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case A:case b:case I:return Fa(+e,+t);case S:return e.name==t.name&&e.message==t.message;case C:case P:return e==t+"";case T:var s=un;case R:var c=1&r;if(s||(s=fn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=ri(s(e),s(t),r,o,i,a);return a.delete(e),l;case N:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(e,t,u,n,r,i,a);if(!(1&n)){var p=d&&ze.call(e,"__wrapped__"),g=f&&ze.call(t,"__wrapped__");if(p||g){var m=p?e.value():e,y=g?t.value():t;return a||(a=new Jn),i(m,y,n,r,a)}}if(!h)return!1;return a||(a=new Jn),function(e,t,n,r,i,a){var s=1&n,c=ii(e),u=c.length,l=ii(t),d=l.length;if(u!=d&&!s)return!1;var f=u;for(;f--;){var h=c[f];if(!(s?h in t:ze.call(t,h)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);var y=s;for(;++f<u;){var w=e[h=c[f]],v=t[h];if(r)var A=s?r(v,w,h,t,e,a):r(w,v,h,e,t,a);if(!(A===o?w===v||i(w,v,n,r,a):A)){m=!1;break}y||(y="constructor"==h)}if(m&&!y){var b=e.constructor,S=t.constructor;b==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof S&&S instanceof S||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,r,i,a)}(e,t,n,r,Br,i))}function Mr(e,t,n,r){var i=n.length,a=i,s=!r;if(null==e)return!a;for(e=xe(e);i--;){var c=n[i];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<a;){var u=(c=n[i])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===o&&!(u in e))return!1}else{var f=new Jn;if(r)var h=r(l,d,u,e,t,f);if(!(h===o?Br(d,l,3,r,f):h))return!1}}return!0}function Or(e){return!(!ts(e)||(t=e,je&&je in t))&&(Qa(e)?$e:we).test(Li(e));var t}function zr(e){return"function"==typeof e?e:null==e?oc:"object"==typeof e?Va(e)?$r(e[0],e[1]):Fr(e):hc(e)}function Ur(e){if(!Ti(e))return Ht(e);var t=[];for(var n in xe(e))ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function jr(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in xe(e))t.push(n);return t}(e);var t=Ti(e),n=[];for(var r in e)("constructor"!=r||!t&&ze.call(e,r))&&n.push(r);return n}function Lr(e,t){return e<t}function Dr(e,t){var n=-1,o=Ga(e)?r(e.length):[];return hr(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}function Fr(e){var t=fi(e);return 1==t.length&&t[0][2]?xi(t[0][0],t[0][1]):function(n){return n===e||Mr(n,e,t)}}function $r(e,t){return Si(e)&&Ii(t)?xi(ji(e),t):function(n){var r=xs(n,e);return r===o&&r===t?_s(n,e):Br(t,r,3)}}function Wr(e,t,n,r,i){e!==t&&vr(t,(function(a,s){if(i||(i=new Jn),ts(a))!function(e,t,n,r,i,a,s){var c=Ri(e,n),u=Ri(t,n),l=s.get(u);if(l)return void tr(e,n,l);var d=a?a(c,u,n+"",e,t,s):o,f=d===o;if(f){var h=Va(u),p=!h&&Za(u),g=!h&&!p&&ls(u);d=u,h||p||g?Va(c)?d=c:Ha(c)?d=Po(c):p?(f=!1,d=To(u,!0)):g?(f=!1,d=xo(u,!0)):d=[]:is(u)||qa(u)?(d=c,qa(c)?d=ws(c):ts(c)&&!Qa(c)||(d=wi(u))):f=!1}f&&(s.set(u,d),i(d,u,r,a,s),s.delete(u));tr(e,n,d)}(e,t,s,n,Wr,r,i);else{var c=r?r(Ri(e,s),a,s+"",e,t,i):o;c===o&&(c=a),tr(e,s,c)}}),Bs)}function qr(e,t){var n=e.length;if(n)return Ai(t+=t<0?n:0,n)?e[t]:o}function Vr(e,t,n){t=t.length?Ot(t,(function(e){return Va(e)?function(t){return kr(t,1===e.length?e[0]:e)}:e})):[oc];var r=-1;t=Ot(t,Xt(li()));var o=Dr(e,(function(e,n,o){var i=Ot(t,(function(t){return t(e)}));return{criteria:i,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){var r=-1,o=e.criteria,i=t.criteria,a=o.length,s=n.length;for(;++r<a;){var c=_o(o[r],i[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Kr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=kr(e,a);n(s,a)&&eo(i,bo(a,e),s)}return i}function Gr(e,t,n,r){var o=r?qt:Wt,i=-1,a=t.length,s=e;for(e===t&&(t=Po(t)),n&&(s=Ot(e,Xt(n)));++i<a;)for(var c=0,u=t[i],l=n?n(u):u;(c=o(s,l,c,r))>-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Hr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;Ai(o)?Je.call(e,o,1):ho(e,o)}}return e}function Zr(e,t){return e+mt(En()*(t-e+1))}function Jr(e,t){var n="";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Bi(_i(e,t,oc),e+"")}function Qr(e){return Qn(Fs(e))}function Xr(e,t){var n=Fs(e);return zi(n,cr(t,0,n.length))}function eo(e,t,n,r){if(!ts(e))return e;for(var i=-1,a=(t=bo(t,e)).length,s=a-1,c=e;null!=c&&++i<a;){var u=ji(t[i]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=s){var d=c[u];(l=r?r(d,u,c):o)===o&&(l=ts(d)?d:Ai(t[i+1])?[]:{})}nr(c,u,l),c=c[u]}return e}var to=Pn?function(e,t){return Pn.set(e,t),e}:oc,no=nt?function(e,t){return nt(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:oc;function ro(e){return zi(Fs(e))}function oo(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=r(i);++o<i;)a[o]=e[o+t];return a}function io(e,t){var n;return hr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function ao(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,a=e[i];null!==a&&!us(a)&&(n?a<=t:a<t)?r=i+1:o=i}return o}return so(e,t,oc,n)}function so(e,t,n,r){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=us(t),l=t===o;i<a;){var d=mt((i+a)/2),f=n(e[d]),h=f!==o,p=null===f,g=f==f,m=us(f);if(s)var y=r||g;else y=l?g&&(r||h):c?g&&h&&(r||!p):u?g&&h&&!p&&(r||!m):!p&&!m&&(r?f<=t:f<t);y?i=d+1:a=d}return An(a,4294967294)}function co(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Fa(s,c)){var c=s;i[o++]=0===a?0:a}}return i}function uo(e){return"number"==typeof e?e:us(e)?g:+e}function lo(e){if("string"==typeof e)return e;if(Va(e))return Ot(e,lo)+"";if(us(e))return Dn?Dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function fo(e,t,n){var r=-1,o=Bt,i=e.length,a=!0,s=[],c=s;if(n)a=!1,o=Mt;else if(i>=200){var u=t?null:Yo(e);if(u)return fn(u);a=!1,o=tn,c=new Zn}else c=t?[]:s;e:for(;++r<i;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(l)}else o(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ho(e,t){return null==(e=Ci(e,t=bo(t,e)))||delete e[ji(Yi(t))]}function po(e,t,n,r){return eo(e,t,n(kr(e,t)),r)}function go(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?oo(e,r?0:i,r?i+1:o):oo(e,r?i+1:0,r?o:i)}function mo(e,t){var n=e;return n instanceof Vn&&(n=n.value()),Ut(t,(function(e,t){return t.func.apply(t.thisArg,zt([e],t.args))}),n)}function yo(e,t,n){var o=e.length;if(o<2)return o?fo(e[0]):[];for(var i=-1,a=r(o);++i<o;)for(var s=e[i],c=-1;++c<o;)c!=i&&(a[i]=fr(a[i]||s,e[c],t,n));return fo(wr(a,1),t,n)}function wo(e,t,n){for(var r=-1,i=e.length,a=t.length,s={};++r<i;){var c=r<a?t[r]:o;n(s,e[r],c)}return s}function vo(e){return Ha(e)?e:[]}function Ao(e){return"function"==typeof e?e:oc}function bo(e,t){return Va(e)?e:Si(e,t)?[e]:Ui(vs(e))}var So=Yr;function Eo(e,t,n){var r=e.length;return n=n===o?r:n,!t&&n>=r?e:oo(e,t,n)}var ko=ot||function(e){return gt.clearTimeout(e)};function To(e,t){if(t)return e.slice();var n=e.length,r=Ke?Ke(n):new e.constructor(n);return e.copy(r),r}function Io(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function xo(e,t){var n=t?Io(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function _o(e,t){if(e!==t){var n=e!==o,r=null===e,i=e==e,a=us(e),s=t!==o,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||c&&n&&i||!s&&i||!u)return-1}return 0}function Co(e,t,n,o){for(var i=-1,a=e.length,s=n.length,c=-1,u=t.length,l=vn(a-s,0),d=r(u+l),f=!o;++c<u;)d[c]=t[c];for(;++i<s;)(f||i<a)&&(d[n[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}function Ro(e,t,n,o){for(var i=-1,a=e.length,s=-1,c=n.length,u=-1,l=t.length,d=vn(a-c,0),f=r(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=t[u];for(;++s<c;)(h||i<a)&&(f[p+n[s]]=e[i++]);return f}function Po(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function No(e,t,n,r){var i=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=r?r(n[c],e[c],c,n,e):o;u===o&&(u=e[c]),i?ar(n,c,u):nr(n,c,u)}return n}function Bo(e,t){return function(n,r){var o=Va(n)?_t:or,i=t?t():{};return o(n,e,li(r,2),i)}}function Mo(e){return Yr((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:o,s=i>2?n[2]:o;for(a=e.length>3&&"function"==typeof a?(i--,a):o,s&&bi(n[0],n[1],s)&&(a=i<3?o:a,i=1),t=xe(t);++r<i;){var c=n[r];c&&e(t,c,r,a)}return t}))}function Oo(e,t){return function(n,r){if(null==n)return n;if(!Ga(n))return e(n,r);for(var o=n.length,i=t?o:-1,a=xe(n);(t?i--:++i<o)&&!1!==r(a[i],i,a););return n}}function zo(e){return function(t,n,r){for(var o=-1,i=xe(t),a=r(t),s=a.length;s--;){var c=a[e?s:++o];if(!1===n(i[c],c,i))break}return t}}function Uo(e){return function(t){var n=cn(t=vs(t))?gn(t):o,r=n?n[0]:t.charAt(0),i=n?Eo(n,1).join(""):t.slice(1);return r[e]()+i}}function jo(e){return function(t){return Ut(Qs(qs(t).replace(et,"")),e,"")}}function Lo(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=$n(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Do(e){return function(t,n,r){var i=xe(t);if(!Ga(t)){var a=li(n,3);t=Ns(t),n=function(e){return a(i[e],e,i)}}var s=e(t,n,r);return s>-1?i[a?t[s]:s]:o}}function Fo(e){return oi((function(t){var n=t.length,r=n,a=qn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Re(i);if(a&&!c&&"wrapper"==ci(s))var c=new qn([],!0)}for(r=c?r:n;++r<n;){var u=ci(s=t[r]),l="wrapper"==u?si(s):o;c=l&&Ei(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ci(l[0])].apply(c,l[3]):1==s.length&&Ei(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&Va(r))return c.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}function $o(e,t,n,i,a,s,c,u,l,f){var h=t&d,p=1&t,g=2&t,m=24&t,y=512&t,w=g?o:Lo(e);return function d(){for(var v=arguments.length,A=r(v),b=v;b--;)A[b]=arguments[b];if(m)var S=ui(d),E=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(A,S);if(i&&(A=Co(A,i,a,m)),s&&(A=Ro(A,s,c,m)),v-=E,m&&v<f){var k=dn(A,S);return Zo(e,t,$o,d.placeholder,n,A,k,u,l,f-v)}var T=p?n:this,I=g?T[e]:e;return v=A.length,u?A=function(e,t){var n=e.length,r=An(t.length,n),i=Po(e);for(;r--;){var a=t[r];e[r]=Ai(a,n)?i[a]:o}return e}(A,u):y&&v>1&&A.reverse(),h&&l<v&&(A.length=l),this&&this!==gt&&this instanceof d&&(I=w||Lo(I)),I.apply(T,A)}}function Wo(e,t){return function(n,r){return function(e,t,n,r){return br(e,(function(e,o,i){t(r,n(e),o,i)})),r}(n,e,t(r),{})}}function qo(e,t){return function(n,r){var i;if(n===o&&r===o)return t;if(n!==o&&(i=n),r!==o){if(i===o)return r;"string"==typeof n||"string"==typeof r?(n=lo(n),r=lo(r)):(n=uo(n),r=uo(r)),i=e(n,r)}return i}}function Vo(e){return oi((function(t){return t=Ot(t,Xt(li())),Yr((function(n){var r=this;return e(t,(function(e){return xt(e,r,n)}))}))}))}function Ko(e,t){var n=(t=t===o?" ":lo(t)).length;if(n<2)return n?Jr(t,e):t;var r=Jr(t,pt(e/pn(t)));return cn(t)?Eo(gn(r),0,e).join(""):r.slice(0,e)}function Go(e){return function(t,n,i){return i&&"number"!=typeof i&&bi(t,n,i)&&(n=i=o),t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n,o){for(var i=-1,a=vn(pt((t-e)/(n||1)),0),s=r(a);a--;)s[o?a:++i]=e,e+=n;return s}(t,n,i=i===o?t<n?1:-1:ps(i),e)}}function Ho(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Zo(e,t,n,r,i,a,s,c,d,f){var h=8&t;t|=h?u:l,4&(t&=~(h?l:u))||(t&=-4);var p=[e,t,i,h?a:o,h?s:o,h?o:a,h?o:s,c,d,f],g=n.apply(o,p);return Ei(e)&&Pi(g,p),g.placeholder=r,Mi(g,e,t)}function Jo(e){var t=Ie[e];return function(e,n){if(e=ys(e),(n=null==n?0:An(gs(n),292))&&At(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yo=_n&&1/fn(new _n([,-0]))[1]==h?function(e){return new _n(e)}:uc;function Qo(e){return function(t){var n=mi(t);return n==T?un(t):n==R?hn(t):function(e,t){return Ot(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xo(e,t,n,a,h,p,g,m){var y=2&t;if(!y&&"function"!=typeof e)throw new Re(i);var w=a?a.length:0;if(w||(t&=-97,a=h=o),g=g===o?g:vn(gs(g),0),m=m===o?m:gs(m),w-=h?h.length:0,t&l){var v=a,A=h;a=h=o}var b=y?o:si(e),S=[e,t,n,a,h,v,A,p,g,m];if(b&&function(e,t){var n=e[1],r=t[1],o=n|r,i=o<131,a=r==d&&8==n||r==d&&n==f&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!i&&!a)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?Co(u,c,t[4]):c,e[4]=u?dn(e[3],s):t[4]}(c=t[5])&&(u=e[5],e[5]=u?Ro(u,c,t[6]):c,e[6]=u?dn(e[5],s):t[6]);(c=t[7])&&(e[7]=c);r&d&&(e[8]=null==e[8]?t[8]:An(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=o}(S,b),e=S[0],t=S[1],n=S[2],a=S[3],h=S[4],!(m=S[9]=S[9]===o?y?0:e.length:vn(S[9]-w,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||t==c?function(e,t,n){var i=Lo(e);return function a(){for(var s=arguments.length,c=r(s),u=s,l=ui(a);u--;)c[u]=arguments[u];var d=s<3&&c[0]!==l&&c[s-1]!==l?[]:dn(c,l);return(s-=d.length)<n?Zo(e,t,$o,a.placeholder,o,c,d,o,o,n-s):xt(this&&this!==gt&&this instanceof a?i:e,this,c)}}(e,t,m):t!=u&&33!=t||h.length?$o.apply(o,S):function(e,t,n,o){var i=1&t,a=Lo(e);return function t(){for(var s=-1,c=arguments.length,u=-1,l=o.length,d=r(l+c),f=this&&this!==gt&&this instanceof t?a:e;++u<l;)d[u]=o[u];for(;c--;)d[u++]=arguments[++s];return xt(f,i?n:this,d)}}(e,t,n,a);else var E=function(e,t,n){var r=1&t,o=Lo(e);return function t(){return(this&&this!==gt&&this instanceof t?o:e).apply(r?n:this,arguments)}}(e,t,n);return Mi((b?to:Pi)(E,S),e,t)}function ei(e,t,n,r){return e===o||Fa(e,Be[n])&&!ze.call(r,n)?t:e}function ti(e,t,n,r,i,a){return ts(e)&&ts(t)&&(a.set(t,e),Wr(e,t,o,ti,a),a.delete(t)),e}function ni(e){return is(e)?o:e}function ri(e,t,n,r,i,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Zn:o;for(a.set(e,t),a.set(t,e);++f<c;){var g=e[f],m=t[f];if(r)var y=s?r(m,g,f,t,e,a):r(g,m,f,e,t,a);if(y!==o){if(y)continue;h=!1;break}if(p){if(!Lt(t,(function(e,t){if(!tn(p,t)&&(g===e||i(g,e,n,r,a)))return p.push(t)}))){h=!1;break}}else if(g!==m&&!i(g,m,n,r,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function oi(e){return Bi(_i(e,o,Ki),e+"")}function ii(e){return Tr(e,Ns,pi)}function ai(e){return Tr(e,Bs,gi)}var si=Pn?function(e){return Pn.get(e)}:uc;function ci(e){for(var t=e.name+"",n=Nn[t],r=ze.call(Nn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function ui(e){return(ze.call(Fn,"placeholder")?Fn:e).placeholder}function li(){var e=Fn.iteratee||ic;return e=e===ic?zr:e,arguments.length?e(arguments[0],arguments[1]):e}function di(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function fi(e){for(var t=Ns(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Ii(o)]}return t}function hi(e,t){var n=function(e,t){return null==e?o:e[t]}(e,t);return Or(n)?n:o}var pi=yt?function(e){return null==e?[]:(e=xe(e),Nt(yt(e),(function(t){return Ze.call(e,t)})))}:mc,gi=yt?function(e){for(var t=[];e;)zt(t,pi(e)),e=Ge(e);return t}:mc,mi=Ir;function yi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var a=ji(t[r]);if(!(i=null!=e&&n(e,a)))break;e=e[a]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&es(o)&&Ai(a,o)&&(Va(e)||qa(e))}function wi(e){return"function"!=typeof e.constructor||Ti(e)?{}:$n(Ge(e))}function vi(e){return Va(e)||qa(e)||!!(Ye&&e&&e[Ye])}function Ai(e,t){var n=typeof e;return!!(t=null==t?p:t)&&("number"==n||"symbol"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!("number"==r?Ga(n)&&Ai(t,n.length):"string"==r&&t in n)&&Fa(n[t],e)}function Si(e,t){if(Va(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!us(e))||(ne.test(e)||!te.test(e)||null!=t&&e in xe(t))}function Ei(e){var t=ci(e),n=Fn[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=si(n);return!!r&&e===r[0]}(Tn&&mi(new Tn(new ArrayBuffer(1)))!=O||In&&mi(new In)!=T||xn&&mi(xn.resolve())!=_||_n&&mi(new _n)!=R||Cn&&mi(new Cn)!=B)&&(mi=function(e){var t=Ir(e),n=t==x?e.constructor:o,r=n?Li(n):"";if(r)switch(r){case Bn:return O;case Mn:return T;case On:return _;case zn:return R;case Un:return B}return t});var ki=Me?Qa:yc;function Ti(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Be)}function Ii(e){return e==e&&!ts(e)}function xi(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==o||e in xe(n)))}}function _i(e,t,n){return t=vn(t===o?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=vn(o.length-t,0),s=r(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=r(t+1);++i<t;)c[i]=o[i];return c[t]=n(s),xt(e,this,c)}}function Ci(e,t){return t.length<2?e:kr(e,oo(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Pi=Oi(to),Ni=ht||function(e,t){return gt.setTimeout(e,t)},Bi=Oi(no);function Mi(e,t,n){var r=t+"";return Bi(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ct(y,(function(n){var r="_."+n[0];t&n[1]&&!Bt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Oi(e){var t=0,n=0;return function(){var r=bn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function zi(e,t){var n=-1,r=e.length,i=r-1;for(t=t===o?r:t;++n<t;){var a=Zr(n,i),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var Ui=function(e){var t=Oa(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(re,(function(e,n,r,o){t.push(r?o.replace(he,"$1"):n||e)})),t}));function ji(e){if("string"==typeof e||us(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Li(e){if(null!=e){try{return Oe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Di(e){if(e instanceof Vn)return e.clone();var t=new qn(e.__wrapped__,e.__chain__);return t.__actions__=Po(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fi=Yr((function(e,t){return Ha(e)?fr(e,wr(t,1,Ha,!0)):[]})),$i=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,wr(t,1,Ha,!0),li(n,2)):[]})),Wi=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,wr(t,1,Ha,!0),o,n):[]}));function qi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=vn(r+o,0)),$t(e,li(t,3),o)}function Vi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return n!==o&&(i=gs(n),i=n<0?vn(r+i,0):An(i,r-1)),$t(e,li(t,3),i,!0)}function Ki(e){return(null==e?0:e.length)?wr(e,1):[]}function Gi(e){return e&&e.length?e[0]:o}var Hi=Yr((function(e){var t=Ot(e,vo);return t.length&&t[0]===e[0]?Rr(t):[]})),Zi=Yr((function(e){var t=Yi(e),n=Ot(e,vo);return t===Yi(n)?t=o:n.pop(),n.length&&n[0]===e[0]?Rr(n,li(t,2)):[]})),Ji=Yr((function(e){var t=Yi(e),n=Ot(e,vo);return(t="function"==typeof t?t:o)&&n.pop(),n.length&&n[0]===e[0]?Rr(n,o,t):[]}));function Yi(e){var t=null==e?0:e.length;return t?e[t-1]:o}var Qi=Yr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var ea=oi((function(e,t){var n=null==e?0:e.length,r=sr(e,t);return Hr(e,Ot(t,(function(e){return Ai(e,n)?+e:e})).sort(_o)),r}));function ta(e){return null==e?e:kn.call(e)}var na=Yr((function(e){return fo(wr(e,1,Ha,!0))})),ra=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),fo(wr(e,1,Ha,!0),li(t,2))})),oa=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,fo(wr(e,1,Ha,!0),o,t)}));function ia(e){if(!e||!e.length)return[];var t=0;return e=Nt(e,(function(e){if(Ha(e))return t=vn(e.length,t),!0})),Yt(t,(function(t){return Ot(e,Gt(t))}))}function aa(e,t){if(!e||!e.length)return[];var n=ia(e);return null==t?n:Ot(n,(function(e){return xt(t,o,e)}))}var sa=Yr((function(e,t){return Ha(e)?fr(e,t):[]})),ca=Yr((function(e){return yo(Nt(e,Ha))})),ua=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),yo(Nt(e,Ha),li(t,2))})),la=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,yo(Nt(e,Ha),o,t)})),da=Yr(ia);var fa=Yr((function(e){var t=e.length,n=t>1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,aa(e,n)}));function ha(e){var t=Fn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ga=oi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return sr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Vn&&Ai(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[i],thisArg:o}),new qn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(i)}));var ma=Bo((function(e,t,n){ze.call(e,n)?++e[n]:ar(e,n,1)}));var ya=Do(qi),wa=Do(Vi);function va(e,t){return(Va(e)?Ct:hr)(e,li(t,3))}function Aa(e,t){return(Va(e)?Rt:pr)(e,li(t,3))}var ba=Bo((function(e,t,n){ze.call(e,n)?e[n].push(t):ar(e,n,[t])}));var Sa=Yr((function(e,t,n){var o=-1,i="function"==typeof t,a=Ga(e)?r(e.length):[];return hr(e,(function(e){a[++o]=i?xt(t,e,n):Pr(e,t,n)})),a})),Ea=Bo((function(e,t,n){ar(e,n,t)}));function ka(e,t){return(Va(e)?Ot:Dr)(e,li(t,3))}var Ta=Bo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Ia=Yr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,wr(t,1),[])})),xa=lt||function(){return gt.Date.now()};function _a(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Xo(e,d,o,o,o,o,t)}function Ca(e,t){var n;if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Ra=Yr((function(e,t,n){var r=1;if(n.length){var o=dn(n,ui(Ra));r|=u}return Xo(e,r,t,n,o)})),Pa=Yr((function(e,t,n){var r=3;if(n.length){var o=dn(n,ui(Pa));r|=u}return Xo(t,r,e,n,o)}));function Na(e,t,n){var r,a,s,c,u,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof e)throw new Re(i);function g(t){var n=r,i=a;return r=a=o,d=t,c=e.apply(i,n)}function m(e){var n=e-l;return l===o||n>=t||n<0||h&&e-d>=s}function y(){var e=xa();if(m(e))return w(e);u=Ni(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function w(e){return u=o,p&&r?g(e):(r=a=o,c)}function v(){var e=xa(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===o)return function(e){return d=e,u=Ni(y,t),f?g(e):c}(l);if(h)return ko(u),u=Ni(y,t),g(l)}return u===o&&(u=Ni(y,t)),c}return t=ys(t)||0,ts(n)&&(f=!!n.leading,s=(h="maxWait"in n)?vn(ys(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),v.cancel=function(){u!==o&&ko(u),d=0,r=l=a=u=o},v.flush=function(){return u===o?c:w(xa())},v}var Ba=Yr((function(e,t){return dr(e,1,t)})),Ma=Yr((function(e,t,n){return dr(e,ys(t)||0,n)}));function Oa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Re(i);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Oa.Cache||Hn),n}function za(e){if("function"!=typeof e)throw new Re(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Oa.Cache=Hn;var Ua=So((function(e,t){var n=(t=1==t.length&&Va(t[0])?Ot(t[0],Xt(li())):Ot(wr(t,1),Xt(li()))).length;return Yr((function(r){for(var o=-1,i=An(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return xt(e,this,r)}))})),ja=Yr((function(e,t){var n=dn(t,ui(ja));return Xo(e,u,o,t,n)})),La=Yr((function(e,t){var n=dn(t,ui(La));return Xo(e,l,o,t,n)})),Da=oi((function(e,t){return Xo(e,f,o,o,o,t)}));function Fa(e,t){return e===t||e!=e&&t!=t}var $a=Ho(xr),Wa=Ho((function(e,t){return e>=t})),qa=Nr(function(){return arguments}())?Nr:function(e){return ns(e)&&ze.call(e,"callee")&&!Ze.call(e,"callee")},Va=r.isArray,Ka=bt?Xt(bt):function(e){return ns(e)&&Ir(e)==M};function Ga(e){return null!=e&&es(e.length)&&!Qa(e)}function Ha(e){return ns(e)&&Ga(e)}var Za=vt||yc,Ja=St?Xt(St):function(e){return ns(e)&&Ir(e)==b};function Ya(e){if(!ns(e))return!1;var t=Ir(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Qa(e){if(!ts(e))return!1;var t=Ir(e);return t==E||t==k||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==gs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=Et?Xt(Et):function(e){return ns(e)&&mi(e)==T};function os(e){return"number"==typeof e||ns(e)&&Ir(e)==I}function is(e){if(!ns(e)||Ir(e)!=x)return!1;var t=Ge(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==De}var as=kt?Xt(kt):function(e){return ns(e)&&Ir(e)==C};var ss=Tt?Xt(Tt):function(e){return ns(e)&&mi(e)==R};function cs(e){return"string"==typeof e||!Va(e)&&ns(e)&&Ir(e)==P}function us(e){return"symbol"==typeof e||ns(e)&&Ir(e)==N}var ls=It?Xt(It):function(e){return ns(e)&&es(e.length)&&!!ct[Ir(e)]};var ds=Ho(Lr),fs=Ho((function(e,t){return e<=t}));function hs(e){if(!e)return[];if(Ga(e))return cs(e)?gn(e):Po(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=mi(e);return(t==T?un:t==R?fn:Fs)(e)}function ps(e){return e?(e=ys(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function ms(e){return e?cr(gs(e),0,m):0}function ys(e){if("number"==typeof e)return e;if(us(e))return g;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qt(e);var n=ye.test(e);return n||ve.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function ws(e){return No(e,Bs(e))}function vs(e){return null==e?"":lo(e)}var As=Mo((function(e,t){if(Ti(t)||Ga(t))No(t,Ns(t),e);else for(var n in t)ze.call(t,n)&&nr(e,n,t[n])})),bs=Mo((function(e,t){No(t,Bs(t),e)})),Ss=Mo((function(e,t,n,r){No(t,Bs(t),e,r)})),Es=Mo((function(e,t,n,r){No(t,Ns(t),e,r)})),ks=oi(sr);var Ts=Yr((function(e,t){e=xe(e);var n=-1,r=t.length,i=r>2?t[2]:o;for(i&&bi(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],s=Bs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===o||Fa(d,Be[l])&&!ze.call(e,l))&&(e[l]=a[l])}return e})),Is=Yr((function(e){return e.push(o,ti),xt(Os,o,e)}));function xs(e,t,n){var r=null==e?o:kr(e,t);return r===o?n:r}function _s(e,t){return null!=e&&yi(e,t,Cr)}var Cs=Wo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Le.call(t)),e[t]=n}),tc(oc)),Rs=Wo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Le.call(t)),ze.call(e,t)?e[t].push(n):e[t]=[n]}),li),Ps=Yr(Pr);function Ns(e){return Ga(e)?Yn(e):Ur(e)}function Bs(e){return Ga(e)?Yn(e,!0):jr(e)}var Ms=Mo((function(e,t,n){Wr(e,t,n)})),Os=Mo((function(e,t,n,r){Wr(e,t,n,r)})),zs=oi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Ot(t,(function(t){return t=bo(t,e),r||(r=t.length>1),t})),No(e,ai(e),n),r&&(n=ur(n,7,ni));for(var o=t.length;o--;)ho(n,t[o]);return n}));var Us=oi((function(e,t){return null==e?{}:function(e,t){return Kr(e,t,(function(t,n){return _s(e,n)}))}(e,t)}));function js(e,t){if(null==e)return{};var n=Ot(ai(e),(function(e){return[e]}));return t=li(t),Kr(e,n,(function(e,n){return t(e,n[0])}))}var Ls=Qo(Ns),Ds=Qo(Bs);function Fs(e){return null==e?[]:en(e,Ns(e))}var $s=jo((function(e,t,n){return t=t.toLowerCase(),e+(n?Ws(t):t)}));function Ws(e){return Ys(vs(e).toLowerCase())}function qs(e){return(e=vs(e))&&e.replace(be,on).replace(tt,"")}var Vs=jo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ks=jo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gs=Uo("toLowerCase");var Hs=jo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Zs=jo((function(e,t,n){return e+(n?" ":"")+Ys(t)}));var Js=jo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ys=Uo("toUpperCase");function Qs(e,t,n){return e=vs(e),(t=n?o:t)===o?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Xs=Yr((function(e,t){try{return xt(e,o,t)}catch(e){return Ya(e)?e:new ke(e)}})),ec=oi((function(e,t){return Ct(t,(function(t){t=ji(t),ar(e,t,Ra(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Fo(),rc=Fo(!0);function oc(e){return e}function ic(e){return zr("function"==typeof e?e:ur(e,1))}var ac=Yr((function(e,t){return function(n){return Pr(n,e,t)}})),sc=Yr((function(e,t){return function(n){return Pr(e,n,t)}}));function cc(e,t,n){var r=Ns(t),o=Er(t,r);null!=n||ts(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Er(t,Ns(t)));var i=!(ts(n)&&"chain"in n&&!n.chain),a=Qa(e);return Ct(o,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Po(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,zt([this.value()],arguments))})})),e}function uc(){}var lc=Vo(Ot),dc=Vo(Pt),fc=Vo(Lt);function hc(e){return Si(e)?Gt(ji(e)):function(e){return function(t){return kr(t,e)}}(e)}var pc=Go(),gc=Go(!0);function mc(){return[]}function yc(){return!1}var wc=qo((function(e,t){return e+t}),0),vc=Jo("ceil"),Ac=qo((function(e,t){return e/t}),1),bc=Jo("floor");var Sc,Ec=qo((function(e,t){return e*t}),1),kc=Jo("round"),Tc=qo((function(e,t){return e-t}),0);return Fn.after=function(e,t){if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},Fn.ary=_a,Fn.assign=As,Fn.assignIn=bs,Fn.assignInWith=Ss,Fn.assignWith=Es,Fn.at=ks,Fn.before=Ca,Fn.bind=Ra,Fn.bindAll=ec,Fn.bindKey=Pa,Fn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Va(e)?e:[e]},Fn.chain=ha,Fn.chunk=function(e,t,n){t=(n?bi(e,t,n):t===o)?1:vn(gs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=r(pt(i/t));a<i;)c[s++]=oo(e,a,a+=t);return c},Fn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},Fn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return zt(Va(n)?Po(n):[n],wr(t,1))},Fn.cond=function(e){var t=null==e?0:e.length,n=li();return e=t?Ot(e,(function(e){if("function"!=typeof e[1])throw new Re(i);return[n(e[0]),e[1]]})):[],Yr((function(n){for(var r=-1;++r<t;){var o=e[r];if(xt(o[0],this,n))return xt(o[1],this,n)}}))},Fn.conforms=function(e){return function(e){var t=Ns(e);return function(n){return lr(n,e,t)}}(ur(e,1))},Fn.constant=tc,Fn.countBy=ma,Fn.create=function(e,t){var n=$n(e);return null==t?n:ir(n,t)},Fn.curry=function e(t,n,r){var i=Xo(t,8,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.curryRight=function e(t,n,r){var i=Xo(t,c,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.debounce=Na,Fn.defaults=Ts,Fn.defaultsDeep=Is,Fn.defer=Ba,Fn.delay=Ma,Fn.difference=Fi,Fn.differenceBy=$i,Fn.differenceWith=Wi,Fn.drop=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=n||t===o?1:gs(t))<0?0:t,r):[]},Fn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,0,(t=r-(t=n||t===o?1:gs(t)))<0?0:t):[]},Fn.dropRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0,!0):[]},Fn.dropWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0):[]},Fn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&bi(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=gs(n))<0&&(n=-n>i?0:i+n),(r=r===o||r>i?i:gs(r))<0&&(r+=i),r=n>r?0:ms(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Fn.filter=function(e,t){return(Va(e)?Nt:yr)(e,li(t,3))},Fn.flatMap=function(e,t){return wr(ka(e,t),1)},Fn.flatMapDeep=function(e,t){return wr(ka(e,t),h)},Fn.flatMapDepth=function(e,t,n){return n=n===o?1:gs(n),wr(ka(e,t),n)},Fn.flatten=Ki,Fn.flattenDeep=function(e){return(null==e?0:e.length)?wr(e,h):[]},Fn.flattenDepth=function(e,t){return(null==e?0:e.length)?wr(e,t=t===o?1:gs(t)):[]},Fn.flip=function(e){return Xo(e,512)},Fn.flow=nc,Fn.flowRight=rc,Fn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},Fn.functions=function(e){return null==e?[]:Er(e,Ns(e))},Fn.functionsIn=function(e){return null==e?[]:Er(e,Bs(e))},Fn.groupBy=ba,Fn.initial=function(e){return(null==e?0:e.length)?oo(e,0,-1):[]},Fn.intersection=Hi,Fn.intersectionBy=Zi,Fn.intersectionWith=Ji,Fn.invert=Cs,Fn.invertBy=Rs,Fn.invokeMap=Sa,Fn.iteratee=ic,Fn.keyBy=Ea,Fn.keys=Ns,Fn.keysIn=Bs,Fn.map=ka,Fn.mapKeys=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,t(e,r,o),e)})),n},Fn.mapValues=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,r,t(e,r,o))})),n},Fn.matches=function(e){return Fr(ur(e,1))},Fn.matchesProperty=function(e,t){return $r(e,ur(t,1))},Fn.memoize=Oa,Fn.merge=Ms,Fn.mergeWith=Os,Fn.method=ac,Fn.methodOf=sc,Fn.mixin=cc,Fn.negate=za,Fn.nthArg=function(e){return e=gs(e),Yr((function(t){return qr(t,e)}))},Fn.omit=zs,Fn.omitBy=function(e,t){return js(e,za(li(t)))},Fn.once=function(e){return Ca(2,e)},Fn.orderBy=function(e,t,n,r){return null==e?[]:(Va(t)||(t=null==t?[]:[t]),Va(n=r?o:n)||(n=null==n?[]:[n]),Vr(e,t,n))},Fn.over=lc,Fn.overArgs=Ua,Fn.overEvery=dc,Fn.overSome=fc,Fn.partial=ja,Fn.partialRight=La,Fn.partition=Ta,Fn.pick=Us,Fn.pickBy=js,Fn.property=hc,Fn.propertyOf=function(e){return function(t){return null==e?o:kr(e,t)}},Fn.pull=Qi,Fn.pullAll=Xi,Fn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,li(n,2)):e},Fn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,o,n):e},Fn.pullAt=ea,Fn.range=pc,Fn.rangeRight=gc,Fn.rearg=Da,Fn.reject=function(e,t){return(Va(e)?Nt:yr)(e,za(li(t,3)))},Fn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=li(t,3);++r<i;){var a=e[r];t(a,r,e)&&(n.push(a),o.push(r))}return Hr(e,o),n},Fn.rest=function(e,t){if("function"!=typeof e)throw new Re(i);return Yr(e,t=t===o?t:gs(t))},Fn.reverse=ta,Fn.sampleSize=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),(Va(e)?Xn:Xr)(e,t)},Fn.set=function(e,t,n){return null==e?e:eo(e,t,n)},Fn.setWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:eo(e,t,n,r)},Fn.shuffle=function(e){return(Va(e)?er:ro)(e)},Fn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&bi(e,t,n)?(t=0,n=r):(t=null==t?0:gs(t),n=n===o?r:gs(n)),oo(e,t,n)):[]},Fn.sortBy=Ia,Fn.sortedUniq=function(e){return e&&e.length?co(e):[]},Fn.sortedUniqBy=function(e,t){return e&&e.length?co(e,li(t,2)):[]},Fn.split=function(e,t,n){return n&&"number"!=typeof n&&bi(e,t,n)&&(t=n=o),(n=n===o?m:n>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=lo(t))&&cn(e)?Eo(gn(e),0,n):e.split(t,n):[]},Fn.spread=function(e,t){if("function"!=typeof e)throw new Re(i);return t=null==t?0:vn(gs(t),0),Yr((function(n){var r=n[t],o=Eo(n,0,t);return r&&zt(o,r),xt(e,this,o)}))},Fn.tail=function(e){var t=null==e?0:e.length;return t?oo(e,1,t):[]},Fn.take=function(e,t,n){return e&&e.length?oo(e,0,(t=n||t===o?1:gs(t))<0?0:t):[]},Fn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=r-(t=n||t===o?1:gs(t)))<0?0:t,r):[]},Fn.takeRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!1,!0):[]},Fn.takeWhile=function(e,t){return e&&e.length?go(e,li(t,3)):[]},Fn.tap=function(e,t){return t(e),e},Fn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Re(i);return ts(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Na(e,t,{leading:r,maxWait:t,trailing:o})},Fn.thru=pa,Fn.toArray=hs,Fn.toPairs=Ls,Fn.toPairsIn=Ds,Fn.toPath=function(e){return Va(e)?Ot(e,ji):us(e)?[e]:Po(Ui(vs(e)))},Fn.toPlainObject=ws,Fn.transform=function(e,t,n){var r=Va(e),o=r||Za(e)||ls(e);if(t=li(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ts(e)&&Qa(i)?$n(Ge(e)):{}}return(o?Ct:br)(e,(function(e,r,o){return t(n,e,r,o)})),n},Fn.unary=function(e){return _a(e,1)},Fn.union=na,Fn.unionBy=ra,Fn.unionWith=oa,Fn.uniq=function(e){return e&&e.length?fo(e):[]},Fn.uniqBy=function(e,t){return e&&e.length?fo(e,li(t,2)):[]},Fn.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?fo(e,o,t):[]},Fn.unset=function(e,t){return null==e||ho(e,t)},Fn.unzip=ia,Fn.unzipWith=aa,Fn.update=function(e,t,n){return null==e?e:po(e,t,Ao(n))},Fn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:po(e,t,Ao(n),r)},Fn.values=Fs,Fn.valuesIn=function(e){return null==e?[]:en(e,Bs(e))},Fn.without=sa,Fn.words=Qs,Fn.wrap=function(e,t){return ja(Ao(t),e)},Fn.xor=ca,Fn.xorBy=ua,Fn.xorWith=la,Fn.zip=da,Fn.zipObject=function(e,t){return wo(e||[],t||[],nr)},Fn.zipObjectDeep=function(e,t){return wo(e||[],t||[],eo)},Fn.zipWith=fa,Fn.entries=Ls,Fn.entriesIn=Ds,Fn.extend=bs,Fn.extendWith=Ss,cc(Fn,Fn),Fn.add=wc,Fn.attempt=Xs,Fn.camelCase=$s,Fn.capitalize=Ws,Fn.ceil=vc,Fn.clamp=function(e,t,n){return n===o&&(n=t,t=o),n!==o&&(n=(n=ys(n))==n?n:0),t!==o&&(t=(t=ys(t))==t?t:0),cr(ys(e),t,n)},Fn.clone=function(e){return ur(e,4)},Fn.cloneDeep=function(e){return ur(e,5)},Fn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:o)},Fn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:o)},Fn.conformsTo=function(e,t){return null==t||lr(e,t,Ns(t))},Fn.deburr=qs,Fn.defaultTo=function(e,t){return null==e||e!=e?t:e},Fn.divide=Ac,Fn.endsWith=function(e,t,n){e=vs(e),t=lo(t);var r=e.length,i=n=n===o?r:cr(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Fn.eq=Fa,Fn.escape=function(e){return(e=vs(e))&&Y.test(e)?e.replace(Z,an):e},Fn.escapeRegExp=function(e){return(e=vs(e))&&ie.test(e)?e.replace(oe,"\\$&"):e},Fn.every=function(e,t,n){var r=Va(e)?Pt:gr;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.find=ya,Fn.findIndex=qi,Fn.findKey=function(e,t){return Ft(e,li(t,3),br)},Fn.findLast=wa,Fn.findLastIndex=Vi,Fn.findLastKey=function(e,t){return Ft(e,li(t,3),Sr)},Fn.floor=bc,Fn.forEach=va,Fn.forEachRight=Aa,Fn.forIn=function(e,t){return null==e?e:vr(e,li(t,3),Bs)},Fn.forInRight=function(e,t){return null==e?e:Ar(e,li(t,3),Bs)},Fn.forOwn=function(e,t){return e&&br(e,li(t,3))},Fn.forOwnRight=function(e,t){return e&&Sr(e,li(t,3))},Fn.get=xs,Fn.gt=$a,Fn.gte=Wa,Fn.has=function(e,t){return null!=e&&yi(e,t,_r)},Fn.hasIn=_s,Fn.head=Gi,Fn.identity=oc,Fn.includes=function(e,t,n,r){e=Ga(e)?e:Fs(e),n=n&&!r?gs(n):0;var o=e.length;return n<0&&(n=vn(o+n,0)),cs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Wt(e,t,n)>-1},Fn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=vn(r+o,0)),Wt(e,t,o)},Fn.inRange=function(e,t,n){return t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n){return e>=An(t,n)&&e<vn(t,n)}(e=ys(e),t,n)},Fn.invoke=Ps,Fn.isArguments=qa,Fn.isArray=Va,Fn.isArrayBuffer=Ka,Fn.isArrayLike=Ga,Fn.isArrayLikeObject=Ha,Fn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Ir(e)==A},Fn.isBuffer=Za,Fn.isDate=Ja,Fn.isElement=function(e){return ns(e)&&1===e.nodeType&&!is(e)},Fn.isEmpty=function(e){if(null==e)return!0;if(Ga(e)&&(Va(e)||"string"==typeof e||"function"==typeof e.splice||Za(e)||ls(e)||qa(e)))return!e.length;var t=mi(e);if(t==T||t==R)return!e.size;if(Ti(e))return!Ur(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0},Fn.isEqual=function(e,t){return Br(e,t)},Fn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:o)?n(e,t):o;return r===o?Br(e,t,o,n):!!r},Fn.isError=Ya,Fn.isFinite=function(e){return"number"==typeof e&&At(e)},Fn.isFunction=Qa,Fn.isInteger=Xa,Fn.isLength=es,Fn.isMap=rs,Fn.isMatch=function(e,t){return e===t||Mr(e,t,fi(t))},Fn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,Mr(e,t,fi(t),n)},Fn.isNaN=function(e){return os(e)&&e!=+e},Fn.isNative=function(e){if(ki(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},Fn.isNil=function(e){return null==e},Fn.isNull=function(e){return null===e},Fn.isNumber=os,Fn.isObject=ts,Fn.isObjectLike=ns,Fn.isPlainObject=is,Fn.isRegExp=as,Fn.isSafeInteger=function(e){return Xa(e)&&e>=-9007199254740991&&e<=p},Fn.isSet=ss,Fn.isString=cs,Fn.isSymbol=us,Fn.isTypedArray=ls,Fn.isUndefined=function(e){return e===o},Fn.isWeakMap=function(e){return ns(e)&&mi(e)==B},Fn.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Ir(e)},Fn.join=function(e,t){return null==e?"":Dt.call(e,t)},Fn.kebabCase=Vs,Fn.last=Yi,Fn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return n!==o&&(i=(i=gs(n))<0?vn(r+i,0):An(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):$t(e,Vt,i,!0)},Fn.lowerCase=Ks,Fn.lowerFirst=Gs,Fn.lt=ds,Fn.lte=fs,Fn.max=function(e){return e&&e.length?mr(e,oc,xr):o},Fn.maxBy=function(e,t){return e&&e.length?mr(e,li(t,2),xr):o},Fn.mean=function(e){return Kt(e,oc)},Fn.meanBy=function(e,t){return Kt(e,li(t,2))},Fn.min=function(e){return e&&e.length?mr(e,oc,Lr):o},Fn.minBy=function(e,t){return e&&e.length?mr(e,li(t,2),Lr):o},Fn.stubArray=mc,Fn.stubFalse=yc,Fn.stubObject=function(){return{}},Fn.stubString=function(){return""},Fn.stubTrue=function(){return!0},Fn.multiply=Ec,Fn.nth=function(e,t){return e&&e.length?qr(e,gs(t)):o},Fn.noConflict=function(){return gt._===this&&(gt._=Fe),this},Fn.noop=uc,Fn.now=xa,Fn.pad=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Ko(mt(o),n)+e+Ko(pt(o),n)},Fn.padEnd=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?e+Ko(t-r,n):e},Fn.padStart=function(e,t,n){e=vs(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?Ko(t-r,n)+e:e},Fn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Sn(vs(e).replace(ae,""),t||0)},Fn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&bi(e,t,n)&&(t=n=o),n===o&&("boolean"==typeof t?(n=t,t=o):"boolean"==typeof e&&(n=e,e=o)),e===o&&t===o?(e=0,t=1):(e=ps(e),t===o?(t=e,e=0):t=ps(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=En();return An(e+i*(t-e+dt("1e-"+((i+"").length-1))),t)}return Zr(e,t)},Fn.reduce=function(e,t,n){var r=Va(e)?Ut:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,hr)},Fn.reduceRight=function(e,t,n){var r=Va(e)?jt:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,pr)},Fn.repeat=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),Jr(vs(e),t)},Fn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fn.result=function(e,t,n){var r=-1,i=(t=bo(t,e)).length;for(i||(i=1,e=o);++r<i;){var a=null==e?o:e[ji(t[r])];a===o&&(r=i,a=n),e=Qa(a)?a.call(e):a}return e},Fn.round=kc,Fn.runInContext=e,Fn.sample=function(e){return(Va(e)?Qn:Qr)(e)},Fn.size=function(e){if(null==e)return 0;if(Ga(e))return cs(e)?pn(e):e.length;var t=mi(e);return t==T||t==R?e.size:Ur(e).length},Fn.snakeCase=Hs,Fn.some=function(e,t,n){var r=Va(e)?Lt:io;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.sortedIndex=function(e,t){return ao(e,t)},Fn.sortedIndexBy=function(e,t,n){return so(e,t,li(n,2))},Fn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ao(e,t);if(r<n&&Fa(e[r],t))return r}return-1},Fn.sortedLastIndex=function(e,t){return ao(e,t,!0)},Fn.sortedLastIndexBy=function(e,t,n){return so(e,t,li(n,2),!0)},Fn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=ao(e,t,!0)-1;if(Fa(e[n],t))return n}return-1},Fn.startCase=Zs,Fn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:cr(gs(n),0,e.length),t=lo(t),e.slice(n,n+t.length)==t},Fn.subtract=Tc,Fn.sum=function(e){return e&&e.length?Jt(e,oc):0},Fn.sumBy=function(e,t){return e&&e.length?Jt(e,li(t,2)):0},Fn.template=function(e,t,n){var r=Fn.templateSettings;n&&bi(e,t,n)&&(t=o),e=vs(e),t=Ss({},t,r,ei);var i,a,s=Ss({},t.imports,r.imports,ei),c=Ns(s),u=en(s,c),l=0,d=t.interpolate||Se,f="__p += '",h=_e((t.escape||Se).source+"|"+d.source+"|"+(d===ee?pe:Se).source+"|"+(t.evaluate||Se).source+"|$","g"),p="//# sourceURL="+(ze.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++st+"]")+"\n";e.replace(h,(function(t,n,r,o,s,c){return r||(r=o),f+=e.slice(l,c).replace(Ee,sn),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(a=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var g=ze.call(t,"variable")&&t.variable;if(g){if(fe.test(g))throw new ke("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(a?f.replace(V,""):f).replace(K,"$1").replace(G,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Xs((function(){return Te(c,p+"return "+f).apply(o,u)}));if(m.source=f,Ya(m))throw m;return m},Fn.times=function(e,t){if((e=gs(e))<1||e>p)return[];var n=m,r=An(e,m);t=li(t),e-=m;for(var o=Yt(r,t);++n<e;)t(n);return o},Fn.toFinite=ps,Fn.toInteger=gs,Fn.toLength=ms,Fn.toLower=function(e){return vs(e).toLowerCase()},Fn.toNumber=ys,Fn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},Fn.toString=vs,Fn.toUpper=function(e){return vs(e).toUpperCase()},Fn.trim=function(e,t,n){if((e=vs(e))&&(n||t===o))return Qt(e);if(!e||!(t=lo(t)))return e;var r=gn(e),i=gn(t);return Eo(r,nn(r,i),rn(r,i)+1).join("")},Fn.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===o))return e.slice(0,mn(e)+1);if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,0,rn(r,gn(t))+1).join("")},Fn.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===o))return e.replace(ae,"");if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,nn(r,gn(t))).join("")},Fn.truncate=function(e,t){var n=30,r="...";if(ts(t)){var i="separator"in t?t.separator:i;n="length"in t?gs(t.length):n,r="omission"in t?lo(t.omission):r}var a=(e=vs(e)).length;if(cn(e)){var s=gn(e);a=s.length}if(n>=a)return e;var c=n-pn(r);if(c<1)return r;var u=s?Eo(s,0,c).join(""):e.slice(0,c);if(i===o)return u+r;if(s&&(c+=u.length-c),as(i)){if(e.slice(c).search(i)){var l,d=u;for(i.global||(i=_e(i.source,vs(ge.exec(i))+"g")),i.lastIndex=0;l=i.exec(d);)var f=l.index;u=u.slice(0,f===o?c:f)}}else if(e.indexOf(lo(i),c)!=c){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Fn.unescape=function(e){return(e=vs(e))&&J.test(e)?e.replace(H,yn):e},Fn.uniqueId=function(e){var t=++Ue;return vs(e)+t},Fn.upperCase=Js,Fn.upperFirst=Ys,Fn.each=va,Fn.eachRight=Aa,Fn.first=Gi,cc(Fn,(Sc={},br(Fn,(function(e,t){ze.call(Fn.prototype,t)||(Sc[t]=e)})),Sc),{chain:!1}),Fn.VERSION="4.17.21",Ct(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Fn[e].placeholder=Fn})),Ct(["drop","take"],(function(e,t){Vn.prototype[e]=function(n){n=n===o?1:vn(gs(n),0);var r=this.__filtered__&&!t?new Vn(this):this.clone();return r.__filtered__?r.__takeCount__=An(n,r.__takeCount__):r.__views__.push({size:An(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ct(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:li(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ct(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}})),Ct(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}})),Vn.prototype.compact=function(){return this.filter(oc)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Yr((function(e,t){return"function"==typeof e?new Vn(this):this.map((function(n){return Pr(n,e,t)}))})),Vn.prototype.reject=function(e){return this.filter(za(li(e)))},Vn.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(m)},br(Vn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Fn[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(Fn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Vn,u=s[0],l=c||Va(t),d=function(e){var t=i.apply(Fn,zt([e],s));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=a&&!f,g=c&&!h;if(!a&&l){t=g?t:new Vn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:o}),new qn(m,f)}return p&&g?e.apply(this,s):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),Ct(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Fn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Va(o)?o:[],e)}return this[n]((function(n){return t.apply(Va(n)?n:[],e)}))}})),br(Vn.prototype,(function(e,t){var n=Fn[t];if(n){var r=n.name+"";ze.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[$o(o,2).name]=[{name:"wrapper",func:o}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Po(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Po(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Po(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Va(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=An(t,e+a);break;case"takeRight":e=vn(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=i.start,s=i.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,f=0,h=An(c,this.__takeCount__);if(!n||!r&&o==c&&h==c)return mo(e,this.__actions__);var p=[];e:for(;c--&&f<h;){for(var g=-1,m=e[u+=t];++g<d;){var y=l[g],w=y.iteratee,v=y.type,A=w(m);if(2==v)m=A;else if(!A){if(1==v)continue e;break e}}p[f++]=m}return p},Fn.prototype.at=ga,Fn.prototype.chain=function(){return ha(this)},Fn.prototype.commit=function(){return new qn(this.value(),this.__chain__)},Fn.prototype.next=function(){this.__values__===o&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},Fn.prototype.plant=function(e){for(var t,n=this;n instanceof Wn;){var r=Di(n);r.__index__=0,r.__values__=o,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Fn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:o}),new qn(t,this.__chain__)}return this.thru(ta)},Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=function(){return mo(this.__wrapped__,this.__actions__)},Fn.prototype.first=Fn.prototype.head,Qe&&(Fn.prototype[Qe]=function(){return this}),Fn}();gt._=wn,(r=function(){return wn}.call(t,n,t,e))===o||(e.exports=r)}.call(this)},5276:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},5288:(e,t,n)=>{var r=n(358),o=n(7200),i=n(6529);e.exports=function(e){return i(e)?r(e,!0):o(e)}},5353:(e,t,n)=>{var r=n(8638);e.exports=function(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,r(e,128,void 0,void 0,void 0,void 0,t)}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},5512:(e,t,n)=>{var r=n(4943),o=n(3316)(r);e.exports=o},5568:e=>{e.exports=function(e,t){return e.has(t)}},5620:(e,t,n)=>{var r=n(8788),o=n(9141),i=n(796),a=n(33);e.exports=function(e,t,n){var s=t+"";return i(e,o(s,a(r(s),n)))}},5650:(e,t,n)=>{var r=n(8942).Symbol;e.exports=r},5681:(e,t,n)=>{var r=n(4700);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},5755:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=-1,c=r.length,u=-1,l=n.length,d=t(a-c,0),f=Array(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=n[u];for(;++s<c;)(h||i<a)&&(f[p+r[s]]=e[i++]);return f}},5832:(e,t,n)=>{var r=n(1129),o=n(4784),i=n(7979),a=n(9306),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:a;e.exports=s},5853:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=n(4772),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,s=a&&a.exports===i?r.Buffer:void 0,c=(s?s.isBuffer:void 0)||o;e.exports=c},5857:(e,t,n)=>{var r=n(313);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},5894:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},5899:(e,t,n)=>{var r=n(3526),o=n(3283),i=n(3142),a=n(9632),s=n(5387),c=n(6040);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,d=!1;++u<l;){var f=c(t[u]);if(!(d=null!=e&&n(e,f)))break;e=e[f]}return d||++u!=l?d:!!(l=null==e?0:e.length)&&s(l)&&a(f,l)&&(i(e)||o(e))}},5962:e=>{e.exports=function(){}},5964:(e,t,n)=>{var r=n(9747),o=n(4784),i=n(4882);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},6027:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},6040:(e,t,n)=>{var r=n(1187);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},6065:(e,t,n)=>{var r=n(9270),o=r&&new r;e.exports=o},6123:(e,t,n)=>{var r=n(7923);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},6131:(e,t,n)=>{var r=n(6403),o=n(1580),i=n(1187),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):a.test(e)?NaN:+e}},6137:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},6285:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},6341:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(8942);e.exports=function(e,t,n,a){var s=1&t,c=o(e);return function t(){for(var o=-1,u=arguments.length,l=-1,d=a.length,f=Array(d+u),h=this&&this!==i&&this instanceof t?c:e;++l<d;)f[l]=a[l];for(;u--;)f[l++]=arguments[++o];return r(h,s?n:this,f)}}},6403:(e,t,n)=>{var r=n(2945),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},6465:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},6493:(e,t,n)=>{var r=n(6853),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=a},6526:(e,t,n)=>{var r=n(8330),o=n(4367),i=n(3904);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},6529:(e,t,n)=>{var r=n(3655),o=n(5387);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},6591:(e,t,n)=>{var r=n(4354),o=n(9632),i=Math.min;e.exports=function(e,t){for(var n=e.length,a=i(t.length,n),s=r(e);a--;){var c=t[a];e[a]=o(c,n)?s[c]:void 0}return e}},6638:(e,t,n)=>{var r=n(1386),o=n(9770),i=n(8250);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},6648:(e,t,n)=>{var r=n(7553),o=n(5196),i=n(961),a=n(3321);e.exports=function(e){var t=i(e),n=a[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;var s=o(n);return!!s&&e===s[0]}},6713:(e,t,n)=>{var r=n(4364),o=n(8942);e.exports=function(e,t,n){var i=1&t,a=r(e);return function t(){return(this&&this!==o&&this instanceof t?a:e).apply(i?n:this,arguments)}}},6850:e=>{e.exports=function(e){return e.placeholder}},6853:(e,t,n)=>{var r=n(9011);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},6912:e=>{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},7028:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(8813),a="__lodash_placeholder__",s=128,c=Math.min;e.exports=function(e,t){var n=e[1],u=t[1],l=n|u,d=l<131,f=u==s&&8==n||u==s&&256==n&&e[7].length<=t[8]||384==u&&t[7].length<=t[8]&&8==n;if(!d&&!f)return e;1&u&&(e[2]=t[2],l|=1&n?0:4);var h=t[3];if(h){var p=e[3];e[3]=p?r(p,h,t[4]):h,e[4]=p?i(e[3],a):t[4]}return(h=t[5])&&(p=e[5],e[5]=p?o(p,h,t[6]):h,e[6]=p?i(e[5],a):t[6]),(h=t[7])&&(e[7]=h),u&s&&(e[8]=null==e[8]?t[8]:c(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l,e}},7034:(e,t,n)=>{var r=n(6285);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},7073:(e,t,n)=>{var r=n(2532);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},7099:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},7144:(e,t,n)=>{var r=n(7034);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},7200:(e,t,n)=>{var r=n(1580),o=n(4882),i=n(8546),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},7250:e=>{e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},7267:(e,t,n)=>{var r=n(1580);e.exports=function(e){return e==e&&!r(e)}},7276:(e,t,n)=>{var r=n(3636),o=n(5899);e.exports=function(e,t){return null!=e&&o(e,t,r)}},7336:(e,t,n)=>{var r=n(8638);function o(e,t,n){var i=r(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=o.placeholder,i}o.placeholder={},e.exports=o},7350:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},7379:(e,t,n)=>{var r=n(5650),o=n(8870),i=n(9005),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},7403:(e,t,n)=>{var r=n(2619),o=n(2532),i=n(2053),a=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=a},7452:(e,t,n)=>{var r=n(7034);e.exports=function(e){return r(this.__data__,e)>-1}},7462:e=>{e.exports=function(e){return this.__data__.has(e)}},7553:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},7642:(e,t,n)=>{var r=n(3301);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},7681:(e,t,n)=>{var r=n(777),o=n(9460),i=n(2306),a=i&&i.isMap,s=a?o(a):r;e.exports=s},7706:e=>{e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},7769:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object WeakMap]"==r(e)}},7923:(e,t,n)=>{var r=n(3526),o=n(6040);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},7930:(e,t,n)=>{var r=n(9032),o=n(1211);e.exports=function(e,t){return e&&r(t,o(t),e)}},7979:(e,t,n)=>{var r=n(9847),o=n(9306),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),r(a(e),(function(t){return i.call(e,t)})))}:o;e.exports=s},7991:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,u=r-o;s<u;s+=a)i.push(c(e,s,s+a>u?u:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(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 c(e,t,r){for(var o,i,a=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8006:e=>{e.exports=function(e){return this.__data__.has(e)}},8055:(e,t,n)=>{e.exports={ary:n(5353),assign:n(7930),clone:n(2846),curry:n(7336),forEach:n(9968),isArray:n(3142),isError:n(441),isFunction:n(3655),isWeakMap:n(7769),iteratee:n(2590),keys:n(195),rearg:n(864),toInteger:n(7642),toPath:n(2613)}},8069:(e,t,n)=>{var r=n(5650),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},8121:(e,t,n)=>{var r=n(3766)(Object.keys,Object);e.exports=r},8244:(e,t,n)=>{var r=n(1129),o=n(3142);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},8250:(e,t,n)=>{var r=n(9753),o=n(5681),i=n(88),a=n(4732),s=n(9068);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},8330:(e,t,n)=>{var r=n(1340),o=n(4687);e.exports=function(e,t,n,i){var a=n.length,s=a,c=!i;if(null==e)return!s;for(e=Object(e);a--;){var u=n[a];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a<s;){var l=(u=n[a])[0],d=e[l],f=u[1];if(c&&u[2]){if(void 0===d&&!(l in e))return!1}else{var h=new r;if(i)var p=i(d,f,l,e,t,h);if(!(void 0===p?o(f,d,3,i,h):p))return!1}}return!0}},8340:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},8360:(e,t,n)=>{var r=n(7379),o=n(4784),i=n(547),a=Function.prototype,s=Object.prototype,c=a.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},8486:(e,t,n)=>{var r=n(3103),o=n(9770),i=n(9413),a=n(4512),s=n(9270),c=n(7379),u=n(4066),l="[object Map]",d="[object Promise]",f="[object Set]",h="[object WeakMap]",p="[object DataView]",g=u(r),m=u(o),y=u(i),w=u(a),v=u(s),A=c;(r&&A(new r(new ArrayBuffer(1)))!=p||o&&A(new o)!=l||i&&A(i.resolve())!=d||a&&A(new a)!=f||s&&A(new s)!=h)&&(A=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case g:return p;case m:return l;case y:return d;case w:return f;case v:return h}return t}),e.exports=A},8546:e=>{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},8638:(e,t,n)=>{var r=n(4943),o=n(6713),i=n(2443),a=n(3504),s=n(6341),c=n(5196),u=n(7028),l=n(5512),d=n(5620),f=n(7642),h=Math.max;e.exports=function(e,t,n,p,g,m,y,w){var v=2&t;if(!v&&"function"!=typeof e)throw new TypeError("Expected a function");var A=p?p.length:0;if(A||(t&=-97,p=g=void 0),y=void 0===y?y:h(f(y),0),w=void 0===w?w:f(w),A-=g?g.length:0,64&t){var b=p,S=g;p=g=void 0}var E=v?void 0:c(e),k=[e,t,n,p,g,b,S,m,y,w];if(E&&u(k,E),e=k[0],t=k[1],n=k[2],p=k[3],g=k[4],!(w=k[9]=void 0===k[9]?v?0:e.length:h(k[9]-A,0))&&24&t&&(t&=-25),t&&1!=t)T=8==t||16==t?i(e,t,w):32!=t&&33!=t||g.length?a.apply(void 0,k):s(e,t,n,p);else var T=o(e,t,n);return d((E?r:l)(T,k),e,t)}},8666:(e,t,n)=>{var r=n(674),o=n(9460),i=n(2306),a=i&&i.isTypedArray,s=a?o(a):r;e.exports=s},8788:e=>{var t=/\{\n\/\* \[wrapped with (.+)\] \*/,n=/,? & /;e.exports=function(e){var r=e.match(t);return r?r[1].split(n):[]}},8813:e=>{var t="__lodash_placeholder__";e.exports=function(e,n){for(var r=-1,o=e.length,i=0,a=[];++r<o;){var s=e[r];s!==n&&s!==t||(e[r]=t,a[i++]=r)}return a}},8861:(e,t,n)=>{var r=n(5650),o=n(1623),i=n(6285),a=n(3934),s=n(5894),c=n(9828),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,d,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var p=1&r;if(h||(h=c),e.size!=t.size&&!p)return!1;var g=f.get(e);if(g)return g==t;r|=2,f.set(e,t);var m=a(h(e),h(t),r,u,d,f);return f.delete(e),m;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},8870:(e,t,n)=>{var r=n(5650),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[s]=n:delete e[s]),o}},8880:(e,t,n)=>{var r=n(7923);e.exports=function(e){return function(t){return r(t,e)}}},8898:(e,t,n)=>{var r=n(1623);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},8942:(e,t,n)=>{var r=n(4967),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9011:(e,t,n)=>{var r=n(8250);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},9032:(e,t,n)=>{var r=n(3422),o=n(7073);e.exports=function(e,t,n,i){var a=!n;n||(n={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=i?i(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),a?o(n,u,l):r(n,u,l)}return n}},9067:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},9068:(e,t,n)=>{var r=n(4700);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},9071:e=>{e.exports=function(){}},9141:e=>{var t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,n){var r=n.length;if(!r)return e;var o=r-1;return n[o]=(r>1?"& ":"")+n[o],n=n.join(r>2?", ":" "),e.replace(t,"{\n/* [wrapped with "+n+"] */\n")}},9270:(e,t,n)=>{var r=n(4715)(n(8942),"WeakMap");e.exports=r},9306:e=>{e.exports=function(){return[]}},9318:(e,t)=>{t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=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*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*g}},9334:(e,t,n)=>{var r=n(1340),o=n(9968),i=n(3422),a=n(7930),s=n(125),c=n(7099),u=n(4354),l=n(3546),d=n(4733),f=n(393),h=n(3650),p=n(8486),g=n(7350),m=n(424),y=n(5964),w=n(3142),v=n(5853),A=n(7681),b=n(1580),S=n(3943),E=n(1211),k=n(5288),T="[object Arguments]",I="[object Function]",x="[object Object]",_={};_[T]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object DataView]"]=_["[object Boolean]"]=_["[object Date]"]=_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Map]"]=_["[object Number]"]=_[x]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object Symbol]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_["[object Error]"]=_[I]=_["[object WeakMap]"]=!1,e.exports=function e(t,n,C,R,P,N){var B,M=1&n,O=2&n,z=4&n;if(C&&(B=P?C(t,R,P,N):C(t)),void 0!==B)return B;if(!b(t))return t;var U=w(t);if(U){if(B=g(t),!M)return u(t,B)}else{var j=p(t),L=j==I||"[object GeneratorFunction]"==j;if(v(t))return c(t,M);if(j==x||j==T||L&&!P){if(B=O||L?{}:y(t),!M)return O?d(t,s(B,t)):l(t,a(B,t))}else{if(!_[j])return P?t:{};B=m(t,j,M)}}N||(N=new r);var D=N.get(t);if(D)return D;N.set(t,B),S(t)?t.forEach((function(r){B.add(e(r,n,C,r,t,N))})):A(t)&&t.forEach((function(r,o){B.set(o,e(r,n,C,o,t,N))}));var F=U?void 0:(z?O?h:f:O?k:E)(t);return o(F||t,(function(r,o){F&&(r=t[o=r]),i(B,o,e(r,n,C,o,t,N))})),B}},9361:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},9413:(e,t,n)=>{var r=n(4715)(n(8942),"Promise");e.exports=r},9454:e=>{e.exports=function(e){return e!=e}},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},9624:(e,t,n)=>{var r=n(3655),o=n(4759),i=n(1580),a=n(4066),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,d=u.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?f:s).test(a(e))}},9632:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n}},9747:(e,t,n)=>{var r=n(1580),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},9753:(e,t,n)=>{var r=n(5098),o=n(1386),i=n(9770);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},9756:(e,t,n)=>{var r=n(2478);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},9770:(e,t,n)=>{var r=n(4715)(n(8942),"Map");e.exports=r},9828:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},9847:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}},9968:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{onActive:()=>yI,onAssetHistoricalPrice:()=>dI,onAssetsConversion:()=>uI,onAssetsLookup:()=>cI,onAssetsMarketData:()=>AI,onClientRequest:()=>fI,onCronjob:()=>sI,onInactive:()=>wI,onInstall:()=>mI,onKeyringRequest:()=>iI,onNameLookup:()=>vI,onProtocolRequest:()=>lI,onRpcRequest:()=>oI,onStart:()=>pI,onUpdate:()=>gI,onUserInput:()=>aI,onWebSocketEvent:()=>hI});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";(()=>{const e=Array(256).fill(-1);for(let n=0;n<58;++n)e[t.charCodeAt(n)]=n})();var o,i,a=e=>{if(!e||"string"!=typeof e)throw new Error(`Expected base58 string but got “${e}”`);if(e.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character “${e.match(/[IOl0]/gmu)}”`);const n=e.match(/^1+/gmu),r=n?n[0].length:0,o=(e.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(r),...e.match(/.{1}/gmu).map((e=>t.indexOf(e))).reduce(((e,t)=>e.map((e=>{const n=58*e+t;return t=n>>8,n}))),new Uint8Array(o)).reverse().filter((i=!1,e=>i=i||e))]);var i},s=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let e=0;e<32;e++){const t=n.charAt(e);r[t]=e}function o(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function i(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=o(t)^r>>5}t=o(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=o(t)^31&r}return t}function a(e,t,n,r){let o=0,i=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(o=o<<t|e[r],i+=t;i>=n;)i-=n,s.push(o>>i&a);if(r)i>0&&s.push(o<<n-i&a);else{if(i>=t)return"Excess padding";if(o<<n-i&a)return"Non-zero padding"}return s}function s(e){return a(e,8,5,!0)}function c(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function l(e){let t;function a(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const a=e.toLowerCase(),s=e.toUpperCase();if(e!==a&&e!==s)return"Mixed-case string "+e;const c=(e=a).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let d=i(u);if("string"==typeof d)return d;const f=[];for(let e=0;e<l.length;++e){const t=l.charAt(e),n=r[t];if(void 0===n)return"Unknown character "+t;d=o(d)^n,e+6>=l.length||f.push(n)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const n=a(e,t);if("object"==typeof n)return n},decode:function(e,t){const n=a(e,t);if("object"==typeof n)return n;throw new Error(n)},encode:function(e,r,a){if(a=a||90,e.length+7+r.length>a)throw new TypeError("Exceeds length limit");let s=i(e=e.toLowerCase());if("string"==typeof s)throw new Error(s);let c=e+"1";for(let e=0;e<r.length;++e){const t=r[e];if(t>>5)throw new Error("Non 5-bit word");s=o(s)^t,c+=n.charAt(t)}for(let e=0;e<6;++e)s=o(s);s^=t;for(let e=0;e<6;++e)c+=n.charAt(s>>5*(5-e)&31);return c},toWords:s,fromWordsUnsafe:c,fromWords:u}}t.bech32=l("bech32"),t.bech32m=l("bech32m")}(o={exports:{}},o.exports),o.exports);(i=s)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")&&i.default;var c=s.bech32m,u=s.bech32;const l=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class d{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!h||p>=8e3)&&(h=new ArrayBuffer(8e3),p=0),this._byte=new Uint8Array(h,p,80),this._word=new Int32Array(h,p,20),p+=80}update(e){if("string"==typeof e)return this._utf8(e);if(null==e)throw new TypeError("Invalid type: "+typeof e);const t=e.byteOffset,n=e.byteLength;let r=n/64|0,o=0;if(r&&!(3&t)&&!(this._size%64)){const n=new Int32Array(e.buffer,t,16*r);for(;r--;)this._int32(n,o>>2),o+=64;this._size+=o}if(1!==e.BYTES_PER_ELEMENT&&e.buffer){const r=new Uint8Array(e.buffer,t+o,n-o);return this._uint8(r)}return o===n?this:this._uint8(e,o)}_uint8(e,t){const{_byte:n,_word:r}=this,o=e.length;for(t|=0;t<o;){const i=this._size%64;let a=i;for(;t<o&&a<64;)n[a++]=e[t++];a>=64&&this._int32(r),this._size+=a-i}return this}_utf8(e){const{_byte:t,_word:n}=this,r=e.length;let o=this._sp;for(let i=0;i<r;){const a=this._size%64;let s=a;for(;i<r&&s<64;){let n=0|e.charCodeAt(i++);n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<55296||n>57343?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):o?(n=((1023&o)<<10)+(1023&n)+65536,t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n,o=0):o=n}s>=64&&(this._int32(n),n[0]=n[16]),this._size+=s-a}return this._sp=o,this}_int32(e,t){let{A:n,B:r,C:o,D:i,E:a,F:s,G:c,H:u}=this,d=0;for(t|=0;d<16;)f[d++]=m(e[t++]);for(d=16;d<64;d++)f[d]=S(f[d-2])+f[d-7]+b(f[d-15])+f[d-16]|0;for(d=0;d<64;d++){const e=u+A(a)+y(a,s,c)+l[d]+f[d]|0,t=v(n)+w(n,r,o)|0;u=c,c=s,s=a,a=i+e|0,i=o,o=r,r=n,n=e+t|0}this.A=n+this.A|0,this.B=r+this.B|0,this.C=o+this.C|0,this.D=i+this.D|0,this.E=a+this.E|0,this.F=s+this.F|0,this.G=c+this.G|0,this.H=u+this.H|0}digest(e){const{_byte:t,_word:n}=this;let r=this._size%64|0;for(t[r++]=128;3&r;)t[r++]=0;if(r>>=2,r>14){for(;r<16;)n[r++]=0;r=0,this._int32(n)}for(;r<16;)n[r++]=0;const o=8*this._size,i=(4294967295&o)>>>0,a=(o-i)/4294967296;return a&&(n[14]=m(a)),i&&(n[15]=m(i)),this._int32(n),"hex"===e?this._hex():this._bin()}_hex(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s}=this;return g(e)+g(t)+g(n)+g(r)+g(o)+g(i)+g(a)+g(s)}_bin(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s,_byte:c,_word:u}=this;return u[0]=m(e),u[1]=m(t),u[2]=m(n),u[3]=m(r),u[4]=m(o),u[5]=m(i),u[6]=m(a),u[7]=m(s),c.slice(0,32)}}const f=new Int32Array(64);let h,p=0;const g=e=>(e+4294967296).toString(16).substr(-8),m=254===new Uint8Array(new Uint16Array([65279]).buffer)[0]?e=>e:e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255,y=(e,t,n)=>n^e&(t^n),w=(e,t,n)=>e&t|n&(e|t),v=e=>(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),A=e=>(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7),b=e=>(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,S=e=>(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10;var E,k,T=function(e){return(new d).update(e).digest()};!function(e){e.mainnet="mainnet",e.testnet="testnet",e.regtest="regtest"}(E||(E={})),function(e){e.p2pkh="p2pkh",e.p2sh="p2sh",e.p2wpkh="p2wpkh",e.p2wsh="p2wsh",e.p2tr="p2tr"}(k||(k={}));var I={0:{type:k.p2pkh,network:E.mainnet},111:{type:k.p2pkh,network:E.testnet},5:{type:k.p2sh,network:E.mainnet},196:{type:k.p2sh,network:E.testnet}},x=function(t){var n,r=t.substr(0,2).toLowerCase();if("bc"===r||"tb"===r)return function(e){var t;try{t=e.startsWith("bc1p")||e.startsWith("tb1p")||e.startsWith("bcrt1p")?c.decode(e):u.decode(e)}catch(e){throw new Error("Invalid address")}var n={bc:E.mainnet,tb:E.testnet,bcrt:E.regtest}[t.prefix];if(void 0===n)throw new Error("Invalid address");var r=t.words[0];if(r<0||r>16)throw new Error("Invalid address");return{bech32:!0,network:n,address:e,type:20===u.fromWords(t.words.slice(1)).length?k.p2wpkh:1===r?k.p2tr:k.p2wsh}}(t);try{n=a(t)}catch(e){throw new Error("Invalid address")}var o=n.length;if(25!==o)throw new Error("Invalid address");var i=n[0],s=n.slice(o-4,o),l=n.slice(0,o-4),d=T(T(l)).slice(0,4);if(s.some((function(e,t){return e!==d[t]})))throw new Error("Invalid address");if(!Object.keys(I).map(Number).includes(i))throw new Error("Invalid address");return e(e({},I[i]),{address:t,bech32:!1})};class _ extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function C(e){return"object"==typeof e&&null!==e}function R(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function P(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function N(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${P(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*B(e,t,n,r){(function(e){return C(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=N(o,t,n,r);e&&(yield e)}}function*M(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&C(t.schema)&&C(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=M(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):C(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class O{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>B(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>B(o(e,t),t,this,e):()=>[]}assert(e,t){return j(e,this,t)}create(e,t){return L(e,this,t)}is(e){return D(e,this)}mask(e,t){return function(e,t,n){const r=F(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return F(e,this,t)}}const z="EXACT_OPTIONAL";class U extends O{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=z}static isExactOptional(e){return C(e)&&"brand"in e&&e.brand===z}}function j(e,t,n){const r=F(e,t,{message:n});if(r[0])throw r[0]}function L(e,t,n){const r=F(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function D(e,t){return!F(e,t)[0]}function F(e,t,n={}){const r=M(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new _(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function $(){return ae("any",(()=>!0))}function W(e){return new O({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${P(e)}`})}function q(){return ae("boolean",(e=>"boolean"==typeof e))}function V(e){const t={},n=e.map((e=>P(e))).join();for(const n of e)t[n]=n;return new O({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${P(t)}`})}function K(){return ae("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${P(e)}`))}function G(e){const t=P(e),n=typeof e;return new O({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${P(n)}`})}function H(){return ae("never",(()=>!1))}function Z(e){return new O({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function J(){return ae("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${P(e)}`))}function Y(e){const t=e?Object.keys(e):[],n=H();return new O({type:"object",schema:e??null,*entries(r){if(e&&C(r)){const o=new Set(Object.keys(r));for(const n of t){o.delete(n);const t=e[n];U.isExactOptional(t)&&!Object.prototype.hasOwnProperty.call(r,n)||(yield[n,r[n],e[n]])}for(const e of o)yield[e,r[e],n]}},validator:e=>C(e)||`Expected an object, but received: ${P(e)}`,coercer:e=>C(e)?{...e}:e})}function Q(e){return new O({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function X(e,t){return new O({type:"record",schema:null,*entries(n){if(C(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>C(e)||`Expected an object, but received: ${P(e)}`})}function ee(){return ae("string",(e=>"string"==typeof e||`Expected a string, but received: ${P(e)}`))}function te(e){const t=H();return new O({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${P(e)}`})}function ne(e){const t=Object.keys(e);return new O({type:"type",schema:e,*entries(n){if(C(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>C(e)||`Expected an object, but received: ${P(e)}`,coercer:e=>C(e)?{...e}:e})}function re(e){const t=e.map((e=>e.type)).join(" | ");return new O({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const o=[];for(const t of e){const[...e]=M(n,t,r),[i]=e;if(!i?.[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${P(n)}`,...o]}})}function oe(){return ae("unknown",(()=>!0))}function ie(...e){const t="type"===e[0]?.type,n=e.map((({schema:e})=>e)),r=Object.assign({},...n);return t?ne(r):Y(r)}function ae(e,t){return new O({type:e,schema:null,validator:t})}function se(e,t){return ae(e,(e=>"string"==typeof e&&t.test(e)))}const ce=se("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),ue=ce,le=ae("Url",(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})),de=se("StringNumber",/^\d+(\.\d+)?$/u);function fe(e){return Y(e)}function he(e){return e.path[e.path.length-1]in e.branch[e.branch.length-2]}function pe(e){return new O({...e,validator:(t,n)=>!he(n)||e.validator(t,n),refiner:(t,n)=>!he(n)||e.refiner(t,n)})}function ge(e){return new O({type:"union",schema:null,*entries(t,n){yield*e(t).entries(t,n)},*refiner(t,n){yield*e(t).refiner(t,n)},coercer:(t,n)=>e(t).coercer(t,n),validator:(t,n)=>e(t).validator(t,n)})}function me(e,t,n){return new O({...e,coercer:(r,o)=>D(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function ye(e){return e instanceof Map||e instanceof Set?e.size:e.length}function we(e,t,n={}){const{exclusive:r}=n;return be(e,"min",(n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))}function ve(e){return be(e,"nonempty",(t=>ye(t)>0||`Expected a nonempty ${e.type} but received an empty one`))}function Ae(e,t){return be(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function be(e,t,n){return new O({...e,*refiner(r,o){yield*e.refiner(r,o);const i=B(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}var Se;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Se=Se||(Se={}));const Ee=e=>Y(e);function ke({path:e,branch:t}){const n=e[e.length-1];return r=t[t.length-2],o=n,Object.hasOwnProperty.call(r,o);var r,o}function Te(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!ke(n)||e.validator(t,n),refiner:(t,n)=>!ke(n)||e.refiner(t,n)})}function Ie(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Ie(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Ie(n[e][1])){t=!1;break}return t}return!1}const xe=ae("JSON",(e=>Ie(e))),_e=me(xe,be($(),"JSON",(e=>D(e,xe))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Ce=G("2.0"),Re=Z(re([J(),ee()])),Pe=Ee({code:K(),message:ee(),data:Te(_e),stack:Te(ee())}),Ne=re([X(ee(),_e),W(_e)]);Ee({id:Re,jsonrpc:Ce,method:ee(),params:Te(Ne)}),Ee({jsonrpc:Ce,method:ee(),params:Te(Ne)});Y({id:Re,jsonrpc:Ce,result:Q(oe()),error:Q(Pe)});const Be=Ee({id:Re,jsonrpc:Ce,result:_e}),Me=Ee({id:Re,jsonrpc:Ce,error:Pe});re([Be,Me]);const Oe=fe({jsonrpc:G("2.0"),id:re([ee(),J(),G(null)]),method:ee(),params:pe(re([W(_e),X(ee(),_e)]))});var ze;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(ze=ze||(ze={}));function Ue(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}const je=e=>Y(e);function Le({path:e,branch:t}){const n=e[e.length-1];return r=t[t.length-2],o=n,Object.hasOwnProperty.call(r,o);var r,o}function De(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Le(n)||e.validator(t,n),refiner:(t,n)=>!Le(n)||e.refiner(t,n)})}function Fe(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Fe(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Fe(n[e][1])){t=!1;break}return t}return!1}const $e=ae("JSON",(e=>Fe(e))),We=me($e,be($(),"JSON",(e=>D(e,$e))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const qe=G("2.0"),Ve=Z(re([J(),ee()])),Ke=je({code:K(),message:ee(),data:De(We),stack:De(ee())}),Ge=re([X(ee(),We),W(We)]);je({id:Ve,jsonrpc:qe,method:ee(),params:De(Ge)}),je({jsonrpc:qe,method:ee(),params:De(Ge)});Y({id:Ve,jsonrpc:qe,result:Q(oe()),error:Q(Ke)});const He=je({id:Ve,jsonrpc:qe,result:We}),Ze=je({id:Ve,jsonrpc:qe,error:Ke});re([He,Ze]);var Je;!function(e){e.Mnemonic="mnemonic",e.PrivateKey="private-key"}(Je||(Je={}));const Ye=Y({type:G(`${Je.Mnemonic}`),id:ee(),derivationPath:ee(),groupIndex:J()}),Qe=Y({type:G(`${Je.PrivateKey}`)}),Xe=ge((e=>Ue(e)&&e.type===Je.PrivateKey?Qe:Ye)),et=(tt=[X(ee(),We),(nt={entropy:pe(Xe),exportable:pe(q())},ne(nt))],new O({type:"intersection",schema:null,*entries(e,t){for(const{entries:n}of tt)yield*n(e,t)},*validator(e,t){for(const{validator:n}of tt)yield*n(e,t)},*refiner(e,t){for(const{refiner:n}of tt)yield*n(e,t)}}));var tt,nt;function rt(e,t){return ae(e,(e=>"string"==typeof e&&t.test(e)))}const ot=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,it=/^[-a-z0-9]{3,8}$/u,at=/^[-_a-zA-Z0-9]{1,32}$/u,st=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,ct=/^[-.%a-zA-Z0-9]{1,128}$/u,ut=/^[-a-z0-9]{3,8}$/u,lt=/^[-.%a-zA-Z0-9]{1,128}$/u,dt=/^[-.%a-zA-Z0-9]{1,78}$/u,ft=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,ht=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,pt=rt("CaipChainId",ot),gt=(rt("CaipNamespace",it),rt("CaipReference",at),rt("CaipAccountId",st)),mt=(rt("CaipAccountAddress",ct),rt("CaipAssetNamespace",ut),rt("CaipAssetReference",lt),rt("CaipTokenId",dt),rt("CaipAssetType",ft)),yt=rt("CaipAssetId",ht),wt=rt("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var vt,At,bt,St,Et,kt;!function(e){e.Bip122="bip122",e.Solana="solana",e.Tron="tron",e.Eip155="eip155",e.Wallet="wallet"}(vt=vt||(vt={})),function(e){e.Eoa="eip155:eoa",e.Erc4337="eip155:erc4337"}(At||(At={})),function(e){e.P2pkh="bip122:p2pkh",e.P2sh="bip122:p2sh",e.P2wpkh="bip122:p2wpkh",e.P2tr="bip122:p2tr"}(bt||(bt={})),function(e){e.DataAccount="solana:data-account"}(St||(St={})),function(e){e.Eoa="tron:eoa"}(Et||(Et={})),function(e){e.Account="any:account"}(kt||(kt={}));const Tt=fe({id:ue,type:V([`${At.Eoa}`,`${At.Erc4337}`,`${bt.P2pkh}`,`${bt.P2sh}`,`${bt.P2wpkh}`,`${bt.P2tr}`,`${St.DataAccount}`,`${Et.Eoa}`,`${kt.Account}`]),address:ee(),scopes:ve(W(pt)),options:et,methods:W(ee())}),It=(Y({address:gt}),fe({unit:ee(),amount:de})),xt=fe({fungible:G(!0),type:mt,...It.schema}),_t=fe({fungible:G(!1),id:yt}),Ct=ge((e=>Ue(e)&&!e.fungible?_t:xt)),Rt=fe({amount:de,unit:ee()}),Pt=rt("DerivationPath",/^m(?:\/\d+'?)+$/u);var Nt;!function(e){e.Bip44="bip44"}(Nt||(Nt={}));const Bt=Y({type:G(`${Nt.Bip44}`),scopes:W(pt),derivationPath:Pt}),Mt=(X(ee(),We),fe({id:ce,scope:ee(),account:ce,origin:ee(),request:fe({method:ee(),params:pe(re([W(We),X(ee(),We)]))})})),Ot=(re([fe({pending:G(!0),redirect:pe(fe({message:pe(ee()),url:pe(ee())}))}),fe({pending:G(!1),result:We})]),fe({address:ee(),asset:Z(Ct)}));var zt;!function(e){e.Base="base",e.Priority="priority"}(zt||(zt={}));const Ut=fe({type:V([`${zt.Base}`,`${zt.Priority}`]),asset:Ct});var jt,Lt;!function(e){e.Submitted="submitted",e.Unconfirmed="unconfirmed",e.Confirmed="confirmed",e.Failed="failed"}(jt||(jt={})),function(e){e.Send="send",e.Receive="receive",e.Swap="swap",e.BridgeSend="bridge:send",e.BridgeReceive="bridge:receive",e.Unknown="unknown"}(Lt||(Lt={}));const Dt=fe({status:V([`${jt.Submitted}`,`${jt.Unconfirmed}`,`${jt.Confirmed}`,`${jt.Failed}`]),timestamp:Z(J())}),Ft=fe({id:ee(),chain:pt,account:ce,status:V([`${jt.Submitted}`,`${jt.Unconfirmed}`,`${jt.Confirmed}`,`${jt.Failed}`]),timestamp:Z(J()),type:V([`${Lt.Send}`,`${Lt.Receive}`,`${Lt.Swap}`,`${Lt.BridgeSend}`,`${Lt.BridgeReceive}`,`${Lt.Unknown}`]),from:W(Ot),to:W(Ot),fees:W(Ut),events:W(Dt)}),$t=(fe({data:W(Ft),next:Z(ee())}),fe({limit:J(),next:pe(Z(ee()))})),Wt=fe({metamask:pe(fe({correlationId:ce}))});var qt;!function(e){e.Mainnet="bip122:000000000019d6689c085ae165831e93",e.Testnet="bip122:000000000933ea01ad0ee984209779ba",e.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",e.Signet="bip122:00000008819873e925422c1ff0f99f7c",e.Regtest="bip122:regtest"}(qt||(qt={}));const Vt=(e,t)=>{try{return x(e).type===t||new Error(`Invalid ${t} address`)}catch(e){return new Error(`Failed to decode ${t} address: ${e.message}`)}},Kt=be(ee(),"BtcP2pkhAddressStruct",(e=>Vt(e,k.p2pkh))),Gt=be(ee(),"BtcP2shAddressStruct",(e=>Vt(e,k.p2sh))),Ht=be(ee(),"BtcP2wpkhAddressStruct",(e=>Vt(e,k.p2wpkh))),Zt=be(ee(),"BtcP2trAddressStruct",(e=>Vt(e,k.p2tr)));var Jt;!function(e){e.SignPsbt="signPsbt",e.ComputeFee="computeFee",e.FillPsbt="fillPsbt",e.BroadcastPsbt="broadcastPsbt",e.SendTransfer="sendTransfer",e.GetUtxo="getUtxo",e.ListUtxos="listUtxos",e.PublicDescriptor="publicDescriptor",e.SignMessage="signMessage"}(Jt||(Jt={}));const Yt=fe({...Tt.schema,scopes:ve(W(pt)),methods:W(V(Object.values(Jt)))});fe({...Yt.schema,address:Kt,type:G(`${bt.P2pkh}`)}),fe({...Yt.schema,address:Gt,type:G(`${bt.P2sh}`)}),fe({...Yt.schema,address:Ht,type:G(`${bt.P2wpkh}`)}),fe({...Yt.schema,address:Zt,type:G(`${bt.P2tr}`)});var Qt;!function(e){e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Qt||(Qt={}));const Xt=rt("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var en;!function(e){e.SendAndConfirmTransaction="sendAndConfirmTransaction",e.SignAndSendTransaction="signAndSendTransaction",e.SignTransaction="signTransaction",e.SignMessage="signMessage",e.SignIn="signIn"}(en||(en={}));fe({...Tt.schema,address:Xt,type:G(`${St.DataAccount}`),scopes:ve(W(pt)),methods:W(V(Object.values(en)))});var tn;!function(e){e.Eoa="eip155:0",e.Mainnet="eip155:1",e.Testnet="eip155:11155111"}(tn||(tn={}));const nn=rt("EthBytes",/^0x[0-9a-f]*$/iu),rn=rt("EthAddress",/^0x[0-9a-f]{40}$/iu),on=rt("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu);var an;!function(e){e.PersonalSign="personal_sign",e.Sign="eth_sign",e.SignTransaction="eth_signTransaction",e.SignTypedDataV1="eth_signTypedData_v1",e.SignTypedDataV3="eth_signTypedData_v3",e.SignTypedDataV4="eth_signTypedData_v4",e.PrepareUserOperation="eth_prepareUserOperation",e.PatchUserOperation="eth_patchUserOperation",e.SignUserOperation="eth_signUserOperation"}(an||(an={}));fe({...Tt.schema,address:rn,type:G(`${At.Eoa}`),scopes:ve(W(G(tn.Eoa))),methods:W(V([`${an.PersonalSign}`,`${an.Sign}`,`${an.SignTransaction}`,`${an.SignTypedDataV1}`,`${an.SignTypedDataV3}`,`${an.SignTypedDataV4}`]))}),fe({...Tt.schema,address:rn,type:G(`${At.Erc4337}`),scopes:ve(W(pt)),methods:W(V([`${an.PersonalSign}`,`${an.Sign}`,`${an.SignTypedDataV1}`,`${an.SignTypedDataV3}`,`${an.SignTypedDataV4}`,`${an.PrepareUserOperation}`,`${an.PatchUserOperation}`,`${an.SignUserOperation}`]))}),fe({sender:rn,nonce:on,initCode:nn,callData:nn,callGasLimit:on,verificationGasLimit:on,preVerificationGas:on,maxFeePerGas:on,maxPriorityFeePerGas:on,paymasterAndData:nn,signature:nn}),fe({to:rn,value:on,data:nn}),fe({nonce:on,initCode:nn,callData:nn,gasLimits:pe(fe({callGasLimit:on,verificationGasLimit:on,preVerificationGas:on})),dummyPaymasterAndData:nn,dummySignature:nn,bundlerUrl:le}),fe({paymasterAndData:nn,callGasLimit:pe(on),verificationGasLimit:pe(on),preVerificationGas:pe(on)});var sn;!function(e){e.Mainnet="tron:728126428",e.Nile="tron:3448148188",e.Shasta="tron:2494104990"}(sn||(sn={}));const cn=rt("TrxAddress",/^T[1-9A-HJ-NP-Za-km-z]{33}$/iu);var un;!function(e){e.SignMessageV2="signMessageV2",e.VerifyMessageV2="verifyMessageV2"}(un||(un={}));fe({...Tt.schema,address:cn,type:G(`${Et.Eoa}`),scopes:ve(W(pt)),methods:W(V(Object.values(un)))});var ln;!function(e){e.ListAccounts="keyring_listAccounts",e.GetAccount="keyring_getAccount",e.CreateAccount="keyring_createAccount",e.DiscoverAccounts="keyring_discoverAccounts",e.ListAccountAssets="keyring_listAccountAssets",e.ListAccountTransactions="keyring_listAccountTransactions",e.GetAccountBalances="keyring_getAccountBalances",e.ResolveAccountAddress="keyring_resolveAccountAddress",e.FilterAccountChains="keyring_filterAccountChains",e.UpdateAccount="keyring_updateAccount",e.DeleteAccount="keyring_deleteAccount",e.ExportAccount="keyring_exportAccount",e.ListRequests="keyring_listRequests",e.GetRequest="keyring_getRequest",e.SubmitRequest="keyring_submitRequest",e.ApproveRequest="keyring_approveRequest",e.RejectRequest="keyring_rejectRequest",e.SetSelectedAccounts="keyring_setSelectedAccounts"}(ln||(ln={}));const dn={jsonrpc:G("2.0"),id:re([ee(),J(),G(null)])},fn=fe({...dn,method:G("keyring_listAccounts")}),hn=(W(Tt),fe({...dn,method:G("keyring_getAccount"),params:fe({id:ce})})),pn=fe({...dn,method:G("keyring_createAccount"),params:fe({options:X(ee(),We)})}),gn=fe({...dn,method:G("keyring_setSelectedAccounts"),params:fe({accounts:W(ee())})}),mn=(G(null),fe({...dn,method:G("keyring_discoverAccounts"),params:fe({scopes:W(pt),entropySource:ee(),groupIndex:J()})})),yn=(W(Bt),fe({...dn,method:G("keyring_listAccountTransactions"),params:fe({id:ce,pagination:$t})})),wn=fe({...dn,method:G("keyring_listAccountAssets"),params:fe({id:ce})}),vn=W(wt),An=fe({...dn,method:G(`${ln.GetAccountBalances}`),params:fe({id:ce,assets:W(mt)})}),bn=(X(mt,Rt),fe({...dn,method:G("keyring_resolveAccountAddress"),params:fe({scope:pt,request:Oe})})),Sn=(Z(fe({address:gt})),fe({...dn,method:G("keyring_filterAccountChains"),params:fe({id:ce,chains:W(ee())})})),En=(W(ee()),fe({...dn,method:G("keyring_updateAccount"),params:fe({account:Tt})})),kn=(G(null),fe({...dn,method:G("keyring_deleteAccount"),params:fe({id:ce})})),Tn=(G(null),fe({...dn,method:G("keyring_exportAccount"),params:fe({id:ce})})),In=fe({...dn,method:G("keyring_listRequests")}),xn=(W(Mt),fe({...dn,method:G("keyring_getRequest"),params:fe({id:ce})})),_n=fe({...dn,method:G("keyring_submitRequest"),params:Mt}),Cn=fe({...dn,method:G("keyring_approveRequest"),params:fe({id:ce,data:X(ee(),We)})}),Rn=(G(null),fe({...dn,method:G("keyring_rejectRequest"),params:fe({id:ce})}));G(null);var Pn;!function(e){e.AccountCreated="notify:accountCreated",e.AccountUpdated="notify:accountUpdated",e.AccountDeleted="notify:accountDeleted",e.RequestApproved="notify:requestApproved",e.RequestRejected="notify:requestRejected",e.AccountBalancesUpdated="notify:accountBalancesUpdated",e.AccountAssetListUpdated="notify:accountAssetListUpdated",e.AccountTransactionsUpdated="notify:accountTransactionsUpdated"}(Pn||(Pn={}));fe({method:G(`${Pn.AccountCreated}`),params:fe({account:Tt,accountNameSuggestion:pe(ee()),displayConfirmation:pe(q()),displayAccountNameSuggestion:pe(q()),...Wt.schema})}),fe({method:G(`${Pn.AccountUpdated}`),params:fe({account:Tt})}),fe({method:G(`${Pn.AccountDeleted}`),params:fe({id:ce})}),fe({method:G(`${Pn.RequestApproved}`),params:fe({id:ce,result:We})}),fe({method:G(`${Pn.RequestRejected}`),params:fe({id:ce})}),fe({method:G(`${Pn.AccountBalancesUpdated}`),params:fe({balances:X(ue,X(mt,It))})}),fe({method:G(`${Pn.AccountTransactionsUpdated}`),params:fe({transactions:X(ue,W(Ft))})}),fe({method:G(`${Pn.AccountAssetListUpdated}`),params:fe({assets:X(ue,fe({added:W(wt),removed:W(wt)}))})});class Nn extends Error{constructor(e){super(`Method not supported: ${e}`)}}async function Bn(e,t){try{return await async function(e,t){switch(j(t,Oe),t.method){case`${ln.ListAccounts}`:return j(t,fn),e.listAccounts();case`${ln.GetAccount}`:return j(t,hn),e.getAccount(t.params.id);case`${ln.CreateAccount}`:return j(t,pn),e.createAccount(t.params.options);case`${ln.DiscoverAccounts}`:if(void 0===e.discoverAccounts)throw new Nn(t.method);return j(t,mn),e.discoverAccounts(t.params.scopes,t.params.entropySource,t.params.groupIndex);case`${ln.ListAccountTransactions}`:if(void 0===e.listAccountTransactions)throw new Nn(t.method);return j(t,yn),e.listAccountTransactions(t.params.id,t.params.pagination);case`${ln.ListAccountAssets}`:if(void 0===e.listAccountAssets)throw new Nn(t.method);return j(t,wn),e.listAccountAssets(t.params.id);case`${ln.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new Nn(t.method);return j(t,An),e.getAccountBalances(t.params.id,t.params.assets);case`${ln.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new Nn(t.method);return j(t,bn),e.resolveAccountAddress(t.params.scope,t.params.request);case`${ln.SetSelectedAccounts}`:if(void 0===e.setSelectedAccounts)throw new Nn(t.method);return j(t,gn),e.setSelectedAccounts(t.params.accounts);case`${ln.FilterAccountChains}`:return j(t,Sn),e.filterAccountChains(t.params.id,t.params.chains);case`${ln.UpdateAccount}`:return j(t,En),e.updateAccount(t.params.account);case`${ln.DeleteAccount}`:return j(t,kn),e.deleteAccount(t.params.id);case`${ln.ExportAccount}`:if(void 0===e.exportAccount)throw new Nn(t.method);return j(t,Tn),e.exportAccount(t.params.id);case`${ln.ListRequests}`:if(void 0===e.listRequests)throw new Nn(t.method);return j(t,In),e.listRequests();case`${ln.GetRequest}`:if(void 0===e.getRequest)throw new Nn(t.method);return j(t,xn),e.getRequest(t.params.id);case`${ln.SubmitRequest}`:return j(t,_n),e.submitRequest(t.params);case`${ln.ApproveRequest}`:if(void 0===e.approveRequest)throw new Nn(t.method);return j(t,Cn),e.approveRequest(t.params.id,t.params.data);case`${ln.RejectRequest}`:if(void 0===e.rejectRequest)throw new Nn(t.method);return j(t,Rn),e.rejectRequest(t.params.id);default:throw new Nn(t.method)}}(e,t)}catch(e){const t=e instanceof Error&&"string"==typeof e.message?e.message:"An unknown error occurred while handling the keyring request";throw new Error(t)}}var Mn;!function(e){e.GetSelectedAccounts="getSelectedAccounts"}(Mn||(Mn={}));Y({method:G(Mn.GetSelectedAccounts)});const On=W(ee());async function zn(e,t,n){await e.request({method:"snap_manageAccounts",params:{method:t,params:{...n}}})}async function Un(e){const t=await e.request({method:"snap_manageAccounts",params:{method:Mn.GetSelectedAccounts}});return j(t,On),t}function jn(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const Ln=(e,t)=>Object.hasOwnProperty.call(e,t);var Dn;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Dn=Dn||(Dn={}));var Fn=n(282);const $n=e=>Y(e);function Wn({path:e,branch:t}){const n=e[e.length-1];return Ln(t[t.length-2],n)}function qn(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Wn(n)||e.validator(t,n),refiner:(t,n)=>!Wn(n)||e.refiner(t,n)})}function Vn(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Vn(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Vn(n[e][1])){t=!1;break}return t}return!1}const Kn=ae("JSON",(e=>Vn(e))),Gn=me(Kn,be($(),"JSON",(e=>D(e,Kn))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Hn(e){try{return function(e){L(e,Gn)}(e),!0}catch{return!1}}const Zn=G("2.0"),Jn=Z(re([J(),ee()])),Yn=$n({code:K(),message:ee(),data:qn(Gn),stack:qn(ee())}),Qn=re([X(ee(),Gn),W(Gn)]);$n({id:Jn,jsonrpc:Zn,method:ee(),params:qn(Qn)}),$n({jsonrpc:Zn,method:ee(),params:qn(Qn)});Y({id:Jn,jsonrpc:Zn,result:Q(oe()),error:Q(Yn)});const Xn=$n({id:Jn,jsonrpc:Zn,result:Gn}),er=$n({id:Jn,jsonrpc:Zn,error:Yn});re([Xn,er]);const tr={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},nr={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},rr={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},or=tr.internal,ir=(ar(or),"Unspecified server error.");function ar(e,t="Unspecified error message. This is a bug, please report it."){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(Ln(rr,t))return rr[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return ir}return t}function sr(e){return Array.isArray(e)?e.map((e=>Hn(e)?e:jn(e)?cr(e):null)):jn(e)?cr(e):Hn(e)?e:null}function cr(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Hn(r)&&(t[n]=r),t}),{})}const ur=function(e){return e?.__esModule?e.default:e}(Fn);class lr extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return jn(e)&&Ln(e,"cause")&&jn(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),Ln(this,"cause")||Object.assign(this,{cause:n.cause})),void 0!==n&&(this.data=n),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=sr(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return ur(this.serialize(),fr,2)}}class dr extends lr{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function fr(e,t){if("[Circular]"!==t)return t}const hr=e=>Cr(tr.parse,e),pr=e=>Cr(tr.invalidRequest,e),gr=e=>Cr(tr.invalidParams,e),mr=e=>Cr(tr.methodNotFound,e),yr=e=>Cr(tr.internal,e),wr=e=>Cr(tr.invalidInput,e),vr=e=>Cr(tr.resourceNotFound,e),Ar=e=>Cr(tr.resourceUnavailable,e),br=e=>Cr(tr.transactionRejected,e),Sr=e=>Cr(tr.methodNotSupported,e),Er=e=>Cr(tr.limitExceeded,e),kr=e=>Rr(nr.userRejectedRequest,e),Tr=e=>Rr(nr.unauthorized,e),Ir=e=>Rr(nr.unsupportedMethod,e),xr=e=>Rr(nr.disconnected,e),_r=e=>Rr(nr.chainDisconnected,e);function Cr(e,t){const[n,r]=Pr(t);return new lr(e,n??ar(e),r)}function Rr(e,t){const[n,r]=Pr(t);return new dr(e,n??ar(e),r)}function Pr(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}const Nr=(e,t)=>Object.hasOwnProperty.call(e,t);var Br;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Br=Br||(Br={}));const Mr=e=>Y(e);function Or({path:e,branch:t}){const n=e[e.length-1];return Nr(t[t.length-2],n)}function zr(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Or(n)||e.validator(t,n),refiner:(t,n)=>!Or(n)||e.refiner(t,n)})}function Ur(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Ur(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Ur(n[e][1])){t=!1;break}return t}return!1}const jr=ae("JSON",(e=>Ur(e))),Lr=me(jr,be($(),"JSON",(e=>D(e,jr))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Dr(e){try{return function(e){L(e,Lr)}(e),!0}catch{return!1}}const Fr=G("2.0"),$r=Z(re([J(),ee()])),Wr=Mr({code:K(),message:ee(),data:zr(Lr),stack:zr(ee())}),qr=re([X(ee(),Lr),W(Lr)]);Mr({id:$r,jsonrpc:Fr,method:ee(),params:zr(qr)}),Mr({jsonrpc:Fr,method:ee(),params:zr(qr)});Y({id:$r,jsonrpc:Fr,result:Q(oe()),error:Q(Wr)});const Vr=Mr({id:$r,jsonrpc:Fr,result:Lr}),Kr=Mr({id:$r,jsonrpc:Fr,error:Wr});re([Vr,Kr]);function Gr(e,t,n=null){return r=e,Boolean(r)&&"object"==typeof r&&!Array.isArray(r)&&Nr(e,t)?e[t]:n;var r}function Hr(e,t,n=String(e)){const r=Gr(e,t);return"string"==typeof r?r:n}function Zr(e){return Hr(e,"message")}function Jr(e){return Hr(e,"stack",null)}function Yr(e){return Hr(e,"name",e instanceof Error?e.name:"Error")}function Qr(e){const t=Gr(e,"data");return null!==t&&Dr(t)&&!Array.isArray(t)?t:{}}class Xr extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=Zr(e);super(n),this.#t=n,this.#e=function(e){const t=Gr(e,"code");return"number"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Qr(e),...t};Object.keys(r).length>0&&(this.#n=r),this.#r=super.stack}get name(){return"SnapError"}get code(){return this.#e}get message(){return this.#t}get data(){return this.#n}get stack(){return this.#r}toJSON(){return{code:-31002,message:"Snap Error",data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}}function eo(e){if("string"==typeof e)return{name:"Error",message:e,stack:null,cause:null};if(D(e,Wr))return{name:"JsonRpcError",message:Zr(e),stack:Jr(e)??Jr(e.data)??null,cause:null};const t=function(e){return Gr(e,"cause")}(e);return{name:Yr(e),message:Zr(e),stack:Jr(e)??null,cause:null===t?null:eo(t)}}function to(e){return class extends Xr{constructor(t,n){if("object"==typeof t){const n=e();return void super({code:n.code,message:n.message,data:t})}const r=e(t);super({code:r.code,message:r.message,data:n})}}}const no=to(yr),ro=to(wr),oo=to(gr),io=to(pr),ao=to(Er),so=to(mr),co=to(Sr),uo=to(hr),lo=to(vr),fo=to(Ar),ho=to(br),po=to(_r),go=to(xr),mo=to(Tr),yo=to(Ir),wo=to(kr);var vo=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ao=Math.ceil,bo=Math.floor,So="[BigNumber Error] ",Eo=So+"Number primitive has more than 15 significant digits: ",ko=1e14,To=14,Io=9007199254740991,xo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],_o=1e7,Co=1e9;function Ro(e){var t=0|e;return e>0||e===t?t:t-1}function Po(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=To-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function No(e,t){var n,r,o=e.c,i=t.c,a=e.s,s=t.s,c=e.e,u=t.e;if(!a||!s)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=a<0,r=c==u,!o||!i)return r?0:!o^n?1:-1;if(!r)return c>u^n?1:-1;for(s=(c=o.length)<(u=i.length)?c:u,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function Bo(e,t,n,r){if(e<t||e>n||e!==bo(e))throw Error(So+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Ro(e.e/To)==t&&e.c[t]%2!=0}function Oo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function zo(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(++t>(r=e.length)){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Uo=function e(t){var n,r,o,i,a,s,c,u,l,d,f=I.prototype={constructor:I,toString:null,valueOf:null},h=new I(1),p=20,g=4,m=-7,y=21,w=-1e7,v=1e7,A=!1,b=1,S=0,E={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function I(e,t){var n,i,a,s,c,u,l,d,f=this;if(!(f instanceof I))return new I(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>v?f.c=f.e=null:e.e<w?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>v?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!vo.test(d=String(e)))return o(f,d,u);f.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(Bo(t,2,k.length,"Base"),10==t&&T)return R(f=new I(e),p+f.e+1,g);if(d=String(e),u="number"==typeof e){if(0*e!=0)return o(f,d,u,t);if(f.s=1/e<0?(d=d.slice(1),-1):1,I.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(Eo+e)}else f.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=k.slice(0,t),s=c=0,l=d.length;c<l;c++)if(n.indexOf(i=d.charAt(c))<0){if("."==i){if(c>s){s=l;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return o(f,String(e),u,t)}u=!1,(s=(d=r(d,t,10,f.s)).indexOf("."))>-1?d=d.replace(".",""):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(l=d.length;48===d.charCodeAt(--l););if(d=d.slice(c,++l)){if(l-=c,u&&I.DEBUG&&l>15&&(e>Io||e!==bo(e)))throw Error(Eo+f.s*e);if((s=s-c-1)>v)f.c=f.e=null;else if(s<w)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%To,s<0&&(c+=To),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=To;c<l;)f.c.push(+d.slice(c,c+=To));c=To-(d=d.slice(c)).length}else c-=l;for(;c--;d+="0");f.c.push(+d)}}else f.c=[f.e=0]}function x(e,t,n,r){var o,i,a,s,c;if(null==n?n=g:Bo(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)c=Po(e.c),c=1==r||2==r&&(a<=m||a>=y)?Oo(c,a):zo(c,a,"0");else if(i=(e=R(new I(e),t,n)).e,s=(c=Po(e.c)).length,1==r||2==r&&(t<=i||i<=m)){for(;s<t;c+="0",s++);c=Oo(c,i)}else if(t-=a,c=zo(c,i,"0"),i+1>s){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-s)>0)for(i+1==s&&(c+=".");t--;c+="0");return e.s<0&&o?"-"+c:c}function _(e,t){for(var n,r,o=1,i=new I(e[0]);o<e.length;o++)(!(r=new I(e[o])).s||(n=No(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function C(e,t,n){for(var r=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,r++);return(n=r+n*To-1)>v?e.c=e.e=null:n<w?e.c=[e.e=0]:(e.e=n,e.c=t),e}function R(e,t,n,r){var o,i,a,s,c,u,l,d=e.c,f=xo;if(d){e:{for(o=1,s=d[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=To,a=t,c=d[u=0],l=bo(c/f[o-a-1]%10);else if((u=Ao((i+1)/To))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,o=1,a=(i%=To)-To+1}else{for(c=s=d[u],o=1;s>=10;s/=10,o++);l=(a=(i%=To)-To+o)<0?0:bo(c/f[o-a-1]%10)}if(r=r||t<0||null!=d[u+1]||(a<0?c:c%f[o-a-1]),r=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(i>0?a>0?c/f[o-a]:0:d[u-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,r?(t-=e.e+1,d[0]=f[(To-t%To)%To],e.e=-t||0):d[0]=e.e=0,e;if(0==i?(d.length=u,s=1,u--):(d.length=u+1,s=f[To-i],d[u]=a>0?bo(c/f[o-a]%f[a])*s:0),r)for(;;){if(0==u){for(i=1,a=d[0];a>=10;a/=10,i++);for(a=d[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(e.e++,d[0]==ko&&(d[0]=1));break}if(d[u]+=s,d[u]!=ko)break;d[u--]=0,s=1}for(i=d.length;0===d[--i];d.pop());}e.e>v?e.c=e.e=null:e.e<w&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=Po(e.c),t=n<=m||n>=y?Oo(t,n):zo(t,n,"0"),e.s<0?"-"+t:t)}return I.clone=e,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(So+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(Bo(n=e[t],0,Co,t),p=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(Bo(n=e[t],0,8,t),g=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(Bo(n[0],-Co,0,t),Bo(n[1],0,Co,t),m=n[0],y=n[1]):(Bo(n,-Co,Co,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)Bo(n[0],-Co,-1,t),Bo(n[1],1,Co,t),w=n[0],v=n[1];else{if(Bo(n,-Co,Co,t),!n)throw Error(So+t+" cannot be zero: "+n);w=-(v=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(So+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(So+"crypto unavailable");A=n}else A=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(Bo(n=e[t],0,9,t),b=n),e.hasOwnProperty(t="POW_PRECISION")&&(Bo(n=e[t],0,Co,t),S=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(So+t+" not an object: "+n);E=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(So+t+" invalid: "+n);T="0123456789"==n.slice(0,10),k=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[w,v],CRYPTO:A,MODULO_MODE:b,POW_PRECISION:S,FORMAT:E,ALPHABET:k}},I.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!I.DEBUG)return!0;var t,n,r=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-Co&&o<=Co&&o===bo(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%To)<1&&(t+=To),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ko||n!==bo(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(So+"Invalid BigNumber: "+e)},I.maximum=I.max=function(){return _(arguments,-1)},I.minimum=I.min=function(){return _(arguments,1)},I.random=(i=9007199254740992,a=Math.random()*i&2097151?function(){return bo(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,i,s=0,c=[],u=new I(h);if(null==e?e=p:Bo(e,0,Co),o=Ao(e/To),A)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));s<o;)(i=131072*t[s]+(t[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[s]=n[0],t[s+1]=n[1]):(c.push(i%1e14),s+=2);s=o/2}else{if(!crypto.randomBytes)throw A=!1,Error(So+"crypto unavailable");for(t=crypto.randomBytes(o*=7);s<o;)(i=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(c.push(i%1e14),s+=7);s=o/7}if(!A)for(;s<o;)(i=a())<9e15&&(c[s++]=i%1e14);for(o=c[--s],e%=To,o&&e&&(i=xo[To-e],c[s]=bo(o/i)*i);0===c[s];c.pop(),s--);if(s<0)c=[r=0];else{for(r=-1;0===c[0];c.splice(0,1),r-=To);for(s=1,i=c[0];i>=10;i/=10,s++);s<To&&(r-=To-s)}return u.e=r,u.c=c,u}),I.sum=function(){for(var e=1,t=arguments,n=new I(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var o,i,a=[0],s=0,c=e.length;s<c;){for(i=a.length;i--;a[i]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),o=0;o<a.length;o++)a[o]>n-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/n|0,a[o]%=n)}return a.reverse()}return function(r,o,i,a,s){var c,u,l,d,f,h,m,y,w=r.indexOf("."),v=p,A=g;for(w>=0&&(d=S,S=0,r=r.replace(".",""),h=(y=new I(o)).pow(r.length-w),S=d,y.c=t(zo(Po(h.c),h.e,"0"),10,i,e),y.e=y.c.length),l=d=(m=t(r,o,i,s?(c=k,e):(c=e,k))).length;0==m[--d];m.pop());if(!m[0])return c.charAt(0);if(w<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,v,A,i)).c,f=h.r,l=h.e),w=m[u=l+v+1],d=i/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=w||f)&&(0==A||A==(h.s<0?3:2)):w>d||w==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?zo(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(m.length=u,f)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(d=m.length;!m[--d];);for(w=0,r="";w<=d;r+=c.charAt(m[w++]));r=zo(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,o,i,a,s=0,c=e.length,u=t%_o,l=t/_o|0;for(e=e.slice();c--;)s=((o=u*(i=e[c]%_o)+(r=l*i+(a=e[c]/_o|0)*u)%_o*_o+s)/n|0)+(r/_o|0)+l*a,e[c]=o%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function n(e,t,n,r){for(var o=0;n--;)e[n]-=o,o=e[n]<t[n]?1:0,e[n]=o*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,i,a,s){var c,u,l,d,f,h,p,g,m,y,w,v,A,b,S,E,k,T=r.s==o.s?1:-1,x=r.c,_=o.c;if(!(x&&x[0]&&_&&_[0]))return new I(r.s&&o.s&&(x?!_||x[0]!=_[0]:_)?x&&0==x[0]||!_?0*T:T/0:NaN);for(m=(g=new I(T)).c=[],T=i+(u=r.e-o.e)+1,s||(s=ko,u=Ro(r.e/To)-Ro(o.e/To),T=T/To|0),l=0;_[l]==(x[l]||0);l++);if(_[l]>(x[l]||0)&&u--,T<0)m.push(1),d=!0;else{for(b=x.length,E=_.length,l=0,T+=2,(f=bo(s/(_[0]+1)))>1&&(_=e(_,f,s),x=e(x,f,s),E=_.length,b=x.length),A=E,w=(y=x.slice(0,E)).length;w<E;y[w++]=0);k=_.slice(),k=[0].concat(k),S=_[0],_[1]>=s/2&&S++;do{if(f=0,(c=t(_,y,E,w))<0){if(v=y[0],E!=w&&(v=v*s+(y[1]||0)),(f=bo(v/S))>1)for(f>=s&&(f=s-1),p=(h=e(_,f,s)).length,w=y.length;1==t(h,y,p,w);)f--,n(h,E<p?k:_,p,s),p=h.length,c=1;else 0==f&&(c=f=1),p=(h=_.slice()).length;if(p<w&&(h=[0].concat(h)),n(y,h,w,s),w=y.length,-1==c)for(;t(_,y,E,w)<1;)f++,n(y,E<w?k:_,w,s),w=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[w++]=x[A]||0:(y=[x[A]],w=1)}while((A++<b||null!=y[0])&&T--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==ko){for(l=1,T=m[0];T>=10;T/=10,l++);R(g,i+(g.e=l+u*To-1)+1,a,d)}else g.e=u,g.r=+d;return g}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,d=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,n,r){var o,i=n?t:t.replace(d,"");if(l.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(s,(function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t})),r&&(o=r,i=i.replace(c,"$1").replace(u,"0.$1")),t!=i))return new I(i,o);if(I.DEBUG)throw Error(So+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new I(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return No(this,new I(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,o,i=this;if(null!=e)return Bo(e,0,Co),null==t?t=g:Bo(t,0,8),R(new I(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-Ro(this.e/To))*To,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},f.dividedBy=f.div=function(e,t){return n(this,new I(e,t),p,g)},f.dividedToIntegerBy=f.idiv=function(e,t){return n(this,new I(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,t){var n,r,o,i,a,s,c,u,l=this;if((e=new I(e)).c&&!e.isInteger())throw Error(So+"Exponent not an integer: "+P(e));if(null!=t&&(t=new I(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new I(Math.pow(+P(l),a?e.s*(2-Mo(e)):+P(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new I(NaN);(r=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return i=l.s<0&&Mo(e)?-0:0,l.e>-1&&(i=1/i),new I(s?1/i:i);S&&(i=Ao(S/To+2))}for(a?(n=new I(.5),s&&(e.s=1),c=Mo(e)):c=(o=Math.abs(+P(e)))%2,u=new I(h);;){if(c){if(!(u=u.times(l)).c)break;i?u.c.length>i&&(u.c.length=i):r&&(u=u.mod(t))}if(o){if(0===(o=bo(o/2)))break;c=o%2}else if(R(e=e.times(n),e.e+1,1),e.e>14)c=Mo(e);else{if(0===(o=+P(e)))break;c=o%2}l=l.times(l),i?l.c&&l.c.length>i&&(l.c.length=i):r&&(l=l.mod(t))}return r?u:(s&&(u=h.div(u)),t?u.mod(t):i?R(u,S,g,undefined):u)},f.integerValue=function(e){var t=new I(this);return null==e?e=g:Bo(e,0,8),R(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===No(this,new I(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return No(this,new I(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=No(this,new I(e,t)))||0===t},f.isInteger=function(){return!!this.c&&Ro(this.e/To)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return No(this,new I(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=No(this,new I(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var n,r,o,i,a=this,s=a.s;if(t=(e=new I(e,t)).s,!s||!t)return new I(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/To,u=e.e/To,l=a.c,d=e.c;if(!c||!u){if(!l||!d)return l?(e.s=-t,e):new I(d?a:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new I(l[0]?a:3==g?-0:0)}if(c=Ro(c),u=Ro(u),l=l.slice(),s=c-u){for((i=s<0)?(s=-s,o=l):(u=c,o=d),o.reverse(),t=s;t--;o.push(0));o.reverse()}else for(r=(i=(s=l.length)<(t=d.length))?s:t,s=t=0;t<r;t++)if(l[t]!=d[t]){i=l[t]<d[t];break}if(i&&(o=l,l=d,d=o,e.s=-e.s),(t=(r=d.length)-(n=l.length))>0)for(;t--;l[n++]=0);for(t=ko-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=ko}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?C(e,l,u):(e.s=3==g?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var r,o,i=this;return e=new I(e,t),!i.c||!e.s||e.c&&!e.c[0]?new I(NaN):!e.c||i.c&&!i.c[0]?new I(i):(9==b?(o=e.s,e.s=1,r=n(i,e,0,3),e.s=o,r.s*=o):r=n(i,e,0,b),(e=i.minus(r.times(e))).c[0]||1!=b||(e.s=i.s),e)},f.multipliedBy=f.times=function(e,t){var n,r,o,i,a,s,c,u,l,d,f,h,p,g,m,y=this,w=y.c,v=(e=new I(e,t)).c;if(!(w&&v&&w[0]&&v[0]))return!y.s||!e.s||w&&!w[0]&&!v||v&&!v[0]&&!w?e.c=e.e=e.s=null:(e.s*=y.s,w&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=Ro(y.e/To)+Ro(e.e/To),e.s*=y.s,(c=w.length)<(d=v.length)&&(p=w,w=v,v=p,o=c,c=d,d=o),o=c+d,p=[];o--;p.push(0));for(g=ko,m=_o,o=d;--o>=0;){for(n=0,f=v[o]%m,h=v[o]/m|0,i=o+(a=c);i>o;)n=((u=f*(u=w[--a]%m)+(s=h*u+(l=w[a]/m|0)*f)%m*m+p[i]+n)/g|0)+(s/m|0)+h*l,p[i--]=u%g;p[i]=n}return n?++r:p.splice(0,1),C(e,p,r)},f.negated=function(){var e=new I(this);return e.s=-e.s||null,e},f.plus=function(e,t){var n,r=this,o=r.s;if(t=(e=new I(e,t)).s,!o||!t)return new I(NaN);if(o!=t)return e.s=-t,r.minus(e);var i=r.e/To,a=e.e/To,s=r.c,c=e.c;if(!i||!a){if(!s||!c)return new I(o/0);if(!s[0]||!c[0])return c[0]?e:new I(s[0]?r:0*o)}if(i=Ro(i),a=Ro(a),s=s.slice(),o=i-a){for(o>0?(a=i,n=c):(o=-o,n=s),n.reverse();o--;n.push(0));n.reverse()}for((o=s.length)-(t=c.length)<0&&(n=c,c=s,s=n,t=o),o=0;t;)o=(s[--t]=s[t]+c[t]+o)/ko|0,s[t]=ko===s[t]?0:s[t]%ko;return o&&(s=[o].concat(s),++a),C(e,s,a)},f.precision=f.sd=function(e,t){var n,r,o,i=this;if(null!=e&&e!==!!e)return Bo(e,1,Co),null==t?t=g:Bo(t,0,8),R(new I(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*To+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},f.shiftedBy=function(e){return Bo(e,-9007199254740991,Io),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,r,o,i,a=this,s=a.c,c=a.s,u=a.e,l=p+4,d=new I("0.5");if(1!==c||!s||!s[0])return new I(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+P(a)))||c==1/0?(((t=Po(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=Ro((u+1)/2)-(u<0||u%2),r=new I(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new I(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=d.times(i.plus(n(a,i,l,1))),Po(i.c).slice(0,c)===(t=Po(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(R(r,r.e+p+2,1),e=!r.times(r).eq(a));break}if(!o&&(R(i,i.e+p+2,0),i.times(i).eq(a))){r=i;break}l+=4,c+=4,o=1}return R(r,r.e+p+1,g,e)},f.toExponential=function(e,t){return null!=e&&(Bo(e,0,Co),e++),x(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(Bo(e,0,Co),e=e+this.e+1),x(this,e,t)},f.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=E;else if("object"!=typeof n)throw Error(So+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var i,a=r.split("."),s=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",l=a[0],d=a[1],f=o.s<0,h=f?l.slice(1):l,p=h.length;if(c&&(i=s,s=c,c=i,p-=i),s>0&&p>0){for(i=p%s||s,l=h.substr(0,i);i<p;i+=s)l+=u+h.substr(i,s);c>0&&(l+=u+h.slice(i)),f&&(l="-"+l)}r=d?l+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):l}return(n.prefix||"")+r+(n.suffix||"")},f.toFraction=function(e){var t,r,o,i,a,s,c,u,l,d,f,p,m=this,y=m.c;if(null!=e&&(!(c=new I(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(So+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+P(c));if(!y)return new I(m);for(t=new I(h),l=r=new I(h),o=u=new I(h),p=Po(y),a=t.e=p.length-m.e-1,t.c[0]=xo[(s=a%To)<0?To+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=v,v=1/0,c=new I(p),u.c[0]=0;d=n(c,t,0,1),1!=(i=r.plus(d.times(o))).comparedTo(e);)r=o,o=i,l=u.plus(d.times(i=l)),u=i,t=c.minus(d.times(i=t)),c=i;return i=n(e.minus(r),o,0,1),u=u.plus(i.times(l)),r=r.plus(i.times(o)),u.s=l.s=m.s,f=n(l,o,a*=2,g).minus(m).abs().comparedTo(n(u,r,a,g).minus(m).abs())<1?[l,o]:[u,r],v=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&Bo(e,1,Co),x(this,e,t,2)},f.toString=function(e){var t,n=this,o=n.s,i=n.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=m||i>=y?Oo(Po(n.c),i):zo(Po(n.c),i,"0"):10===e&&T?t=zo(Po((n=R(new I(n),p+i+1,g)).c),n.e,"0"):(Bo(e,2,k.length,"Base"),t=r(zo(Po(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(t="-"+t)),t},f.valueOf=f.toJSON=function(){return P(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=t&&I.set(t),I}();const jo=Uo;function Lo(e,t){return ae(e,(e=>"string"==typeof e&&t.test(e)))}const Do=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Fo=/^[-a-z0-9]{3,8}$/u,$o=/^[-_a-zA-Z0-9]{1,32}$/u,Wo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,qo=/^[-.%a-zA-Z0-9]{1,128}$/u,Vo=/^[-a-z0-9]{3,8}$/u,Ko=/^[-.%a-zA-Z0-9]{1,128}$/u,Go=/^[-.%a-zA-Z0-9]{1,78}$/u,Ho=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,Zo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,Jo=(Lo("CaipChainId",Do),Lo("CaipNamespace",Fo),Lo("CaipReference",$o),Lo("CaipAccountId",Wo),Lo("CaipAccountAddress",qo),Lo("CaipAssetNamespace",Vo),Lo("CaipAssetReference",Ko),Lo("CaipTokenId",Go),Lo("CaipAssetType",Ho));Lo("CaipAssetId",Zo),Lo("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var Yo;function Qo(e){const t=Ho.exec(e);if(!t?.groups)throw new Error("Invalid CAIP asset type.");return{assetNamespace:t.groups.assetNamespace,assetReference:t.groups.assetReference,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}function Xo(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(Yo=Yo||(Yo={}));class ei extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function ti(e,t="Assertion failed.",n=ei){if(!e){if(t instanceof Error)throw t;throw Xo(n,t)}}var ni=-32700,ri=-32603,oi=-32602,ii=-32601,ai=-32600,si=-32015,ci=-32014,ui=-32012,li=-32010,di=-32009,fi=-32007,hi=-32006,pi=-32004,gi=-32002,mi=-32001,yi=28e5,wi=2800001,vi=2800003,Ai=2800006,bi=2800007,Si=2800008,Ei=2800009,ki=323e4,Ti=32300001,Ii=3230002,xi=3230004,_i=361e4,Ci=3610001,Ri=3610003,Pi=3610005,Ni=3610006,Bi=3610007,Mi=3704001,Oi=3704002,zi=3704003,Ui=4615e3,ji=4615026,Li=4615045,Di=5508e3,Fi=5663e3,$i=5663001,Wi=5663004,qi=5663005,Vi=5663006,Ki=5663007,Gi=5663008,Hi=5663009,Zi=5663012,Ji=5663015,Yi=5663016,Qi=5663017,Xi=5663018,ea=5663019,ta=705e4,na=7050030,ra=7050031,oa=7050035,ia=8078e3,aa=8078001,sa=8078002,ca=8078004,ua=8078005,la=8078006,da=8078007,fa=8078008,ha=8078010,pa=8078011,ga=8078012,ma=8078013,ya=8078014,wa=8078017,va=8078018,Aa=8078022,ba=81e5,Sa=8100002,Ea=8100003,ka=9900003;function Ta(e){if(Array.isArray(e)){return"%5B"+e.map(Ta).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function Ia([e,t]){return`${e}=${Ta(t)}`}function xa(e,t={}){{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${function(e){const t=Object.entries(e).map(Ia).join("&");return btoa(t)}(t)}'`),`${n}\``}}function _a(e,t){return!!(e instanceof Error&&"SolanaError"===e.name)&&(void 0===t||e.context.__code===t)}var Ca=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;if(t){const{cause:e,...o}=t;e&&(r={cause:e}),Object.keys(o).length>0&&(n=o)}super(xa(e,n),r),this.context={__code:e,...n},this.name="SolanaError"}};function Ra(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function Pa({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:n,rpcEnumError:r},o){let i,a;"string"==typeof r?i=r:(i=Object.keys(r)[0],a=r[i]);const s=e+n.indexOf(i),c=t(s,i,a),u=new Ca(s,c);return Ra(u,o),u}var Na=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"];function Ba(e,t){const n=Number(e);return Pa({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===Ui?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===ji?{code:Number(r),index:n}:e===Li?{encodedData:r,index:n}:{index:n},orderedErrorNames:Na,rpcEnumError:t},Ba)}var Ma=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function Oa(e){return"object"==typeof e&&"InstructionError"in e?Ba(...e.InstructionError):Pa({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===ta?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===na?{index:Number(n)}:e===ra||e===oa?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:Ma,rpcEnumError:e},Oa)}function za(e){let t;if("object"==typeof(n=e)&&null!==n&&"code"in n&&"message"in n&&("number"==typeof n.code||"bigint"==typeof n.code)&&"string"==typeof n.message){const{code:n,data:r,message:o}=e,i=Number(n);if(i===gi){const{err:e,...n}=r,o=e?{cause:Oa(e)}:null;t=new Ca(gi,{...n,...o})}else{let e;switch(i){case ri:case oi:case ai:case ii:case ni:case ui:case mi:case pi:case ci:case li:case di:case fi:case hi:case si:e={__serverMessage:o};break;default:"object"!=typeof r||Array.isArray(r)||(e=r)}t=new Ca(i,e)}}else{const n="object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:"Malformed JSON-RPC error with no message attribute";t=new Ca(10,{error:e,message:n})}var n;return Ra(t,za),t}var Ua=(e,t)=>((e,t)=>{if(e.length>=t)return e;const n=new Uint8Array(t).fill(0);return n.set(e),n})(e.length<=t?e:e.slice(0,t),t);function ja(e,t,n){const r=0===n&&e.length===t.length?e:e.slice(n,n+t.length);return r.length===t.length&&t.every(((e,t)=>e===r[t]))}function La(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function Da(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(La(t,e));return e.write(t,n,0),n}})}function Fa(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function $a(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function Wa(e){if(!$a(e))throw new Ca(sa)}function qa(e){return!$a(e)}function Va(e,t){if($a(e)!==$a(t))throw new Ca(ca);if($a(e)&&$a(t)&&e.fixedSize!==t.fixedSize)throw new Ca(ua,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!$a(e)&&!$a(t)&&e.maxSize!==t.maxSize)throw new Ca(la,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function Ka(e,t,n,r=0){const o=n.length-r;if(o<t)throw new Ca(aa,{bytesLength:o,codecDescription:e,expected:t})}function Ga(e,t,n){if(t<0||t>n)throw new Ca(ya,{bytesLength:n,codecDescription:e,offset:t})}function Ha(e,t){const n=(n,r,o)=>{const i=e.encode(n);return o=t.write(i.length,r,o),r.set(i,o),o+i.length};if($a(t)&&$a(e))return Da({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=$a(t)?t.fixedSize:t.maxSize??null,o=$a(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Da({...e,...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=La(n,e);return La(r,t)+r},write:n})}function Za(e,t){const n=(n,r)=>{const[o,i]=t.read(n,r),a=Number(o);return((r=i)>0||n.length>a)&&(n=n.slice(r,r+a)),Ka("addDecoderSizePrefix",a,n),[e.decode(n),r+a]};if($a(t)&&$a(e))return Fa({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=$a(t)?t.fixedSize:t.maxSize??null,o=$a(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Fa({...e,...null!==i?{maxSize:i}:{},read:n})}function Ja(e,t){return Da({fixedSize:t,write:(n,r,o)=>{const i=e.encode(n),a=i.length>t?i.slice(0,t):i;return r.set(a,o),o+t}})}function Ya(e,t){return Fa({fixedSize:t,read:(n,r)=>{Ka("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),$a(e)&&(n=Ua(n,e.fixedSize));const[o]=e.read(n,0);return[o,r+t]}})}function Qa(e,t){return Da({...e,write:(n,r,o)=>{const i=e=>es(e,r.length),a=t.preOffset?t.preOffset({bytes:r,preOffset:o,wrapBytes:i}):o;Ga("offsetEncoder",a,r.length);const s=e.write(n,r,a),c=t.postOffset?t.postOffset({bytes:r,newPreOffset:a,postOffset:s,preOffset:o,wrapBytes:i}):s;return Ga("offsetEncoder",c,r.length),c}})}function Xa(e,t){return Fa({...e,read:(n,r)=>{const o=e=>es(e,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Ga("offsetDecoder",i,n.length);const[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return Ga("offsetDecoder",c,n.length),[a,c]}})}function es(e,t){return 0===t?0:(e%t+t)%t}function ts(e,t){if($a(e)){const n=t(e.fixedSize);if(n<0)throw new Ca(ma,{bytesLength:n,codecDescription:"resizeEncoder"});return Da({...e,fixedSize:n})}return Da({...e,getSizeFromValue:n=>{const r=t(e.getSizeFromValue(n));if(r<0)throw new Ca(ma,{bytesLength:r,codecDescription:"resizeEncoder"});return r}})}function ns(e,t){if($a(e)){const n=t(e.fixedSize);if(n<0)throw new Ca(ma,{bytesLength:n,codecDescription:"resizeDecoder"});return Fa({...e,fixedSize:n})}return e}function rs(e,t){return Qa(ts(e,(e=>e+t)),{preOffset:({preOffset:e})=>e+t})}function os(e,t){return Xa(ns(e,(e=>e+t)),{postOffset:({postOffset:e})=>e+t})}function is(e,t){return Da({...qa(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function as(e,t){return Fa({...e,read:(n,r)=>{const[o,i]=e.read(n,r);return[t(o,n,r),i]}})}function ss(e,t,n,r){if(r<t||r>n)throw new Ca(pa,{codecDescription:e,max:n,min:t,value:r})}var cs,us=((cs=us||{})[cs.Little=0]="Little",cs[cs.Big=1]="Big",cs);function ls(e){return 1!==e?.endian}function ds(e){return Da({fixedSize:e.size,write(t,n,r){e.range&&ss(e.name,e.range[0],e.range[1],t);const o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,ls(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function fs(e){return Fa({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Ca(ia,{codecDescription:e})}(e.name,t,n),Ka(e.name,e.size,t,n);const r=new DataView(function(e,t,n){const r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}(t,n,e.size));return[e.get(r,ls(e.config)),n+e.size]}})}var hs=(e={})=>fs({config:e,get:(e,t)=>e.getFloat64(0,t),name:"f64",size:8}),ps=(e={})=>fs({config:e,get:(e,t)=>e.getInt16(0,t),name:"i16",size:2}),gs=(e={})=>fs({config:e,get:(e,t)=>e.getBigInt64(0,t),name:"i64",size:8}),ms=()=>fs({get:e=>e.getInt8(0),name:"i8",size:1}),ys=()=>Da({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{ss("shortU16",0,65535,e);const r=[0];for(let t=0;;t+=1){const n=Number(e)>>7*t;if(0===n)break;const o=127&n;r[t]=o,t>0&&(r[t-1]|=128)}return t.set(r,n),n+r.length}}),ws=()=>Fa({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){const o=r-1,i=e[t+o];if(n|=(127&i)<<7*o,!(128&i))break}return[n,t+r]}}),vs=(e={})=>fs({config:e,get:(e,t)=>e.getUint16(0,t),name:"u16",size:2}),As=(e={})=>ds({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),bs=(e={})=>fs({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),Ss=(e={})=>ds({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),Es=(e={})=>fs({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}),ks=()=>ds({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),Ts=()=>fs({get:e=>e.getUint8(0),name:"u8",size:1});var Is,xs=((Is=xs||{})[Is.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",Is[Is.READONLY_SIGNER=2]="READONLY_SIGNER",Is[Is.WRITABLE=1]="WRITABLE",Is[Is.READONLY=0]="READONLY",Is);function _s(e){return e>=2}function Cs(e){return!!(1&e)}function Rs(e,t){return e|t}function Ps(e){return 2|e}function Ns(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Ca(ga,{alphabet:e,base:e.length,value:n})}var Bs=e=>Da({getSizeFromValue:t=>{const[n,r]=zs(t,e[0]);if(!r)return t.length;const o=Us(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Ns(e,t),""===t)return r;const[o,i]=zs(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=Us(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),Ms=e=>Fa({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}}),Os=e=>Va(Bs(e),Ms(e));function zs(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function Us(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var js="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ls=()=>Bs(js),Ds=()=>Ms(js),Fs=()=>Os(js);var $s,Ws,qs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vs=()=>Da({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Ca(ga,{alphabet:qs,base:64,value:e})}},write(e,t,n){try{const r=atob(e).split("").map((e=>e.charCodeAt(0)));return t.set(r,n),r.length+n}catch{throw new Ca(ga,{alphabet:qs,base:64,value:e})}}}),Ks=()=>Fa({read(e,t=0){const n=e.slice(t);return[btoa(String.fromCharCode(...n)),e.length]}}),Gs=()=>Va(Vs(),Ks()),Hs=e=>e.replace(/\u0000/g,""),Zs=globalThis.TextDecoder,Js=globalThis.TextEncoder,Ys=()=>{let e;return Fa({read(t,n){const r=(e||=new Zs).decode(t.slice(n));return[Hs(r),t.length]}})},Qs=()=>Va((()=>{let e;return Da({getSizeFromValue:t=>(e||=new Js).encode(t).length,write:(t,n,r)=>{const o=(e||=new Js).encode(t);return n.set(o,r),r+o.length}})})(),Ys());function Xs(){if(!globalThis.isSecureContext)throw new Ca(_i)}function ec(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new Ca(Ri)}function tc(){return $s||($s=Ls()),$s}function nc(e){if(e.length<32||e.length>44)return!1;const t=tc();try{return 32===t.encode(e).byteLength}catch{return!1}}function rc(e){if(e.length<32||e.length>44)throw new Ca(wi,{actualLength:e.length});const t=tc().encode(e).byteLength;if(32!==t)throw new Ca(yi,{actualLength:t})}function oc(e){return rc(e),e}function ic(){return is(Ja(tc(),32),(e=>oc(e)))}function ac(){return Ya((Ws||(Ws=Ds()),Ws),32)}function sc(){return Va(ic(),ac())}function cc(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var uc=57896044618658097711785492504343953926634992332820282019728792003956564819949n,lc=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function dc(e){const t=e%uc;return t>=0n?t:uc+t}function fc(e,t){let n=e;for(;t-- >0n;)n*=n,n%=uc;return n}function hc(e,t){const n=dc(t*t*t),r=function(e){const t=e*e%uc*e%uc,n=fc(t,2n)*t%uc,r=fc(n,1n)*e%uc,o=fc(r,5n)*r%uc,i=fc(o,10n)*o%uc,a=fc(i,20n)*i%uc,s=fc(a,40n)*a%uc,c=fc(s,80n)*s%uc,u=fc(c,80n)*s%uc,l=fc(u,10n)*o%uc;return fc(l,2n)*e%uc}(e*dc(n*n*t));let o=dc(e*n*r);const i=dc(t*o*o),a=o,s=dc(o*lc),c=i===e,u=i===dc(-e),l=i===dc(-e*lc);return c&&(o=a),(u||l)&&(o=s),1n==(1n&dc(o))&&(o=dc(-o)),c||u?o:null}function pc(e){if(32!==e.byteLength)return!1;const t=function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(e);return function(e,t){const n=dc(e*e),r=hc(dc(n-1n),dc(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}(t,e[31])}var gc=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function mc({programAddress:e,seeds:t}){if(function(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new Ca(Ci)}(),t.length>16)throw new Ca(Ai,{actual:t.length,maxSeeds:16});let n;const r=t.reduce(((e,t,r)=>{const o="string"==typeof t?(n||=new TextEncoder).encode(t):t;if(o.byteLength>32)throw new Ca(bi,{actual:o.byteLength,index:r,maxSeedLength:32});return e.push(...o),e}),[]),o=sc(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...gc])),s=new Uint8Array(a);if(pc(s))throw new Ca(Si);return o.decode(s)}async function yc({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await mc({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!_a(e,Si))throw e;n--}throw new Ca(Ei)}async function wc(e){if(ec(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new Ca(vi);const t=await crypto.subtle.exportKey("raw",e);return ac().decode(new Uint8Array(t))}var vc,Ac=Object.freeze({name:"Ed25519"});async function bc(e,t){const n=e.byteLength;if(32!==n)throw new Ca(Mi,{actualLength:n});const r=function(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}(e);return await crypto.subtle.importKey("pkcs8",r,Ac,t??!1,["sign"])}async function Sc(e,t){!function(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new Ca(Pi)}();const n=await crypto.subtle.sign(Ac,e,t);return new Uint8Array(n)}function Ec(e){return function(e){if(vc||(vc=Ls()),e.length<64||e.length>88)throw new Ca(zi,{actualLength:e.length});const t=vc.encode(e).byteLength;if(64!==t)throw new Ca(Oi,{actualLength:t})}(e),e}async function kc(e,t,n){return function(){if(Xs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new Ca(Ni)}(),await crypto.subtle.verify(Ac,e,t,n)}async function Tc(e,t=!1){const n=bc(e,t),[r,o]=await Promise.all([(t?n:bc(e,!0)).then((async e=>await async function(e,t=!1){if(ec(),!1===e.extractable)throw new Ca(Bi,{key:e});const n=await crypto.subtle.exportKey("jwk",e);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:t,key_ops:["verify"],kty:"OKP",x:n.x},"Ed25519",t,["verify"])}(e,!0))),n]);return{privateKey:o,publicKey:r}}function Ic(e,t,n){if(t!==n)throw new Ca(da,{actual:n,codecDescription:e,expected:t})}function xc(e){return e.reduce(((e,t)=>null===e||null===t?null:e+t),0)}function _c(e){return $a(e)?e.fixedSize:null}function Cc(e){return $a(e)?e.fixedSize:e.maxSize??null}function Rc(e,t={}){const n=t.size??As(),r=Nc(n,_c(e)),o=Nc(n,Cc(e))??void 0;return Da({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>("object"==typeof n?La(t.length,n):0)+[...t].reduce(((t,n)=>t+La(n,e)),0),maxSize:o},write:(t,r,o)=>("number"==typeof n&&Ic("array",n,t.length),"object"==typeof n&&(o=n.write(t.length,r,o)),t.forEach((t=>{o=e.write(t,r,o)})),o)})}function Pc(e,t={}){const n=t.size??bs(),r=_c(e),o=Nc(n,r),i=Nc(n,Cc(e))??void 0;return Fa({...null!==o?{fixedSize:o}:{maxSize:i},read:(t,r)=>{const o=[];if("object"==typeof n&&0===t.slice(r).length)return[o,r];if("remainder"===n){for(;r<t.length;){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}const[i,a]="number"==typeof n?[n,r]:n.read(t,r);r=a;for(let n=0;n<i;n+=1){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}})}function Nc(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function Bc(e={}){return is(e.size??ks(),(e=>e?1:0))}function Mc(e={}){return as(e.size??Ts(),(e=>1===Number(e)))}function Oc(){return Da({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function zc(){return Fa({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}function Uc(e){return Da({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function jc(e){return Fa({fixedSize:e.length,read:(t,n)=>{const r=Fa({read(e,t){const n=e.slice(t).reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"");return[n,e.length]}});if(!ja(t,e,n))throw new Ca(va,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function Lc(e){const t=xc(e.map(_c)),n=xc(e.map(Cc))??void 0;return Da({...null===t?{getSizeFromValue:t=>e.map(((e,n)=>La(t[n],e))).reduce(((e,t)=>e+t),0),maxSize:n}:{fixedSize:t},write:(t,n,r)=>(Ic("tuple",e.length,t.length),e.forEach(((e,o)=>{r=e.write(t[o],n,r)})),r)})}function Dc(e){const t=xc(e.map(_c)),n=xc(e.map(Cc))??void 0;return Fa({...null===t?{maxSize:n}:{fixedSize:t},read:(t,n)=>{const r=[];return e.forEach((e=>{const[o,i]=e.read(t,n);r.push(o),n=i})),[r,n]}})}function Fc(e,t){const n=qc(e),r=(n,r,o)=>{const i=t(n);return Wc(e,i),e[i].write(n,r,o)};if(null!==n)return Da({fixedSize:n,write:r});const o=Vc(e);return Da({...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=t(n);return Wc(e,r),La(n,e[r])},write:r})}function $c(e,t){const n=qc(e),r=(n,r)=>{const o=t(n,r);return Wc(e,o),e[o].read(n,r)};if(null!==n)return Fa({fixedSize:n,read:r});const o=Vc(e);return Fa({...null!==o?{maxSize:o}:{},read:r})}function Wc(e,t){if(void 0===e[t])throw new Ca(wa,{maxRange:e.length-1,minRange:0,variant:t})}function qc(e){if(0===e.length)return 0;if(!$a(e[0]))return null;const t=e[0].fixedSize;return e.every((e=>$a(e)&&e.fixedSize===t))?t:null}function Vc(e){return e.map((e=>Cc(e))).reduce(((e,t)=>null===e||null===t?null:Math.max(e,t)),0)}function Kc(e,t={}){const n=t.discriminator??"__kind",r=t.size??Ts();return $c(e.map((([e,t])=>as(Dc([r,t]),(([,t])=>({[n]:e,...t}))))),((e,t)=>Number(r.read(e,t)[0])))}function Gc(e){const t=[...new Set(Object.values(e).filter((e=>"number"==typeof e)))].sort(),n=Object.fromEntries(Object.entries(e).slice(t.length)),r=Object.keys(n),o=Object.values(n),i=[...new Set([...r,...o.filter((e=>"string"==typeof e))])];return{enumKeys:r,enumRecord:n,enumValues:o,numericalValues:t,stringValues:i}}function Hc(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function Zc(e){if(0===e.length)return"";let t=[e[0],e[0]];const n=[];for(let r=1;r<e.length;r++){const o=e[r];t[1]+1===o?t[1]=o:(n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),t=[o,o])}return n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),n.join(", ")}function Jc(e,t={}){const n=t.size??ks(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=Gc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Ca(Aa,{stringValues:i.filter((e=>"string"==typeof e))});return is(n,(e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=Hc(t,(e=>e===n));return r>=0?r:e.findIndex((e=>e===n))}({enumKeys:o,enumValues:i,variant:e});if(t<0)throw new Ca(ha,{formattedNumericalValues:Zc(a),numericalValues:a,stringValues:s,variant:e});return r?i[t]:t}))}function Yc(e,t={}){const n=t.size??Ts(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a}=Gc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Ca(Aa,{stringValues:i.filter((e=>"string"==typeof e))});return as(n,(e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?Hc(n,(t=>t===e)):e>=0&&e<t.length?e:-1}({discriminator:t,enumKeys:o,enumValues:i,useValuesAsDiscriminators:r});if(n<0){const e=r?a:[...Array(o.length).keys()];throw new Ca(fa,{discriminator:t,formattedValidDiscriminators:Zc(e),validDiscriminators:e})}return i[n]}))}var Qc;function Xc(e,t){return as(Dc([...t,e]),(e=>e[e.length-1]))}function eu(e,t,n={}){return as(Pc(Dc([e,t]),n),(e=>new Map(e)))}function tu(){return Da({fixedSize:0,write:(e,t,n)=>n})}function nu(){return Fa({fixedSize:0,read:(e,t)=>[void 0,t]})}function ru(e){const t=e.map((([,e])=>e)),n=xc(t.map(_c)),r=xc(t.map(Cc))??void 0;return Da({...null===n?{getSizeFromValue:t=>e.map((([e,n])=>La(t[e],n))).reduce(((e,t)=>e+t),0),maxSize:r}:{fixedSize:n},write:(t,n,r)=>(e.forEach((([e,o])=>{r=o.write(t[e],n,r)})),r)})}function ou(e){const t=e.map((([,e])=>e)),n=xc(t.map(_c)),r=xc(t.map(Cc))??void 0;return Fa({...null===n?{maxSize:r}:{fixedSize:n},read:(t,n)=>{const r={};return e.forEach((([e,o])=>{const[i,a]=o.read(t,n);n=a,r[e]=i})),[r,n]}})}function iu(){return Qc||(Qc=Ls()),Qc}function au(e){if(e.length<32||e.length>44)throw new Ca(4,{actualLength:e.length});const t=iu().encode(e).byteLength;if(32!==t)throw new Ca(5,{actualLength:t})}function su(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new Ca(ka,{unexpectedValue:e})}}var cu=18446744073709551615n;function uu(e){return function(e){if(e<0||e>cu)throw new Ca(6)}(e),e}function lu(e,...t){return t.reduce(((e,t)=>t(e)),e)}function du(e){if(!("lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight))return!1;try{return au(e.lifetimeConstraint.blockhash),!0}catch{return!1}}function fu(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;const n={...t,lifetimeConstraint:Object.freeze(e)};return Object.freeze(n),n}var hu=e=>Da({getSizeFromValue:t=>{const[n,r]=gu(t,e[0]);if(!r)return t.length;const o=mu(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(function(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Ca(ga,{alphabet:e,base:e.length,value:n})}(e,t),""===t)return r;const[o,i]=gu(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=mu(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),pu=e=>Fa({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}});function gu(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function mu(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var yu,wu,vu,Au,bu,Su,Eu="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function ku(){return vu||(vu=ks()),vu}function Tu(){return Au||(Au=Ts()),Au}function Iu(){return Da({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,n)=>{if("legacy"===e)return n;if(e<0||e>127)throw new Ca(Wi,{actualVersion:e});return t.set([128|e],n),n+1}})}function xu(){return Fa({maxSize:1,read:(e,t)=>{const n=e[t];if(128&n){return[128^n,t+1]}return["legacy",t]}})}function _u(){return ru(Ru())}function Cu(){return is(ru([...Ru(),["addressTableLookups",Rc((yu||(yu=ru([["lookupTableAddress",ic()],["writableIndices",Rc(ks(),{size:ys()})],["readableIndices",Rc(ks(),{size:ys()})]])),yu),{size:ys()})]]),(e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]}))}function Ru(){return[["version",Iu()],["header",ru([["numSignerAccounts",ku()],["numReadonlySignerAccounts",ku()],["numReadonlyNonSignerAccounts",ku()]])],["staticAccounts",Rc(ic(),{size:ys()})],["lifetimeToken",Ja(hu(Eu),32)],["instructions",Rc((bu||(bu=is(ru([["programAddressIndex",ks()],["accountIndices",Rc(ks(),{size:ys()})],["data",Ha(Oc(),ys())]]),(e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)}))),bu),{size:ys()})]]}function Pu(){return Da({getSizeFromValue:e=>"legacy"===e.version?_u().getSizeFromValue(e):Cu().getSizeFromValue(e),write:(e,t,n)=>"legacy"===e.version?_u().write(e,t,n):Cu().write(e,t,n)})}function Nu(){return as(ou([["version",xu()],["header",ou([["numSignerAccounts",Tu()],["numReadonlySignerAccounts",Tu()],["numReadonlyNonSignerAccounts",Tu()]])],["staticAccounts",Pc(ac(),{size:ws()})],["lifetimeToken",Ya(pu(Eu),32)],["instructions",Pc((Su||(Su=as(ou([["programAddressIndex",Ts()],["accountIndices",Pc(Ts(),{size:ws()})],["data",Za(zc(),ws())]]),(e=>{if(e.accountIndices.length&&e.data.byteLength)return e;const{accountIndices:t,data:n,...r}=e;return{...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}}))),Su),{size:ws()})],["addressTableLookups",Pc((wu||(wu=ou([["lookupTableAddress",ac()],["writableIndices",Pc(Ts(),{size:ws()})],["readableIndices",Pc(Ts(),{size:ws()})]])),wu),{size:ws()})]]),(({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t))}function Bu(e,t,n){e[t]=n(e[t]??{role:xs.READONLY})}var Mu=Symbol("AddressMapTypeProperty");function Ou(e){const t={};for(const n of e){if(!("lookupTableAddress"in n))continue;const e=t[n.lookupTableAddress]||={readableIndices:[],writableIndices:[]};n.role===xs.WRITABLE?e.writableIndices.push(n.addressIndex):e.readableIndices.push(n.addressIndex)}return Object.keys(t).sort(cc()).map((e=>({lookupTableAddress:e,...t[e]})))}function zu(e){let t=0,n=0,r=0;for(const o of e){if("lookupTableAddress"in o)break;const e=Cs(o.role);_s(o.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Uu(e,t){const n=function(e){const t={};for(const[n,r]of e.entries())t[r.address]=n;return t}(t);return e.map((({accounts:e,data:t,programAddress:r})=>({programAddressIndex:n[r],...e?{accountIndices:e.map((({address:e})=>n[e]))}:null,...t?{data:t}:null})))}function ju(e){const t=e.findIndex((e=>"lookupTableAddress"in e));return(-1===t?e:e.slice(0,t)).map((({address:e})=>e))}function Lu(e){const t=function(e){let t;const n=Object.entries(e).sort((([e,n],[r,o])=>{if(n[Mu]!==o[Mu]){if(0===n[Mu])return-1;if(0===o[Mu])return 1;if(2===n[Mu])return-1;if(2===o[Mu])return 1}const i=_s(n.role);if(i!==_s(o.role))return i?-1:1;const a=Cs(n.role);return a!==Cs(o.role)?a?-1:1:(t||=cc(),1===n[Mu]&&1===o[Mu]&&n.lookupTableAddress!==o.lookupTableAddress?t(n.lookupTableAddress,o.lookupTableAddress):t(e,r))})).map((([e,t])=>({address:e,...t})));return n}(function(e,t){const n={[e]:{[Mu]:0,role:xs.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(Bu(n,e.programAddress,(t=>{if(r.add(e.programAddress),Mu in t){if(Cs(t.role)){if(0===t[Mu])throw new Ca(Fi,{programAddress:e.programAddress});throw new Ca($i,{programAddress:e.programAddress})}if(2===t[Mu])return t}return{[Mu]:2,role:xs.READONLY}})),e.accounts)for(const o of e.accounts)Bu(n,o.address,(e=>{const{address:n,...i}=o;if(Mu in e)switch(e[Mu]){case 0:return e;case 1:{const n=Rs(e.role,i.role);if("lookupTableAddress"in i){if(e.lookupTableAddress!==i.lookupTableAddress&&(t||=cc())(i.lookupTableAddress,e.lookupTableAddress)<0)return{[Mu]:1,...i,role:n}}else if(_s(i.role))return{[Mu]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=Rs(e.role,i.role);if(r.has(o.address)){if(Cs(i.role))throw new Ca($i,{programAddress:o.address});return e.role!==t?{...e,role:t}:e}return"lookupTableAddress"in i&&!_s(e.role)?{...i,[Mu]:1,role:t}:e.role!==t?{...e,role:t}:e}}return"lookupTableAddress"in i?{...i,[Mu]:1}:{...i,[Mu]:2}}))}return n}(e.feePayer.address,e.instructions));return{..."legacy"!==e.version?{addressTableLookups:Ou(t)}:null,header:zu(t),instructions:Uu(e.instructions,t),lifetimeToken:(n=e.lifetimeConstraint,"nonce"in n?n.nonce:n.blockhash),staticAccounts:ju(t),version:e.version};var n}function Du({version:e}){return Object.freeze({instructions:Object.freeze([]),version:e})}var Fu,$u="SysvarRecentB1ockHashes11111111111111111111",Wu="11111111111111111111111111111111";function qu(e,t){return{accounts:[{address:e,role:xs.WRITABLE},{address:$u,role:xs.READONLY},{address:t,role:xs.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Wu}}function Vu(e){return e.programAddress===Wu&&null!=e.data&&(4===(t=e.data).byteLength&&4===t[0]&&0===t[1]&&0===t[2]&&0===t[3])&&3===e.accounts?.length&&null!=e.accounts[0].address&&e.accounts[0].role===xs.WRITABLE&&e.accounts[1].address===$u&&e.accounts[1].role===xs.READONLY&&null!=e.accounts[2].address&&_s(e.accounts[2].role);var t}function Ku(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&Vu(e.instructions[0])}function Gu(e,t){if("feePayer"in t&&e===t.feePayer?.address&&function(e){return!!e&&"address"in e&&"string"==typeof e.address&&1===Object.keys(e).length}(t.feePayer))return t;const n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function Hu(e,t){return Zu([e],t)}function Zu(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Ju(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Yu(e,t){const n=e.staticAccounts[0];if(!n)throw new Ca(Gi);const r=[...function(e){const{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[];let i=0;for(let t=0;t<n;t++)o.push({address:e.staticAccounts[i],role:xs.WRITABLE_SIGNER}),i++;for(let n=0;n<t.numReadonlySignerAccounts;n++)o.push({address:e.staticAccounts[i],role:xs.READONLY_SIGNER}),i++;for(let t=0;t<r;t++)o.push({address:e.staticAccounts[i],role:xs.WRITABLE}),i++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)o.push({address:e.staticAccounts[i],role:xs.READONLY}),i++;return o}(e),..."addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?function(e,t){const n=e.map((e=>e.lookupTableAddress)).filter((e=>void 0===t[e]));if(n.length>0)throw new Ca(qi,{lookupTableAddresses:n});const r=[],o=[];for(const n of e){const e=t[n.lookupTableAddress],i=Math.max(...n.readableIndices,...n.writableIndices);if(i>=e.length)throw new Ca(Vi,{highestKnownIndex:e.length-1,highestRequestedIndex:i,lookupTableAddress:n.lookupTableAddress});const a=n.readableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:xs.READONLY})));r.push(...a);const s=n.writableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:xs.WRITABLE})));o.push(...s)}return[...o,...r]}(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[]],o=e.instructions.map((e=>function(e,t){const n=t[e.programAddressIndex]?.address;if(!n)throw new Ca(Ki,{index:e.programAddressIndex});const r=e.accountIndices?.map((e=>t[e])),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}(e,r))),i=o[0],a=function(e,t,n){if(t&&Vu(t)){const n=t.accounts[0].address;rc(n);const r=t.accounts[2].address;return rc(r),{nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}(e.lifetimeToken,i,t?.lastValidBlockHeight);return lu(Du({version:e.version}),(e=>Gu(n,e)),(e=>o.reduce(((e,t)=>Hu(t,e)),e)),(e=>"blockhash"in a?fu(a,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o;const i=r.instructions[0];if(i&&Vu(i))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(i,t,n)){if(Ku(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)]}else o=[Object.freeze(qu(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(qu(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}(a,e)))}function Qu(e){const t=Object.values(e);if(0===t.length)throw new Ca(Yi);return t.map((e=>e||new Uint8Array(64).fill(0)))}function Xu(){return ru([["signatures",is(Rc(Ja(Oc(),64),{size:ys()}),Qu)],["messageBytes",Oc()]])}function el(){return as(ou([["signatures",Pc(Ya(zc(),64),{size:ws()})],["messageBytes",zc()]]),tl)}function tl(e){const{messageBytes:t,signatures:n}=e,r=Dc([xu(),os(Ts(),2),Pc(ac(),{size:ws()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new Ca(Qi,{numRequiredSignatures:i,signaturesLength:n.length,signerAddresses:s});const c={};return s.forEach(((e,t)=>{const r=n[t];r.every((e=>0===e))?c[e]=null:c[e]=r})),{messageBytes:t,signatures:Object.freeze(c)}}function nl(e){const t=Lu(e),n=Pu().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(const e of r)o[e]=null;let i;i=du(e)?{blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:{nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address};const a={lifetimeConstraint:i,messageBytes:n,signatures:Object.freeze(o)};return Object.freeze(a)}function rl(e){Fu||(Fu=Ds());const t=Object.values(e.signatures)[0];if(!t)throw new Ca(Zi);return Fu.decode(t)}async function ol(e,t){let n,r;if(await Promise.all(e.map((async e=>{const o=await wc(e.publicKey),i=t.signatures[o];if(void 0===i)return r||=new Set,void r.add(o);if(r)return;const a=await Sc(e.privateKey,t.messageBytes);var s,c;null!==i&&(c=i,(s=a).length===c.length&&s.every(((e,t)=>e===c[t])))||(n||={},n[o]=a)}))),r&&r.size>0){const e=Object.keys(t.signatures);throw new Ca(Ji,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function il(e){const t=[];if(Object.entries(e.signatures).forEach((([e,n])=>{n||t.push(e)})),t.length>0)throw new Ca(Hi,{addresses:t})}function al(e){const t=Xu().encode(e);return Ks().decode(t)}function sl(e){const t={};return e.forEach((e=>{if(t[e.address]){if(t[e.address]!==e)throw new Ca(Di,{address:e.address})}else t[e.address]=e})),Object.values(t)}function cl(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function ul(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function ll(e){return"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function dl(e){return ul(e)||cl(e)||ll(e)}function fl(e){return sl((e.accounts??[]).flatMap((e=>"signer"in e?e.signer:[])))}function hl(e){return sl([...e.feePayer&&dl(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(fl)])}function pl(e,t){const n=(r=t)&&"feePayer"in r&&r.feePayer&&"string"==typeof r.feePayer.address&&!dl(r.feePayer)?e.find((e=>e.address===t.feePayer.address)):void 0;var r;return n||0!==t.instructions.length?Object.freeze({...t,...n?{feePayer:n}:null,instructions:t.instructions.map((t=>function(e,t){if(!t.accounts||0===t.accounts.length)return t;const n=new Map(sl(e).map((e=>[e.address,e])));return Object.freeze({...t,accounts:t.accounts.map((e=>{const t=n.get(e.address);return _s(e.role)&&!("signer"in e)&&t?Object.freeze({...e,signer:t}):e}))})}(e,t)))}):t}async function gl(e){const t=await wc(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map((async n=>Object.freeze({[t]:await Sc(e.privateKey,n.content)})))),signTransactions:n=>Promise.all(n.map((async n=>{const r=await ol([e],n);return Object.freeze({[t]:r.signatures[t]})})))};return Object.freeze(n)}async function ml(e,t){return await gl(await Tc(e,t))}function yl(e){const t={address:e,signMessages:e=>Promise.resolve(e.map((()=>Object.freeze({})))),signTransactions:e=>Promise.resolve(e.map((()=>Object.freeze({}))))};return Object.freeze(t)}async function wl(e,t){const{partialSigners:n,modifyingSigners:r}=vl(sl(hl(e).filter(dl)),{identifySendingSigner:!1});return await Al(e,r,n,t)}function vl(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(ll);if(0===t.length)return null;const n=t.filter((e=>!cl(e)&&!ul(e)));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter((e=>e!==n&&(cl(e)||ul(e)))),o=function(e){const t=e.filter(cl);if(0===t.length)return[];const n=t.filter((e=>!ul(e)));return n.length>0?n:[t[0]]}(r),i=r.filter(ul).filter((e=>!o.includes(e)));return Object.freeze({modifyingSigners:o,partialSigners:i,sendingSigner:n})}async function Al(e,t=[],n=[],r){const o=nl(e),i=await t.reduce((async(e,t)=>{r?.abortSignal?.throwIfAborted();const[n]=await t.modifyAndSignTransactions([await e],r);return Object.freeze(n)}),Promise.resolve(o));r?.abortSignal?.throwIfAborted();const a=await Promise.all(n.map((async e=>{const[t]=await e.signTransactions([i],r);return t}))),s={...i,signatures:Object.freeze(a.reduce(((e,t)=>({...e,...t})),i.signatures??{}))};return Object.freeze(s)}var bl=globalThis.TextEncoder;var Sl,El=((Sl=El||{})[Sl.Uninitialized=0]="Uninitialized",Sl[Sl.Initialized=1]="Initialized",Sl);var kl,Tl=((kl=Tl||{})[kl.Legacy=0]="Legacy",kl[kl.Current=1]="Current",kl);var Il,xl,_l="11111111111111111111111111111111",Cl=((Il=Cl||{})[Il.Nonce=0]="Nonce",Il),Rl=((xl=Rl||{})[xl.CreateAccount=0]="CreateAccount",xl[xl.Assign=1]="Assign",xl[xl.TransferSol=2]="TransferSol",xl[xl.CreateAccountWithSeed=3]="CreateAccountWithSeed",xl[xl.AdvanceNonceAccount=4]="AdvanceNonceAccount",xl[xl.WithdrawNonceAccount=5]="WithdrawNonceAccount",xl[xl.InitializeNonceAccount=6]="InitializeNonceAccount",xl[xl.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",xl[xl.Allocate=8]="Allocate",xl[xl.AllocateWithSeed=9]="AllocateWithSeed",xl[xl.AssignWithSeed=10]="AssignWithSeed",xl[xl.TransferSolWithSeed=11]="TransferSolWithSeed",xl[xl.UpgradeNonceAccount=12]="UpgradeNonceAccount",xl);function Pl(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function Nl(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:xs.READONLY});const n=t.isWritable?xs.WRITABLE:xs.READONLY;return Object.freeze({address:Pl(t.value),role:Bl(t.value)?Ps(n):n,...Bl(t.value)?{signer:t.value}:{}})}}function Bl(e){return!!e&&"object"==typeof e&&"address"in e&&dl(e)}function Ml(){return ou([["discriminator",bs()]])}function Ol(){return ou([["discriminator",bs()],["space",Es()]])}function zl(){return ou([["discriminator",bs()],["base",ac()],["seed",Za(Ys(),Es())],["space",Es()],["programAddress",ac()]])}function Ul(){return ou([["discriminator",bs()],["programAddress",ac()]])}function jl(){return ou([["discriminator",bs()],["base",ac()],["seed",Za(Ys(),Es())],["programAddress",ac()]])}function Ll(){return ou([["discriminator",bs()],["newNonceAuthority",ac()]])}function Dl(){return ou([["discriminator",bs()],["lamports",Es()],["space",Es()],["programAddress",ac()]])}function Fl(){return ou([["discriminator",bs()],["base",ac()],["seed",Za(Ys(),Es())],["amount",Es()],["space",Es()],["programAddress",ac()]])}function $l(){return ou([["discriminator",bs()],["nonceAuthority",ac()]])}function Wl(){return is(ru([["discriminator",As()],["amount",Ss()]]),(e=>({...e,discriminator:2})))}function ql(){return ou([["discriminator",bs()],["amount",Es()]])}function Vl(){return ou([["discriminator",bs()],["amount",Es()],["fromSeed",Za(Ys(),Es())],["fromOwner",ac()]])}function Kl(){return ou([["discriminator",bs()]])}function Gl(){return ou([["discriminator",bs()],["withdrawAmount",Es()]])}const Hl={log:(console.log,(...e)=>{}),info:(console.info,(...e)=>{}),warn:(console.warn,(...e)=>{}),debug:(console.debug,(...e)=>{}),error:(console.error,(...e)=>{})};const Zl={log:()=>{},info:()=>{},warn:()=>{},debug:()=>{},error:()=>{}},Jl=(e,t)=>new Proxy(e,{get(e,n){const r=e[n];return"function"==typeof r?(n,...o)=>r.call(e,t,n,...o):r}}),Yl=Hl;const Ql=(e,t)=>`${e}:${t.map((e=>JSON.stringify(e))).join(":")}`,Xl=(e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:o})=>{const i=o??Ql,a=r??e.name??"anonymousFunction";return async(...r)=>{const o=i(a,r);try{const e=await t.get(o);if(void 0!==e)return e}catch(e){Yl.error(`Cache get error for key "${o}":`,e)}const s=await e(...r);return t.set(o,s,n).catch((e=>{Yl.error(`Cache set error for key "${o}":`,e)})),s}},ed=1000000n,td=1e9,nd="metamask";var rd=function(e){return e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",e.Localnet="solana:123456789abcdef",e}({}),od=function(e){return e.SolMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",e.SolDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",e.SolTestnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",e.SolLocalnet="solana:123456789abcdef/slip44:501",e.UsdcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.UsdcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",e.UsdcLocalnet="solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.EurcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcLocalnet="solana:123456789abcdef/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.Ai16zMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC",e}({});Ae(ee(),/^solana:[a-zA-Z0-9]+\/slip44:501$/u);const id=Ae(ee(),/^solana:[a-zA-Z0-9]+\/token:[a-zA-Z0-9]+$/u),ad=(Ae(ee(),/^solana:[a-zA-Z0-9]+\/nft:[a-zA-Z0-9]+$/u),ae("TokenCaipAssetTypeFromString",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;const[t]=id.validate(e);return t||!0})));var sd=function(e){return e.SOL="slip44:501",e}({});const cd={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501":{symbol:"SOL",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501":{symbol:"SOL",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501":{symbol:"SOL",caip19Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:123456789abcdef/slip44:501":{symbol:"SOL",caip19Id:"solana:123456789abcdef/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",decimals:6},"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6}},ud={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":{caip2Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",cluster:"mainnet",name:"Solana Mainnet",nativeToken:cd["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501"]},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":{caip2Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",cluster:"devnet",name:"Solana Devnet",nativeToken:cd["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501"]},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":{caip2Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",cluster:"testnet",name:"Solana Testnet",nativeToken:cd["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501"]},"solana:123456789abcdef":{caip2Id:"solana:123456789abcdef",cluster:"local",name:"Solana Localnet",nativeToken:cd["solana:123456789abcdef/slip44:501"]}},ld=Ae(ee(),/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),dd=Ae(ee(),/^(?!0\d)(\d+(\.\d+)?)$/u),fd=be(ee(),"safe-url",(e=>{try{const t=new URL(e),n=["http:","https:","wss:"];if(!n.includes(t.protocol))return`URL must use one of the following protocols: ${n}`;if(!e.match(/^(https?|wss):\/\/[^/]+\/?/u))return"Malformed URL - incorrect protocol format";const r=t.hostname.toLowerCase();if(!("localhost"===r||r.includes(".")&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/u.test(r)))return"Invalid hostname format";const o=decodeURIComponent(e.toLowerCase());if(e.includes("\\")||e.includes("@")||o.includes("\\")||o.includes("@")||e.toLowerCase().includes("%2f@")||e.toLowerCase().includes("%5c@"))return"URL contains protocol pollution attempts";const i=decodeURIComponent(r);if(r.includes("\\")||r.includes("@")||i.includes("/")||r.toLowerCase().includes("%2f"))return"Invalid hostname characters detected";if(e.includes("../")||e.includes("..%2f")||e.includes("..%2F"))return"Directory traversal attempts are not allowed";const a=[/<[^>]*>/u,/javascript:/u,/data:/u,/\\[@\\]/u,/%2f@/u,/[^\x20-\x7E]/u,/\$\{.*?\}/u,/#\{.*?\}/u,/[|;]/u,/%0[acd]|%0[acd]/u,/\/\/\w+@/u,/(?:[^a-z]|^)(?:union\s+(?:all\s+)?select|select\s+(?:.*\s+)?from|insert\s+into|update\s+.*\s+set|delete\s+from|drop\s+table|alter\s+table|create\s+table|exec(?:ute)?|union|where\s+[\d\w]\s*=\s*[\d\w]|\bor\b\s*[\d\w]\s*=\s*[\d\w])/iu,/'.*?(?:OR|UNION|SELECT|FROM|WHERE).*?'/iu,/%27.*?(?:OR|UNION|SELECT|FROM|WHERE).*?(?:%27|')/iu,/%20(?:OR|UNION|SELECT|FROM|WHERE)%20/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=(?:[^&]*\/\/|https?:)/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=%(?:[^&]*\/\/|https?:)/iu];for(const e of a)if(e.test(o))return"URL contains potentially malicious patterns";return!(t.port&&!/^\d+$/u.test(t.port))||"Invalid port number"}catch(e){return"Invalid URL format"}})),hd=Y({accountId:ld}),pd=Y({accountId:ld}),gd=Y({accountId:ld}),md=Y({accountId:ld,assets:W(mt)}),yd=Y({accountId:ld,pagination:Y({limit:K(),next:Q(Z(ee()))})}),wd=X(mt,Y({amount:dd,unit:ee()})),vd=(W(mt),V(Object.values(en)),V(Object.values(rd))),Ad=(V(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","usd","aed","ars","aud","bdt","bhd","bmd","brl","cad","chf","clp","cny","czk","dkk","eur","gbp","gel","hkd","huf","idr","ils","inr","jpy","krw","kwd","lkr","mmk","mxn","myr","ngn","nok","nzd","php","pkr","pln","rub","sar","sek","sgd","thb","try","twd","uah","vef","vnd","zar","xdr","xag","xau","bits","sats"]),Y({transaction:ee(),scope:V(Object.values(rd))})),bd=Y({value:Z(dd)}),Sd=ae("Base58",(e=>"string"!=typeof e?"Expected a string, but received: "+typeof e:!!/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(e)||"Expected a Base58 encoded string, but received a string with invalid characters")),Ed=Ae(ee(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),kd=Ae(ee(),/^m\/44'\/501'/u),Td=(Ae(ee(),/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/u),ae("SolanaAddress",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;try{return oc(e),!0}catch(e){return"Invalid Solana address"}})));function Id(e){return e&&"string"==typeof e?e.replace(/[\u0000-\u0008\u000A-\u001F\u007F]/gu,""):""}function xd(e,t=1e3){if(!e||"string"!=typeof e)return"";let n=Id(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function _d(e){if(!e||"string"!=typeof e)return"";const t=Id(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?"":t:""}function Cd(e){if(!e||"string"!=typeof e)return"";const t=Id(e);try{const e=new URL(t);return["http:","https:","wss:","ipfs:"].includes(e.protocol)?t.length>2048?"":t:""}catch{return""}}function Rd(e){const{baseUrl:t,path:n,pathParams:r,queryParams:o,encodePathParams:i=!0}=e,a=Cd(t);if(""===a)throw new Error("Invalid URL format");j(a,fd);const s=n.replace(/\{(\w+)\}/gu,((e,t)=>{const n=r?.[t];if(void 0===n)throw new Error(`Path parameter ${t} is undefined`);const o=Id(n);return i?encodeURIComponent(o):o})).replace(/^\/+/u,"").replace(/\/+/gu,"/").replace(/\/+$/u,""),c=new URL(s,a);Object.entries(o??{}).filter((([e,t])=>void 0!==t)).filter((([e,t])=>null!==t)).forEach((([e,t])=>{if(t){const n=Id(t);c.searchParams.append(e,n)}}));const u=c.toString();return j(u,fd),u}var Pd=n(5250);const Nd=re([V(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","bits","sats","sol","sei","sonic"]),V(["usd","aed","amd","ars","aud","bam","bdt","bhd","bmd","brl","cad","chf","clp","cny","cop","crc","czk","dkk","dop","eur","gbp","gel","gtq","hkd","hnl","huf","idr","ils","inr","jpy","kes","krw","kwd","lbp","lkr","mmk","mxn","myr","ngn","nok","nzd","pen","php","pkr","pln","ron","rub","sar","sek","sgd","svc","thb","try","twd","uah","vef","vnd","xdr","zar","zmw"]),V(["xag","xau"])]),Bd=Y({id:ee(),price:we(J(),0),marketCap:Q(Z(we(J(),0))),allTimeHigh:Q(Z(we(J(),0))),allTimeLow:Q(Z(we(J(),0))),totalVolume:Q(Z(we(J(),0))),high1d:Q(Z(we(J(),0))),low1d:Q(Z(we(J(),0))),circulatingSupply:Q(Z(we(J(),0))),dilutedMarketCap:Q(Z(we(J(),0))),marketCapPercentChange1d:Q(Z(J())),priceChange1d:Q(Z(J())),pricePercentChange1h:Q(Z(J())),pricePercentChange1d:Q(Z(J())),pricePercentChange7d:Q(Z(J())),pricePercentChange14d:Q(Z(J())),pricePercentChange30d:Q(Z(J())),pricePercentChange200d:Q(Z(J())),pricePercentChange1y:Q(Z(J())),bondingCurveProgressPercent:Q(Z(J())),liquidity:Q(Z(J())),totalSupply:Q(Z(J())),holderCount:Q(Z(J())),isMutable:Q(Z(q()))}),Md=X(Jo,Z(Bd)),Od=Nd,zd=Y({assetType:Jo,timePeriod:Q(Ae(ee(),/^[1-9][0-9]*[dmy]$/u)),from:Q(we(J(),0)),to:Q(we(J(),0)),vsCurrency:Q(Od)}),Ud=Y({prices:W(te([J(),J()])),marketCaps:W(te([J(),J()])),totalVolumes:W(te([J(),J()]))}),jd={prices:[],marketCaps:[],totalVolumes:[]};const Ld=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const r=e.charAt(n),o=r.charCodeAt(0);if(255!==t[o])throw new TypeError(r+" is ambiguous");t[o]=n}const n=e.length,r=e.charAt(0),o=Math.log(n)/Math.log(256),i=Math.log(256)/Math.log(n);function a(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let i=0,a=0,s=0;for(;e[i]===r;)a++,i++;const c=(e.length-i)*o+1>>>0,u=new Uint8Array(c);for(;e[i];){let r=t[e.charCodeAt(i)];if(255===r)return;let o=0;for(let e=c-1;(0!==r||o<s)&&-1!==e;e--,o++)r+=n*u[e]>>>0,u[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");s=o,i++}let l=c-s;for(;l!==c&&0===u[l];)l++;const d=new Uint8Array(a+(c-l));let f=a;for(;l!==c;)d[f++]=u[l++];return d}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"";let o=0,a=0,s=0;const c=t.length;for(;s!==c&&0===t[s];)s++,o++;const u=(c-s)*i+1>>>0,l=new Uint8Array(u);for(;s!==c;){let e=t[s],r=0;for(let t=u-1;(0!==e||r<a)&&-1!==t;t--,r++)e+=256*l[t]>>>0,l[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");a=r,s++}let d=u-a;for(;d!==u&&0===l[d];)d++;let f=r.repeat(o);for(;d<u;++d)f+=e.charAt(l[d]);return f},decodeUnsafe:a,decode:function(e){const t=a(e);if(t)return t;throw new Error("Non-base"+n+" character")}}};const Dd=Ld("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Fd=n(1048).hp;const $d={[rd.Mainnet]:"mainnet",[rd.Devnet]:"devnet",[rd.Testnet]:"testnet",[rd.Localnet]:"localnet"};const Wd=W(Y({decimals:K(),assetId:ad,name:Q(ee()),symbol:Q(ee()),iconUrl:Q(fd)})),qd={name:"UNKNOWN",symbol:"UNKNOWN",fungible:!0,iconUrl:"",units:[{name:"UNKNOWN",symbol:"UNKNOWN",decimals:9}]};class Vd{#o;#i;#a;#s;#c;static supportedNetworks=[rd.Mainnet,rd.Devnet];constructor(e,t=globalThis.fetch,n=Yl){this.#o=t,this.#i=n;const{tokenApi:r,staticApi:o}=e.get(),{baseUrl:i,chunkSize:a}=r;j(i,fd),this.#a=i,this.#s=a,this.#c=o.baseUrl}async#u(e){j(e,W(id));const t=Rd({baseUrl:this.#a,path:"/v3/assets",queryParams:{assetIds:e.join(",")}}),n=await this.#o(t);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=await n.json();return j(r,Wd),r}async getTokensMetadata(e){try{j(e,W(Jo));const t=e.filter((e=>{const{chainId:t}=Qo(e);return Vd.supportedNetworks.includes(t)}));t.length!==e.length&&this.#i.warn(`[TokenApiClient] Received some asset types on networks that the Token API doesn't support. They will be ignored. Supported networks: ${Vd.supportedNetworks.join(", ")}`);const n=[];for(let e=0;e<t.length;e+=this.#s)n.push(t.slice(e,e+this.#s));const r=(await Promise.all(n.map((async e=>this.#u(e))))).flat(),o=new Map(r.map((e=>[e.assetId,e]))),i=new Map;return e.forEach((e=>{const t=o.get(e),n=this.#l(t,e);i.set(e,n)})),Object.fromEntries(i)}catch(e){throw this.#i.error(e,"Error fetching token metadata"),e}}#d(e){return Rd({baseUrl:this.#c,path:"/api/v2/tokenIcons/assets/{assetType}.png",pathParams:{assetType:e.replace(/:/gu,"/")},encodePathParams:!1})}#l(e,t){const n=this.#d(t);if(!e)return this.#i.warn(`No metadata for ${t}. Returning default values.`),{...qd,iconUrl:n};const r=e.name??qd.name,o=e.symbol??qd.symbol,i=e.decimals??9;return{name:r,symbol:o,fungible:!0,iconUrl:e.iconUrl??n,units:[{name:r,symbol:o,decimals:i}]}}}var Kd,Gd="ComputeBudget111111111111111111111111111111",Hd=((Kd=Hd||{})[Kd.RequestUnits=0]="RequestUnits",Kd[Kd.RequestHeapFrame=1]="RequestHeapFrame",Kd[Kd.SetComputeUnitLimit=2]="SetComputeUnitLimit",Kd[Kd.SetComputeUnitPrice=3]="SetComputeUnitPrice",Kd[Kd.SetLoadedAccountsDataSizeLimit=4]="SetLoadedAccountsDataSizeLimit",Kd);function Zd(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;if(ja(t,ks().encode(3),0))return 3;if(ja(t,ks().encode(4),0))return 4;throw new Error("The provided instruction could not be identified as a computeBudget instruction.")}function Jd(){return ou([["discriminator",Ts()],["bytes",bs()]])}function Yd(){return ou([["discriminator",Ts()],["units",bs()],["additionalFee",bs()]])}function Qd(){return is(ru([["discriminator",ks()],["units",As()]]),(e=>({...e,discriminator:2})))}function Xd(){return ou([["discriminator",Ts()],["units",bs()]])}function ef(e,t){const n={...e};return{programAddress:t?.programAddress??Gd,data:Qd().encode(n)}}function tf(e){return{programAddress:e.programAddress,data:Xd().decode(e.data)}}function nf(){return is(ru([["discriminator",ks()],["microLamports",Ss()]]),(e=>({...e,discriminator:3})))}function rf(){return ou([["discriminator",Ts()],["microLamports",Es()]])}function of(e,t){const n={...e};return{programAddress:t?.programAddress??Gd,data:nf().encode(n)}}function af(e){return{programAddress:e.programAddress,data:rf().decode(e.data)}}function sf(){return ou([["discriminator",Ts()],["accountDataSizeLimit",bs()]])}var cf=e=>({__option:"Some",value:e}),uf=e=>!!(e&&"object"==typeof e&&"__option"in e&&("Some"===e.__option&&"value"in e||"None"===e.__option)),lf=e=>"Some"===e.__option;function df(e,t={}){const n=null===t.prefix?is(tu(),(e=>{})):Bc({size:t.prefix??ks()});return Fc([is(Lc([n,"zeroes"===t.noneValue?(Wa(e),Ja(tu(),e.fixedSize)):t.noneValue?Uc(t.noneValue):tu()]),(e=>[!1,void 0])),is(Lc([n,e]),(e=>[!0,uf(e)&&lf(e)?e.value:e]))],(e=>{const t=uf(e)?e:(e=>null!==e?cf(e):{__option:"None"})(e);return Number(lf(t))}))}function ff(e,t={}){const n=null===t.prefix?as(nu(),(()=>!1)):Mc({size:t.prefix??Ts()}),r="zeroes"===t.noneValue?(Wa(e),Ya(nu(),e.fixedSize)):t.noneValue?jc(t.noneValue):nu();return $c([as(Dc([n,r]),(()=>({__option:"None"}))),as(Dc([n,e]),(([,e])=>cf(e)))],((e,o)=>{if(null===t.prefix&&!t.noneValue)return Number(o<e.length);if(null===t.prefix&&null!=t.noneValue){return ja(e,"zeroes"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,o)?0:1}return Number(n.read(e,o)[0])}))}var hf,pf=((hf=pf||{})[hf.Uninitialized=0]="Uninitialized",hf[hf.Initialized=1]="Initialized",hf[hf.Frozen=2]="Frozen",hf);var gf,mf=((gf=mf||{})[gf.MintTokens=0]="MintTokens",gf[gf.FreezeAccount=1]="FreezeAccount",gf[gf.AccountOwner=2]="AccountOwner",gf[gf.CloseAccount=3]="CloseAccount",gf);function yf(){return Yc(mf)}var wf,vf="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",Af=((wf=Af||{})[wf.CreateAssociatedToken=0]="CreateAssociatedToken",wf[wf.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",wf[wf.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",wf);var bf,Sf="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Ef=((bf=Ef||{})[bf.Mint=0]="Mint",bf[bf.Token=1]="Token",bf[bf.Multisig=2]="Multisig",bf);var kf,Tf=((kf=Tf||{})[kf.InitializeMint=0]="InitializeMint",kf[kf.InitializeAccount=1]="InitializeAccount",kf[kf.InitializeMultisig=2]="InitializeMultisig",kf[kf.Transfer=3]="Transfer",kf[kf.Approve=4]="Approve",kf[kf.Revoke=5]="Revoke",kf[kf.SetAuthority=6]="SetAuthority",kf[kf.MintTo=7]="MintTo",kf[kf.Burn=8]="Burn",kf[kf.CloseAccount=9]="CloseAccount",kf[kf.FreezeAccount=10]="FreezeAccount",kf[kf.ThawAccount=11]="ThawAccount",kf[kf.TransferChecked=12]="TransferChecked",kf[kf.ApproveChecked=13]="ApproveChecked",kf[kf.MintToChecked=14]="MintToChecked",kf[kf.BurnChecked=15]="BurnChecked",kf[kf.InitializeAccount2=16]="InitializeAccount2",kf[kf.SyncNative=17]="SyncNative",kf[kf.InitializeAccount3=18]="InitializeAccount3",kf[kf.InitializeMultisig2=19]="InitializeMultisig2",kf[kf.InitializeMint2=20]="InitializeMint2",kf[kf.GetAccountDataSize=21]="GetAccountDataSize",kf[kf.InitializeImmutableOwner=22]="InitializeImmutableOwner",kf[kf.AmountToUiAmount=23]="AmountToUiAmount",kf[kf.UiAmountToAmount=24]="UiAmountToAmount",kf);function If(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function xf(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:xs.READONLY});const n=t.isWritable?xs.WRITABLE:xs.READONLY;return Object.freeze({address:If(t.value),role:_f(t.value)?Ps(n):n,..._f(t.value)?{signer:t.value}:{}})}}function _f(e){return!!e&&"object"==typeof e&&"address"in e&&dl(e)}function Cf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Rf(){return is(ru([["discriminator",ks()],["amount",Ss()]]),(e=>({...e,discriminator:4})))}function Pf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Nf(e,t){const n=t?.programAddress??Sf,r={source:{value:e.source??null,isWritable:!0},delegate:{value:e.delegate??null,isWritable:!1},owner:{value:e.owner??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=xf(n);return{accounts:[a(r.source),a(r.delegate),a(r.owner),...i],programAddress:n,data:Rf().encode(o)}}function Bf(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Mf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Of(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function zf(){return ou([["discriminator",Ts()]])}async function Uf(e,t={}){const{programAddress:n="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=t;return await yc({programAddress:n,seeds:[ic().encode(e.owner),ic().encode(e.tokenProgram),ic().encode(e.mint)]})}function jf(){return is(ru([["discriminator",ks()]]),(e=>({...e,discriminator:1})))}function Lf(e,t){const n=t?.programAddress??vf,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),r.systemProgram.value||(r.systemProgram.value="11111111111111111111111111111111");const o=xf(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:jf().encode({})}}function Df(){return ou([["discriminator",Ts()]])}function Ff(){return ou([["discriminator",Ts()]])}function $f(){return ou([["discriminator",Ts()]])}function Wf(){return ou([["discriminator",Ts()],["owner",ac()]])}function qf(){return ou([["discriminator",Ts()],["owner",ac()]])}function Vf(){return ou([["discriminator",Ts()]])}function Kf(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Gf(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Hf(){return ou([["discriminator",Ts()],["m",Ts()]])}function Zf(){return ou([["discriminator",Ts()],["m",Ts()]])}function Jf(){return ou([["discriminator",Ts()],["amount",Es()]])}function Yf(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Qf(){return ou([["discriminator",Ts()]])}function Xf(){return ou([["discriminator",Ts()],["authorityType",yf()],["newAuthority",ff(ac())]])}function eh(){return ou([["discriminator",Ts()]])}function th(){return ou([["discriminator",Ts()]])}function nh(){return ou([["discriminator",Ts()],["amount",Es()]])}function rh(){return is(ru([["discriminator",ks()],["amount",Ss()],["decimals",ks()]]),(e=>({...e,discriminator:12})))}function oh(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function ih(e,t){const n=t?.programAddress??Sf,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=xf(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:rh().encode(o)}}function ah(){return ou([["discriminator",Ts()],["uiAmount",Ys()]])}function sh(e){return!("exists"in e)||"exists"in e&&e.exists}function ch(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Vs().encode(t.data[0]);return Object.freeze({...lh(t),address:e,data:n,exists:!0})}function uh(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info;return Object.freeze({...lh(t),address:e,data:n,exists:!0})}function lh(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function dh(e,t,n={}){const{abortSignal:r,...o}=n;return ch(t,(await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r})).value)}async function fh(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map(((e,n)=>ch(t[n],e)))}function hh(e){if(!e.exists)throw new Ca(ki,{address:e.address})}var ph=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(ph||{});function gh(){return Yc(ph)}var mh=(e=>(e[e.MintTokens=0]="MintTokens",e[e.FreezeAccount=1]="FreezeAccount",e[e.AccountOwner=2]="AccountOwner",e[e.CloseAccount=3]="CloseAccount",e[e.TransferFeeConfig=4]="TransferFeeConfig",e[e.WithheldWithdraw=5]="WithheldWithdraw",e[e.CloseMint=6]="CloseMint",e[e.InterestRate=7]="InterestRate",e[e.PermanentDelegate=8]="PermanentDelegate",e[e.ConfidentialTransferMint=9]="ConfidentialTransferMint",e[e.TransferHookProgramId=10]="TransferHookProgramId",e[e.ConfidentialTransferFeeConfig=11]="ConfidentialTransferFeeConfig",e[e.MetadataPointer=12]="MetadataPointer",e[e.GroupPointer=13]="GroupPointer",e[e.GroupMemberPointer=14]="GroupMemberPointer",e[e.ScaledUiAmount=15]="ScaledUiAmount",e[e.Pause=16]="Pause",e))(mh||{});function yh(){return Yc(mh)}function wh(){return Ya(zc(),36)}function vh(){return Ya(zc(),64)}function Ah(){return Kc([["Uninitialized",nu()],["TransferFeeConfig",Za(ou([["transferFeeConfigAuthority",ac()],["withdrawWithheldAuthority",ac()],["withheldAmount",Es()],["olderTransferFee",Th()],["newerTransferFee",Th()]]),vs())],["TransferFeeAmount",Za(ou([["withheldAmount",Es()]]),vs())],["MintCloseAuthority",Za(ou([["closeAuthority",ac()]]),vs())],["ConfidentialTransferMint",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Mc()],["auditorElgamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["ConfidentialTransferAccount",Za(ou([["approved",Mc()],["elgamalPubkey",ac()],["pendingBalanceLow",vh()],["pendingBalanceHigh",vh()],["availableBalance",vh()],["decryptableAvailableBalance",wh()],["allowConfidentialCredits",Mc()],["allowNonConfidentialCredits",Mc()],["pendingBalanceCreditCounter",Es()],["maximumPendingBalanceCreditCounter",Es()],["expectedPendingBalanceCreditCounter",Es()],["actualPendingBalanceCreditCounter",Es()]]),vs())],["DefaultAccountState",Za(ou([["state",gh()]]),vs())],["ImmutableOwner",Za(ou([]),vs())],["MemoTransfer",Za(ou([["requireIncomingTransferMemos",Mc()]]),vs())],["NonTransferable",Za(ou([]),vs())],["InterestBearingConfig",Za(ou([["rateAuthority",ac()],["initializationTimestamp",Es()],["preUpdateAverageRate",ps()],["lastUpdateTimestamp",Es()],["currentRate",ps()]]),vs())],["CpiGuard",Za(ou([["lockCpi",Mc()]]),vs())],["PermanentDelegate",Za(ou([["delegate",ac()]]),vs())],["NonTransferableAccount",Za(ou([]),vs())],["TransferHook",Za(ou([["authority",ac()],["programId",ac()]]),vs())],["TransferHookAccount",Za(ou([["transferring",Mc()]]),vs())],["ConfidentialTransferFee",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["elgamalPubkey",ac()],["harvestToMintEnabled",Mc()],["withheldAmount",vh()]]),vs())],["ConfidentialTransferFeeAmount",Za(ou([["withheldAmount",vh()]]),vs())],["MetadataPointer",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["TokenMetadata",Za(ou([["updateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["mint",ac()],["name",Za(Ys(),bs())],["symbol",Za(Ys(),bs())],["uri",Za(Ys(),bs())],["additionalMetadata",eu(Za(Ys(),bs()),Za(Ys(),bs()))]]),vs())],["GroupPointer",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["groupAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["TokenGroup",Za(ou([["updateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["mint",ac()],["size",Es()],["maxSize",Es()]]),vs())],["GroupMemberPointer",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["memberAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]]),vs())],["TokenGroupMember",Za(ou([["mint",ac()],["group",ac()],["memberNumber",Es()]]),vs())],["ConfidentialMintBurn",nu()],["ScaledUiAmountConfig",Za(ou([["authority",ac()],["multiplier",hs()],["newMultiplierEffectiveTimestamp",Es()],["newMultiplier",hs()]]),vs())],["PausableConfig",Za(ou([["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["paused",Mc()]]),vs())],["PausableAccount",nu()]],{size:vs()})}var bh,Sh=((bh=Sh||{})[bh.Uninitialized=0]="Uninitialized",bh[bh.TransferFeeConfig=1]="TransferFeeConfig",bh[bh.TransferFeeAmount=2]="TransferFeeAmount",bh[bh.MintCloseAuthority=3]="MintCloseAuthority",bh[bh.ConfidentialTransferMint=4]="ConfidentialTransferMint",bh[bh.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",bh[bh.DefaultAccountState=6]="DefaultAccountState",bh[bh.ImmutableOwner=7]="ImmutableOwner",bh[bh.MemoTransfer=8]="MemoTransfer",bh[bh.NonTransferable=9]="NonTransferable",bh[bh.InterestBearingConfig=10]="InterestBearingConfig",bh[bh.CpiGuard=11]="CpiGuard",bh[bh.PermanentDelegate=12]="PermanentDelegate",bh[bh.NonTransferableAccount=13]="NonTransferableAccount",bh[bh.TransferHook=14]="TransferHook",bh[bh.TransferHookAccount=15]="TransferHookAccount",bh[bh.ConfidentialTransferFee=16]="ConfidentialTransferFee",bh[bh.ConfidentialTransferFeeAmount=17]="ConfidentialTransferFeeAmount",bh[bh.ScaledUiAmountConfig=18]="ScaledUiAmountConfig",bh[bh.PausableConfig=19]="PausableConfig",bh[bh.PausableAccount=20]="PausableAccount",bh[bh.MetadataPointer=21]="MetadataPointer",bh[bh.TokenMetadata=22]="TokenMetadata",bh[bh.GroupPointer=23]="GroupPointer",bh[bh.TokenGroup=24]="TokenGroup",bh[bh.GroupMemberPointer=25]="GroupMemberPointer",bh[bh.TokenGroupMember=26]="TokenGroupMember",bh);function Eh(){return Yc(Sh,{size:vs()})}function kh(){return Kc([["Name",nu()],["Symbol",nu()],["Uri",nu()],["Key",ou([["fields",Dc([Za(Ys(),bs())])]])]])}function Th(){return ou([["epoch",Es()],["maximumFee",Es()],["transferFeeBasisPoints",vs()]])}function Ih(){return ou([["mintAuthority",ff(ac(),{prefix:bs(),noneValue:"zeroes"})],["supply",Es()],["decimals",Ts()],["isInitialized",Mc()],["freezeAuthority",ff(ac(),{prefix:bs(),noneValue:"zeroes"})],["extensions",ff(Xc(Pc(Ah(),{size:"remainder"}),[jc(rs(ks(),83).encode(1))]),{prefix:null})]])}function xh(e){return function(e,t){try{return"exists"in e&&!e.exists?e:Object.freeze({...e,data:t.decode(e.data)})}catch{throw new Ca(Ii,{address:e.address})}}(e,Ih())}async function _h(e,t,n){const r=await async function(e,t,n){const r=await dh(e,t,n);return xh(r)}(e,t,n);return hh(r),r}var Ch="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",Rh=(e=>(e[e.CreateAssociatedToken=0]="CreateAssociatedToken",e[e.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",e[e.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",e))(Rh||{});var Ph,Nh="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",Bh=((Ph=Bh||{})[Ph.Mint=0]="Mint",Ph[Ph.Token=1]="Token",Ph[Ph.Multisig=2]="Multisig",Ph);var Mh,Oh=((Mh=Oh||{})[Mh.InitializeMint=0]="InitializeMint",Mh[Mh.InitializeAccount=1]="InitializeAccount",Mh[Mh.InitializeMultisig=2]="InitializeMultisig",Mh[Mh.Transfer=3]="Transfer",Mh[Mh.Approve=4]="Approve",Mh[Mh.Revoke=5]="Revoke",Mh[Mh.SetAuthority=6]="SetAuthority",Mh[Mh.MintTo=7]="MintTo",Mh[Mh.Burn=8]="Burn",Mh[Mh.CloseAccount=9]="CloseAccount",Mh[Mh.FreezeAccount=10]="FreezeAccount",Mh[Mh.ThawAccount=11]="ThawAccount",Mh[Mh.TransferChecked=12]="TransferChecked",Mh[Mh.ApproveChecked=13]="ApproveChecked",Mh[Mh.MintToChecked=14]="MintToChecked",Mh[Mh.BurnChecked=15]="BurnChecked",Mh[Mh.InitializeAccount2=16]="InitializeAccount2",Mh[Mh.SyncNative=17]="SyncNative",Mh[Mh.InitializeAccount3=18]="InitializeAccount3",Mh[Mh.InitializeMultisig2=19]="InitializeMultisig2",Mh[Mh.InitializeMint2=20]="InitializeMint2",Mh[Mh.GetAccountDataSize=21]="GetAccountDataSize",Mh[Mh.InitializeImmutableOwner=22]="InitializeImmutableOwner",Mh[Mh.AmountToUiAmount=23]="AmountToUiAmount",Mh[Mh.UiAmountToAmount=24]="UiAmountToAmount",Mh[Mh.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",Mh[Mh.InitializeTransferFeeConfig=26]="InitializeTransferFeeConfig",Mh[Mh.TransferCheckedWithFee=27]="TransferCheckedWithFee",Mh[Mh.WithdrawWithheldTokensFromMint=28]="WithdrawWithheldTokensFromMint",Mh[Mh.WithdrawWithheldTokensFromAccounts=29]="WithdrawWithheldTokensFromAccounts",Mh[Mh.HarvestWithheldTokensToMint=30]="HarvestWithheldTokensToMint",Mh[Mh.SetTransferFee=31]="SetTransferFee",Mh[Mh.InitializeConfidentialTransferMint=32]="InitializeConfidentialTransferMint",Mh[Mh.UpdateConfidentialTransferMint=33]="UpdateConfidentialTransferMint",Mh[Mh.ConfigureConfidentialTransferAccount=34]="ConfigureConfidentialTransferAccount",Mh[Mh.ApproveConfidentialTransferAccount=35]="ApproveConfidentialTransferAccount",Mh[Mh.EmptyConfidentialTransferAccount=36]="EmptyConfidentialTransferAccount",Mh[Mh.ConfidentialDeposit=37]="ConfidentialDeposit",Mh[Mh.ConfidentialWithdraw=38]="ConfidentialWithdraw",Mh[Mh.ConfidentialTransfer=39]="ConfidentialTransfer",Mh[Mh.ApplyConfidentialPendingBalance=40]="ApplyConfidentialPendingBalance",Mh[Mh.EnableConfidentialCredits=41]="EnableConfidentialCredits",Mh[Mh.DisableConfidentialCredits=42]="DisableConfidentialCredits",Mh[Mh.EnableNonConfidentialCredits=43]="EnableNonConfidentialCredits",Mh[Mh.DisableNonConfidentialCredits=44]="DisableNonConfidentialCredits",Mh[Mh.ConfidentialTransferWithFee=45]="ConfidentialTransferWithFee",Mh[Mh.InitializeDefaultAccountState=46]="InitializeDefaultAccountState",Mh[Mh.UpdateDefaultAccountState=47]="UpdateDefaultAccountState",Mh[Mh.Reallocate=48]="Reallocate",Mh[Mh.EnableMemoTransfers=49]="EnableMemoTransfers",Mh[Mh.DisableMemoTransfers=50]="DisableMemoTransfers",Mh[Mh.CreateNativeMint=51]="CreateNativeMint",Mh[Mh.InitializeNonTransferableMint=52]="InitializeNonTransferableMint",Mh[Mh.InitializeInterestBearingMint=53]="InitializeInterestBearingMint",Mh[Mh.UpdateRateInterestBearingMint=54]="UpdateRateInterestBearingMint",Mh[Mh.EnableCpiGuard=55]="EnableCpiGuard",Mh[Mh.DisableCpiGuard=56]="DisableCpiGuard",Mh[Mh.InitializePermanentDelegate=57]="InitializePermanentDelegate",Mh[Mh.InitializeTransferHook=58]="InitializeTransferHook",Mh[Mh.UpdateTransferHook=59]="UpdateTransferHook",Mh[Mh.InitializeConfidentialTransferFee=60]="InitializeConfidentialTransferFee",Mh[Mh.WithdrawWithheldTokensFromMintForConfidentialTransferFee=61]="WithdrawWithheldTokensFromMintForConfidentialTransferFee",Mh[Mh.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=62]="WithdrawWithheldTokensFromAccountsForConfidentialTransferFee",Mh[Mh.HarvestWithheldTokensToMintForConfidentialTransferFee=63]="HarvestWithheldTokensToMintForConfidentialTransferFee",Mh[Mh.EnableHarvestToMint=64]="EnableHarvestToMint",Mh[Mh.DisableHarvestToMint=65]="DisableHarvestToMint",Mh[Mh.WithdrawExcessLamports=66]="WithdrawExcessLamports",Mh[Mh.InitializeMetadataPointer=67]="InitializeMetadataPointer",Mh[Mh.UpdateMetadataPointer=68]="UpdateMetadataPointer",Mh[Mh.InitializeGroupPointer=69]="InitializeGroupPointer",Mh[Mh.UpdateGroupPointer=70]="UpdateGroupPointer",Mh[Mh.InitializeGroupMemberPointer=71]="InitializeGroupMemberPointer",Mh[Mh.UpdateGroupMemberPointer=72]="UpdateGroupMemberPointer",Mh[Mh.InitializeScaledUiAmountMint=73]="InitializeScaledUiAmountMint",Mh[Mh.UpdateMultiplierScaledUiMint=74]="UpdateMultiplierScaledUiMint",Mh[Mh.InitializePausableConfig=75]="InitializePausableConfig",Mh[Mh.Pause=76]="Pause",Mh[Mh.Resume=77]="Resume",Mh[Mh.InitializeTokenMetadata=78]="InitializeTokenMetadata",Mh[Mh.UpdateTokenMetadataField=79]="UpdateTokenMetadataField",Mh[Mh.RemoveTokenMetadataKey=80]="RemoveTokenMetadataKey",Mh[Mh.UpdateTokenMetadataUpdateAuthority=81]="UpdateTokenMetadataUpdateAuthority",Mh[Mh.EmitTokenMetadata=82]="EmitTokenMetadata",Mh[Mh.InitializeTokenGroup=83]="InitializeTokenGroup",Mh[Mh.UpdateTokenGroupMaxSize=84]="UpdateTokenGroupMaxSize",Mh[Mh.UpdateTokenGroupUpdateAuthority=85]="UpdateTokenGroupUpdateAuthority",Mh[Mh.InitializeTokenGroupMember=86]="InitializeTokenGroupMember",Mh);function zh(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function Uh(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:xs.READONLY});const n=t.isWritable?xs.WRITABLE:xs.READONLY;return Object.freeze({address:zh(t.value),role:jh(t.value)?Ps(n):n,...jh(t.value)?{signer:t.value}:{}})}}function jh(e){return!!e&&"object"==typeof e&&"address"in e&&dl(e)}function Lh(){return ou([["discriminator",Ts()],["amount",Es()]])}function Dh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["expectedPendingBalanceCreditCounter",Es()],["newDecryptableAvailableBalance",wh()]])}function Fh(){return is(ru([["discriminator",ks()],["amount",Ss()]]),(e=>({...e,discriminator:4})))}function $h(){return ou([["discriminator",Ts()],["amount",Es()]])}function Wh(e,t){const n=t?.programAddress??Nh,r={source:{value:e.source??null,isWritable:!0},delegate:{value:e.delegate??null,isWritable:!1},owner:{value:e.owner??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=Uh(n);return{accounts:[a(r.source),a(r.delegate),a(r.owner),...i],programAddress:n,data:Fh().encode(o)}}function qh(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Vh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function Kh(){return ou([["discriminator",Ts()],["amount",Es()]])}function Gh(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Hh(){return ou([["discriminator",Ts()]])}function Zh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Jh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["newSourceDecryptableAvailableBalance",wh()],["equalityProofInstructionOffset",ms()],["ciphertextValidityProofInstructionOffset",ms()],["rangeProofInstructionOffset",ms()]])}function Yh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["newSourceDecryptableAvailableBalance",wh()],["equalityProofInstructionOffset",ms()],["transferAmountCiphertextValidityProofInstructionOffset",ms()],["feeSigmaProofInstructionOffset",ms()],["feeCiphertextValidityProofInstructionOffset",ms()],["rangeProofInstructionOffset",ms()]])}function Qh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["amount",Es()],["decimals",Ts()],["newDecryptableAvailableBalance",wh()],["equalityProofInstructionOffset",ms()],["rangeProofInstructionOffset",ms()]])}function Xh(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["decryptableZeroBalance",wh()],["maximumPendingBalanceCreditCounter",Es()],["proofInstructionOffset",ms()]])}function ep(){return ou([["discriminator",Ts()]])}function tp(){return is(ru([["discriminator",ks()]]),(e=>({...e,discriminator:1})))}function np(){return ou([["discriminator",Ts()]])}function rp(e,t){const n=t?.programAddress??Ch,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),r.systemProgram.value||(r.systemProgram.value="11111111111111111111111111111111");const o=Uh(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:tp().encode({})}}function op(){return ou([["discriminator",Ts()]])}function ip(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function ap(){return ou([["discriminator",Ts()],["cpiGuardDiscriminator",Ts()]])}function sp(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()]])}function cp(){return ou([["discriminator",Ts()],["memoTransfersDiscriminator",Ts()]])}function up(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}new Uint8Array([250,166,180,250,13,12,184,70]);function lp(){return ou([["discriminator",zc()],["start",ff(Es())],["end",ff(Es())]])}function dp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["proofInstructionOffset",ms()]])}function fp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function hp(){return ou([["discriminator",Ts()],["cpiGuardDiscriminator",Ts()]])}function pp(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()]])}function gp(){return ou([["discriminator",Ts()],["memoTransfersDiscriminator",Ts()]])}function mp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()]])}function yp(){return ou([["discriminator",Ts()]])}function wp(){return ou([["discriminator",Ts()]])}function vp(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()]])}function Ap(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()]])}function bp(){return ou([["discriminator",Ts()]])}function Sp(){return ou([["discriminator",Ts()],["owner",ac()]])}function Ep(){return ou([["discriminator",Ts()],["owner",ac()]])}function kp(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["withdrawWithheldAuthorityElGamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Tp(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Mc()],["auditorElgamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Ip(){return ou([["discriminator",Ts()],["defaultAccountStateDiscriminator",Ts()],["state",gh()]])}function xp(){return ou([["discriminator",Ts()],["groupMemberPointerDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["memberAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function _p(){return ou([["discriminator",Ts()],["groupPointerDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["groupAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Cp(){return ou([["discriminator",Ts()]])}function Rp(){return ou([["discriminator",Ts()],["interestBearingMintDiscriminator",Ts()],["rateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["rate",ps()]])}function Pp(){return ou([["discriminator",Ts()],["metadataPointerDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Np(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Bp(){return ou([["discriminator",Ts()],["decimals",Ts()],["mintAuthority",ac()],["freezeAuthority",ff(ac())]])}function Mp(){return ou([["discriminator",Ts()],["closeAuthority",ff(ac())]])}function Op(){return ou([["discriminator",Ts()],["m",Ts()]])}function zp(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:Op().decode(e.data)}}function Up(){return ou([["discriminator",Ts()]])}function jp(){return ou([["discriminator",Ts()],["pausableDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Lp(){return ou([["discriminator",Ts()],["delegate",ac()]])}function Dp(){return ou([["discriminator",Ts()],["scaledUiAmountMintDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["multiplier",hs()]])}new Uint8Array([121,113,108,39,54,51,0,4]);function Fp(){return ou([["discriminator",zc()],["updateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["maxSize",Es()]])}new Uint8Array([152,32,222,176,223,237,116,134]);function $p(){return ou([["discriminator",zc()]])}new Uint8Array([210,225,30,162,88,184,77,141]);function Wp(){return ou([["discriminator",zc()],["name",Za(Ys(),bs())],["symbol",Za(Ys(),bs())],["uri",Za(Ys(),bs())]])}function qp(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["transferFeeConfigAuthority",ff(ac())],["withdrawWithheldAuthority",ff(ac())],["transferFeeBasisPoints",vs()],["maximumFee",Es()]])}function Vp(){return ou([["discriminator",Ts()],["transferHookDiscriminator",Ts()],["authority",ff(ac(),{prefix:null,noneValue:"zeroes"})],["programId",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Kp(){return ou([["discriminator",Ts()],["amount",Es()]])}function Gp(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function Hp(){return ou([["discriminator",Ts()],["pausableDiscriminator",Ts()]])}function Zp(){return ou([["discriminator",Ts()],["newExtensionTypes",Pc(Eh(),{size:"remainder"})]])}function Jp(){return ou([["discriminator",Ts()]])}new Uint8Array([234,18,32,56,89,141,37,181]);function Yp(){return ou([["discriminator",zc()],["idempotent",Mc()],["key",Za(Ys(),bs())]])}function Qp(){return ou([["discriminator",Ts()],["pausableDiscriminator",Ts()]])}function Xp(){return ou([["discriminator",Ts()]])}function eg(){return ou([["discriminator",Ts()],["authorityType",yh()],["newAuthority",ff(ac())]])}function tg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["transferFeeBasisPoints",vs()],["maximumFee",Es()]])}function ng(){return ou([["discriminator",Ts()]])}function rg(){return ou([["discriminator",Ts()]])}function og(){return ou([["discriminator",Ts()],["amount",Es()]])}function ig(){return is(ru([["discriminator",ks()],["amount",Ss()],["decimals",ks()]]),(e=>({...e,discriminator:12})))}function ag(){return ou([["discriminator",Ts()],["amount",Es()],["decimals",Ts()]])}function sg(e,t){const n=t?.programAddress??Nh,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:xs.READONLY_SIGNER,signer:e}))),a=Uh(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:ig().encode(o)}}function cg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["amount",Es()],["decimals",Ts()],["fee",Es()]])}function ug(){return ou([["discriminator",Ts()],["uiAmount",Ys()]])}function lg(){return ou([["discriminator",Ts()],["confidentialTransferDiscriminator",Ts()],["autoApproveNewAccounts",Mc()],["auditorElgamalPubkey",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function dg(){return ou([["discriminator",Ts()],["defaultAccountStateDiscriminator",Ts()],["state",gh()]])}function fg(){return ou([["discriminator",Ts()],["groupMemberPointerDiscriminator",Ts()],["memberAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function hg(){return ou([["discriminator",Ts()],["groupPointerDiscriminator",Ts()],["groupAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function pg(){return ou([["discriminator",Ts()],["metadataPointerDiscriminator",Ts()],["metadataAddress",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function gg(){return ou([["discriminator",Ts()],["scaledUiAmountMintDiscriminator",Ts()],["multiplier",hs()],["effectiveTimestamp",gs()]])}function mg(){return ou([["discriminator",Ts()],["interestBearingMintDiscriminator",Ts()],["rate",ps()]])}new Uint8Array([108,37,171,143,248,30,18,110]);function yg(){return ou([["discriminator",zc()],["maxSize",Es()]])}new Uint8Array([161,105,88,1,237,221,216,203]);function wg(){return ou([["discriminator",zc()],["newUpdateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}new Uint8Array([221,233,49,45,181,202,220,200]);function vg(){return ou([["discriminator",zc()],["field",kh()],["value",Za(Ys(),bs())]])}new Uint8Array([215,228,166,228,84,100,86,123]);function Ag(){return ou([["discriminator",zc()],["newUpdateAuthority",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function bg(){return ou([["discriminator",Ts()],["transferHookDiscriminator",Ts()],["programId",ff(ac(),{prefix:null,noneValue:"zeroes"})]])}function Sg(){return ou([["discriminator",Ts()]])}function Eg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()],["numTokenAccounts",Ts()]])}function kg(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()],["numTokenAccounts",Ts()],["proofInstructionOffset",ms()],["newDecryptableAvailableBalance",wh()]])}function Tg(){return ou([["discriminator",Ts()],["transferFeeDiscriminator",Ts()]])}function Ig(){return ou([["discriminator",Ts()],["confidentialTransferFeeDiscriminator",Ts()],["proofInstructionOffset",ms()],["newDecryptableAvailableBalance",wh()]])}function xg(e,t,n){const r=t-e;if(r<0)throw new Error("Invalid timespan: end time before start time");const o=n*r/31556736e4;return Math.exp(o)}function _g({currentTimestamp:e,lastUpdateTimestamp:t,initializationTimestamp:n,preUpdateAverageRate:r,currentRate:o}){return xg(n,t,r)*xg(t,e,o)}function Cg(e){return Math.pow(10,e)}function Rg(e,t,n,r,o,i,a){const s=parseFloat(e)*Cg(t)/_g({currentTimestamp:n,lastUpdateTimestamp:r,initializationTimestamp:o,preUpdateAverageRate:i,currentRate:a});return BigInt(Math.trunc(s))}function Pg(e,t,n){const r=parseFloat(e)*Cg(t)/n;return BigInt(Math.trunc(r))}var Ng="ComputeBudget111111111111111111111111111111",Bg={blockhash:"11111111111111111111111111111111",lastValidBlockHeight:0n};function Mg(e){return function(e,t){return e.programAddress===t}(e,Ng)&&function(e){return void 0!==e.data}(e)&&2===e.data[0]}async function Og({abortSignal:e,rpc:t,transactionMessage:n,...r}){const o=Ku(n);let i;i=o||du(n)?n:fu(Bg,n);const a=n.instructions.findIndex(Mg),s=function(e){const t=new Uint8Array(5);return t[0]=2,As().write(e,t,1),Object.freeze({data:t,programAddress:Ng})}(14e5);if(-1===a)i=Hu(s,i);else{const e=[...i.instructions];e.splice(a,1,s),i=Object.freeze({...i,instructions:e})}const c=al(nl(i));try{const{value:{err:n,unitsConsumed:i}}=await t.simulateTransaction(c,{...r,encoding:"base64",replaceRecentBlockhash:!o,sigVerify:!1}).send({abortSignal:e});if(null==i)throw new Ca(Xi);const a=i>4294967295n?4294967295:Number(i);if(n)throw new Ca(ea,{cause:n,unitsConsumed:a});return a}catch(e){if(_a(e,ea))throw e;throw new Ca(Xi,{cause:e})}}async function zg(e,t,n){if(0===e.length)return{};const r=await async function(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map(((e,n)=>e&&"object"==typeof e&&"parsed"in e.data?uh(t[n],e):ch(t[n],e)))}(t,e,n);return function(e){const t=e.filter((e=>sh(e)&&e.data instanceof Uint8Array));if(t.length>0){const e=t.map((e=>e.address));throw new Ca(xi,{addresses:e})}}(r),function(e){const t=e.filter((e=>!e.exists));if(t.length>0){const e=t.map((e=>e.address));throw new Ca(Ti,{addresses:e})}}(r),r.reduce(((e,t)=>({...e,[t.address]:t.data.addresses})),{})}async function Ug(e,t,n){const r=("addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?e.addressTableLookups:[]).map((e=>e.lookupTableAddress)),{lastValidBlockHeight:o,...i}=n??{};return Yu(e,{addressesByLookupTableAddress:r.length>0?await zg(r,t,i):{},lastValidBlockHeight:o})}function jg(e,t){return!t?.preflightCommitment&&function(e,t){return e===t?0:su(e)<su(t)?-1:1}(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function Lg({abortSignal:e,commitment:t,rpc:n,transaction:r,...o}){const i=al(r);return await n.sendTransaction(i,{...jg(t,o),encoding:"base64"}).send({abortSignal:e})}const Dg=async(e,t,n)=>lu(e,Vs().encode,Nu().decode,(async e=>Ug(e,t,n))),Fg=async(e,t,n)=>lu(e,Nu().decode,(async e=>Ug(e,t,n))),$g=e=>lu(e,Xu().encode,Ks().decode),Wg=async e=>lu(e,Vs().encode,el().decode),qg=async(e,t,n)=>(async e=>new Promise(((t,n)=>{if(0===e.length)return void n(new AggregateError([],"No promises to resolve"));let r=0;const o=[];e.forEach(((i,a)=>{Promise.resolve(i).then((e=>t(e)),(t=>{o[a]=t,r+=1,r===e.length&&n(new AggregateError(o,"All promises rejected"))}))}))})))([Wg(e),Dg(e,t,n)]),Vg=oc("KeccakSecp256k11111111111111111111111111111"),Kg=oc("Secp256r1SigVerify1111111111111111111111111");var Gg=function(e){return e[e.Verify=0]="Verify",e}({});const Hg=e=>0,Zg=e=>e.programAddress===Vg,Jg=e=>e.programAddress===Kg,Yg=()=>{return e=[["numSignatures",Va(ks(),Ts())]],Va(ru(e),ou(e));var e},Qg=e=>({programAddress:e.programAddress,data:Yg().decode(e.data??new Uint8Array)});const Xg={[_l]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,As().encode(0),0))return 0;if(ja(t,As().encode(1),0))return 1;if(ja(t,As().encode(2),0))return 2;if(ja(t,As().encode(3),0))return 3;if(ja(t,As().encode(4),0))return 4;if(ja(t,As().encode(5),0))return 5;if(ja(t,As().encode(6),0))return 6;if(ja(t,As().encode(7),0))return 7;if(ja(t,As().encode(8),0))return 8;if(ja(t,As().encode(9),0))return 9;if(ja(t,As().encode(10),0))return 10;if(ja(t,As().encode(11),0))return 11;if(ja(t,As().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")},instructionEnum:Rl,typeToParserMap:{[Rl.Assign]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ul().decode(e.data)}},[Rl.TransferSol]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n()},data:ql().decode(e.data)}},[Rl.CreateAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n()},data:Dl().decode(e.data)}},[Rl.CreateAccountWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n(),baseAccount:n()},data:Fl().decode(e.data)}},[Rl.AdvanceNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),nonceAuthority:n()},data:Ml().decode(e.data)}},[Rl.WithdrawNonceAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recipientAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n(),nonceAuthority:n()},data:Gl().decode(e.data)}},[Rl.InitializeNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n()},data:$l().decode(e.data)}},[Rl.AuthorizeNonceAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),nonceAuthority:n()},data:Ll().decode(e.data)}},[Rl.Allocate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{newAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ol().decode(e.data)}},[Rl.AllocateWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{newAccount:n(),baseAccount:n()},data:zl().decode(e.data)}},[Rl.AssignWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),baseAccount:n()},data:jl().decode(e.data)}},[Rl.TransferSolWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),baseAccount:n(),destination:n()},data:Vl().decode(e.data)}},[Rl.UpgradeNonceAccount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{nonceAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Kl().decode(e.data)}}}},[Gd]:{identifier:Zd,instructionEnum:Hd,typeToParserMap:{[Hd.RequestUnits]:function(e){return{programAddress:e.programAddress,data:Yd().decode(e.data)}},[Hd.RequestHeapFrame]:function(e){return{programAddress:e.programAddress,data:Jd().decode(e.data)}},[Hd.SetComputeUnitPrice]:af,[Hd.SetComputeUnitLimit]:tf,[Hd.SetLoadedAccountsDataSizeLimit]:function(e){return{programAddress:e.programAddress,data:sf().decode(e.data)}}}},[Sf]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;if(ja(t,ks().encode(3),0))return 3;if(ja(t,ks().encode(4),0))return 4;if(ja(t,ks().encode(5),0))return 5;if(ja(t,ks().encode(6),0))return 6;if(ja(t,ks().encode(7),0))return 7;if(ja(t,ks().encode(8),0))return 8;if(ja(t,ks().encode(9),0))return 9;if(ja(t,ks().encode(10),0))return 10;if(ja(t,ks().encode(11),0))return 11;if(ja(t,ks().encode(12),0))return 12;if(ja(t,ks().encode(13),0))return 13;if(ja(t,ks().encode(14),0))return 14;if(ja(t,ks().encode(15),0))return 15;if(ja(t,ks().encode(16),0))return 16;if(ja(t,ks().encode(17),0))return 17;if(ja(t,ks().encode(18),0))return 18;if(ja(t,ks().encode(19),0))return 19;if(ja(t,ks().encode(20),0))return 20;if(ja(t,ks().encode(21),0))return 21;if(ja(t,ks().encode(22),0))return 22;if(ja(t,ks().encode(23),0))return 23;if(ja(t,ks().encode(24),0))return 24;throw new Error("The provided instruction could not be identified as a token instruction.")},instructionEnum:Tf,typeToParserMap:{[Tf.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Kf().decode(e.data)}},[Tf.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:$f().decode(e.data)}},[Tf.InitializeMultisig]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:Hf().decode(e.data)}},[Tf.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:nh().decode(e.data)}},[Tf.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Pf().decode(e.data)}},[Tf.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:Qf().decode(e.data)}},[Tf.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:Xf().decode(e.data)}},[Tf.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Jf().decode(e.data)}},[Tf.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Mf().decode(e.data)}},[Tf.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:zf().decode(e.data)}},[Tf.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:Df().decode(e.data)}},[Tf.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:th().decode(e.data)}},[Tf.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:oh().decode(e.data)}},[Tf.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Bf().decode(e.data)}},[Tf.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Yf().decode(e.data)}},[Tf.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Of().decode(e.data)}},[Tf.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Wf().decode(e.data)}},[Tf.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:eh().decode(e.data)}},[Tf.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:qf().decode(e.data)}},[Tf.InitializeMultisig2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{multisig:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Zf().decode(e.data)}},[Tf.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Gf().decode(e.data)}},[Tf.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ff().decode(e.data)}},[Tf.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vf().decode(e.data)}},[Tf.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cf().decode(e.data)}},[Tf.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ah().decode(e.data)}}}},[Nh]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;if(ja(t,ks().encode(3),0))return 3;if(ja(t,ks().encode(4),0))return 4;if(ja(t,ks().encode(5),0))return 5;if(ja(t,ks().encode(6),0))return 6;if(ja(t,ks().encode(7),0))return 7;if(ja(t,ks().encode(8),0))return 8;if(ja(t,ks().encode(9),0))return 9;if(ja(t,ks().encode(10),0))return 10;if(ja(t,ks().encode(11),0))return 11;if(ja(t,ks().encode(12),0))return 12;if(ja(t,ks().encode(13),0))return 13;if(ja(t,ks().encode(14),0))return 14;if(ja(t,ks().encode(15),0))return 15;if(ja(t,ks().encode(16),0))return 16;if(ja(t,ks().encode(17),0))return 17;if(ja(t,ks().encode(18),0))return 18;if(ja(t,ks().encode(19),0))return 19;if(ja(t,ks().encode(20),0))return 20;if(ja(t,ks().encode(21),0))return 21;if(ja(t,ks().encode(22),0))return 22;if(ja(t,ks().encode(23),0))return 23;if(ja(t,ks().encode(24),0))return 24;if(ja(t,ks().encode(25),0))return 25;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(0),1))return 26;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(1),1))return 27;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(2),1))return 28;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(3),1))return 29;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(4),1))return 30;if(ja(t,ks().encode(26),0)&&ja(t,ks().encode(5),1))return 31;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(0),1))return 32;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(1),1))return 33;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(2),1))return 34;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(3),1))return 35;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(4),1))return 36;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(5),1))return 37;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(6),1))return 38;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(7),1))return 39;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(8),1))return 40;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(9),1))return 41;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(10),1))return 42;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(11),1))return 43;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(12),1))return 44;if(ja(t,ks().encode(27),0)&&ja(t,ks().encode(13),1))return 45;if(ja(t,ks().encode(28),0)&&ja(t,ks().encode(0),1))return 46;if(ja(t,ks().encode(28),0)&&ja(t,ks().encode(1),1))return 47;if(ja(t,ks().encode(29),0))return 48;if(ja(t,ks().encode(30),0)&&ja(t,ks().encode(0),1))return 49;if(ja(t,ks().encode(30),0)&&ja(t,ks().encode(1),1))return 50;if(ja(t,ks().encode(31),0))return 51;if(ja(t,ks().encode(32),0))return 52;if(ja(t,ks().encode(33),0)&&ja(t,ks().encode(0),1))return 53;if(ja(t,ks().encode(33),0)&&ja(t,ks().encode(1),1))return 54;if(ja(t,ks().encode(34),0)&&ja(t,ks().encode(0),1))return 55;if(ja(t,ks().encode(34),0)&&ja(t,ks().encode(1),1))return 56;if(ja(t,ks().encode(35),0))return 57;if(ja(t,ks().encode(36),0)&&ja(t,ks().encode(0),1))return 58;if(ja(t,ks().encode(36),0)&&ja(t,ks().encode(1),1))return 59;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(0),1))return 60;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(1),1))return 61;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(2),1))return 62;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(3),1))return 63;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(4),1))return 64;if(ja(t,ks().encode(37),0)&&ja(t,ks().encode(5),1))return 65;if(ja(t,ks().encode(38),0))return 66;if(ja(t,ks().encode(39),0)&&ja(t,ks().encode(0),1))return 67;if(ja(t,ks().encode(39),0)&&ja(t,ks().encode(1),1))return 68;if(ja(t,ks().encode(40),0)&&ja(t,ks().encode(0),1))return 69;if(ja(t,ks().encode(40),0)&&ja(t,ks().encode(1),1))return 70;if(ja(t,ks().encode(41),0)&&ja(t,ks().encode(0),1))return 71;if(ja(t,ks().encode(41),0)&&ja(t,ks().encode(1),1))return 72;if(ja(t,ks().encode(43),0)&&ja(t,ks().encode(0),1))return 73;if(ja(t,ks().encode(43),0)&&ja(t,ks().encode(1),1))return 74;if(ja(t,ks().encode(44),0)&&ja(t,ks().encode(0),1))return 75;if(ja(t,ks().encode(44),0)&&ja(t,ks().encode(1),1))return 76;if(ja(t,ks().encode(44),0)&&ja(t,ks().encode(2),1))return 77;if(ja(t,new Uint8Array([210,225,30,162,88,184,77,141]),0))return 78;if(ja(t,new Uint8Array([221,233,49,45,181,202,220,200]),0))return 79;if(ja(t,new Uint8Array([234,18,32,56,89,141,37,181]),0))return 80;if(ja(t,new Uint8Array([215,228,166,228,84,100,86,123]),0))return 81;if(ja(t,new Uint8Array([250,166,180,250,13,12,184,70]),0))return 82;if(ja(t,new Uint8Array([121,113,108,39,54,51,0,4]),0))return 83;if(ja(t,new Uint8Array([108,37,171,143,248,30,18,110]),0))return 84;if(ja(t,new Uint8Array([161,105,88,1,237,221,216,203]),0))return 85;if(ja(t,new Uint8Array([152,32,222,176,223,237,116,134]),0))return 86;throw new Error("The provided instruction could not be identified as a token-2022 instruction.")},instructionEnum:Oh,typeToParserMap:{[Oh.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Np().decode(e.data)}},[Oh.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:bp().decode(e.data)}},[Oh.InitializeMultisig]:zp,[Oh.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:og().decode(e.data)}},[Oh.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:$h().decode(e.data)}},[Oh.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:Xp().decode(e.data)}},[Oh.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:eg().decode(e.data)}},[Oh.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Kp().decode(e.data)}},[Oh.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Kh().decode(e.data)}},[Oh.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:Hh().decode(e.data)}},[Oh.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:yp().decode(e.data)}},[Oh.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:rg().decode(e.data)}},[Oh.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:ag().decode(e.data)}},[Oh.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:qh().decode(e.data)}},[Oh.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Gp().decode(e.data)}},[Oh.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Gh().decode(e.data)}},[Oh.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Sp().decode(e.data)}},[Oh.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ng().decode(e.data)}},[Oh.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:Ep().decode(e.data)}},[Oh.InitializeMultisig2]:zp,[Oh.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Bp().decode(e.data)}},[Oh.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:wp().decode(e.data)}},[Oh.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cp().decode(e.data)}},[Oh.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lh().decode(e.data)}},[Oh.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:ug().decode(e.data)}},[Oh.InitializeMintCloseAuthority]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Mp().decode(e.data)}},[Oh.InitializeTransferFeeConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:qp().decode(e.data)}},[Oh.TransferCheckedWithFee]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:cg().decode(e.data)}},[Oh.WithdrawWithheldTokensFromMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:Tg().decode(e.data)}},[Oh.WithdrawWithheldTokensFromAccounts]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:Eg().decode(e.data)}},[Oh.HarvestWithheldTokensToMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:vp().decode(e.data)}},[Oh.SetTransferFee]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),transferFeeConfigAuthority:n()},data:tg().decode(e.data)}},[Oh.InitializeConfidentialTransferMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Tp().decode(e.data)}},[Oh.UpdateConfidentialTransferMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:lg().decode(e.data)}},[Oh.ConfigureConfidentialTransferAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:Xh().decode(e.data)}},[Oh.ApproveConfidentialTransferAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Vh().decode(e.data)}},[Oh.EmptyConfidentialTransferAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:dp().decode(e.data)}},[Oh.ConfidentialDeposit]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Zh().decode(e.data)}},[Oh.ConfidentialWithdraw]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Nh?void 0:e};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvar:r(),equalityRecord:r(),rangeRecord:r(),authority:n()},data:Qh().decode(e.data)}},[Oh.ConfidentialTransfer]:function(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Nh?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),ciphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:Jh().decode(e.data)}},[Oh.ApplyConfidentialPendingBalance]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Dh().decode(e.data)}},[Oh.EnableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:fp().decode(e.data)}},[Oh.DisableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:ip().decode(e.data)}},[Oh.EnableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:mp().decode(e.data)}},[Oh.DisableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:up().decode(e.data)}},[Oh.ConfidentialTransferWithFee]:function(e){if(e.accounts.length<10)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Nh?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),transferAmountCiphertextValidityRecord:r(),feeSigmaRecord:r(),feeCiphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:Yh().decode(e.data)}},[Oh.InitializeDefaultAccountState]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ip().decode(e.data)}},[Oh.UpdateDefaultAccountState]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),freezeAuthority:n()},data:dg().decode(e.data)}},[Oh.Reallocate]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),payer:n(),systemProgram:n(),owner:n()},data:Zp().decode(e.data)}},[Oh.EnableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:gp().decode(e.data)}},[Oh.DisableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:cp().decode(e.data)}},[Oh.CreateNativeMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),nativeMint:n(),systemProgram:n()},data:op().decode(e.data)}},[Oh.InitializeNonTransferableMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Up().decode(e.data)}},[Oh.InitializeInterestBearingMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rp().decode(e.data)}},[Oh.UpdateRateInterestBearingMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rateAuthority:n()},data:mg().decode(e.data)}},[Oh.EnableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:hp().decode(e.data)}},[Oh.DisableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:ap().decode(e.data)}},[Oh.InitializePermanentDelegate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lp().decode(e.data)}},[Oh.InitializeTransferHook]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vp().decode(e.data)}},[Oh.UpdateTransferHook]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:bg().decode(e.data)}},[Oh.InitializeConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:kp().decode(e.data)}},[Oh.WithdrawWithheldTokensFromMintForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:Ig().decode(e.data)}},[Oh.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Nh?void 0:e})(),authority:n()},data:kg().decode(e.data)}},[Oh.HarvestWithheldTokensToMintForConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ap().decode(e.data)}},[Oh.EnableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:pp().decode(e.data)}},[Oh.DisableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:sp().decode(e.data)}},[Oh.WithdrawExcessLamports]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{sourceAccount:n(),destinationAccount:n(),authority:n()},data:Sg().decode(e.data)}},[Oh.InitializeMetadataPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Pp().decode(e.data)}},[Oh.UpdateMetadataPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),metadataPointerAuthority:n()},data:pg().decode(e.data)}},[Oh.InitializeGroupPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:_p().decode(e.data)}},[Oh.UpdateGroupPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupPointerAuthority:n()},data:hg().decode(e.data)}},[Oh.InitializeGroupMemberPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:xp().decode(e.data)}},[Oh.UpdateGroupMemberPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupMemberPointerAuthority:n()},data:fg().decode(e.data)}},[Oh.InitializeScaledUiAmountMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Dp().decode(e.data)}},[Oh.UpdateMultiplierScaledUiMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:gg().decode(e.data)}},[Oh.InitializePausableConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:jp().decode(e.data)}},[Oh.Pause]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Hp().decode(e.data)}},[Oh.Resume]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Qp().decode(e.data)}},[Oh.InitializeTokenMetadata]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n(),mint:n(),mintAuthority:n()},data:Wp().decode(e.data)}},[Oh.UpdateTokenMetadataField]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:vg().decode(e.data)}},[Oh.RemoveTokenMetadataKey]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:Yp().decode(e.data)}},[Oh.UpdateTokenMetadataUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:Ag().decode(e.data)}},[Oh.EmitTokenMetadata]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{metadata:(()=>{const n=e.accounts[t];return t+=1,n})()},data:lp().decode(e.data)}},[Oh.InitializeTokenGroup]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),mint:n(),mintAuthority:n()},data:Fp().decode(e.data)}},[Oh.UpdateTokenGroupMaxSize]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:yg().decode(e.data)}},[Oh.UpdateTokenGroupUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:wg().decode(e.data)}},[Oh.InitializeTokenGroupMember]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{member:n(),memberMint:n(),memberMintAuthority:n(),group:n(),groupUpdateAuthority:n()},data:$p().decode(e.data)}}}},[vf]:{identifier:function(e){const t="data"in e?e.data:e;if(ja(t,ks().encode(0),0))return 0;if(ja(t,ks().encode(1),0))return 1;if(ja(t,ks().encode(2),0))return 2;throw new Error("The provided instruction could not be identified as a associatedToken instruction.")},instructionEnum:Rh,typeToParserMap:{[Rh.CreateAssociatedToken]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:ep().decode(e.data)}},[Rh.CreateAssociatedTokenIdempotent]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:np().decode(e.data)}},[Rh.RecoverNestedAssociatedToken]:function(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nestedAssociatedAccountAddress:n(),nestedTokenMintAddress:n(),destinationAssociatedAccountAddress:n(),ownerAssociatedAccountAddress:n(),ownerTokenMintAddress:n(),walletAddress:n(),tokenProgram:n()},data:Jp().decode(e.data)}}}},[Vg]:{identifier:Hg,instructionEnum:Gg,typeToParserMap:{[Gg.Verify]:Qg}},[Kg]:{identifier:Hg,instructionEnum:Gg,typeToParserMap:{[Gg.Verify]:Qg}}},em=e=>{const{programAddress:t}=e,n={...e,dataBase58:Fs().decode(e.data??new Uint8Array)};try{const r=Xg[t];if(!r)throw new Error("Unsupported program address");const{identifier:o,typeToParserMap:i,instructionEnum:a}=r,s=o(e),c=a[s],u=i[s];if(!u)throw new Error("Unsupported instruction type");return{type:c,encoded:n,parsed:u(e)}}catch(e){return{type:"Unknown",encoded:n,parsed:null}}},tm=(e,t)=>{const n=e.accounts.filter((e=>e<t.transaction.message.accountKeys.length)).map((e=>({address:t.transaction.message.accountKeys[e],role:0}))),r=t.transaction.message.accountKeys[e.programIdIndex];if(!r)throw new Error("Program address not found");return{accounts:n,data:Fs().encode(e.data),programAddress:r}};function nm(e){const{type:t,id:n,address:r,options:o,methods:i,scopes:a}=e;return{type:t,id:n,address:r,options:o,methods:i,scopes:a}}const rm={accountSubscribe:"accountUnsubscribe",programSubscribe:"programUnsubscribe",signatureSubscribe:"signatureUnsubscribe"},om=V(["processed","confirmed","finalized"]),im=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:Gu(e,t),am=e=>e.programAddress===Gd&&Zd({data:new Uint8Array,...e})===Hd.SetComputeUnitPrice,sm=e=>e.instructions.filter(Boolean).some(am),cm=e=>e.programAddress===Gd&&Zd({data:new Uint8Array,...e})===Hd.SetComputeUnitLimit,um=e=>e.instructions.filter(Boolean).some(cm),lm=async(e,t,n)=>{try{const r=e.instructions.filter(Boolean),o=function({rpc:e}){return async function(t,n){return await Og({...n,rpc:e,transactionMessage:t})}}({rpc:t}),i=await o(e,n?.getComputeUnitEstimateConfig).catch((e=>{if(_a(e,ea))return e.context.unitsConsumed;throw e}));return{...(0,Pd.cloneDeep)(e),instructions:[...r.filter((e=>!cm(e))),ef({units:i},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}};class dm extends Error{constructor(e){super(e),this.name="FeeCalculatorError"}}class fm extends dm{constructor(e){super(e),this.name="FeeCalculatorUnsupportedInputTypeError"}}const hm=e=>({ed25519Signatures:["signature"],instructions:e.instructions.map((t=>({accounts:[],data:t.data??new Uint8Array,programAddress:e.staticAccounts[t.programAddressIndex]})))}),pm=e=>({...lu(e.messageBytes,Nu().decode,hm),ed25519Signatures:Object.values(e.signatures)}),gm=e=>lu(e,Vs().encode,el().decode,pm),mm=e=>lu(e,Vs().encode,Nu().decode,hm);class ym{static calculateFee(e){const t=this.#f(e),{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i}=this.#h(t),a=this.#p(i),s=this.#g(t),c=this.#m(t),u=this.#y(s,c);return{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i,baseFee:a,computeUnitLimit:s,computeUnitPriceMicroLamportsPerComputeUnit:c,priorityFee:u,totalFee:uu(a+u)}}static#p(e){return uu(5000n*BigInt(e))}static#g(e){const{instructions:t}=e,n=t.find(cm);return n?tf(n).data.units:0}static#m(e){const{instructions:t}=e,n=t.find(am);return n?af(n).data.microLamports:0n}static#y(e,t){return lu(e,(e=>jo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(ed.toString())),(e=>e.toString()),BigInt,uu)}static#h(e){const{ed25519Signatures:t,instructions:n}=e,r=t.length,o=n.filter(Zg).map(em).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0),i=n.filter(Jg).map(em).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0);return{ed25519SignaturesCount:r,secp256k1SignaturesCount:o,secp256r1SignaturesCount:i,totalSignaturesCount:r+o+i}}static#f(e){if(this.#w(e))return gm(e);if(this.#v(e))return mm(e);if(this.#A(e))return hm(e);if(this.#b(e))return pm(e);if(this.#S(e))return(e=>({ed25519Signatures:e.transaction.signatures,instructions:e.transaction.message.instructions.map((t=>tm(t,e)))}))(e);throw new fm("The fee calculator could not recognize the input type. It supports SolanaTransactions, kit Transactions, and base64 strings.")}static#w(e){try{return"string"==typeof e&&(gm(e),!0)}catch(e){return!1}}static#v(e){try{return"string"==typeof e&&(mm(e),!0)}catch(e){return!1}}static#A(e){return"object"==typeof e&&"instructions"in e&&"staticAccounts"in e}static#S(e){return"object"==typeof e&&"transaction"in e&&"object"==typeof e.transaction&&"message"in e.transaction&&"object"==typeof e.transaction.message&&"accountKeys"in e.transaction.message&&"object"==typeof e.transaction.message.accountKeys&&"instructions"in e.transaction.message&&"object"==typeof e.transaction.message.instructions&&"signatures"in e.transaction&&"object"==typeof e.transaction.signatures}static#b(e){return"object"==typeof e&&"messageBytes"in e&&"object"==typeof e.messageBytes&&"signatures"in e}}const wm=e=>jo(e.toString()).dividedBy(td),vm=e=>jo(e.toString()).multipliedBy(td).integerValue(jo.ROUND_DOWN);var Am=function(e){return e.SignAndSendTransactionWithoutConfirmation="signAndSendTransactionWithoutConfirmation",e.ConfirmSend="confirmSend",e.SignAndSendTransaction="signAndSendTransaction",e.ComputeFee="computeFee",e.OnAddressInput="onAddressInput",e.OnAmountInput="onAmountInput",e.SignRewardsMessage="signRewardsMessage",e.SignCardMessage="signCardMessage",e.ApproveCardAmount="approveCardAmount",e}({});function bm(e){return ae(JSON.stringify(e),G(e).validator)}function Sm(e){return null==e}var Em;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Em=Em||(Em={}));const km=e=>Y(e);function Tm({path:e,branch:t}){const n=e[e.length-1];return r=t[t.length-2],o=n,Object.hasOwnProperty.call(r,o);var r,o}function Im(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Tm(n)||e.validator(t,n),refiner:(t,n)=>!Tm(n)||e.refiner(t,n)})}function xm(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!xm(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!xm(n[e][1])){t=!1;break}return t}return!1}const _m=ae("JSON",(e=>xm(e))),Cm=me(_m,be($(),"JSON",(e=>D(e,_m))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Rm=G("2.0"),Pm=Z(re([J(),ee()])),Nm=km({code:K(),message:ee(),data:Im(Cm),stack:Im(ee())}),Bm=re([X(ee(),Cm),W(Cm)]);km({id:Pm,jsonrpc:Rm,method:ee(),params:Im(Bm)}),km({jsonrpc:Rm,method:ee(),params:Im(Bm)});Y({id:Pm,jsonrpc:Rm,result:Q(oe()),error:Q(Nm)});const Mm=km({id:Pm,jsonrpc:Rm,result:Cm}),Om=km({id:Pm,jsonrpc:Rm,error:Nm});re([Mm,Om]);function zm(e){return D(e,Om)}var Um=function(e){return e.Required="Required",e.Invalid="Invalid",e.InsufficientBalanceToCoverFee="InsufficientBalanceToCoverFee",e.InsufficientBalance="InsufficientBalance",e}({});const jm=V(Object.values(rd)),Lm=ne({address:me(ee(),ee(),(e=>{if(!e||""===e)throw new Error("Account address is required");const t=_d(e);if(""===t)throw new Error("Invalid Solana address format");return t}))}),Dm=G("ed25519"),Fm=me(ee(),ee(),(e=>{const t=function(e){if(!e||"string"!=typeof e)return"";let t=Id(e);const n=t.match(/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+)/u);return n?.[1]&&(t=n[1]),/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+$/u.test(t)?t.length>253?"":t.toLowerCase():""}(e);if(""===t)throw new Error("Invalid domain format");return t})),$m=me(ee(),ee(),(e=>{const t=_d(e);if(""===t)throw new Error("Invalid Solana address format");return t})),Wm=me(ee(),ee(),(e=>{const t=xd(e,1e3);if(""===t)throw new Error("Statement cannot be empty. Control characters and excessive whitespace are removed for security. Please use plain text only.");return t})),qm=me(ee(),ee(),(e=>Cd(e))),Vm=me(ee(),ee(),(e=>xd(e,10))),Km=me(ee(),ee(),(e=>xd(e,50))),Gm=me(ee(),ee(),(e=>xd(e,100))),Hm=me(ee(),ee(),(e=>function(e){if(!e||"string"!=typeof e)return"";const t=Id(e);if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/u.test(t))return"";const n=new Date(t);return isNaN(n.getTime())?"":t}(e))),Zm=me(ee(),ee(),(e=>xd(e,100))),Jm=me(W(ee()),W(ee()),(e=>{var t;return t=e,Array.isArray(t)?t.filter((e=>"string"==typeof e)).map((e=>Cd(e))).filter((e=>""!==e)):[]})),Ym=ne({domain:Q(Fm),address:Q($m),statement:Q(Wm),uri:Q(qm),version:Q(Vm),chainId:Q(Km),nonce:Q(Gm),issuedAt:Q(Hm),expirationTime:Q(Hm),notBefore:Q(Hm),requestId:Q(Zm),resources:Q(Jm)}),Qm=ne({account:Lm,message:Ed}),Xm=V(["processed","confirmed","finalized"]),ey=ne({preflightCommitment:Q(Xm),minContextSlot:Q(J())}),ty=ne({account:Lm,transaction:Ed,scope:jm,options:Q(ey)}),ny=ne({...ey.schema,commitment:Q(Xm),skipPreflight:Q(q()),maxRetries:Q(J())}),ry=ne({...ty.schema,scope:jm,options:Q(ny)}),oy=Y({method:V([en.SignAndSendTransaction]),params:ry}),iy=Y({method:V([en.SignIn]),params:Ym}),ay=Y({method:V([en.SignMessage]),params:Qm}),sy=Y({method:V([en.SignTransaction]),params:ty}),cy=Y({signature:Sd}),uy=Y({signedTransaction:Ed}),ly=Y({signature:Sd,signedMessage:Ed,signatureType:Dm}),dy=Y({account:Lm,...ly.schema}),fy=re([oy,iy,ay,sy]),hy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignAndSendTransactionWithoutConfirmation),params:ry}),py=Y({transaction:Ed,accountId:ld,scope:jm,options:Q(ny)}),gy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignAndSendTransaction),params:py}),my=Y({transactionId:Sd}),yy=Y({fromAccountId:ld,toAddress:Td,amount:dd,assetId:Jo}),wy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.ConfirmSend),params:yy}),vy=Y({value:ee(),scope:function(e,t,n={}){return me(e,oe(),(e=>{const r="function"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&R(e)&&R(r)){const t={...e};let n=!1;for(const e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e}))}(jm,rd.Mainnet)}),Ay=Y({jsonrpc:Rm,id:Pm,method:bm(Am.OnAddressInput),params:vy}),by=Y({value:dd,accountId:ld,assetId:Jo}),Sy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.OnAmountInput),params:by});function Ey(e){const t=lu(e,Gs().encode,Qs().decode);if(!t.startsWith("rewards,"))throw new Error('Message must start with "rewards,"');const n=t.split(",");if(3!==n.length)throw new Error("Message must have exactly 3 parts: rewards,{address},{timestamp}");const[r,o,i]=n;if("rewards"!==r)throw new Error('Message must start with "rewards"');if(!D(o,Td))throw new Error("Invalid Solana address");if(!D(i,dd))throw new Error("Invalid timestamp format");if(i.includes("."))throw new Error("Invalid timestamp");const a=parseInt(i,10);if(a<=0)throw new Error("Invalid timestamp");return{address:o,timestamp:a}}const ky=be(Ed,"RewardsMessage",(e=>{try{return Ey(e),!0}catch(e){return e instanceof Error?e.message:"Invalid rewards message"}})),Ty=Y({accountId:ld,message:ky}),Iy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignRewardsMessage),params:Ty});function xy(e){const t=lu(e,Gs().encode,Qs().decode).match(/^(.+) wants you to sign in with your Solana account: ([1-9A-HJ-NP-Za-km-z]{32,44}) (.+) URI: (.+) Version: (\d+) Chain ID: (\d+) Nonce: ([a-zA-Z0-9]+) Issued At: (.+) Expiration Time: (.+)$/u);if(!t)throw new Error('Invalid card message format. Expected format: "{domain} wants you to sign in with your Solana account: {address} {statement} URI: {uri} Version: {version} Chain ID: {chainId} Nonce: {nonce} Issued At: {issuedAt} Expiration Time: {expirationTime}"');const[,n,r,o,i,a,s,c,u,l]=t;if(!n||""===n.trim())throw new Error("Invalid domain in card message");if(!D(r,Td))throw new Error("Invalid Solana address in card message");try{if(!new URL(i).protocol)throw new Error("Invalid URI")}catch{throw new Error("Invalid URI in card message")}const d=new Date(u);if(isNaN(d.getTime()))throw new Error("Invalid Issued At date in card message");const f=new Date(l);if(isNaN(f.getTime()))throw new Error("Invalid Expiration Time date in card message");return{domain:n,address:r,statement:o,uri:i,version:a,chainId:s,nonce:c,issuedAt:u,expirationTime:l}}const _y=be(Ed,"CardMessage",(e=>{try{return xy(e),!0}catch(e){return e instanceof Error?e.message:"Invalid card message"}})),Cy=Y({accountId:ld,message:_y}),Ry=Y({jsonrpc:Rm,id:Pm,method:bm(Am.SignCardMessage),params:Cy}),Py=Y({accountId:ld,amount:dd,mint:Td,delegate:Td,scope:jm}),Ny=Y({jsonrpc:Rm,id:Pm,method:bm(Am.ApproveCardAmount),params:Py}),By=Y({signature:Sd}),My=Y({valid:q(),errors:W(Y({code:V(Object.values(Um))}))}),Oy=Y({transaction:Ed,accountId:ld,scope:jm}),zy=Y({jsonrpc:Rm,id:Pm,method:bm(Am.ComputeFee),params:Oy}),Uy=W(Y({type:V(Object.values(zt)),asset:Ct}));const jy=Ae(ee(),/^(?:0x)?[0-9a-f]+$/iu);Ae(ee(),/^0x[0-9a-f]+$/iu),Ae(ee(),/^0x[0-9a-f]{40}$/u),Ae(ee(),/^0x[0-9a-fA-F]{40}$/u);function Ly(e){ti(function(e){return D(e,jy)}(e),"Value must be a hexadecimal string.")}function Dy(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}n(1048).hp;!function(){const e=[]}();function Fy(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;Ly(e);const t=Dy(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++){const t=n.charCodeAt(2*e),o=n.charCodeAt(2*e+1),i=t-(t<58?48:87),a=o-(o<58?48:87);r[e]=16*i+a}return r}async function $y({entropySource:e,derivationPath:t}){Yl.log({derivationPath:t},"Generating solana wallet"),j(t,kd);const n=t.split("/");try{const t=await async function({entropySource:e,path:t,curve:n}){return await snap.request({method:"snap_getBip32Entropy",params:{path:t,curve:n,...e?{source:e}:{}}})}({entropySource:e,path:n,curve:"ed25519"});if(!t.privateKey||!t.publicKey)throw new Error("Unable to derive private key");return{privateKeyBytes:Fy(t.privateKey),publicKeyBytes:Fy(t.publicKey)}}catch(e){throw Yl.error({error:e},"Error deriving keypair"),new Error(e)}}const Wy=e=>JSON.parse(JSON.stringify(e),((e,t)=>t?"undefined"!==t.__type?"BigNumber"===t.__type?new jo(t.value):"bigint"===t.__type?BigInt(t.value):"Uint8Array"===t.__type?Gs().encode(t.value):t:void 0:t)),qy=e=>(0,Pd.cloneDeepWith)(e,(e=>void 0===e?{__type:"undefined"}:e instanceof jo?{__type:"BigNumber",value:e.toString()}:"bigint"==typeof e?{__type:"bigint",value:e.toString()}:e instanceof Uint8Array?{__type:"Uint8Array",value:Gs().decode(e)}:void 0)),Vy="send-form",Ky="confirm-sign-and-send-transaction";async function Gy(e,t){const n=qy(t);return snap.request({method:"snap_createInterface",params:{ui:e,context:n}})}async function Hy(e,t,n){const r=qy(n);return snap.request({method:"snap_updateInterface",params:{id:e,ui:t,context:r}})}async function Zy(e,t){return snap.request({method:"snap_resolveInterface",params:{id:e,value:t}})}async function Jy(e){return snap.request({method:"snap_dialog",params:{id:e}})}async function Yy(){return snap.request({method:"snap_getPreferences"})}async function Qy(e){const t=await async function(e){const t=await snap.request({method:"snap_getInterfaceContext",params:{id:e}});return t?Wy(t):null}(e);if(!t)throw new Error("Interface context not found");return t}async function Xy(){return await snap.request({method:"snap_getClientStatus"})}var ew,tw=function(e){return e.StartSendTransactionFlow="startSendTransactionFlow",e.GetFeeForTransaction="getFeeForTransaction",e}({}),nw=function(e){return e.ListWebSockets="listWebSockets",e.ListSubscriptions="listSubscriptions",e.TestOnStart="testOnStart",e.TestOnInstall="testOnInstall",e.TestOnUpdate="testOnUpdate",e.SynchronizeAccounts="synchronizeAccounts",e.SetAccountSelected="setAccountSelected",e.ConfirmSend="confirmSend",e.SignRewardsMessage="signRewardsMessage",e}({});!function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(ew=ew||(ew={}));const rw=[rd.Mainnet,rd.Devnet],ow={production:[rd.Mainnet],local:[rd.Mainnet],test:[rd.Localnet]},iw=me(W(fd),ee(),(e=>e.split(","))),aw=me(W(ee()),ee(),(e=>e.split(","))),sw=Y({ENVIRONMENT:V(["local","test","production"]),RPC_URL_MAINNET_LIST:iw,RPC_URL_DEVNET_LIST:iw,RPC_URL_TESTNET_LIST:iw,RPC_URL_LOCALNET_LIST:aw,RPC_WEB_SOCKET_URL_MAINNET:fd,RPC_WEB_SOCKET_URL_DEVNET:fd,RPC_WEB_SOCKET_URL_TESTNET:fd,RPC_WEB_SOCKET_URL_LOCALNET:fd,EXPLORER_BASE_URL:fd,PRICE_API_BASE_URL:fd,TOKEN_API_BASE_URL:fd,STATIC_API_BASE_URL:fd,SECURITY_ALERTS_API_BASE_URL:fd,NFT_API_BASE_URL:fd,LOCAL_API_BASE_URL:ee()});class cw{#E;#k;constructor(){const e=this.#T();this.#E=this.#I(e),this.#k=[]}#T(){return L({ENVIRONMENT:"production",RPC_URL_MAINNET_LIST:"https://solana-mainnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_DEVNET_LIST:"https://solana-devnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_TESTNET_LIST:"https://api.testnet.solana.com",RPC_URL_LOCALNET_LIST:"http://localhost:8899",RPC_WEB_SOCKET_URL_MAINNET:"wss://solana-mainnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_DEVNET:"wss://solana-devnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_TESTNET:"wss://api.testnet.solana.com",RPC_WEB_SOCKET_URL_LOCALNET:"wss://localhost:8899",EXPLORER_BASE_URL:"https://solscan.io",PRICE_API_BASE_URL:"https://price.api.cx.metamask.io",TOKEN_API_BASE_URL:"https://tokens.api.cx.metamask.io",STATIC_API_BASE_URL:"https://static.cx.metamask.io",SECURITY_ALERTS_API_BASE_URL:"https://security-alerts.api.cx.metamask.io",LOCAL_API_BASE_URL:"http://localhost:8899",NFT_API_BASE_URL:"https://nft.api.cx.metamask.io"},sw)}#I(e){return{environment:e.ENVIRONMENT,networks:[{...ud[rd.Mainnet],rpcUrls:e.RPC_URL_MAINNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_MAINNET},{...ud[rd.Devnet],rpcUrls:e.RPC_URL_DEVNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_DEVNET},{...ud[rd.Testnet],rpcUrls:e.RPC_URL_TESTNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_TESTNET},{...ud[rd.Localnet],rpcUrls:e.RPC_URL_LOCALNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_LOCALNET}],explorerBaseUrl:e.EXPLORER_BASE_URL,priceApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.PRICE_API_BASE_URL,chunkSize:50,cacheTtlsMilliseconds:{fiatExchangeRates:ew.Minute,spotPrices:ew.Minute,historicalPrices:ew.Minute}},tokenApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.TOKEN_API_BASE_URL,chunkSize:50},staticApi:{baseUrl:e.STATIC_API_BASE_URL},transactions:{storageLimit:10},securityAlertsApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.SECURITY_ALERTS_API_BASE_URL},nftApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.NFT_API_BASE_URL,cacheTtlsMilliseconds:{listAddressSolanaNfts:ew.Minute,getNftMetadata:ew.Minute}},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:ew.Second,closeConnectionsGracePeriodMilliseconds:5*ew.Minute}}}get(){return this.#E}getNetworkBy(e,t){const n=this.get().networks.find((n=>n[e]===t));if(!n)throw new Error(`Network ${e} not found`);return n}async getActiveNetworks(){if(this.#k.length>0)return this.#k;const e=(0,Pd.uniq)([rd.Mainnet,...ow[this.#E.environment]??[]]);try{const{clientVersion:t}=await Xy(),n=t.includes("flask")?[rd.Devnet]:[],r=(0,Pd.uniq)([...e,...n]);return this.#k=r,this.#k}catch(t){return e}}}const uw=(new cw).get(),lw=["local","test"].includes(uw.environment),dw=lw?["http://localhost:3000"]:["https://portfolio.metamask.io"],fw=lw?new Set([ln.ListAccounts,ln.GetAccount,ln.CreateAccount,ln.FilterAccountChains,ln.DeleteAccount,ln.DiscoverAccounts,ln.GetAccountBalances,ln.SubmitRequest,ln.ListAccountTransactions,ln.ListAccountAssets,ln.SetSelectedAccounts,tw.StartSendTransactionFlow,tw.GetFeeForTransaction,nw.ListWebSockets,nw.ListSubscriptions,nw.TestOnStart,nw.TestOnInstall,nw.TestOnUpdate,nw.SynchronizeAccounts,nw.SetAccountSelected,nw.ConfirmSend,nw.SignRewardsMessage]):new Set([]),hw=new Set([ln.ListAccounts,ln.GetAccount,ln.CreateAccount,ln.DeleteAccount,ln.DiscoverAccounts,ln.GetAccountBalances,ln.SubmitRequest,ln.ListAccountTransactions,ln.ListAccountAssets,ln.ResolveAccountAddress,ln.SetSelectedAccounts,tw.StartSendTransactionFlow,tw.GetFeeForTransaction,Am.SignAndSendTransactionWithoutConfirmation]),pw=new Map([]);for(const e of dw)pw.set(e,fw);pw.set("metamask",hw);const gw=(e,t)=>{if(!e)throw new mo("Origin not found");if(!pw.get(e)?.has(t))throw new mo("Permission denied")};function mw(e,t){try{j(e,t)}catch(e){throw new oo(e.message)}}function yw(e,t){try{j(e,t)}catch(e){throw new Xr("Invalid Response")}}const ww=Y({...Mt.schema,scope:vd,request:fy}),vw=Y({scopes:ve(W(vd)),entropySource:ee(),groupIndex:we(J(),0)});Error;function Aw(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:null==e?"":String(e)}(e).replace(/\.$/u,"")}function bw(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class Sw extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Ew(e,t="Assertion failed.",n=Sw){if(!e){if(t instanceof Error)throw t;throw bw(n,t)}}function kw(e,t,n="Assertion failed",r=Sw){try{j(e,t)}catch(e){throw bw(r,`${n}: ${Aw(e)}.`)}}function Tw(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function Iw(e,...t){if(!Tw(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function xw(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function _w(e){if("function"!=typeof e)throw new Error("function expected");return!0}function Cw(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function Rw(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Pw(e){if(!Array.isArray(e))throw new Error("array expected")}function Nw(e,t){if(!xw(!0,t))throw new Error(`${e}: array of strings expected`)}function Bw(e,t){if(!xw(!1,t))throw new Error(`${e}: array of numbers expected`)}function Mw(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map((e=>e.encode)).reduceRight(n,t),decode:e.map((e=>e.decode)).reduce(n,t)}}function Ow(e){const t="string"==typeof e?e.split(""):e,n=t.length;Nw("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(Pw(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]}))),decode:t=>(Pw(t),t.map((t=>{Cw("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})))}}function zw(e=""){return Cw("join",e),{encode:t=>(Nw("join.decode",t),t.join(e)),decode:t=>(Cw("join.decode",t),t.split(e))}}function Uw(e,t="="){return Rw(e),Cw("padding",t),{encode(n){for(Nw("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){Nw("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--){if((r-1)*e%8==0)throw new Error("padding: invalid, string has too much padding")}return n.slice(0,r)}}}function jw(e){return _w(e),{encode:e=>e,decode:t=>e(t)}}function Lw(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(Pw(e),!e.length)return[];let r=0;const o=[],i=Array.from(e,(e=>{if(Rw(e),e<0||e>=t)throw new Error(`invalid integer: ${e}`);return e})),a=i.length;for(;;){let e=0,s=!0;for(let o=r;o<a;o++){const a=i[o],c=t*e,u=c+a;if(!Number.isSafeInteger(u)||c/t!==e||u-a!==c)throw new Error("convertRadix: carry overflow");const l=u/n;e=u%n;const d=Math.floor(l);if(i[o]=d,!Number.isSafeInteger(d)||d*n+e!==u)throw new Error("convertRadix: carry overflow");s&&(d?s=!1:r=o)}if(o.push(e),s)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}const Dw=(e,t)=>0===t?e:Dw(t,e%t),Fw=(e,t)=>e+(t-Dw(e,t)),$w=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function Ww(e,t,n,r){if(Pw(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Fw(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Fw(t,n)}`);let o=0,i=0;const a=$w[t],s=$w[n]-1,c=[];for(const r of e){if(Rw(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);const e=$w[i];if(void 0===e)throw new Error("invalid carry");o&=e-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function qw(e){Rw(e);return{encode:t=>{if(!Tw(t))throw new Error("radix.encode input should be Uint8Array");return Lw(Array.from(t),256,e)},decode:t=>(Bw("radix.decode",t),Uint8Array.from(Lw(t,e,256)))}}function Vw(e,t=!1){if(Rw(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Fw(8,e)>32||Fw(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!Tw(n))throw new Error("radix2.encode input should be Uint8Array");return Ww(Array.from(n),8,e,!t)},decode:n=>(Bw("radix2.decode",n),Uint8Array.from(Ww(n,e,8,t)))}}function Kw(e){return _w(e),function(...t){try{return e.apply(null,t)}catch(e){}}}const Gw=Mw(Vw(4),Ow("0123456789ABCDEF"),zw("")),Hw=Mw(Vw(5),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Uw(5),zw("")),Zw=(Mw(Vw(5),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),zw("")),Mw(Vw(5),Ow("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Uw(5),zw("")),Mw(Vw(5),Ow("0123456789ABCDEFGHIJKLMNOPQRSTUV"),zw("")),Mw(Vw(5),Ow("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),zw(""),jw((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64),Jw=(e,t)=>{Cw("base64",e);const n=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,r=t?"base64url":"base64";if(e.length>0&&!n.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},Yw=Zw?{encode:e=>(Iw(e),e.toBase64()),decode:e=>Jw(e,!1)}:Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Uw(6),zw("")),Qw=(Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),zw("")),Zw?{encode:e=>(Iw(e),e.toBase64({alphabet:"base64url"})),decode:e=>Jw(e,!0)}:Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Uw(6),zw(""))),Xw=(Mw(Vw(6),Ow("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),zw("")),e=>Mw(qw(58),Ow(e),zw(""))),ev=Xw("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),tv=(Xw("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Xw("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),[0,2,3,5,6,7,9,10,11]),nv={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=ev.encode(r).padStart(tv[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),o=tv.indexOf(r.length),i=ev.decode(r);for(let e=0;e<i.length-o;e++)if(0!==i[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}},rv=Mw(Ow("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),zw("")),ov=[996825010,642813549,513874426,1027748829,705979059];function iv(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<ov.length;e++)1==(t>>e&1)&&(n^=ov[e]);return n}function av(e,t,n=1){const r=e.length;let o=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);o=iv(o)^n>>5}o=iv(o);for(let t=0;t<r;t++)o=iv(o)^31&e.charCodeAt(t);for(let e of t)o=iv(o)^e;for(let e=0;e<6;e++)o=iv(o);return o^=n,rv.encode(Ww([o%$w[30]],30,5,!1))}function sv(e){const t="bech32"===e?1:734539939,n=Vw(5),r=n.decode,o=n.encode,i=Kw(r);function a(e,n,r=90){Cw("bech32.encode prefix",e),Tw(n)&&(n=Array.from(n)),Bw("bech32.encode",n);const o=e.length;if(0===o)throw new TypeError(`Invalid prefix length ${o}`);const i=o+7+n.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);const a=e.toLowerCase(),s=av(a,n,t);return`${a}1${rv.encode(n)}${s}`}function s(e,n=90){Cw("bech32.decode input",e);const r=e.length;if(r<8||!1!==n&&r>n)throw new TypeError(`invalid string length: ${r} (${e}). Expected (8..${n})`);const o=e.toLowerCase();if(e!==o&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=o.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const a=o.slice(0,i),s=o.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const c=rv.decode(s).slice(0,-6),u=av(a,c,t);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected "${u}"`);return{prefix:a,words:c}}return{encode:a,decode:s,encodeFromBytes:function(e,t){return a(e,o(t))},decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:Kw(s),fromWords:r,fromWordsUnsafe:i,toWords:o}}sv("bech32"),sv("bech32m");const cv={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)};"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex||Mw(Vw(4),Ow("0123456789abcdef"),zw(""),jw((e=>{if("string"!=typeof e||e.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));n(1048).hp;!function(){const e=[]}();function uv(e){return e instanceof Uint8Array}function lv(e){Ew(uv(e),"Value must be a Uint8Array.")}var dv;!function(e){e.Copyable="copyable",e.Divider="divider",e.Heading="heading",e.Panel="panel",e.Spinner="spinner",e.Text="text",e.Image="image",e.Row="row",e.Address="address",e.Button="button",e.Input="input",e.Form="form"}(dv||(dv={}));const fv=Y({type:ee()}),hv=(ie(fv,Y({value:oe()})),ie(fv,Y({type:bm(dv.Image),value:be(ee(),"SVG",(e=>!!e.includes("<svg")||"Value is not a valid SVG."))}))),pv=function(e,t,n=[]){return(...r)=>{if(1===r.length&&function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(r[0])){const n={...r[0],type:e};return kw(n,t,`Invalid ${e} component`),n}const o=n.reduce(((e,t,n)=>void 0!==r[n]?{...e,[t]:r[n]}:e),{type:e});return kw(o,t,`Invalid ${e} component`),o}}(dv.Image,hv,["value"]);async function gv(e,t){const n=await async function(e,t){if("function"!=typeof fetch)throw new Error(`Failed to fetch image data from "${e}": Using this function requires the "endowment:network-access" permission.`);return fetch(e,t).then((async t=>{if(!t.ok)throw new Error(`Failed to fetch image data from "${e}": ${t.status} ${t.statusText}`);const n=await t.blob();return Ew("image/jpeg"===n.type||"image/png"===n.type,"Expected image data to be a JPEG or PNG image."),n}))}(e,t),r=new Uint8Array(await n.arrayBuffer());return`data:${n.type};base64,${function(e){return lv(e),Yw.encode(e)}(r)}`}const mv='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48">\n <path fill="#999999" d="M42.75 24c0 10.59375-8.53125 19.21875-19.125 19.21875-10.6875 0-19.21875-8.625-19.21875-19.21875 0-10.59375 8.53125-19.21875 19.21875-19.21875 10.59375 0 19.125 8.625 19.125 19.21875zM23.625 14.0625c-3.09375 0-5.90625 2.25-5.90625 5.4375 0 0.84375 0.75 1.59375 1.59375 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375 0-1.125 1.03125-2.25 2.71875-2.25 1.59375 0 2.625 1.125 2.625 2.25 0 0.5625-0.375 1.03125-1.3125 1.59375l0 0c-1.125 0.75-3 1.96875-3 4.5l0 0.46875c0 0.84375 0.75 1.59375 1.6875 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375l0-0.46875c0-0.65625 0.28125-1.125 1.40625-1.78125 1.03125-0.65625 2.8125-1.875 2.8125-4.3125 0-3.1875-2.8125-5.4375-5.8125-5.4375zM23.53125 31.875c-0.84375 0-1.59375 0.65625-1.59375 1.59375 0 0.84375 0.75 1.59375 1.59375 1.59375l0.09375 0c0.84375 0 1.59375-0.75 1.59375-1.59375 0-0.9375-0.75-1.59375-1.59375-1.59375z"/>\n</svg>';function yv(e,t){return new jo(e.toString()).div(10**t).toFixed()}function wv(e){return e.split("/")[0]}function vv(e,t){return`${e}/token:${t}`}class Av{#i;#x;#_;#C;#R;#P;#N;#B;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*ew.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,tokenApiClient:o,tokenPricesService:i,cache:a,nftApiClient:s}){this.#i=Jl(t,"[🪙 AssetsService]"),this.#x=e,this.#_=n,this.#C=r,this.#P=o,this.#R=i,this.#N=a,this.#B=s}#M(e){return{nativeAssetTypes:e.filter((e=>e.endsWith(sd.SOL))),tokenAssetTypes:e.filter((e=>e.includes("/token:"))),nftAssetTypes:e.filter((e=>e.includes("/nft:")))}}#O(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:o,assetReference:i}=Qo(n);t[n]={name:"Solana",symbol:"SOL",fungible:!0,iconUrl:`${this.#_.get().staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${o}/${i}.png`,units:[{name:"Solana",symbol:"SOL",decimals:9}]}}return t}async#z(e){const t=await this.#B.getNftsMetadata(e.map((e=>{const{assetReference:t}=Qo(e);return t}))),n={};return e.forEach(((e,r)=>{const o=t[r];if(!o)return;const i={name:o.name,symbol:o.name,imageUrl:o.imageUrl,description:o.description,fungible:!1,isPossibleSpam:!1,attributes:Object.fromEntries(o.attributes.map((e=>[e.key,e.value]))),collection:{name:o.collectionName,address:o.onchainCollectionAddress,symbol:o.collectionSymbol,tokenCount:o.collectionCount,creator:"",imageUrl:o.collectionImageUrl??""}};n[e]=i})),n}async getAssetsMetadata(e){this.#i.log("Fetching metadata for assets",e);const{nativeAssetTypes:t,tokenAssetTypes:n,nftAssetTypes:r}=this.#M(e),[o,i]=await Promise.all([this.#O(t),this.#P.getTokensMetadata(n)]);return{...o,...i}}async#U(e,t=[Sf,Nh],n=[rd.Mainnet]){if(0===t.length||0===n.length)return[];const r=e.flatMap((e=>t.flatMap((t=>n.map((n=>({account:e,programId:t,scope:n}))))))),o=Xl(this.#j.bind(this),this.#N,{functionName:"AssetsService:fetchTokenAccounts",ttlMilliseconds:Av.cacheTtlsMilliseconds.tokenAccountsByOwner,generateCacheKey:(e,t)=>{const[n,r,o]=t;return`${e}:${n.id}:${r}:${o}`}});return(await Promise.allSettled(r.map((async({account:e,programId:t,scope:n})=>await o(e,t,n))))).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#j(e,t=Sf,n=rd.Mainnet){return(await this.#x.getRpc(n).getTokenAccountsByOwner(oc(e.address),{programId:t},{encoding:"jsonParsed"}).send()).value.map((t=>({token:t,scope:n,assetType:vv(n,t.account.data.parsed.info.mint),keyringAccount:e})))}async fetch(e){const[t,n]=await Promise.all([this.#L(e),this.#U([e],[Sf,Nh],await this.#_.getActiveNetworks())]),r=n.map((e=>e.assetType)),o=await this.#P.getTokensMetadata(r);return[...t,...n.filter((e=>e.assetType.includes("/token:"))).map((e=>{const{assetType:t}=e,{decimals:n,amount:r,uiAmountString:i}=e.token.account.data.parsed.info.tokenAmount;return{assetType:t,keyringAccountId:e.keyringAccount.id,network:e.scope,mint:e.token.account.data.parsed.info.mint,pubkey:e.token.pubkey,symbol:o[t]?.symbol??"UNKNOWN",decimals:n,rawAmount:r,uiAmount:i??yv(r,n)}}))]}async getNativeAssetTypes(){return(await this.#_.getActiveNetworks()).map((e=>`${e}/${sd.SOL}`))}async#L(e){const t=await this.getNativeAssetTypes(),n=oc(e.address),r=t.map((async t=>{const r=await this.#x.getRpc(wv(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:wv(t),address:n,symbol:"SOL",decimals:9,rawAmount:r.value.toString(),uiAmount:yv(r.value,9)}}));return(await Promise.allSettled(r)).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#D(e,t){const n=oc(e.address),r=await this.#B.listAddressSolanaNfts(n),o={};for(const e of t){const{assetReference:t}=Qo(e),n=r.find((e=>e.tokenAddress===t));n&&(o[e]={unit:n.nftToken.name,amount:n.balance.toString()})}return o}async fetchAssetsMarketData(e){this.#i.info("Fetching market data for assets",e);return await this.#R.getMultipleTokensMarketData(e)}async save(e){await this.saveMany([e])}async saveMany(e){this.#i.info("Saving assets",e);const t=e=>"0"===e.rawAmount||"0"===e.uiAmount;await this.getAll();await this.#C.saveMany(e);const n=e=>t(e)&&!(e=>e.assetType.includes(sd.SOL))(e),r=e=>!n(e)&&!0,o=e.reduce(((e,t)=>({...e,[t.keyringAccountId]:{added:[...e[t.keyringAccountId]?.added??[],...r(t)?[t.assetType]:[]],removed:[...e[t.keyringAccountId]?.removed??[],...n(t)?[t.assetType]:[]]}})),{});Object.values(o).map((e=>e.added.length+e.removed.length)).every((e=>0===e))||await zn(snap,Pn.AccountAssetListUpdated,{assets:o});const i=e.filter((()=>!0)).reduce(((e,t)=>({...e,[t.keyringAccountId]:{...e[t.keyringAccountId]??{},[t.assetType]:{unit:t.symbol,amount:t.uiAmount}}})),{});Object.values(i).map((e=>Object.keys(e).length)).some((e=>e>0))&&await zn(snap,Pn.AccountBalancesUpdated,{balances:i})}static hasChanged(e,t){const n=t.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType));if(!n)return!0;const r=n.rawAmount!==e.rawAmount,o=n.uiAmount!==e.uiAmount;return r||o}async getAll(){return this.#C.getAll()}async findByAccount(e){const{id:t,address:n}=e,r=await this.#C.findByKeyringAccountId(t),o=await this.getNativeAssetTypes(),i=[];for(const t of o){if(!r.some((e=>e.assetType===t))){const r=wv(t);i.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:"SOL",decimals:9,rawAmount:"0",uiAmount:"0"})}}return[...r,...i]}static maxSvgSizeBytes=512e3;static generateImageComponent=async(e,t=48,n=48,r)=>e?async function(e,{width:t,height:n=t,request:r}){Ew("number"==typeof t&&t>0,"Expected width to be a number greater than 0."),Ew("number"==typeof n&&n>0,"Expected height to be a number greater than 0.");const o=await gv(e,r),i=`width="${t}" height="${n}"`;return pv(`<svg ${i.trim()} xmlns="http://www.w3.org/2000/svg"><image ${i.trim()} href="${o}" /></svg>`)}(e,{width:t,height:n}).then((t=>{const n=(new TextEncoder).encode(t.value).length;if(n>Av.maxSvgSizeBytes){const t=(n/1024).toFixed(2),o=`SVG too large (${t}KB), using fallback icon`;return r&&r.warn(o,{imageUrl:e,svgSizeKB:t}),mv}return t.value})).catch((()=>mv)):mv}const bv=uu(5000n);class Sv{#F;constructor(e){this.#F=e}#$(){const e=this.#F.getComputeUnitLimit(),t=this.#F.getComputeUnitPriceMicroLamportsPerComputeUnit();return lu(e,(e=>jo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(ed.toString())),(e=>e.toString()),BigInt,uu)}getFee(){const e=this.#$();return uu(bv+e)}}const Ev="Sending to this address may result in permanent loss of funds.";class kv extends Error{constructor(e,t){super(e,t),this.name="RecipientClassificationError"}}class Tv extends kv{constructor(){super(`Cannot send to this address. This appears to be a mint account, program data account, metadata account, or PDA. ${Ev} Only wallet addresses and token accounts are supported.`),this.name="RecipientUnsupportedError"}}class Iv extends kv{constructor(){super(`Cannot send to this address. This is a token account for a different token than the one you're trying to send. ${Ev}`),this.name="RecipientTokenAccountMintMismatchError"}}class xv{#W;#q;#x;#i;#V=4e4;#K=10000n;constructor(e,t,n,r){this.#W=e,this.#q=t,this.#x=n,this.#i=Jl(r,"[📩 SendSplTokenBuilder]")}async buildTransactionMessage(e){this.#i.log("Build transfer SPL token transaction message");const{from:{entropySource:t,derivationPath:n},to:r,mint:o,amount:i,network:a}=e;ti(o,"Mint is required");const s=await this.#q.classify(r,a);if("UNSUPPORTED"===s.type)throw new Tv;const[c,u,{privateKeyBytes:l},d]=await Promise.all([this.#x.fetchMint(o,a),this.#W.uiAmountToAmountForMint(o,a,i.toString()),$y({entropySource:t,derivationPath:n}),this.#x.getLatestBlockhash(a)]),{programAddress:f,data:{decimals:h}}=c,p=await ml(l),g=await xv.deriveAssociatedTokenAccountAddress({mint:o,owner:p.address,tokenProgram:f}),m=[],y=f===Nh,w=y?rp:Lf,v=y?sg:ih;switch(s.type){case"SYSTEM":{const e=await xv.deriveAssociatedTokenAccountAddress({mint:o,owner:r,tokenProgram:f});m.push(w({mint:o,payer:p,tokenProgram:f,owner:r,ata:e})),m.push(v({source:g,mint:o,destination:e,authority:p,amount:u,decimals:h}));break}case"TOKEN_ACCOUNT":if(s.mint!==o)throw new Iv;m.push(v({source:g,mint:o,destination:r,authority:p,amount:u,decimals:h}));break;default:throw new Tv}const A=lu(Du({version:0}),(e=>Gu(p.address,e)),(e=>fu(d,e)),(e=>Zu(m,e)));return Ju([ef({units:this.#V}),of({microLamports:this.#K})],A)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await Uf({mint:e,owner:t,tokenProgram:n}))[0]}getComputeUnitLimit(){return this.#V}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#K}}class _v{#x;#i;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#x=e,this.#i=Jl(t,"[🖋️ Signer]")}async partiallySignBase64String(e,t,n,r){this.#i.log("Partially sign base64 string",{base64String:e,account:t,network:n,config:r});const o=this.#x.getRpc(n),i=await qg(e,o,r);if("instructions"in i)return this.#G(i,t,n);if(Object.values(i.signatures).every((e=>!e))){const{messageBytes:e}=i,a=await Fg(e,o,r);return this.#G(a,t,n)}return this.#H(i,t)}async#G(e,t,n){const r=du(e)?e.lifetimeConstraint:await this.#x.getLatestBlockhash(n),o=sm(e),i=_v.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,a=!um(e)||!o,{privateKeyBytes:s}=await $y({entropySource:t.entropySource,derivationPath:t.derivationPath}),c=await ml(s),u=await lu(e,(e=>im(c.address,e)),(e=>{return t=r,du(n=e)?n:fu(t,n);var t,n}),(e=>((e,t,n)=>sm(e)?e:Ju([of(t,n)],e))(e,{microLamports:i})),(async e=>a?lm(e,this.#x.getRpc(n)):e)),l=pl([c],u);return await wl(l)}async#H(e,t){const{privateKeyBytes:n}=await $y({entropySource:t.entropySource,derivationPath:t.derivationPath});return ol([await Tc(n)],e)}}const Cv=(e,t)=>{const{to:n,type:r,status:o}=e,{address:i}=t;if(!(r===Lt.Receive||o===jt.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce(((e,t)=>t.address!==i||!t.asset?.fungible||t.asset.type!==od.SolMainnet&&t.asset.type!==od.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)}),{hasReceivedSOL:!1,receivedSOLAmount:new jo(0)});return a&&s.isLessThan(.001)};function Rv(e,t){return[Cv].some((n=>n(e,t)))}class Pv{#Z;#J;#Y;#Q;#X;#W;#_;#i;#ee=[Sf,Nh];constructor(e,t,n,r,o,i,a,s){this.#Z=e,this.#J=t,this.#Y=n,this.#Q=r,this.#X=o,this.#W=i,this.#_=a,this.#i=Jl(s,"[🗝️ KeyringAccountMonitor]"),this.#te()}#te(){this.#i.info("Binding handlers"),rw.forEach((e=>{this.#Z.registerNotificationHandler("accountSubscribe",e,this.#ne.bind(this)),this.#Z.registerNotificationHandler("programSubscribe",e,this.#re.bind(this))})),rw.forEach((e=>{this.#Z.registerConnectionRecoveryHandler(e,this.#oe.bind(this))}))}async setMonitoredAccounts(e){this.#i.info("Setting monitored accounts",e);const[t,n,r]=await Promise.all([this.#J.getAll(),this.#Z.getAll(),this.#_.getActiveNetworks()]),o=t.filter((e=>n.some((t=>e.address===(0,Pd.get)(t,"params[0]")||e.address===(0,Pd.get)(t,"params[1].filters[0].memcmp.bytes"))))),i=o.filter((t=>!e.includes(t.id))),a=t.filter((t=>e.includes(t.id))).filter((e=>!o.includes(e)));await Promise.allSettled([this.#ie(i,n),this.#ae(a,r)])}async#ae(e,t){try{this.#i.log("Monitoring keyring accounts",e);const n=this.#X.synchronize(e),r=e.flatMap((e=>{const n=t=>e.scopes.includes(t);return[...t.filter(n).map((async t=>this.#se(e,t))),...t.filter(n).map((async t=>{await Promise.all(this.#ee.map((async n=>this.#ce(e,n,t))))}))]}));await Promise.allSettled([...r,n])}catch(e){throw this.#i.error("Error monitoring keyring account",e),e}}async#ie(e,t){this.#i.log("Stopping to monitor accounts",e);const n=e.map((e=>e.address)),r=t.filter((e=>Pv.#ue(e)||Pv.#le(e))).filter((e=>n.includes(Pv.#de(e))));await Promise.allSettled(r.map((async e=>this.#Z.unsubscribe(e.id))))}async#se(e,t){this.#i.log("Monitoring native asset balance",{account:e,network:t});const{address:n}=e;await this.#Z.subscribe({method:"accountSubscribe",network:t,params:[n,{commitment:"confirmed",encoding:"jsonParsed"}]})}async#ce(e,t,n){this.#i.log("Monitoring token program by owner",{account:e,tokenProgramAddress:t,network:n});const{address:r}=e;await this.#Z.subscribe({method:"programSubscribe",network:n,params:[t,{commitment:"confirmed",encoding:"jsonParsed",filters:[{memcmp:{offset:32,bytes:r,encoding:"base58"}}]}]})}async#ne(e,t){this.#i.info("Account notification received",{notification:e,subscription:t});const{network:n}=t,r=(0,Pd.get)(t,"params[0]");j(r,ee());const o=await this.#J.findByAddress(r);if(!o)throw new Error(`No keyring account found for address: ${r}`);const{lamports:i}=e.params.result.value;j(i,J());await Promise.all([this.#Y.save({assetType:`${n}/${sd.SOL}`,keyringAccountId:o.id,network:n,address:r,symbol:"SOL",decimals:9,rawAmount:i.toString(),uiAmount:yv(i,9)}),this.#fe(o,n,r)])}async#re(e,t){this.#i.info("Handling program notification",{notification:e,subscription:t});const{network:n}=t,r=(0,Pd.get)(t,"params[0]");if(j(r,ee()),r!==Sf&&r!==Nh)throw new Error(`Program not supported: ${r}`);const{owner:o}=e.params.result.value.account.data.parsed.info;j(o,ee());const{mint:i}=e.params.result.value.account.data.parsed.info;j(i,ee());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;j(a,ee()),j(s,J()),j(c,ee());const{pubkey:u}=e.params.result.value;j(u,ee());const l=vv(n,i),d=await this.#J.findByAddress(o);if(!d)throw new Error(`No keyring account found with address: ${o}`);const f=await this.#W.amountToUiAmountForMint(i,n,uu(BigInt(a))).catch((e=>(this.#i.error("Error converting amount to uiAmount",e),c))),h=(await this.#Y.getAssetsMetadata([l]))[l];await Promise.all([this.#Y.save({assetType:l,keyringAccountId:d.id,network:n,mint:i,pubkey:u,symbol:h?.symbol??"UNKNOWN",decimals:s,rawAmount:a,uiAmount:f}),this.#fe(d,n,u)])}async#fe(e,t,n){const r=(await this.#Q.fetchLatestSignatures(t,oc(n),{limit:1}))?.[0];if(!r)throw new Error("No signature found");const o=await this.#Q.fetchBySignature(r,e,t);if(!o)throw new Error("No transaction found");Rv(o,e)?this.#i.info(`Transaction ${r} is spam. Skipping.`):await this.#Q.save(o)}async#oe(e){this.#i.info("Handling connection recovery",{network:e});const[t,n]=await Promise.all([this.#J.getAll(),this.#Z.getAll()]),r=n.filter((e=>Pv.#ue(e)||Pv.#le(e))),o=(0,Pd.uniq)(r.map((e=>Pv.#de(e)))),i=t.filter((e=>o.includes(e.address)));i.length?await this.#X.synchronize(i):this.#i.info("No monitored accounts found. Skipping connection recovery.")}static#ue(e){return"accountSubscribe"===e.method}static#le(e){return"programSubscribe"===e.method}static#de(e){if(this.#ue(e))return(0,Pd.get)(e,"params[0]");if(this.#le(e))return(0,Pd.get)(e,"params[1].filters[0].memcmp.bytes");throw new Error("Invalid subscription")}}class Nv{#he;#pe;#ge;#i;#me=new Map;constructor(e,t,n,r){this.#he=e,this.#pe=t,this.#ge=n,this.#i=Jl(r,"[🔔 SubscriptionService]"),this.#te()}#te(){this.#ge.on("onInactive",this.#ye.bind(this)),this.#ge.on("onWebSocketEvent",this.#we.bind(this)),this.#ge.on("onListSubscriptions",this.#ve.bind(this)),rw.forEach((e=>{this.#he.onConnectionRecovery(e,this.#Ae.bind(this))}))}registerNotificationHandler(e,t,n){this.#i.info("Registering notification handler",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#me.has(r)||this.#me.set(r,new Set),this.#me.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#he.onConnectionRecovery(e,t)}async subscribe(e){this.#i.info("New subscription request",e);const{method:t,params:n,network:r,expiryMilliseconds:o}=e,i=await this.#be(e),a=await this.#pe.getById(i);if(a){if("confirmed"===a.status)return i;await this.#pe.delete(i)}const s={...e,id:i,status:"pending",requestId:i,createdAt:(new Date).toISOString(),...o?{expiresAt:new Date(Date.now()+o).toISOString()}:{}};await this.#pe.save(s);const c=await this.#he.findByNetwork(r),u=async e=>{const r={jsonrpc:"2.0",id:i,method:t,params:n};e&&await this.#Se(e,r)};return c&&await u(c.id),s.id}async unsubscribe(e){this.#i.info("Unsubscribing from",e);const t=await this.#pe.getById(e);if(!t)return void this.#i.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:o}=t,i=rm[o];if(await this.#pe.delete(n),"confirmed"===t.status){const e=await this.#he.findByNetwork(r);e&&await this.#Se(e.id,{jsonrpc:"2.0",id:globalThis.crypto.randomUUID(),method:i,params:[t.rpcSubscriptionId]})}}async getAll(){return this.#pe.getAll()}async#we(e){if("message"!==e.type)return;const t=(e=>{const{data:t}=e;let n;if(t&&"object"==typeof t&&"type"in t)if("text"===t.type)n="string"==typeof t.message?JSON.parse(t.message):t.message;else{if("binary"!==t.type)throw new Error("Unknown message data");{const e=t.message,r=String.fromCharCode(...e);n=JSON.parse(r)}}else n="string"==typeof t?JSON.parse(t):t;return n})(e),n=await this.#he.findById(e.id);if(n)switch(this.#i.info("Received message",e),t.method){case"accountNotification":case"programNotification":case"signatureNotification":await this.#Ee(t,n.network);break;default:this.#ke(t)?await this.#Te(t):this.#Ie(t)?await this.#xe(t):zm(t)?await this.#_e(t):this.#i.warn("Received unknown message",t)}}async#Ee(e,t){const{subscription:n}=e.params,r=await this.#pe.findBy("rpcSubscriptionId",n);if(!r)return void this.#i.warn("No subscription found for RPC ID:",n);const o=`${r.method}:${t}`,i=this.#me.get(o);if(i&&i.size>0){(await Promise.allSettled(Array.from(i).map((async t=>t(e,r))))).forEach((e=>{"rejected"===e.status&&this.#i.error(`Handler failed for ${r.method}:`,e.reason)}))}}async#Se(e,t){this.#i.info(`Sending message to connection ${e}`,t),await snap.request({method:"snap_sendWebSocketMessage",params:{id:e,message:JSON.stringify(t)}})}#ke(e){return"jsonrpc"in e&&"2.0"===e.jsonrpc&&"id"in e&&"result"in e&&"number"==typeof e.result}#Ie(e){return"jsonrpc"in e&&"id"in e&&"result"in e&&!0===e.result}async#Te(e){const{id:t,result:n}=e,r=await this.#pe.getById(String(t));r?(await this.#pe.update({...r,status:"confirmed",rpcSubscriptionId:n,confirmedAt:(new Date).toISOString()}),this.#i.info(`Subscription confirmed: request ID: ${t} -> RPC ID: ${n}`)):this.#i.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#xe(e){this.#i.info("Received unsubscription confirmation",e)}async#_e(e){if("id"in e&&void 0!==e.id){const t=await this.#pe.getById(String(e.id));"pending"===t?.status?(await this.#pe.delete(t.id),this.#i.error(`Subscription establishment failed for ${t.id}:`,e.error)):this.#i.error(`Received error for request ID: ${e.id}`,e.error)}else this.#i.error("Connection-level error:",e.error)}async#be(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#Ce(t),r=(new TextEncoder).encode(n),o=await globalThis.crypto.subtle.digest("SHA-256",r),i=Array.from(new Uint8Array(o)).map((e=>e.toString(16).padStart(2,"0"))).join("");return i}#Ce(e){if(null==e)return JSON.stringify(e);if("object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map((e=>this.#Ce(e))).join(",")}]`;const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));return`{${t.map((t=>`"${t}":${this.#Ce(e[t])}`)).join(",")}}`}async#ve(){const e=await this.#pe.getAll();this.#i.info("Subscriptions",{subscriptions:e,notificationHandlers:this.#me})}#Re(e){return{method:e.method,params:e.params,network:e.network,...e.expiryMilliseconds?{expiryMilliseconds:e.expiryMilliseconds}:{},...e.metadata?{metadata:e.metadata}:{}}}async#Ae(e){this.#i.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#pe.getAll()).filter((t=>t.network===e)).filter(Nv.#Pe),n=t.map((e=>e.id));await this.#pe.deleteMany(n),await Promise.allSettled(t.map((async e=>{await this.subscribe(this.#Re(e))})))}async#ye(){this.#i.info("Client became inactive"),await this.#Ne()}async#Ne(){this.#i.info("Removing expired subscriptions");const e=(await this.#pe.getAll()).filter(Nv.#Be);await Promise.allSettled(e.map((async e=>{await this.unsubscribe(e.id)})))}static#Be(e){const t=new Date;return Boolean(e.expiresAt&&new Date(e.expiresAt)<t)}static#Pe(e){return!Nv.#Be(e)}}function Bv(e,t,n){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...t,key:n})}function Mv(e,t,n){return Bv(e,t,n)}const Ov='<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><image width="16" height="16" href="data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUFBQUFBQUGBgUICAcICAsKCQkKCxEMDQwNDBEaEBMQEBMQGhcbFhUWGxcpIBwcICkvJyUnLzkzMzlHREddXX0BBQUFBQUFBQYGBQgIBwgICwoJCQoLEQwNDA0MERoQExAQExAaFxsWFRYbFykgHBwgKS8nJScvOTMzOUdER11dff/CABEIAPoA+gMBIgACEQEDEQH/xAA1AAEAAwEBAQEBAAAAAAAAAAAAAQIHBggEBQMBAQADAQEBAQAAAAAAAAAAAAACAwQBBQYH/9oADAMBAAIQAxAAAADxkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACx204cU3mdnnYLG+IQwNvsxhgLfrRh5/egLRh59egkYefXoRCPn6mv5BH2ajuwAAAACZdFZz6/SvzfofWfLWtS2jw7WpNGO01mjJaas+P+k0tRjtNbUY38Leccnq/DxFq5f2ao7cAAAAB+36W8/9p7+DZZxp6nl7LOM3qzbLOMqs2zzjF6suyzjNqqNlnGrU5NkY7zlHP75Wjzv0mg5pAAAAAAs6jqdsMuajacMsam5HLGqORytqkxjlTVbc5lLVpjDKGsfhQlwdb1p3QAAAAAADofSXk7q/cp9MT8n0/cebe1Jpx2tS2fJNqTRkvNLUY7TWaMdqXZ8vnHPvZHmrw/u+JTGL6EAAAAABMDuvQvkLQfo6PQU55P0WLRJztTl0Sc7U5tFnOppzaOzmacujTnSrLo3x8NNFOM8zsuM+H99Aq2AAAAAATMfpWPznbNXOJdqjHi47Wec4l2jnOLdo5zi57JFxrsp5HjadRy9d0CMgAAAAJPqm+j0X8fW/oV82rPvUWRNGObUmjHe1LUZLIUY7TDPk/opk2CP5uPy+U+1qKrwAAAAPo3zPdc+23fu2/BfYXdA/AmjL+/bn1GToZ55Tl6KedmjJ0c87anL0LnuZyUTgH9fm+Q9+Bk0AAAAAAWVdWVFlRZUWVFpo4uoLxV0HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH//EAEEQAAECAwQHBAgDBgcBAAAAAAECBAADBgURF1UQMUFRkpPSEiFSohYgIjBAYaPiBzLBEyRUYnCRFBVDRYGhstH/2gAIAQEAAT8A/qXdF0XRd8ou9a4R3aOz8AO+KUo95Uc1SyoyGcs+3OIvvPhQDrMYUWPmbzhRGFFj5m74URhRY2Zu+FEYT2NmbvhRGE1jZm84URhNY2ZvOFEYTWNmjzhRGEti5o84URhLYuaPP7IjCWxc0ecKIwksXM3nCiMJLFzN5wojCSxczd/2RGEliZm8/siKt/DthYNkTLRbWlNUqWtIKJwA7Xa8JHwFK0w6qN6EJvQ1lkGfO2AeEb1HZDRq2YNpLVrJTLkyk9lCAO4D9TtJ2nQIv0C/QDAOgGL9Lp22Yt5rl1NTLky03rWrUB+p+W2KyqubUr72SpDOSSJEonzKHiPv6dsB7UT1LduLkJuM2afyy0bzvO4RZdmtbIZSGTRHZlS069qlbVK3k6AYGkQDA0DQDonTpTaVMnTpqUSkJKlrUbkhI1kmK3rJdQuRIaKUiz5BPYB7jMV41CD3++sWx3ltv5LNqm9au9Sj+VCRrUo7hFg2IzsBhLZthftmzCO+Yvao7vkNA0AxfA0A6RAMCCpKUqJUAALySbgBFeVsLXUuzbPWQxQr25m2coH/AMiFa/f0rVK6ZmO1hkiemehIIKuwoFBvFyrjGLByIc89MYsnIxz/ALIxZORjn/ZGLJyMc89MYspyP6/2xi0nIvr/AGxi2nI/r/bGLYyL6/2xi5LyM8/7Yxbl5Gef9sYuSsjPPHTGLkrI1c8dMYuSMjXzh0xi63yRfOHTFR/iO9tpktk1bBpJWLpp7fbWtPh1CCTBJPwN3udfqk6vgKcph7Ui3KW02VKEhIK1zL9atQFwJjCu1szZ+fpjCy18zZ+fpjCu1syZefpjCu1syZefpjCq18yZ+fpjCq18yZ+fpjCm18zZ+fpjCi1s0Z+fpjCe1szZ+fpjCe1s0Z+fpjCa180Z+fpjCa1szZ+fpjCa1szZefpjCW1s0Zefpi36Etan2gdrVKcSAblqlX+wTvBAMKB7ou9/T9vPKffJctriki6bLP5Vo3H9DFl2m1tdlIetV9qXMGralW1KtxGgGAYvgQDoBi+L9A0TZUtxKmSp0tK5cwFK0K7wUnWCIrWjlU+4DltethOPsE95lK8CjB+ApipnVPPAtN62yyBPk7FDeNyhsMNHbZ+2kum04TJMxPaSobR+hG0bIEXwDpB0AwIHqO2rZ+2nNXMlM2TMR2VoVqI/Q7jsisKWn049ISVTGc4kyJvy1lCvmII9+DdFH1VNsB0JThalMJyh+1RrKD40jeIkzpLiVLnSZqZkqYkKQtJvSUnUQdAOi+BF+gHQNA0WjZzO1Wc5m8lCZKmC4jaDsUk7FDYYqWnHtOv1t56SqUq8yJwHctH/ANG2B78G4xR1ZKsLttXiVzGSzeAk3mUraUg6wdojEum9zzkp64xMprc85KeuMTKa8Lzkp64xMprwvOSnrjE2mvC85KeuMTaa8LzlJ64xNprwveSnrjE6mvC95KeuMT6Z3POSnrjE+mdzzlJ6oxOpnc85Q6oxPpjc85SeqMT6YOx5yU9cYn0xue8lPXFY1tYFuWKtk1kT1zzNQpCpqAkIuPeoHtHX8APWv9S+L4vGjVo/4+Bs6zHtquA3ZN1TphBNydgG0k9wEYfVR/Ao5qIw9qj+BRzURh/VWXDmojD6qsuHNRGH1VZcOaiMPqqy4c1EYf1Xlf1ZfVGH9WZX9VHVGH1WZX9WX1Rh9VeWfVl9UYf1blJ5qOqMP6tyo81HVGH1W5T9VHVGH1XZSeajqi0qSt+yGxdPrPXLkhQSV9pKgCd/ZJ+As6z3dpu5LVrKMybMNwA/7JOwDaYpun29PMBIRcufMuLib41bh/KNnq3iL4ECO6Bd6m0d0fiBWMp6ldj2esKkBX7xOGpage5Cd6RtPvhDRrPeOJTeRKVMnTFBKEDWSYpSmJNPNSVkLezUj9rM2Aa+wn5DadI9QQDovgQNAivK2S2TPsezZl80jsOZwP5AdaE/PeYJJ99KlrmrQhAJWSAABeSdwikaTRYklLp0Ap/MRcdolJOwfPeY1QDov0iBoBi+AdNb1l/k6FWcwX+/LR7ax/oAjZ/OYUpSiSSSSbyT3kn39BubFZv5860ZqJc5KB/h1zPyJO0/JW6PSanh/vTXjj0mp7OmvHAqens6a8celFO501449Kacztrxx6U05nbXjj0ppzPGnHHpTTeeNOOPSqnM8accelVN54044FVU3njTjj0rprPWnHAqums8accelVNZ4044qav7PYNDLsp0hy7mC4LR3oljxE7VbhE+dNcTVzpswrmLUVKUokqJOsknWfgAbovMXnfF/wAzHai+L4vMdo747R3x2jvgKO+O18zHa+cXnfBJ/rX/AP/EADQRAAEDAQUFBAkFAAAAAAAAAAIAAQQDBRIUU5IREzBCVBUjMkMGICExM0RQUqIQImFyof/aAAgBAgEBPwD6pTpnVK6A3iT2fJ+z/U8GQ3InhyG5FhqzcqehUbkW7qfYnE25eBTA6piADeIlCgNFD2/ELxIhRCiFEKIUQqq93gWXXs+NT3lQu+/qitWC/m/i6e04b+annxcxFOi5iKZGfmRSo78yORS2ftJETk+1+BRgTK4bylQMhT2XO6U12ZOb5c12dMyDTwJWQawUnKNYORlIo9YG2vS4NkWoUM92fwS/H+UziY3hRCiFEKIUQog2+9S4z0ivD4eDY9rYd9xXLu+UvtRWlA6oEVowepBFPhZ4IpsPPBFMiZ4IpUbNBHXjG2x6oKsICbsBXh4AAVQhAAvES7Om9Kel1gJnSnpdYGY3y56Vg5TeQelYSVkHpWGkZJ6Vh6+UaISF9hD64iREIj73Vh2Jg6bSKw98X4ohRCiFEKIUQqVWCPTvEq1YqxuRev6Nw4Aji5MgN5yARN7EU6D1YamRTYXVBqZFMh9QGpkUqJ1AamRSonUBqZFJi54amVaXGpgRb0FKlHKqXn8PLwNqvOrzra6vP+u36t//xAA2EQABBAEBAwkECwEAAAAAAAACAAEDBAWiEjFDBhETFDAyQkRSICFBkhYjM1BTVGBhcrHB0f/aAAgBAwEBPwD70llCGMpJC2RT5jHtxtLp85jm42l0/KDFtvsaXT8pMS3mdLp+U+HbzOl0/KvCN5vS6+l+Cbfb0uqOQq5KBp6x7Ufd7rt/ftkTA3O+5ZC0dk9lvsxRgjBGCMEYI41hMBLl7PpgDvn/AIq1aGpBHBCGzGDcw+3binmbZDuosbYfwo8VbfhosNdfhamR4PIPwtTIsBkX4GpkfJzKPug1MoOSuSmmAZI+jDxntMqVOvQrhBCGyI6v3fsHkAX95J7ELeNPbr/GVddqNxl1+m3HBPk6Db7QJ8tjvjaBRZOhNIMYWgci7GWPbZHGjBGCMFJGjBOxCTEKwmYG4HQTF9cOrsZYtv3sjryP4UdSV+EjpWH4SPH2X3QGjxlx+AaPE338qaHFZSIwOOuYkKoS2ZawPZi6OT4/97F3ZOYN4l0sbeNl08P4oJ7EDcUF1mv+YD5l1uq3mA+ZkMkcjc4GxD2DROze9GCMFICMEYIwVelJbl2B3KtWjqxDFHub260cXNtmYI3i9aNg9aMWRx86OE/Qjry+hdSnM+ZgVatHWjYQb+X6F//Z" /></svg>';function zv(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function Uv(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:zv(r),key:n}}}const jv=Uv("Container"),Lv=Uv("Box"),Dv=Uv("Heading"),Fv=Uv("Text"),$v=Uv("Section"),Wv=Uv("Row"),qv=Uv("Address"),Vv=Uv("Image"),Kv=Uv("Footer"),Gv=Uv("Button"),Hv=Uv("Link");function Zv(e,t,n){const{cluster:r}=ud[e];return Rd({baseUrl:"https://solscan.io",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const Jv=({domain:e,scope:t,address:n})=>Bv(Lv,{direction:"horizontal",alignment:"center",children:Bv(Hv,{href:Zv(t,"address",n),children:e})});function Yv(e,t){return`${e}:${t}`}const Qv=JSON.parse('{"D":{"send.title":{"message":"Send"},"send.balance":{"message":"Balance"},"send.maxButton":{"message":"Max"},"send.cancelButton":{"message":"Cancel"},"send.continueButton":{"message":"Continue"},"send.fromField":{"message":"From"},"send.toField":{"message":"To"},"send.amountField":{"message":"Amount"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Enter public address or domain name"},"send.fromRequiredError":{"message":"Account is required"},"send.amountRequiredError":{"message":"Amount is required"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"Amount must be greater than {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Insufficient SOL balance to cover the transaction fee"},"send.toRequiredError":{"message":"To address is required"},"send.toInvalidError":{"message":"Invalid Solana address or domain name"},"send.toInvalidErrorDomain":{"message":"Unable to resolve domain name"},"send.toDomainResolutionStatus.initial":{"message":"Domain"},"send.toDomainResolutionStatus.fetching":{"message":"Resolving domain name..."},"send.toDomainResolutionStatus.fetched":{"message":"Domain name resolved."},"send.toDomainResolutionStatus.error":{"message":"Unable to resolve domain name."},"send.insufficientBalance":{"message":"Insufficient balance"},"send.simulationTitleAPIError":{"message":"Because of an error, we couldn\'t check for security alerts."},"send.simulationMessageAPIError":{"message":"Only continue if you trust every address involved."},"send.simulationTitleError":{"message":"Transaction simulation failed"},"send.simulationMessageError":{"message":"This transaction was reverted during simulation."},"send.selectedTokenPriceNotAvailable":{"message":"Prices for tokens in {currency} are currently not available. You are still able to send tokens."},"send.confirmation.title":{"message":"Review"},"send.confirmation.from":{"message":"From"},"send.confirmation.recipient":{"message":"Recipient"},"send.confirmation.network":{"message":"Network"},"send.confirmation.transactionSpeed":{"message":"Transaction speed"},"send.confirmation.fee":{"message":"Network fee"},"send.confirmation.sendButton":{"message":"Send"},"send.confirmation.cancelButton":{"message":"Cancel"},"send.confirmation.viewTransaction":{"message":"View transaction"},"send.send-pending.title":{"message":"Sending..."},"send.send-pending.subtitle":{"message":"Your transaction was submitted."},"send.transaction-success.title":{"message":"Sent"},"send.transaction-success.subtitle":{"message":"{amount} {tokenSymbol} was successfully sent"},"send.transaction-failure.title":{"message":"Transaction failed"},"send.transaction-failure.subtitle":{"message":"Unable to send {amount} {tokenSymbol}"},"confirmation.account":{"message":"Account"},"confirmation.network":{"message":"Network"},"confirmation.estimatedChanges":{"message":"Estimated changes"},"confirmation.estimatedChanges.send":{"message":"You send"},"confirmation.estimatedChanges.receive":{"message":"You receive"},"confirmation.estimatedChanges.notAvailable":{"message":"Not available"},"confirmation.estimatedChanges.noChanges":{"message":"No changes"},"confirmation.estimatedChanges.tooltip":{"message":"Estimated changes are what might happen if you go through with this transaction. This is just a prediction, not a guarantee."},"confirmation.advanced.show":{"message":"Show advanced"},"confirmation.advanced.hide":{"message":"Hide advanced"},"confirmation.cancelButton":{"message":"Cancel"},"confirmation.confirmButton":{"message":"Confirm"},"confirmation.signAndSendTransaction.title":{"message":"Transaction request"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Unknown"},"confirmation.advanced.programId":{"message":"Program ID"},"confirmation.advanced.data":{"message":"Data"},"confirmation.fee":{"message":"Network fee"},"confirmation.feeError":{"message":"Unable to estimate fee"},"confirmation.origin":{"message":"Request from"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"This transaction was reverted during simulation."},"confirmation.simulationErrorSubtitle":{"message":"{reason}"},"confirmation.validationErrorTitle":{"message":"This is a deceptive request"},"confirmation.validationErrorSubtitle":{"message":"If you approve this request, a third party known for scams will take all your assets."},"confirmation.validationErrorLearnMore":{"message":"Learn more"},"confirmation.validationErrorSecurityAdviced":{"message":"Security advice by"},"confirmation.signMessage.title":{"message":"Sign message"},"confirmation.signMessage.message":{"message":"Message"},"confirmation.signIn.title":{"message":"Sign-in request"},"confirmation.signIn.description":{"message":"A site wants you to sign in to prove you own this account."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Unknown domain"},"confirmation.signIn.signingInWith":{"message":"Signing in with"},"confirmation.signIn.badAccount":{"message":"This site is asking you to sign in using the wrong account."},"confirmation.signIn.message":{"message":"Message"},"confirmation.signIn.statement":{"message":"Statement"},"confirmation.signIn.version":{"message":"Version"},"confirmation.signIn.chainId":{"message":"Chain ID"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Issued at"},"confirmation.signIn.expirationTime":{"message":"Expiration time"},"confirmation.signIn.notBefore":{"message":"Not before"},"confirmation.signIn.requestId":{"message":"Request ID"},"confirmation.signIn.resources":{"message":"Resources"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"An account with the same address already exists."},"transactionScan.errors.insufficientSol":{"message":"Account does not have enough SOL to perform the operation."},"transactionScan.errors.slippageToleranceExceeded":{"message":"The transaction was reverted because the slippage tolerance was exceeded."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),Xv=JSON.parse('{"D":{"send.title":{"message":"Enviar"},"send.balance":{"message":"Saldo"},"send.maxButton":{"message":"Máx."},"send.cancelButton":{"message":"Cancelar"},"send.continueButton":{"message":"Continuar"},"send.fromField":{"message":"De"},"send.toField":{"message":"Para"},"send.amountField":{"message":"Monto"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Introduzca la dirección pública"},"send.fromRequiredError":{"message":"La cuenta es obligatoria"},"send.amountRequiredError":{"message":"El monto es obligatorio"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"El valor debe ser superior a {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Saldo de SOL insuficiente para cubrir la tarifa de transacción"},"send.toRequiredError":{"message":"La dirección del destinatario es obligatoria"},"send.toInvalidError":{"message":"Dirección de Solana no válida"},"send.insufficientBalance":{"message":"Saldo insuficiente"},"send.simulationTitleAPIError":{"message":"Debido a un error, no pudimos verificar las alertas de seguridad."},"send.simulationMessageAPIError":{"message":"Continúa solo si confías en todas las direcciones involucradas."},"send.simulationTitleError":{"message":"Simulación de transacción fallida"},"send.simulationMessageError":{"message":"Esta transacción se revirtió durante la simulación."},"send.selectedTokenPriceNotAvailable":{"message":"Los precios de los tokens en {currency} no están disponibles actualmente. Aún puede enviar tokens."},"send.confirmation.title":{"message":"Revisar"},"send.confirmation.from":{"message":"De"},"send.confirmation.recipient":{"message":"Destinatario"},"send.confirmation.network":{"message":"Red"},"send.confirmation.transactionSpeed":{"message":"Velocidad de la transacción"},"send.confirmation.fee":{"message":"Tarifa de red"},"send.confirmation.sendButton":{"message":"Enviar"},"send.confirmation.cancelButton":{"message":"Cancelar"},"send.confirmation.viewTransaction":{"message":"Ver transacción"},"send.send-pending.title":{"message":"Enviando..."},"send.send-pending.subtitle":{"message":"Se envió su transacción."},"send.transaction-success.title":{"message":"Enviado"},"send.transaction-success.subtitle":{"message":"El envío de {amount} {tokenSymbol} se realizó correctamente"},"send.transaction-failure.title":{"message":"Transacción fallida"},"send.transaction-failure.subtitle":{"message":"Error al enviar {amount} {tokenSymbol}"},"confirmation.account":{"message":"Cuenta"},"confirmation.network":{"message":"Red"},"confirmation.estimatedChanges":{"message":"Cambios estimados"},"confirmation.estimatedChanges.send":{"message":"Usted envía"},"confirmation.estimatedChanges.receive":{"message":"Usted recibe"},"confirmation.estimatedChanges.notAvailable":{"message":"No disponible"},"confirmation.estimatedChanges.noChanges":{"message":"Sin cambios"},"confirmation.estimatedChanges.tooltip":{"message":"Los cambios estimados son los que podrían producirse si sigue adelante con esta transacción. Esto es solo una predicción, no una garantía."},"confirmation.advanced.show":{"message":"Mostrar avanzadas"},"confirmation.advanced.hide":{"message":"Ocultar avanzadas"},"confirmation.cancelButton":{"message":"Cancelar"},"confirmation.confirmButton":{"message":"Confirmar"},"confirmation.signAndSendTransaction.title":{"message":"Solicitud de transacción"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Desconocida"},"confirmation.advanced.programId":{"message":"ID del programa"},"confirmation.advanced.data":{"message":"Datos"},"confirmation.fee":{"message":"Tarifa de red"},"confirmation.feeError":{"message":"No se puede calcular la tarifa"},"confirmation.origin":{"message":"Solicitud de"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"Esta transacción se revirtió durante la simulación."},"confirmation.simulationErrorSubtitle":{"message":"Motivo: {reason}"},"confirmation.validationErrorTitle":{"message":"Esta es una solicitud engañosa"},"confirmation.validationErrorSubtitle":{"message":"Si aprueba esta solicitud, un tercero conocido por sus estafas se quedará con todos sus activos."},"confirmation.validationErrorLearnMore":{"message":"Conozca más"},"confirmation.validationErrorSecurityAdviced":{"message":"Asesoramiento de seguridad por"},"confirmation.signMessage.title":{"message":"Firmar mensaje"},"confirmation.signMessage.message":{"message":"Mensaje"},"confirmation.signIn.title":{"message":"Solicitud de inicio de sesión"},"confirmation.signIn.description":{"message":"Un sitio quiere que inicie sesión para demostrar que usted es el titular de esta cuenta."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Dominio desconocido"},"confirmation.signIn.signingInWith":{"message":"Iniciar sesión con"},"confirmation.signIn.badAccount":{"message":"Este sitio le pide que inicie sesión con la cuenta incorrecta."},"confirmation.signIn.message":{"message":"Mensaje"},"confirmation.signIn.statement":{"message":"Declaración"},"confirmation.signIn.version":{"message":"Versión"},"confirmation.signIn.chainId":{"message":"ID de cadena"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Emitido a las"},"confirmation.signIn.expirationTime":{"message":"Hora de caducidad"},"confirmation.signIn.notBefore":{"message":"No antes de"},"confirmation.signIn.requestId":{"message":"ID de solicitud"},"confirmation.signIn.resources":{"message":"Recursos"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"Ya existe una cuenta con la misma dirección."},"transactionScan.errors.insufficientSol":{"message":"La cuenta no tiene suficiente SOL para realizar la operación."},"transactionScan.errors.slippageToleranceExceeded":{"message":"La transacción se revirtió porque se superó la tolerancia de deslizamiento."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),eA={en:Qv.D,es:Xv.D};function tA(e){const t=eA[e]??eA.en;return(e,n)=>{let r=t?.[e]?.message??e;return n&&r&&Object.keys(n).forEach((e=>{const t=new RegExp(`\\{${e}\\}`,"gu");r=r.replace(t,n[e]??"")})),r}}function nA(e){if(e===nd)return"MetaMask";try{return new URL(e).hostname}catch(e){throw new Error("Invalid URL")}}const rA=({label:e,value:t})=>null!=t?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:e}),Bv(Fv,{children:t})]}):null,oA=1e-6,iA=new jo(oA).decimalPlaces();function aA(e,t){const[n]=t.split("_");try{const r=new jo(e);if(r.isNaN())return"0";if(r.isZero())return"0";if(r.abs().lt(oA))return`<${function(e,t){const n=new jo(t),r=n.decimalPlaces(),o=n.toFixed(r??0),[i]=e.split("_"),[a,s]=o.split("."),c=new Intl.NumberFormat(i).format(a);return s?`${c}.${s}`:c}(t,oA)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:3}).format(Number(r.toFixed(iA??0)));const o=r.abs().integerValue().toString().length,i=Math.max(0,3-o+1);return new Intl.NumberFormat(t,{maximumFractionDigits:i}).format(r.toFixed(i))}catch(e){return Yl.error(e),"0"}}function sA(e,t,n){const r=new jo(e).toNumber(),[o]=n.split("_");return r.toLocaleString(o,{style:"currency",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const cA=({asset:e,preferences:t})=>{const n=e.type;return Mv(Lv,{direction:"vertical",crossAlignment:"end",children:[Mv(Lv,{direction:"horizontal",alignment:"center",children:[Mv(Fv,{color:"in"===n?"success":"error",children:["in"===n?"+":"-",aA(e.value??0,t.locale)]}),e.imageSvg?Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"full",src:e.imageSvg})}):null,Bv(Fv,{children:e.symbol??""})]}),e.price?Bv(Fv,{color:"muted",children:sA(e.price.toString(),t.currency,t.locale)}):null]})},uA=Uv("Tooltip");var lA;!function(e){e.Accessibility="accessibility",e.Activity="activity",e.AddCard="add-card",e.AddCircle="add-circle",e.AddSquare="add-square",e.Add="add",e.Ai="ai",e.AlternateEmail="alternate-email",e.Apple="apple",e.Apps="apps",e.Arrow2Down="arrow-2-down",e.Arrow2Left="arrow-2-left",e.Arrow2Right="arrow-2-right",e.Arrow2UpRight="arrow-2-up-right",e.Arrow2Up="arrow-2-up",e.ArrowCircleDown="arrow-circle-down",e.ArrowCircleUp="arrow-circle-up",e.ArrowDoubleLeft="arrow-double-left",e.ArrowDoubleRight="arrow-double-right",e.ArrowDown="arrow-down",e.ArrowDropDownCircle="arrow-drop-down-circle",e.ArrowLeft="arrow-left",e.ArrowRight="arrow-right",e.ArrowUp="arrow-up",e.Attachment="attachment",e.Ban="ban",e.BankAssured="bank-assured",e.Bank="bank",e.Bold="bold",e.Book="book",e.Bookmark="bookmark",e.Bridge="bridge",e.Briefcase="briefcase",e.Bulb="bulb",e.BuySell="buy-sell",e.Cake="cake",e.Calculator="calculator",e.Calendar="calendar",e.Call="call",e.Camera="camera",e.Campaign="campaign",e.CardPos="card-pos",e.Card="card",e.Cash="cash",e.Category="category",e.Chart="chart",e.CheckBold="check-bold",e.Check="check",e.CircleX="circle-x",e.ClockFilled="clock-filled",e.Clock="clock",e.Close="close",e.CloudDownload="cloud-download",e.CloudUpload="cloud-upload",e.Cloud="cloud",e.CodeCircle="code-circle",e.Code="code",e.Coin="coin",e.Collapse="collapse",e.Confirmation="confirmation",e.Connect="connect",e.CopySuccess="copy-success",e.Copy="copy",e.CreditCheck="credit-check",e.CurrencyFranc="currency-franc",e.CurrencyLira="currency-lira",e.CurrencyPound="currency-pound",e.CurrencyYuan="currency-yuan",e.Customize="customize",e.Danger="danger",e.DarkFilled="dark-filled",e.Dark="dark",e.Data="data",e.Description="description",e.Details="details",e.Diagram="diagram",e.DocumentCode="document-code",e.Download="download",e.Draft="draft",e.EcoLeaf="eco-leaf",e.EditSquare="edit-square",e.Edit="edit",e.EncryptedAdd="encrypted-add",e.Eraser="eraser",e.Error="error",e.Ethereum="ethereum",e.Exchange="exchange",e.ExpandVertical="expand-vertical",e.Expand="expand",e.ExploreFilled="explore-filled",e.Explore="explore",e.Export="export",e.Extension="extension",e.EyeSlash="eye-slash",e.Eye="eye",e.FaceId="face-id",e.Feedback="feedback",e.File="file",e.Filter="filter",e.Fingerprint="fingerprint",e.Fire="fire",e.FirstPage="first-page",e.Flag="flag",e.FlashSlash="flash-slash",e.Flash="flash",e.Flask="flask",e.Flower="flower",e.Folder="folder",e.Forest="forest",e.FullCircle="full-circle",e.Gas="gas",e.Gift="gift",e.GlobalSearch="global-search",e.Global="global",e.Graph="graph",e.Hardware="hardware",e.HashTag="hash-tag",e.HeartFilled="heart-filled",e.Heart="heart",e.Hierarchy="hierarchy",e.HomeFilled="home-filled",e.Home="home",e.Image="image",e.Info="info",e.Inventory="inventory",e.Joystick="joystick",e.KeepFilled="keep-filled",e.Keep="keep",e.Key="key",e.LastPage="last-page",e.LightFilled="light-filled",e.Light="light",e.Link="link",e.Loading="loading",e.Location="location",e.LockSlash="lock-slash",e.Lock="lock",e.LockedFilled="locked-filled",e.Login="login",e.Logout="logout",e.Mail="mail",e.Map="map",e.Menu="menu",e.MessageQuestion="message-question",e.Messages="messages",e.Mic="mic",e.MinusBold="minus-bold",e.MinusSquare="minus-square",e.Minus="minus",e.Mobile="mobile",e.MoneyBag="money-bag",e.Money="money",e.Monitor="monitor",e.MoreHorizontal="more-horizontal",e.MoreVertical="more-vertical",e.MountainFlag="mountain-flag",e.MusicNote="music-note",e.Notification="notification",e.PageInfo="page-info",e.Palette="palette",e.PasswordCheck="password-check",e.Pending="pending",e.People="people",e.PersonCancel="person-cancel",e.Pin="pin",e.Plant="plant",e.Plug="plug",e.PlusAndMinus="plus-and-minus",e.PolicyAlert="policy-alert",e.Print="print",e.PriorityHigh="priority-high",e.PrivacyTip="privacy-tip",e.ProgrammingArrows="programming-arrows",e.Publish="publish",e.QrCode="qr-code",e.Question="question",e.Receive="receive",e.Received="received",e.Refresh="refresh",e.RemoveMinus="remove-minus",e.Report="report",e.Rocket="rocket",e.SaveFilled="save-filled",e.Save="save",e.Saving="saving",e.ScanBarcode="scan-barcode",e.ScanFocus="scan-focus",e.Scan="scan",e.Search="search",e.SecurityAlert="security-alert",e.SecurityCross="security-cross",e.SecurityKey="security-key",e.SecuritySearch="security-search",e.SecuritySlash="security-slash",e.SecurityTick="security-tick",e.SecurityTime="security-time",e.SecurityUser="security-user",e.Security="security",e.Send="send",e.SentimentDissatisfied="sentiment-dissatisfied",e.SentimentNeutral="sentiment-neutral",e.SentimentSatisfied="sentiment-satisfied",e.SentimentVerySatisfied="sentiment-very-satisfied",e.SettingFilled="setting-filled",e.Setting="setting",e.Share="share",e.ShieldLock="shield-lock",e.ShoppingBag="shopping-bag",e.ShoppingCart="shopping-cart",e.SignalCellular="signal-cellular",e.Slash="slash",e.Sms="sms",e.SnapsMobile="snaps-mobile",e.SnapsPlus="snaps-plus",e.SnapsRound="snaps-round",e.Snaps="snaps",e.SortByAlpha="sort-by-alpha",e.Sort="sort",e.Sparkle="sparkle",e.Speed="speed",e.Speedometer="speedometer",e.Square="square",e.Stake="stake",e.StarFilled="star-filled",e.Star="star",e.Start="start",e.Storefront="storefront",e.Student="student",e.SwapHorizontal="swap-horizontal",e.SwapVertical="swap-vertical",e.TabClose="tab-close",e.TableRow="table-row",e.Tablet="tablet",e.Tag="tag",e.ThumbDownFilled="thumb-down-filled",e.ThumbDown="thumb-down",e.ThumbUpFilled="thumb-up-filled",e.ThumbUp="thumb-up",e.Tint="tint",e.Tooltip="tooltip",e.Translate="translate",e.Trash="trash",e.TrendDown="trend-down",e.TrendUp="trend-up",e.TriangleUp="triangle-up",e.TriangleDown="triangle-down",e.Undo="undo",e.Unfold="unfold",e.UnlockedFilled="unlocked-filled",e.Unpin="unpin",e.UploadFile="upload-file",e.Upload="upload",e.Usb="usb",e.UserCheck="user-check",e.UserCircleAdd="user-circle-add",e.UserCircleRemove="user-circle-remove",e.UserCircle="user-circle",e.User="user",e.VerifiedFilled="verified-filled",e.Verified="verified",e.Videocam="videocam",e.ViewColumn="view-column",e.ViewInAr="view-in-ar",e.VolumeOff="volume-off",e.VolumeUp="volume-up",e.WalletFilled="wallet-filled",e.Wallet="wallet",e.Warning="warning",e.WebTraffic="web-traffic",e.Widgets="widgets",e.WifiOff="wifi-off",e.Wifi="wifi",e.X="x"}(lA||(lA={}));const dA=Uv("Icon"),fA=({preferences:e})=>{const t=tA(e.locale);return Mv(Lv,{direction:"horizontal",center:!0,children:[Bv(Fv,{fontWeight:"medium",children:t("confirmation.estimatedChanges")}),Bv(uA,{content:t("confirmation.estimatedChanges.tooltip"),children:Bv(dA,{name:"info"})})]})},hA=Uv("Skeleton"),pA=({preferences:e})=>{const t=tA(e.locale);return Mv($v,{direction:"vertical",children:[Bv(fA,{preferences:e}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.send")}),Bv(Lv,{children:Mv(Lv,{direction:"vertical",crossAlignment:"end",children:[Bv(hA,{width:100,height:20}),Bv(hA,{width:40,height:20})]})})]}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.receive")}),Bv(Lv,{children:Mv(Lv,{direction:"vertical",crossAlignment:"end",children:[Bv(hA,{width:100,height:20}),Bv(hA,{width:40,height:20})]})})]})]})},gA=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const o=tA(t.locale),i="fetched"===n,a="error"===n;if("fetching"===n)return Bv(pA,{preferences:t});if(a||i&&"ERROR"===r)return Mv($v,{direction:"vertical",children:[Bv(fA,{preferences:t}),Bv(Fv,{color:"alternative",children:o("confirmation.estimatedChanges.notAvailable")})]});const s=e?.assets.filter((e=>"out"===e.type))??[],c=e?.assets.filter((e=>"in"===e.type))??[],u=s.length>0||c.length>0;return Mv($v,i&&!u?{direction:"vertical",children:[Bv(fA,{preferences:t}),Bv(Fv,{color:"alternative",children:o("confirmation.estimatedChanges.noChanges")})]}:{children:[Bv(fA,{preferences:t}),s?.length>0?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.send")}),Bv(Lv,{children:Bv(Lv,{children:s?.map((e=>Bv(cA,{asset:e,preferences:t})))})})]}):null,Bv(Lv,{children:null}),c?.length>0?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.receive")}),Bv(Lv,{children:Bv(Lv,{children:c?.map((e=>Bv(cA,{asset:e,preferences:t})))})})]}):null]})};var mA=function(e){return e.Cancel="confirm-sign-in-cancel",e.Confirm="confirm-sign-in-confirm",e}({});const yA={"confirm-sign-in-cancel":async function({id:e}){await Zy(e,!1)},"confirm-sign-in-confirm":async function({id:e}){await Zy(e,!0)}},wA=({params:e,origin:t,account:n,accountDomain:r,scope:o,preferences:i,networkImage:a})=>{const s=tA(i.locale),c=t?nA(t):null,{domain:u,statement:l,uri:d,version:f,chainId:h,nonce:p,issuedAt:g,expirationTime:m,notBefore:y,requestId:w,resources:v,address:A}=e,b=Yv(o,n.address),S=A?Yv(o,A):null,E=S!==b,k=u!==c;return Mv(jv,{children:[Mv(Lv,{children:[Mv(Lv,{alignment:"center",center:!0,children:[Bv(Lv,{children:null}),Bv(Dv,{size:"lg",children:s("confirmation.signIn.title")}),Bv(Fv,{color:"muted",alignment:"center",children:s("confirmation.signIn.description")})]}),i.simulateOnChainActions?Bv(gA,{changes:null,scanStatus:null,preferences:i,scanFetchStatus:"fetched"}):null,Mv($v,{children:[c?Bv(Wv,{label:s("confirmation.origin"),tooltip:s("confirmation.origin.tooltip"),children:Bv(Fv,{children:c})}):null,Bv(Wv,{variant:k?"critical":"default",label:s("confirmation.signIn.domain"),tooltip:k?s("confirmation.signIn.badDomain"):void 0,children:Bv(Fv,{children:u??s("confirmation.signIn.unknownDomain")})}),Bv(Wv,{label:s("confirmation.signIn.signingInWith"),tooltip:E?s("confirmation.signIn.badAccount"):void 0,variant:E?"warning":"default",children:r?Bv(Jv,{domain:r,scope:o,address:n.address}):Bv(qv,{address:b,truncate:!0,displayName:!0,avatar:!0})})]}),Mv($v,{children:[Bv(Fv,{fontWeight:"medium",children:s("confirmation.signIn.message")}),Bv(Fv,{children:l??""}),Bv(rA,{label:"URL",value:d??""}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.network")}),Mv(Lv,{direction:"horizontal",alignment:"center",children:[Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"medium",src:a??Ov})}),Bv(Fv,{children:ud[o].name})]})]}),S?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.account")}),Bv(qv,{address:S,truncate:!0,displayName:!0,avatar:!0})]}):null,Bv(rA,{label:s("confirmation.signIn.version"),value:f??""}),Bv(rA,{label:s("confirmation.signIn.chainId"),value:h??""}),Bv(rA,{label:s("confirmation.signIn.nonce"),value:p??""}),Bv(rA,{label:s("confirmation.signIn.issuedAt"),value:g??""}),Bv(rA,{label:s("confirmation.signIn.expirationTime"),value:m??""}),Bv(rA,{label:s("confirmation.signIn.notBefore"),value:y??""}),Bv(rA,{label:s("confirmation.signIn.requestId"),value:w??""}),v&&v.length>0?Mv(Lv,{alignment:"space-between",direction:"vertical",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.signIn.resources")}),Bv(Lv,{direction:"vertical",children:v.map((e=>Bv(Fv,{children:e},e)))})]}):null]})]}),Mv(Kv,{children:[Bv(Gv,{name:mA.Cancel,children:s("confirmation.cancelButton")}),Bv(Gv,{name:mA.Confirm,variant:k?"destructive":"primary",children:s("confirmation.confirmButton")})]})]})};var vA=function(e){return e.Cancel="confirm-sign-message-cancel",e.Confirm="confirm-sign-message-confirm",e}({});const AA={"confirm-sign-message-cancel":async function({id:e}){await Zy(e,!1)},"confirm-sign-message-confirm":async function({id:e}){await Zy(e,!0)}},bA=({message:e,account:t,accountDomain:n,scope:r,locale:o,networkImage:i,origin:a})=>{const s=tA(o),{address:c}=t,u=a?nA(a):null,l=Yv(r,c);return Mv(jv,{children:[Mv(Lv,{children:[Mv(Lv,{alignment:"center",center:!0,children:[Bv(Lv,{children:null}),Bv(Dv,{size:"lg",children:s("confirmation.signMessage.title")})]}),Mv($v,{children:[Bv(Lv,{direction:"horizontal",center:!0,children:Bv(Fv,{fontWeight:"medium",children:s("confirmation.signMessage.message")})}),Bv(Lv,{alignment:"space-between",children:Bv(Fv,{children:e})})]}),Mv($v,{children:[u?Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Mv(Lv,{alignment:"space-between",direction:"horizontal",center:!0,children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.origin")}),Bv(uA,{content:s("confirmation.origin.tooltip"),children:Bv(dA,{name:"question",color:"muted"})})]}),Bv(Fv,{children:u})]}):null,Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.account")}),n?Bv(Jv,{domain:n,scope:r,address:c}):Bv(qv,{address:l,truncate:!0,displayName:!0,avatar:!0})]}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:s("confirmation.network")}),Mv(Lv,{direction:"horizontal",alignment:"center",children:[Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"medium",src:i??Ov})}),Bv(Fv,{children:ud[r].name})]})]})]})]}),Mv(Kv,{children:[Bv(Gv,{name:vA.Cancel,children:s("confirmation.cancelButton")}),Bv(Gv,{name:vA.Confirm,children:s("confirmation.confirmButton")})]})]})};var SA=function(e){return e.ShowAdvanced="confirm-sign-and-send-transaction-show-advanced",e.Cancel="confirm-sign-and-send-transaction-cancel",e.Confirm="confirm-sign-and-send-transaction-confirm",e}({});const EA={"confirm-sign-and-send-transaction-show-advanced":async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await Hy(e,Bv(zA,{context:n}),n)},"confirm-sign-and-send-transaction-cancel":async function({id:e}){await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Ky}`)},"confirm-sign-and-send-transaction-confirm":async function({id:e}){await Zy(e,!0),await AE.deleteKey(`mapInterfaceNameToId.${Ky}`)}},kA=e=>e.replace(/([A-Z])/gu," $1").trim().replace(/^./u,(e=>e.toUpperCase())),TA=({address:e,scope:t})=>Bv(Hv,{href:Zv(t,"address",e),children:Bv(qv,{avatar:!1,address:Yv(t,e),truncate:!0})}),IA=({instruction:e,scope:t,locale:n})=>{const r=tA(n),{type:o,encoded:i,parsed:a}=e,{programAddress:s,dataBase58:c}=i,u=null!==a,l=kA(o);return Mv($v,{alignment:"start",children:[Bv(Fv,{color:"alternative",fontWeight:"bold",children:l}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",alignment:"start",children:r("confirmation.advanced.programId")}),Bv(TA,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map((([e,n])=>Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",children:kA(e)}),nc(n.address)?Bv(TA,{address:n.address,scope:t}):Bv(Fv,{children:Wy(n.address)?.toString()??""})]}))),u&&Object.entries(a.data).map((([e,n])=>Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",children:kA(e)}),nc(n)?Bv(TA,{address:n,scope:t}):Bv(Fv,{children:Wy(n)?.toString()??""})]}))),!u&&Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{color:"alternative",children:r("confirmation.advanced.data")}),Bv(Fv,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},xA=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const o=tA(n),i=t?"hide":"show",a=t?"arrow-up":"arrow-down";return Mv(Lv,{alignment:"start",children:[Mv(Gv,{name:SA.ShowAdvanced,children:[o(`confirmation.advanced.${i}`),"&nbsp;",Bv(dA,{name:a,color:"primary"})]}),t&&Bv(Lv,{children:e.map((e=>Bv(IA,{locale:n,scope:r,instruction:e})))})]})},_A=Uv("Banner"),CA={AccountAlreadyInUse:"transactionScan.errors.accountAlreadyInUse",ResultWithNegativeLamports:"transactionScan.errors.insufficientSol",SlippageToleranceExceeded:"transactionScan.errors.slippageToleranceExceeded",ExceededDesiredSlippageLimit:"transactionScan.errors.slippageToleranceExceeded"};function RA(e,t){const n=tA(t.locale),{code:r}=e;return n((r&&CA[r])??"transactionScan.errors.unknownError")}const PA={Malicious:"danger",Warning:"warning"},NA=({preferences:e,validation:t,error:n,scanFetchStatus:r})=>{const o=tA(e.locale);if("error"===r)return Bv(_A,{title:o("send.simulationTitleAPIError"),severity:"danger",children:Bv(Fv,{children:o("send.simulationMessageAPIError")})});if(!n&&!t)return Bv(Lv,{children:null});if(n)return Bv(_A,{title:o("confirmation.simulationErrorTitle"),severity:"warning",children:Bv(Fv,{children:o("confirmation.simulationErrorSubtitle",{reason:RA(n,e)})})});if(!t)return Bv(Lv,{children:null});const i=t?.type?PA[t.type]:void 0;return i?Mv(_A,{title:o("confirmation.validationErrorTitle"),severity:i,children:[Bv(Fv,{children:o("confirmation.validationErrorSubtitle")}),Bv(Fv,{size:"sm",children:Bv(Hv,{href:"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/",children:o("confirmation.validationErrorLearnMore")})}),Mv(Fv,{size:"sm",children:[Bv(dA,{color:"primary",name:"security-tick"})," ",o("confirmation.validationErrorSecurityAdviced")," ",Bv(Hv,{href:"https://www.blockaid.io",children:"Blockaid"})]})]}):Bv(Lv,{children:null})};function BA(e,t,n){return`${aA(e,n)} ${t}`}function MA(e,t){return new jo(e).multipliedBy(t).toString()}const OA=({origin:e,accountAddress:t,accountDomain:n,scope:r,feeInSol:o,nativePrice:i,fetchingPricesStatus:a,preferences:s,networkImage:c})=>{const{currency:u,locale:l}=s,d=tA(l),f=e?nA(e):null,h="fetching"===a,p=o&&i&&!("error"===a)?sA(MA(o,i),u,l):"";return Mv($v,{children:[f?Mv(Lv,{children:[Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Mv(Lv,{alignment:"space-between",direction:"horizontal",center:!0,children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.origin")}),Bv(uA,{content:d("confirmation.origin.tooltip"),children:Bv(dA,{name:"question",color:"muted"})})]}),Bv(Fv,{children:f})]}),Bv(Lv,{children:null})]}):null,Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.account")}),n&&t?Bv(Jv,{domain:n,scope:r,address:t}):null,!n&&t?Bv(qv,{address:Yv(r,t),truncate:!0,displayName:!0,avatar:!0}):null]}),Bv(Lv,{children:null}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.network")}),Mv(Lv,{direction:"horizontal",alignment:"center",children:[Bv(Lv,{alignment:"center",center:!0,children:Bv(Vv,{borderRadius:"medium",src:c??""})}),Bv(Fv,{children:ud[r].name})]})]}),Bv(Lv,{children:null}),Mv(Lv,{alignment:"space-between",direction:"horizontal",children:[Bv(Fv,{fontWeight:"medium",color:"alternative",children:d("confirmation.fee")}),o?Mv(Lv,{direction:"horizontal",alignment:"center",children:[h?Bv(hA,{width:80}):Bv(Fv,{color:"muted",children:p}),Bv(Fv,{children:BA(o,ud[r].nativeToken.symbol,l)})]}):Bv(uA,{content:d("confirmation.feeError"),children:Bv(dA,{name:"warning"})})]})]})},zA=({context:e})=>{const t=tA(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=ud[e.scope],o=e.tokenPrices[r.caip19Id]?.price??null,i="fetching"===e.scanFetchStatus||"ERROR"===e.scan?.status;return Mv(jv,{children:[Mv(Lv,{children:[e.preferences.useSecurityAlerts?Bv(NA,{scanFetchStatus:e.scanFetchStatus,validation:e.scan?.validation??null,error:e.scan?.error??null,preferences:e.preferences}):null,Mv(Lv,{alignment:"center",center:!0,children:[Bv(Lv,{children:null}),Bv(Dv,{size:"lg",children:t(`confirmation.${e.method}.title`)}),Bv(Lv,{children:null})]}),e.preferences.simulateOnChainActions?Bv(gA,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,Bv(OA,{accountAddress:e.account?.address??null,accountDomain:e.accountDomain??null,scope:e.scope,feeInSol:n,nativePrice:o,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),Bv(xA,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),Mv(Kv,{children:[Bv(Gv,{name:SA.Cancel,children:t("confirmation.cancelButton")}),Bv(Gv,{name:SA.Confirm,disabled:i,children:t("confirmation.confirmButton")})]})]})},UA={method:en.SignAndSendTransaction,scope:rd.Mainnet,networkImage:Ov,account:null,accountDomain:null,transaction:"",scan:null,scanFetchStatus:"fetching",feeEstimatedInSol:"0",tokenPrices:{},tokenPricesFetchStatus:"fetching",origin:"",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},advanced:{shown:!1,instructions:[]}};async function jA(e){const t={...UA,...e},n=Yy().then((e=>{t.preferences=e})).catch((()=>{t.preferences=UA.preferences})),r=(async(e,t)=>{const n=await qg(t,e),r="instructions"in n?n:await Fg(n.messageBytes,e),{instructions:o}=r;return o.map(em)})(kE.getRpc(t.scope),t.transaction).then((e=>{t.advanced.instructions=e})).catch((e=>{Yl.error(e),t.advanced.instructions=[]})),o=t.account?.address?jE.resolveAddress(t.scope,t.account.address).then((e=>{t.accountDomain=e})):Promise.resolve().then((()=>{t.accountDomain=null}));await Promise.all([n,r,o]);const{currency:i,useExternalPricingData:a,useSecurityAlerts:s,simulateOnChainActions:c}=t.preferences,u=await Gy(Bv(zA,{context:t}),t),l=Jy(u),d={...t},f=[ud[t.scope].nativeToken.caip19Id];a?await ME.getMultipleSpotPrices(f,i).then((e=>{d.tokenPrices=e,d.tokenPricesFetchStatus="fetched"})).catch((()=>{d.tokenPricesFetchStatus="error"})):(d.tokenPricesFetchStatus="fetched",d.tokenPrices={});let h=null;try{const{totalFee:e}=ym.calculateFee(t.transaction);h=wm(e).toString()}catch{h=null}d.feeEstimatedInSol=h,await Hy(u,Bv(zA,{context:d}),d);const p={...d},g=[];if(c&&g.push("simulation"),s&&g.push("validation"),c||s){const e=GE.scanTransaction({method:p.method,accountAddress:p.account?.address??"",transaction:p.transaction,scope:p.scope,origin:p.origin,options:g}).then((async e=>{p.scan=e,p.scanFetchStatus=e?"fetched":"error"})).catch((()=>{p.scan=null,p.scanFetchStatus="error"}));await Promise.all([e])}else p.scanFetchStatus="fetched",p.scan=null;return await Hy(u,Bv(zA,{context:p}),p),await AE.setKey(`mapInterfaceNameToId.${Ky}`,u),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}}),l}var LA=function(e){return e.OnTransactionAdded="onTransactionAdded",e.OnTransactionApproved="onTransactionApproved",e.OnTransactionRejected="onTransactionRejected",e.RefreshSend="refreshSend",e.RefreshConfirmationEstimation="refreshConfirmationEstimation",e.CloseWebSocketConnections="closeWebSocketConnections",e}({});function DA(e){return JSON.parse(function(e){const t=[];let n=!1;for(let r=0;r<e.length;r++){let o=!1;if("\\"===e[r]&&(t.push(e[r++]),o=!o),'"'!==e[r]){if(!n){const n=FA(e,r);if(n?.length){r+=n.length-1,n.match(/\.|[eE]-/)?t.push(n):t.push($A(n));continue}}t.push(e[r])}else t.push(e[r]),o||(n=!n)}return t.join("")}(e),((e,t)=>function(e){return!!e&&"object"==typeof e&&"$n"in e&&"string"==typeof e.$n}(t)?function({$n:e}){if(e.match(/[eE]/)){const[t,n]=e.split(/[eE]/);return BigInt(t)*BigInt(10)**BigInt(n)}return BigInt(e)}(t):t))}function FA(e,t){if(!e[t]?.match(/[-\d]/))return null;const n=e.slice(t).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);return n?n[0]:null}function $A(e){return`{"$n":"${e}"}`}var WA=0n;function qA(){const e=WA;return WA++,e.toString()}function VA(e){return function(e){return new Proxy(e.api,{defineProperty:()=>!1,deleteProperty:()=>!1,get:(t,n,r)=>function(...o){const i=n.toString(),a=Reflect.get(t,i,r);if(!a)throw new Ca(Ea,{method:i,params:o});const s=a(...o);return function({transport:e},t){return{send:async n=>await t.execute({signal:n?.abortSignal,transport:e})}}(e,s)}})}(e)}function KA(e){return new Proxy({},{defineProperty:()=>!1,deleteProperty:()=>!1,get(...t){const[n,r]=t,o=r.toString();return function(...t){const n=Object.freeze({methodName:o,params:t}),r=e?.requestTransformer?e?.requestTransformer(n):n;return Object.freeze({execute:async({signal:t,transport:n})=>{const o=function(e){return{id:qA(),jsonrpc:"2.0",method:e.methodName,params:e.params}}(r),i=await n({payload:o,signal:t});return e?.responseTransformer?e.responseTransformer(i,r):i}})}}})}function GA(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)&&("jsonrpc"in e&&"2.0"===e.jsonrpc&&"method"in e&&"string"==typeof e.method&&"params"in e)}var HA={};function ZA(e){return function t(n,r){if(Array.isArray(n))return n.map(((e,n)=>{const o={...r,keyPath:[...r.keyPath,n]};return t(e,o)}));if("object"==typeof n&&null!==n){const e={};for(const o in n){if(!Object.prototype.hasOwnProperty.call(n,o))continue;const i={...r,keyPath:[...r.keyPath,o]};e[o]=t(n[o],i)}return e}return e.reduce(((e,t)=>t(e,r)),n)}}function JA(e,t){return n=>{const r=ZA(e);return Object.freeze({...n,params:r(n.params,t)})}}function YA(e){return"bigint"==typeof e?Number(e):e}function QA({commitmentPropertyName:e,params:t,optionsObjectPositionInParams:n,overrideCommitment:r}){const o=t[n];if(void 0===o||o&&"object"==typeof o&&!Array.isArray(o))if(o&&e in o){if(!o[e]||"finalized"===o[e]){const r=[...t],{[e]:i,...a}=o;return Object.keys(a).length>0?r[n]=a:n===r.length-1?r.length--:r[n]=void 0,r}}else if("finalized"!==r){const i=[...t];return i[n]={...o,[e]:r},i}return t}function XA(e){return(t,{keyPath:n})=>("bigint"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var eb={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function tb(e){const t=e?.onIntegerOverflow;return n=>{return lu(n,t?(r=t,e=>JA([XA(((...t)=>r(e,...t)))],{keyPath:[]})(e)):e=>e,JA([YA],{keyPath:[]}),function({defaultCommitment:e,optionsObjectPositionByMethod:t}){return n=>{const{params:r,methodName:o}=n;if(!Array.isArray(r))return n;const i=t[o];return null==i?n:Object.freeze({methodName:o,params:QA({commitmentPropertyName:"sendTransaction"===o?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:eb}));var r}}function nb(e){return t=[rb(e)],n={keyPath:[]},e=>ZA(t)(e,n);var t,n}function rb(e){return function(t,{keyPath:n}){return"number"==typeof t&&Number.isInteger(t)||"bigint"==typeof t?function(e,t){return t.some((t=>{if(t.length!==e.length)return!1;for(let n=e.length-1;n>=0;n--){const r=e[n],o=t[n];if(o!==r&&(o!==HA||"number"!=typeof r))return!1}return!0}))}(n,e)?Number(t):BigInt(t):t}}function ob(e){return(t,n)=>{const r=n.methodName,o=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return lu(t,(e=>(e=>{const t=e;if("error"in t)throw za(t.error);return t})(e)),(e=>e.result),(e=>nb(o??[])(e,n)))}}var ib,ab=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",HA,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",HA,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",HA,"state","preUpdateAverageRate"],["data","parsed","info","extensions",HA,"state","currentRate"]],sb=[...ab,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",HA,"confirmationCount"]],cb=[["index"],["instructions",HA,"accounts",HA],["instructions",HA,"programIdIndex"],["instructions",HA,"stackHeight"]],ub=[["addressTableLookups",HA,"writableIndexes",HA],["addressTableLookups",HA,"readonlyIndexes",HA],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",HA,"accounts",HA],["instructions",HA,"programIdIndex"],["instructions",HA,"stackHeight"]];function lb(e){return KA({requestTransformer:tb(e),responseTransformer:ob({allowedNumericKeyPaths:db()})})}function db(){return ib||(ib={getAccountInfo:sb.map((e=>["value",...e])),getBlock:[["transactions",HA,"meta","preTokenBalances",HA,"accountIndex"],["transactions",HA,"meta","preTokenBalances",HA,"uiTokenAmount","decimals"],["transactions",HA,"meta","postTokenBalances",HA,"accountIndex"],["transactions",HA,"meta","postTokenBalances",HA,"uiTokenAmount","decimals"],["transactions",HA,"meta","rewards",HA,"commission"],...cb.map((e=>["transactions",HA,"meta","innerInstructions",HA,...e])),...ub.map((e=>["transactions",HA,"transaction","message",...e])),["rewards",HA,"commission"]],getClusterNodes:[[HA,"featureSet"],[HA,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[HA,"commission"]],getMultipleAccounts:sb.map((e=>["value",HA,...e])),getProgramAccounts:sb.flatMap((e=>[["value",HA,"account",...e],[HA,"account",...e]])),getRecentPerformanceSamples:[[HA,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:ab.map((e=>["value",HA,"account",...e])),getTokenAccountsByOwner:ab.map((e=>["value",HA,"account",...e])),getTokenLargestAccounts:[["value",HA,"decimals"],["value",HA,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",HA,"accountIndex"],["meta","preTokenBalances",HA,"uiTokenAmount","decimals"],["meta","postTokenBalances",HA,"accountIndex"],["meta","postTokenBalances",HA,"uiTokenAmount","decimals"],["meta","rewards",HA,"commission"],...cb.map((e=>["meta","innerInstructions",HA,...e])),...ub.map((e=>["transaction","message",...e]))],getVersion:[["feature-set"]],getVoteAccounts:[["current",HA,"commission"],["delinquent",HA,"commission"]],simulateTransaction:[...sb.map((e=>["value","accounts",HA,...e])),...cb.map((e=>["value","innerInstructions",HA,...e]))]}),ib}Object.assign({"accept-charset":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,"permissions-policy":!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,via:!0},{"accept-encoding":!0});var fb=["getAccountInfo","getBalance","getBlock","getBlockCommitment","getBlockHeight","getBlockProduction","getBlocks","getBlocksWithLimit","getBlockTime","getClusterNodes","getEpochInfo","getEpochSchedule","getFeeForMessage","getFirstAvailableBlock","getGenesisHash","getHealth","getHighestSnapshotSlot","getIdentity","getInflationGovernor","getInflationRate","getInflationReward","getLargestAccounts","getLatestBlockhash","getLeaderSchedule","getMaxRetransmitSlot","getMaxShredInsertSlot","getMinimumBalanceForRentExemption","getMultipleAccounts","getProgramAccounts","getRecentPerformanceSamples","getRecentPrioritizationFees","getSignaturesForAddress","getSignatureStatuses","getSlot","getSlotLeader","getSlotLeaders","getStakeMinimumDelegation","getSupply","getTokenAccountBalance","getTokenAccountsByDelegate","getTokenAccountsByOwner","getTokenLargestAccounts","getTokenSupply","getTransaction","getTransactionCount","getVersion","getVoteAccounts","index","isBlockhashValid","minimumLedgerSlot","requestAirdrop","sendTransaction","simulateTransaction"];function hb(e){return GA(e)&&fb.includes(e.method)}function pb(e){return function(e){const{fromJson:t,headers:n,toJson:r,url:o}=e,i=n&&function(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}(n);return async function({payload:e,signal:n}){const a=r?r(e):JSON.stringify(e),s={body:a,headers:{...i,accept:"application/json","content-length":a.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:n},c=await fetch(o,s);if(!c.ok)throw new Ca(Sa,{headers:c.headers,message:c.statusText,statusCode:c.status});return t?t(await c.text(),e):await c.json()}}({...e,fromJson:(e,t)=>hb(t)?DA(e):JSON.parse(e),toJson:e=>{return hb(e)?(t=e,function(e){return e.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g,"$1")}(JSON.stringify(t,((e,t)=>"bigint"==typeof t?function(e){return{$n:`${e}`}}(t):t),n))):JSON.stringify(e);var t,n}})}var gb=Object.prototype.toString,mb=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function yb(e,t){let n,r,o,i,a,s,c;if(!0===e)return"true";if(!1===e)return"false";switch(typeof e){case"object":if(null===e)return null;if("toJSON"in e&&"function"==typeof e.toJSON)return yb(e.toJSON(),t);if(c=gb.call(e),"[object Array]"===c){for(o="[",r=e.length-1,n=0;n<r;n++)o+=yb(e[n],!0)+",";return r>-1&&(o+=yb(e[n],!0)),o+"]"}if("[object Object]"===c){for(i=mb(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=yb(e[a],!1),void 0!==s&&(o&&(o+=","),o+=JSON.stringify(a)+":"+s),n++;return"{"+o+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"bigint":return`${e.toString()}n`;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}function wb(e){const t=yb(e,!1);if(void 0!==t)return""+t}function vb(e,t,n){let r="";if("number"==typeof t[0]){const e=t[0]+1,n=e%10,o=e%100;r=1==n&&11!=o?e+"st":2==n&&12!=o?e+"nd":3==n&&13!=o?e+"rd":e+"th"}else r=`\`${t[0].toString()}\``;const o=t.length>1?t.slice(1).map((e=>"number"==typeof e?`[${e}]`:e)).join("."):void 0,i=new Ca(ba,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...void 0!==o?{path:o}:void 0});return Ra(i,vb),i}var Ab,bb={defaultCommitment:"confirmed",onIntegerOverflow(e,t,n){throw vb(e.methodName,t,n)}},Sb=globalThis.AbortController;function Eb(e){return GA(e)?wb([e.method,e.params]):void 0}function kb(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function Tb(e){return lu(pb({...e,headers:{...e.headers?kb(e.headers):void 0,"solana-client":"js/2.1.0"}}),(e=>function(e,t){let n;return async function(r){const{payload:o,signal:i}=r,a=t(o);if(void 0===a)return await e(r);if(n||(queueMicrotask((()=>{n=void 0})),n={}),null==n[a]){const t=new Sb,o=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(Ab||={}))return;throw e}})();n[a]={abortController:t,numConsumers:0,responsePromise:o}}const s=n[a];if(s.numConsumers++,i){const e=s.responsePromise;return await new Promise(((t,n)=>{const r=e=>{i.removeEventListener("abort",r),s.numConsumers-=1,queueMicrotask((()=>{0===s.numConsumers&&s.abortController.abort(Ab||={})})),n(e.target.reason)};i.addEventListener("abort",r),e.then(t).catch(n).finally((()=>{i.removeEventListener("abort",r)}))}))}return await s.responsePromise}}(e,Eb)))}function Ib(e){return VA({api:lb(bb),transport:e})}const xb=Zl,_b=["getTransaction","getSignaturesForAddress"],Cb=e=>{const t=Tb({url:e}),n=Tb({url:e,headers:{"x-bigtable":"disabled"}});return async(...e)=>{const{payload:r}=e[0],{method:o}=r,i=_b.includes(o);return xb.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${o}. ${i?"Enabling":"Disabling"} BigTable lookups.`),i?t(...e):n(...e)}},Rb=Zl;async function Pb(e){try{await snap.request({method:"snap_trackError",params:{error:eo(new Error(JSON.stringify(e)))}}),Rb.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){Rb.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}function Nb(e){return!(!D(e,Nm)&&!zm(e))||!!_a(e)}const Bb=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{Rb.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const o=await e(...t);if(Nb(o)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(o)}`,responseData:o,requestParams:n};return await Pb(e),o}return o}catch(e){const t=function(e,t){const n={method:t,errorMessage:"Unknown error"};return e?.currentUrl&&(n.url=e.currentUrl),e instanceof Error?(n.errorMessage=e.message,n.errorStack=e.stack):"string"==typeof e?n.errorMessage=e:e?.message?n.errorMessage=e.message:e?.error&&(n.errorMessage="string"==typeof e.error?e.error:JSON.stringify(e.error)),e?.status?n.statusCode=e.status:e?.statusCode&&(n.statusCode=e.statusCode),e?.response?n.responseData=e.response:e?.data&&(n.responseData=e.data),n}(e,r);throw await Pb(t),e instanceof Error?e:new Error(t.errorMessage)}},Mb=Zl;async function Ob(e){return new Promise((t=>setTimeout(t,e)))}const zb=Zl;const Ub=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;let o;for(let n=0;n<4;n++)try{return zb.info(`[🚌 RetryingTransport] Attempt "${r}" ${n+1} of 4`),await e(...t)}catch(e){if(zb.error(`[🚌 RetryingTransport] Error during attempt "${r}" ${n+1} of 4: ${e}`),o=e,n<3){const e=(i=n,Math.min(400*Math.pow(2,i),1500));zb.info(`[🚌 RetryingTransport] Sleeping for ${e}ms`),await Ob(e)}}var i;throw o},jb=e=>{return lu(e,(t=Cb,e=>e.map(t)),(t=>((e,t)=>async(...n)=>{let r;const o=e.length;for(const[i,a]of e.entries())try{const e=t[i];return Mb.info(`[🚌 FailoverTransport] Attempting to use transport ${i+1} of ${o} (URL: ${e})`),await a(...n)}catch(e){const n=t[i];r=e;const a=i===o-1;Mb.error(`[🚌 FailoverTransport] Transport failed (URL: ${n}): ${e}. ${a?"No more transports to try.":"Trying next transport..."}`),e instanceof Error&&(e.currentUrl=n)}throw r})(t,e)),Ub,(e=>Bb(e)));var t};var Lb,Db=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Fb=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var n=t.substring(1),r=parseInt(n)/8;this.resize_if_necessary(r);var o="f"===t[0]?"setFloat".concat(n):"i"===t[0]?"setInt".concat(n):"setUint".concat(n);this.view[o](this.offset,e,!0),this.offset+=r},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),$b=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),n=parseInt(t)/8;this.assert_enough_buffer(n);var r="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[r](this.offset,!0);return this.offset+=n,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),Wb=(Lb=function(e,t){return Lb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Lb(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Lb(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function qb(e,t,n){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}function Vb(e,t,n){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(n.join(".")))}var Kb=Db.concat(["bool","string"]),Gb=["option","enum","array","set","map","struct"],Hb=function(e){function t(t,n){var r="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return e.call(this,r)||this}return Wb(t,e),t}(Error);function Zb(e){if("string"!=typeof e||!Kb.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&Gb.includes(t[0])){var n=t[0];if("option"===n)return Zb(e[n]);if("enum"===n)return function(e){if(!Array.isArray(e))throw new Hb(e,"Array");for(var t=0,n=e;t<n.length;t++){var r=n[t];if("object"!=typeof r||!("struct"in r))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof r.struct||1!==Object.keys(r.struct).length)throw new Error('The "struct" in each enum must have a single key');Zb({struct:r.struct})}}(e[n]);if("array"===n)return function(e){if("object"!=typeof e)throw new Hb(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return Zb(e.type);throw new Hb(e,"{ type, len? }")}(e[n]);if("set"===n)return Zb(e[n]);if("map"===n)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new Hb(e,"{ key, value }");Zb(e.key),Zb(e.value)}(e[n]);if("struct"===n)return function(e){if("object"!=typeof e)throw new Hb(e,"object");for(var t in e)Zb(e[t])}(e[n])}}throw new Hb(e,Gb.join(", ")+" or "+Kb.join(", "))}}!function(){function e(e){this.encoded=new Fb,this.fieldPath=["value"],this.checkTypes=e}e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(Db.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var n=parseInt(t.substring(1));n<=32||"f64"==t?(this.checkTypes&&qb(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),n))},e.prototype.encode_bigint=function(e,t){for(var n=t/8,r=new Uint8Array(n),o=0;o<n;o++)r[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(r))},e.prototype.encode_string=function(e){this.checkTypes&&qb(e,"string",this.fieldPath);for(var t=e,n=[],r=0;r<t.length;r++){var o=t.charCodeAt(r);o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<55296||o>=57344?n.push(224|o>>12,128|o>>6&63,128|63&o):(r++,o=65536+((1023&o)<<10|1023&t.charCodeAt(r)),n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o))}this.encoded.store_value(n.length,"u32"),this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_boolean=function(e){this.checkTypes&&qb(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var n=Object.keys(e)[0],r=0;r<t.enum.length;r++){var o=t.enum[r];if(n===Object.keys(o.struct)[0])return this.encoded.store_value(r,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(n,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?Vb(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var n=0;n<e.length;n++)this.encode_value(e[n],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?Vb(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&qb(e,"object",this.fieldPath);var n=e instanceof Set?Array.from(e.values()):Object.values(e);this.encoded.store_value(n.length,"u32");for(var r=0,o=n;r<o.length;r++){var i=o[r];this.encode_value(i,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&qb(e,"object",this.fieldPath);var n=e instanceof Map,r=n?Array.from(e.keys()):Object.keys(e);this.encoded.store_value(r.length,"u32");for(var o=0,i=r;o<i.length;o++){var a=i[o];this.encode_value(a,t.map.key),this.encode_value(n?e.get(a):e[a],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&qb(e,"object",this.fieldPath);for(var n=0,r=Object.keys(t.struct);n<r.length;n++){var o=r[n];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}}}();var Jb=function(){function e(e){this.buffer=new $b(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(Db.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var n=e/8,r=new Uint8Array(this.buffer.consume_bytes(n)),o=r.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&r[n-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){for(var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e)),n=[],r=0;r<e;++r){var o=t[r];if(o<128)n.push(o);else if(o<224)n.push((31&o)<<6|63&t[++r]);else if(o<240)n.push((15&o)<<12|(63&t[++r])<<6|63&t[++r]);else{var i=(7&o)<<18|(63&t[++r])<<12|(63&t[++r])<<6|63&t[++r];n.push(i)}}return String.fromCodePoint.apply(String,n)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,n=this.buffer.consume_value("u8");if(n>e.enum.length)throw new Error("Enum option ".concat(n," is not available"));var r=e.enum[n].struct,o=Object.keys(r)[0];return(t={})[o]=this.decode_value(r[o]),t},e.prototype.decode_array=function(e){for(var t=[],n=e.array.len?e.array.len:this.decode_integer("u32"),r=0;r<n;++r)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),n=new Set,r=0;r<t;++r)n.add(this.decode_value(e.set));return n},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),n=new Map,r=0;r<t;++r){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);n.set(o,i)}return n},e.prototype.decode_struct=function(e){var t={};for(var n in e.struct)t[n]=this.decode_value(e.struct[n]);return t},e}();function Yb(e,t,n){return void 0===n&&(n=!0),n&&Zb(e),new Jb(t).decode(e)}var Qb=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Qb||{});const Xb=sc(),eS=(Fs(),Gs()),tS=Qs(),nS=Va(ru([["mint",ic()],["owner",ic()],["amount",Ss()],["delegate",df(ic(),{prefix:As(),noneValue:"zeroes"})],["state",Jc(Qb)],["isNative",df(Ss(),{prefix:As(),noneValue:"zeroes"})],["delegatedAmount",Ss()],["closeAuthority",df(ic(),{prefix:As(),noneValue:"zeroes"})]]),ou([["mint",ac()],["owner",ac()],["amount",Es()],["delegate",ff(ac(),{prefix:bs(),noneValue:"zeroes"})],["state",Yc(Qb)],["isNative",ff(Es(),{prefix:bs(),noneValue:"zeroes"})],["delegatedAmount",Es()],["closeAuthority",ff(ac(),{prefix:bs(),noneValue:"zeroes"})]]));var rS;!function(e){e.SymbolNotFound="SymbolNotFound",e.InvalidSubdomain="InvalidSubdomain",e.PrimaryDomainNotFound="PrimaryDomainNotFound",e.MissingParentOwner="MissingParentOwner",e.U32Overflow="U32Overflow",e.InvalidBufferLength="InvalidBufferLength",e.U64Overflow="U64Overflow",e.NoRecordData="NoRecordData",e.InvalidRecordData="InvalidRecordData",e.UnsupportedRecord="UnsupportedRecord",e.InvalidEvmAddress="InvalidEvmAddress",e.InvalidInjectiveAddress="InvalidInjectiveAddress",e.InvalidARecord="InvalidARecord",e.InvalidAAAARecord="InvalidAAAARecord",e.InvalidRecordInput="InvalidRecordInput",e.InvalidSignature="InvalidSignature",e.AccountDoesNotExist="AccountDoesNotExist",e.MultipleRegistries="MultipleRegistries",e.InvalidReverseTwitter="InvalidReverseTwitter",e.NoAccountData="NoAccountData",e.InvalidInput="InvalidInput",e.InvalidDomain="InvalidDomain",e.InvalidCustomBg="InvalidCustomBackground",e.UnsupportedSignature="UnsupportedSignature",e.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",e.RecordIsNotSigned="RecordIsNotSigned",e.UnsupportedSignatureType="UnsupportedSignatureType",e.InvalidSolRecordV2="InvalidSolRecordV2",e.MissingVerifier="MissingVerifier",e.PythFeedNotFound="PythFeedNotFound",e.InvalidRoA="InvalidRoA",e.InvalidPda="InvalidPda",e.InvalidParent="InvalidParent",e.NftAccountNotFound="NftRecordNotFound",e.PdaOwnerNotAllowed="PdaOwnerNotAllowed",e.DomainDoesNotExist="DomainDoesNotExist",e.RecordMalformed="RecordMalformed",e.CouldNotFindNftOwner="CouldNotFindNftOwner",e.InvalidValidation="InvalidValidation",e.InvalidSerializedData="InvalidSerializedData"}(rS||(rS={}));class oS extends Error{type;constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,oS)}}class iS extends oS{constructor(e){super(rS.PrimaryDomainNotFound,e)}}class aS extends oS{constructor(e){super(rS.NoRecordData,e)}}class sS extends oS{constructor(e){super(rS.AccountDoesNotExist,e)}}class cS extends oS{constructor(e){super(rS.NoAccountData,e)}}class uS extends oS{constructor(e){super(rS.InvalidInput,e)}}class lS extends oS{constructor(e){super(rS.InvalidRoA,e)}}class dS extends oS{constructor(e){super(rS.NftAccountNotFound,e)}}class fS extends oS{constructor(e){super(rS.PdaOwnerNotAllowed,e)}}class hS extends oS{constructor(e){super(rS.DomainDoesNotExist,e)}}class pS extends oS{constructor(e){super(rS.RecordMalformed,e)}}class gS extends oS{constructor(e){super(rS.CouldNotFindNftOwner,e)}}class mS extends oS{constructor(e){super(rS.InvalidValidation,e)}}class yS extends oS{constructor(e){super(rS.InvalidSerializedData,e)}}class wS{static HEADER_LEN=96;parentName;owner;class;data;static schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};constructor(e){this.parentName=Xb.decode(e.parentName),this.owner=Xb.decode(e.owner),this.class=Xb.decode(e.class)}static deserialize(e){try{const t=new wS(Yb(this.schema,e));return t.data=e?.slice(this.HEADER_LEN),t}catch{throw new Error("Failed to deserialize RegistryState data")}}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new sS("The domain account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await fh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}}const vS="58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx",AS="nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk",bS="33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z",SS="2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo",ES=async(e,t,n)=>{const r=await(async e=>{const t=tS.encode("SPL Name Service"+e),n=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(n)})(e);return await(async(e,t,n)=>{const r=[e];r.push(n?Xb.encode(n):new Uint8Array(32)),r.push(t?Xb.encode(t):new Uint8Array(32));const[o]=await yc({programAddress:"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX",seeds:r});return o})(r,t,n)};var kS;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(kS||(kS={}));class TS{tag;nonce;nameAccount;owner;nftMint;static LEN=98;static schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=Xb.decode(e.nameAccount),this.owner=Xb.decode(e.owner),this.nftMint=Xb.decode(e.nftMint)}static deserialize(e){try{return new TS(Yb(this.schema,e))}catch{throw new yS("Failed to deserialize NftState data")}}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new dS(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(AS,{encoding:"base64",filters:[{dataSize:BigInt(TS.LEN)},{memcmp:{offset:BigInt(0),bytes:"3",encoding:"base58"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:"base58"}}]}).send();if(1!==n.length)throw new dS(`NFT not found: ${t}`);return this.deserialize(eS.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await yc({programAddress:AS,seeds:[tS.encode("nft_record"),Xb.encode(e)]});return t}}const IS=tS.encode("tokenized_name"),xS=async(e,t)=>{try{const n=await(async e=>{const[t]=await yc({programAddress:AS,seeds:[IS,Xb.encode(e)]});return t})(t),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const o=await dh(e,r.value[0].address);if(!o.exists)return null;const i=nS.decode(o.data);return"1"===i.amount.toString()?i.owner:null}catch(e){if(_a(e,oi))return null;throw e}};class _S{tag;nameAccount;static schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=Xb.decode(e.nameAccount)}static deserialize(e){try{return new _S(Yb(this.schema,e))}catch{throw new yS("Failed to deserialize PrimaryDomainState data")}}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new iS("The favourite account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await fh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}static async getAddress(e,t){const[n]=await yc({programAddress:e,seeds:[tS.encode("favourite_domain"),Xb.encode(t)]});return n}}async function CS(e,t,n){const r=await(async(e,t)=>await ES(e,t,bS))(t,n),o=await wS.retrieve(e,r);if(!o.data)throw new cS("The registry data is empty");return function(e,t=!1){if(!e)return;const n=new DataView(e.buffer).getUint32(0,!0);return tS.decode(e.subarray(4,4+n)).replace(/^\0/,t?"":"\0")}(o.data,!!n)}var RS;!function(e){e.IPFS="IPFS",e.ARWV="ARWV",e.SOL="SOL",e.ETH="ETH",e.BTC="BTC",e.LTC="LTC",e.DOGE="DOGE",e.Email="email",e.Url="url",e.Discord="discord",e.Github="github",e.Reddit="reddit",e.Twitter="twitter",e.Telegram="telegram",e.Pic="pic",e.SHDW="SHDW",e.POINT="POINT",e.BSC="BSC",e.Injective="INJ",e.Backpack="backpack",e.A="A",e.AAAA="AAAA",e.CNAME="CNAME",e.TXT="TXT",e.Background="background",e.BASE="BASE",e.IPNS="IPNS"}(RS||(RS={}));new Map([[RS.SOL,96],[RS.ETH,20],[RS.BSC,20],[RS.Injective,20],[RS.A,4],[RS.AAAA,16],[RS.Background,32]]);var PS;!function(e){e[e.V1=1]="V1",e[e.V2=2]="V2"}(PS||(PS={}));const NS=async(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const n=t===PS.V2?SS:void 0,r={[PS.V2]:"",[PS.V1]:""}[t]||"\0",o=e.split(".");if(2===o.length){const e=await ES(o[1],vS);return{address:await ES(r+o[0],e,n),parentAddress:e,isSub:!0}}if(3===o.length&&t){const e=await ES(o[2],vS),t=await ES("\0"+o[1],e);return{address:await ES(r+o[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(o.length>=3)throw new uS("The domain is malformed");return{address:await ES(e,vS),isSub:!1}};function BS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function MS(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function OS(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function zS(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function US(e){if(!Array.isArray(e))throw new Error("array expected")}function jS(e,t){if(!MS(!0,t))throw new Error(`${e}: array of strings expected`)}function LS(e,t){if(!MS(!1,t))throw new Error(`${e}: array of numbers expected`)}const DS=(e,t)=>0===t?e:DS(t,e%t),FS=(e,t)=>e+(t-DS(e,t)),$S=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function WS(e,t,n,r){if(US(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(FS(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${FS(t,n)}`);let o=0,i=0;const a=$S[t],s=$S[n]-1,c=[];for(const r of e){if(zS(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);const e=$S[i];if(void 0===e)throw new Error("invalid carry");o&=e-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function qS(e){return function(e){if("function"!=typeof e)throw new Error("function expected")}(e),function(...t){try{return e.apply(null,t)}catch(e){}}}const VS=function(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map((e=>e.encode)).reduceRight(n,t),decode:e.map((e=>e.decode)).reduce(n,t)}}(function(e){const t=e.split(""),n=t.length;jS("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(US(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]}))),decode:t=>(US(t),t.map((t=>{OS("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})))}}("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),function(e=""){return OS("join",e),{encode:t=>(jS("join.decode",t),t.join(e)),decode:t=>(OS("join.decode",t),t.split(e))}}("")),KS=[996825010,642813549,513874426,1027748829,705979059];function GS(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<KS.length;e++)1==(t>>e&1)&&(n^=KS[e]);return n}function HS(e,t,n=1){const r=e.length;let o=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);o=GS(o)^n>>5}o=GS(o);for(let t=0;t<r;t++)o=GS(o)^31&e.charCodeAt(t);for(let e of t)o=GS(o)^e;for(let e=0;e<6;e++)o=GS(o);return o^=n,VS.encode(WS([o%$S[30]],30,5,!1))}!function(){const e=function(e,t=!1){if(zS(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(FS(8,e)>32||FS(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!BS(n))throw new Error("radix2.encode input should be Uint8Array");return WS(Array.from(n),8,e,!t)},decode:n=>(LS("radix2.decode",n),Uint8Array.from(WS(n,e,8,t)))}}(5),t=e.decode,n=e.encode,r=qS(t);function o(e,t,n=90){OS("bech32.encode prefix",e),BS(t)&&Array.from(t),LS("bech32.encode",t);const r=e.length;if(0===r)throw new TypeError(`Invalid prefix length ${r}`);const o=r+7+t.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),a=HS(i,t,1);return`${i}1${VS.encode(t)}${a}`}function i(e,t=90){OS("bech32.decode input",e);const n=e.length;if(n<8||!1!==t&&n>t)throw new TypeError(`invalid string length: ${n} (${e}). Expected (8..${t})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=r.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=r.slice(0,o),a=r.slice(o+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=VS.decode(a).slice(0,-6),c=HS(i,s,1);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:s}}qS(i)}();var ZS,JS={exports:{}},YS=JS.exports;!function(){return ZS||(ZS=1,e=JS,function(t){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${a})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let n,r,o=0,i=-1,a=(e.match(c.zoneIndex)||[])[0];for(a&&(a=a.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)o++;if("::"===e.substr(0,2)&&o--,"::"===e.substr(-2,2)&&o--,o>t)return null;for(r=t-o,n=":";r--;)n+="0:";return":"===(e=e.replace("::",n))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n}(),zoneId:a}}function l(e,t,n,r){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;r>0;){if(o=n-r,o<0&&(o=0),e[i]>>o!=t[i]>>o)return!1;r-=n,i+=1}return!0}function d(e){if(i.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(o.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}const h={};h.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,o,i;for(r=3;r>=0;r-=1){if(o=this.octets[r],!(o in n))return null;if(i=n[o],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),h.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<4;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(e){return null!==this.parser(e)},h.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},h.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv4.isValidFourPartDecimal=function(e){return!(!h.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<4;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},h.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(e){let t,n,o;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r}();if(t=e.match(r.longValue)){if(o=d(t[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(o>>t&255);return e}().reverse()}return(t=e.match(r.twoOctet))?function(){const e=t.slice(1,4),n=[];if(o=d(e[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(o>>16&255),n.push(o>>8&255),n.push(255&o),n}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),n=[];if(o=d(e[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(d(e[1])),n.push(o>>8&255),n.push(255&o),n}():null},h.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.IPv6=function(){function e(e,t){let n,r;if(16===e.length)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let r,o;for(let i=7;i>=0;i-=1){if(r=this.parts[i],!(r in n))return null;if(o=n[r],t&&0!==o)return null;16!==o&&(t=!0),e+=o}return 128-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],n=e[1];return new h.IPv4([t>>8,255&t,n>>8,255&n])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let n,r=0,o=-1;for(;n=e.exec(t);)n[0].length>o&&(r=n.index,o=n[0].length);return o<0?t:`${t.substring(0,r)}::${t.substring(r+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),h.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<16;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.isIPv6=function(e){return null!==this.parser(e)},h.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},h.IPv6.isValidCIDR=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv6.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<16;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},h.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(e){let t,n,r,o,i,a;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return u(e,8);if((r=e.match(c.transitional))&&(a=r[6]||"",t=r[1],r[1].endsWith("::")||(t=t.slice(0,-1)),t=u(t+a,6),t.parts)){for(i=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<i.length;n++)if(o=i[n],!(0<=o&&o<=255))return null;return t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.fromByteArray=function(e){const t=e.length;if(4===t)return new h.IPv4(e);if(16===t)return new h.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(e){return h.IPv6.isValid(e)||h.IPv4.isValid(e)},h.isValidCIDR=function(e){return h.IPv6.isValidCIDR(e)||h.IPv4.isValidCIDR(e)},h.parse=function(e){if(h.IPv6.isValid(e))return h.IPv6.parse(e);if(h.IPv4.isValid(e))return h.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(e){try{return h.IPv6.parseCIDR(e)}catch(t){try{return h.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},h.subnetMatch=function(e,t,n){let r,o,i,a;for(o in null==n&&(n="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,o))for(i=t[o],!i[0]||i[0]instanceof Array||(i=[i]),r=0;r<i.length;r++)if(a=i[r],e.kind()===a[0].kind()&&e.match.apply(e,a))return o;return n},e.exports?e.exports=h:t.ipaddr=h}(YS)),JS.exports;var e}();Math.floor,String.fromCharCode;new Map([[RS.CNAME,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"],[RS.Url,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"]]),new Set([RS.BASE,RS.BSC,RS.ETH,RS.Injective]),new Set([RS.BASE,RS.BSC,RS.ETH]),new Set([RS.ARWV,RS.Backpack,RS.BTC,RS.CNAME,RS.Discord,RS.DOGE,RS.Email,RS.Github,RS.IPFS,RS.IPNS,RS.LTC,RS.Pic,RS.POINT,RS.Reddit,RS.SHDW,RS.Telegram,RS.Twitter,RS.TXT,RS.Url]),new Set([RS.BASE,RS.BSC,RS.ETH,RS.Injective,RS.SOL]);new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]],["6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",[135,149,81,2,24,83,238,199,167,220,130,117,120,232,230,157,167,228,250,129,72,51,154,160,211,213,41,100,5,190,75,26]]]);var QS;!function(e){e[e.None=0]="None",e[e.Solana=1]="Solana",e[e.Ethereum=2]="Ethereum",e[e.UnverifiedSolana=3]="UnverifiedSolana"}(QS||(QS={}));const XS=e=>{switch(e){case QS.None:return 0;case QS.Ethereum:return 20;case QS.Solana:case QS.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class eE{stalenessValidation;rightOfAssociationValidation;contentLength;static LEN=8;static schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new eE(Yb(this.schema,e,!0))}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new Error("Record header account not found");return this.deserialize(n.data.slice(96,96+this.LEN))}}class tE{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=eE.deserialize(e.slice(96,96+eE.LEN));return new tE(t,e.slice(96+eE.LEN))}static async retrieve(e,t){const n=await dh(e,t);if(!n.exists)throw new aS("Record account not found");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await fh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}getContent(){const e=XS(this.header.stalenessValidation)+XS(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){const e=XS(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=XS(this.header.stalenessValidation),t=e+XS(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}const nE=57896044618658097711785492504343953926634992332820282019728792003956564819949n,rE=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function oE(e){const t=e%nE;return t>=0n?t:nE+t}function iE(e,t){let n=e;for(;t-- >0n;)n*=n,n%=nE;return n}function aE(e,t){const n=oE(e*e),r=function(e,t){const n=oE(t*t*t),r=function(e){const t=e*e%nE*e%nE,n=iE(t,2n)*t%nE,r=iE(n,1n)*e%nE,o=iE(r,5n)*r%nE,i=iE(o,10n)*o%nE,a=iE(i,20n)*i%nE,s=iE(a,40n)*a%nE,c=iE(s,80n)*s%nE,u=iE(c,80n)*s%nE,l=iE(u,10n)*o%nE;return iE(l,2n)*e%nE}(e*oE(n*n*t));let o=oE(e*n*r);const i=oE(t*o*o),a=o,s=oE(o*rE),c=i===e,u=i===oE(-e),l=i===oE(-e*rE);return c&&(o=a),(u||l)&&(o=s),1n==(1n&oE(o))&&(o=oE(-o)),c||u?o:null}(oE(n-1n),oE(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}const sE=async(e,t,n={allowPda:!1})=>{const{address:r}=await NS(t),o=await TS.getAddress(r),i=await(async(e,t)=>{const{address:n}=await NS(t+"."+e,PS.V1);return n})(t,RS.SOL),a=await(async(e,t)=>{const{address:n}=await NS(e);return await ES(`${t}`,n,SS)})(t,RS.SOL),[s,c,u,l]=await fh(e,[r,o,i,a]);if(!s.exists)throw new hS(`Domain ${t} does not exist`);const d=wS.deserialize(s.data);if(c.exists&&TS.deserialize(c.data).tag===kS.ActiveRecord){const t=await xS(e,r);if(!t)throw new gS;return t}e:if(l.exists){const e=tE.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new pS("Record is malformed");if(e.header.rightOfAssociationValidation!==QS.Solana||e.header.stalenessValidation!==QS.Solana)throw new mS;if(d.owner!==Xb.decode(t))break e;if(((e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])))(n,r))return Xb.decode(r);throw new lS(`The RoA ID shoudl be ${Xb.decode(r)} but is ${Xb.decode(n)} `)}if(u.exists){const e=new Uint8Array([...u.data.slice(wS.HEADER_LEN,wS.HEADER_LEN+32),...Xb.encode(i)]),t=u.data.slice(wS.HEADER_LEN+32,wS.HEADER_LEN+32+64),n=await(async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=ic().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!0,["verify"])}(n),o=tS.encode((e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""))(e));return await crypto.subtle.verify({name:"Ed25519"},r,t,o)})({data:e,signature:t,address:d.owner});if(n)return Xb.decode(u.data.slice(wS.HEADER_LEN,wS.HEADER_LEN+32))}if(!function(e){const t=Xb.encode(e);if(32!==t.byteLength)return!1;return aE(function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(t),t[31])}(d.owner)){if("any"===n.allowPda)return d.owner;if(n.allowPda){const t=await dh(e,d.owner);if(!t.exists)throw new fS("Invalid domain owner account");const r=n.programIds?.some((e=>t.programAddress===e));if(r)return d.owner;throw new fS(`The program ${t.programAddress} is not allowed`)}throw new fS}return d.owner};new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked");const cE=new Error("request for lock canceled");var uE=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};class lE{constructor(e,t=cE){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((n,r)=>{const o={resolve:n,reject:r,weight:e,priority:t},i=dE(this._queue,(e=>t<=e.priority));-1===i&&e<=this._value?this._dispatchItem(o):this._queue.splice(i+1,0,o)}))}runExclusive(e){return uE(this,arguments,void 0,(function*(e,t=1,n=0){const[r,o]=yield this.acquire(t,n);try{return yield e(r)}finally{o()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const n=dE(e,(e=>t.priority<=e.priority));e.splice(n+1,0,t)}(this._weightedWaiters[e-1],{resolve:n,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const n=this._weightedWaiters[t-1];if(!n)continue;const r=n.findIndex((t=>t.priority<=e));(-1===r?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function dE(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var fE=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};class hE{constructor(e){this._semaphore=new lE(1,e)}acquire(){return fE(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class pE{#Me=new hE;#Oe=new hE;#ze=0;#Ue=null;async#je(){this.#Oe.isLocked()||(this.#Ue=await this.#Oe.acquire())}async wrapRegularStateOperation(e){await Promise.all([this.#Me.waitForUnlock(),this.#je()]);try{return this.#ze+=1,await e()}finally{this.#ze-=1,0===this.#ze&&this.#Ue&&this.#Ue()}}async wrapManageStateOperation(e){return await this.#Oe.waitForUnlock(),await this.#Me.runExclusive(e)}}function gE(e){return e.includes("swift:0/iso4217:")}var mE=function(e){return e.Benign="Benign",e.Warning="Warning",e.Malicious="Malicious",e}({}),yE=function(e){return e.SUCCESS="SUCCESS",e.ERROR="ERROR",e}({});const wE=new cw,vE=new class{#i;#Le=new Map;constructor(e){this.#i=Jl(e,"[⚡ EventEmitter]")}on(e,t){this.#i.info(`Adding listener for event ${e}`),this.#Le.has(e)||this.#Le.set(e,new Set),this.#Le.get(e)?.add(t)}off(e,t){this.#i.info(`Removing listener for event ${e}`);const n=this.#Le.get(e);n&&(n.delete(t),0===n.size&&this.#Le.delete(e))}async emitSync(e,t){this.#i.info(`Emitting event ${e}`);const n=this.#Le.get(e);if(n){const e=Array.from(n).map((async e=>await e(t)));await Promise.allSettled(e)}}removeAllListeners(e){e?(this.#i.info(`Removing all listeners for event ${e}`),this.#Le.delete(e)):(this.#i.info("Removing all listeners for all events"),this.#Le.clear())}listenerCount(e){const t=this.#Le.get(e);return t?t.size:0}eventNames(){return Array.from(this.#Le.keys())}}(Yl),AE=new class{#De=new pE;#E;constructor(e,t){this.#E=t,e.on("onStart",this.#Fe.bind(this)),e.on("onUpdate",this.#Fe.bind(this)),e.on("onInstall",this.#Fe.bind(this))}async#Fe(){await this.update((e=>(0,Pd.omit)(e,["assets"])))}async#$e(){const e=await snap.request({method:"snap_getState",params:{encrypted:this.#E.encrypted}}),t=Wy(e??{});var n,r;return n=this.#E.defaultState,r=t,{...n,...Object.fromEntries(Object.entries(r).filter((([e,t])=>null!=t&&(!t||"object"!=typeof t||Object.keys(t).length>0))))}}async get(){return this.#De.wrapRegularStateOperation((async()=>this.#$e()))}async getKey(e){return this.#De.wrapRegularStateOperation((async()=>{const t=await snap.request({method:"snap_getState",params:{key:e,encrypted:this.#E.encrypted}});if(null!==t)return Wy(t)}))}async setKey(e,t){await this.#De.wrapRegularStateOperation((async()=>{await snap.request({method:"snap_setState",params:{key:e,value:qy(t),encrypted:this.#E.encrypted}})}))}async update(e){return await this.#De.wrapManageStateOperation((async()=>{const t=await this.#$e(),n=e(t);return await snap.request({method:"snap_manageState",params:{operation:"update",newState:qy(n),encrypted:this.#E.encrypted}}),n}))}async deleteKey(e){return this.setKey(e,void 0)}async deleteKeys(e){await this.update((t=>(e.forEach((e=>{(0,Pd.unset)(t,e)})),t)))}}(vE,{encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},tokenPrices:{},subscriptions:{},webSocketConnections:{closeWebSocketConnectionsBackgroundEventId:null}}}),bE=new class{#We;prefix;logger;constructor(e,t=console,n="__cache__default"){this.#We=e,this.logger=t,this.prefix=n}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#qe(n),await this.#We.setKey(`${this.prefix}.${e}`,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}#qe(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){await this.#We.setKey(this.prefix,{})}async has(e){return void 0!==await this.get(e)}async keys(){const e=await this.#We.getKey(this.prefix);return Object.keys(e??{})}async size(){const e=await this.#We.getKey(this.prefix);return Object.keys(e??{}).length}async peek(e){const t=await this.#We.getKey(this.prefix),n=t?.[e];return n?.value}async mget(e){const t=await this.#We.getKey(this.prefix),n=Object.entries(t??{}).filter((([t])=>e.includes(t))),r=n.filter((([e,t])=>t&&t.expiresAt<Date.now()));return await this.mdelete(r.map((([e])=>e))),n.reduce(((e,[t,n])=>void 0===n?(this.logger.info(`[StateCache] ❌ Cache miss for key "${t}"`),e):(n.expiresAt<Date.now()?(this.logger.info(`[StateCache] ⌛ Cache expired for key "${t}"`),e[t]=void 0):(this.logger.info(`[StateCache] 🎉 Cache hit for key "${t}"`),e[t]=n.value),e)),{})}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#qe(e)})),await this.#We.update((t=>{const n=t[this.prefix]??{};return e.forEach((({key:e,value:t,ttlMilliseconds:r})=>{void 0!==t&&(n[e]={value:t,expiresAt:Math.min(Date.now()+(r??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})})),t[this.prefix]=n,t}));else{ti(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){const t={};return await this.#We.update((n=>{const r=n[this.prefix]??{};return e.forEach((e=>{void 0===r[e]?t[e]=!1:(delete r[e],t[e]=!0)})),n[this.prefix]=r,n})),t}}(AE,Yl),SE=new class{#N=new Map;logger;constructor(e){this.logger=Jl(e,"[💾 InMemoryCache]")}#qe(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}#Be(e){return e.expiresAt<Date.now()}async#Ve(){const e=[];for(const[t,n]of this.#N.entries())this.#Be(n)&&e.push(t);await this.mdelete(e)}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#qe(n),this.#N.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){this.#N.clear()}async has(e){const t=this.#N.get(e);return!!t&&(!this.#Be(t)||(this.#N.delete(e),!1))}async keys(){return await this.#Ve(),Array.from(this.#N.keys())}async size(){return await this.#Ve(),this.#N.size}async peek(e){const t=this.#N.get(e);if(t){if(!this.#Be(t))return t.value;this.#N.delete(e)}}async mget(e){await this.#Ve();const t={};for(const n of e){const e=this.#N.get(n);e?(this.logger.info(`🎉 Cache hit for key "${n}"`),t[n]=e.value):(this.logger.info(`❌ Cache miss for key "${n}"`),t[n]=void 0)}return t}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#qe(e)})),e.forEach((({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#N.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}));else{ti(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){return Object.fromEntries(e.map((e=>[e,this.#N.delete(e)])))}}(Zl),EE=new class{#i;constructor(e=Yl){this.#i=Jl(e,"[📣 AnalyticsService]")}async#Ke(e,t){try{this.#i.log(`Tracking event ${e}`),await snap.request({method:"snap_trackEvent",params:{event:{event:e,properties:t}}})}catch(n){this.#i.warn("Error tracking event",{error:n,event:e,properties:t})}}async trackEventTransactionAdded(e,t){await this.#Ke("Transaction Added",{message:"Snap transaction added",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventTransactionApproved(e,t){await this.#Ke("Transaction Approved",{message:"Snap transaction approved",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventTransactionSubmitted(e,t,n){await this.#Ke("Transaction Submitted",{message:"Snap transaction submitted",origin:n.origin,account_type:e.type,chain_id_caip:n.scope})}async trackEventTransactionFinalized(e,t,n){await this.#Ke("Transaction Finalized",{message:"Snap transaction finalized",origin:n.origin,account_type:e.type,chain_id_caip:t.chain,transaction_status:t.status,transaction_type:t.type})}async trackEventTransactionRejected(e,t){await this.#Ke("Transaction Rejected",{message:"Snap transaction rejected",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventSecurityAlertDetected(e,t,n,r,o,i){await this.#Ke("Security Alert Detected",{message:"Snap security alert detected",origin:t,account_type:e.type,chain_id_caip:n,security_alert_response:r,security_alert_reason:o,security_alert_description:i})}async trackEventSecurityScanCompleted(e,t,n,r,o){await this.#Ke("Security Scan Completed",{message:"Snap security scan completed",origin:t,account_type:e.type,chain_id_caip:n,scan_status:r,has_security_alerts:o})}async trackEventWebSocketConnectionClosedNotCleanly(e,t,n){await this.#Ke("WebSocket Connection Closed Not Cleanly",{message:"Snap WebSocket connection closed not cleanly",origin:e,code:t,reason:n})}}(Yl),kE=new class{#_;#N;#Ge={fetchMint:ew.Minute,fetchJsonParsedAccount:ew.Minute};#He=new Map;constructor(e,t){this.#_=e,this.#N=t}#Ze(e){const t=this.#_.getNetworkBy("caip2Id",e),n=Ib(jb(t.rpcUrls));return this.#He.set(e,n),n}getRpc(e){return j(e,vd),this.#He.get(e)??this.#Ze(e)}async fetchJsonParsedAccount(e,t,n){const r=Xl((async(e,t,n)=>async function(e,t,n={}){const{abortSignal:r,...o}=n,{value:i}=await e.getAccountInfo(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r});return i&&"object"==typeof i&&"parsed"in i.data?uh(t,i):ch(t,i)}(this.getRpc(t),oc(e),n)),this.#N,{ttlMilliseconds:this.#Ge.fetchJsonParsedAccount,functionName:"SolanaConnection::fetchJsonParsedAccount"});return r(e,t,n)}async fetchMint(e,t,n){return Xl((async(r,o,i)=>_h(this.getRpc(t),oc(e),n)),this.#N,{ttlMilliseconds:this.#Ge.fetchMint,functionName:"SolanaConnection::fetchMint"})(oc(e),t,n)}async getLatestBlockhash(e){return(await this.getRpc(e).getLatestBlockhash().send()).value}}(wE,SE),TE=new class{#_;constructor(e){this.#_=e}async getAll(){return(await snap.request({method:"snap_getWebSockets"})).map((e=>({...e,network:this.#Je(e.url)})))}async getById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByNetwork(e){return(await this.getAll()).find((t=>t.network===e))??null}async save(e){const{url:t,protocols:n}=e,r=await snap.request({method:"snap_openWebSocket",params:{url:t,...n?{protocols:n}:{}}});return{...e,id:r}}async delete(e){await snap.request({method:"snap_closeWebSocket",params:{id:e}})}#Je(e){const t=this.#_.getNetworkBy("webSocketUrl",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(wE),IE=new class{#Ye;#Qe;#_;#We;#ge;#i;#Xe;#et;#tt=new Map;#nt=new Map;#rt;#ot="webSocketConnections";constructor(e,t,n,r,o,i){const{maxReconnectAttempts:a,reconnectDelayMilliseconds:s,closeConnectionsGracePeriodMilliseconds:c}=n.get().subscriptions;this.#Ye=e,this.#Qe=t,this.#_=n,this.#We=r,this.#ge=o,this.#i=Jl(i,"[🔌 WebSocketConnectionService]"),this.#Xe=a,this.#et=s,this.#rt=c,this.#te()}#te(){const e=this.#it.bind(this),t=this.#at.bind(this),n=this.#ye.bind(this),r=this.#st.bind(this),o=this.#we.bind(this);this.#ge.on("onStart",e),this.#ge.on("onUpdate",e),this.#ge.on("onInstall",e),this.#ge.on("onActive",t),this.#ge.on("onInactive",n),this.#ge.on("onWebSocketEvent",o),this.#ge.on("onListWebSockets",r)}async#it(){this.#i.log("Setting up connections");const{active:e}=await Xy();e?await this.#ct():await this.closeAllConnections()}async#ct(){this.#i.log("Opening connections for active networks");const e=await this.#_.getActiveNetworks();this.#nt.clear(),await Promise.allSettled(e.map((async e=>{await this.openConnection(e)})))}async openConnection(e){this.#i.log(`Opening connection for network ${e}`);const t=this.#_.getNetworkBy("caip2Id",e),{webSocketUrl:n}=t;await this.#Ye.findByNetwork(e)?this.#i.log(`✅ Connection for network ${e} already exists`):await this.#Ye.save({network:e,url:n,protocols:[]})}async closeAllConnections(){this.#i.log("Closing all connections");const e=await this.#Ye.getAll();await Promise.allSettled(e.map(this.#ut.bind(this))),await this.#We.setKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`,null)}async#ut(e){this.#i.log(`Closing connection for network ${e.network}`),await this.#Ye.delete(e.id)}onConnectionRecovery(e,t){const n=this.#tt.get(e)??[];this.#tt.set(e,[...n,t])}async findByNetwork(e){return await this.#Ye.findByNetwork(e)??null}async findById(e){return this.#Ye.getById(e)}async#we(e){if("open"!==e.type&&"close"!==e.type)return;const{id:t,type:n}=e;switch(this.#i.log(`Handling connection event "${n}" for ${t}`,e),n){case"open":await this.#lt(e);break;case"close":await this.#dt(e);break;default:this.#i.warn(`Unknown connection event type: ${n}`)}}async#lt(e){const{id:t}=e,n=await this.#Ye.getById(t);if(!n)return void this.#i.warn(`No connection found with id: ${t}`);this.#i.log(`✅ Connected to ${t}`,e);const{network:r}=n;this.#nt.delete(r);const o=this.#tt.get(r)??[];this.#i.log(`Triggering ${o.length} connection recovery handlers`,r);const i=o.map((async e=>{try{await e(r)}catch(e){this.#i.error("Error in connection recovery handler",e)}}))??[];await Promise.allSettled(i)}async#dt(e){const{wasClean:t,origin:n,code:r,reason:o}=e;if(t)return void this.#i.log("✅ Connection closed cleanly",e);const{networks:i}=this.#_.get(),a=i.find((e=>e.webSocketUrl.startsWith(n)));a?(await this.#Qe.trackEventWebSocketConnectionClosedNotCleanly(n,r,o),await this.#ft(a.caip2Id)):this.#i.warn("No network found for origin",n)}async#ft(e){const t=this.#nt.get(e)??0,n=t+1;if(this.#nt.set(e,n),n>this.#Xe)return void this.#i.error(`❌ Failed to reconnect to ${e} after ${this.#Xe}/${this.#Xe} attempts. Giving up.`);const r=this.#et*Math.pow(2,t);this.#i.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#Xe})`),await new Promise((t=>{setTimeout((()=>{this.openConnection(e).catch((t=>{this.#i.info(`Error opening connection for ${e}`,t)})).finally((()=>t()))}),r)}))}async#st(){const e=await this.#Ye.getAll();this.#i.log("All connections",{connections:e,connectionRecoveryHandlers:this.#tt})}async#at(){this.#i.log("Client became active"),await this.#ht(),await this.#ct()}async#ye(){this.#i.log("Client became inactive"),await this.#ht();const e=Math.floor(this.#rt/1e3),t=await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:`PT${e}S`,request:{method:"closeWebSocketConnections"}}});await this.#We.setKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`,t),this.#i.log(`Scheduled background event to close connections after ${e}s`,t)}async#ht(){try{const e=await this.#We.getKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`);if(!e)return;await snap.request({method:"snap_cancelBackgroundEvent",params:{id:e}}),this.#i.log("🫸 Cancelled background event to close connections",e)}catch(e){this.#i.warn("Failed to cancel background event",e)}finally{await this.#We.setKey(`${this.#ot}.closeWebSocketConnectionsBackgroundEventId`,null)}}}(TE,EE,wE,AE,vE,Yl),xE=new class{#We;#ot="subscriptions";constructor(e){this.#We=e}async getAll(){const e=await this.#We.getKey(`${this.#ot}`);return Object.values(e??{})}async getById(e){return await this.#We.getKey(`${this.#ot}.${e}`)}async save(e){await this.#We.setKey(`${this.#ot}.${e.id}`,e)}async delete(e){await this.#We.deleteKey(`${this.#ot}.${e}`)}async deleteMany(e){const t=e.map((e=>`${this.#ot}.${e}`));await this.#We.deleteKeys(t)}async update(e){await this.#We.setKey(`${this.#ot}.${e.id}`,e)}async findBy(e,t){const n=await this.getAll();if(0!==n.length)return n.find((n=>e in n&&n[e]===t))}async clear(){await this.#We.deleteKey(`${this.#ot}`)}}(AE),_E=new Nv(IE,xE,vE,Yl),CE=new class{#x;constructor(e){this.#x=e}async uiAmountToAmountForMint(e,t,n){const r=await this.#x.fetchMint(e,t);return this.#pt(r,n)}async amountToUiAmountForMint(e,t,n){const r=await this.#x.fetchMint(e,t);return this.#gt(r,n)}#pt(e,t){try{const o=(n=e.data?.extensions,lf(n)?n.value:r?r():null),{decimals:i}=e.data??{},a=o?.find((e=>"InterestBearingConfig"===e.__kind)),s=o?.find((e=>"ScaledUiAmountConfig"===e.__kind));if(!a&&!s)return uu(BigInt(jo(t).multipliedBy(10**i).toFixed(0)));const c=Date.now()/1e3;if(a){return uu(Rg(t,i,Number(c),Number(a.lastUpdateTimestamp),Number(a.initializationTimestamp),a.preUpdateAverageRate,a.currentRate))}if(s){let{multiplier:e}=s;c>=s.newMultiplierEffectiveTimestamp&&(e=s.newMultiplier);return uu(Pg(t,i,e))}throw new Error("Unknown mint extension type")}catch(n){const r=e?.data?.decimals??9;return uu(BigInt(jo(t).multipliedBy(10**r).toFixed(0)))}var n,r}#gt(e,t){try{const n=1000000000n,r=jo(this.#pt(e,n.toString()).toString()).dividedBy(n.toString());return jo(t.toString()).dividedBy(r).toString()}catch(n){const r=e.data?.decimals??9;return jo(t.toString()).dividedBy(10**r).toString()}}}(kE),RE=new _v(kE,Yl),PE=new class{#x;#i;#V=450;#K=10000n;constructor(e,t){this.#x=e,this.#i=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:o}=e,i=oc(t.address),a=BigInt(vm(r).toString()),s=await this.#x.getLatestBlockhash(o),c=lu(Du({version:0}),(e=>Gu(i,e)),(e=>fu(s,e)),(e=>Hu(function(e,t){const n=t?.programAddress??_l,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},o={...e},i=Nl(n);return{accounts:[i(r.source),i(r.destination)],programAddress:n,data:Wl().encode(o)}}({amount:a,destination:n,source:yl(i)}),e)));return Ju([ef({units:this.#V}),of({microLamports:this.#K})],c)}catch(e){throw this.#i.error({error:e},"Error building transaction message"),e}}getComputeUnitLimit(){return this.#V}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#K}}(kE,Yl),NE=new class{#x;#i;constructor(e,t){this.#x=e,this.#i=Jl(t,"[👀 RecipientClassifier]")}async classify(e,t){this.#i.info("Classifying recipient",{recipientAddress:e,network:t});const n=await this.#x.fetchJsonParsedAccount(e,t);try{hh(n)}catch(e){return{type:"SYSTEM"}}const{programAddress:r}=n;if(r===_l)return{type:"SYSTEM"};const o=(0,Pd.get)(n,"data.mint"),i=(0,Pd.get)(n,"data.owner");return(r===Sf||r===Nh)&&o&&i?{type:"TOKEN_ACCOUNT",mint:o}:{type:"UNSUPPORTED"}}}(kE,Yl),BE=new xv(CE,NE,kE,Yl),ME=new class{#o;#i;#a;#s;#N;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=Yl){const{baseUrl:o,chunkSize:i,cacheTtlsMilliseconds:a}=e.get().priceApi;j(o,fd),this.#o=n,this.#i=r,this.#a=o,this.#s=i,this.cacheTtlsMilliseconds=a,this.#N=t}async getFiatExchangeRates(){return Xl(this.#mt.bind(this),this.#N,{functionName:"PriceApiClient:getFiatExchangeRates",ttlMilliseconds:this.cacheTtlsMilliseconds.fiatExchangeRates})()}async#mt(){try{const e=await this.#o(`${this.#a}/v1/exchange-rates/fiat`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){throw this.#i.error(e,"Error fetching fiat exchange rates"),e}}async#yt(e,t="usd"){try{if(j(e,W(Jo)),j(t,Od),0===e.length)return{};const n=[...new Set(e)],r=[];for(let e=0;e<n.length;e+=this.#s)r.push(n.slice(e,e+this.#s));const o=await Promise.all(r.map((async e=>{const n=Rd({baseUrl:this.#a,path:"/v3/spot-prices",queryParams:{vsCurrency:t,assetIds:e.join(","),includeMarketData:"true"}}),r=await this.#o(n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return j(o,Md),o}))),i=o.reduce(((e,t)=>({...e,...t})),{});return await this.#N.mset(e.map((e=>({key:`PriceApiClient:getMultipleSpotPrices:${e}:${t}`,value:i[e],ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),i}catch(e){throw this.#i.error(e,"Error fetching spot prices"),e}}async#wt(e,t="usd"){const n=[...new Set(e)],r="PriceApiClient:getMultipleSpotPrices",o=e=>`${r}:${e}:${t}`,i=await this.#N.mget(n.map(o)),a=(0,Pd.mapKeys)(i,((e,t)=>(e=>{const t=new RegExp(`^${r}:(.+):(.+)$`,"u"),n=e.match(t);if(!n)throw new Error("Invalid cache key");return n})(t)[1])),s=n.filter((e=>void 0===a[e]));if(0===s.length)return a;const c=await this.#yt(s,t);return await this.#N.mset(Object.entries(c).map((([e,t])=>({key:o(e),value:t,ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),{...a,...c}}async getMultipleSpotPrices(e,t="usd"){return this.#wt(e,t)}async#vt(e){j(e,zd);const t=Rd({baseUrl:this.#a,path:"/v3/historical-prices/{assetType}",pathParams:{assetType:e.assetType},encodePathParams:!1,queryParams:{...e.timePeriod&&{timePeriod:e.timePeriod},...e.from&&{from:e.from.toString()},...e.to&&{to:e.to.toString()},...e.vsCurrency&&{vsCurrency:e.vsCurrency}}}),n=await this.#o(t),r=await n.json();return j(r,Ud),r}async getHistoricalPrices(e){return Xl(this.#vt.bind(this),this.#N,{functionName:"PriceApiClient:getHistoricalPrices",ttlMilliseconds:this.cacheTtlsMilliseconds.historicalPrices})(e)}}(wE,SE),OE=new Vd(wE),zE=new class{#o;#i;#a;#N;#Ge;constructor(e,t,n=globalThis.fetch,r=Yl){const{baseUrl:o,cacheTtlsMilliseconds:i}=e.get().nftApi;j(o,fd),this.#o=n,this.#i=r,this.#a=o,this.#Ge=i,this.#N=t}#At(e){return{cursor:e.cursor,error:e.error,items:e.items.map((e=>({chain:e.chain,address:e.address,tokenAddress:e.token_address,tokenId:e.token_id,balance:e.balance,acquiredAt:e.acquired_at,isSpam:e.isSpam,nftToken:this.#bt(e.nft_token)})))}}async#St(e){let t,n=[];do{const r=Rd({baseUrl:this.#a,path:`/users/${e}/solana-tokens`,queryParams:t?{cursor:t}:void 0}),o=await this.#o(r,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),i=await o.json(),a=this.#At(i);n=[...n,...a.items],t=a.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return Xl(this.#St.bind(this),this.#N,{functionName:"NftApiClient:listAddressSolanaNfts",ttlMilliseconds:this.#Ge.listAddressSolanaNfts})(e)}#bt(e){return{address:e.address,tokenId:e.token_id,tokenStandard:e.token_standard,name:e.name,description:e.description,metadata:e.metadata,imageUrl:e.image_url,mediaUrl:e.media_url,externalUrl:e.external_url,attributes:e.attributes.map((e=>({key:e.key,value:e.value}))),tokenAccountAddress:e.token_account_address,creators:e.creators.map((e=>({address:e.address,share:e.share,verified:e.verified}))),collectionName:e.collection_name,collectionSymbol:e.collection_symbol,collectionCount:e.collection_count,collectionImageUrl:e.collection_image_url,onchainCollectionAddress:e.onchain_collection_address,floorPrice:e.floor_price?{asset:{type:e.floor_price.asset.type,name:e.floor_price.asset.name,symbol:e.floor_price.asset.symbol,decimals:e.floor_price.asset.decimals,tokenId:e.floor_price.asset.token_id},amount:{rawAmount:e.floor_price.amount.raw_amount,amount:e.floor_price.amount.amount}}:null,lastSalePrice:e.last_sale_price?{asset:{type:e.last_sale_price.asset.type,name:e.last_sale_price.asset.name,symbol:e.last_sale_price.asset.symbol,decimals:e.last_sale_price.asset.decimals,tokenId:e.last_sale_price.asset.token_id},amount:{rawAmount:e.last_sale_price.amount.raw_amount,amount:e.last_sale_price.amount.amount}}:null,rarity:e.rarity?{ranking:{source:e.rarity.ranking.source,value:e.rarity.ranking.value},metadata:{howrare:{rank:e.rarity.metadata.howrare.rank},moonrank:{rank:e.rarity.metadata.moonrank.rank}}}:null}}async#Et(e){try{const t=Rd({baseUrl:this.#a,path:`/nfts/contracts/solana/${e}/1`}),n=await this.#o(t,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),r=await n.json();return this.#bt(r)}catch(e){return null}}async getNftMetadata(e){return Xl(this.#Et.bind(this),this.#N,{functionName:"NftApiClient:getNftMetadata",ttlMilliseconds:this.#Ge.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map((async e=>this.getNftMetadata(e))))}}(wE,SE),UE=new class{#kt;#i;cacheTtlsMilliseconds;constructor({configProvider:e,priceApiClient:t,logger:n}){this.#kt=t,this.#i=n;const{cacheTtlsMilliseconds:r}=e.get().priceApi;this.cacheTtlsMilliseconds=r}#Tt(e){if(!gE(e))throw new Error("Passed caipAssetType is not a fiat asset");return Qo(e).assetReference.toLowerCase()}async#It(e){const t=e.filter((e=>!gE(e))),[n,r]=await Promise.all([this.#kt.getFiatExchangeRates(),this.#kt.getMultipleSpotPrices(t,"usd")]);return{fiatExchangeRates:n,cryptoPrices:r}}async getMultipleTokenConversions(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.from,e.to])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#It(t),o={};return e.forEach((e=>{const{from:t,to:i}=e;let a,s;if(o[t]||(o[t]={}),gE(t)){const e=n[this.#Tt(t)]?.value;if(!e)return void(o[t][i]=null);a=new jo(1).dividedBy(e)}else a=new jo(r[t]?.price??0);if(gE(i)){const e=n[this.#Tt(i)]?.value;if(!e)return void(o[t][i]=null);s=new jo(1).dividedBy(e)}else s=new jo(r[i]?.price??0);if(a.isZero()||s.isZero())return void(o[t][i]=null);const c=a.dividedBy(s).toString(),u=Date.now();o[t][i]={rate:c,conversionTime:u,expirationTime:u+this.cacheTtlsMilliseconds.historicalPrices}})),o}#xt(e,t){const n=(0,Pd.pick)(e,["marketCap","totalVolume","circulatingSupply","allTimeHigh","allTimeLow","pricePercentChange1h","pricePercentChange1d","pricePercentChange7d","pricePercentChange14d","pricePercentChange30d","pricePercentChange200d","pricePercentChange1y"]),r=e=>null==e?"":new jo(e).dividedBy(t).toString(),o=(e,t)=>null==t?{}:{[e]:t},i={...o("PT1H",n.pricePercentChange1h),...o("P1D",n.pricePercentChange1d),...o("P7D",n.pricePercentChange7d),...o("P14D",n.pricePercentChange14d),...o("P30D",n.pricePercentChange30d),...o("P200D",n.pricePercentChange200d),...o("P1Y",n.pricePercentChange1y)};return{fungible:!0,marketCap:r(n.marketCap),totalVolume:r(n.totalVolume),circulatingSupply:(n.circulatingSupply??0).toString(),allTimeHigh:r(n.allTimeHigh),allTimeLow:r(n.allTimeLow),...Object.keys(i).length>0?{pricePercentChange:i}:{}}}async getMultipleTokensMarketData(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.asset,e.unit])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#It(t),o={};return e.forEach((e=>{const{asset:t,unit:i}=e;if(!r[t])return;let a;if(gE(i)){const e=n[this.#Tt(i)]?.value;if(!e)return;a=new jo(1).dividedBy(e)}else a=new jo(r[i]?.price??0);a.isZero()||(o[t]||(o[t]={}),o[t][i]=this.#xt(r[t],a))})),o}async getHistoricalPrice(e,t){j(e,mt),j(t,mt);const n=Qo(t).assetReference.toLowerCase();j(n,Od);const r=["1d","7d","1m","3m","1y","1000y"].map((async r=>this.#kt.getHistoricalPrices({assetType:e,timePeriod:r,vsCurrency:n}).then((e=>({timePeriod:r,response:e}))).catch((n=>(this.#i.warn(`Error fetching historical prices for ${e} to ${t} with time period ${r}. Returning null object.`,n),{timePeriod:r,response:jd}))))),o=(await Promise.all(r)).reduce(((e,{timePeriod:t,response:n})=>(e[`P${t.toUpperCase()}`]=n.prices.map((e=>[e[0],e[1].toString()])),e)),{}),i=Date.now();return{intervals:o,updateTime:i,expirationTime:i+this.cacheTtlsMilliseconds.historicalPrices}}}({configProvider:wE,priceApiClient:ME,logger:Yl}),jE=new class{#x;#i;tld=".sol";constructor(e,t){this.#x=e,this.#i=t}async resolveDomain(e,t){const n=this.#x.getRpc(e);return sE(n,t)}async resolveAddress(e,t){try{const n=this.#x.getRpc(e);return`${(await(async(e,t)=>{const n=await _S.getAddress("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29",t),r=await _S.retrieve(e,n),[o,i]=await Promise.all([wS.retrieve(e,r.nameAccount),xS(e,r.nameAccount)]),a=i||o.owner,s=o.parentName!==vS,c=[CS(e,r.nameAccount,s?o.parentName:void 0)];s&&c.push(CS(e,o.parentName));const u=(await Promise.all(c)).join(".");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})(n,oc(t))).domainName}.sol`}catch(e){return this.#i.error("Error resolving address",e),null}}}(kE,Yl),LE=new class{#We;constructor(e){this.#We=e}async findByKeyringAccountId(e){return await this.#We.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#We.getKey("assetEntities")??{};return Object.values(e).flat()}async saveMany(e){await this.#We.update((t=>{const n=(0,Pd.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,Pd.cloneDeep)(n.assetEntities[e]??[]),o=r.findIndex((e=>e.assetType===t.assetType&&e.keyringAccountId===t.keyringAccountId));-1===o?r.push(t):r[o]=t,n.assetEntities[e]=r}return n}))}}(AE),DE=new Av({connection:kE,logger:Yl,configProvider:wE,assetsRepository:LE,tokenApiClient:OE,cache:SE,tokenPricesService:UE,nftApiClient:zE}),FE=new class{#We;constructor(e){this.#We=e}async getAll(){const e=await this.#We.getKey("keyringAccounts");return Object.values(e??{})}async findById(e){return await this.#We.getKey(`keyringAccounts.${e}`)??null}async findByAddress(e){return(await this.getAll()).find((t=>t.address===e))??null}async save(e){await this.#We.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#We.deleteKey(`keyringAccounts.${e}`)}}(AE),$E=new class{#_t;constructor(e){this.#_t=e}async getAll(){return this.#_t.getAll()}async getAllSelected(){const[e,t]=await Promise.all([this.#_t.getAll(),Un(snap)]);return e.filter((e=>t.includes(e.id)))}async findById(e){return this.#_t.findById(e)}async findByAddress(e){return this.#_t.findByAddress(e)}async save(e){return this.#_t.save(e)}async delete(e){return this.#_t.delete(e)}}(FE),WE=new class{#We;#ot="transactions";constructor(e){this.#We=e}async getAll(){const e=await this.#We.getKey(this.#ot);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#We.getKey(`${this.#ot}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#We.update((t=>{const n=t[this.#ot];return e.forEach((e=>{const r=e.id,o=e.account,i=n[o]??[],a=i.findIndex((e=>e.id===r));-1!==a&&(i[a]=e);const s=(0,Pd.chain)([...i,e]).uniqBy("id").sortBy((e=>-(e.timestamp??0))).value();t[this.#ot][o]=s})),t}))}}(AE),qE=new class{#W;#Y;#i;constructor(e,t,n){this.#W=e,this.#Y=t,this.#i=n}async mapRpcTransaction(e,t,n,r){try{const{blockTime:o}=e,{id:i,address:a}=t,s=e.transaction.signatures[0];if(!s)throw new Error("Transaction ID is required");const c=Number(o),u=this.#Ct(e);let l=[],d=[],f=[];const h=(u===jt.Failed?this.#Rt.bind(this):this.#Pt.bind(this))({scope:n,transactionData:e});l=h.fees,d=h.from,f=h.to;const{from:p,to:g}=await this.#Nt({scope:n,transactionData:e});let m=[...p,...d],y=[...g,...f];const w=this.#Bt({address:oc(a),status:u,from:m,to:y});w===Lt.Swap&&(m=m.filter((e=>e.address===a)),y=y.filter((e=>e.address===a))),w===Lt.Receive&&(y=y.filter((e=>e.address===a)),l=[]);const v=[...new Set([...m,...y].filter((e=>e.asset?.fungible)).map((e=>e.asset.type)))],A=r??await this.#Y.getAssetsMetadata(v);return m.forEach((e=>{e.asset?.fungible&&A[e.asset.type]&&(e.asset.unit=A[e.asset.type]?.symbol??"UNKNOWN")})),y.forEach((e=>{e.asset?.fungible&&A[e.asset.type]&&(e.asset.unit=A[e.asset.type]?.symbol??"UNKNOWN")})),{id:s,account:i,timestamp:c,chain:n,status:u,type:w,from:m,to:y,fees:l,events:[{status:u,timestamp:c}]}}catch(e){return this.#i.warn(e,"Error mapping transaction"),null}}#Ct(e){return e.meta?.err||e.meta?.status&&"Err"in e.meta.status?jt.Failed:jt.Confirmed}#Bt({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===jt.Failed)return Lt.Unknown;const o=n.filter((t=>t.address===e)),i=r.filter((t=>t.address===e)),a=o.length>0,s=i.length>0,c=n.every((t=>r.some((n=>n.address===e&&!0===t.asset?.fungible&&!0===n.asset?.fungible&&t.asset.type===n.asset.type)))),u=r.every((t=>n.some((n=>n.address===e&&!0===n.asset?.fungible&&!0===t.asset?.fungible&&n.asset.type===t.asset.type))));return c&&u?Lt.Send:a&&s?Lt.Swap:a?Lt.Send:Lt.Receive}#Pt({scope:e,transactionData:t}){const n=this.#Mt({scope:e,transactionData:t}),r=[],o=[],i=new Map(t.meta?.preBalances?.map(((e,t)=>[t,new jo(e.toString())]))??[]),a=new Map(t.meta?.postBalances?.map(((e,t)=>[t,new jo(e.toString())]))??[]),s=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],c=new Set([...Array.from(i.keys()),...Array.from(a.keys())]);for(const n of c){const c=s[n]?.toString();if(!c)continue;const u=i.get(n)??new jo(0),l=a.get(n)??new jo(0),d=0===n?wm(t.meta?.fee??0):new jo(0),f=u.minus(l).dividedBy(new jo(td)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();u.isGreaterThan(l)&&r.push({address:c,asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:h}}),u.isLessThan(l)&&o.push({address:c,asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:h}})}const u=this.#Ot({scope:e,transactionData:t});return u.from.length>0&&r.push(...u.from),u.to.length>0&&o.push(...u.to),{fees:n,from:r,to:o}}#Rt({scope:e,transactionData:t}){const n=this.#Mt({scope:e,transactionData:t}),r=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],o=[],i=[],{instructions:a}=t.transaction.message;a.forEach((t=>{const{accounts:n,data:a,programIdIndex:s}=t;if(r[s]!==_l)return;const[c,u]=n;if(void 0===c||void 0===u)return;const l=r[c],d=r[u];if(!l||!d)return;const f=Dd.decode(a);if(2!==this.#zt(f))return;const h=this.#Ut(f);o.push({address:l,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}}),i.push({address:d,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}})}));return{fees:n,from:this.#jt(o),to:this.#jt(i)}}#Ot({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===_l));return-1===i||n.forEach((n=>{const{accounts:a,data:s,programIdIndex:c}=n;if(c!==i)return;const[u,l]=a;if(void 0===u||void 0===l||u!==l)return;const d=t.transaction.message.accountKeys[u],f=t.transaction.message.accountKeys[l];if(!d||!f||d!==f)return;const h=this.#Ut(Dd.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}}),o.push({address:f,asset:{amount:h.toString(),fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol}})})),{from:r,to:o}}async#Nt({scope:e,transactionData:t}){const n=[],r=[],o=new Map(t.meta?.preTokenBalances?.map((e=>[e.accountIndex,new jo(e.uiTokenAmount.amount)]))??[]),i=new Map(t.meta?.postTokenBalances?.map((e=>[e.accountIndex,new jo(e.uiTokenAmount.amount)]))??[]),a=new Set([...t.meta?.preTokenBalances?.map((e=>e.accountIndex))??[],...t.meta?.postTokenBalances?.map((e=>e.accountIndex))??[]]);for(const s of a){const a=o.get(s)??new jo(0),c=(i.get(s)??new jo(0)).minus(a);if(c.isZero())continue;const u=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??t.meta?.postTokenBalances?.find((e=>e.accountIndex===s));if(!u)continue;const{mint:l,owner:d}=u;if(!d)continue;const f=vv(e,l),h=c.absoluteValue().toString(),p=(await this.#W.amountToUiAmountForMint(l,e,uu(BigInt(h)))).toString();c.isNegative()&&n.push({address:d,asset:{fungible:!0,type:f,unit:"",amount:p}}),c.isPositive()&&r.push({address:d,asset:{fungible:!0,type:f,unit:"",amount:p}})}const s=this.#Lt({scope:e,transactionData:t});return s.from.length>0&&n.push(...s.from),s.to.length>0&&r.push(...s.to),{from:n,to:r}}#Lt({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[];return n.map((e=>tm(e,t))).map(em).filter(this.#Dt.bind(this)).forEach((n=>{const i=(0,Pd.get)(n,"parsed.accounts.authority.address"),a=(0,Pd.get)(n,"parsed.accounts.source.address");if(!i||!a)return;const s=t.transaction.message.accountKeys.indexOf(oc(a)),{mint:c,uiTokenAmount:{decimals:u}={}}=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??{};if(!c||void 0===u)return;const l=n.parsed?.data.amount,d=jo(l).dividedBy(new jo(10).pow(u)).toString(),f=vv(e,c);r.push({address:i,asset:{amount:d,fungible:!0,type:f,unit:""}}),o.push({address:i,asset:{amount:d,fungible:!0,type:f,unit:""}})})),{from:r,to:o}}#Mt({scope:e,transactionData:t}){const n=this.#Ft(t),r=this.#$t(t),o=n.minus(r),i=[{type:"base",asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:r.toString()}}];return o?.isGreaterThan(0)&&i.push({type:"priority",asset:{fungible:!0,type:ud[e].nativeToken.caip19Id,unit:ud[e].nativeToken.symbol,amount:o.toString()}}),i}#Ft(e){return new jo(e.meta?.fee?.toString()??"0").dividedBy(td)}#$t(e){const t=e.transaction.signatures.length;return jo(5e3).dividedBy(td).multipliedBy(t)}#jt(e){return e.reduce(((e,t)=>{const n=e.find((e=>!0===e?.asset?.fungible&&!0===t.asset?.fungible&&e.asset.type===t.asset.type&&e.address===t.address));if(n&&!0===n.asset?.fungible&&!0===t.asset?.fungible){const e=new jo(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e}),[])}#zt(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}#Ut(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return jo(t.toString()).dividedBy(td)}#Dt(e){if("Transfer"!==e.type&&"TransferChecked"!==e.type)return!1;if(!e.parsed)return!1;const{source:t,destination:n,authority:r}=e.parsed.accounts??{};return!!(t&&n&&r)&&t.address===n.address}}(CE,DE,Yl),VE=new class{#Wt;#qt;#Vt;#Y;#x;#i;constructor(e,t,n,r,o,i){this.#Wt=e,this.#qt=t,this.#Vt=n,this.#Y=r,this.#x=o,this.#i=Jl(i,"[💱 TransactionsService]")}async fetchBySignature(e,t,n){const r=await this.#x.getRpc(n).getTransaction(Ec(e),{maxSupportedTransactionVersion:0}).send();return r?this.#qt.mapRpcTransaction(r,t,n):null}async fetchAssetsTransactions(e,t){const n=await this.#Vt.getAll(),r=e.map((e=>e.assetType)),o=await this.#Y.getAssetsMetadata(r),i=await this.#Wt.getAll(),a=(await Promise.all(e.map((async e=>{const{network:t}=e,n="pubkey"in e?e.pubkey:e.address,r=await(async e=>{const{network:t}=e,n="mint"in e?e.mint:e.address,r=i.sort(((e,t)=>(t.timestamp??0)-(e.timestamp??0))).find((e=>e.from.some((e=>vv(t,n)===(0,Pd.get)(e,"asset.type")))||e.to.some((e=>vv(t,n)===(0,Pd.get)(e,"asset.type")))));return r||null})(e),o=r?Ec(r?.id):void 0;return(await this.#x.getRpc(t).getSignaturesForAddress(oc(n),{limit:5,...o?{until:o}:{}}).send()).map((t=>({signatureResponse:{signature:t.signature,blockTime:Number(t.blockTime??0)},asset:e})))})))).flat(),s=t?.limit?a.sort(((e,t)=>(t.signatureResponse.blockTime??0)-(e.signatureResponse.blockTime??0))).slice(0,t.limit):a,c=(await Promise.all(s.map((async e=>{try{const{signatureResponse:t,asset:n}=e;return{transaction:await this.#x.getRpc(n.network).getTransaction(Ec(t.signature),{maxSupportedTransactionVersion:0}).send(),asset:n}}catch(e){return null}})))).filter((e=>null!==e)),u=e=>n.find((t=>t.id===e));return(await Promise.all(c.map((async e=>{const{transaction:t,asset:n}=e;if(!t)return null;const r=u(n.keyringAccountId);return r?this.#qt.mapRpcTransaction(t,r,n.network,o):null})))).filter((e=>null!==e)).filter((e=>{const t=u(e.account);return!!t&&!Rv(e,t)}))}async fetchLatestSignatures(e,t,n){return(await this.#x.getRpc(e).getSignaturesForAddress(t,n).send()).map((({signature:e})=>e))}async findByAccounts(e){return(await Promise.all(e.map((async e=>this.#Wt.findByAccountId(e.id))))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#Wt.saveMany(e);const t=(0,Pd.groupBy)(e,"account");await zn(snap,Pn.AccountTransactionsUpdated,{transactions:t})}}(WE,qE,$E,DE,kE,Yl),KE=new class{#Vt;#Y;#Q;#i;constructor(e,t,n,r){this.#Vt=e,this.#Y=t,this.#Q=n,this.#i=Jl(r,"[🔄 AccountsSynchronizer]")}async synchronize(e){const t=e??await this.#Vt.getAll();this.#i.info("Synchronizing accounts",t);const n=(await Promise.allSettled(t.map((async e=>this.#Y.fetch(e))))).map((e=>"fulfilled"===e.status?e.value:[])).flat();await this.#Y.saveMany(n);const r=await this.#Q.fetchAssetsTransactions(n,{limit:20});await this.#Q.saveMany(r)}}($E,DE,VE,Yl),GE=new class{#Kt;#i;#Qe;constructor(e,t,n){this.#Kt=e,this.#Qe=t,this.#i=n}async scanTransaction({method:e,accountAddress:t,transaction:n,scope:r,origin:o,options:i=["simulation","validation"],account:a}){try{const s=await this.#Kt.scanTransactions({method:e,accountAddress:t,transactions:[n],scope:r,origin:o===nd?"https://metamask.io":o,options:i}),c=this.#Gt(s);if(!c?.status)return this.#i.warn("Invalid scan result received from security alerts API"),a&&await this.#Qe.trackEventSecurityScanCompleted(a,o,r,yE.ERROR,!1),null;if(a){const e=Object.values(yE).includes(c.status)?c.status:yE.ERROR,t=Boolean(c.validation?.type&&c.validation.type!==mE.Benign),n=[this.#Qe.trackEventSecurityScanCompleted(a,o,r,e,t)];if(t){const e=Object.values(mE).includes(c.validation.type)?c.validation.type:mE.Warning;n.push(this.#Qe.trackEventSecurityAlertDetected(a,o,r,e,c.validation.reason??"unknown",this.#Ht(c.validation)))}await Promise.all(n)}if(!c?.estimatedChanges?.assets)return null;const u={...c},l=c.estimatedChanges.assets.map((async(e,t)=>{const{logo:n}=e;if(n)return Av.generateImageComponent(n,16,16,this.#i).then((e=>{e&&u?.estimatedChanges?.assets?.[t]&&(u.estimatedChanges.assets[t].imageSvg=e)})).catch((()=>null))}));return await Promise.all(l??[]),u}catch(e){return this.#i.error(e),a&&await this.#Qe.trackEventSecurityScanCompleted(a,o,r,yE.ERROR,!1),null}}#Ht(e){if(!e?.reason)return"Security alert: Unknown reason";return{unfair_trade:"Unfair trade of assets, without adequate compensation to the owner's account",transfer_farming:"Substantial transfer of the account's assets to untrusted entities",writable_accounts_farming:"Transaction exposes unused writable account, can be utilized in BIT-FLIP attacks patterns",native_ownership_change:"The account transferred ownership of its native SOL to untrusted entities",spl_token_ownership_change:"The account transferred ownership of its SPL tokens to untrusted entities",exposure_farming:"The account delegates ownership, thereby exposing its assets to untrusted spenders",known_attacker:"A known attacker's account is involved in the transaction",invalid_signature:"One of the transactions provided contains non valid signatures, that can lead misleading simulation results",honeypot:"The account invests funds in a token that is part of an orchestrated honeypot scheme",other:"The transaction was marked as malicious for other reason, further details would be described in features field"}[e.reason]??`Security alert: ${e.reason}`}#Gt(e){return e?{status:"SUCCESS"===e.status||"ERROR"===e.status?e.status:"ERROR",estimatedChanges:{assets:e.result?.simulation?.account_summary?.account_assets_diff?.map((e=>({type:e.in?"in":"out",symbol:"symbol"in e.asset?e.asset.symbol:e.asset_type,name:"name"in e.asset?e.asset.name:e.asset_type,logo:"logo"in e.asset?e.asset.logo:null,value:e.in?.value??e.out?.value??null,price:e.in?.usd_price??e.out?.usd_price??null,imageSvg:null})))??[]},validation:{type:e.result?.validation?.result_type??null,reason:e.result?.validation?.reason??null},error:e?.error_details?{type:"type"in e.error_details?e.error_details.type:null,code:"code"in e.error_details?e.error_details.code:null}:null}:null}}(new class{#o;#i;#a;constructor(e,t=globalThis.fetch,n=Yl){const{baseUrl:r}=e.get().securityAlertsApi;this.#o=t,this.#i=n,this.#a=r}async scanTransactions({method:e,accountAddress:t,transactions:n,scope:r,origin:o,options:i}){const a=Fd.from(Dd.decode(t)).toString("base64");this.#i.info("Scanning transaction");return(await this.#o(`${this.#a}/solana/message/scan`,{headers:{"Content-Type":"application/json",accept:"application/json"},method:"POST",body:JSON.stringify({method:e,encoding:"base64",account_address:a,metadata:{url:o},chain:$d[r],transactions:n,options:i})})).json()}}(wE),EE,Yl),HE=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case en.SignAndSendTransaction:case en.SignTransaction:return this.#Zt(e,t);case en.SignMessage:return this.#Jt(e,t);case en.SignIn:return this.#Yt(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#Zt(e,t){j(e.request,re([oy,sy]));const{request:{method:n,params:{transaction:r}},scope:o,account:i,origin:a}=e;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionAdded,params:{accountId:i,metadata:{scope:o,origin:a}}}}});return await jA({...UA,scope:o,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionApproved,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!0):(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionRejected,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!1)}async#Jt(e,t){const n=await async function(e,t){j(e.request,ay);const{request:{params:{message:n}},scope:r,origin:o}=e,i=Gs().encode(n),a=Qs().decode(i),[s,c]=await Promise.all([Yy().then((e=>e.locale)).catch((()=>"en")),jE.resolveAddress(r,t.address)]);return Jy(await Gy(Bv(bA,{message:a,account:t,accountDomain:c,scope:r,locale:s,networkImage:Ov,origin:o}),{}))}(e,t);return Boolean(n)}async#Yt(e,t){const n=await async function(e,t){j(e.request,iy);const{request:{params:n},scope:r,origin:o}=e,[i,a]=await Promise.all([Yy(),jE.resolveAddress(r,t.address)]);return Jy(await Gy(Bv(wA,{params:n,account:t,accountDomain:a,scope:r,preferences:i,networkImage:Ov,origin:o}),{}))}(e,t);return Boolean(n)}},ZE=new class{#Z;#J;#Q;#Qe;#x;#_;#i;#Qt=new Map;#Xt=10*ew.Minute;constructor(e,t,n,r,o,i,a){this.#Z=e,this.#J=t,this.#Q=n,this.#Qe=r,this.#x=o,this.#_=i,this.#i=Jl(a,"[✍️ SignatureMonitor]"),this.#te()}#te(){rw.forEach((e=>{this.#Z.registerNotificationHandler("signatureSubscribe",e,this.#en.bind(this)),this.#Z.registerConnectionRecoveryHandler(e,this.#oe.bind(this))}))}async monitor(e,t,n,r,o){this.#i.info("Monitoring signature",{signature:e,accountId:t,commitment:n,network:r,origin:o});const i={method:"signatureSubscribe",network:r,expiryMilliseconds:this.#Xt,params:[e,{commitment:n,enableReceivedNotification:!1}],metadata:{accountId:t,origin:o}},a=await this.#Z.subscribe(i);this.#Qt.set(a,i)}async#en(e,t){try{const{network:e}=t,n=(0,Pd.get)(t,"params[0]");j(n,ee());const r=(0,Pd.get)(t,"params[1].commitment");j(r,om);const o=t.metadata?.accountId;j(o,ee());const i=t.metadata?.origin;j(i,ee());const a=await this.#J.findById(o);if(!a)throw new Error(`Account not found: ${o}`);const s=await this.#Q.fetchBySignature(n,a,e);if(!s)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(r){case"processed":await this.#Q.save(s),await this.#Qe.trackEventTransactionSubmitted(a,n,{scope:e,origin:i});break;case"confirmed":case"finalized":await this.#Q.save(s),await this.#Qe.trackEventTransactionFinalized(a,s,{scope:e,origin:i});break;default:this.#i.warn(`⚠️ Commitment ${r} not supported`)}}catch(e){this.#i.error("Error handling signature notification",e)}finally{await this.#Z.unsubscribe(t.id),this.#Qt.delete(t.id)}}async#oe(){this.#i.info("Handling connection recovery"),await Promise.all(Array.from(this.#Qt.entries()).map((async([e,t])=>{await this.#tn(t,e)})))}async#tn(e,t){try{const{network:n}=e;j(n,ee());const r=(0,Pd.get)(e,"params[0]");j(r,ee());const o=(0,Pd.get)(e,"params[1].commitment");j(o,om);const i=await this.#nn(r,n);if(!i)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#rn(i,o))return void this.#i.info("Signature did not reach the desired commitment while connection was down. Skipping.");const a={jsonrpc:"2.0",method:"signatureNotification",params:{subscription:1,result:{context:{slot:BigInt(0)},value:{err:null}}}},s={...e,id:t};await this.#en(a,s),this.#Qt.delete(t)}catch(e){this.#i.error("Error handling connection recovery",e)}}async#nn(e,t){const n=await this.#x.getRpc(t).getSignatureStatuses([Ec(e)],{searchTransactionHistory:!0}).send(),r=n.value[0]?.confirmationStatus;if(!r)throw new Error(`Signature ${e} not found via HTTP fetch during connection recovery`);return r}#rn(e,t){return t===e||"processed"===t&&("confirmed"===e||"finalized"===e)||"confirmed"===t&&"finalized"===e}}(_E,$E,VE,EE,kE,wE,Yl),JE=new Pv(_E,$E,DE,VE,KE,CE,wE,Yl),YE=(new class{#Vt;#on;#ge;#i;constructor(e,t,n,r){this.#Vt=e,this.#on=t,this.#ge=n,this.#i=Jl(r,"[🥾 MonitoredAccountsInitializer]"),this.#te()}#te(){this.#ge.on("onActive",this.#in.bind(this))}async#in(){this.#i.info("Starting to monitor the selected accounts");const e=await this.#Vt.getAllSelected();await this.#on.setMonitoredAccounts(e.map((e=>e.id)))}}($E,JE,vE,Yl),new class{#x;#an;#sn;#i;constructor(e,t,n,r=Yl){this.#x=e,this.#an=t,this.#sn=n,this.#i=Jl(r,"[👛 WalletService]")}async resolveAccountAddress(e,t,n){this.#i.log("Resolving account address",{keyringAccounts:e,scope:t,request:n});const{method:r,params:o}=n,i=e.filter((e=>e.scopes.includes(t)));if(0===i.length)throw new Error("No accounts with this scope");let a;switch(r){case en.SignIn:{const{address:e}=o;if(!e)throw new Error("No address");a=e;break}case en.SignAndSendTransaction:case en.SignMessage:case en.SignTransaction:{const{account:e}=o;a=e.address;break}default:throw this.#i.warn({method:r},"Unsupported method"),new Error("Unsupported method")}if(!i.find((e=>e.address===a)))throw new Error("Account not found");return Yv(t,a)}async signTransaction(e,t,n,r,o){this.#i.log("Signing transaction",{account:e,transaction:t,scope:n,options:o});const i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#an.partiallySignBase64String(t,e,n,i),s={signedTransaction:$g(a)};j(s,uy);try{il(a);const t=rl(a);await this.#sn.monitor(t,e.id,"confirmed",n,r)}catch(e){this.#i.warn("Transaction is not fully signed, skipping monitoring",{error:e})}return s}async signAndSendTransaction(e,t,n,r,o){this.#i.log("Signing and sending transaction",e);const i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#an.partiallySignBase64String(t,e,n,i),s=rl(a),c=function({rpc:e}){return async function(t,n){await Lg({...n,rpc:e,transaction:t})}}({rpc:this.#x.getRpc(n)}),u=Zv(n,"tx",s);this.#i.info(`Sending transaction: ${u}`),il(a);const l={...o?.preflightCommitment?{preflightCommitment:o.preflightCommitment}:{},...o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:{},...o?.maxRetries?{maxRetries:BigInt(o.maxRetries)}:{},skipPreflight:o?.skipPreflight??!0,commitment:"confirmed"};await c(a,l),await this.#sn.monitor(s,e.id,o?.commitment??"confirmed",n,r);const d={signature:s};return j(d,cy),d}async signMessage(e,t){this.#i.log("Signing message",e,t);const{address:n,entropySource:r,derivationPath:o}=e,i=oc(n),a=Gs().encode(t),s=function(e,t={}){return Object.freeze({content:"string"==typeof e?(new bl).encode(e):e,signatures:Object.freeze({...t})})}(Qs().decode(a)),{privateKeyBytes:c}=await $y({entropySource:r,derivationPath:o}),u=await ml(c),[l]=await u.signMessages([s]);j(l,Y());const d=l[i];var f;j(d,(f=Uint8Array,ae("instance",(e=>e instanceof f||`Expected a \`${f.name}\` instance, but received: ${P(e)}`))));const h={signature:Ds().decode(d),signedMessage:t,signatureType:"ed25519"};return j(h,ly),h}async signIn(e,t){this.#i.log("Signing in",e,t);const{address:n}=e,r=this.#cn(t),o=Qs().encode(r),i=Gs().decode(o),a={account:{address:n},...await this.signMessage(e,i)};return j(a,dy),a}async verifySignature(e,t,n){this.#i.log("Verifying signature",{account:e,signatureBase58:t,messageBase64:n}),j(t,Sd),j(n,Ed);const r=Fs().encode(t),o=Gs().encode(n),{privateKeyBytes:i}=await $y({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await ml(i);return await kc(a.keyPair.publicKey,r,o)}#cn(e){const{domain:t,address:n,statement:r,uri:o,version:i,chainId:a,nonce:s,issuedAt:c,expirationTime:u,notBefore:l,requestId:d,resources:f}=e;let h=`${t??""} wants you to sign in with your Solana account:\n`;h+=`${n??""}`,r&&(h+=`\n\n${r}`);const p=[];if(o&&p.push(`URI: ${o}`),i&&p.push(`Version: ${i}`),a&&p.push(`Chain ID: ${a}`),s&&p.push(`Nonce: ${s}`),c&&p.push(`Issued At: ${c}`),u&&p.push(`Expiration Time: ${u}`),l&&p.push(`Not Before: ${l}`),d&&p.push(`Request ID: ${d}`),f&&f.length>0){p.push("Resources:");for(const e of f)p.push(`- ${e}`)}return p.length&&(h+=`\n\n${p.join("\n")}`),h}}(kE,RE,ZE,Yl)),QE=new class{#We;#i;#Q;#Y;#un;#ln;#on;#dn="Create Solana Account";constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:o,confirmationHandler:i,keyringAccountMonitor:a}){this.#We=e,this.#i=Jl(t,"[🔑 Keyring]"),this.#Q=n,this.#Y=r,this.#un=o,this.#ln=i,this.#on=a}async listAccounts(){return(await this.#fn()).map(nm)}async#fn(){try{const e=await this.#We.getKey("keyringAccounts")??{};return(0,Pd.sortBy)(Object.values(e),["entropySource","index"])}catch(e){throw this.#i.error({error:e},"Error listing accounts"),new Error("Error listing accounts")}}async getAccount(e){try{mw({accountId:e},hd);const t=await this.#hn(e);return t?nm(t):void 0}catch(e){throw this.#i.error({error:e},"Error getting account"),new Xr(e)}}async getAccountOrThrow(e){const t=await this.#hn(e);if(!t)throw new Error(`Account "${e}" not found`);return t}async#hn(e){try{return await this.#We.getKey(`keyringAccounts.${e}`)}catch(e){throw this.#i.error({error:e},"Error getting account"),new Xr(e)}}#pn(e,t){return function(e){if(0===e.length)return 0;const t=e.map((e=>e.index)).sort(((e,t)=>e-t));let n=0;for(const e of t){if(e!==n)break;n+=1}return n}(e.filter((e=>e.entropySource===t)))}#gn(e){return`m/44'/501'/${e}'/0'`}#mn(e){const t=e.split("/")[3];if(!t)throw new Error("Invalid derivation path");const n=parseInt(t.replace("'",""),10);return j(n,K()),n}async#yn(){const e=(await async function(){return await snap.request({method:"snap_listEntropySources"})}()).find((({primary:e})=>e));if(!e)throw new Error("No default entropy source found - this can never happen");return e.id}async createAccount(e){const t=globalThis.crypto.randomUUID();try{await async function(e){try{return await snap.request({method:"snap_startTrace",params:{name:e}})}catch(e){return null}}(this.#dn);const n=await this.#fn(),r=e?.entropySource??await this.#yn(),o=e?.derivationPath?this.#mn(e.derivationPath):this.#pn(n,r),i=e?.derivationPath?e.derivationPath:this.#gn(o),a=n.find((e=>e.derivationPath===i&&e.entropySource===r));if(a)return this.#i.warn("An account already exists with the same derivation path and entropy source. Skipping account creation."),nm(a);const{publicKeyBytes:s}=await $y({entropySource:r,derivationPath:i}),c=ac().decode(s.slice(1)),{importedAccount:u,accountNameSuggestion:l,metamask:d,...f}=e??{},h={id:t,entropySource:r,derivationPath:i,index:o,type:St.DataAccount,address:c,scopes:[Qt.Mainnet,Qt.Testnet,Qt.Devnet],options:{...f,entropySource:r,derivationPath:i,index:o},methods:[en.SignAndSendTransaction,en.SignTransaction,en.SignMessage,en.SignIn]},p=nm(h);return await this.#We.setKey(`keyringAccounts.${h.id}`,h),await this.emitEvent(Pn.AccountCreated,{account:p,accountNameSuggestion:l??`Solana Account ${o+1}`,displayAccountNameSuggestion:!l,displayConfirmation:!1,...d?{metamask:d}:{}}).catch((async e=>{throw this.#i.warn("Could not inform the client about the account creation. Rolling back the account creation operation.",{error:e}),await this.#wn(t),e})),await async function(e){try{return await snap.request({method:"snap_endTrace",params:{name:e}})}catch(e){return null}}(this.#dn),p}catch(e){throw this.#i.error({error:e},"Error creating account"),new Error(`Error creating account: ${e.message}`)}}async#wn(e){await Promise.all([this.#We.deleteKey(`keyringAccounts.${e}`),this.#We.deleteKey(`transactions.${e}`),this.#We.deleteKey(`assets.${e}`)])}async deleteAccount(e){try{mw({accountId:e},pd),await this.emitEvent(Pn.AccountDeleted,{id:e}),await this.#wn(e)}catch(e){throw this.#i.error({error:e},"Error deleting account"),e}}async listAccountAssets(e){try{mw({accountId:e},gd);const t=await this.getAccountOrThrow(e),n=(await this.#Y.findByAccount(t)).filter((e=>e.assetType.endsWith(sd.SOL)||Number(e.rawAmount)>0)).map((e=>e.assetType));return yw(n,vn),n}catch(e){throw this.#i.error({error:e},"Error listing account assets"),e}}async getAccountBalances(e,t){try{mw({accountId:e,assets:t},md);const n=await this.getAccountOrThrow(e),r=(await this.#Y.findByAccount(n)).filter((e=>t.includes(e.assetType))).filter((e=>e.assetType.endsWith(sd.SOL)||Number(e.rawAmount)>0)).reduce(((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e)),{});return yw(r,wd),r}catch(e){throw this.#i.error({error:e},"Error getting account balances"),e}}async emitEvent(e,t){await zn(snap,e,t)}async filterAccountChains(e,t){throw new Error(`Implement me! ${e} ${t.toString()}`)}async updateAccount(e){throw new Error(`Implement me! ${JSON.stringify(e)}`)}async submitRequest(e){return{pending:!1,result:await this.#vn(e)}}async#vn(e){j(e,ww);const{request:{method:t,params:n},scope:r,account:o,origin:i}=e,a=await this.getAccountOrThrow(o);if(!a.scopes.includes(r))throw new Error(`Scope "${r}" is not allowed for this account`);if(!a.methods.includes(t))throw new Error(`Method "${t}" is not allowed for this account`);if("scope"in n&&r!==n.scope)throw new Error(`Scope "${r}" does not match "${n.scope}" in request.params`);j(r,vd);if(!await this.#ln.handleKeyringRequest(e,a))throw new wo;switch(t){case en.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#un.signAndSendTransaction(a,e,r,i,t)}case en.SignTransaction:{this.#An(a,e);const{transaction:t,options:o}=n;return this.#un.signTransaction(a,t,r,i,o)}case en.SignMessage:{this.#An(a,e);const{message:t}=n;return this.#un.signMessage(a,t)}case en.SignIn:return this.#un.signIn(a,n);default:throw new so(`Unsupported method: ${t}`)}}#An(e,t){const{address:n}=e,{account:r}=t.request.params;try{oc(r.address)}catch{throw new Error("Invalid Solana address format")}if(r.address!==n)throw new Error("The requested account and/or method has not been authorized by the user.")}async listAccountTransactions(e,t){try{mw({accountId:e,pagination:t},yd);const{limit:n,next:r}=t,o=await this.#hn(e);if(!o)throw new Error("Account not found");const i=await this.#Q.findByAccounts([o]),a=r?i.findIndex((e=>e.id===r)):0,s=i.slice(a,a+n),c=a+t.limit<i.length;return{data:s,next:c?i[a+t.limit]?.id??null:null}}catch(e){throw this.#i.error({error:e},"Error listing account transactions"),e}}async resolveAccountAddress(e,t){try{j(e,vd);const{method:n,params:r}=t,o={method:n,params:r};j(o,fy);const i=await this.#fn();return{address:await this.#un.resolveAccountAddress(i,e,o)}}catch(e){return this.#i.error({error:e},"Error resolving account address"),null}}async discoverAccounts(e,t,n){try{j({scopes:e,entropySource:t,groupIndex:n},vw);const r=this.#gn(n),{publicKeyBytes:o}=await $y({entropySource:t,derivationPath:r}),i=ac().decode(o.slice(1)),a=[];for(const t of e)a.push(this.#Q.fetchLatestSignatures(t,i,{limit:1}));const s=await Promise.all(a);return s.some((e=>e.length>0))?[{type:"bip44",scopes:e,derivationPath:r}]:[]}catch(e){throw this.#i.error({error:e},"Error discovering accounts"),e}}async setSelectedAccounts(e){mw(e,W(ld)),await this.#on.setMonitoredAccounts(e)}}({state:AE,transactionsService:VE,logger:Yl,assetsService:DE,walletService:YE,confirmationHandler:HE,keyringAccountMonitor:JE}),XE=new class{#x;#i;constructor(e,t=Yl){this.#x=e,this.#i=t}static isMaybeNonFungible(e){const{tokenAmount:t}=e,{decimals:n}=t;return!1}}(kE,Yl),ek=new class{#x;#bn;#i;#N;#q;#Sn;#En;#Y;#Ge={minimumBalanceForRentExemption:5*ew.Minute};constructor(e,t,n,r,o,i,a,s){this.#x=e,this.#bn=t,this.#N=r,this.#i=Jl(n,"[📬 SendService]"),this.#q=o,this.#Sn=i,this.#En=a,this.#Y=s}async#kn(e){return Xl((async t=>this.#x.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>Uo(e.toString())))),this.#N,{functionName:"SendService:getMinimumBalanceForRentExemption",ttlMilliseconds:this.#Ge.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){this.#i.log("Confirming send transaction",e);const{fromAccountId:t,toAddress:n,amount:r,assetId:o}=e.params,i=await this.#bn.getAccountOrThrow(t),{chainId:a,assetReference:s}=Qo(o),c=a,u=o===ud[c].nativeToken.caip19Id,l=u?this.#Sn:this.#En,d={from:i,to:oc(n),amount:r,network:c,...u?{}:{mint:oc(s)}},f=nl(await l.buildTransactionMessage(d)),h=$g(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:nd,request:{method:en.SignAndSendTransaction,params:{account:{address:i.address},transaction:h,scope:c}}};return this.#i.log("Submitting keyring request",p),this.#bn.submitRequest(p)}async onAddressInput(e,t){if(""===e)return{valid:!1,errors:[{code:Um.Required}]};try{oc(e);if("UNSUPPORTED"===(await this.#q.classify(e,t)).type)throw new Error("Unsupported recipient");return{valid:!0,errors:[]}}catch(e){return{valid:!1,errors:[{code:Um.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e,o=await this.#bn.getAccountOrThrow(n),{chainId:i}=Qo(r),a=i,s=ud[a].nativeToken.caip19Id,c=r===s,u=await this.#Y.findByAccount(o),l=u.find((e=>e.assetType===r)),d=u.find((e=>e.assetType===s));if(!l)throw new Error(`Balance not found for asset ${r} and account ${n}`);if(""===t)return{valid:!1,errors:[{code:Um.Required}]};const f=vm(l.uiAmount??"0"),h=vm(d?.uiAmount??"0"),p=vm(t),g=await this.#kn(a),m=c?this.#Sn:this.#En,y=new Sv(m).getFee(),w=Uo(y.toString());if(h.isZero())return{valid:!1,errors:[{code:Um.InsufficientBalance}]};if(c){if(p.gt(h))return{valid:!1,errors:[{code:Um.InsufficientBalance}]};if(p.plus(w).plus(g).gt(h))return{valid:!1,errors:[{code:Um.InsufficientBalanceToCoverFee}]}}else{if(p.gt(f))return{valid:!1,errors:[{code:Um.InsufficientBalance}]};if(w.plus(g).gt(h))return{valid:!1,errors:[{code:Um.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(kE,QE,Yl,SE,NE,PE,BE,DE),tk=new class{#x;#W;#i;#V=2e4;#K=10000n;constructor(e,t,n){this.#x=e,this.#W=t,this.#i=Jl(n,"[🔐 ApproveTokenService]")}async buildApprovalTransactionMessage(e){this.#i.log("Building token approval transaction",{mint:e.mint,delegate:e.delegate,amount:e.amount,network:e.network});const{account:{entropySource:t,derivationPath:n},mint:r,delegate:o,amount:i,network:a}=e,[s,c,{privateKeyBytes:u}]=await Promise.all([this.#x.fetchMint(r,a),this.#x.getLatestBlockhash(a),$y({entropySource:t,derivationPath:n})]),{programAddress:l}=s,d=await ml(u),f=await this.#W.uiAmountToAmountForMint(r,a,i),h=(await Uf({mint:r,owner:d.address,tokenProgram:l}))[0],p=l===Nh,g=p?Wh:Nf,m=(p?rp:Lf)({ata:h,mint:r,owner:d.address,payer:d,tokenProgram:l}),y=g({source:h,delegate:o,owner:d,amount:f}),w=lu(Du({version:0}),(e=>Gu(d.address,e)),(e=>fu(c,e)),(e=>Hu(m,e)),(e=>Hu(y,e)));return Ju([ef({units:this.#V}),of({microLamports:this.#K})],w)}}(kE,CE,Yl),nk=new class{#Vt;#un;#i;#Tn;#In;constructor(e,t,n,r,o){this.#Vt=e,this.#un=t,this.#i=Jl(n,"[👋 ClientRequestHandler]"),this.#Tn=r,this.#In=o}async handle(e){this.#i.log("Handling client request",e);const{method:t}=e;switch(t){case Am.SignAndSendTransactionWithoutConfirmation:return this.#xn(e);case Am.ConfirmSend:return this.#_n(e);case Am.SignAndSendTransaction:return this.#Cn(e);case Am.ComputeFee:return this.#Rn(e);case Am.OnAddressInput:return this.#Pn(e);case Am.OnAmountInput:return this.#Nn(e);case Am.SignRewardsMessage:return this.#Bn(e);case Am.SignCardMessage:return this.#Mn(e);case Am.ApproveCardAmount:return this.#On(e);default:throw new so}}async#xn(e){try{j(e,hy)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:o}}=e,i=await this.#Vt.findByAddress(r);if(!i)throw new oo(`Account not found: ${r}`);return this.#un.signAndSendTransaction(i,t,o,nd,n)}async#Cn(e){try{j(e,gy)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:o}}=e,i=await this.#Vt.findById(r);if(!i)throw new oo(`Account not found: ${r}`);const{signature:a}=await this.#un.signAndSendTransaction(i,t,o,nd,n),s={transactionId:a};return j(s,my),s}async#_n(e){try{j(e,wy)}catch(e){const t=new oo;throw t.cause=e,t}return await this.#Tn.confirmSend(e)}async#Rn(e){try{j(e,zy)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,{baseFee:r,priorityFee:o}=ym.calculateFee(t),i=ud[n].nativeToken.symbol,a=ud[n].nativeToken.caip19Id,s=[{type:zt.Base,asset:{unit:i,type:a,amount:wm(r).toString(),fungible:!0}},{type:zt.Priority,asset:{unit:i,type:a,amount:wm(o).toString(),fungible:!0}}];return j(s,Uy),s}async#Pn(e){let t;try{t=L(e,Ay)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{value:n,scope:r}}=t,o=await this.#Tn.onAddressInput(n,r);return j(o,My),o}async#Nn(e){try{j(e,Sy)}catch(e){const t=new oo;throw t.cause=e,t}const t=await this.#Tn.onAmountInput(e);return j(t,My),t}async#Bn(e){j(e,Iy);const{params:{accountId:t,message:n}}=e,r=await this.#Vt.findById(t);if(!r)throw new oo(`Account not found: ${t}`);const{address:o}=Ey(n);if(o!==r.address)throw new oo(`Address in rewards message (${o}) does not match signing account address (${r.address})`);return await this.#un.signMessage(r,n)}async#Mn(e){try{j(e,Ry)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{accountId:t,message:n}}=e,r=await this.#Vt.findById(t);if(!r)throw new oo(`Account not found: ${t}`);const{address:o}=xy(n);if(o!==r.address)throw new oo(`Address in card message (${o}) does not match signing account address (${r.address})`);return await this.#un.signMessage(r,n)}async#On(e){try{j(e,Ny)}catch(e){const t=new oo;throw t.cause=e,t}const{params:{accountId:t,amount:n,mint:r,delegate:o,scope:i}}=e,a=await this.#Vt.findById(t);if(!a)throw new oo(`Account not found: ${t}`);const s=i,c=nl(await this.#In.buildApprovalTransactionMessage({account:a,mint:oc(r),delegate:oc(o),amount:n,network:s})),u=$g(c),{signature:l}=await this.#un.signAndSendTransaction(a,u,s,nd),d={signature:l};return j(d,By),d}}($E,YE,Yl,ek,tk),rk={configProvider:wE,connection:kE,keyring:QE,priceApiClient:ME,state:AE,cache:bE,assetsService:DE,tokenPricesService:UE,signer:RE,transactionsService:VE,sendSolBuilder:PE,sendSplTokenBuilder:BE,walletService:YE,transactionScanService:GE,analyticsService:EE,confirmationHandler:HE,nftService:XE,clientRequestHandler:nk,webSocketConnectionService:IE,subscriptionService:_E,eventEmitter:vE,nameResolutionService:jE,accountsService:$E,accountsSynchronizer:KE,tokenHelper:CE},ok=Y({id:ee(),jsonrpc:G("2.0"),method:G(LA.OnTransactionAdded),params:Y({accountId:ld,metadata:Y({scope:vd,origin:ee()})})}),ik=Y({id:ee(),jsonrpc:G("2.0"),method:G(LA.OnTransactionApproved),params:Y({accountId:ld,metadata:Y({scope:vd,origin:ee()})})}),ak=Y({id:ee(),jsonrpc:G("2.0"),method:G(LA.OnTransactionRejected),params:Y({accountId:ld,metadata:Y({scope:vd,origin:ee()})})}),sk=Uv("Form"),ck=Uv("Field"),uk=Uv("AccountSelector"),lk=Uv("AssetSelector"),dk=({title:e,backButtonName:t})=>Mv(Lv,{direction:"horizontal",alignment:"space-between",center:!0,children:[t?Bv(Gv,{name:t,children:Bv(dA,{name:"arrow-left",color:"primary",size:"md"})}):null,Bv(Dv,{size:"sm",children:e}),Mv(Lv,{direction:"horizontal",children:[Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null})]})]}),fk=Uv("Input");var hk=function(e){return e.Form="send-form",e.DestinationAccountInput="send-to",e.BackButton="send-back-button",e.SourceAccountSelector="send-account-selector",e.AmountInput="send-amount-input",e.AssetSelector="send-asset-selector",e.SwapCurrencyButton="send-swap-currency",e.MaxAmountButton="send-amount-input-max",e.CancelButton="send-cancel-button",e.SendButton="send-submit-button",e.ClearButton="send-clear-button",e.CloseButton="send-close-button",e}({}),pk=function(e){return e.TOKEN="TOKEN",e.FIAT="USD",e}({});const gk=({name:e,value:t,tokenSymbol:n,currency:r,currencyType:o,locale:i,swapCurrencyButtonDisabled:a=!1})=>{const s=tA(i),c=o===pk.FIAT?r.toUpperCase():n;return Mv(ck,{label:s("send.amountField"),children:[Bv(fk,{name:e,type:"number",min:0,placeholder:"0",step:.01,value:t??void 0}),Mv(Lv,{direction:"horizontal",center:!0,children:[Bv(Lv,{direction:"vertical",alignment:"center",children:Bv(Fv,{size:"sm",children:c})}),Bv(Gv,{name:hk.SwapCurrencyButton,disabled:a,children:Bv(dA,{name:"swap-vertical",color:a?"muted":"primary",size:"md"})})]})]})},mk={initial:null,fetching:"default",fetched:"success",error:null},yk=({name:e,value:t,error:n,locale:r,showClearButton:o,disabled:i,domainResolutionStatus:a})=>{const s=tA(r);return Mv(Lv,{children:[Mv(ck,{label:s("send.toField"),error:n,children:[Bv(fk,{name:e,placeholder:i?"":s("send.toPlaceholder"),value:t??void 0,disabled:i}),o?Bv(Lv,{children:Bv(Gv,{name:hk.ClearButton,children:Bv(dA,{name:lA.Close,color:"primary"})})}):null]}),a&&null!==mk[a]&&Bv(Fv,{size:"sm",color:mk[a],children:s(`send.toDomainResolutionStatus.${a}`)})]})},wk=e=>{const{amount:t,tokenPrices:n,tokenCaipId:r,currencyType:o}=e,i=n?.[r]?.price;if(o===pk.TOKEN)return t;if(void 0===i)throw new Error("Token price is undefined, cannot convert to fiat amount.");return null===t?null:jo(t).dividedBy(jo(i)).toString()},vk=e=>{const{selectedTokenMetadata:t}=e;return{...t??{},tokenSymbol:t?.symbol??"UNKNOWN",tokenImage:t?.imageSvg??mv}},Ak=e=>{const{tokenCaipId:t,tokenPrices:n}=e;return n?.[t]?.price},bk=e=>{const{balances:t,fromAccountId:n,tokenCaipId:r}=e;return t?.[n]?.[r]?.amount??"0"},Sk=e=>{const{tokenCaipId:t,scope:n}=e;return t===ud[n]?.nativeToken?.caip19Id},Ek=Uv("Spinner"),kk=({title:e,subtitle:t,iconSrc:n,isLoading:r})=>Mv(Lv,{alignment:"center",center:!0,children:[Mv(Lv,{direction:"horizontal",center:!0,children:[r?Bv(Ek,{}):null,n&&!r?Bv(Vv,{borderRadius:"full",src:n}):null]}),Bv(Dv,{size:"lg",children:e}),t?Bv(Fv,{color:"muted",children:t}):null]}),Tk=Uv("Value"),Ik=({context:e})=>{const{scope:t,fromAccountId:n,toAddress:r,accounts:o,feeEstimatedInSol:i,preferences:{locale:a,currency:s},transaction:c,feePaidInSol:u,tokenPrices:l,fromDomain:d,toDomain:f}=e,h=tA(a),p=ud[t],g=o.find((e=>e.id===n))?.address,m=Yv(t,g),y=p.name,w=p.nativeToken.symbol,v=l[p.nativeToken.caip19Id]?.price,A=c?u:i,b=A?BA(A,w,a):"",S=void 0===v||null===A?"":sA(MA(A,v),s,a);return Mv(Lv,{children:[Mv($v,{children:[Bv(Wv,{label:h("send.confirmation.from"),children:d?Bv(Jv,{domain:d,scope:t,address:g}):Bv(Hv,{href:Zv(t,"address",g),children:Bv(qv,{address:m,displayName:!0})})}),r?Bv(Wv,{label:h("send.confirmation.recipient"),children:f?Bv(Jv,{domain:f,scope:t,address:r}):Bv(Hv,{href:Zv(t,"address",r),children:Bv(qv,{address:Yv(t,r),displayName:!0})})}):null]}),Mv($v,{children:[Bv(Wv,{label:h("send.confirmation.network"),children:Bv(Fv,{children:y})}),Bv(Wv,{label:h("send.confirmation.transactionSpeed"),children:Bv(Fv,{children:"<1s"})}),Bv(Wv,{label:h("send.confirmation.fee"),children:Bv(Tk,{extra:S,value:b})})]})]})};var xk=function(e){return e.BackButton="transaction-confirmation-back-button",e.CancelButton="transaction-confirmation-cancel-button",e.ConfirmButton="transaction-confirmation-submit-button",e}({});const _k={"send-form":({context:e,inputToAddress:t,inputAmount:n})=>{const{accounts:r,fromAccountId:o,amount:i,destinationAddressOrDomain:a,domainResolutionStatus:s,validation:c,currencyType:u,tokenCaipId:l,scope:d,balances:f,tokenPricesFetchStatus:h,buildingTransaction:p,error:g,loading:m,transactionMessage:y,preferences:{locale:w,currency:v}}=e,A=tA(w),b=f[o]?.[l],S=b?.amount,E=b?.unit??"",k=void 0!==S,T=r.find((e=>e.id===o)),I=T?.address?Yv(d,T.address):void 0,x=Ak(e),_=void 0===S||"0"===S,C=void 0===x,R="error"===h||"fetched"===h&&C,P=(k?{[pk.FIAT]:sA(MA(S,x??0),v,w),[pk.TOKEN]:BA(S,E,w)}:{[pk.FIAT]:"",[pk.TOKEN]:""})[u],N=o.length>0&&!!a&&a.length>0&&Sm(c?.[hk.DestinationAccountInput]),B=!Sm(y)&&""!==y,M=Boolean(a&&a.length>0),O=Boolean(c?.[hk.AmountInput]?.message),z=O?c?.[hk.AmountInput]?.message??"":`${A("send.balance")}: ${P}`,U=o.length>0&&!!i&&i.length>0&&!!a&&a.length>0&&Object.values(c).every(Sm)&&k&&!p&&B;return Mv(jv,{backgroundColor:"alternative",children:[Mv(Lv,{children:[Bv(dk,{title:A("send.title"),backButtonName:hk.BackButton}),Mv(sk,{name:hk.Form,children:[R&&Bv(_A,{title:"",severity:"info",children:Bv(Fv,{children:A("send.selectedTokenPriceNotAvailable",{currency:v})})}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(ck,{label:A("send.fromField"),error:c?.[hk.SourceAccountSelector]?.message??"",children:Bv(uk,{name:hk.SourceAccountSelector,chainIds:[d],value:I??void 0,hideExternalAccounts:!0,switchGlobalAccount:!0})}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(yk,{locale:w,disabled:m,name:hk.DestinationAccountInput,value:t??null,showClearButton:M,domainResolutionStatus:s,error:c?.[hk.DestinationAccountInput]?.message??""}),N&&Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(Lv,{children:null}),Bv(Lv,{children:null}),Mv(Lv,{direction:"horizontal",children:[Bv(ck,{label:A("send.assetField"),children:Bv(lk,{chainIds:[d],value:l,name:hk.AssetSelector,addresses:I?[I]:[]})}),Bv(gk,{name:hk.AmountInput,currencyType:u,tokenSymbol:E,currency:v,value:n??null,locale:w,swapCurrencyButtonDisabled:C||_})]}),Mv(Lv,{direction:"horizontal",alignment:"space-between",crossAlignment:"start",children:[Bv(Lv,{direction:"vertical",alignment:"start",children:Bv(Fv,{size:"sm",color:O?"error":"muted",children:z})}),Bv(Gv,{size:"sm",name:hk.MaxAmountButton,disabled:_,children:A("send.maxButton")})]})]}),g&&Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(_A,{title:A(g.title),severity:"warning",children:Bv(Fv,{children:A(g.message)})})]})]})]}),Mv(Kv,{children:[Bv(Gv,{name:hk.CancelButton,children:A("send.cancelButton")}),Bv(Gv,{name:hk.SendButton,disabled:!U,loading:p,children:A("send.continueButton")})]})]})},"transaction-confirmation":({context:e})=>{const{preferences:{currency:t,locale:n}}=e,r=tA(n),{tokenImage:o,tokenSymbol:i}=vk(e),a=wk(e),s=Ak(e),c=void 0===s?"":sA(MA(a??"0",s),t,n);return Mv(jv,{children:[Mv(Lv,{children:[Bv(dk,{title:r("send.confirmation.title"),backButtonName:"transaction-confirmation-back-button"}),Bv(kk,{title:BA(a??"0",i,n),subtitle:c,iconSrc:o}),Bv(Ik,{context:e})]}),Mv(Kv,{children:[Bv(Gv,{name:"transaction-confirmation-cancel-button",children:r("send.confirmation.cancelButton")}),Bv(Gv,{name:"transaction-confirmation-submit-button",loading:e.loading,disabled:e.loading,children:r("send.confirmation.sendButton")})]})]})},"send-pending":({context:e})=>{const t=tA(e.preferences.locale);return Bv(jv,{children:Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(kk,{title:t("send.send-pending.title"),subtitle:t("send.send-pending.subtitle"),isLoading:!0}),Bv(Ik,{context:e})]})})},"transaction-success":({context:e})=>{const{preferences:t,transaction:n,scope:r}=e,o=tA(t.locale),{tokenSymbol:i}=vk(e),a=wk(e);return Bv(jv,{children:Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(kk,{title:o("send.transaction-success.title"),subtitle:o("send.transaction-success.subtitle",{amount:aA(a??"0",t.locale),tokenSymbol:i}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.0002 3.99902C12.9802 3.99902 4.00024 12.979 4.00024 23.999C4.00024 35.019 12.9802 43.999 24.0002 43.999C35.0202 43.999 44.0002 35.019 44.0002 23.999C44.0002 12.979 35.0202 3.99902 24.0002 3.99902ZM33.5602 19.399L22.2202 30.739C21.9402 31.019 21.5602 31.179 21.1602 31.179C20.7602 31.179 20.3802 31.019 20.1002 30.739L14.4402 25.079C13.8602 24.499 13.8602 23.539 14.4402 22.959C15.0202 22.379 15.9802 22.379 16.5602 22.959L21.1602 27.559L31.4402 17.279C32.0202 16.699 32.9802 16.699 33.5602 17.279C34.1402 17.859 34.1402 18.799 33.5602 19.399Z" fill="#1C8234"/>\n</svg>\n'}),Bv(Ik,{context:e}),n?.signature?Bv(Lv,{alignment:"center",center:!0,children:Bv(Hv,{href:Zv(r,"tx",n?.signature),children:o("send.confirmation.viewTransaction")})}):null]})})},"transaction-failure":({context:e})=>{const{preferences:t}=e,n=tA(t.locale),{tokenSymbol:r}=vk(e),o=wk(e);return Bv(jv,{children:Mv(Lv,{children:[Bv(Lv,{children:null}),Bv(kk,{title:n("send.transaction-failure.title"),subtitle:n("send.transaction-failure.subtitle",{amount:o??"0",tokenSymbol:r}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M40.8277 29.5283L29.7931 8.40143C28.3104 5.55884 26.2586 4 24 4C21.7414 4 19.6896 5.55884 18.2069 8.40143L7.17228 29.5283C5.77572 32.2241 5.62055 34.81 6.74125 36.8456C7.86194 38.8813 10.0689 40 12.9654 40H35.0346C37.9311 40 40.1381 38.8813 41.2588 36.8456C42.3795 34.81 42.2243 32.2058 40.8277 29.5283ZM22.7069 16.8375C22.7069 16.0856 23.2931 15.462 24 15.462C24.7069 15.462 25.2931 16.0856 25.2931 16.8375V26.0071C25.2931 26.759 24.7069 27.3826 24 27.3826C23.2931 27.3826 22.7069 26.759 22.7069 26.0071V16.8375ZM25.2241 32.811C25.1379 32.8844 25.0517 32.9577 24.9655 33.0311C24.8621 33.1044 24.7586 33.1595 24.6552 33.1961C24.5517 33.2511 24.4483 33.2878 24.3276 33.3062C24.2241 33.3245 24.1034 33.3428 24 33.3428C23.8965 33.3428 23.7759 33.3245 23.6552 33.3062C23.5517 33.2878 23.4483 33.2511 23.3448 33.1961C23.2414 33.1595 23.1379 33.1044 23.0345 33.0311C22.9483 32.9577 22.8621 32.8844 22.7759 32.811C22.4655 32.4626 22.2758 31.9857 22.2758 31.5089C22.2758 31.0321 22.4655 30.5553 22.7759 30.2068C22.8621 30.1335 22.9483 30.0601 23.0345 29.9868C23.1379 29.9134 23.2414 29.8584 23.3448 29.8217C23.4483 29.7667 23.5517 29.73 23.6552 29.7117C23.8793 29.6567 24.1207 29.6567 24.3276 29.7117C24.4483 29.73 24.5517 29.7667 24.6552 29.8217C24.7586 29.8584 24.8621 29.9134 24.9655 29.9868C25.0517 30.0601 25.1379 30.1335 25.2241 30.2068C25.5345 30.5553 25.7241 31.0321 25.7241 31.5089C25.7241 31.9857 25.5345 32.4626 25.2241 32.811Z" fill="#BF5208"/>\n</svg>\n'}),Bv(Ik,{context:e})]})})}},Ck=({context:e,inputToAddress:t,inputAmount:n})=>{const r=e.stage??"send-form";return Bv(_k[r],{context:e,inputToAddress:t,inputAmount:n})};function Rk(e){if(!e)return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.sol$/u.test(e)}function Pk(e,t,n){return n[e]?n[e]?.map((e=>e(t))).find((e=>null!==e))??null:null}function Nk(e){const t=Uk(e),n={[hk.SourceAccountSelector]:e.fromAccountId,[hk.AmountInput]:e.amount,[hk.DestinationAccountInput]:e.toAddress};return Object.entries(t).every((([e,t])=>{const r=n[e];return!!r&&t.every((e=>null===e(r)))}))}const Bk=(e,t)=>{const n=tA(t);return t=>{const r=""===t?{message:n(e),value:t}:null;return r?{message:r.message,value:t}:null}},Mk=(e,t)=>{const n=tA(t);return t=>{try{return Rk(t)||oc(t),null}catch{return{message:n(e),value:t}}}},Ok=e=>{const{minimumBalanceForRentExemptionSol:t,preferences:{locale:n},feeEstimatedInSol:r,selectedTokenMetadata:o}=e,i=tA(n);return n=>{if(""===n)return{message:"",value:n};const a=wk({...e,amount:n}),s=vm(a??"0"),c=bk(e),u=vm(c),l=vm(r??"0"),d=vm(t??"0"),f=(e=>bk({...e,tokenCaipId:ud[e.scope].nativeToken.caip19Id}))(e),h=vm(f),p=Sk(e);if(s.gt(u))return{message:`${i("send.insufficientBalance")}: ${c} ${o?.symbol??""}`,value:n};if(p){if(s.lt(d))return{message:i("send.amountGreatherThanMinimumBalanceForRentExemptionError",{minimumValue:t}),value:n};if(s.plus(l).plus(d).gt(u))return{message:i("send.insuffientSolToCoverFee"),value:n}}else{if(l.plus(d).gt(h))return{message:i("send.insuffientSolToCoverFee"),value:n}}return s.isZero()?{message:"",value:n}:h.isZero()?{message:i("send.insuffientSolToCoverFee"),value:n}:null}},zk=Y({scope:V([...Object.values(rd)]),account:ld,assetId:Q(Jo)}),Uk=e=>({[hk.SourceAccountSelector]:[Bk("send.fromRequiredError",e.preferences.locale)],[hk.AmountInput]:[Ok(e),Bk("send.amountRequiredError",e.preferences.locale)],[hk.DestinationAccountInput]:[Bk("send.toRequiredError",e.preferences.locale),Mk("send.toInvalidError",e.preferences.locale)]}),jk={scope:rd.Mainnet,fromAccountId:"",fromDomain:null,amount:"",destinationAddressOrDomain:null,toDomain:null,toAddress:null,domainResolutionStatus:null,feeEstimatedInSol:"0",feePaidInSol:"0",tokenCaipId:od.SolMainnet,accounts:[],currencyType:pk.TOKEN,validation:{},balances:{},assets:[],tokenPrices:{},selectedTokenMetadata:null,tokenPricesFetchStatus:"initial",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},error:null,buildingTransaction:!1,transactionMessage:null,transaction:null,stage:"send-form",minimumBalanceForRentExemptionSol:"0.002",loading:!0},Lk={[LA.OnTransactionAdded]:async({request:e})=>{try{Yl.info("[onTransactionAdded] Cronjob triggered",e),j(e,ok);const{accountId:t,metadata:n}=e.params,r=await QE.getAccountOrThrow(t);await EE.trackEventTransactionAdded(r,n)}catch(e){throw Yl.error(e),new no(e)}},[LA.OnTransactionApproved]:async({request:e})=>{try{Yl.info("[onTransactionApproved] Cronjob triggered",e),j(e,ik);const{accountId:t,metadata:n}=e.params,r=await QE.getAccountOrThrow(t);await EE.trackEventTransactionApproved(r,n)}catch(e){throw Yl.error(e),new no(e)}},[LA.OnTransactionRejected]:async({request:e})=>{try{Yl.info("[onTransactionRejected] Cronjob triggered",e),j(e,ak);const{accountId:t,metadata:n}=e.params,r=await QE.getAccountOrThrow(t);await EE.trackEventTransactionRejected(r,n)}catch(e){throw Yl.error(e),new no(e)}},[LA.RefreshSend]:async()=>{const e=Jl(Yl,"[refreshSend]");e.info("Background event triggered");const[t,n,r]=await Promise.all([DE.getAll(),AE.getKey("mapInterfaceNameToId"),Yy().catch((()=>jk.preferences))]),o=t.flatMap((e=>e.assetType)),i=n?.[Vy];if(!i)return void e.info("No send form interface found");const a=await Qy(i),s=await ME.getMultipleSpotPrices(o,r.currency);await AE.setKey("tokenPrices",s);const c={...a,tokenPrices:{...a.tokenPrices,...s}};await Hy(i,Bv(Ck,{context:c}),c),e.info("✅ Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}})},[LA.RefreshConfirmationEstimation]:async()=>{const e=Jl(Yl,"[refreshConfirmationEstimation]");e.info("Background event triggered");const t=(await AE.getKey("mapInterfaceNameToId")??{})[Ky];if(!t)return void e.info("No interface context found");const n=await Qy(t);try{if(!(n.account?.address&&n.transaction&&n.scope&&n.method))return void e.info("Context is missing required fields");if(!n.preferences?.simulateOnChainActions)return void e.info("Transaction simulation is disabled in preferences");const r={...n,scanFetchStatus:"fetching"};await Hy(t,Bv(zA,{context:qy(r)}),r);const[o,i]=await Promise.all([GE.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}),Qy(t)]),a={...i,scanFetchStatus:"fetched",scan:o};e.info("New scan fetched"),await Hy(t,Bv(zA,{context:qy(a)}),a),e.info("Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}})}catch(n){const r={...await Qy(t),scanFetchStatus:"fetched"};await Hy(t,Bv(zA,{context:qy(r)}),r),e.warn({error:n},"Could not update the interface. But rolled back status to fetched.")}},[LA.CloseWebSocketConnections]:async()=>{Yl.info("Closing all WebSocket connections via background event"),await IE.closeAllConnections()}},Dk={...Lk};var Fk={};const $k=Y({chainId:vd,domain:Q(ee()),address:Q(ee())}),Wk="Solana Name Service";var qk=function(e){return e.GetGenesisHash="getGenesisHash",e.GetLatestBlockhash="getLatestBlockhash",e.GetMinimumBalanceForRentExemption="getMinimumBalanceForRentExemption",e}({});const Vk=Y({jsonrpc:Rm,id:Pm,method:G("getGenesisHash"),params:Q(W())}),Kk=Y({jsonrpc:Rm,id:Pm,method:G("getLatestBlockhash")}),Gk=Y({jsonrpc:Rm,id:Pm,method:G("getMinimumBalanceForRentExemption"),params:te([J(),Q(Y())])}),Hk={[tw.GetFeeForTransaction]:async({request:e})=>{j(e.params,Ad);const{transaction:t}=e.params;try{const{totalFee:e}=ym.calculateFee(t),n={value:e.toString()};return j(n,bd),n}catch(e){throw Yl.error(e),new no(e)}},[tw.StartSendTransactionFlow]:async({request:e})=>{const{params:t}=e;j(t,zk);const{scope:n,account:r}=t,o=t.assetId??ud[n].nativeToken.caip19Id,i={...jk,scope:n,fromAccountId:r,tokenCaipId:o,loading:!0},[a,s,c,u]=await Promise.all([DE.getAll(),$E.getAll(),AE.getKey("tokenPrices"),Yy().catch((()=>jk.preferences))]);i.balances=function(e,t){return t.filter((t=>{const n=t.assetType===ud[e].nativeToken.caip19Id,r=t.assetType.startsWith(e),o="0"!==t.rawAmount;return n||r&&o})).reduce(((e,t)=>(e[t.keyringAccountId]={...e[t.keyringAccountId],[t.assetType]:{unit:t.symbol,amount:t.uiAmount}},e)),{})}(n,a),i.assets=a.map((e=>e.assetType)),i.accounts=s,i.preferences=u,i.tokenPrices=c??{};const l=await Gy(Bv(Ck,{context:i}),i),d=Jy(l),f=DE.getAssetsMetadata([i.tokenCaipId]).then((e=>{const t=e[i.tokenCaipId];t?.symbol&&t?.name&&(i.selectedTokenMetadata={symbol:t.symbol,name:t.name,asset:i.tokenCaipId,imageSvg:null})})).catch((()=>null));let h;i.preferences.useExternalPricingData?h=ME.getMultipleSpotPrices(i.assets,i.preferences.currency).then((e=>{i.tokenPrices={...i.tokenPrices,...e},i.tokenPricesFetchStatus="fetched"})).catch((()=>{i.tokenPricesFetchStatus="error"})):i.tokenPricesFetchStatus="fetched";const p=kE.getRpc(n).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>{i.minimumBalanceForRentExemptionSol=wm(e).toString()})).catch((()=>{}));return i.loading=!0,await Hy(l,Bv(Ck,{context:i}),i),i.loading=!1,await Promise.all([h,f,p]),await Hy(l,Bv(Ck,{context:i}),i),await AE.setKey(`mapInterfaceNameToId.${Vy}`,l),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}}),d},[nw.ListWebSockets]:async()=>(await vE.emitSync("onListWebSockets"),null),[nw.ListSubscriptions]:async()=>(await vE.emitSync("onListSubscriptions"),null),[nw.TestOnStart]:async()=>(await vE.emitSync("onStart"),null),[nw.TestOnInstall]:async()=>(await vE.emitSync("onInstall"),null),[nw.TestOnUpdate]:async()=>(await vE.emitSync("onUpdate"),null),[nw.SynchronizeAccounts]:async()=>(await KE.synchronize(),null),[nw.SetAccountSelected]:async({request:e})=>(await QE.setSelectedAccounts(e.params.accountIds),null),[nw.ConfirmSend]:async({request:e})=>(await nk.handle(e),null),[nw.SignRewardsMessage]:async({request:e})=>nk.handle({...e,method:Am.SignRewardsMessage})};const Zk=async e=>{try{return await e()}catch(e){const t=function(e){return[Xr,so,wo,co,so,uo,lo,fo,ho,po,go,mo,yo,no,ro,oo,io,ao].some((t=>e instanceof t))}(e)?e:new Xr(e);throw Yl.error({error:t},`[SnapError] ${JSON.stringify(t.toJSON(),null,2)}`),t}};var Jk=n(4255),Yk=n.n(Jk),Qk=n(3804),Xk=n.n(Qk);class eT extends Error{constructor(e="Operation cancelled"){super(e),this.name="CancellationError"}}const tT=async e=>{const{fromAccountId:t,tokenCaipId:n,scope:r,toAddress:o}=e,i=wk(e),a=await QE.getAccountOrThrow(t);if(!o||!i)throw new Error("Invalid transaction parameters");const s=n===ud[r].nativeToken.caip19Id,c=s?PE:BE,u=new Sv(c),l={from:a,to:oc(o),amount:i,network:r,...s?{}:{mint:oc(Qo(n).assetReference)}},d=await c.buildTransactionMessage(l),f=await(async e=>lu(e,Lu,Pu().encode,Ks().decode))(d);return{feeInLamports:u.getFee(),base64EncodedTransactionMessage:f}},nT=Xk()((async(e,t)=>{try{if(!Nk(t))return;const n={buildingTransaction:!0,transactionMessage:null,feeEstimatedInSol:null};await Hy(e,Bv(Ck,{context:{...t,...n}}),{...t,...n});const{feeInLamports:r,base64EncodedTransactionMessage:o}=await tT(t),i={transactionMessage:o,feeEstimatedInSol:r?wm(r).toString():null,buildingTransaction:!1},a=await Qy(e);await Hy(e,Bv(Ck,{context:{...a,...i}}),{...a,...i})}catch(t){Yl.error("Could not build the send transaction",t);const n={error:{title:"send.simulationTitleError",message:"send.simulationMessageError"},transactionMessage:null,feeEstimatedInSol:null,buildingTransaction:!1},r=await Qy(e);await Hy(e,Bv(Ck,{context:{...r,...n}}),{...r,...n})}}),(function(e){const t=(e=>(...t)=>{const n=new AbortController,r=[...t];r.some((e=>e instanceof AbortSignal))||r.push(n.signal);const o=Promise.race([e(...r),new Promise(((e,t)=>{n.signal.addEventListener("abort",(()=>{t(new eT)}))}))]);return o.cancel=()=>n.abort(),o})(e);let n=null;return async(...e)=>{if(n&&"function"==typeof n.cancel){const e="Cancelling previous task";Yl.warn(e),n.cancel()}const r=t(...e);n=r;try{return await r}finally{n===r&&(n=null)}}}),Yk()(500));const rT={[hk.BackButton]:async function({id:e}){await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)},[hk.SourceAccountSelector]:async function({id:e,event:t,context:n}){const r=t.value;n.fromAccountId=r.accountId,n.error=null,n.validation[hk.SourceAccountSelector]=Pk(hk.SourceAccountSelector,n.fromAccountId,Uk(n)),n.amount&&(n.validation[hk.AmountInput]=Pk(hk.AmountInput,n.amount,Uk(n))),await Hy(e,Bv(Ck,{context:n}),n),await nT(e,n)},[hk.AmountInput]:async function({id:e,event:t,context:n}){const r={...n};r.amount=t.value,r.error=null;const o=Pk(hk.AmountInput,r.amount,Uk(r));if(o&&r.validation[hk.AmountInput]?.message!==o?.message)return r.validation[hk.AmountInput]=o,void await Hy(e,Bv(Ck,{context:r}),r);null===o&&(r.validation[hk.AmountInput]=null,await Hy(e,Bv(Ck,{context:r}),r),await nT(e,r))},[hk.AssetSelector]:async function({id:e,event:t,context:n}){if("object"!=typeof t.value||!t.value||!("asset"in t.value))return;const r=t.value.asset;if(n.tokenCaipId===r)return;const o=r===ud[n.scope].nativeToken.caip19Id?PE:BE,i=new Sv(o).getFee(),a={tokenCaipId:r,feeEstimatedInSol:wm(i).toString(),selectedTokenMetadata:{symbol:t.value.symbol,name:t.value.name,asset:t.value.asset,imageSvg:null},amount:"",error:null},s=(0,Pd.merge)(n,a);await Hy(e,Bv(Ck,{context:s,inputAmount:""}),s),await nT(e,n)},[hk.SwapCurrencyButton]:async function({id:e,context:t}){if(t.error=null,t.currencyType=t.currencyType===pk.TOKEN?pk.FIAT:pk.TOKEN,!t.amount)return void await Hy(e,Bv(Ck,{context:t}),t);const n=jo(t.amount??"0"),{price:r}=t.tokenPrices[t.tokenCaipId]??{price:0};t.currencyType===pk.TOKEN&&(t.amount=n.dividedBy(r).toString()),t.currencyType===pk.FIAT&&(t.amount=n.multipliedBy(r).toString()),await Hy(e,Bv(Ck,{context:t,inputAmount:t.amount}),t)},[hk.MaxAmountButton]:async function({id:e,context:t}){const{currencyType:n,minimumBalanceForRentExemptionSol:r,tokenCaipId:o,tokenPrices:i}=t,a={...t},s=bk(t);if(Sk(t)){const e=vm(s),t=new Sv(PE).getFee().toString(),n=vm(r),o=e.minus(t).minus(n).minus(1),i=jo.maximum(o,o.isNegative()?e:jo(0)),c=wm(i);a.amount=c.toString()}else a.amount=s;if(n===pk.FIAT){const{price:e}=i[o]??{price:0};a.amount=MA(a.amount,e)}a.error=null,a.validation[hk.AmountInput]=Pk(hk.AmountInput,a.amount,Uk(a)),await Hy(e,Bv(Ck,{context:a,inputAmount:a.amount}),a),await nT(e,a)},[hk.DestinationAccountInput]:async function({id:e,event:t,context:n}){const r={...n};r.destinationAddressOrDomain=t.value,r.domainResolutionStatus=null,r.error=null;const o=Pk(hk.DestinationAccountInput,r.destinationAddressOrDomain,Uk(r));r.validation[hk.DestinationAccountInput]=o,Rk(r?.destinationAddressOrDomain)?(r.domainResolutionStatus="fetching",await Hy(e,Bv(Ck,{context:r}),r),r.toAddress=await jE.resolveDomain(r.scope,r.destinationAddressOrDomain).catch((()=>{const e=tA(r.preferences.locale);return r.validation[hk.DestinationAccountInput]={message:e("send.toInvalidErrorDomain"),value:r.destinationAddressOrDomain??""},null})),r.domainResolutionStatus=r.toAddress?"fetched":"error"):r.toAddress=r.destinationAddressOrDomain,await Hy(e,Bv(Ck,{context:r}),r),null===o&&await nT(e,r)},[hk.ClearButton]:async function({id:e,context:t}){t.destinationAddressOrDomain="",t.toAddress="",t.domainResolutionStatus=null,t.error=null,t.validation[hk.DestinationAccountInput]=null,await Hy(e,Bv(Ck,{context:t,inputToAddress:t.toAddress}),t)},[hk.CancelButton]:async function({id:e}){await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)},[hk.SendButton]:async function({id:e,context:t}){if(!Nk(t))return;const n={...t};n.stage="transaction-confirmation",n.loading=!0,await Hy(e,Bv(Ck,{context:n}),n);const r=t.accounts.find((e=>e.id===t.fromAccountId))?.address,[o,i,a,s]=await Promise.all([r?jE.resolveAddress(t.scope,r):null,t.toAddress?jE.resolveAddress(t.scope,t.toAddress):null,ME.getMultipleSpotPrices(t.assets,t.preferences.currency).then((e=>e)).catch((()=>null)),t.selectedTokenMetadata?Av.generateImageComponent(Rd({baseUrl:wE.get().staticApi.baseUrl,path:"/api/v2/tokenIcons/assets/{assetId}.png",pathParams:{assetId:t.selectedTokenMetadata?.asset.replace(/:/gu,"/")},encodePathParams:!1})):null]);n.fromDomain=o,n.toDomain=i,a&&(n.tokenPrices=a),s&&t.selectedTokenMetadata&&(n.selectedTokenMetadata={...t.selectedTokenMetadata,imageSvg:s}),n.loading=!1,await Hy(e,Bv(Ck,{context:n}),n),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionAdded,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:nd}}}}})}};const oT={[xk.BackButton]:async function({id:e,context:t}){const n={...t,stage:"send-form"};await Hy(e,Bv(Ck,{context:n,inputAmount:t.amount??"",inputToAddress:t.destinationAddressOrDomain??""}),n)},[xk.CancelButton]:async function({id:e,context:t}){const{fromAccountId:n,transactionMessage:r,scope:o}=t;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionRejected,params:{accountId:n,metadata:{scope:o,origin:nd}}}}}),await Zy(e,!1),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)},[xk.ConfirmButton]:async function({id:e,context:t}){const{scope:n,fromAccountId:r,feeEstimatedInSol:o,transactionMessage:i}=t;if(t.error=null,!i)return t.stage="send-form",void await Hy(e,Bv(Ck,{context:t}),t);await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:LA.OnTransactionApproved,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:nd}}}}});const a={...t,stage:"send-pending"};await Hy(e,Bv(Ck,{context:a}),a);let s=null;try{const e=await QE.getAccountOrThrow(r);s=(await YE.signAndSendTransaction(e,i,n,nd)).signature}catch(e){Yl.error({error:e},"Error submitting request")}const c={...t,stage:s?"transaction-success":"transaction-failure",feePaidInSol:o,transaction:{result:s?"success":"failure",signature:s}};await Hy(e,Bv(Ck,{context:c}),c),await AE.deleteKey(`mapInterfaceNameToId.${Vy}`)}};const iT=2n**255n-19n,aT=2n**252n+27742317777372353535851937790883648493n,sT=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,cT=0x6666666666666666666666666666666666666666666666666666666666666658n,uT={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:iT,n:aT,h:8,Gx:sT,Gy:cT},lT=(e="")=>{throw new Error(e)},dT=e=>"string"==typeof e,fT=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name)(e)||"number"==typeof t&&t>0&&e.length!==t?lT("Uint8Array of valid length expected"):e,hT=e=>new Uint8Array(e),pT=(e,t)=>fT(dT(e)?ST(e):hT(fT(e)),t),gT=(e,t=iT)=>{let n=e%t;return n>=0n?n:t+n},mT=e=>e instanceof yT?e:lT("Point expected");class yT{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new yT(e.x,e.y,1n,gT(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=uT,r=(e=pT(e,32)).slice(),o=e[31];r[31]=-129&o;const i=kT(r);!t||0n<=i&&i<2n**256n||lT("bad y coord 1"),t||0n<=i&&i<iT||lT("bad y coord 2");const a=gT(i*i),s=gT(a-1n),c=gT(n*a+1n);let{isValid:u,value:l}=CT(s,c);u||lT("bad y coordinate 3");const d=1n==(1n&l),f=!!(128&o);return!t&&0n===l&&f&&lT("bad y coord 3"),f!==d&&(l=gT(-l)),new yT(l,i,1n,gT(l*i))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{ex:t,ey:n,ez:r}=this,{ex:o,ey:i,ez:a}=mT(e),s=gT(t*a),c=gT(o*r),u=gT(n*a),l=gT(i*r);return s===c&&u===l}is0(){return this.equals(vT)}negate(){return new yT(gT(-this.ex),this.ey,this.ez,gT(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=uT,o=gT(e*e),i=gT(t*t),a=gT(2n*gT(n*n)),s=gT(r*o),c=e+t,u=gT(gT(c*c)-o-i),l=s+i,d=l-a,f=s-i,h=gT(u*d),p=gT(l*f),g=gT(u*f),m=gT(d*l);return new yT(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:o}=this,{ex:i,ey:a,ez:s,et:c}=mT(e),{a:u,d:l}=uT,d=gT(t*i),f=gT(n*a),h=gT(o*l*c),p=gT(r*s),g=gT((t+n)*(i+a)-d-f),m=gT(p-h),y=gT(p+h),w=gT(f-u*d),v=gT(g*m),A=gT(y*w),b=gT(g*w),S=gT(m*y);return new yT(v,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?lT("cannot multiply by 0"):vT;if("bigint"==typeof e&&0n<e&&e<aT||lT("invalid scalar, must be < L"),!t&&this.is0()||1n===e)return this;if(this.equals(wT))return KT(e).p;let n=vT,r=wT;for(let o=this;e>0n;o=o.double(),e>>=1n)1n&e?n=n.add(o):t&&(r=r.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(uT.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(aT/2n,!1).double();return e=e.add(this),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(vT))return{x:0n,y:1n};const r=IT(n);return 1n!==gT(n*r)&&lT("invalid inverse"),{x:gT(e*r),y:gT(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=ET(t);return n[31]|=1n&e?128:0,n}toHex(){return bT(this.toRawBytes())}}yT.BASE=new yT(sT,cT,1n,gT(sT*cT)),yT.ZERO=new yT(0n,1n,1n,0n);const{BASE:wT,ZERO:vT}=yT,AT=(e,t)=>e.toString(16).padStart(t,"0"),bT=e=>Array.from(e).map((e=>AT(e,2))).join(""),ST=e=>{const t=e.length;(!dT(e)||t%2)&&lT("hex invalid 1");const n=hT(t/2);for(let t=0;t<n.length;t++){const r=2*t,o=e.slice(r,r+2),i=Number.parseInt(o,16);(Number.isNaN(i)||i<0)&&lT("hex invalid 2"),n[t]=i}return n},ET=e=>ST(AT(e,64)).reverse(),kT=e=>BigInt("0x"+bT(hT(fT(e)).reverse())),TT=(...e)=>{const t=hT(e.reduce(((e,t)=>e+fT(t).length),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.length})),t},IT=(e,t=iT)=>{(0n===e||t<=0n)&&lT("no inverse n="+e+" mod="+t);let n=gT(e,t),r=t,o=0n,i=1n,a=1n,s=0n;for(;0n!==n;){const e=r/n,t=r%n,c=o-a*e,u=i-s*e;r=n,n=t,o=a,i=s,a=c,s=u}return 1n===r?gT(o,t):lT("no inverse")},xT=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=iT;return n},_T=19681161376707505956807079304988542015446066515923890162744021073123829784752n,CT=(e,t)=>{const n=gT(t*t*t),r=(e=>{const t=e*e%iT*e%iT,n=xT(t,2n)*t%iT,r=xT(n,1n)*e%iT,o=xT(r,5n)*r%iT,i=xT(o,10n)*o%iT,a=xT(i,20n)*i%iT,s=xT(a,40n)*a%iT,c=xT(s,80n)*s%iT,u=xT(c,80n)*s%iT,l=xT(u,10n)*o%iT;return{pow_p_5_8:xT(l,2n)*e%iT,b2:t}})(e*gT(n*n*t)).pow_p_5_8;let o=gT(e*n*r);const i=gT(t*o*o),a=o,s=gT(o*_T),c=i===e,u=i===gT(-e),l=i===gT(-e*_T);return c&&(o=a),(u||l)&&(o=s),1n==(1n&gT(o))&&(o=gT(-o)),{isValid:c||u,value:o}},RT=e=>gT(kT(e),aT);let PT;const NT=(...e)=>WT.sha512Async(...e),BT=(...e)=>"function"==typeof PT?PT(...e):lT("etc.sha512Sync not set"),MT=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=RT(t),o=wT.mul(r),i=o.toRawBytes();return{head:t,prefix:n,scalar:r,point:o,pointBytes:i}},OT=e=>NT(pT(e,32)).then(MT),zT=e=>MT(BT(pT(e,32))),UT=e=>OT(e).then((e=>e.pointBytes));function jT(e,t){return e?NT(t.hashable).then(t.finish):t.finish(BT(t.hashable))}const LT=(e,t,n)=>{const{pointBytes:r,scalar:o}=e,i=RT(t),a=wT.mul(i).toRawBytes();return{hashable:TT(a,r,n),finish:e=>{const t=gT(i+RT(e)*o,aT);return fT(TT(a,ET(t)),64)}}},DT={zip215:!0},FT=(e,t,n,r=DT)=>{t=pT(t),e=pT(e,64);const{zip215:o}=r;let i,a,s,c,u=new Uint8Array;try{i=yT.fromHex(n,o),a=yT.fromHex(e.slice(0,32),o),s=kT(e.slice(32,64)),c=wT.mul(s,!1),u=TT(a.toRawBytes(),i.toRawBytes(),t)}catch(e){}return{hashable:u,finish:e=>{if(null==c)return!1;if(!o&&i.isSmallOrder())return!1;const t=RT(e);return a.add(i.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},$T=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,WT={bytesToHex:bT,hexToBytes:ST,concatBytes:TT,mod:gT,invert:IT,randomBytes:(e=32)=>{const t=$T();return t&&t.getRandomValues||lT("crypto.getRandomValues must be defined"),t.getRandomValues(hT(e))},sha512Async:async(...e)=>{const t=$T();t&&t.subtle||lT("crypto.subtle or etc.sha512Async must be defined");const n=TT(...e);return hT(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(WT,{sha512Sync:{configurable:!1,get:()=>PT,set(e){PT||(PT=e)}}});const qT={getExtendedPublicKeyAsync:OT,getExtendedPublicKey:zT,randomPrivateKey:()=>WT.randomBytes(32),precompute:(e=8,t=wT)=>(t.multiply(3n),t)};let VT;const KT=e=>{const t=VT||(VT=(()=>{const e=[];let t=wT,n=t;for(let r=0;r<33;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e})()),n=(e,t)=>{let n=t.negate();return e?n:t};let r=vT,o=wT;const i=BigInt(255),a=BigInt(8);for(let s=0;s<33;s++){const c=128*s;let u=Number(e&i);e>>=a,u>128&&(u-=256,e+=1n);const l=c,d=c+Math.abs(u)-1,f=s%2!=0,h=u<0;0===u?o=o.add(n(f,t[l])):r=r.add(n(h,t[d]))}return{p:r,f:o}};function GT(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var HT=n(1048).hp;const ZT="8d9df0f7-1363-4d2c-8152-ce4ed78f27d8",JT=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function YT(e){return HT.from(e).toString("base64").replace(/\+/gu,"-").replace(/\//gu,"_").replace(/[=]/gu,"")}function QT(e){const t=e.replace(/-/gu,"+").replace(/_/gu,"/");return new Uint8Array(HT.from(t,"base64"))}async function XT(e,t,n){if("private"!==t.type)throw new DOMException("Key is not private","NotAllowedError");if(!t.usages.includes("sign"))throw new DOMException("Key usage not allowed","NotAllowedError");const r=GT(n),o=t[ZT],i=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(await(async(e,t)=>{const n=pT(e),r=await OT(t),o=await NT(r.prefix,n);return jT(!0,LT(r,o,n))})(r,o));return i}async function eI(e,t,n,r){if("public"!==t.type)throw new DOMException("Key is not public","NotAllowedError");if(!t.usages.includes("verify"))throw new DOMException("Key usage not allowed","NotAllowedError");const o=GT(n),i=GT(r),a=t[ZT];return await(async(e,t,n,r=DT)=>jT(!0,FT(e,t,n,r)))(o,i,a)}function tI(e){return"Ed25519"===e||"object"==typeof e&&"Ed25519"===e.name}function nI(){const{subtle:e}=globalThis.crypto;Object.defineProperty(globalThis,"isSecureContext",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,"generateKey",{value:async(...e)=>tI(e[0])?await async function(e,t,n){const r=qT.randomPrivateKey(),o=await UT(r),i=Array.from(n);return{privateKey:{algorithm:{name:"Ed25519"},extractable:t,type:"private",usages:i,[ZT]:r},publicKey:{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i,[ZT]:o}}}(...e):await globalThis.crypto.subtle.generateKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"exportKey",{value:async(...e)=>tI(e[1].algorithm)?await async function(e,t){if(!t.extractable)throw new DOMException("key is not extractable","InvalidAccessException");const n=t[ZT];switch(e){case"raw":if("public"!==t.type)throw new DOMException("Unable to export a raw Ed25519 private key","InvalidAccessError");return n.buffer;case"pkcs8":if("private"!==t.type)throw new DOMException("Unable to export a pkcs8 Ed25519 public key","InvalidAccessError");return new Uint8Array([...JT,...n]).buffer;case"jwk":{const e={crv:"Ed25519",ext:t.extractable,key_ops:t.usages,kty:"OKP"};if("private"===t.type){const t=await UT(n);return Object.freeze({...e,d:YT(n),x:YT(t)})}return Object.freeze({...e,x:YT(n)})}case"spki":{if("public"!==t.type)throw new DOMException("Only public keys can be exported as SPKI","InvalidAccessError");const e=new Uint8Array([48,5,6,3,43,101,112]),r=new Uint8Array([3,n.length+1,0,...n]);return new Uint8Array([48,e.length+r.length,...e,...r]).buffer}default:throw new Error(`Unsupported export format: ${e}`)}}(...e):await globalThis.crypto.subtle.exportKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"sign",{value:async(...e)=>{const[t,n]=e;return tI(t)&&tI(n.algorithm)?await XT(...e):await globalThis.crypto.subtle.sign(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"verify",{value:async(...e)=>{const[t,n]=e;return tI(t)&&tI(n.algorithm)?await eI(...e):await globalThis.crypto.subtle.verify(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"importKey",{value:async(...e)=>tI(e[2])?await async function(e,t,n,r,o){const i=Array.from(o);switch(e){case"raw":{const e=GT(t);if(32!==e.length)throw new DOMException("Ed25519 raw keys must be exactly 32-bytes","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"public",usages:i.filter((e=>"verify"===e)),[ZT]:e}}case"pkcs8":{const e=GT(t);if(48!==e.length)throw new DOMException("Invalid PKCS8 key data length","DataError");if(!e.slice(0,16).every(((e,t)=>e===JT[t])))throw new DOMException("Invalid PKCS8 header","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"private",usages:i.filter((e=>"sign"===e)),[ZT]:e.slice(16)}}case"jwk":{const e=t;if("OKP"!==e.kty||"Ed25519"!==e.crv)throw new DOMException("Invalid Ed25519 JWK","DataError");const n="d"in e?"private":"public";if("public"===n&&!e.x)throw new DOMException("Ed25519 JWK is missing public key","DataError");if(!("private"!==n||e.d&&e.x))throw new DOMException("Ed25519 JWK is missing key data","DataError");const o="private"===n?e.d:e.x;return{algorithm:{name:"Ed25519"},extractable:r,type:n,usages:i.filter((e=>"private"===n?"sign"===e:"verify"===e)),[ZT]:QT(o)}}case"spki":{const e=GT(t);if(48!==e[0])throw new DOMException("Invalid SPKI format","DataError");const n=2;if(48!==e[n]||6!==e[n+2]||3!==e[n+3]||43!==e[n+4]||101!==e[n+5]||112!==e[n+6])throw new DOMException("Not an Ed25519 key","DataError");const r=n+7+2;return{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i.filter((e=>"verify"===e)),[ZT]:e.slice(r)}}default:throw new Error(`Unsupported import format: ${e}`)}}(...e):await globalThis.crypto.subtle.importKey(...e),writable:!0,configurable:!0})}const rI=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,"DOMException",{value:Error,writable:!0,configurable:!0,enumerable:!0}),nI(),Object.defineProperty(globalThis,"queueMicrotask",{value:rI,writable:!0,configurable:!0,enumerable:!0}),jo.config({EXPONENTIAL_AT:16});const oI=async({origin:e,request:t})=>{Yl.log("[🔄 onRpcRequest]",t.method,t);const{method:n}=t;gw(e,n);const r=Hk[n];if(!r)throw new so(`RpcRequest method ${n} not found. Available methods: ${Object.values(tw).toString()}`);return await Zk((async()=>r({origin:e,request:t})))??null},iI=async({origin:e,request:t})=>{Yl.log("[🔑 onKeyringRequest]",t.method,t),gw(e,t.method),t.method===ln.SubmitRequest&&t.params&&!("origin"in t.params)&&(t.params.origin="https://metamask.io");return await Zk((async()=>Bn(QE,t)))??null},aI=async({id:e,event:t,context:n})=>{if(Yl.log("[👇 onUserInput]",e,t),!t.name)return;const r={...rT,...oT,...EA,...AA,...yA}[t.name];r&&await Zk((async()=>r({id:e,event:t,context:n,snapContext:rk})))},sI=async({request:e})=>{const t=Jl(Yl,"[⏱️ onCronjob]");t.log(e.method,e);const{method:n}=e;j(n,V([...Object.values(Fk),...Object.values(LA)]));return await Zk((async()=>{t.log("Running cronjob",{method:n});const r=Dk[n];if(!r)throw new so(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${Object.values([...Object.values(Fk),...Object.values(LA)]).toString()}`);return r({request:e})}))??null},cI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[🔍 onAssetsLookup]",e);const{assets:t}=e,n=t.filter((e=>{const{assetNamespace:t}=Qo(e);return"token"===t||"slip44"===t}));return{assets:await DE.getAssetsMetadata(n)}})(e)));return t??null},uI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[💱 onAssetsConversion]",e);const{conversions:t}=e;return{conversionRates:await UE.getMultipleTokenConversions(t)}})(e)));return t??null},lI=async e=>await Zk((async()=>(async({scope:e,request:t})=>{switch(j(e,vd),t.method){case qk.GetGenesisHash:return j(t,Vk),kE.getRpc(e).getGenesisHash().send();case qk.GetLatestBlockhash:return j(t,Kk),(await kE.getLatestBlockhash(e)).blockhash;case qk.GetMinimumBalanceForRentExemption:return j(t,Gk),(await kE.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)))??null,dI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[📈 onAssetHistoricalPrice]",e);const{from:t,to:n}=e;return j(t,Jo),j(n,Jo),{historicalPrice:await UE.getHistoricalPrice(t,n)}})(e)));return t??null},fI=async({request:e})=>await Zk((async()=>nk.handle(e)))??null,hI=async({event:e})=>Zk((async()=>{await vE.emitSync("onWebSocketEvent",e)})),pI=async()=>Zk((async()=>{await vE.emitSync("onStart")})),gI=async()=>Zk((async()=>{await vE.emitSync("onUpdate")})),mI=async()=>Zk((async()=>{await vE.emitSync("onInstall")})),yI=async()=>Zk((async()=>{await vE.emitSync("onActive")})),wI=async()=>Zk((async()=>{await vE.emitSync("onInactive")})),vI=async e=>{const t=await Zk((async()=>(async e=>{j(e,$k);const{chainId:t,domain:n,address:r}=e,o=new RegExp(`^.+\\${jE.tld}$`,"u");if(n&&o.test(n)){const e=await jE.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:Wk,domainName:n}]}}if(r){const e=await jE.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:Wk}]}}return null})(e)));return t??null},AI=async e=>{const t=await Zk((async()=>(async e=>{Yl.log("[💰 onAssetsMarketData]",e);const{assets:t}=e;return{marketData:await DE.fetchAssetsMarketData(t)}})(e)));return t??null}})(),module.exports=r})();