@metamask/solana-wallet-snap 2.4.0 → 2.4.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/CHANGELOG.md +15 -1
- package/dist/bundle.js +1 -1
- package/dist/preinstalled-snap.json +1 -1
- package/package.json +1 -1
- package/snap.manifest.json +3 -2
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 v=c(e),w=c(t),A=v?f:s(e),b=w?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;v=!0,S=!1}if(k&&!S)return y||(y=new r),v||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 v(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:w(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):w(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function w(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 v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(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 O(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 M(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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 O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(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 O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return M(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){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function q(e,t){if("number"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw q(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]],v=t[f];if(i)var w=c?i(v,y,f,t,e,s):i(y,v,f,e,t,s);if(!(void 0===w?y===v||a(y,v,n,i,s):w)){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==-Infinity?"-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 v(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function w(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function A(){var e=o();if(w(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?v(e):(c=u=void 0,d)}function S(){var e=o(),n=w(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(A,t),g?v(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(A,t),v(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,v,w){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<w){var N=l(_,R);return s(t,n,e,I.placeholder,f,_,N,y,v,w-x)}var B=b?f:this,O=S?B[t]:t;return x=_.length,y?_=u(_,y):k&&x>1&&_.reverse(),A&&v<x&&(_.length=v),this&&this!==d&&this instanceof I&&(O=T||a(O)),O.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:!("cap"in l)||l.cap,curry:!("curry"in l)||l.curry,fixed:!("fixed"in l)||l.fixed,immutable:!("immutable"in l)||l.immutable,rearg:!("rearg"in l)||l.rearg},p=d?u:o,g="curry"in l&&l.curry,m="fixed"in l&&l.fixed,y="rearg"in l&&l.rearg,v=d?u.runInContext():void 0,w=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},A=w.ary,b=w.assign,S=w.clone,E=w.curry,k=w.forEach,T=w.isArray,I=w.isError,x=w.isFunction,_=w.isWeakMap,C=w.keys,R=w.rearg,P=w.toInteger,N=w.toPath,B=C(r.aryMethod),O={castArray:function(e){return function(){var t=arguments[0];return T(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.cap&&"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(!x(n))return e(n,Object(t));var r=[];return k(C(t),(function(e){x(t[e])&&r.push([e,n.prototype[e]])})),e(n,Object(t)),k(r,(function(e){var t=e[1];x(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]})),n}},nthArg:function(e){return function(t){var n=t<0?1:P(t)+1;return E(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return E(e(t,n),r)}},runInContext:function(n){return function(r){return e(t,n(r),l)}}};function M(e,t){if(h.cap){var n=r.iterateeRearg[e];if(n)return function(e,t){return D(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)}}(R(a(e,n),t),n)}))}(t,n);var o=!d&&r.iterateeAry[e];if(o)return function(e,t){return D(e,(function(e){return"function"==typeof e?a(e,t):e}))}(t,o)}return t}function z(e,t,n){if(h.fixed&&(m||!r.skipFixed[e])){var o=r.methodSpread[e],a=o&&o.start;return void 0===a?A(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 U(e,t,n){return h.rearg&&n>1&&(y||!r.skipRearg[e])?R(t,r.methodRearg[e]||r.aryRearg[n]):t}function j(e,t){for(var n=-1,r=(t=N(t)).length,o=r-1,i=S(Object(e)),a=i;null!=a&&++n<r;){var s=t[n],c=a[s];null==c||x(c)||I(c)||_(c)||(a[s]=S(n==o?c:Object(c))),a=a[s]}return i}function L(t,n){var o=r.aliasToReal[t]||t,i=r.remap[o]||o,a=l;return function(t){var r=d?v:w,s=d?v[i]:n,c=b(b({},a),t);return e(r,o,s,c)}}function D(e,t){return function(){var n=arguments.length;if(!n)return e();for(var r=Array(n);n--;)r[n]=arguments[n];var o=h.rearg?0:n-1;return r[o]=t(r[o]),e.apply(void 0,r)}}function F(e,t,n){var o,i=r.aliasToReal[e]||e,a=t,u=O[i];return u?a=u(t):h.immutable&&(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,j))),k(B,(function(e){return k(r.aryMethod[e],(function(t){if(i==t){var n=r.methodSpread[i],s=n&&n.afterRearg;return o=s?z(i,U(i,a,e),e):U(i,z(i,a,e),e),o=function(e,t,n){return g||h.curry&&n>1?E(t,n):t}(0,o=M(i,o),e),!1}})),!o})),o||(o=a),o==t&&(o=g?E(o,1):function(){return t.apply(this,arguments)}),o.convert=L(i,t),o.placeholder=t.placeholder=n,o}if(!f)return F(n,u,p);var $=u,q=[];return k(B,(function(e){k(r.aryMethod[e],(function(e){var t=$[r.remap[e]||e];t&&q.push([e,F(e,t,$)])}))})),k(C($),(function(e){var t=$[e];if("function"==typeof t){for(var n=q.length;n--;)if(q[n][0]==e)return;t.convert=L(e,t),q.push([e,t])}})),k(q,(function(e){$[e[0]]=e[1]})),$.convert=function(e){return $.runInContext.convert(e)(void 0)},$.placeholder=$,k(C($),(function(e){k(r.realToAlias[e]||[],(function(t){$[t]=$[e]}))})),$}},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],v=t[p];if(a)var w=u?a(v,y,p,t,e,c):a(y,v,p,e,t,c);if(void 0!==w){if(w)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!==v&&!s(y,v,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]],v="[object Arguments]",w="[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]",O="[object ArrayBuffer]",M="[object DataView]",z="[object Float32Array]",U="[object Float64Array]",j="[object Int8Array]",L="[object Int16Array]",D="[object Int32Array]",F="[object Uint8Array]",$="[object Uint8ClampedArray]",q="[object Uint16Array]",W="[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,ve=/^\[object .+?Constructor\]$/,we=/^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+"]",Oe="["+Te+"]",Me="\\d+",ze="["+Ie+"]",Ue="["+xe+"]",je="[^"+ke+Re+Me+Ie+xe+_e+"]",Le="\\ud83c[\\udffb-\\udfff]",De="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+_e+"]",We="\\u200d",Ve="(?:"+Ue+"|"+je+")",Ke="(?:"+qe+"|"+je+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",He="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Oe+"|"+Le+")"+"?",Je="["+Ce+"]?",Ye=Je+Ze+("(?:"+We+"(?:"+[De,Fe,$e].join("|")+")"+Je+Ze+")*"),Qe="(?:"+[ze,Fe,$e].join("|")+")"+Ye,Xe="(?:"+[De+Oe+"?",Oe,Fe,$e,Ne].join("|")+")",et=RegExp(Pe,"g"),tt=RegExp(Oe,"g"),nt=RegExp(Le+"(?="+Le+")|"+Xe+Ye,"g"),rt=RegExp([qe+"?"+Ue+"+"+Ge+"(?="+[Be,qe,"$"].join("|")+")",Ke+"+"+He+"(?="+[Be,qe+Ve,"$"].join("|")+")",qe+"?"+Ve+"+"+Ge,qe+"+"+He,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Me,Qe].join("|"),"g"),ot=RegExp("["+We+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[q]=ct[W]=!0,ct[v]=ct[w]=ct[O]=ct[A]=ct[M]=ct[b]=ct[S]=ct[E]=ct[T]=ct[I]=ct[x]=ct[C]=ct[R]=ct[P]=ct[B]=!1;var ut={};ut[v]=ut[w]=ut[O]=ut[M]=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[q]=ut[W]=!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,vt=yt&&yt.exports===mt,wt=vt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||wt&&wt.binding&&wt.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)&&qt(e,t,0)>-1}function Ot(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 Mt(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 qt(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 Wt(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 Mt(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&&qt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&qt(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({"&":"&","<":"<",">":">",'"':""","'":"'"});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({"&":"&","<":"<",">":">",""":'"',"'":"'"});var vn=function e(t){var n,r=(t=null==t?gt:vn.defaults(gt.Object(),t,vn.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,Oe=t["__core-js_shared__"],Me=Ne.toString,ze=Be.hasOwnProperty,Ue=0,je=(n=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Le=Be.toString,De=Me.call(xe),Fe=gt._,$e=_e("^"+Me.call(ze).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=vt?t.Buffer:o,We=t.Symbol,Ve=t.Uint8Array,Ke=qe?qe.allocUnsafe:o,Ge=ln(xe.getPrototypeOf,xe),He=xe.create,Ze=Be.propertyIsEnumerable,Je=Pe.splice,Ye=We?We.isConcatSpreadable:o,Qe=We?We.iterator:o,Xe=We?We.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,wt=qe?qe.isBuffer:o,At=t.isFinite,Dt=Pe.join,Ht=ln(xe.keys,xe),wn=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),On=Li(In),Mn=Li(xn),zn=Li(_n),Un=Li(Cn),jn=We?We.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 Wn)return e;if(ze.call(e,"__wrapped__"))return Di(e)}return new Wn(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 qn(){}function Wn(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&&Wa(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==v||h&&!i){if(s=u||h?{}:vi(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 O:return Io(e);case A:case b:return new r(+e);case M: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 q:case W: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=Mt(t,Xt(n))),r?(i=Ot,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=qn.prototype,Fn.prototype.constructor=Fn,Wn.prototype=$n(qn.prototype),Wn.prototype.constructor=Wn,Vn.prototype=$n(qn.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=Mo(br),pr=Mo(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 vr(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=wi),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?vr(s,t-1,n,r,o):zt(o,s):r||(o[o.length]=s)}return o}var wr=zo(),Ar=zo(!0);function br(e,t){return e&&wr(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?Ot: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=Mt(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)==v}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?w:mi(e),l=c?w:mi(t),d=(u=u==v?x:u)==x,f=(l=l==v?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 M:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case O: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 v=e[h=c[f]],w=t[h];if(r)var A=s?r(w,v,h,t,e,a):r(v,w,h,e,t,a);if(!(A===o?v===w||i(v,w,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 Or(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 Mr(e){return!(!ts(e)||(t=e,je&&je in t))&&(Qa(e)?$e:ve).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||Or(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 qr(e,t,n,r,i){e!==t&&wr(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)||Wa(u)?(d=c,Wa(c)?d=vs(c):ts(c)&&!Qa(c)||(d=vi(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,qr,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 Wr(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?Mt(t,(function(e){return Va(e)?function(t){return kr(t,1===e.length?e[0]:e)}:e})):[oc];var r=-1;t=Mt(t,Xt(li()));var o=Dr(e,(function(e,n,o){var i=Mt(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?Wt:qt,i=-1,a=t.length,s=e;for(e===t&&(t=Po(t)),n&&(s=Mt(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 Mt(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=Ot;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(vr(a,1),t,n)}function vo(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 wo(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(ws(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=wn(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=wn(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 Oo(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 Mo(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=ws(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(Ws(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=Wn.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 Wn([],!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,v=g?o:Lo(e);return function d(){for(var w=arguments.length,A=r(w),b=w;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)),w-=E,m&&w<f){var k=dn(A,S);return Zo(e,t,$o,d.placeholder,n,A,k,u,l,f-w)}var T=p?n:this,I=g?T[e]:e;return w=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&&w>1&&A.reverse(),h&&l<w&&(A.length=l),this&&this!==gt&&this instanceof d&&(I=v||Lo(I)),I.apply(T,A)}}function qo(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 Wo(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=Mt(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=wn(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,Oi(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=(ws(e)+"e").split("e");return+((r=(ws(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 Mt(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 v=a?a.length:0;if(v||(t&=-97,a=h=o),g=g===o?g:wn(gs(g),0),m=m===o?m:gs(m),v-=h?h.length:0,t&l){var w=a,A=h;a=h=o}var b=y?o:si(e),S=[e,t,n,a,h,w,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:wn(S[9]-v,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 Oi((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),qr(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 Mr(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)||Wa(e))}function vi(e){return"function"!=typeof e.constructor||Ti(e)?{}:$n(Ge(e))}function wi(e){return Va(e)||Wa(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)))!=M||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 M;case On:return T;case Mn:return _;case zn:return R;case Un:return B}return t});var ki=Oe?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=wn(t===o?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=wn(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=Mi(to),Ni=ht||function(e,t){return gt.setTimeout(e,t)},Bi=Mi(no);function Oi(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 Mi(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=Ma(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 Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Di(e){if(e instanceof Vn)return e.clone();var t=new Wn(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,vr(t,1,Ha,!0)):[]})),$i=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),li(n,2)):[]})),qi=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),o,n):[]}));function Wi(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=wn(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?wn(r+i,0):An(i,r-1)),$t(e,li(t,3),i,!0)}function Ki(e){return(null==e?0:e.length)?vr(e,1):[]}function Gi(e){return e&&e.length?e[0]:o}var Hi=Yr((function(e){var t=Mt(e,wo);return t.length&&t[0]===e[0]?Rr(t):[]})),Zi=Yr((function(e){var t=Yi(e),n=Mt(e,wo);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=Mt(e,wo);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,Mt(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(vr(e,1,Ha,!0))})),ra=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),fo(vr(e,1,Ha,!0),li(t,2))})),oa=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,fo(vr(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=wn(e.length,t),!0})),Yt(t,(function(t){return Mt(e,Gt(t))}))}function aa(e,t){if(!e||!e.length)return[];var n=ia(e);return null==t?n:Mt(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 Wn(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(Wi),va=Do(Vi);function wa(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)?Mt: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,vr(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 v(e);u=Ni(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function v(e){return u=o,p&&r?g(e):(r=a=o,c)}function w(){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)?wn(ys(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),w.cancel=function(){u!==o&&ko(u),d=0,r=l=a=u=o},w.flush=function(){return u===o?c:v(xa())},w}var Ba=Yr((function(e,t){return dr(e,1,t)})),Oa=Yr((function(e,t,n){return dr(e,ys(t)||0,n)}));function Ma(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(Ma.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)}}Ma.Cache=Hn;var Ua=So((function(e,t){var n=(t=1==t.length&&Va(t[0])?Mt(t[0],Xt(li())):Mt(vr(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),qa=Ho((function(e,t){return e>=t})),Wa=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)==O};function Ga(e){return null!=e&&es(e.length)&&!Qa(e)}function Ha(e){return ns(e)&&Ga(e)}var Za=wt||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&&Me.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||we.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function vs(e){return No(e,Bs(e))}function ws(e){return null==e?"":lo(e)}var As=Oo((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=Oo((function(e,t){No(t,Bs(t),e)})),Ss=Oo((function(e,t,n,r){No(t,Bs(t),e,r)})),Es=Oo((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(Ms,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=qo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Le.call(t)),e[t]=n}),tc(oc)),Rs=qo((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 Os=Oo((function(e,t,n){qr(e,t,n)})),Ms=Oo((function(e,t,n,r){qr(e,t,n,r)})),zs=oi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Mt(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=Mt(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?qs(t):t)}));function qs(e){return Ys(ws(e).toLowerCase())}function Ws(e){return(e=ws(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=ws(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(Mt),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 vc=Wo((function(e,t){return e+t}),0),wc=Jo("ceil"),Ac=Wo((function(e,t){return e/t}),1),bc=Jo("floor");var Sc,Ec=Wo((function(e,t){return e*t}),1),kc=Jo("round"),Tc=Wo((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:wn(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],vr(t,1))},Fn.cond=function(e){var t=null==e?0:e.length,n=li();return e=t?Mt(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=Oa,Fn.difference=Fi,Fn.differenceBy=$i,Fn.differenceWith=qi,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 vr(ka(e,t),1)},Fn.flatMapDeep=function(e,t){return vr(ka(e,t),h)},Fn.flatMapDepth=function(e,t,n){return n=n===o?1:gs(n),vr(ka(e,t),n)},Fn.flatten=Ki,Fn.flattenDeep=function(e){return(null==e?0:e.length)?vr(e,h):[]},Fn.flattenDepth=function(e,t){return(null==e?0:e.length)?vr(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=Ma,Fn.merge=Os,Fn.mergeWith=Ms,Fn.method=ac,Fn.methodOf=sc,Fn.mixin=cc,Fn.negate=za,Fn.nthArg=function(e){return e=gs(e),Yr((function(t){return Wr(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=ws(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:wn(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)?Mt(e,ji):us(e)?[e]:Po(Ui(ws(e)))},Fn.toPlainObject=vs,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 vo(e||[],t||[],nr)},Fn.zipObjectDeep=function(e,t){return vo(e||[],t||[],eo)},Fn.zipWith=fa,Fn.entries=Ls,Fn.entriesIn=Ds,Fn.extend=bs,Fn.extendWith=Ss,cc(Fn,Fn),Fn.add=vc,Fn.attempt=Xs,Fn.camelCase=$s,Fn.capitalize=qs,Fn.ceil=wc,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=Ws,Fn.defaultTo=function(e,t){return null==e||e!=e?t:e},Fn.divide=Ac,Fn.endsWith=function(e,t,n){e=ws(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=ws(e))&&Y.test(e)?e.replace(Z,an):e},Fn.escapeRegExp=function(e){return(e=ws(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=Wi,Fn.findKey=function(e,t){return Ft(e,li(t,3),br)},Fn.findLast=va,Fn.findLastIndex=Vi,Fn.findLastKey=function(e,t){return Ft(e,li(t,3),Sr)},Fn.floor=bc,Fn.forEach=wa,Fn.forEachRight=Aa,Fn.forIn=function(e,t){return null==e?e:wr(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=qa,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=wn(o+n,0)),cs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&qt(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=wn(r+o,0)),qt(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<wn(t,n)}(e=ys(e),t,n)},Fn.invoke=Ps,Fn.isArguments=Wa,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)||Wa(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||Or(e,t,fi(t))},Fn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,Or(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 Mr(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?wn(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?Wr(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=ws(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=ws(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=ws(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(ws(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(ws(e),t)},Fn.replace=function(){var e=arguments,t=ws(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=ws(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=ws(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 ws(e).toLowerCase()},Fn.toNumber=ys,Fn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},Fn.toString=ws,Fn.toUpper=function(e){return ws(e).toUpperCase()},Fn.trim=function(e,t,n){if((e=ws(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=ws(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=ws(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=ws(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,ws(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=ws(e))&&J.test(e)?e.replace(H,yn):e},Fn.uniqueId=function(e){var t=++Ue;return ws(e)+t},Fn.upperCase=Js,Fn.upperFirst=Ys,Fn.each=wa,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:wn(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 Wn(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=wn(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],v=y.iteratee,w=y.type,A=v(m);if(2==w)m=A;else if(!A){if(1==w)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 Wn(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 qn;){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 Wn(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._=vn,(r=function(){return vn}.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==-Infinity?"-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),v=u(a),w=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 v:return f;case w: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,v){var w=2&t;if(!w&&"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),v=void 0===v?v:f(v),A-=g?g.length:0,64&t){var b=p,S=g;p=g=void 0}var E=w?void 0:c(e),k=[e,t,n,p,g,b,S,m,y,v];if(E&&u(k,E),e=k[0],t=k[1],n=k[2],p=k[3],g=k[4],!(v=k[9]=void 0===k[9]?w?0:e.length:h(k[9]-A,0))&&24&t&&(t&=-25),t&&1!=t)T=8==t||16==t?i(e,t,v):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),v=n(3142),w=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,O=1&n,M=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=v(t);if(U){if(B=g(t),!O)return u(t,B)}else{var j=p(t),L=j==I||"[object GeneratorFunction]"==j;if(w(t))return c(t,O);if(j==x||j==T||L&&!P){if(B=M||L?{}:y(t),!O)return M?d(t,s(B,t)):l(t,a(B,t))}else{if(!_[j])return P?t:{};B=m(t,j,O)}}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?M?h:f:M?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:()=>tI,onAssetHistoricalPrice:()=>ZT,onAssetsConversion:()=>GT,onAssetsLookup:()=>KT,onAssetsMarketData:()=>oI,onClientRequest:()=>JT,onCronjob:()=>VT,onInactive:()=>nI,onInstall:()=>eI,onKeyringRequest:()=>qT,onNameLookup:()=>rI,onProtocolRequest:()=>HT,onRpcRequest:()=>$T,onStart:()=>QT,onUpdate:()=>XT,onUserInput:()=>WT,onWebSocketEvent:()=>YT});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&-(t>>0&1)^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!=0)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=w(n)+v(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),v=(e,t,n)=>e&t|n&(e|t),w=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){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function P(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: \`${R(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*N(e,t,n,r){(function(e){return C(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=P(o,t,n,r);e&&(yield e)}}function*B(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=B(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)=>N(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>N(o(e,t),t,this,e):()=>[]}assert(e,t){return M(e,this,t)}create(e,t){return z(e,this,t)}is(e){return U(e,this)}mask(e,t){return function(e,t,n){const r=j(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return j(e,this,t)}}function M(e,t,n){const r=j(e,t,{message:n});if(r[0])throw r[0]}function z(e,t,n){const r=j(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function U(e,t){return!j(e,t)[0]}function j(e,t,n={}){const r=B(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 L(e,t){return new O({type:e,schema:null,validator:t})}function D(e,t){return L(e,(e=>"string"==typeof e&&t.test(e)))}const F=D("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),$=F,q=L("Url",(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})),W=D("StringNumber",/^\d+(\.\d+)?$/u);function V(){return L("any",(()=>!0))}function K(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: ${R(e)}`})}function G(){return L("boolean",(e=>"boolean"==typeof e))}function H(e){const t={},n=e.map((e=>R(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: ${R(t)}`})}function Z(){return L("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${R(e)}`))}function J(e){const t=R(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: ${R(n)}`})}function Y(){return L("never",(()=>!1))}function Q(e){return new O({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function X(){return L("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${R(e)}`))}function ee(e){const t=e?Object.keys(e):[],n=Y();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),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: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function te(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 ne(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: ${R(e)}`})}function re(){return L("string",(e=>"string"==typeof e||`Expected a string, but received: ${R(e)}`))}function oe(e){const t=Y();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: ${R(e)}`})}function ie(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: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function ae(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]=B(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: ${R(n)}`,...o]}})}function se(){return L("unknown",(()=>!0))}function ce(e){return ee(e)}function ue(e){return e.path[e.path.length-1]in e.branch[e.branch.length-2]}function le(e){return new O({...e,validator:(t,n)=>!ue(n)||e.validator(t,n),refiner:(t,n)=>!ue(n)||e.refiner(t,n)})}function de(e,t,n){return new O({...e,coercer:(r,o)=>U(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function fe(e){return e instanceof Map||e instanceof Set?e.size:e.length}function he(e,t,n={}){const{exclusive:r}=n;return me(e,"min",(n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))}function pe(e){return me(e,"nonempty",(t=>fe(t)>0||`Expected a nonempty ${e.type} but received an empty one`))}function ge(e,t){return me(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function me(e,t,n){return new O({...e,*refiner(r,o){yield*e.refiner(r,o);const i=N(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const ye=(e,t)=>Object.hasOwnProperty.call(e,t);var ve;!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"}(ve=ve||(ve={}));const we=e=>ee(e);function Ae({path:e,branch:t}){const n=e[e.length-1];return ye(t[t.length-2],n)}function be(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Ae(n)||e.validator(t,n),refiner:(t,n)=>!Ae(n)||e.refiner(t,n)})}function Se(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(!Se(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]||!Se(n[e][1])){t=!1;break}return t}return!1}const Ee=L("JSON",(e=>Se(e))),ke=de(Ee,me(V(),"JSON",(e=>U(e,Ee))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Te=J("2.0"),Ie=Q(ae([X(),re()])),xe=we({code:Z(),message:re(),data:be(ke),stack:be(re())}),_e=ae([ne(re(),ke),K(ke)]);we({id:Ie,jsonrpc:Te,method:re(),params:be(_e)}),we({jsonrpc:Te,method:re(),params:be(_e)});ee({id:Ie,jsonrpc:Te,result:te(se()),error:te(xe)});const Ce=we({id:Ie,jsonrpc:Te,result:ke}),Re=we({id:Ie,jsonrpc:Te,error:xe});ae([Ce,Re]);const Pe=ce({jsonrpc:J("2.0"),id:ae([re(),X(),J(null)]),method:re(),params:le(ae([K(ke),ne(re(),ke)]))});const Ne=(e,t)=>Object.hasOwnProperty.call(e,t);var Be;!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"}(Be=Be||(Be={}));const Oe=e=>ee(e);function Me({path:e,branch:t}){const n=e[e.length-1];return Ne(t[t.length-2],n)}function ze(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Me(n)||e.validator(t,n),refiner:(t,n)=>!Me(n)||e.refiner(t,n)})}function Ue(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(!Ue(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]||!Ue(n[e][1])){t=!1;break}return t}return!1}const je=L("JSON",(e=>Ue(e))),Le=de(je,me(V(),"JSON",(e=>U(e,je))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const De=J("2.0"),Fe=Q(ae([X(),re()])),$e=Oe({code:Z(),message:re(),data:ze(Le),stack:ze(re())}),qe=ae([ne(re(),Le),K(Le)]);Oe({id:Fe,jsonrpc:De,method:re(),params:ze(qe)}),Oe({jsonrpc:De,method:re(),params:ze(qe)});ee({id:Fe,jsonrpc:De,result:te(se()),error:te($e)});const We=Oe({id:Fe,jsonrpc:De,result:Le}),Ve=Oe({id:Fe,jsonrpc:De,error:$e});ae([We,Ve]);function Ke(e,t){return L(e,(e=>"string"==typeof e&&t.test(e)))}const Ge=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,He=/^[-a-z0-9]{3,8}$/u,Ze=/^[-_a-zA-Z0-9]{1,32}$/u,Je=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Ye=/^[-.%a-zA-Z0-9]{1,128}$/u,Qe=/^[-a-z0-9]{3,8}$/u,Xe=/^[-.%a-zA-Z0-9]{1,128}$/u,et=/^[-.%a-zA-Z0-9]{1,78}$/u,tt=/^(?<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,nt=/^(?<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,rt=Ke("CaipChainId",Ge),ot=(Ke("CaipNamespace",He),Ke("CaipReference",Ze),Ke("CaipAccountId",Je)),it=(Ke("CaipAccountAddress",Ye),Ke("CaipAssetNamespace",Qe),Ke("CaipAssetReference",Xe),Ke("CaipTokenId",et),Ke("CaipAssetType",tt)),at=Ke("CaipAssetId",nt),st=Ke("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 ct,ut,lt,dt;!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(ct=ct||(ct={})),function(e){e.Eoa="eip155:eoa",e.Erc4337="eip155:erc4337"}(ut||(ut={})),function(e){e.P2pkh="bip122:p2pkh",e.P2sh="bip122:p2sh",e.P2wpkh="bip122:p2wpkh",e.P2tr="bip122:p2tr"}(lt||(lt={})),function(e){e.DataAccount="solana:data-account"}(dt||(dt={}));const ft=ce({id:$,type:H([`${ut.Eoa}`,`${ut.Erc4337}`,`${lt.P2pkh}`,`${lt.P2sh}`,`${lt.P2wpkh}`,`${lt.P2tr}`,`${dt.DataAccount}`]),address:re(),scopes:pe(K(rt)),options:ne(re(),Le),methods:K(re())}),ht=(ee({address:ot}),ce({unit:re(),amount:W})),pt=ce({fungible:J(!0),type:it,...ht.schema}),gt=ce({fungible:J(!1),id:at}),mt=(yt=e=>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}}(e)&&!e.fungible?gt:pt,new O({type:"union",schema:null,*entries(e,t){yield*yt(e).entries(e,t)},*refiner(e,t){yield*yt(e).refiner(e,t)},coercer:(e,t)=>yt(e).coercer(e,t),validator:(e,t)=>yt(e).validator(e,t)}));var yt;const vt=ce({amount:W,unit:re()}),wt=Ke("DerivationPath",/^m(?:\/\d+'?)+$/u);var At;!function(e){e.Bip44="bip44"}(At||(At={}));const bt=ee({type:J(`${At.Bip44}`),scopes:K(rt),derivationPath:wt}),St=(ne(re(),Le),ce({id:F,scope:re(),account:F,origin:re(),request:ce({method:re(),params:le(ae([K(Le),ne(re(),Le)]))})})),Et=(ae([ce({pending:J(!0),redirect:le(ce({message:le(re()),url:le(re())}))}),ce({pending:J(!1),result:Le})]),ce({address:re(),asset:Q(mt)}));var kt;!function(e){e.Base="base",e.Priority="priority"}(kt||(kt={}));const Tt=ce({type:H([`${kt.Base}`,`${kt.Priority}`]),asset:mt});var It,xt;!function(e){e.Submitted="submitted",e.Unconfirmed="unconfirmed",e.Confirmed="confirmed",e.Failed="failed"}(It||(It={})),function(e){e.Send="send",e.Receive="receive",e.Swap="swap",e.BridgeSend="bridge:send",e.BridgeReceive="bridge:receive",e.Unknown="unknown"}(xt||(xt={}));const _t=ce({status:H([`${It.Submitted}`,`${It.Unconfirmed}`,`${It.Confirmed}`,`${It.Failed}`]),timestamp:Q(X())}),Ct=ce({id:re(),chain:rt,account:F,status:H([`${It.Submitted}`,`${It.Unconfirmed}`,`${It.Confirmed}`,`${It.Failed}`]),timestamp:Q(X()),type:H([`${xt.Send}`,`${xt.Receive}`,`${xt.Swap}`,`${xt.BridgeSend}`,`${xt.BridgeReceive}`,`${xt.Unknown}`]),from:K(Et),to:K(Et),fees:K(Tt),events:K(_t)}),Rt=(ce({data:K(Ct),next:Q(re())}),ce({limit:X(),next:le(Q(re()))})),Pt=ce({metamask:le(ce({correlationId:F}))});var Nt;!function(e){e.Mainnet="bip122:000000000019d6689c085ae165831e93",e.Testnet="bip122:000000000933ea01ad0ee984209779ba",e.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",e.Signet="bip122:00000008819873e925422c1ff0f99f7c",e.Regtest="bip122:regtest"}(Nt||(Nt={}));const Bt=(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}`)}},Ot=me(re(),"BtcP2pkhAddressStruct",(e=>Bt(e,k.p2pkh))),Mt=me(re(),"BtcP2shAddressStruct",(e=>Bt(e,k.p2sh))),zt=me(re(),"BtcP2wpkhAddressStruct",(e=>Bt(e,k.p2wpkh))),Ut=me(re(),"BtcP2trAddressStruct",(e=>Bt(e,k.p2tr)));var jt;!function(e){e.SendBitcoin="sendBitcoin"}(jt||(jt={}));const Lt=ce({...ft.schema,scopes:pe(K(rt)),methods:K(H([`${jt.SendBitcoin}`]))});ce({...Lt.schema,address:Ot,type:J(`${lt.P2pkh}`)}),ce({...Lt.schema,address:Mt,type:J(`${lt.P2sh}`)}),ce({...Lt.schema,address:zt,type:J(`${lt.P2wpkh}`)}),ce({...Lt.schema,address:Ut,type:J(`${lt.P2tr}`)});var Dt;!function(e){e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Dt||(Dt={}));const Ft=Ke("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var $t;!function(e){e.SendAndConfirmTransaction="sendAndConfirmTransaction",e.SignAndSendTransaction="signAndSendTransaction",e.SignTransaction="signTransaction",e.SignMessage="signMessage",e.SignIn="signIn"}($t||($t={}));ce({...ft.schema,address:Ft,type:J(`${dt.DataAccount}`),scopes:pe(K(rt)),methods:K(H(Object.values($t)))});var qt;!function(e){e.Eoa="eip155:0",e.Mainnet="eip155:1",e.Testnet="eip155:11155111"}(qt||(qt={}));const Wt=Ke("EthBytes",/^0x[0-9a-f]*$/iu),Vt=Ke("EthAddress",/^0x[0-9a-f]{40}$/iu),Kt=Ke("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu);var Gt;!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"}(Gt||(Gt={}));ce({...ft.schema,address:Vt,type:J(`${ut.Eoa}`),scopes:pe(K(J(qt.Eoa))),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTransaction}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`]))}),ce({...ft.schema,address:Vt,type:J(`${ut.Erc4337}`),scopes:pe(K(rt)),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`,`${Gt.PrepareUserOperation}`,`${Gt.PatchUserOperation}`,`${Gt.SignUserOperation}`]))}),ce({sender:Vt,nonce:Kt,initCode:Wt,callData:Wt,callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt,maxFeePerGas:Kt,maxPriorityFeePerGas:Kt,paymasterAndData:Wt,signature:Wt}),ce({to:Vt,value:Kt,data:Wt}),ce({nonce:Kt,initCode:Wt,callData:Wt,gasLimits:le(ce({callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt})),dummyPaymasterAndData:Wt,dummySignature:Wt,bundlerUrl:q}),ce({paymasterAndData:Wt,callGasLimit:le(Kt),verificationGasLimit:le(Kt),preVerificationGas:le(Kt)});var Ht;!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"}(Ht||(Ht={}));const Zt={jsonrpc:J("2.0"),id:ae([re(),X(),J(null)])},Jt=ce({...Zt,method:J("keyring_listAccounts")}),Yt=(K(ft),ce({...Zt,method:J("keyring_getAccount"),params:ce({id:F})})),Qt=ce({...Zt,method:J("keyring_createAccount"),params:ce({options:ne(re(),Le)})}),Xt=ce({...Zt,method:J("keyring_discoverAccounts"),params:ce({scopes:K(rt),entropySource:re(),groupIndex:X()})}),en=(K(bt),ce({...Zt,method:J("keyring_listAccountTransactions"),params:ce({id:F,pagination:Rt})})),tn=ce({...Zt,method:J("keyring_listAccountAssets"),params:ce({id:F})}),nn=K(st),rn=ce({...Zt,method:J(`${Ht.GetAccountBalances}`),params:ce({id:F,assets:K(it)})}),on=(ne(it,vt),ce({...Zt,method:J("keyring_resolveAccountAddress"),params:ce({scope:rt,request:Pe})})),an=(Q(ce({address:ot})),ce({...Zt,method:J("keyring_filterAccountChains"),params:ce({id:F,chains:K(re())})})),sn=(K(re()),ce({...Zt,method:J("keyring_updateAccount"),params:ce({account:ft})})),cn=(J(null),ce({...Zt,method:J("keyring_deleteAccount"),params:ce({id:F})})),un=(J(null),ce({...Zt,method:J("keyring_exportAccount"),params:ce({id:F})})),ln=ce({...Zt,method:J("keyring_listRequests")}),dn=(K(St),ce({...Zt,method:J("keyring_getRequest"),params:ce({id:F})})),fn=ce({...Zt,method:J("keyring_submitRequest"),params:St}),hn=ce({...Zt,method:J("keyring_approveRequest"),params:ce({id:F,data:ne(re(),Le)})}),pn=(J(null),ce({...Zt,method:J("keyring_rejectRequest"),params:ce({id:F})}));J(null);var gn;!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"}(gn||(gn={}));ce({method:J(`${gn.AccountCreated}`),params:ce({account:ft,accountNameSuggestion:le(re()),displayConfirmation:le(G()),displayAccountNameSuggestion:le(G()),...Pt.schema})}),ce({method:J(`${gn.AccountUpdated}`),params:ce({account:ft})}),ce({method:J(`${gn.AccountDeleted}`),params:ce({id:F})}),ce({method:J(`${gn.RequestApproved}`),params:ce({id:F,result:Le})}),ce({method:J(`${gn.RequestRejected}`),params:ce({id:F})}),ce({method:J(`${gn.AccountBalancesUpdated}`),params:ce({balances:ne($,ne(it,ht))})}),ce({method:J(`${gn.AccountTransactionsUpdated}`),params:ce({transactions:ne($,K(Ct))})}),ce({method:J(`${gn.AccountAssetListUpdated}`),params:ce({assets:ne($,ce({added:K(st),removed:K(st)}))})});class mn extends Error{constructor(e){super(`Method not supported: ${e}`)}}async function yn(e,t){try{return await async function(e,t){switch(M(t,Pe),t.method){case`${Ht.ListAccounts}`:return M(t,Jt),e.listAccounts();case`${Ht.GetAccount}`:return M(t,Yt),e.getAccount(t.params.id);case`${Ht.CreateAccount}`:return M(t,Qt),e.createAccount(t.params.options);case`${Ht.DiscoverAccounts}`:if(void 0===e.discoverAccounts)throw new mn(t.method);return M(t,Xt),e.discoverAccounts(t.params.scopes,t.params.entropySource,t.params.groupIndex);case`${Ht.ListAccountTransactions}`:if(void 0===e.listAccountTransactions)throw new mn(t.method);return M(t,en),e.listAccountTransactions(t.params.id,t.params.pagination);case`${Ht.ListAccountAssets}`:if(void 0===e.listAccountAssets)throw new mn(t.method);return M(t,tn),e.listAccountAssets(t.params.id);case`${Ht.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new mn(t.method);return M(t,rn),e.getAccountBalances(t.params.id,t.params.assets);case`${Ht.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new mn(t.method);return M(t,on),e.resolveAccountAddress(t.params.scope,t.params.request);case`${Ht.FilterAccountChains}`:return M(t,an),e.filterAccountChains(t.params.id,t.params.chains);case`${Ht.UpdateAccount}`:return M(t,sn),e.updateAccount(t.params.account);case`${Ht.DeleteAccount}`:return M(t,cn),e.deleteAccount(t.params.id);case`${Ht.ExportAccount}`:if(void 0===e.exportAccount)throw new mn(t.method);return M(t,un),e.exportAccount(t.params.id);case`${Ht.ListRequests}`:if(void 0===e.listRequests)throw new mn(t.method);return M(t,ln),e.listRequests();case`${Ht.GetRequest}`:if(void 0===e.getRequest)throw new mn(t.method);return M(t,dn),e.getRequest(t.params.id);case`${Ht.SubmitRequest}`:return M(t,fn),e.submitRequest(t.params);case`${Ht.ApproveRequest}`:if(void 0===e.approveRequest)throw new mn(t.method);return M(t,hn),e.approveRequest(t.params.id,t.params.data);case`${Ht.RejectRequest}`:if(void 0===e.rejectRequest)throw new mn(t.method);return M(t,pn),e.rejectRequest(t.params.id);default:throw new mn(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)}}async function vn(e,t,n){await e.request({method:"snap_manageAccounts",params:{method:t,params:{...n}}})}function wn(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const An=(e,t)=>Object.hasOwnProperty.call(e,t);var bn;!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"}(bn=bn||(bn={}));function Sn(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}}var En=n(282);class kn 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 Tn(e){return"object"==typeof e&&null!==e}function In(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function xn(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: \`${In(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*_n(e,t,n,r){(function(e){return Tn(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=xn(o,t,n,r);e&&(yield e)}}function*Cn(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&&Tn(t.schema)&&Tn(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=Cn(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):Tn(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 Rn{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)=>_n(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>_n(o(e,t),t,this,e):()=>[]}assert(e,t){return Pn(e,this,t)}create(e,t){return Nn(e,this,t)}is(e){return Bn(e,this)}mask(e,t){return function(e,t,n){const r=On(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return On(e,this,t)}}function Pn(e,t,n){const r=On(e,t,{message:n});if(r[0])throw r[0]}function Nn(e,t,n){const r=On(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Bn(e,t){return!On(e,t)[0]}function On(e,t,n={}){const r=Cn(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new kn(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Mn(e,t){return new Rn({type:e,schema:null,validator:t})}function zn(){return Mn("never",(()=>!1))}function Un(e){const t=e?Object.keys(e):[],n=zn();return new Rn({type:"object",schema:e??null,*entries(r){if(e&&Tn(r)){const o=new Set(Object.keys(r));for(const n of t)o.delete(n),yield[n,r[n],e[n]];for(const e of o)yield[e,r[e],n]}},validator:e=>Tn(e)||`Expected an object, but received: ${In(e)}`,coercer:e=>Tn(e)?{...e}:e})}function jn(e){return new Rn({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function Ln(){return Mn("string",(e=>"string"==typeof e||`Expected a string, but received: ${In(e)}`))}function Dn(e){const t=e.map((e=>e.type)).join(" | ");return new Rn({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]=Cn(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: ${In(n)}`,...o]}})}function Fn(e,t,n){return new Rn({...e,coercer:(r,o)=>Bn(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function $n(e,t,n){return new Rn({...e,*refiner(r,o){yield*e.refiner(r,o);const i=_n(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const qn=e=>Un(e);function Wn({path:e,branch:t}){const n=e[e.length-1];return An(t[t.length-2],n)}function Vn(e){return new Rn({...e,type:`optional ${e.type}`,validator:(t,n)=>!Wn(n)||e.validator(t,n),refiner:(t,n)=>!Wn(n)||e.refiner(t,n)})}function Kn(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(!Kn(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]||!Kn(n[e][1])){t=!1;break}return t}return!1}const Gn=Mn("JSON",(e=>Kn(e))),Hn=Fn(Gn,$n(Mn("any",(()=>!0)),"JSON",(e=>Bn(e,Gn))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Zn(e){try{return function(e){Nn(e,Hn)}(e),!0}catch{return!1}}const Jn=function(e){const t=In(e),n=typeof e;return new Rn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${In(n)}`})}("2.0"),Yn=(Qn=Dn([Mn("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${In(e)}`)),Ln()]),new Rn({...Qn,validator:(e,t)=>null===e||Qn.validator(e,t),refiner:(e,t)=>null===e||Qn.refiner(e,t)}));var Qn;const Xn=qn({code:Mn("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${In(e)}`)),message:Ln(),data:Vn(Hn),stack:Vn(Ln())}),er=Dn([function(e,t){return new Rn({type:"record",schema:null,*entries(n){if(Tn(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>Tn(e)||`Expected an object, but received: ${In(e)}`})}(Ln(),Hn),(tr=Hn,new Rn({type:"array",schema:tr,*entries(e){if(tr&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,tr]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${In(e)}`}))]);var tr;qn({id:Yn,jsonrpc:Jn,method:Ln(),params:Vn(er)}),qn({jsonrpc:Jn,method:Ln(),params:Vn(er)});Un({id:Yn,jsonrpc:Jn,result:jn(Mn("unknown",(()=>!0))),error:jn(Xn)});const nr=qn({id:Yn,jsonrpc:Jn,result:Hn}),rr=qn({id:Yn,jsonrpc:Jn,error:Xn});Dn([nr,rr]);const or={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},ir={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},ar={"-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."}},sr=or.internal,cr="Unspecified error message. This is a bug, please report it.",ur=(lr(sr),"Unspecified server error.");function lr(e,t=cr){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(An(ar,t))return ar[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return ur}return t}function dr(e){return Array.isArray(e)?e.map((e=>Zn(e)?e:wn(e)?fr(e):null)):wn(e)?fr(e):Zn(e)?e:null}function fr(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Zn(r)&&(t[n]=r),t}),{})}const hr=function(e){return e?.__esModule?e.default:e}(En);class pr 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 wn(e)&&An(e,"cause")&&wn(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),An(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,Sn(this.data)&&(e.data.cause=dr(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return hr(this.serialize(),mr,2)}}class gr extends pr{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 mr(e,t){if("[Circular]"!==t)return t}const yr=e=>Br(or.parse,e),vr=e=>Br(or.invalidRequest,e),wr=e=>Br(or.invalidParams,e),Ar=e=>Br(or.methodNotFound,e),br=e=>Br(or.internal,e),Sr=e=>Br(or.invalidInput,e),Er=e=>Br(or.resourceNotFound,e),kr=e=>Br(or.resourceUnavailable,e),Tr=e=>Br(or.transactionRejected,e),Ir=e=>Br(or.methodNotSupported,e),xr=e=>Br(or.limitExceeded,e),_r=e=>Or(ir.userRejectedRequest,e),Cr=e=>Or(ir.unauthorized,e),Rr=e=>Or(ir.unsupportedMethod,e),Pr=e=>Or(ir.disconnected,e),Nr=e=>Or(ir.chainDisconnected,e);function Br(e,t){const[n,r]=Mr(t);return new pr(e,n??lr(e),r)}function Or(e,t){const[n,r]=Mr(t);return new gr(e,n??lr(e),r)}function Mr(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[]}function zr(e,t,n=null){return wn(e)&&An(e,t)?e[t]:n}function Ur(e,t,n=String(e)){const r=zr(e,t);return"string"==typeof r?r:n}function jr(e){return Ur(e,"message")}function Lr(e){return Ur(e,"stack",null)}function Dr(e){return Ur(e,"name",e instanceof Error?e.name:"Error")}function Fr(e){const t=zr(e,"data");return null!==t&&Zn(t)&&!Array.isArray(t)?t:{}}class $r extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=jr(e);super(n),this.#t=n,this.#e=function(e){const t=zr(e,"code");return"number"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Fr(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 qr(e){if("string"==typeof e)return{name:"Error",message:e,stack:null,cause:null};if(Bn(e,Xn))return{name:"JsonRpcError",message:jr(e),stack:Lr(e)??Lr(e.data)??null,cause:null};const t=function(e){return zr(e,"cause")}(e);return{name:Dr(e),message:jr(e),stack:Lr(e)??null,cause:null===t?null:qr(t)}}function Wr(e){return class extends $r{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 Vr=Wr(br),Kr=Wr(Sr),Gr=Wr(wr),Hr=Wr(vr),Zr=Wr(xr),Jr=Wr(Ar),Yr=Wr(Ir),Qr=Wr(yr),Xr=Wr(Er),eo=Wr(kr),to=Wr(Tr),no=Wr(Nr),ro=Wr(Pr),oo=Wr(Cr),io=Wr(Rr),ao=Wr(_r);var so=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,co=Math.ceil,uo=Math.floor,lo="[BigNumber Error] ",fo=lo+"Number primitive has more than 15 significant digits: ",ho=1e14,po=14,go=9007199254740991,mo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yo=1e7,vo=1e9;function wo(e){var t=0|e;return e>0||e===t?t:t-1}function Ao(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=po-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function bo(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 So(e,t,n,r){if(e<t||e>n||e!==uo(e))throw Error(lo+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Eo(e){var t=e.c.length-1;return wo(e.e/po)==t&&e.c[t]%2!=0}function ko(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function To(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 Io=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,v=-1e7,w=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>w?f.c=f.e=null:e.e<v?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>w?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!so.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(So(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(fo+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>go||e!==uo(e)))throw Error(fo+f.s*e);if((s=s-c-1)>w)f.c=f.e=null;else if(s<v)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%po,s<0&&(c+=po),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=po;c<l;)f.c.push(+d.slice(c,c+=po));c=po-(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:So(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)c=Ao(e.c),c=1==r||2==r&&(a<=m||a>=y)?ko(c,a):To(c,a,"0");else if(i=(e=R(new I(e),t,n)).e,s=(c=Ao(e.c)).length,1==r||2==r&&(t<=i||i<=m)){for(;s<t;c+="0",s++);c=ko(c,i)}else if(t-=a,c=To(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=bo(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*po-1)>w?e.c=e.e=null:n<v?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=mo;if(d){e:{for(o=1,s=d[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=po,a=t,c=d[u=0],l=uo(c/f[o-a-1]%10);else if((u=co((i+1)/po))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,o=1,a=(i%=po)-po+1}else{for(c=s=d[u],o=1;s>=10;s/=10,o++);l=(a=(i%=po)-po+o)<0?0:uo(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[(po-t%po)%po],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[po-i],d[u]=a>0?uo(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]==ho&&(d[0]=1));break}if(d[u]+=s,d[u]!=ho)break;d[u--]=0,s=1}for(i=d.length;0===d[--i];d.pop());}e.e>w?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=Ao(e.c),t=n<=m||n>=y?ko(t,n):To(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(lo+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(So(n=e[t],0,vo,t),p=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(So(n=e[t],0,8,t),g=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(So(n[0],-vo,0,t),So(n[1],0,vo,t),m=n[0],y=n[1]):(So(n,-vo,vo,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)So(n[0],-vo,-1,t),So(n[1],1,vo,t),v=n[0],w=n[1];else{if(So(n,-vo,vo,t),!n)throw Error(lo+t+" cannot be zero: "+n);v=-(w=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(lo+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(lo+"crypto unavailable");A=n}else A=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(So(n=e[t],0,9,t),b=n),e.hasOwnProperty(t="POW_PRECISION")&&(So(n=e[t],0,vo,t),S=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(lo+t+" not an object: "+n);E=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(lo+t+" invalid: "+n);T="0123456789"==n.slice(0,10),k=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[v,w],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>=-vo&&o<=vo&&o===uo(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%po)<1&&(t+=po),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ho||n!==uo(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(lo+"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 uo(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:So(e,0,vo),o=co(e/po),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(lo+"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%=po,o&&e&&(i=mo[po-e],c[s]=uo(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-=po);for(s=1,i=c[0];i>=10;i/=10,s++);s<po&&(r-=po-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,v=r.indexOf("."),w=p,A=g;for(v>=0&&(d=S,S=0,r=r.replace(".",""),h=(y=new I(o)).pow(r.length-v),S=d,y.c=t(To(Ao(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(v<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,w,A,i)).c,f=h.r,l=h.e),v=m[u=l+w+1],d=i/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=v||f)&&(0==A||A==(h.s<0?3:2)):v>d||v==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?To(c.charAt(1),-w,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(v=0,r="";v<=d;r+=c.charAt(m[v++]));r=To(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%yo,l=t/yo|0;for(e=e.slice();c--;)s=((o=u*(i=e[c]%yo)+(r=l*i+(a=e[c]/yo|0)*u)%yo*yo+s)/n|0)+(r/yo|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,v,w,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=ho,u=wo(r.e/po)-wo(o.e/po),T=T/po|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=uo(s/(_[0]+1)))>1&&(_=e(_,f,s),x=e(x,f,s),E=_.length,b=x.length),A=E,v=(y=x.slice(0,E)).length;v<E;y[v++]=0);k=_.slice(),k=[0].concat(k),S=_[0],_[1]>=s/2&&S++;do{if(f=0,(c=t(_,y,E,v))<0){if(w=y[0],E!=v&&(w=w*s+(y[1]||0)),(f=uo(w/S))>1)for(f>=s&&(f=s-1),p=(h=e(_,f,s)).length,v=y.length;1==t(h,y,p,v);)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<v&&(h=[0].concat(h)),n(y,h,v,s),v=y.length,-1==c)for(;t(_,y,E,v)<1;)f++,n(y,E<v?k:_,v,s),v=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[v++]=x[A]||0:(y=[x[A]],v=1)}while((A++<b||null!=y[0])&&T--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==ho){for(l=1,T=m[0];T>=10;T/=10,l++);R(g,i+(g.e=l+u*po-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(lo+"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 bo(this,new I(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,o,i=this;if(null!=e)return So(e,0,vo),null==t?t=g:So(t,0,8),R(new I(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-wo(this.e/po))*po,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(lo+"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-Eo(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&&Eo(e)?-0:0,l.e>-1&&(i=1/i),new I(s?1/i:i);S&&(i=co(S/po+2))}for(a?(n=new I(.5),s&&(e.s=1),c=Eo(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=uo(o/2)))break;c=o%2}else if(R(e=e.times(n),e.e+1,1),e.e>14)c=Eo(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:So(e,0,8),R(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===bo(this,new I(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return bo(this,new I(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=bo(this,new I(e,t)))||0===t},f.isInteger=function(){return!!this.c&&wo(this.e/po)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return bo(this,new I(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=bo(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/po,u=e.e/po,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=wo(c),u=wo(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=ho-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=ho}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,v=y.c,w=(e=new I(e,t)).c;if(!(v&&w&&v[0]&&w[0]))return!y.s||!e.s||v&&!v[0]&&!w||w&&!w[0]&&!v?e.c=e.e=e.s=null:(e.s*=y.s,v&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=wo(y.e/po)+wo(e.e/po),e.s*=y.s,(c=v.length)<(d=w.length)&&(p=v,v=w,w=p,o=c,c=d,d=o),o=c+d,p=[];o--;p.push(0));for(g=ho,m=yo,o=d;--o>=0;){for(n=0,f=w[o]%m,h=w[o]/m|0,i=o+(a=c);i>o;)n=((u=f*(u=v[--a]%m)+(s=h*u+(l=v[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/po,a=e.e/po,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=wo(i),a=wo(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)/ho|0,s[t]=ho===s[t]?0:s[t]%ho;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 So(e,1,vo),null==t?t=g:So(t,0,8),R(new I(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*po+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 So(e,-9007199254740991,go),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=Ao(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=wo((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))),Ao(i.c).slice(0,c)===(t=Ao(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&&(So(e,0,vo),e++),x(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(So(e,0,vo),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(lo+"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(lo+"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=Ao(y),a=t.e=p.length-m.e-1,t.c[0]=mo[(s=a%po)<0?po+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=w,w=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],w=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&So(e,1,vo),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?ko(Ao(n.c),i):To(Ao(n.c),i,"0"):10===e&&T?t=To(Ao((n=R(new I(n),p+i+1,g)).c),n.e,"0"):(So(e,2,k.length,"Base"),t=r(To(Ao(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 xo=Io;function _o(e,t){return L(e,(e=>"string"==typeof e&&t.test(e)))}const Co=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Ro=/^[-a-z0-9]{3,8}$/u,Po=/^[-_a-zA-Z0-9]{1,32}$/u,No=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Bo=/^[-.%a-zA-Z0-9]{1,128}$/u,Oo=/^[-a-z0-9]{3,8}$/u,Mo=/^[-.%a-zA-Z0-9]{1,128}$/u,zo=/^[-.%a-zA-Z0-9]{1,78}$/u,Uo=/^(?<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,jo=/^(?<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,Lo=(_o("CaipChainId",Co),_o("CaipNamespace",Ro),_o("CaipReference",Po),_o("CaipAccountId",No),_o("CaipAccountAddress",Bo),_o("CaipAssetNamespace",Oo),_o("CaipAssetReference",Mo),_o("CaipTokenId",zo),_o("CaipAssetType",Uo));_o("CaipAssetId",jo),_o("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 Do;function Fo(e){const t=Uo.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 $o(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"}(Do=Do||(Do={}));class qo extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Wo(e,t="Assertion failed.",n=qo){if(!e){if(t instanceof Error)throw t;throw $o(n,t)}}var Vo=4,Ko=5,Go=6,Ho=10,Zo=-32700,Jo=-32603,Yo=-32602,Qo=-32601,Xo=-32600,ei=-32015,ti=-32014,ni=-32012,ri=-32010,oi=-32009,ii=-32007,ai=-32006,si=-32004,ci=-32002,ui=-32001,li=28e5,di=2800001,fi=2800003,hi=2800006,pi=2800007,gi=2800008,mi=2800009,yi=323e4,vi=32300001,wi=3230002,Ai=3230004,bi=361e4,Si=3610001,Ei=3610003,ki=3610005,Ti=3610006,Ii=3610007,xi=3704001,_i=3704002,Ci=3704003,Ri=4615e3,Pi=4615026,Ni=4615045,Bi=5508e3,Oi=5663e3,Mi=5663001,zi=5663004,Ui=5663005,ji=5663006,Li=5663007,Di=5663008,Fi=5663009,$i=5663012,qi=5663015,Wi=5663016,Vi=5663017,Ki=5663018,Gi=5663019,Hi=705e4,Zi=7050030,Ji=7050031,Yi=7050035,Qi=8078e3,Xi=8078001,ea=8078002,ta=8078004,na=8078005,ra=8078006,oa=8078007,ia=8078008,aa=8078010,sa=8078011,ca=8078012,ua=8078013,la=8078014,da=8078017,fa=8078018,ha=8078022,pa=81e5,ga=8100002,ma=8100003,ya=9900003;function va(e){if(Array.isArray(e)){return"%5B"+e.map(va).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function wa([e,t]){return`${e}=${va(t)}`}function Aa(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(wa).join("&");return btoa(t)}(t)}'`),`${n}\``}}function ba(e,t){return!!(e instanceof Error&&"SolanaError"===e.name)&&(void 0===t||e.context.__code===t)}var Sa=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(Aa(e,n),r),this.context={__code:e,...n},this.name="SolanaError"}};function Ea(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function ka({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 Sa(s,c);return Ea(u,o),u}var Ta=["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 Ia(e,t){const n=Number(e);return ka({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===Ri?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===Pi?{code:Number(r),index:n}:e===Ni?{encodedData:r,index:n}:{index:n},orderedErrorNames:Ta,rpcEnumError:t},Ia)}var xa=["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 _a(e){return"object"==typeof e&&"InstructionError"in e?Ia(...e.InstructionError):ka({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===Hi?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===Zi?{index:Number(n)}:e===Ji||e===Yi?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:xa,rpcEnumError:e},_a)}function Ca(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===ci){const{err:e,...n}=r,o=e?{cause:_a(e)}:null;t=new Sa(ci,{...n,...o})}else{let e;switch(i){case Jo:case Yo:case Xo:case Qo:case Zo:case ni:case ui:case si:case ti:case ri:case oi:case ii:case ai:case ei:e={__serverMessage:o};break;default:"object"!=typeof r||Array.isArray(r)||(e=r)}t=new Sa(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 Sa(Ho,{error:e,message:n})}var n;return Ea(t,Ca),t}var Ra=(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 Pa(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 Na(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function Ba(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(Na(t,e));return e.write(t,n,0),n}})}function Oa(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function Ma(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function za(e){if(!Ma(e))throw new Sa(ea)}function Ua(e){return!Ma(e)}function ja(e,t){if(Ma(e)!==Ma(t))throw new Sa(ta);if(Ma(e)&&Ma(t)&&e.fixedSize!==t.fixedSize)throw new Sa(na,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!Ma(e)&&!Ma(t)&&e.maxSize!==t.maxSize)throw new Sa(ra,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function La(e,t,n,r=0){const o=n.length-r;if(o<t)throw new Sa(Xi,{bytesLength:o,codecDescription:e,expected:t})}function Da(e,t,n){if(t<0||t>n)throw new Sa(la,{bytesLength:n,codecDescription:e,offset:t})}function Fa(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(Ma(t)&&Ma(e))return Ba({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=Ma(t)?t.fixedSize:t.maxSize??null,o=Ma(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Ba({...e,...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=Na(n,e);return Na(r,t)+r},write:n})}function $a(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)),La("addDecoderSizePrefix",a,n),[e.decode(n),r+a]};if(Ma(t)&&Ma(e))return Oa({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=Ma(t)?t.fixedSize:t.maxSize??null,o=Ma(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Oa({...e,...null!==i?{maxSize:i}:{},read:n})}function qa(e,t){return Ba({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 Wa(e,t){return Oa({fixedSize:t,read:(n,r)=>{La("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),Ma(e)&&(n=Ra(n,e.fixedSize));const[o]=e.read(n,0);return[o,r+t]}})}function Va(e,t){return Ba({...e,write:(n,r,o)=>{const i=e=>Ga(e,r.length),a=t.preOffset?t.preOffset({bytes:r,preOffset:o,wrapBytes:i}):o;Da("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 Da("offsetEncoder",c,r.length),c}})}function Ka(e,t){return Oa({...e,read:(n,r)=>{const o=e=>Ga(e,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Da("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 Da("offsetDecoder",c,n.length),[a,c]}})}function Ga(e,t){return 0===t?0:(e%t+t)%t}function Ha(e,t){if(Ma(e)){const n=t(e.fixedSize);if(n<0)throw new Sa(ua,{bytesLength:n,codecDescription:"resizeEncoder"});return Ba({...e,fixedSize:n})}return Ba({...e,getSizeFromValue:n=>{const r=t(e.getSizeFromValue(n));if(r<0)throw new Sa(ua,{bytesLength:r,codecDescription:"resizeEncoder"});return r}})}function Za(e,t){if(Ma(e)){const n=t(e.fixedSize);if(n<0)throw new Sa(ua,{bytesLength:n,codecDescription:"resizeDecoder"});return Oa({...e,fixedSize:n})}return e}function Ja(e,t){return Va(Ha(e,(e=>e+t)),{preOffset:({preOffset:e})=>e+t})}function Ya(e,t){return Ka(Za(e,(e=>e+t)),{postOffset:({postOffset:e})=>e+t})}function Qa(e,t){return Ba({...Ua(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function Xa(e,t){return Oa({...e,read:(n,r)=>{const[o,i]=e.read(n,r);return[t(o,n,r),i]}})}function es(e,t,n,r){if(r<t||r>n)throw new Sa(sa,{codecDescription:e,max:n,min:t,value:r})}var ts,ns=((ts=ns||{})[ts.Little=0]="Little",ts[ts.Big=1]="Big",ts);function rs(e){return 1!==e?.endian}function os(e){return Ba({fixedSize:e.size,write(t,n,r){e.range&&es(e.name,e.range[0],e.range[1],t);const o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,rs(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function is(e){return Oa({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Sa(Qi,{codecDescription:e})}(e.name,t,n),La(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,rs(e.config)),n+e.size]}})}var as=(e={})=>is({config:e,get:(e,t)=>e.getFloat64(0,t),name:"f64",size:8}),ss=(e={})=>is({config:e,get:(e,t)=>e.getInt16(0,t),name:"i16",size:2}),cs=(e={})=>is({config:e,get:(e,t)=>e.getBigInt64(0,t),name:"i64",size:8}),us=()=>is({get:e=>e.getInt8(0),name:"i8",size:1}),ls=()=>Ba({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{es("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}}),ds=()=>Oa({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,0==(128&i))break}return[n,t+r]}}),fs=(e={})=>is({config:e,get:(e,t)=>e.getUint16(0,t),name:"u16",size:2}),hs=(e={})=>os({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),ps=(e={})=>is({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),gs=(e={})=>os({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),ms=(e={})=>is({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}),ys=()=>os({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),vs=()=>is({get:e=>e.getUint8(0),name:"u8",size:1});var ws,As=((ws=As||{})[ws.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",ws[ws.READONLY_SIGNER=2]="READONLY_SIGNER",ws[ws.WRITABLE=1]="WRITABLE",ws[ws.READONLY=0]="READONLY",ws),bs=2,Ss=1;function Es(e){return e>=2}function ks(e){return 0!=(e&Ss)}function Ts(e,t){return e|t}function Is(e){return e|bs}function xs(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Sa(ca,{alphabet:e,base:e.length,value:n})}var _s=e=>Ba({getSizeFromValue:t=>{const[n,r]=Ps(t,e[0]);if(!r)return t.length;const o=Ns(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(xs(e,t),""===t)return r;const[o,i]=Ps(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=Ns(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}}),Cs=e=>Oa({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]}}),Rs=e=>ja(_s(e),Cs(e));function Ps(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function Ns(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 Bs="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Os=()=>_s(Bs),Ms=()=>Cs(Bs),zs=()=>Rs(Bs);var Us,js,Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ds=()=>Ba({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Sa(ca,{alphabet:Ls,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 Sa(ca,{alphabet:Ls,base:64,value:e})}}}),Fs=()=>Oa({read(e,t=0){const n=e.slice(t);return[btoa(String.fromCharCode(...n)),e.length]}}),$s=()=>ja(Ds(),Fs()),qs=e=>e.replace(/\u0000/g,""),Ws=globalThis.TextDecoder,Vs=globalThis.TextEncoder,Ks=()=>{let e;return Oa({read(t,n){const r=(e||=new Ws).decode(t.slice(n));return[qs(r),t.length]}})},Gs=()=>ja((()=>{let e;return Ba({getSizeFromValue:t=>(e||=new Vs).encode(t).length,write:(t,n,r)=>{const o=(e||=new Vs).encode(t);return n.set(o,r),r+o.length}})})(),Ks());function Hs(){if(!globalThis.isSecureContext)throw new Sa(bi)}function Zs(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new Sa(Ei)}function Js(){return Us||(Us=Os()),Us}function Ys(e){if(e.length<32||e.length>44)return!1;const t=Js();try{return 32===t.encode(e).byteLength}catch{return!1}}function Qs(e){if(e.length<32||e.length>44)throw new Sa(di,{actualLength:e.length});const t=Js().encode(e).byteLength;if(32!==t)throw new Sa(li,{actualLength:t})}function Xs(e){return Qs(e),e}function ec(){return Qa(qa(Js(),32),(e=>Xs(e)))}function tc(){return Wa((js||(js=Ms()),js),32)}function nc(){return ja(ec(),tc())}function rc(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var oc=37095705934669439343138083508754565189542113879843219016388785533085940283555n,ic=57896044618658097711785492504343953926634992332820282019728792003956564819949n,ac=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function sc(e){const t=e%ic;return t>=0n?t:ic+t}function cc(e,t){let n=e;for(;t-- >0n;)n*=n,n%=ic;return n}function uc(e,t){const n=sc(t*t*t),r=function(e){const t=e*e%ic*e%ic,n=cc(t,2n)*t%ic,r=cc(n,1n)*e%ic,o=cc(r,5n)*r%ic,i=cc(o,10n)*o%ic,a=cc(i,20n)*i%ic,s=cc(a,40n)*a%ic,c=cc(s,80n)*s%ic,u=cc(c,80n)*s%ic,l=cc(u,10n)*o%ic;return cc(l,2n)*e%ic}(e*sc(n*n*t));let o=sc(e*n*r);const i=sc(t*o*o),a=o,s=sc(o*ac),c=i===e,u=i===sc(-e),l=i===sc(-e*ac);return c&&(o=a),(u||l)&&(o=s),1n===(1n&sc(o))&&(o=sc(-o)),c||u?o:null}function lc(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=sc(e*e),r=uc(sc(n-1n),sc(oc*n+1n));return null!==r&&(0n!==r||!(0!=(128&t)))}(t,e[31])}var dc=32,fc=16,hc=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function pc({programAddress:e,seeds:t}){if(function(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new Sa(Si)}(),t.length>fc)throw new Sa(hi,{actual:t.length,maxSeeds:fc});let n;const r=t.reduce(((e,t,r)=>{const o="string"==typeof t?(n||=new TextEncoder).encode(t):t;if(o.byteLength>dc)throw new Sa(pi,{actual:o.byteLength,index:r,maxSeedLength:dc});return e.push(...o),e}),[]),o=nc(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...hc])),s=new Uint8Array(a);if(lc(s))throw new Sa(gi);return o.decode(s)}async function gc({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await pc({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!ba(e,gi))throw e;n--}throw new Sa(mi)}async function mc(e){if(Zs(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new Sa(fi);const t=await crypto.subtle.exportKey("raw",e);return tc().decode(new Uint8Array(t))}var yc,vc=Object.freeze({name:"Ed25519"});async function wc(e,t){const n=e.byteLength;if(32!==n)throw new Sa(xi,{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,vc,t??!1,["sign"])}async function Ac(e,t){!function(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new Sa(ki)}();const n=await crypto.subtle.sign(vc,e,t);return new Uint8Array(n)}function bc(e){return function(e){if(yc||(yc=Os()),e.length<64||e.length>88)throw new Sa(Ci,{actualLength:e.length});const t=yc.encode(e).byteLength;if(64!==t)throw new Sa(_i,{actualLength:t})}(e),e}async function Sc(e,t,n){return function(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new Sa(Ti)}(),await crypto.subtle.verify(vc,e,t,n)}async function Ec(e,t=!1){const n=wc(e,t),[r,o]=await Promise.all([(t?n:wc(e,!0)).then((async e=>await async function(e,t=!1){if(Zs(),!1===e.extractable)throw new Sa(Ii,{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 kc(e,t,n){if(t!==n)throw new Sa(oa,{actual:n,codecDescription:e,expected:t})}function Tc(e){return e.reduce(((e,t)=>null===e||null===t?null:e+t),0)}function Ic(e){return Ma(e)?e.fixedSize:null}function xc(e){return Ma(e)?e.fixedSize:e.maxSize??null}function _c(e,t={}){const n=t.size??hs(),r=Rc(n,Ic(e)),o=Rc(n,xc(e))??void 0;return Ba({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>("object"==typeof n?Na(t.length,n):0)+[...t].reduce(((t,n)=>t+Na(n,e)),0),maxSize:o},write:(t,r,o)=>("number"==typeof n&&kc("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 Cc(e,t={}){const n=t.size??ps(),r=Ic(e),o=Rc(n,r),i=Rc(n,xc(e))??void 0;return Oa({...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 Rc(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function Pc(e={}){return Qa(e.size??ys(),(e=>e?1:0))}function Nc(e={}){return Xa(e.size??vs(),(e=>1===Number(e)))}function Bc(){return Ba({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Oc(){return Oa({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}var Mc=()=>Oa({read(e,t){const n=e.slice(t).reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"");return[n,e.length]}});function zc(e){return Ba({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function Uc(e){return Oa({fixedSize:e.length,read:(t,n)=>{const r=Mc();if(!Pa(t,e,n))throw new Sa(fa,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function jc(e){const t=Tc(e.map(Ic)),n=Tc(e.map(xc))??void 0;return Ba({...null===t?{getSizeFromValue:t=>e.map(((e,n)=>Na(t[n],e))).reduce(((e,t)=>e+t),0),maxSize:n}:{fixedSize:t},write:(t,n,r)=>(kc("tuple",e.length,t.length),e.forEach(((e,o)=>{r=e.write(t[o],n,r)})),r)})}function Lc(e){const t=Tc(e.map(Ic)),n=Tc(e.map(xc))??void 0;return Oa({...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 Dc(e,t){const n=qc(e),r=(n,r,o)=>{const i=t(n);return $c(e,i),e[i].write(n,r,o)};if(null!==n)return Ba({fixedSize:n,write:r});const o=Wc(e);return Ba({...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=t(n);return $c(e,r),Na(n,e[r])},write:r})}function Fc(e,t){const n=qc(e),r=(n,r)=>{const o=t(n,r);return $c(e,o),e[o].read(n,r)};if(null!==n)return Oa({fixedSize:n,read:r});const o=Wc(e);return Oa({...null!==o?{maxSize:o}:{},read:r})}function $c(e,t){if(void 0===e[t])throw new Sa(da,{maxRange:e.length-1,minRange:0,variant:t})}function qc(e){if(0===e.length)return 0;if(!Ma(e[0]))return null;const t=e[0].fixedSize;return e.every((e=>Ma(e)&&e.fixedSize===t))?t:null}function Wc(e){return e.map((e=>xc(e))).reduce(((e,t)=>null===e||null===t?null:Math.max(e,t)),0)}function Vc(e,t={}){const n=t.discriminator??"__kind",r=t.size??vs();return Fc(e.map((([e,t])=>Xa(Lc([r,t]),(([,t])=>({[n]:e,...t}))))),((e,t)=>Number(r.read(e,t)[0])))}function Kc(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 Gc(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function Hc(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 Zc(e,t={}){const n=t.size??ys(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=Kc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Sa(ha,{stringValues:i.filter((e=>"string"==typeof e))});return Qa(n,(e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=Gc(t,(e=>e===n));return r>=0?r:e.findIndex((e=>e===n))}({enumKeys:o,enumValues:i,variant:e});if(t<0)throw new Sa(aa,{formattedNumericalValues:Hc(a),numericalValues:a,stringValues:s,variant:e});return r?i[t]:t}))}function Jc(e,t={}){const n=t.size??vs(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a}=Kc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Sa(ha,{stringValues:i.filter((e=>"string"==typeof e))});return Xa(n,(e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?Gc(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 Sa(ia,{discriminator:t,formattedValidDiscriminators:Hc(e),validDiscriminators:e})}return i[n]}))}var Yc;function Qc(e,t){return Xa(Lc([...t,e]),(e=>e[e.length-1]))}function Xc(e,t,n={}){return Xa(Cc(Lc([e,t]),n),(e=>new Map(e)))}function eu(){return Ba({fixedSize:0,write:(e,t,n)=>n})}function tu(){return Oa({fixedSize:0,read:(e,t)=>[void 0,t]})}function nu(e){const t=e.map((([,e])=>e)),n=Tc(t.map(Ic)),r=Tc(t.map(xc))??void 0;return Ba({...null===n?{getSizeFromValue:t=>e.map((([e,n])=>Na(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 ru(e){const t=e.map((([,e])=>e)),n=Tc(t.map(Ic)),r=Tc(t.map(xc))??void 0;return Oa({...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 ou(){return Yc||(Yc=Os()),Yc}function iu(e){if(e.length<32||e.length>44)throw new Sa(Vo,{actualLength:e.length});const t=ou().encode(e).byteLength;if(32!==t)throw new Sa(Ko,{actualLength:t})}function au(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new Sa(ya,{unexpectedValue:e})}}var su=18446744073709551615n;function cu(e){return function(e){if(e<0||e>su)throw new Sa(Go)}(e),e}function uu(e,...t){return t.reduce(((e,t)=>t(e)),e)}function lu(e){if(!("lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight))return!1;try{return iu(e.lifetimeConstraint.blockhash),!0}catch{return!1}}function du(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 fu=e=>Ba({getSizeFromValue:t=>{const[n,r]=pu(t,e[0]);if(!r)return t.length;const o=gu(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 Sa(ca,{alphabet:e,base:e.length,value:n})}(e,t),""===t)return r;const[o,i]=pu(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=gu(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}}),hu=e=>Oa({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 pu(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function gu(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 mu,yu,vu,wu,Au,bu,Su="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Eu=()=>fu(Su),ku=()=>hu(Su);function Tu(){return vu||(vu=ys()),vu}function Iu(){return wu||(wu=vs()),wu}var xu=128;function _u(){return Ba({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,n)=>{if("legacy"===e)return n;if(e<0||e>127)throw new Sa(zi,{actualVersion:e});return t.set([e|xu],n),n+1}})}function Cu(){return Oa({maxSize:1,read:(e,t)=>{const n=e[t];if(0==(n&xu))return["legacy",t];return[n^xu,t+1]}})}function Ru(){return nu(Nu())}function Pu(){return Qa(nu([...Nu(),["addressTableLookups",_c((mu||(mu=nu([["lookupTableAddress",ec()],["writableIndices",_c(ys(),{size:ls()})],["readableIndices",_c(ys(),{size:ls()})]])),mu),{size:ls()})]]),(e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]}))}function Nu(){return[["version",_u()],["header",nu([["numSignerAccounts",Tu()],["numReadonlySignerAccounts",Tu()],["numReadonlyNonSignerAccounts",Tu()]])],["staticAccounts",_c(ec(),{size:ls()})],["lifetimeToken",qa(Eu(),32)],["instructions",_c((Au||(Au=Qa(nu([["programAddressIndex",ys()],["accountIndices",_c(ys(),{size:ls()})],["data",Fa(Bc(),ls())]]),(e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)}))),Au),{size:ls()})]]}function Bu(){return Ba({getSizeFromValue:e=>"legacy"===e.version?Ru().getSizeFromValue(e):Pu().getSizeFromValue(e),write:(e,t,n)=>"legacy"===e.version?Ru().write(e,t,n):Pu().write(e,t,n)})}function Ou(){return Xa(ru([["version",Cu()],["header",ru([["numSignerAccounts",Iu()],["numReadonlySignerAccounts",Iu()],["numReadonlyNonSignerAccounts",Iu()]])],["staticAccounts",Cc(tc(),{size:ds()})],["lifetimeToken",Wa(ku(),32)],["instructions",Cc((bu||(bu=Xa(ru([["programAddressIndex",vs()],["accountIndices",Cc(vs(),{size:ds()})],["data",$a(Oc(),ds())]]),(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}}))),bu),{size:ds()})],["addressTableLookups",Cc((yu||(yu=ru([["lookupTableAddress",tc()],["writableIndices",Cc(vs(),{size:ds()})],["readableIndices",Cc(vs(),{size:ds()})]])),yu),{size:ds()})]]),(({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t))}function Mu(e,t,n){e[t]=n(e[t]??{role:As.READONLY})}var zu=Symbol("AddressMapTypeProperty");function Uu(e){const t={};for(const n of e){if(!("lookupTableAddress"in n))continue;const e=t[n.lookupTableAddress]||={readableIndices:[],writableIndices:[]};n.role===As.WRITABLE?e.writableIndices.push(n.addressIndex):e.readableIndices.push(n.addressIndex)}return Object.keys(t).sort(rc()).map((e=>({lookupTableAddress:e,...t[e]})))}function ju(e){let t=0,n=0,r=0;for(const o of e){if("lookupTableAddress"in o)break;const e=ks(o.role);Es(o.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Lu(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 Du(e){const t=e.findIndex((e=>"lookupTableAddress"in e));return(-1===t?e:e.slice(0,t)).map((({address:e})=>e))}function Fu(e){const t=function(e){let t;const n=Object.entries(e).sort((([e,n],[r,o])=>{if(n[zu]!==o[zu]){if(0===n[zu])return-1;if(0===o[zu])return 1;if(2===n[zu])return-1;if(2===o[zu])return 1}const i=Es(n.role);if(i!==Es(o.role))return i?-1:1;const a=ks(n.role);return a!==ks(o.role)?a?-1:1:(t||=rc(),1===n[zu]&&1===o[zu]&&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]:{[zu]:0,role:As.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(Mu(n,e.programAddress,(t=>{if(r.add(e.programAddress),zu in t){if(ks(t.role)){if(0===t[zu])throw new Sa(Oi,{programAddress:e.programAddress});throw new Sa(Mi,{programAddress:e.programAddress})}if(2===t[zu])return t}return{[zu]:2,role:As.READONLY}})),e.accounts)for(const o of e.accounts)Mu(n,o.address,(e=>{const{address:n,...i}=o;if(zu in e)switch(e[zu]){case 0:return e;case 1:{const n=Ts(e.role,i.role);if("lookupTableAddress"in i){if(e.lookupTableAddress!==i.lookupTableAddress&&(t||=rc())(i.lookupTableAddress,e.lookupTableAddress)<0)return{[zu]:1,...i,role:n}}else if(Es(i.role))return{[zu]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=Ts(e.role,i.role);if(r.has(o.address)){if(ks(i.role))throw new Sa(Mi,{programAddress:o.address});return e.role!==t?{...e,role:t}:e}return"lookupTableAddress"in i&&!Es(e.role)?{...i,[zu]:1,role:t}:e.role!==t?{...e,role:t}:e}}return"lookupTableAddress"in i?{...i,[zu]:1}:{...i,[zu]:2}}))}return n}(e.feePayer.address,e.instructions));return{..."legacy"!==e.version?{addressTableLookups:Uu(t)}:null,header:ju(t),instructions:Lu(e.instructions,t),lifetimeToken:(n=e.lifetimeConstraint,"nonce"in n?n.nonce:n.blockhash),staticAccounts:Du(t),version:e.version};var n}function $u({version:e}){return Object.freeze({instructions:Object.freeze([]),version:e})}var qu,Wu="SysvarRecentB1ockHashes11111111111111111111",Vu="11111111111111111111111111111111";function Ku(e,t){return{accounts:[{address:e,role:As.WRITABLE},{address:Wu,role:As.READONLY},{address:t,role:As.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Vu}}function Gu(e){return e.programAddress===Vu&&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===As.WRITABLE&&e.accounts[1].address===Wu&&e.accounts[1].role===As.READONLY&&null!=e.accounts[2].address&&Es(e.accounts[2].role);var t}function Hu(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&Gu(e.instructions[0])}function Zu(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 Ju(e,t){return Yu([e],t)}function Yu(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Qu(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Xu(e,t){const n=e.staticAccounts[0];if(!n)throw new Sa(Di);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:As.WRITABLE_SIGNER}),i++;for(let n=0;n<t.numReadonlySignerAccounts;n++)o.push({address:e.staticAccounts[i],role:As.READONLY_SIGNER}),i++;for(let t=0;t<r;t++)o.push({address:e.staticAccounts[i],role:As.WRITABLE}),i++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)o.push({address:e.staticAccounts[i],role:As.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 Sa(Ui,{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 Sa(ji,{highestKnownIndex:e.length-1,highestRequestedIndex:i,lookupTableAddress:n.lookupTableAddress});const a=n.readableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:As.READONLY})));r.push(...a);const s=n.writableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:As.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 Sa(Li,{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&&Gu(t)){const n=t.accounts[0].address;Qs(n);const r=t.accounts[2].address;return Qs(r),{nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}(e.lifetimeToken,i,t?.lastValidBlockHeight);return uu($u({version:e.version}),(e=>Zu(n,e)),(e=>o.reduce(((e,t)=>Ju(t,e)),e)),(e=>"blockhash"in a?du(a,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o;const i=r.instructions[0];if(i&&Gu(i))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(i,t,n)){if(Hu(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)]}else o=[Object.freeze(Ku(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Ku(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}(a,e)))}function el(e){const t=Object.values(e);if(0===t.length)throw new Sa(Wi);return t.map((e=>e||new Uint8Array(64).fill(0)))}function tl(){return nu([["signatures",Qa(_c(qa(Bc(),64),{size:ls()}),el)],["messageBytes",Bc()]])}function nl(){return Xa(ru([["signatures",Cc(Wa(Oc(),64),{size:ds()})],["messageBytes",Oc()]]),rl)}function rl(e){const{messageBytes:t,signatures:n}=e,r=Lc([Cu(),Ya(vs(),2),Cc(tc(),{size:ds()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new Sa(Vi,{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 ol(e){const t=Fu(e),n=Bu().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(const e of r)o[e]=null;let i;i=lu(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 il(e){qu||(qu=Ms());const t=Object.values(e.signatures)[0];if(!t)throw new Sa($i);return qu.decode(t)}async function al(e,t){let n,r;if(await Promise.all(e.map((async e=>{const o=await mc(e.publicKey),i=t.signatures[o];if(void 0===i)return r||=new Set,void r.add(o);if(r)return;const a=await Ac(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 Sa(qi,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function sl(e){const t=[];if(Object.entries(e.signatures).forEach((([e,n])=>{n||t.push(e)})),t.length>0)throw new Sa(Fi,{addresses:t})}function cl(e){const t=tl().encode(e);return Fs().decode(t)}function ul(e){const t={};return e.forEach((e=>{if(t[e.address]){if(t[e.address]!==e)throw new Sa(Bi,{address:e.address})}else t[e.address]=e})),Object.values(t)}function ll(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function dl(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function fl(e){return"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function hl(e){return dl(e)||ll(e)||fl(e)}function pl(e){return ul((e.accounts??[]).flatMap((e=>"signer"in e?e.signer:[])))}function gl(e){return ul([...e.feePayer&&hl(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(pl)])}function ml(e,t){const n=(r=t)&&"feePayer"in r&&r.feePayer&&"string"==typeof r.feePayer.address&&!hl(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(ul(e).map((e=>[e.address,e])));return Object.freeze({...t,accounts:t.accounts.map((e=>{const t=n.get(e.address);return Es(e.role)&&!("signer"in e)&&t?Object.freeze({...e,signer:t}):e}))})}(e,t)))}):t}async function yl(e){const t=await mc(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map((async n=>Object.freeze({[t]:await Ac(e.privateKey,n.content)})))),signTransactions:n=>Promise.all(n.map((async n=>{const r=await al([e],n);return Object.freeze({[t]:r.signatures[t]})})))};return Object.freeze(n)}async function vl(e,t){return await yl(await Ec(e,t))}function wl(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 Al(e,t){const{partialSigners:n,modifyingSigners:r}=bl(ul(gl(e).filter(hl)),{identifySendingSigner:!1});return await Sl(e,r,n,t)}function bl(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(fl);if(0===t.length)return null;const n=t.filter((e=>!ll(e)&&!dl(e)));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter((e=>e!==n&&(ll(e)||dl(e)))),o=function(e){const t=e.filter(ll);if(0===t.length)return[];const n=t.filter((e=>!dl(e)));return n.length>0?n:[t[0]]}(r),i=r.filter(dl).filter((e=>!o.includes(e)));return Object.freeze({modifyingSigners:o,partialSigners:i,sendingSigner:n})}async function Sl(e,t=[],n=[],r){const o=ol(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 El=globalThis.TextEncoder;var kl,Tl=((kl=Tl||{})[kl.Uninitialized=0]="Uninitialized",kl[kl.Initialized=1]="Initialized",kl);var Il,xl=((Il=xl||{})[Il.Legacy=0]="Legacy",Il[Il.Current=1]="Current",Il);var _l,Cl,Rl="11111111111111111111111111111111",Pl=((_l=Pl||{})[_l.Nonce=0]="Nonce",_l),Nl=((Cl=Nl||{})[Cl.CreateAccount=0]="CreateAccount",Cl[Cl.Assign=1]="Assign",Cl[Cl.TransferSol=2]="TransferSol",Cl[Cl.CreateAccountWithSeed=3]="CreateAccountWithSeed",Cl[Cl.AdvanceNonceAccount=4]="AdvanceNonceAccount",Cl[Cl.WithdrawNonceAccount=5]="WithdrawNonceAccount",Cl[Cl.InitializeNonceAccount=6]="InitializeNonceAccount",Cl[Cl.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",Cl[Cl.Allocate=8]="Allocate",Cl[Cl.AllocateWithSeed=9]="AllocateWithSeed",Cl[Cl.AssignWithSeed=10]="AssignWithSeed",Cl[Cl.TransferSolWithSeed=11]="TransferSolWithSeed",Cl[Cl.UpgradeNonceAccount=12]="UpgradeNonceAccount",Cl);function Bl(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 Ol(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:As.READONLY});const n=t.isWritable?As.WRITABLE:As.READONLY;return Object.freeze({address:Bl(t.value),role:Ml(t.value)?Is(n):n,...Ml(t.value)?{signer:t.value}:{}})}}function Ml(e){return!!e&&"object"==typeof e&&"address"in e&&hl(e)}function zl(){return ru([["discriminator",ps()]])}function Ul(){return ru([["discriminator",ps()],["space",ms()]])}function jl(){return ru([["discriminator",ps()],["base",tc()],["seed",$a(Ks(),ms())],["space",ms()],["programAddress",tc()]])}function Ll(){return ru([["discriminator",ps()],["programAddress",tc()]])}function Dl(){return ru([["discriminator",ps()],["base",tc()],["seed",$a(Ks(),ms())],["programAddress",tc()]])}function Fl(){return ru([["discriminator",ps()],["newNonceAuthority",tc()]])}function $l(){return ru([["discriminator",ps()],["lamports",ms()],["space",ms()],["programAddress",tc()]])}function ql(){return ru([["discriminator",ps()],["base",tc()],["seed",$a(Ks(),ms())],["amount",ms()],["space",ms()],["programAddress",tc()]])}function Wl(){return ru([["discriminator",ps()],["nonceAuthority",tc()]])}var Vl=2;function Kl(){return Qa(nu([["discriminator",hs()],["amount",gs()]]),(e=>({...e,discriminator:Vl})))}function Gl(){return ru([["discriminator",ps()],["amount",ms()]])}function Hl(){return ru([["discriminator",ps()],["amount",ms()],["fromSeed",$a(Ks(),ms())],["fromOwner",tc()]])}function Zl(){return ru([["discriminator",ps()]])}function Jl(){return ru([["discriminator",ps()],["withdrawAmount",ms()]])}const Yl={log:(console.log,(...e)=>{}),info:(console.info,(...e)=>{}),warn:(console.warn,(...e)=>{}),debug:(console.debug,(...e)=>{}),error:(console.error,(...e)=>{})};const Ql={log:()=>{},info:()=>{},warn:()=>{},debug:()=>{},error:()=>{}},Xl=(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}}),ed=Yl;const td=(e,t)=>`${e}:${t.map((e=>JSON.stringify(e))).join(":")}`,nd=(e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:o})=>{const i=o??td,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){ed.error(`Cache get error for key "${o}":`,e)}const s=await e(...r);return t.set(o,s,n).catch((e=>{ed.error(`Cache set error for key "${o}":`,e)})),s}},rd=1000000n,od=1e9,id="metamask";var ad=function(e){return e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",e.Localnet="solana:123456789abcdef",e}({}),sd=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}({});ge(re(),/^solana:[a-zA-Z0-9]+\/slip44:501$/u);const cd=ge(re(),/^solana:[a-zA-Z0-9]+\/token:[a-zA-Z0-9]+$/u),ud=(ge(re(),/^solana:[a-zA-Z0-9]+\/nft:[a-zA-Z0-9]+$/u),L("TokenCaipAssetTypeFromString",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;const[t]=cd.validate(e);return t||!0})));var ld=function(e){return e.SOL="slip44:501",e}({});const dd={"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}},fd={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":{caip2Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",cluster:"mainnet",name:"Solana Mainnet",nativeToken:dd["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501"]},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":{caip2Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",cluster:"devnet",name:"Solana Devnet",nativeToken:dd["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501"]},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":{caip2Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",cluster:"testnet",name:"Solana Testnet",nativeToken:dd["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501"]},"solana:123456789abcdef":{caip2Id:"solana:123456789abcdef",cluster:"local",name:"Solana Localnet",nativeToken:dd["solana:123456789abcdef/slip44:501"]}},hd=ge(re(),/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),pd=ge(re(),/^(?!0\d)(\d+(\.\d+)?)$/u),gd=me(re(),"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"}})),md=ee({accountId:hd}),yd=ee({accountId:hd}),vd=ee({accountId:hd}),wd=ee({accountId:hd,assets:K(it)}),Ad=ee({accountId:hd,pagination:ee({limit:Z(),next:te(Q(re()))})}),bd=ne(it,ee({amount:pd,unit:re()})),Sd=(K(it),H(Object.values($t)),H(Object.values(ad))),Ed=(H(["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"]),ee({transaction:re(),scope:H(Object.values(ad))})),kd=ee({value:Q(pd)}),Td=L("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")),Id=ge(re(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),xd=ge(re(),/^m\/44'\/501'/u),_d=(ge(re(),/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/u),L("SolanaAddress",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;try{return Xs(e),!0}catch(e){return"Invalid Solana address"}})));function Cd(e){return e&&"string"==typeof e?e.replace(/[\u0000-\u0008\u000A-\u001F\u007F]/gu,""):""}function Rd(e,t=1e3){if(!e||"string"!=typeof e)return"";let n=Cd(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function Pd(e){if(!e||"string"!=typeof e)return"";const t=Cd(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?"":t:""}function Nd(e){if(!e||"string"!=typeof e)return"";const t=Cd(e);try{const e=new URL(t);return["http:","https:","wss:","ipfs:"].includes(e.protocol)?t.length>2048?"":t:""}catch{return""}}function Bd(e){const{baseUrl:t,path:n,pathParams:r,queryParams:o,encodePathParams:i=!0}=e,a=Nd(t);if(""===a)throw new Error("Invalid URL format");M(a,gd);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=Cd(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=Cd(t);c.searchParams.append(e,n)}}));const u=c.toString();return M(u,gd),u}var Od=n(5250);const Md=ae([H(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","bits","sats","sol","sei","sonic"]),H(["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"]),H(["xag","xau"])]),zd=ee({id:re(),price:he(X(),0),marketCap:te(Q(he(X(),0))),allTimeHigh:te(Q(he(X(),0))),allTimeLow:te(Q(he(X(),0))),totalVolume:te(Q(he(X(),0))),high1d:te(Q(he(X(),0))),low1d:te(Q(he(X(),0))),circulatingSupply:te(Q(he(X(),0))),dilutedMarketCap:te(Q(he(X(),0))),marketCapPercentChange1d:te(Q(X())),priceChange1d:te(Q(X())),pricePercentChange1h:te(Q(X())),pricePercentChange1d:te(Q(X())),pricePercentChange7d:te(Q(X())),pricePercentChange14d:te(Q(X())),pricePercentChange30d:te(Q(X())),pricePercentChange200d:te(Q(X())),pricePercentChange1y:te(Q(X())),bondingCurveProgressPercent:te(Q(X())),liquidity:te(Q(X())),totalSupply:te(Q(X())),holderCount:te(Q(X())),isMutable:te(Q(G()))}),Ud=ne(Lo,Q(zd)),jd=Md,Ld=ee({assetType:Lo,timePeriod:te(ge(re(),/^[1-9][0-9]*[dmy]$/u)),from:te(he(X(),0)),to:te(he(X(),0)),vsCurrency:te(jd)}),Dd=ee({prices:K(oe([X(),X()])),marketCaps:K(oe([X(),X()])),totalVolumes:K(oe([X(),X()]))}),Fd={prices:[],marketCaps:[],totalVolumes:[]};const $d=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 qd=$d("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Wd=n(1048).hp;const Vd={[ad.Mainnet]:"mainnet",[ad.Devnet]:"devnet",[ad.Testnet]:"testnet",[ad.Localnet]:"localnet"};const Kd=K(ee({decimals:Z(),assetId:ud,name:te(re()),symbol:te(re()),iconUrl:te(gd)})),Gd={name:"UNKNOWN",symbol:"UNKNOWN",fungible:!0,iconUrl:"",units:[{name:"UNKNOWN",symbol:"UNKNOWN",decimals:9}]};class Hd{#o;#i;#a;#s;#c;static supportedNetworks=[ad.Mainnet,ad.Devnet];constructor(e,t=globalThis.fetch,n=ed){this.#o=t,this.#i=n;const{tokenApi:r,staticApi:o}=e.get(),{baseUrl:i,chunkSize:a}=r;M(i,gd),this.#a=i,this.#s=a,this.#c=o.baseUrl}async#u(e){M(e,K(cd));const t=Bd({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 M(r,Kd),r}async getTokensMetadata(e){try{M(e,K(Lo));const t=e.filter((e=>{const{chainId:t}=Fo(e);return Hd.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: ${Hd.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;return e.forEach((e=>{const t=r.find((t=>t.assetId===e));if(!t)return this.#i.warn(`No metadata for ${e}. Returning default values.`),void o.set(e,Gd);const n=t.name??Gd.name,i=t.symbol??Gd.symbol,a=t.decimals??9,s={name:n,symbol:i,fungible:!0,iconUrl:t.iconUrl??Bd({baseUrl:this.#c,path:"/api/v2/tokenIcons/assets/{assetType}.png",pathParams:{assetType:e.replace(/:/gu,"/")},encodePathParams:!1}),units:[{name:n,symbol:i,decimals:a}]};o.set(e,s)})),Object.fromEntries(o)}catch(e){throw this.#i.error(e,"Error fetching token metadata"),e}}}var Zd,Jd="ComputeBudget111111111111111111111111111111",Yd=((Zd=Yd||{})[Zd.RequestUnits=0]="RequestUnits",Zd[Zd.RequestHeapFrame=1]="RequestHeapFrame",Zd[Zd.SetComputeUnitLimit=2]="SetComputeUnitLimit",Zd[Zd.SetComputeUnitPrice=3]="SetComputeUnitPrice",Zd[Zd.SetLoadedAccountsDataSizeLimit=4]="SetLoadedAccountsDataSizeLimit",Zd);function Qd(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;if(Pa(t,ys().encode(3),0))return 3;if(Pa(t,ys().encode(4),0))return 4;throw new Error("The provided instruction could not be identified as a computeBudget instruction.")}function Xd(){return ru([["discriminator",vs()],["bytes",ps()]])}function ef(){return ru([["discriminator",vs()],["units",ps()],["additionalFee",ps()]])}var tf=2;function nf(){return Qa(nu([["discriminator",ys()],["units",hs()]]),(e=>({...e,discriminator:tf})))}function rf(){return ru([["discriminator",vs()],["units",ps()]])}function of(e,t){const n={...e};return{programAddress:t?.programAddress??Jd,data:nf().encode(n)}}function af(e){return{programAddress:e.programAddress,data:rf().decode(e.data)}}var sf=3;function cf(){return Qa(nu([["discriminator",ys()],["microLamports",gs()]]),(e=>({...e,discriminator:sf})))}function uf(){return ru([["discriminator",vs()],["microLamports",ms()]])}function lf(e,t){const n={...e};return{programAddress:t?.programAddress??Jd,data:cf().encode(n)}}function df(e){return{programAddress:e.programAddress,data:uf().decode(e.data)}}function ff(){return ru([["discriminator",vs()],["accountDataSizeLimit",ps()]])}var hf=e=>({__option:"Some",value:e}),pf=()=>({__option:"None"}),gf=e=>!!(e&&"object"==typeof e&&"__option"in e&&("Some"===e.__option&&"value"in e||"None"===e.__option)),mf=e=>"Some"===e.__option;var yf=e=>null!==e?hf(e):pf();function vf(e,t={}){const n=null===t.prefix?Qa(eu(),(e=>{})):Pc({size:t.prefix??ys()});return Dc([Qa(jc([n,"zeroes"===t.noneValue?(za(e),qa(eu(),e.fixedSize)):t.noneValue?zc(t.noneValue):eu()]),(e=>[!1,void 0])),Qa(jc([n,e]),(e=>[!0,gf(e)&&mf(e)?e.value:e]))],(e=>{const t=gf(e)?e:yf(e);return Number(mf(t))}))}function wf(e,t={}){const n=null===t.prefix?Xa(tu(),(()=>!1)):Nc({size:t.prefix??vs()}),r="zeroes"===t.noneValue?(za(e),Wa(tu(),e.fixedSize)):t.noneValue?Uc(t.noneValue):tu();return Fc([Xa(Lc([n,r]),(()=>pf())),Xa(Lc([n,e]),(([,e])=>hf(e)))],((e,o)=>{if(null===t.prefix&&!t.noneValue)return Number(o<e.length);if(null===t.prefix&&null!=t.noneValue){return Pa(e,"zeroes"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,o)?0:1}return Number(n.read(e,o)[0])}))}var Af,bf=((Af=bf||{})[Af.Uninitialized=0]="Uninitialized",Af[Af.Initialized=1]="Initialized",Af[Af.Frozen=2]="Frozen",Af);var Sf,Ef=((Sf=Ef||{})[Sf.MintTokens=0]="MintTokens",Sf[Sf.FreezeAccount=1]="FreezeAccount",Sf[Sf.AccountOwner=2]="AccountOwner",Sf[Sf.CloseAccount=3]="CloseAccount",Sf);function kf(){return Jc(Ef)}var Tf,If="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",xf=((Tf=xf||{})[Tf.CreateAssociatedToken=0]="CreateAssociatedToken",Tf[Tf.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",Tf[Tf.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",Tf);var _f,Cf="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Rf=((_f=Rf||{})[_f.Mint=0]="Mint",_f[_f.Token=1]="Token",_f[_f.Multisig=2]="Multisig",_f);var Pf,Nf=((Pf=Nf||{})[Pf.InitializeMint=0]="InitializeMint",Pf[Pf.InitializeAccount=1]="InitializeAccount",Pf[Pf.InitializeMultisig=2]="InitializeMultisig",Pf[Pf.Transfer=3]="Transfer",Pf[Pf.Approve=4]="Approve",Pf[Pf.Revoke=5]="Revoke",Pf[Pf.SetAuthority=6]="SetAuthority",Pf[Pf.MintTo=7]="MintTo",Pf[Pf.Burn=8]="Burn",Pf[Pf.CloseAccount=9]="CloseAccount",Pf[Pf.FreezeAccount=10]="FreezeAccount",Pf[Pf.ThawAccount=11]="ThawAccount",Pf[Pf.TransferChecked=12]="TransferChecked",Pf[Pf.ApproveChecked=13]="ApproveChecked",Pf[Pf.MintToChecked=14]="MintToChecked",Pf[Pf.BurnChecked=15]="BurnChecked",Pf[Pf.InitializeAccount2=16]="InitializeAccount2",Pf[Pf.SyncNative=17]="SyncNative",Pf[Pf.InitializeAccount3=18]="InitializeAccount3",Pf[Pf.InitializeMultisig2=19]="InitializeMultisig2",Pf[Pf.InitializeMint2=20]="InitializeMint2",Pf[Pf.GetAccountDataSize=21]="GetAccountDataSize",Pf[Pf.InitializeImmutableOwner=22]="InitializeImmutableOwner",Pf[Pf.AmountToUiAmount=23]="AmountToUiAmount",Pf[Pf.UiAmountToAmount=24]="UiAmountToAmount",Pf);function Bf(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 Of(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:As.READONLY});const n=t.isWritable?As.WRITABLE:As.READONLY;return Object.freeze({address:Bf(t.value),role:Mf(t.value)?Is(n):n,...Mf(t.value)?{signer:t.value}:{}})}}function Mf(e){return!!e&&"object"==typeof e&&"address"in e&&hl(e)}function zf(){return ru([["discriminator",vs()],["amount",ms()]])}function Uf(){return ru([["discriminator",vs()],["amount",ms()]])}function jf(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Lf(){return ru([["discriminator",vs()],["amount",ms()]])}function Df(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Ff(){return ru([["discriminator",vs()]])}async function $f(e,t={}){const{programAddress:n="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=t;return await gc({programAddress:n,seeds:[ec().encode(e.owner),ec().encode(e.tokenProgram),ec().encode(e.mint)]})}var qf=1;function Wf(){return Qa(nu([["discriminator",ys()]]),(e=>({...e,discriminator:qf})))}function Vf(e,t){const n=t?.programAddress??If,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=Of(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:Wf().encode({})}}function Kf(){return ru([["discriminator",vs()]])}function Gf(){return ru([["discriminator",vs()]])}function Hf(){return ru([["discriminator",vs()]])}function Zf(){return ru([["discriminator",vs()],["owner",tc()]])}function Jf(){return ru([["discriminator",vs()],["owner",tc()]])}function Yf(){return ru([["discriminator",vs()]])}function Qf(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function Xf(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function eh(){return ru([["discriminator",vs()],["m",vs()]])}function th(){return ru([["discriminator",vs()],["m",vs()]])}function nh(){return ru([["discriminator",vs()],["amount",ms()]])}function rh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function oh(){return ru([["discriminator",vs()]])}function ih(){return ru([["discriminator",vs()],["authorityType",kf()],["newAuthority",wf(tc())]])}function ah(){return ru([["discriminator",vs()]])}function sh(){return ru([["discriminator",vs()]])}function ch(){return ru([["discriminator",vs()],["amount",ms()]])}var uh=12;function lh(){return Qa(nu([["discriminator",ys()],["amount",gs()],["decimals",ys()]]),(e=>({...e,discriminator:uh})))}function dh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function fh(e,t){const n=t?.programAddress??Cf,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:As.READONLY_SIGNER,signer:e}))),a=Of(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:lh().encode(o)}}function hh(){return ru([["discriminator",vs()],["uiAmount",Ks()]])}function ph(e){return!("exists"in e)||"exists"in e&&e.exists}function gh(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Ds().encode(t.data[0]);return Object.freeze({...yh(t),address:e,data:n,exists:!0})}function mh(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info;return Object.freeze({...yh(t),address:e,data:n,exists:!0})}function yh(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function vh(e,t,n={}){const{abortSignal:r,...o}=n;return gh(t,(await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r})).value)}async function wh(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map(((e,n)=>gh(t[n],e)))}var Ah=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Ah||{});function bh(){return Jc(Ah)}var Sh=(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))(Sh||{});function Eh(){return Jc(Sh)}function kh(){return Wa(Oc(),36)}function Th(){return Wa(Oc(),64)}function Ih(){return Vc([["Uninitialized",tu()],["TransferFeeConfig",$a(ru([["transferFeeConfigAuthority",tc()],["withdrawWithheldAuthority",tc()],["withheldAmount",ms()],["olderTransferFee",Ph()],["newerTransferFee",Ph()]]),fs())],["TransferFeeAmount",$a(ru([["withheldAmount",ms()]]),fs())],["MintCloseAuthority",$a(ru([["closeAuthority",tc()]]),fs())],["ConfidentialTransferMint",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Nc()],["auditorElgamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["ConfidentialTransferAccount",$a(ru([["approved",Nc()],["elgamalPubkey",tc()],["pendingBalanceLow",Th()],["pendingBalanceHigh",Th()],["availableBalance",Th()],["decryptableAvailableBalance",kh()],["allowConfidentialCredits",Nc()],["allowNonConfidentialCredits",Nc()],["pendingBalanceCreditCounter",ms()],["maximumPendingBalanceCreditCounter",ms()],["expectedPendingBalanceCreditCounter",ms()],["actualPendingBalanceCreditCounter",ms()]]),fs())],["DefaultAccountState",$a(ru([["state",bh()]]),fs())],["ImmutableOwner",$a(ru([]),fs())],["MemoTransfer",$a(ru([["requireIncomingTransferMemos",Nc()]]),fs())],["NonTransferable",$a(ru([]),fs())],["InterestBearingConfig",$a(ru([["rateAuthority",tc()],["initializationTimestamp",ms()],["preUpdateAverageRate",ss()],["lastUpdateTimestamp",ms()],["currentRate",ss()]]),fs())],["CpiGuard",$a(ru([["lockCpi",Nc()]]),fs())],["PermanentDelegate",$a(ru([["delegate",tc()]]),fs())],["NonTransferableAccount",$a(ru([]),fs())],["TransferHook",$a(ru([["authority",tc()],["programId",tc()]]),fs())],["TransferHookAccount",$a(ru([["transferring",Nc()]]),fs())],["ConfidentialTransferFee",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["elgamalPubkey",tc()],["harvestToMintEnabled",Nc()],["withheldAmount",Th()]]),fs())],["ConfidentialTransferFeeAmount",$a(ru([["withheldAmount",Th()]]),fs())],["MetadataPointer",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["TokenMetadata",$a(ru([["updateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["mint",tc()],["name",$a(Ks(),ps())],["symbol",$a(Ks(),ps())],["uri",$a(Ks(),ps())],["additionalMetadata",Xc($a(Ks(),ps()),$a(Ks(),ps()))]]),fs())],["GroupPointer",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["groupAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["TokenGroup",$a(ru([["updateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["mint",tc()],["size",ms()],["maxSize",ms()]]),fs())],["GroupMemberPointer",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["memberAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["TokenGroupMember",$a(ru([["mint",tc()],["group",tc()],["memberNumber",ms()]]),fs())],["ConfidentialMintBurn",tu()],["ScaledUiAmountConfig",$a(ru([["authority",tc()],["multiplier",as()],["newMultiplierEffectiveTimestamp",ms()],["newMultiplier",as()]]),fs())],["PausableConfig",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["paused",Nc()]]),fs())],["PausableAccount",tu()]],{size:fs()})}var xh,_h=((xh=_h||{})[xh.Uninitialized=0]="Uninitialized",xh[xh.TransferFeeConfig=1]="TransferFeeConfig",xh[xh.TransferFeeAmount=2]="TransferFeeAmount",xh[xh.MintCloseAuthority=3]="MintCloseAuthority",xh[xh.ConfidentialTransferMint=4]="ConfidentialTransferMint",xh[xh.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",xh[xh.DefaultAccountState=6]="DefaultAccountState",xh[xh.ImmutableOwner=7]="ImmutableOwner",xh[xh.MemoTransfer=8]="MemoTransfer",xh[xh.NonTransferable=9]="NonTransferable",xh[xh.InterestBearingConfig=10]="InterestBearingConfig",xh[xh.CpiGuard=11]="CpiGuard",xh[xh.PermanentDelegate=12]="PermanentDelegate",xh[xh.NonTransferableAccount=13]="NonTransferableAccount",xh[xh.TransferHook=14]="TransferHook",xh[xh.TransferHookAccount=15]="TransferHookAccount",xh[xh.ConfidentialTransferFee=16]="ConfidentialTransferFee",xh[xh.ConfidentialTransferFeeAmount=17]="ConfidentialTransferFeeAmount",xh[xh.ScaledUiAmountConfig=18]="ScaledUiAmountConfig",xh[xh.PausableConfig=19]="PausableConfig",xh[xh.PausableAccount=20]="PausableAccount",xh[xh.MetadataPointer=21]="MetadataPointer",xh[xh.TokenMetadata=22]="TokenMetadata",xh[xh.GroupPointer=23]="GroupPointer",xh[xh.TokenGroup=24]="TokenGroup",xh[xh.GroupMemberPointer=25]="GroupMemberPointer",xh[xh.TokenGroupMember=26]="TokenGroupMember",xh);function Ch(){return Jc(_h,{size:fs()})}function Rh(){return Vc([["Name",tu()],["Symbol",tu()],["Uri",tu()],["Key",ru([["fields",Lc([$a(Ks(),ps())])]])]])}function Ph(){return ru([["epoch",ms()],["maximumFee",ms()],["transferFeeBasisPoints",fs()]])}function Nh(){return ru([["mintAuthority",wf(tc(),{prefix:ps(),noneValue:"zeroes"})],["supply",ms()],["decimals",vs()],["isInitialized",Nc()],["freezeAuthority",wf(tc(),{prefix:ps(),noneValue:"zeroes"})],["extensions",wf(Qc(Cc(Ih(),{size:"remainder"}),[Uc(Ja(ys(),83).encode(1))]),{prefix:null})]])}function Bh(e){return function(e,t){try{return"exists"in e&&!e.exists?e:Object.freeze({...e,data:t.decode(e.data)})}catch{throw new Sa(wi,{address:e.address})}}(e,Nh())}async function Oh(e,t,n){const r=await async function(e,t,n){const r=await vh(e,t,n);return Bh(r)}(e,t,n);return function(e){if(!e.exists)throw new Sa(yi,{address:e.address})}(r),r}var Mh=(e=>(e[e.CreateAssociatedToken=0]="CreateAssociatedToken",e[e.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",e[e.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",e))(Mh||{});var zh,Uh="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",jh=((zh=jh||{})[zh.Mint=0]="Mint",zh[zh.Token=1]="Token",zh[zh.Multisig=2]="Multisig",zh);var Lh,Dh=((Lh=Dh||{})[Lh.InitializeMint=0]="InitializeMint",Lh[Lh.InitializeAccount=1]="InitializeAccount",Lh[Lh.InitializeMultisig=2]="InitializeMultisig",Lh[Lh.Transfer=3]="Transfer",Lh[Lh.Approve=4]="Approve",Lh[Lh.Revoke=5]="Revoke",Lh[Lh.SetAuthority=6]="SetAuthority",Lh[Lh.MintTo=7]="MintTo",Lh[Lh.Burn=8]="Burn",Lh[Lh.CloseAccount=9]="CloseAccount",Lh[Lh.FreezeAccount=10]="FreezeAccount",Lh[Lh.ThawAccount=11]="ThawAccount",Lh[Lh.TransferChecked=12]="TransferChecked",Lh[Lh.ApproveChecked=13]="ApproveChecked",Lh[Lh.MintToChecked=14]="MintToChecked",Lh[Lh.BurnChecked=15]="BurnChecked",Lh[Lh.InitializeAccount2=16]="InitializeAccount2",Lh[Lh.SyncNative=17]="SyncNative",Lh[Lh.InitializeAccount3=18]="InitializeAccount3",Lh[Lh.InitializeMultisig2=19]="InitializeMultisig2",Lh[Lh.InitializeMint2=20]="InitializeMint2",Lh[Lh.GetAccountDataSize=21]="GetAccountDataSize",Lh[Lh.InitializeImmutableOwner=22]="InitializeImmutableOwner",Lh[Lh.AmountToUiAmount=23]="AmountToUiAmount",Lh[Lh.UiAmountToAmount=24]="UiAmountToAmount",Lh[Lh.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",Lh[Lh.InitializeTransferFeeConfig=26]="InitializeTransferFeeConfig",Lh[Lh.TransferCheckedWithFee=27]="TransferCheckedWithFee",Lh[Lh.WithdrawWithheldTokensFromMint=28]="WithdrawWithheldTokensFromMint",Lh[Lh.WithdrawWithheldTokensFromAccounts=29]="WithdrawWithheldTokensFromAccounts",Lh[Lh.HarvestWithheldTokensToMint=30]="HarvestWithheldTokensToMint",Lh[Lh.SetTransferFee=31]="SetTransferFee",Lh[Lh.InitializeConfidentialTransferMint=32]="InitializeConfidentialTransferMint",Lh[Lh.UpdateConfidentialTransferMint=33]="UpdateConfidentialTransferMint",Lh[Lh.ConfigureConfidentialTransferAccount=34]="ConfigureConfidentialTransferAccount",Lh[Lh.ApproveConfidentialTransferAccount=35]="ApproveConfidentialTransferAccount",Lh[Lh.EmptyConfidentialTransferAccount=36]="EmptyConfidentialTransferAccount",Lh[Lh.ConfidentialDeposit=37]="ConfidentialDeposit",Lh[Lh.ConfidentialWithdraw=38]="ConfidentialWithdraw",Lh[Lh.ConfidentialTransfer=39]="ConfidentialTransfer",Lh[Lh.ApplyConfidentialPendingBalance=40]="ApplyConfidentialPendingBalance",Lh[Lh.EnableConfidentialCredits=41]="EnableConfidentialCredits",Lh[Lh.DisableConfidentialCredits=42]="DisableConfidentialCredits",Lh[Lh.EnableNonConfidentialCredits=43]="EnableNonConfidentialCredits",Lh[Lh.DisableNonConfidentialCredits=44]="DisableNonConfidentialCredits",Lh[Lh.ConfidentialTransferWithFee=45]="ConfidentialTransferWithFee",Lh[Lh.InitializeDefaultAccountState=46]="InitializeDefaultAccountState",Lh[Lh.UpdateDefaultAccountState=47]="UpdateDefaultAccountState",Lh[Lh.Reallocate=48]="Reallocate",Lh[Lh.EnableMemoTransfers=49]="EnableMemoTransfers",Lh[Lh.DisableMemoTransfers=50]="DisableMemoTransfers",Lh[Lh.CreateNativeMint=51]="CreateNativeMint",Lh[Lh.InitializeNonTransferableMint=52]="InitializeNonTransferableMint",Lh[Lh.InitializeInterestBearingMint=53]="InitializeInterestBearingMint",Lh[Lh.UpdateRateInterestBearingMint=54]="UpdateRateInterestBearingMint",Lh[Lh.EnableCpiGuard=55]="EnableCpiGuard",Lh[Lh.DisableCpiGuard=56]="DisableCpiGuard",Lh[Lh.InitializePermanentDelegate=57]="InitializePermanentDelegate",Lh[Lh.InitializeTransferHook=58]="InitializeTransferHook",Lh[Lh.UpdateTransferHook=59]="UpdateTransferHook",Lh[Lh.InitializeConfidentialTransferFee=60]="InitializeConfidentialTransferFee",Lh[Lh.WithdrawWithheldTokensFromMintForConfidentialTransferFee=61]="WithdrawWithheldTokensFromMintForConfidentialTransferFee",Lh[Lh.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=62]="WithdrawWithheldTokensFromAccountsForConfidentialTransferFee",Lh[Lh.HarvestWithheldTokensToMintForConfidentialTransferFee=63]="HarvestWithheldTokensToMintForConfidentialTransferFee",Lh[Lh.EnableHarvestToMint=64]="EnableHarvestToMint",Lh[Lh.DisableHarvestToMint=65]="DisableHarvestToMint",Lh[Lh.WithdrawExcessLamports=66]="WithdrawExcessLamports",Lh[Lh.InitializeMetadataPointer=67]="InitializeMetadataPointer",Lh[Lh.UpdateMetadataPointer=68]="UpdateMetadataPointer",Lh[Lh.InitializeGroupPointer=69]="InitializeGroupPointer",Lh[Lh.UpdateGroupPointer=70]="UpdateGroupPointer",Lh[Lh.InitializeGroupMemberPointer=71]="InitializeGroupMemberPointer",Lh[Lh.UpdateGroupMemberPointer=72]="UpdateGroupMemberPointer",Lh[Lh.InitializeScaledUiAmountMint=73]="InitializeScaledUiAmountMint",Lh[Lh.UpdateMultiplierScaledUiMint=74]="UpdateMultiplierScaledUiMint",Lh[Lh.InitializePausableConfig=75]="InitializePausableConfig",Lh[Lh.Pause=76]="Pause",Lh[Lh.Resume=77]="Resume",Lh[Lh.InitializeTokenMetadata=78]="InitializeTokenMetadata",Lh[Lh.UpdateTokenMetadataField=79]="UpdateTokenMetadataField",Lh[Lh.RemoveTokenMetadataKey=80]="RemoveTokenMetadataKey",Lh[Lh.UpdateTokenMetadataUpdateAuthority=81]="UpdateTokenMetadataUpdateAuthority",Lh[Lh.EmitTokenMetadata=82]="EmitTokenMetadata",Lh[Lh.InitializeTokenGroup=83]="InitializeTokenGroup",Lh[Lh.UpdateTokenGroupMaxSize=84]="UpdateTokenGroupMaxSize",Lh[Lh.UpdateTokenGroupUpdateAuthority=85]="UpdateTokenGroupUpdateAuthority",Lh[Lh.InitializeTokenGroupMember=86]="InitializeTokenGroupMember",Lh);function Fh(){return ru([["discriminator",vs()],["amount",ms()]])}function $h(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["expectedPendingBalanceCreditCounter",ms()],["newDecryptableAvailableBalance",kh()]])}function qh(){return ru([["discriminator",vs()],["amount",ms()]])}function Wh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Vh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function Kh(){return ru([["discriminator",vs()],["amount",ms()]])}function Gh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Hh(){return ru([["discriminator",vs()]])}function Zh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["amount",ms()],["decimals",vs()]])}function Jh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["newSourceDecryptableAvailableBalance",kh()],["equalityProofInstructionOffset",us()],["ciphertextValidityProofInstructionOffset",us()],["rangeProofInstructionOffset",us()]])}function Yh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["newSourceDecryptableAvailableBalance",kh()],["equalityProofInstructionOffset",us()],["transferAmountCiphertextValidityProofInstructionOffset",us()],["feeSigmaProofInstructionOffset",us()],["feeCiphertextValidityProofInstructionOffset",us()],["rangeProofInstructionOffset",us()]])}function Qh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["amount",ms()],["decimals",vs()],["newDecryptableAvailableBalance",kh()],["equalityProofInstructionOffset",us()],["rangeProofInstructionOffset",us()]])}function Xh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["decryptableZeroBalance",kh()],["maximumPendingBalanceCreditCounter",ms()],["proofInstructionOffset",us()]])}function ep(){return ru([["discriminator",vs()]])}function tp(){return ru([["discriminator",vs()]])}function np(){return ru([["discriminator",vs()]])}function rp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function op(){return ru([["discriminator",vs()],["cpiGuardDiscriminator",vs()]])}function ip(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()]])}function ap(){return ru([["discriminator",vs()],["memoTransfersDiscriminator",vs()]])}function sp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}new Uint8Array([250,166,180,250,13,12,184,70]);function cp(){return ru([["discriminator",Oc()],["start",wf(ms())],["end",wf(ms())]])}function up(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["proofInstructionOffset",us()]])}function lp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function dp(){return ru([["discriminator",vs()],["cpiGuardDiscriminator",vs()]])}function fp(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()]])}function hp(){return ru([["discriminator",vs()],["memoTransfersDiscriminator",vs()]])}function pp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function gp(){return ru([["discriminator",vs()]])}function mp(){return ru([["discriminator",vs()]])}function yp(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()]])}function vp(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()]])}function wp(){return ru([["discriminator",vs()]])}function Ap(){return ru([["discriminator",vs()],["owner",tc()]])}function bp(){return ru([["discriminator",vs()],["owner",tc()]])}function Sp(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["withdrawWithheldAuthorityElGamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Ep(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Nc()],["auditorElgamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function kp(){return ru([["discriminator",vs()],["defaultAccountStateDiscriminator",vs()],["state",bh()]])}function Tp(){return ru([["discriminator",vs()],["groupMemberPointerDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["memberAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Ip(){return ru([["discriminator",vs()],["groupPointerDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["groupAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function xp(){return ru([["discriminator",vs()]])}function _p(){return ru([["discriminator",vs()],["interestBearingMintDiscriminator",vs()],["rateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["rate",ss()]])}function Cp(){return ru([["discriminator",vs()],["metadataPointerDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Rp(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function Pp(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function Np(){return ru([["discriminator",vs()],["closeAuthority",wf(tc())]])}function Bp(){return ru([["discriminator",vs()],["m",vs()]])}function Op(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:Bp().decode(e.data)}}function Mp(){return ru([["discriminator",vs()]])}function zp(){return ru([["discriminator",vs()],["pausableDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Up(){return ru([["discriminator",vs()],["delegate",tc()]])}function jp(){return ru([["discriminator",vs()],["scaledUiAmountMintDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["multiplier",as()]])}new Uint8Array([121,113,108,39,54,51,0,4]);function Lp(){return ru([["discriminator",Oc()],["updateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["maxSize",ms()]])}new Uint8Array([152,32,222,176,223,237,116,134]);function Dp(){return ru([["discriminator",Oc()]])}new Uint8Array([210,225,30,162,88,184,77,141]);function Fp(){return ru([["discriminator",Oc()],["name",$a(Ks(),ps())],["symbol",$a(Ks(),ps())],["uri",$a(Ks(),ps())]])}function $p(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["transferFeeConfigAuthority",wf(tc())],["withdrawWithheldAuthority",wf(tc())],["transferFeeBasisPoints",fs()],["maximumFee",ms()]])}function qp(){return ru([["discriminator",vs()],["transferHookDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["programId",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Wp(){return ru([["discriminator",vs()],["amount",ms()]])}function Vp(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Kp(){return ru([["discriminator",vs()],["pausableDiscriminator",vs()]])}function Gp(){return ru([["discriminator",vs()],["newExtensionTypes",Cc(Ch(),{size:"remainder"})]])}function Hp(){return ru([["discriminator",vs()]])}new Uint8Array([234,18,32,56,89,141,37,181]);function Zp(){return ru([["discriminator",Oc()],["idempotent",Nc()],["key",$a(Ks(),ps())]])}function Jp(){return ru([["discriminator",vs()],["pausableDiscriminator",vs()]])}function Yp(){return ru([["discriminator",vs()]])}function Qp(){return ru([["discriminator",vs()],["authorityType",Eh()],["newAuthority",wf(tc())]])}function Xp(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["transferFeeBasisPoints",fs()],["maximumFee",ms()]])}function eg(){return ru([["discriminator",vs()]])}function tg(){return ru([["discriminator",vs()]])}function ng(){return ru([["discriminator",vs()],["amount",ms()]])}function rg(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function og(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["amount",ms()],["decimals",vs()],["fee",ms()]])}function ig(){return ru([["discriminator",vs()],["uiAmount",Ks()]])}function ag(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["autoApproveNewAccounts",Nc()],["auditorElgamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function sg(){return ru([["discriminator",vs()],["defaultAccountStateDiscriminator",vs()],["state",bh()]])}function cg(){return ru([["discriminator",vs()],["groupMemberPointerDiscriminator",vs()],["memberAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function ug(){return ru([["discriminator",vs()],["groupPointerDiscriminator",vs()],["groupAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function lg(){return ru([["discriminator",vs()],["metadataPointerDiscriminator",vs()],["metadataAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function dg(){return ru([["discriminator",vs()],["scaledUiAmountMintDiscriminator",vs()],["multiplier",as()],["effectiveTimestamp",cs()]])}function fg(){return ru([["discriminator",vs()],["interestBearingMintDiscriminator",vs()],["rate",ss()]])}new Uint8Array([108,37,171,143,248,30,18,110]);function hg(){return ru([["discriminator",Oc()],["maxSize",ms()]])}new Uint8Array([161,105,88,1,237,221,216,203]);function pg(){return ru([["discriminator",Oc()],["newUpdateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}new Uint8Array([221,233,49,45,181,202,220,200]);function gg(){return ru([["discriminator",Oc()],["field",Rh()],["value",$a(Ks(),ps())]])}new Uint8Array([215,228,166,228,84,100,86,123]);function mg(){return ru([["discriminator",Oc()],["newUpdateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function yg(){return ru([["discriminator",vs()],["transferHookDiscriminator",vs()],["programId",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function vg(){return ru([["discriminator",vs()]])}function wg(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["numTokenAccounts",vs()]])}function Ag(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()],["numTokenAccounts",vs()],["proofInstructionOffset",us()],["newDecryptableAvailableBalance",kh()]])}function bg(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()]])}function Sg(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()],["proofInstructionOffset",us()],["newDecryptableAvailableBalance",kh()]])}var Eg=1e4,kg=31556736;function Tg(e,t,n){const r=t-e;if(r<0)throw new Error("Invalid timespan: end time before start time");const o=n*r/(kg*Eg);return Math.exp(o)}function Ig({currentTimestamp:e,lastUpdateTimestamp:t,initializationTimestamp:n,preUpdateAverageRate:r,currentRate:o}){return Tg(n,t,r)*Tg(t,e,o)}function xg(e){return Math.pow(10,e)}function _g(e,t,n,r,o,i,a){const s=parseFloat(e)*xg(t)/Ig({currentTimestamp:n,lastUpdateTimestamp:r,initializationTimestamp:o,preUpdateAverageRate:i,currentRate:a});return BigInt(Math.trunc(s))}function Cg(e,t,n){const r=parseFloat(e)*xg(t)/n;return BigInt(Math.trunc(r))}var Rg="ComputeBudget111111111111111111111111111111",Pg={blockhash:"11111111111111111111111111111111",lastValidBlockHeight:0n},Ng=2;function Bg(e){return function(e,t){return e.programAddress===t}(e,Rg)&&function(e){return void 0!==e.data}(e)&&e.data[0]===Ng}async function Og({abortSignal:e,rpc:t,transactionMessage:n,...r}){const o=Hu(n);let i;i=o||lu(n)?n:du(Pg,n);const a=n.instructions.findIndex(Bg),s=function(e){const t=new Uint8Array(5);return t[0]=Ng,hs().write(e,t,1),Object.freeze({data:t,programAddress:Rg})}(14e5);if(-1===a)i=Ju(s,i);else{const e=[...i.instructions];e.splice(a,1,s),i=Object.freeze({...i,instructions:e})}const c=cl(ol(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 Sa(Ki);const a=i>4294967295n?4294967295:Number(i);if(n)throw new Sa(Gi,{cause:n,unitsConsumed:a});return a}catch(e){if(ba(e,Gi))throw e;throw new Sa(Ki,{cause:e})}}async function Mg(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?mh(t[n],e):gh(t[n],e)))}(t,e,n);return function(e){const t=e.filter((e=>ph(e)&&e.data instanceof Uint8Array));if(t.length>0){const e=t.map((e=>e.address));throw new Sa(Ai,{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 Sa(vi,{addresses:e})}}(r),r.reduce(((e,t)=>({...e,[t.address]:t.data.addresses})),{})}async function zg(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 Xu(e,{addressesByLookupTableAddress:r.length>0?await Mg(r,t,i):{},lastValidBlockHeight:o})}function Ug(e,t){return!t?.preflightCommitment&&function(e,t){return e===t?0:au(e)<au(t)?-1:1}(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function jg({abortSignal:e,commitment:t,rpc:n,transaction:r,...o}){const i=cl(r);return await n.sendTransaction(i,{...Ug(t,o),encoding:"base64"}).send({abortSignal:e})}const Lg=async(e,t,n)=>uu(e,Ds().encode,Ou().decode,(async e=>zg(e,t,n))),Dg=async(e,t,n)=>uu(e,Ou().decode,(async e=>zg(e,t,n))),Fg=e=>uu(e,tl().encode,Fs().decode),$g=async e=>uu(e,Ds().encode,nl().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"))}))}))})))([$g(e),Lg(e,t,n)]),Wg=Xs("KeccakSecp256k11111111111111111111111111111"),Vg=Xs("Secp256r1SigVerify1111111111111111111111111");var Kg=function(e){return e[e.Verify=0]="Verify",e}({});const Gg=e=>0,Hg=e=>e.programAddress===Wg,Zg=e=>e.programAddress===Vg,Jg=()=>{return e=[["numSignatures",ja(ys(),vs())]],ja(nu(e),ru(e));var e},Yg=e=>({programAddress:e.programAddress,data:Jg().decode(e.data??new Uint8Array)});const Qg={[Rl]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,hs().encode(0),0))return 0;if(Pa(t,hs().encode(1),0))return 1;if(Pa(t,hs().encode(2),0))return 2;if(Pa(t,hs().encode(3),0))return 3;if(Pa(t,hs().encode(4),0))return 4;if(Pa(t,hs().encode(5),0))return 5;if(Pa(t,hs().encode(6),0))return 6;if(Pa(t,hs().encode(7),0))return 7;if(Pa(t,hs().encode(8),0))return 8;if(Pa(t,hs().encode(9),0))return 9;if(Pa(t,hs().encode(10),0))return 10;if(Pa(t,hs().encode(11),0))return 11;if(Pa(t,hs().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")},instructionEnum:Nl,typeToParserMap:{[Nl.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:Ll().decode(e.data)}},[Nl.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:Gl().decode(e.data)}},[Nl.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:$l().decode(e.data)}},[Nl.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:ql().decode(e.data)}},[Nl.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:zl().decode(e.data)}},[Nl.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:Jl().decode(e.data)}},[Nl.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:Wl().decode(e.data)}},[Nl.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:Fl().decode(e.data)}},[Nl.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:Ul().decode(e.data)}},[Nl.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:jl().decode(e.data)}},[Nl.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:Dl().decode(e.data)}},[Nl.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:Hl().decode(e.data)}},[Nl.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:Zl().decode(e.data)}}}},[Jd]:{identifier:Qd,instructionEnum:Yd,typeToParserMap:{[Yd.RequestUnits]:function(e){return{programAddress:e.programAddress,data:ef().decode(e.data)}},[Yd.RequestHeapFrame]:function(e){return{programAddress:e.programAddress,data:Xd().decode(e.data)}},[Yd.SetComputeUnitPrice]:df,[Yd.SetComputeUnitLimit]:af,[Yd.SetLoadedAccountsDataSizeLimit]:function(e){return{programAddress:e.programAddress,data:ff().decode(e.data)}}}},[Cf]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;if(Pa(t,ys().encode(3),0))return 3;if(Pa(t,ys().encode(4),0))return 4;if(Pa(t,ys().encode(5),0))return 5;if(Pa(t,ys().encode(6),0))return 6;if(Pa(t,ys().encode(7),0))return 7;if(Pa(t,ys().encode(8),0))return 8;if(Pa(t,ys().encode(9),0))return 9;if(Pa(t,ys().encode(10),0))return 10;if(Pa(t,ys().encode(11),0))return 11;if(Pa(t,ys().encode(12),0))return 12;if(Pa(t,ys().encode(13),0))return 13;if(Pa(t,ys().encode(14),0))return 14;if(Pa(t,ys().encode(15),0))return 15;if(Pa(t,ys().encode(16),0))return 16;if(Pa(t,ys().encode(17),0))return 17;if(Pa(t,ys().encode(18),0))return 18;if(Pa(t,ys().encode(19),0))return 19;if(Pa(t,ys().encode(20),0))return 20;if(Pa(t,ys().encode(21),0))return 21;if(Pa(t,ys().encode(22),0))return 22;if(Pa(t,ys().encode(23),0))return 23;if(Pa(t,ys().encode(24),0))return 24;throw new Error("The provided instruction could not be identified as a token instruction.")},instructionEnum:Nf,typeToParserMap:{[Nf.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:Qf().decode(e.data)}},[Nf.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:Hf().decode(e.data)}},[Nf.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:eh().decode(e.data)}},[Nf.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:ch().decode(e.data)}},[Nf.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:Uf().decode(e.data)}},[Nf.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:oh().decode(e.data)}},[Nf.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:ih().decode(e.data)}},[Nf.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:nh().decode(e.data)}},[Nf.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:Lf().decode(e.data)}},[Nf.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:Ff().decode(e.data)}},[Nf.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:Kf().decode(e.data)}},[Nf.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:sh().decode(e.data)}},[Nf.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:dh().decode(e.data)}},[Nf.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:jf().decode(e.data)}},[Nf.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:rh().decode(e.data)}},[Nf.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:Df().decode(e.data)}},[Nf.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:Zf().decode(e.data)}},[Nf.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:ah().decode(e.data)}},[Nf.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:Jf().decode(e.data)}},[Nf.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:th().decode(e.data)}},[Nf.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:Xf().decode(e.data)}},[Nf.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:Gf().decode(e.data)}},[Nf.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:Yf().decode(e.data)}},[Nf.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:zf().decode(e.data)}},[Nf.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:hh().decode(e.data)}}}},[Uh]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;if(Pa(t,ys().encode(3),0))return 3;if(Pa(t,ys().encode(4),0))return 4;if(Pa(t,ys().encode(5),0))return 5;if(Pa(t,ys().encode(6),0))return 6;if(Pa(t,ys().encode(7),0))return 7;if(Pa(t,ys().encode(8),0))return 8;if(Pa(t,ys().encode(9),0))return 9;if(Pa(t,ys().encode(10),0))return 10;if(Pa(t,ys().encode(11),0))return 11;if(Pa(t,ys().encode(12),0))return 12;if(Pa(t,ys().encode(13),0))return 13;if(Pa(t,ys().encode(14),0))return 14;if(Pa(t,ys().encode(15),0))return 15;if(Pa(t,ys().encode(16),0))return 16;if(Pa(t,ys().encode(17),0))return 17;if(Pa(t,ys().encode(18),0))return 18;if(Pa(t,ys().encode(19),0))return 19;if(Pa(t,ys().encode(20),0))return 20;if(Pa(t,ys().encode(21),0))return 21;if(Pa(t,ys().encode(22),0))return 22;if(Pa(t,ys().encode(23),0))return 23;if(Pa(t,ys().encode(24),0))return 24;if(Pa(t,ys().encode(25),0))return 25;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(0),1))return 26;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(1),1))return 27;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(2),1))return 28;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(3),1))return 29;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(4),1))return 30;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(5),1))return 31;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(0),1))return 32;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(1),1))return 33;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(2),1))return 34;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(3),1))return 35;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(4),1))return 36;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(5),1))return 37;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(6),1))return 38;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(7),1))return 39;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(8),1))return 40;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(9),1))return 41;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(10),1))return 42;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(11),1))return 43;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(12),1))return 44;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(13),1))return 45;if(Pa(t,ys().encode(28),0)&&Pa(t,ys().encode(0),1))return 46;if(Pa(t,ys().encode(28),0)&&Pa(t,ys().encode(1),1))return 47;if(Pa(t,ys().encode(29),0))return 48;if(Pa(t,ys().encode(30),0)&&Pa(t,ys().encode(0),1))return 49;if(Pa(t,ys().encode(30),0)&&Pa(t,ys().encode(1),1))return 50;if(Pa(t,ys().encode(31),0))return 51;if(Pa(t,ys().encode(32),0))return 52;if(Pa(t,ys().encode(33),0)&&Pa(t,ys().encode(0),1))return 53;if(Pa(t,ys().encode(33),0)&&Pa(t,ys().encode(1),1))return 54;if(Pa(t,ys().encode(34),0)&&Pa(t,ys().encode(0),1))return 55;if(Pa(t,ys().encode(34),0)&&Pa(t,ys().encode(1),1))return 56;if(Pa(t,ys().encode(35),0))return 57;if(Pa(t,ys().encode(36),0)&&Pa(t,ys().encode(0),1))return 58;if(Pa(t,ys().encode(36),0)&&Pa(t,ys().encode(1),1))return 59;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(0),1))return 60;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(1),1))return 61;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(2),1))return 62;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(3),1))return 63;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(4),1))return 64;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(5),1))return 65;if(Pa(t,ys().encode(38),0))return 66;if(Pa(t,ys().encode(39),0)&&Pa(t,ys().encode(0),1))return 67;if(Pa(t,ys().encode(39),0)&&Pa(t,ys().encode(1),1))return 68;if(Pa(t,ys().encode(40),0)&&Pa(t,ys().encode(0),1))return 69;if(Pa(t,ys().encode(40),0)&&Pa(t,ys().encode(1),1))return 70;if(Pa(t,ys().encode(41),0)&&Pa(t,ys().encode(0),1))return 71;if(Pa(t,ys().encode(41),0)&&Pa(t,ys().encode(1),1))return 72;if(Pa(t,ys().encode(43),0)&&Pa(t,ys().encode(0),1))return 73;if(Pa(t,ys().encode(43),0)&&Pa(t,ys().encode(1),1))return 74;if(Pa(t,ys().encode(44),0)&&Pa(t,ys().encode(0),1))return 75;if(Pa(t,ys().encode(44),0)&&Pa(t,ys().encode(1),1))return 76;if(Pa(t,ys().encode(44),0)&&Pa(t,ys().encode(2),1))return 77;if(Pa(t,new Uint8Array([210,225,30,162,88,184,77,141]),0))return 78;if(Pa(t,new Uint8Array([221,233,49,45,181,202,220,200]),0))return 79;if(Pa(t,new Uint8Array([234,18,32,56,89,141,37,181]),0))return 80;if(Pa(t,new Uint8Array([215,228,166,228,84,100,86,123]),0))return 81;if(Pa(t,new Uint8Array([250,166,180,250,13,12,184,70]),0))return 82;if(Pa(t,new Uint8Array([121,113,108,39,54,51,0,4]),0))return 83;if(Pa(t,new Uint8Array([108,37,171,143,248,30,18,110]),0))return 84;if(Pa(t,new Uint8Array([161,105,88,1,237,221,216,203]),0))return 85;if(Pa(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:Dh,typeToParserMap:{[Dh.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:Rp().decode(e.data)}},[Dh.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:wp().decode(e.data)}},[Dh.InitializeMultisig]:Op,[Dh.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:ng().decode(e.data)}},[Dh.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:qh().decode(e.data)}},[Dh.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:Yp().decode(e.data)}},[Dh.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:Qp().decode(e.data)}},[Dh.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:Wp().decode(e.data)}},[Dh.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)}},[Dh.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)}},[Dh.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:gp().decode(e.data)}},[Dh.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:tg().decode(e.data)}},[Dh.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:rg().decode(e.data)}},[Dh.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)}},[Dh.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:Vp().decode(e.data)}},[Dh.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)}},[Dh.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:Ap().decode(e.data)}},[Dh.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:eg().decode(e.data)}},[Dh.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:bp().decode(e.data)}},[Dh.InitializeMultisig2]:Op,[Dh.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:Pp().decode(e.data)}},[Dh.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:mp().decode(e.data)}},[Dh.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:xp().decode(e.data)}},[Dh.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:Fh().decode(e.data)}},[Dh.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:ig().decode(e.data)}},[Dh.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:Np().decode(e.data)}},[Dh.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:$p().decode(e.data)}},[Dh.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:og().decode(e.data)}},[Dh.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:bg().decode(e.data)}},[Dh.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:wg().decode(e.data)}},[Dh.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:yp().decode(e.data)}},[Dh.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:Xp().decode(e.data)}},[Dh.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:Ep().decode(e.data)}},[Dh.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:ag().decode(e.data)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:Xh().decode(e.data)}},[Dh.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)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:up().decode(e.data)}},[Dh.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)}},[Dh.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===Uh?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)}},[Dh.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===Uh?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)}},[Dh.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:$h().decode(e.data)}},[Dh.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:lp().decode(e.data)}},[Dh.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:rp().decode(e.data)}},[Dh.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:pp().decode(e.data)}},[Dh.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:sp().decode(e.data)}},[Dh.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===Uh?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)}},[Dh.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:kp().decode(e.data)}},[Dh.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:sg().decode(e.data)}},[Dh.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:Gp().decode(e.data)}},[Dh.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:hp().decode(e.data)}},[Dh.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:ap().decode(e.data)}},[Dh.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:np().decode(e.data)}},[Dh.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:Mp().decode(e.data)}},[Dh.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:_p().decode(e.data)}},[Dh.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:fg().decode(e.data)}},[Dh.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:dp().decode(e.data)}},[Dh.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:op().decode(e.data)}},[Dh.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:Up().decode(e.data)}},[Dh.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:qp().decode(e.data)}},[Dh.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:yg().decode(e.data)}},[Dh.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:Sp().decode(e.data)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:Sg().decode(e.data)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:Ag().decode(e.data)}},[Dh.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:vp().decode(e.data)}},[Dh.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:fp().decode(e.data)}},[Dh.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:ip().decode(e.data)}},[Dh.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:vg().decode(e.data)}},[Dh.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:Cp().decode(e.data)}},[Dh.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:lg().decode(e.data)}},[Dh.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:Ip().decode(e.data)}},[Dh.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:ug().decode(e.data)}},[Dh.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:Tp().decode(e.data)}},[Dh.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:cg().decode(e.data)}},[Dh.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:jp().decode(e.data)}},[Dh.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:dg().decode(e.data)}},[Dh.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:zp().decode(e.data)}},[Dh.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:Kp().decode(e.data)}},[Dh.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:Jp().decode(e.data)}},[Dh.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:Fp().decode(e.data)}},[Dh.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:gg().decode(e.data)}},[Dh.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:Zp().decode(e.data)}},[Dh.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:mg().decode(e.data)}},[Dh.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:cp().decode(e.data)}},[Dh.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:Lp().decode(e.data)}},[Dh.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:hg().decode(e.data)}},[Dh.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:pg().decode(e.data)}},[Dh.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:Dp().decode(e.data)}}}},[If]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;throw new Error("The provided instruction could not be identified as a associatedToken instruction.")},instructionEnum:Mh,typeToParserMap:{[Mh.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)}},[Mh.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:tp().decode(e.data)}},[Mh.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:Hp().decode(e.data)}}}},[Wg]:{identifier:Gg,instructionEnum:Kg,typeToParserMap:{[Kg.Verify]:Yg}},[Vg]:{identifier:Gg,instructionEnum:Kg,typeToParserMap:{[Kg.Verify]:Yg}}},Xg=e=>{const{programAddress:t}=e,n={...e,dataBase58:zs().decode(e.data??new Uint8Array)};try{const r=Qg[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}}},em=(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:zs().encode(e.data),programAddress:r}};function tm(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 nm={accountSubscribe:"accountUnsubscribe",programSubscribe:"programUnsubscribe",signatureSubscribe:"signatureUnsubscribe"},rm=H(["processed","confirmed","finalized"]),om=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:Zu(e,t),im=e=>e.programAddress===Jd&&Qd({data:new Uint8Array,...e})===Yd.SetComputeUnitPrice,am=e=>e.instructions.filter(Boolean).some(im),sm=e=>e.programAddress===Jd&&Qd({data:new Uint8Array,...e})===Yd.SetComputeUnitLimit,cm=e=>e.instructions.filter(Boolean).some(sm),um=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(ba(e,Gi))return e.context.unitsConsumed;throw e}));return{...(0,Od.cloneDeep)(e),instructions:[...r.filter((e=>!sm(e))),of({units:i},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}};class lm extends Error{constructor(e){super(e),this.name="FeeCalculatorError"}}class dm extends lm{constructor(e){super(e),this.name="FeeCalculatorUnsupportedInputTypeError"}}const fm=e=>({ed25519Signatures:["signature"],instructions:e.instructions.map((t=>({accounts:[],data:t.data??new Uint8Array,programAddress:e.staticAccounts[t.programAddressIndex]})))}),hm=e=>({...uu(e.messageBytes,Ou().decode,fm),ed25519Signatures:Object.values(e.signatures)}),pm=e=>uu(e,Ds().encode,nl().decode,hm),gm=e=>uu(e,Ds().encode,Ou().decode,fm),mm=5000n;class ym{static calculateFee(e){const t=this.#l(e),{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i}=this.#d(t),a=this.#f(i),s=this.#h(t),c=this.#p(t),u=this.#g(s,c);return{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i,baseFee:a,computeUnitLimit:s,computeUnitPriceMicroLamportsPerComputeUnit:c,priorityFee:u,totalFee:cu(a+u)}}static#f(e){return cu(mm*BigInt(e))}static#h(e){const{instructions:t}=e,n=t.find(sm);return n?af(n).data.units:0}static#p(e){const{instructions:t}=e,n=t.find(im);return n?df(n).data.microLamports:0n}static#g(e,t){return uu(e,(e=>xo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(rd.toString())),(e=>e.toString()),BigInt,cu)}static#d(e){const{ed25519Signatures:t,instructions:n}=e,r=t.length,o=n.filter(Hg).map(Xg).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0),i=n.filter(Zg).map(Xg).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0);return{ed25519SignaturesCount:r,secp256k1SignaturesCount:o,secp256r1SignaturesCount:i,totalSignaturesCount:r+o+i}}static#l(e){if(this.#m(e))return pm(e);if(this.#y(e))return gm(e);if(this.#v(e))return fm(e);if(this.#w(e))return hm(e);if(this.#A(e))return(e=>({ed25519Signatures:e.transaction.signatures,instructions:e.transaction.message.instructions.map((t=>em(t,e)))}))(e);throw new dm("The fee calculator could not recognize the input type. It supports SolanaTransactions, kit Transactions, and base64 strings.")}static#m(e){try{return"string"==typeof e&&(pm(e),!0)}catch(e){return!1}}static#y(e){try{return"string"==typeof e&&(gm(e),!0)}catch(e){return!1}}static#v(e){return"object"==typeof e&&"instructions"in e&&"staticAccounts"in e}static#A(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#w(e){return"object"==typeof e&&"messageBytes"in e&&"object"==typeof e.messageBytes&&"signatures"in e}}const vm=e=>xo(e.toString()).dividedBy(od),wm=e=>xo(e.toString()).multipliedBy(od).integerValue(xo.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}({});class bm 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 Sm(e){return"object"==typeof e&&null!==e}function Em(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function km(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: \`${Em(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*Tm(e,t,n,r){(function(e){return Sm(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=km(o,t,n,r);e&&(yield e)}}function*Im(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&&Sm(t.schema)&&Sm(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=Im(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):Sm(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 xm{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)=>Tm(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Tm(o(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,n){const r=Rm(e,t,{message:n});if(r[0])throw r[0]}(e,this,t)}create(e,t){return function(e,t,n){const r=Rm(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}is(e){return function(e,t){const n=Rm(e,t);return!n[0]}(e,this)}mask(e,t){return function(e,t,n){const r=Rm(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Rm(e,this,t)}}const _m="EXACT_OPTIONAL";class Cm extends xm{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=_m}static isExactOptional(e){return Sm(e)&&"brand"in e&&e.brand===_m}}function Rm(e,t,n={}){const r=Im(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new bm(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Pm(){return Mm("never",(()=>!1))}function Nm(e){const t=e?Object.keys(e):[],n=Pm();return new xm({type:"object",schema:e??null,*entries(r){if(e&&Sm(r)){const o=new Set(Object.keys(r));for(const n of t){o.delete(n);const t=e[n];Cm.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=>Sm(e)||`Expected an object, but received: ${Em(e)}`,coercer:e=>Sm(e)?{...e}:e})}function Bm(){return Mm("string",(e=>"string"==typeof e||`Expected a string, but received: ${Em(e)}`))}function Om(...e){const t="type"===e[0]?.type,n=e.map((({schema:e})=>e)),r=Object.assign({},...n);return t?function(e){const t=Object.keys(e);return new xm({type:"type",schema:e,*entries(n){if(Sm(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>Sm(e)||`Expected an object, but received: ${Em(e)}`,coercer:e=>Sm(e)?{...e}:e})}(r):Nm(r)}function Mm(e,t){return new xm({type:e,schema:null,validator:t})}function zm(e){return Mm(JSON.stringify(e),function(e){const t=Em(e),n=typeof e;return new xm({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Em(n)}`})}(e).validator)}function Um(e){return null==e}const jm=(e,t)=>Object.hasOwnProperty.call(e,t);var Lm;!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"}(Lm=Lm||(Lm={}));const Dm=e=>ee(e);function Fm({path:e,branch:t}){const n=e[e.length-1];return jm(t[t.length-2],n)}function $m(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Fm(n)||e.validator(t,n),refiner:(t,n)=>!Fm(n)||e.refiner(t,n)})}function qm(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(!qm(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]||!qm(n[e][1])){t=!1;break}return t}return!1}const Wm=L("JSON",(e=>qm(e))),Vm=de(Wm,me(V(),"JSON",(e=>U(e,Wm))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Km=J("2.0"),Gm=Q(ae([X(),re()])),Hm=Dm({code:Z(),message:re(),data:$m(Vm),stack:$m(re())}),Zm=ae([ne(re(),Vm),K(Vm)]);Dm({id:Gm,jsonrpc:Km,method:re(),params:$m(Zm)}),Dm({jsonrpc:Km,method:re(),params:$m(Zm)});ee({id:Gm,jsonrpc:Km,result:te(se()),error:te(Hm)});const Jm=Dm({id:Gm,jsonrpc:Km,result:Vm}),Ym=Dm({id:Gm,jsonrpc:Km,error:Hm});ae([Jm,Ym]);function Qm(e){return U(e,Ym)}var Xm=function(e){return e.Required="Required",e.Invalid="Invalid",e.InsufficientBalanceToCoverFee="InsufficientBalanceToCoverFee",e.InsufficientBalance="InsufficientBalance",e}({});const ey=H(Object.values(ad)),ty=ie({address:de(re(),re(),(e=>{if(!e||""===e)throw new Error("Account address is required");const t=Pd(e);if(""===t)throw new Error("Invalid Solana address format");return t}))}),ny=J("ed25519"),ry=de(re(),re(),(e=>{const t=function(e){if(!e||"string"!=typeof e)return"";let t=Cd(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})),oy=de(re(),re(),(e=>{const t=Pd(e);if(""===t)throw new Error("Invalid Solana address format");return t})),iy=de(re(),re(),(e=>{const t=Rd(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})),ay=de(re(),re(),(e=>Nd(e))),sy=de(re(),re(),(e=>Rd(e,10))),cy=de(re(),re(),(e=>Rd(e,50))),uy=de(re(),re(),(e=>Rd(e,100))),ly=de(re(),re(),(e=>function(e){if(!e||"string"!=typeof e)return"";const t=Cd(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))),dy=de(re(),re(),(e=>Rd(e,100))),fy=de(K(re()),K(re()),(e=>{var t;return t=e,Array.isArray(t)?t.filter((e=>"string"==typeof e)).map((e=>Nd(e))).filter((e=>""!==e)):[]})),hy=ie({domain:te(ry),address:te(oy),statement:te(iy),uri:te(ay),version:te(sy),chainId:te(cy),nonce:te(uy),issuedAt:te(ly),expirationTime:te(ly),notBefore:te(ly),requestId:te(dy),resources:te(fy)}),py=ie({account:ty,message:Id}),gy=H(["processed","confirmed","finalized"]),my=ie({preflightCommitment:te(gy),minContextSlot:te(X())}),yy=ie({account:ty,transaction:Id,scope:ey,options:te(my)}),vy=ie({...my.schema,commitment:te(gy),skipPreflight:te(G()),maxRetries:te(X())}),wy=ie({...yy.schema,scope:ey,options:te(vy)}),Ay=ee({method:H([$t.SignAndSendTransaction]),params:wy}),by=ee({method:H([$t.SignIn]),params:hy}),Sy=ee({method:H([$t.SignMessage]),params:py}),Ey=ee({method:H([$t.SignTransaction]),params:yy}),ky=ee({signature:Td}),Ty=ee({signedTransaction:Id}),Iy=ee({signature:Td,signedMessage:Id,signatureType:ny}),xy=ee({account:ty,...Iy.schema}),_y=ae([Ay,by,Sy,Ey]),Cy=ee({jsonrpc:Km,id:Gm,method:zm(Am.SignAndSendTransactionWithoutConfirmation),params:wy}),Ry=ee({transaction:Id,accountId:hd,scope:ey,options:te(vy)}),Py=ee({jsonrpc:Km,id:Gm,method:zm(Am.SignAndSendTransaction),params:Ry}),Ny=ee({transactionId:Td}),By=ee({fromAccountId:hd,toAddress:_d,amount:pd,assetId:Lo}),Oy=ee({jsonrpc:Km,id:Gm,method:zm(Am.ConfirmSend),params:By}),My=ee({value:re()}),zy=ee({jsonrpc:Km,id:Gm,method:zm(Am.OnAddressInput),params:My}),Uy=ee({value:pd,accountId:hd,assetId:Lo}),jy=ee({jsonrpc:Km,id:Gm,method:zm(Am.OnAmountInput),params:Uy});function Ly(e){const t=uu(e,$s().encode,Gs().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(!U(o,_d))throw new Error("Invalid Solana address");if(!U(i,pd))throw new Error("Invalid timestamp format");const a=parseInt(i,10),s=Math.floor(Date.now()/1e3);if(Math.abs(s-a)>60)throw new Error("Timestamp must be within 1 minute of current time");return{address:o,timestamp:a}}const Dy=me(Id,"RewardsMessage",(e=>{try{return Ly(e),!0}catch(e){return e instanceof Error?e.message:"Invalid rewards message"}})),Fy=ee({account:ee({address:_d}),message:Dy}),$y=ee({jsonrpc:Km,id:Gm,method:zm(Am.SignRewardsMessage),params:Fy}),qy=ee({valid:G(),errors:K(ee({code:H(Object.values(Xm))}))}),Wy=ee({transaction:Id,accountId:hd,scope:ey}),Vy=ee({jsonrpc:Km,id:Gm,method:zm(Am.ComputeFee),params:Wy}),Ky=K(ee({type:H(Object.values(kt)),asset:mt}));const Gy=ge(re(),/^(?:0x)?[0-9a-f]+$/iu);ge(re(),/^0x[0-9a-f]+$/iu),ge(re(),/^0x[0-9a-f]{40}$/u),ge(re(),/^0x[0-9a-fA-F]{40}$/u);function Hy(e){Wo(function(e){return U(e,Gy)}(e),"Value must be a hexadecimal string.")}function Zy(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}n(1048).hp;const Jy=48,Yy=58,Qy=87;!function(){const e=[]}();function Xy(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;Hy(e);const t=Zy(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<Yy?Jy:Qy),a=o-(o<Yy?Jy:Qy);r[e]=16*i+a}return r}async function ev({entropySource:e,derivationPath:t}){ed.log({derivationPath:t},"Generating solana wallet"),M(t,xd);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:Xy(t.privateKey),publicKeyBytes:Xy(t.publicKey)}}catch(e){throw ed.error({error:e},"Error deriving keypair"),new Error(e)}}const tv=e=>JSON.parse(JSON.stringify(e),((e,t)=>t?"undefined"!==t.__type?"BigNumber"===t.__type?new xo(t.value):"bigint"===t.__type?BigInt(t.value):"Uint8Array"===t.__type?$s().encode(t.value):t:void 0:t)),nv=e=>(0,Od.cloneDeepWith)(e,(e=>void 0===e?{__type:"undefined"}:e instanceof xo?{__type:"BigNumber",value:e.toString()}:"bigint"==typeof e?{__type:"bigint",value:e.toString()}:e instanceof Uint8Array?{__type:"Uint8Array",value:$s().decode(e)}:void 0)),rv="send-form",ov="confirm-sign-and-send-transaction";async function iv(e,t){const n=nv(t);return snap.request({method:"snap_createInterface",params:{ui:e,context:n}})}async function av(e,t,n){const r=nv(n);return snap.request({method:"snap_updateInterface",params:{id:e,ui:t,context:r}})}async function sv(e,t){return snap.request({method:"snap_resolveInterface",params:{id:e,value:t}})}async function cv(e){return snap.request({method:"snap_dialog",params:{id:e}})}async function uv(){return snap.request({method:"snap_getPreferences"})}async function lv(e){const t=await async function(e){const t=await snap.request({method:"snap_getInterfaceContext",params:{id:e}});return t?tv(t):null}(e);if(!t)throw new Error("Interface context not found");return t}var dv=function(e){return e.GetGenesisHash="getGenesisHash",e.GetLatestBlockhash="getLatestBlockhash",e.GetMinimumBalanceForRentExemption="getMinimumBalanceForRentExemption",e}({});const fv=ee({jsonrpc:Km,id:Gm,method:J("getGenesisHash"),params:te(K())}),hv=ee({jsonrpc:Km,id:Gm,method:J("getLatestBlockhash")}),pv=ee({jsonrpc:Km,id:Gm,method:J("getMinimumBalanceForRentExemption"),params:oe([X(),te(ee())])});var gv,mv=function(e){return e.StartSendTransactionFlow="startSendTransactionFlow",e.GetFeeForTransaction="getFeeForTransaction",e}({}),yv=function(e){return e.ListWebSockets="listWebSockets",e.ListSubscriptions="listSubscriptions",e.TestOnStart="testOnStart",e.TestOnInstall="testOnInstall",e.TestOnUpdate="testOnUpdate",e.SynchronizeAccounts="synchronizeAccounts",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"}(gv=gv||(gv={}));const vv={production:[ad.Mainnet,ad.Devnet],local:[ad.Mainnet,ad.Devnet],test:[ad.Localnet,ad.Devnet]},wv=de(K(gd),re(),(e=>e.split(","))),Av=de(K(re()),re(),(e=>e.split(","))),bv=ee({ENVIRONMENT:H(["local","test","production"]),RPC_URL_MAINNET_LIST:wv,RPC_URL_DEVNET_LIST:wv,RPC_URL_TESTNET_LIST:wv,RPC_URL_LOCALNET_LIST:Av,RPC_WEB_SOCKET_URL_MAINNET:gd,RPC_WEB_SOCKET_URL_DEVNET:gd,RPC_WEB_SOCKET_URL_TESTNET:gd,RPC_WEB_SOCKET_URL_LOCALNET:gd,EXPLORER_BASE_URL:gd,PRICE_API_BASE_URL:gd,TOKEN_API_BASE_URL:gd,STATIC_API_BASE_URL:gd,SECURITY_ALERTS_API_BASE_URL:gd,NFT_API_BASE_URL:gd,LOCAL_API_BASE_URL:re()});class Sv{#b;constructor(){const e=this.#S();this.#b=this.#E(e)}#S(){return z({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"},bv)}#E(e){return{environment:e.ENVIRONMENT,networks:[{...fd[ad.Mainnet],rpcUrls:e.RPC_URL_MAINNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_MAINNET},{...fd[ad.Devnet],rpcUrls:e.RPC_URL_DEVNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_DEVNET},{...fd[ad.Testnet],rpcUrls:e.RPC_URL_TESTNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_TESTNET},{...fd[ad.Localnet],rpcUrls:e.RPC_URL_LOCALNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_LOCALNET}],explorerBaseUrl:e.EXPLORER_BASE_URL,activeNetworks:vv[e.ENVIRONMENT],priceApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.PRICE_API_BASE_URL,chunkSize:50,cacheTtlsMilliseconds:{fiatExchangeRates:gv.Minute,spotPrices:gv.Minute,historicalPrices:gv.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:gv.Minute,getNftMetadata:gv.Minute}},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:gv.Second,closeConnectionsGracePeriodMilliseconds:5*gv.Minute}}}get(){return this.#b}getNetworkBy(e,t){const n=this.get().networks.find((n=>n[e]===t));if(!n)throw new Error(`Network ${e} not found`);return n}}const Ev=(new Sv).get(),kv=["local","test"].includes(Ev.environment),Tv=kv?["http://localhost:3000"]:["https://portfolio.metamask.io"],Iv=kv?new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.FilterAccountChains,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,mv.StartSendTransactionFlow,mv.GetFeeForTransaction,dv.GetGenesisHash,dv.GetLatestBlockhash,Am.SignAndSendTransactionWithoutConfirmation,yv.ListWebSockets,yv.ListSubscriptions,yv.TestOnStart,yv.TestOnInstall,yv.TestOnUpdate,yv.SynchronizeAccounts]):new Set([]),xv=new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,Ht.ResolveAccountAddress,mv.StartSendTransactionFlow,mv.GetFeeForTransaction,Am.SignAndSendTransactionWithoutConfirmation]),_v=new Map([]);for(const e of Tv)_v.set(e,Iv);_v.set("metamask",xv);const Cv=(e,t)=>{if(!e)throw new oo("Origin not found");if(!_v.get(e)?.has(t))throw new oo("Permission denied")};function Rv(e,t){try{M(e,t)}catch(e){throw new Gr(e.message)}}function Pv(e,t){try{M(e,t)}catch(e){throw new $r("Invalid Response")}}var Nv=function(e){return e.OnTransactionAdded="onTransactionAdded",e.OnTransactionApproved="onTransactionApproved",e.OnTransactionRejected="onTransactionRejected",e.OnSyncAccount="onSyncAccount",e.RefreshSend="refreshSend",e.RefreshConfirmationEstimation="refreshConfirmationEstimation",e.CloseWebSocketConnections="closeWebSocketConnections",e}({});const Bv=ee({...St.schema,scope:Sd,request:_y}),Ov=ee({scopes:pe(K(Sd)),entropySource:re(),groupIndex:he(X(),0)});Error;function Mv(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 zv(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class Uv extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function jv(e,t="Assertion failed.",n=Uv){if(!e){if(t instanceof Error)throw t;throw zv(n,t)}}function Lv(e,t,n="Assertion failed",r=Uv){try{Pn(e,t)}catch(e){throw zv(r,`${n}: ${Mv(e)}.`)}}function Dv(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function Fv(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function $v(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(Dv(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function qv(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function Wv(e,t="="){if(Dv(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Vv(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function Kv(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],i=Array.from(e);for(i.forEach((e=>{if(Dv(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,a=!0;for(let o=r;o<i.length;o++){const s=i[o],c=t*e+s;if(!Number.isSafeInteger(c)||t*e/t!==e||c-s!=t*e)throw new Error("convertRadix: carry overflow");e=c%n;const u=Math.floor(c/n);if(i[o]=u,!Number.isSafeInteger(u)||u*n+e!==c)throw new Error("convertRadix: carry overflow");a&&(u?a=!1:r=o)}if(o.push(e),a)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}const Gv=(e,t)=>t?Gv(t,e%t):e,Hv=(e,t)=>e+(t-Gv(e,t));function Zv(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Hv(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Hv(t,n)}`);let o=0,i=0;const a=2**n-1,s=[];for(const r of e){if(Dv(r),r>=2**t)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)s.push((o>>i-n&a)>>>0);o&=2**i-1}if(o=o<<n-i&a,!r&&i>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&s.push(o>>>0),s}function Jv(e){return Dv(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Kv(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Kv(t,e,256))}}}function Yv(e,t=!1){if(Dv(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Hv(8,e)>32||Hv(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Zv(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Zv(n,e,8,t))}}}const Qv=Fv(Yv(4),$v("0123456789ABCDEF"),qv("")),Xv=Fv(Yv(5),$v("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Wv(5),qv("")),ew=(Fv(Yv(5),$v("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Wv(5),qv("")),Fv(Yv(5),$v("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),qv(""),Vv((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),Fv(Yv(6),$v("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Wv(6),qv(""))),tw=Fv(Yv(6),$v("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Wv(6),qv("")),nw=(Fv(Yv(6),$v("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),qv("")),e=>Fv(Jv(58),$v(e),qv(""))),rw=nw("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ow=[0,2,3,5,6,7,9,10,11],iw={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=rw.encode(r).padStart(ow[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=ow.indexOf(r.length),i=rw.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)}};Fv($v("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),qv(""));const aw={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)};Fv(Yv(4),$v("0123456789abcdef"),qv(""),Vv((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));n(1048).hp;!function(){const e=[]}();function sw(e){return e instanceof Uint8Array}function cw(e){jv(sw(e),"Value must be a Uint8Array.")}function uw(e,t,n){return new xm({...e,*refiner(r,o){yield*e.refiner(r,o);const i=Tm(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}var lw;!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"}(lw||(lw={}));const dw=Nm({type:Bm()}),fw=(Om(dw,Nm({value:Mm("unknown",(()=>!0))})),Om(dw,Nm({type:zm(lw.Image),value:uw(Bm(),"SVG",(e=>!!e.includes("<svg")||"Value is not a valid SVG."))}))),hw=function(e,t,n=[]){return(...r)=>{if(1===r.length&&Sn(r[0])){const n={...r[0],type:e};return Lv(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 Lv(o,t,`Invalid ${e} component`),o}}(lw.Image,fw,["value"]);async function pw(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 jv("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 cw(e),ew.encode(e)}(r)}`}const gw='<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 mw(e,t){return new xo(e.toString()).div(10**t).toFixed()}function yw(e){return e.split("/")[0]}function vw(e,t){return`${e}/token:${t}`}class ww{#i;#k;#T;#I;#x;#_;#C;#R;#P;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*gv.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,tokenApiClient:o,tokenPricesService:i,cache:a,nftApiClient:s}){this.#i=Xl(t,"[🪙 AssetsService]"),this.#k=e,this.#T=n,this.#I=r,this.#_=o,this.#x=i,this.#C=a,this.#R=s,this.#P=n.get().activeNetworks}#N(e){return{nativeAssetTypes:e.filter((e=>e.endsWith(ld.SOL))),tokenAssetTypes:e.filter((e=>e.includes("/token:"))),nftAssetTypes:e.filter((e=>e.includes("/nft:")))}}#B(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:o,assetReference:i}=Fo(n);t[n]={name:"Solana",symbol:"SOL",fungible:!0,iconUrl:`${this.#T.get().staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${o}/${i}.png`,units:[{name:"Solana",symbol:"SOL",decimals:9}]}}return t}async#O(e){const t=await this.#R.getNftsMetadata(e.map((e=>{const{assetReference:t}=Fo(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.#N(e),[o,i]=await Promise.all([this.#B(t),this.#_.getTokensMetadata(n)]);return{...o,...i}}async#M(e,t=[Cf,Uh],n=[ad.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=nd(this.#z.bind(this),this.#C,{functionName:"AssetsService:fetchTokenAccounts",ttlMilliseconds:ww.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#z(e,t=Cf,n=ad.Mainnet){return(await this.#k.getRpc(n).getTokenAccountsByOwner(Xs(e.address),{programId:t},{encoding:"jsonParsed"}).send()).value.map((t=>({token:t,scope:n,assetType:vw(n,t.account.data.parsed.info.mint),keyringAccount:e})))}async fetch(e){const[t,n]=await Promise.all([this.#U(e),this.#M([e],[Cf,Uh],this.#P)]),r=n.map((e=>e.assetType)),o=await this.#_.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??mw(r,n)}}))]}getNativeAssetTypes(){return this.#P.map((e=>`${e}/${ld.SOL}`))}async#U(e){const t=this.getNativeAssetTypes(),n=Xs(e.address),r=t.map((async t=>{const r=await this.#k.getRpc(yw(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:yw(t),address:n,symbol:"SOL",decimals:9,rawAmount:r.value.toString(),uiAmount:mw(r.value,9)}}));return(await Promise.allSettled(r)).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#j(e,t){const n=Xs(e.address),r=await this.#R.listAddressSolanaNfts(n),o={};for(const e of t){const{assetReference:t}=Fo(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.#x.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.#I.saveMany(e);const n=e=>t(e)&&!(e=>e.assetType.includes(ld.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 vn(snap,gn.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 vn(snap,gn.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.#I.getAll()}async findByAccount(e){const{id:t,address:n}=e,r=await this.#I.findByKeyringAccountId(t),o=this.getNativeAssetTypes(),i=[];for(const t of o){if(!r.some((e=>e.assetType===t))){const r=yw(t);i.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:"SOL",decimals:9,rawAmount:"0",uiAmount:"0"})}}return[...r,...i]}static generateImageComponent=async(e,t=48,n=48)=>e?async function(e,{width:t,height:n=t,request:r}){jv("number"==typeof t&&t>0,"Expected width to be a number greater than 0."),jv("number"==typeof n&&n>0,"Expected height to be a number greater than 0.");const o=await pw(e,r),i=`width="${t}" height="${n}"`;return hw(`<svg ${i.trim()} xmlns="http://www.w3.org/2000/svg"><image ${i.trim()} href="${o}" /></svg>`)}(e,{width:t,height:n}).then((e=>e.value)).catch((()=>gw)):gw}class Aw{#k;#i;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#k=e,this.#i=Xl(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.#k.getRpc(n),i=await qg(e,o,r);if("instructions"in i)return this.#L(i,t,n);if(Object.values(i.signatures).every((e=>!e))){const{messageBytes:e}=i,a=await Dg(e,o,r);return this.#L(a,t,n)}return this.#D(i,t)}async#L(e,t,n){const r=lu(e)?e.lifetimeConstraint:await this.#k.getLatestBlockhash(n),o=am(e),i=Aw.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,a=!cm(e)||!o,{privateKeyBytes:s}=await ev({entropySource:t.entropySource,derivationPath:t.derivationPath}),c=await vl(s),u=await uu(e,(e=>om(c.address,e)),(e=>{return t=r,lu(n=e)?n:du(t,n);var t,n}),(e=>((e,t,n)=>am(e)?e:Qu([lf(t,n)],e))(e,{microLamports:i})),(async e=>a?um(e,this.#k.getRpc(n)):e)),l=ml([c],u);return await Al(l)}async#D(e,t){const{privateKeyBytes:n}=await ev({entropySource:t.entropySource,derivationPath:t.derivationPath});return al([await Ec(n)],e)}}const bw=(e,t)=>{const{to:n,type:r,status:o}=e,{address:i}=t;if(!(r===xt.Receive||o===It.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce(((e,t)=>t.address!==i||!t.asset?.fungible||t.asset.type!==sd.SolMainnet&&t.asset.type!==sd.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)}),{hasReceivedSOL:!1,receivedSOLAmount:new xo(0)});return a&&s.isLessThan(.001)};function Sw(e,t){return[bw].some((n=>n(e,t)))}class Ew{#F;#$;#T;#q;#i;#W=new Map;constructor(e,t,n,r,o){this.#F=e,this.#$=t,this.#T=n,this.#q=r,this.#i=Xl(o,"[🔔 SubscriptionService]"),this.#V()}#V(){this.#q.on("onInactive",this.#K.bind(this)),this.#q.on("onWebSocketEvent",this.#G.bind(this)),this.#q.on("onListSubscriptions",this.#H.bind(this));const{activeNetworks:e}=this.#T.get();e.forEach((e=>{this.#F.onConnectionRecovery(e,this.#Z.bind(this))}))}registerNotificationHandler(e,t,n){this.#i.info("Registering notification handler",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#W.has(r)||this.#W.set(r,new Set),this.#W.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#F.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.#J(e),a=await this.#$.getById(i);if(a){if("confirmed"===a.status)return i;await this.#$.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.#$.save(s);const c=await this.#F.findByNetwork(r),u=async e=>{const r={jsonrpc:"2.0",id:i,method:t,params:n};e&&await this.#Y(e,r)};return c&&await u(c.id),s.id}async unsubscribe(e){this.#i.info("Unsubscribing from",e);const t=await this.#$.getById(e);if(!t)return void this.#i.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:o}=t,i=nm[o];if("confirmed"===t.status){const e=await this.#F.findByNetwork(r);e&&await this.#Y(e.id,{jsonrpc:"2.0",id:globalThis.crypto.randomUUID(),method:i,params:[t.rpcSubscriptionId]})}await this.#$.delete(n)}async getAll(){return this.#$.getAll()}async#G(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.#F.findById(e.id);if(n)switch(this.#i.info("Received message",e),t.method){case"accountNotification":case"programNotification":case"signatureNotification":await this.#Q(t,n.network);break;default:this.#X(t)?await this.#ee(t):Qm(t)?await this.#te(t):this.#i.warn("Received unknown message",t)}}async#Q(e,t){const{subscription:n}=e.params,r=await this.#$.findBy("rpcSubscriptionId",n);if(!r)return void this.#i.warn("No subscription found for RPC ID:",n);const o=`${r.method}:${t}`,i=this.#W.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#Y(e,t){this.#i.info(`Sending message to connection ${e}`,t),await snap.request({method:"snap_sendWebSocketMessage",params:{id:e,message:JSON.stringify(t)}})}#X(e){return"jsonrpc"in e&&"2.0"===e.jsonrpc&&"id"in e&&"result"in e}async#ee(e){const{id:t,result:n}=e,r=await this.#$.getById(String(t));r?"confirmed"!==r.status?(await this.#$.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 the subscription is already confirmed for request ID: ${t}.`):this.#i.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#te(e){if("id"in e&&void 0!==e.id){const t=await this.#$.getById(String(e.id));"pending"===t?.status?(await this.#$.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#J(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#ne(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}#ne(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.#ne(e))).join(",")}]`;const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));return`{${t.map((t=>`"${t}":${this.#ne(e[t])}`)).join(",")}}`}async#H(){const e=await this.#$.getAll();this.#i.info("Subscriptions",{subscriptions:e,notificationHandlers:this.#W})}#re(e){return{method:e.method,params:e.params,network:e.network,...e.expiryMilliseconds?{expiryMilliseconds:e.expiryMilliseconds}:{},...e.metadata?{metadata:e.metadata}:{}}}async#Z(e){this.#i.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#$.getAll()).filter((t=>t.network===e)).filter(Ew.#oe),n=t.map((e=>e.id));await this.#$.deleteMany(n),await Promise.allSettled(t.map((async e=>{await this.subscribe(this.#re(e))})))}async#K(){this.#i.info("Client became inactive"),await this.#ie()}async#ie(){this.#i.info("Removing expired subscriptions");const e=(await this.#$.getAll()).filter(Ew.#ae);await Promise.allSettled(e.map((async e=>{await this.unsubscribe(e.id)})))}static#ae(e){const t=new Date;return Boolean(e.expiresAt&&new Date(e.expiresAt)<t)}static#oe(e){return!Ew.#ae(e)}}function kw(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 Tw(e,t,n){return kw(e,t,n)}const Iw='<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 xw(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function _w(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:xw(r),key:n}}}const Cw=_w("Container"),Rw=_w("Box"),Pw=_w("Heading"),Nw=_w("Text"),Bw=_w("Section"),Ow=_w("Row"),Mw=_w("Address"),zw=_w("Image"),Uw=_w("Footer"),jw=_w("Button"),Lw=_w("Link");function Dw(e,t,n){const{cluster:r}=fd[e];return Bd({baseUrl:"https://solscan.io",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const Fw=({domain:e,scope:t,address:n})=>kw(Rw,{direction:"horizontal",alignment:"center",children:kw(Lw,{href:Dw(t,"address",n),children:e})});function $w(e,t){return`${e}:${t}`}const qw=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."}}}'),Ww=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."}}}'),Vw={en:qw.D,es:Ww.D},Kw="en";function Gw(e){const t=Vw[e]??Vw[Kw];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 Hw(e){if(e===id)return"MetaMask";try{return new URL(e).hostname}catch(e){throw new Error("Invalid URL")}}const Zw=({label:e,value:t})=>null!=t?Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:e}),kw(Nw,{children:t})]}):null,Jw=1e-6,Yw=3,Qw="0",Xw=new xo(Jw).decimalPlaces();function eA(e,t){const[n]=t.split("_");try{const r=new xo(e);if(r.isNaN())return Qw;if(r.isZero())return Qw;if(r.abs().lt(Jw))return`<${function(e,t){const n=new xo(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,Jw)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:Yw}).format(Number(r.toFixed(Xw??0)));const o=r.abs().integerValue().toString().length,i=Math.max(0,Yw-o+1);return new Intl.NumberFormat(t,{maximumFractionDigits:i}).format(r.toFixed(i))}catch(e){return ed.error(e),Qw}}function tA(e,t,n){const r=new xo(e).toNumber(),[o]=n.split("_");return r.toLocaleString(o,{style:"currency",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const nA=({asset:e,preferences:t})=>{const n=e.type;return Tw(Rw,{direction:"vertical",crossAlignment:"end",children:[Tw(Rw,{direction:"horizontal",alignment:"center",children:[Tw(Nw,{color:"in"===n?"success":"error",children:["in"===n?"+":"-",eA(e.value??0,t.locale)]}),e.imageSvg?kw(Rw,{alignment:"center",center:!0,children:kw(zw,{borderRadius:"full",src:e.imageSvg})}):null,kw(Nw,{children:e.symbol??""})]}),e.price?kw(Nw,{color:"muted",children:tA(e.price.toString(),t.currency,t.locale)}):null]})},rA=_w("Tooltip");var oA;!function(e){e.AddSquare="add-square",e.Add="add",e.Arrow2Down="arrow-2-down",e.Arrow2Left="arrow-2-left",e.Arrow2Right="arrow-2-right",e.Arrow2Up="arrow-2-up",e.Arrow2UpRight="arrow-2-up-right",e.ArrowDoubleLeft="arrow-double-left",e.ArrowDoubleRight="arrow-double-right",e.ArrowDown="arrow-down",e.ArrowLeft="arrow-left",e.ArrowRight="arrow-right",e.ArrowUp="arrow-up",e.BankToken="bank-token",e.Bank="bank",e.Book="book",e.Bookmark="bookmark",e.Bridge="bridge",e.Calculator="calculator",e.CardPos="card-pos",e.CardToken="card-token",e.Card="card",e.Category="category",e.Chart="chart",e.CheckBold="check-bold",e.Check="check",e.Clock="clock",e.Close="close",e.CodeCircle="code-circle",e.Coin="coin",e.Confirmation="confirmation",e.Connect="connect",e.CopySuccess="copy-success",e.Copy="copy",e.Customize="customize",e.Danger="danger",e.Dark="dark",e.Data="data",e.Diagram="diagram",e.DocumentCode="document-code",e.DragDrop="drag-drop",e.DraggingAnimation="dragging-animation",e.PinningAnimation="pinning-animation",e.Edit="edit",e.Eraser="eraser",e.Ethereum="ethereum",e.Expand="expand",e.Explore="explore",e.Export="export",e.EyeSlash="eye-slash",e.Eye="eye",e.Filter="filter",e.Flag="flag",e.FlashSlash="flash-slash",e.Flash="flash",e.FullCircle="full-circle",e.Gas="gas",e.GlobalSearch="global-search",e.Global="global",e.Graph="graph",e.Hardware="hardware",e.Heart="heart",e.Hierarchy="hierarchy",e.Home="home",e.Import="import",e.Info="info",e.Key="key",e.Light="light",e.Link="link",e.Loading="loading",e.LockCircle="lock-circle",e.LockSlash="lock-slash",e.Lock="lock",e.Login="login",e.Logout="logout",e.Menu="menu",e.MessageQuestion="message-question",e.Messages="messages",e.MinusBold="minus-bold",e.MinusSquare="minus-square",e.Minus="minus",e.Mobile="mobile",e.Money="money",e.Monitor="monitor",e.MoreHorizontal="more-horizontal",e.MoreVertical="more-vertical",e.NotificationCircle="notification-circle",e.Notification="notification",e.PasswordCheck="password-check",e.People="people",e.Pin="pin",e.ProgrammingArrows="programming-arrows",e.Custody="custody",e.Question="question",e.Received="received",e.Refresh="refresh",e.Save="save",e.ScanBarcode="scan-barcode",e.ScanFocus="scan-focus",e.Scan="scan",e.Scroll="scroll",e.Search="search",e.SecurityCard="security-card",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.Send1="send-1",e.Send2="send-2",e.Setting="setting",e.Slash="slash",e.SnapsMobile="snaps-mobile",e.SnapsPlus="snaps-plus",e.Snaps="snaps",e.Speedometer="speedometer",e.Star="star",e.Stake="stake",e.Student="student",e.SwapHorizontal="swap-horizontal",e.SwapVertical="swap-vertical",e.Tag="tag",e.Tilde="tilde",e.Timer="timer",e.Trash="trash",e.TrendDown="trend-down",e.TrendUp="trend-up",e.UserCircleAdd="user-circle-add",e.UserCircleLink="user-circle-link",e.UserCircleRemove="user-circle-remove",e.UserCircle="user-circle",e.User="user",e.WalletCard="wallet-card",e.WalletMoney="wallet-money",e.Wallet="wallet",e.Warning="warning",e.Twitter="twitter",e.QrCode="qr-code",e.UserCheck="user-check",e.Unpin="unpin",e.Ban="ban",e.Bold="bold",e.CircleX="circle-x",e.Download="download",e.FileIcon="file",e.Flask="flask",e.Plug="plug",e.Share="share",e.Square="square",e.Tint="tint",e.Upload="upload",e.Usb="usb",e.Wifi="wifi",e.PlusMinus="plus-minus"}(oA||(oA={}));const iA=_w("Icon"),aA=({preferences:e})=>{const t=Gw(e.locale);return Tw(Rw,{direction:"horizontal",center:!0,children:[kw(Nw,{fontWeight:"medium",children:t("confirmation.estimatedChanges")}),kw(rA,{content:t("confirmation.estimatedChanges.tooltip"),children:kw(iA,{name:"info"})})]})},sA=_w("Skeleton"),cA=({preferences:e})=>{const t=Gw(e.locale);return Tw(Bw,{direction:"vertical",children:[kw(aA,{preferences:e}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.send")}),kw(Rw,{children:Tw(Rw,{direction:"vertical",crossAlignment:"end",children:[kw(sA,{width:100,height:20}),kw(sA,{width:40,height:20})]})})]}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.receive")}),kw(Rw,{children:Tw(Rw,{direction:"vertical",crossAlignment:"end",children:[kw(sA,{width:100,height:20}),kw(sA,{width:40,height:20})]})})]})]})},uA=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const o=Gw(t.locale),i="fetched"===n,a="error"===n;if("fetching"===n)return kw(cA,{preferences:t});if(a||i&&"ERROR"===r)return Tw(Bw,{direction:"vertical",children:[kw(aA,{preferences:t}),kw(Nw,{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 Tw(Bw,i&&!u?{direction:"vertical",children:[kw(aA,{preferences:t}),kw(Nw,{color:"alternative",children:o("confirmation.estimatedChanges.noChanges")})]}:{children:[kw(aA,{preferences:t}),s?.length>0?Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.send")}),kw(Rw,{children:kw(Rw,{children:s?.map((e=>kw(nA,{asset:e,preferences:t})))})})]}):null,kw(Rw,{children:null}),c?.length>0?Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.receive")}),kw(Rw,{children:kw(Rw,{children:c?.map((e=>kw(nA,{asset:e,preferences:t})))})})]}):null]})};var lA=function(e){return e.Cancel="confirm-sign-in-cancel",e.Confirm="confirm-sign-in-confirm",e}({});const dA={"confirm-sign-in-cancel":async function({id:e}){await sv(e,!1)},"confirm-sign-in-confirm":async function({id:e}){await sv(e,!0)}},fA=({params:e,origin:t,account:n,scope:r,preferences:o,networkImage:i})=>{const a=Gw(o.locale),s=t?Hw(t):null,{domain:c,statement:u,uri:l,version:d,chainId:f,nonce:h,issuedAt:p,expirationTime:g,notBefore:m,requestId:y,resources:v,address:w}=e,A=$w(r,n.address),b=w?$w(r,w):null,S=b!==A,E=c!==s;return Tw(Cw,{children:[Tw(Rw,{children:[Tw(Rw,{alignment:"center",center:!0,children:[kw(Rw,{children:null}),kw(Pw,{size:"lg",children:a("confirmation.signIn.title")}),kw(Nw,{color:"muted",alignment:"center",children:a("confirmation.signIn.description")})]}),o.simulateOnChainActions?kw(uA,{changes:null,scanStatus:null,preferences:o,scanFetchStatus:"fetched"}):null,Tw(Bw,{children:[s?kw(Ow,{label:a("confirmation.origin"),tooltip:a("confirmation.origin.tooltip"),children:kw(Nw,{children:s})}):null,kw(Ow,{variant:E?"critical":"default",label:a("confirmation.signIn.domain"),tooltip:E?a("confirmation.signIn.badDomain"):void 0,children:kw(Nw,{children:c??a("confirmation.signIn.unknownDomain")})}),kw(Ow,{label:a("confirmation.signIn.signingInWith"),tooltip:S?a("confirmation.signIn.badAccount"):void 0,variant:S?"warning":"default",children:n.domain?kw(Fw,{domain:n.domain,scope:r,address:n.address}):kw(Mw,{address:A,truncate:!0,displayName:!0,avatar:!0})})]}),Tw(Bw,{children:[kw(Nw,{fontWeight:"medium",children:a("confirmation.signIn.message")}),kw(Nw,{children:u??""}),kw(Zw,{label:"URL",value:l??""}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Tw(Rw,{direction:"horizontal",alignment:"center",children:[kw(Rw,{alignment:"center",center:!0,children:kw(zw,{borderRadius:"medium",src:i??Iw})}),kw(Nw,{children:fd[r].name})]})]}),b?Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),kw(Mw,{address:b,truncate:!0,displayName:!0,avatar:!0})]}):null,kw(Zw,{label:a("confirmation.signIn.version"),value:d??""}),kw(Zw,{label:a("confirmation.signIn.chainId"),value:f??""}),kw(Zw,{label:a("confirmation.signIn.nonce"),value:h??""}),kw(Zw,{label:a("confirmation.signIn.issuedAt"),value:p??""}),kw(Zw,{label:a("confirmation.signIn.expirationTime"),value:g??""}),kw(Zw,{label:a("confirmation.signIn.notBefore"),value:m??""}),kw(Zw,{label:a("confirmation.signIn.requestId"),value:y??""}),v&&v.length>0?Tw(Rw,{alignment:"space-between",direction:"vertical",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:a("confirmation.signIn.resources")}),kw(Rw,{direction:"vertical",children:v.map((e=>kw(Nw,{children:e},e)))})]}):null]})]}),Tw(Uw,{children:[kw(jw,{name:lA.Cancel,children:a("confirmation.cancelButton")}),kw(jw,{name:lA.Confirm,variant:E?"destructive":"primary",children:a("confirmation.confirmButton")})]})]})};var hA=function(e){return e.Cancel="confirm-sign-message-cancel",e.Confirm="confirm-sign-message-confirm",e}({});const pA={"confirm-sign-message-cancel":async function({id:e}){await sv(e,!1)},"confirm-sign-message-confirm":async function({id:e}){await sv(e,!0)}},gA=({message:e,account:t,scope:n,locale:r,networkImage:o,origin:i})=>{const a=Gw(r),{address:s}=t,c=i?Hw(i):null,u=$w(n,s);return Tw(Cw,{children:[Tw(Rw,{children:[Tw(Rw,{alignment:"center",center:!0,children:[kw(Rw,{children:null}),kw(Pw,{size:"lg",children:a("confirmation.signMessage.title")})]}),Tw(Bw,{children:[kw(Rw,{direction:"horizontal",center:!0,children:kw(Nw,{fontWeight:"medium",children:a("confirmation.signMessage.message")})}),kw(Rw,{alignment:"space-between",children:kw(Nw,{children:e})})]}),Tw(Bw,{children:[c?Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[Tw(Rw,{alignment:"space-between",direction:"horizontal",center:!0,children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:a("confirmation.origin")}),kw(rA,{content:a("confirmation.origin.tooltip"),children:kw(iA,{name:"question",color:"muted"})})]}),kw(Nw,{children:c})]}):null,Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),t.domain?kw(Fw,{domain:t.domain,scope:n,address:s}):kw(Mw,{address:u,truncate:!0,displayName:!0,avatar:!0})]}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Tw(Rw,{direction:"horizontal",alignment:"center",children:[kw(Rw,{alignment:"center",center:!0,children:kw(zw,{borderRadius:"medium",src:o??Iw})}),kw(Nw,{children:fd[n].name})]})]})]})]}),Tw(Uw,{children:[kw(jw,{name:hA.Cancel,children:a("confirmation.cancelButton")}),kw(jw,{name:hA.Confirm,children:a("confirmation.confirmButton")})]})]})};var mA=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 yA={"confirm-sign-and-send-transaction-show-advanced":async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await av(e,kw(RA,{context:n}),n)},"confirm-sign-and-send-transaction-cancel":async function({id:e}){await sv(e,!1)},"confirm-sign-and-send-transaction-confirm":async function({id:e}){await sv(e,!0)}},vA=e=>e.replace(/([A-Z])/gu," $1").trim().replace(/^./u,(e=>e.toUpperCase())),wA=({address:e,scope:t})=>kw(Lw,{href:Dw(t,"address",e),children:kw(Mw,{avatar:!1,address:$w(t,e),truncate:!0})}),AA=({instruction:e,scope:t,locale:n})=>{const r=Gw(n),{type:o,encoded:i,parsed:a}=e,{programAddress:s,dataBase58:c}=i,u=null!==a,l=vA(o);return Tw(Bw,{alignment:"start",children:[kw(Nw,{color:"alternative",fontWeight:"bold",children:l}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{color:"alternative",alignment:"start",children:r("confirmation.advanced.programId")}),kw(wA,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map((([e,n])=>Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{color:"alternative",children:vA(e)}),Ys(n.address)?kw(wA,{address:n.address,scope:t}):kw(Nw,{children:tv(n.address)?.toString()??""})]}))),u&&Object.entries(a.data).map((([e,n])=>Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{color:"alternative",children:vA(e)}),Ys(n)?kw(wA,{address:n,scope:t}):kw(Nw,{children:tv(n)?.toString()??""})]}))),!u&&Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{color:"alternative",children:r("confirmation.advanced.data")}),kw(Nw,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},bA=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const o=Gw(n),i=t?"hide":"show",a=t?"arrow-up":"arrow-down";return Tw(Rw,{alignment:"start",children:[Tw(jw,{name:mA.ShowAdvanced,children:[o(`confirmation.advanced.${i}`)," ",kw(iA,{name:a,color:"primary"})]}),t&&kw(Rw,{children:e.map((e=>kw(AA,{locale:n,scope:r,instruction:e})))})]})},SA=_w("Banner"),EA={AccountAlreadyInUse:"transactionScan.errors.accountAlreadyInUse",ResultWithNegativeLamports:"transactionScan.errors.insufficientSol",SlippageToleranceExceeded:"transactionScan.errors.slippageToleranceExceeded",ExceededDesiredSlippageLimit:"transactionScan.errors.slippageToleranceExceeded"};function kA(e,t){const n=Gw(t.locale),{code:r}=e;return n((r&&EA[r])??"transactionScan.errors.unknownError")}const TA={Malicious:"danger",Warning:"warning"},IA=({preferences:e,validation:t,error:n,scanFetchStatus:r})=>{const o=Gw(e.locale);if("error"===r)return kw(SA,{title:o("send.simulationTitleAPIError"),severity:"danger",children:kw(Nw,{children:o("send.simulationMessageAPIError")})});if(!n&&!t)return kw(Rw,{children:null});if(n)return kw(SA,{title:o("confirmation.simulationErrorTitle"),severity:"warning",children:kw(Nw,{children:o("confirmation.simulationErrorSubtitle",{reason:kA(n,e)})})});if(!t)return kw(Rw,{children:null});const i=t?.type?TA[t.type]:void 0;return i?Tw(SA,{title:o("confirmation.validationErrorTitle"),severity:i,children:[kw(Nw,{children:o("confirmation.validationErrorSubtitle")}),kw(Nw,{size:"sm",children:kw(Lw,{href:"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/",children:o("confirmation.validationErrorLearnMore")})}),Tw(Nw,{size:"sm",children:[kw(iA,{color:"primary",name:"security-tick"})," ",o("confirmation.validationErrorSecurityAdviced")," ",kw(Lw,{href:"https://www.blockaid.io",children:"Blockaid"})]})]}):kw(Rw,{children:null})};function xA(e,t,n){return`${eA(e,n)} ${t}`}function _A(e,t){return new xo(e).multipliedBy(t).toString()}const CA=({origin:e,accountAddress:t,scope:n,feeInSol:r,nativePrice:o,fetchingPricesStatus:i,preferences:a,networkImage:s})=>{const{currency:c,locale:u}=a,l=Gw(u),d=e?Hw(e):null,f="fetching"===i,h=r&&o&&!("error"===i)?tA(_A(r,o),c,u):"";return Tw(Bw,{children:[d?Tw(Rw,{children:[Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[Tw(Rw,{alignment:"space-between",direction:"horizontal",center:!0,children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:l("confirmation.origin")}),kw(rA,{content:l("confirmation.origin.tooltip"),children:kw(iA,{name:"question",color:"muted"})})]}),kw(Nw,{children:d})]}),kw(Rw,{children:null})]}):null,Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:l("confirmation.account")}),kw(Mw,{address:$w(n,t),truncate:!0,displayName:!0,avatar:!0})]}),kw(Rw,{children:null}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:l("confirmation.network")}),Tw(Rw,{direction:"horizontal",alignment:"center",children:[kw(Rw,{alignment:"center",center:!0,children:kw(zw,{borderRadius:"medium",src:s??""})}),kw(Nw,{children:fd[n].name})]})]}),kw(Rw,{children:null}),Tw(Rw,{alignment:"space-between",direction:"horizontal",children:[kw(Nw,{fontWeight:"medium",color:"alternative",children:l("confirmation.fee")}),r?Tw(Rw,{direction:"horizontal",alignment:"center",children:[f?kw(sA,{width:80}):kw(Nw,{color:"muted",children:h}),kw(Nw,{children:xA(r,fd[n].nativeToken.symbol,u)})]}):kw(rA,{content:l("confirmation.feeError"),children:kw(iA,{name:"warning"})})]})]})},RA=({context:e})=>{const t=Gw(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=fd[e.scope],o=e.tokenPrices[r.caip19Id]?.price??null,i="fetching"===e.scanFetchStatus||"ERROR"===e.scan?.status;return Tw(Cw,{children:[Tw(Rw,{children:[e.preferences.useSecurityAlerts?kw(IA,{scanFetchStatus:e.scanFetchStatus,validation:e.scan?.validation??null,error:e.scan?.error??null,preferences:e.preferences}):null,Tw(Rw,{alignment:"center",center:!0,children:[kw(Rw,{children:null}),kw(Pw,{size:"lg",children:t(`confirmation.${e.method}.title`)}),kw(Rw,{children:null})]}),e.preferences.simulateOnChainActions?kw(uA,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,kw(CA,{accountAddress:e.account?.address??null,scope:e.scope,feeInSol:n,nativePrice:o,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),kw(bA,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),Tw(Uw,{children:[kw(jw,{name:mA.Cancel,children:t("confirmation.cancelButton")}),kw(jw,{name:mA.Confirm,disabled:i,children:t("confirmation.confirmButton")})]})]})},PA={method:$t.SignAndSendTransaction,scope:ad.Mainnet,networkImage:Iw,account: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 NA(e){const t={...PA,...e},n=uv().then((e=>{t.preferences=e})).catch((()=>{t.preferences=PA.preferences})),r=(async(e,t)=>{const n=await qg(t,e),r="instructions"in n?n:await Dg(n.messageBytes,e),{instructions:o}=r;return o.map(Xg)})(hE.getRpc(t.scope),t.transaction).then((e=>{t.advanced.instructions=e})).catch((e=>{ed.error(e),t.advanced.instructions=[]}));await Promise.all([n,r]);const{currency:o,useExternalPricingData:i,useSecurityAlerts:a,simulateOnChainActions:s}=t.preferences,c=await iv(kw(RA,{context:t}),t),u=cv(c),l={...t},d=[fd[t.scope].nativeToken.caip19Id];i?await SE.getMultipleSpotPrices(d,o).then((e=>{l.tokenPrices=e,l.tokenPricesFetchStatus="fetched"})).catch((()=>{l.tokenPricesFetchStatus="error"})):(l.tokenPricesFetchStatus="fetched",l.tokenPrices={});let f=null;try{const{totalFee:e}=ym.calculateFee(t.transaction);f=vm(e).toString()}catch{f=null}l.feeEstimatedInSol=f,await av(c,kw(RA,{context:l}),l);const h={...l},p=[];if(s&&p.push("simulation"),a&&p.push("validation"),s||a){const e=ME.scanTransaction({method:h.method,accountAddress:h.account?.address??"",transaction:h.transaction,scope:h.scope,origin:h.origin,options:p}).then((async e=>{h.scan=e,h.scanFetchStatus=e?"fetched":"error"})).catch((()=>{h.scan=null,h.scanFetchStatus="error"}));await Promise.all([e])}else h.scanFetchStatus="fetched",h.scan=null;return await av(c,kw(RA,{context:h}),h),await uE.setKey(`mapInterfaceNameToId.${ov}`,c),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}}),u}function BA(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=OA(e,r);if(n?.length){r+=n.length-1,n.match(/\.|[eE]-/)?t.push(n):t.push(MA(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 OA(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 MA(e){return`{"$n":"${e}"}`}var zA=0n;function UA(){const e=zA;return zA++,e.toString()}function jA(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 Sa(ma,{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 LA(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:UA(),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 DA(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 FA={};function $A(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 qA(e,t){return n=>{const r=$A(e);return Object.freeze({...n,params:r(n.params,t)})}}function WA(e){return"bigint"==typeof e?Number(e):e}function VA({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 KA(e){return(t,{keyPath:n})=>("bigint"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var GA={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 HA(e){const t=e?.onIntegerOverflow;return n=>{return uu(n,t?(r=t,e=>qA([KA(((...t)=>r(e,...t)))],{keyPath:[]})(e)):e=>e,qA([WA],{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:VA({commitmentPropertyName:"sendTransaction"===o?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:GA}));var r}}function ZA(e){return t=[JA(e)],n={keyPath:[]},e=>$A(t)(e,n);var t,n}function JA(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!==FA||"number"!=typeof r))return!1}return!0}))}(n,e)?Number(t):BigInt(t):t}}function YA(e){return(t,n)=>{const r=n.methodName,o=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return uu(t,(e=>(e=>{const t=e;if("error"in t)throw Ca(t.error);return t})(e)),(e=>e.result),(e=>ZA(o??[])(e,n)))}}var QA,XA=[["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",FA,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",FA,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",FA,"state","preUpdateAverageRate"],["data","parsed","info","extensions",FA,"state","currentRate"]],eb=[...XA,["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",FA,"confirmationCount"]],tb=[["index"],["instructions",FA,"accounts",FA],["instructions",FA,"programIdIndex"],["instructions",FA,"stackHeight"]],nb=[["addressTableLookups",FA,"writableIndexes",FA],["addressTableLookups",FA,"readonlyIndexes",FA],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",FA,"accounts",FA],["instructions",FA,"programIdIndex"],["instructions",FA,"stackHeight"]];function rb(e){return LA({requestTransformer:HA(e),responseTransformer:YA({allowedNumericKeyPaths:ob()})})}function ob(){return QA||(QA={getAccountInfo:eb.map((e=>["value",...e])),getBlock:[["transactions",FA,"meta","preTokenBalances",FA,"accountIndex"],["transactions",FA,"meta","preTokenBalances",FA,"uiTokenAmount","decimals"],["transactions",FA,"meta","postTokenBalances",FA,"accountIndex"],["transactions",FA,"meta","postTokenBalances",FA,"uiTokenAmount","decimals"],["transactions",FA,"meta","rewards",FA,"commission"],...tb.map((e=>["transactions",FA,"meta","innerInstructions",FA,...e])),...nb.map((e=>["transactions",FA,"transaction","message",...e])),["rewards",FA,"commission"]],getClusterNodes:[[FA,"featureSet"],[FA,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[FA,"commission"]],getMultipleAccounts:eb.map((e=>["value",FA,...e])),getProgramAccounts:eb.flatMap((e=>[["value",FA,"account",...e],[FA,"account",...e]])),getRecentPerformanceSamples:[[FA,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:XA.map((e=>["value",FA,"account",...e])),getTokenAccountsByOwner:XA.map((e=>["value",FA,"account",...e])),getTokenLargestAccounts:[["value",FA,"decimals"],["value",FA,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",FA,"accountIndex"],["meta","preTokenBalances",FA,"uiTokenAmount","decimals"],["meta","postTokenBalances",FA,"accountIndex"],["meta","postTokenBalances",FA,"uiTokenAmount","decimals"],["meta","rewards",FA,"commission"],...tb.map((e=>["meta","innerInstructions",FA,...e])),...nb.map((e=>["transaction","message",...e]))],getVersion:[["feature-set"]],getVoteAccounts:[["current",FA,"commission"],["delinquent",FA,"commission"]],simulateTransaction:[...eb.map((e=>["value","accounts",FA,...e])),...tb.map((e=>["value","innerInstructions",FA,...e]))]}),QA}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 ib=["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 ab(e){return DA(e)&&ib.includes(e.method)}function sb(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 Sa(ga,{headers:c.headers,message:c.statusText,statusCode:c.status});return t?t(await c.text(),e):await c.json()}}({...e,fromJson:(e,t)=>ab(t)?BA(e):JSON.parse(e),toJson:e=>{return ab(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 cb=Object.prototype.toString,ub=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function lb(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 lb(e.toJSON(),t);if(c=cb.call(e),"[object Array]"===c){for(o="[",r=e.length-1,n=0;n<r;n++)o+=lb(e[n],!0)+",";return r>-1&&(o+=lb(e[n],!0)),o+"]"}if("[object Object]"===c){for(i=ub(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=lb(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 db(e){const t=lb(e,!1);if(void 0!==t)return""+t}function fb(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 Sa(pa,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...void 0!==o?{path:o}:void 0});return Ea(i,fb),i}var hb,pb={defaultCommitment:"confirmed",onIntegerOverflow(e,t,n){throw fb(e.methodName,t,n)}},gb=globalThis.AbortController;function mb(e){return DA(e)?db([e.method,e.params]):void 0}function yb(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function vb(e){return uu(sb({...e,headers:{...!1,...e.headers?yb(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 gb,o=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(hb||={}))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(hb||={})})),n(e.target.reason)};i.addEventListener("abort",r),e.then(t).catch(n).finally((()=>{i.removeEventListener("abort",r)}))}))}return await s.responsePromise}}(e,mb)))}function wb(e){return jA({api:rb(pb),transport:e})}const Ab=Ql,bb=["getTransaction","getSignaturesForAddress"],Sb=e=>{const t=vb({url:e}),n=vb({url:e,headers:{"x-bigtable":"disabled"}});return async(...e)=>{const{payload:r}=e[0],{method:o}=r,i=bb.includes(o);return Ab.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${o}. ${i?"Enabling":"Disabling"} BigTable lookups.`),i?t(...e):n(...e)}},Eb=Ql;async function kb(e){try{await snap.request({method:"snap_trackError",params:{error:qr(new Error(JSON.stringify(e)))}}),Eb.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){Eb.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}function Tb(e){return!(!U(e,Hm)&&!Qm(e))||!!ba(e)}const Ib=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{Eb.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const o=await e(...t);if(Tb(o)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(o)}`,responseData:o,requestParams:n};return await kb(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 kb(t),e instanceof Error?e:new Error(t.errorMessage)}},xb=Ql;async function _b(e){return new Promise((t=>setTimeout(t,e)))}const Cb=Ql;const Rb=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;let o;for(let n=0;n<4;n++)try{return Cb.info(`[🚌 RetryingTransport] Attempt "${r}" ${n+1} of 4`),await e(...t)}catch(e){if(Cb.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));Cb.info(`[🚌 RetryingTransport] Sleeping for ${e}ms`),await _b(e)}}var i;throw o},Pb=e=>{return uu(e,(t=Sb,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 xb.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;xb.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)),Rb,(e=>Ib(e)));var t};var Nb,Bb=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ob=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}(),Mb=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}(),zb=(Nb=function(e,t){return Nb=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])},Nb(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}Nb(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function Ub(e,t,n){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}function jb(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 Lb=Bb.concat(["bool","string"]),Db=["option","enum","array","set","map","struct"],Fb=function(e){function t(t,n){var r="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return e.call(this,r)||this}return zb(t,e),t}(Error);function $b(e){if("string"!=typeof e||!Lb.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&Db.includes(t[0])){var n=t[0];if("option"===n)return $b(e[n]);if("enum"===n)return function(e){if(!Array.isArray(e))throw new Fb(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');$b({struct:r.struct})}}(e[n]);if("array"===n)return function(e){if("object"!=typeof e)throw new Fb(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return $b(e.type);throw new Fb(e,"{ type, len? }")}(e[n]);if("set"===n)return $b(e[n]);if("map"===n)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new Fb(e,"{ key, value }");$b(e.key),$b(e.value)}(e[n]);if("struct"===n)return function(e){if("object"!=typeof e)throw new Fb(e,"object");for(var t in e)$b(e[t])}(e[n])}}throw new Fb(e,Db.join(", ")+" or "+Lb.join(", "))}}!function(){function e(e){this.encoded=new Ob,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(Bb.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&&Ub(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&&Ub(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&&Ub(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?jb(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?jb(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&&Ub(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&&Ub(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&&Ub(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 qb=function(){function e(e){this.buffer=new Mb(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(Bb.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 Wb(e,t,n){return void 0===n&&(n=!0),n&&$b(e),new qb(t).decode(e)}var Vb=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Vb||{});const Kb=nc(),Gb=(zs(),$s()),Hb=Gs(),Zb=ja(nu([["mint",ec()],["owner",ec()],["amount",gs()],["delegate",vf(ec(),{prefix:hs(),noneValue:"zeroes"})],["state",Zc(Vb)],["isNative",vf(gs(),{prefix:hs(),noneValue:"zeroes"})],["delegatedAmount",gs()],["closeAuthority",vf(ec(),{prefix:hs(),noneValue:"zeroes"})]]),ru([["mint",tc()],["owner",tc()],["amount",ms()],["delegate",wf(tc(),{prefix:ps(),noneValue:"zeroes"})],["state",Jc(Vb)],["isNative",wf(ms(),{prefix:ps(),noneValue:"zeroes"})],["delegatedAmount",ms()],["closeAuthority",wf(tc(),{prefix:ps(),noneValue:"zeroes"})]]));var Jb;!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"}(Jb||(Jb={}));class Yb extends Error{type;constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,Yb)}}class Qb extends Yb{constructor(e){super(Jb.PrimaryDomainNotFound,e)}}class Xb extends Yb{constructor(e){super(Jb.NoRecordData,e)}}class eS extends Yb{constructor(e){super(Jb.AccountDoesNotExist,e)}}class tS extends Yb{constructor(e){super(Jb.NoAccountData,e)}}class nS extends Yb{constructor(e){super(Jb.InvalidInput,e)}}class rS extends Yb{constructor(e){super(Jb.InvalidRoA,e)}}class oS extends Yb{constructor(e){super(Jb.NftAccountNotFound,e)}}class iS extends Yb{constructor(e){super(Jb.PdaOwnerNotAllowed,e)}}class aS extends Yb{constructor(e){super(Jb.DomainDoesNotExist,e)}}class sS extends Yb{constructor(e){super(Jb.RecordMalformed,e)}}class cS extends Yb{constructor(e){super(Jb.CouldNotFindNftOwner,e)}}class uS extends Yb{constructor(e){super(Jb.InvalidValidation,e)}}class lS extends Yb{constructor(e){super(Jb.InvalidSerializedData,e)}}class dS{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=Kb.decode(e.parentName),this.owner=Kb.decode(e.owner),this.class=Kb.decode(e.class)}static deserialize(e){try{const t=new dS(Wb(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 vh(e,t);if(!n.exists)throw new eS("The domain account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await wh(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 fS="58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx",hS="nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk",pS="33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z",gS="2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo",mS=async(e,t,n)=>{const r=await(async e=>{const t=Hb.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?Kb.encode(n):new Uint8Array(32)),r.push(t?Kb.encode(t):new Uint8Array(32));const[o]=await gc({programAddress:"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX",seeds:r});return o})(r,t,n)};var yS;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(yS||(yS={}));class vS{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=Kb.decode(e.nameAccount),this.owner=Kb.decode(e.owner),this.nftMint=Kb.decode(e.nftMint)}static deserialize(e){try{return new vS(Wb(this.schema,e))}catch{throw new lS("Failed to deserialize NftState data")}}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new oS(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(hS,{encoding:"base64",filters:[{dataSize:BigInt(vS.LEN)},{memcmp:{offset:BigInt(0),bytes:"3",encoding:"base58"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:"base58"}}]}).send();if(1!==n.length)throw new oS(`NFT not found: ${t}`);return this.deserialize(Gb.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await gc({programAddress:hS,seeds:[Hb.encode("nft_record"),Kb.encode(e)]});return t}}const wS=Hb.encode("tokenized_name"),AS=async(e,t)=>{try{const n=await(async e=>{const[t]=await gc({programAddress:hS,seeds:[wS,Kb.encode(e)]});return t})(t),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const o=await vh(e,r.value[0].address);if(!o.exists)return null;const i=Zb.decode(o.data);return"1"===i.amount.toString()?i.owner:null}catch(e){if(ba(e,Yo))return null;throw e}};class bS{tag;nameAccount;static schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=Kb.decode(e.nameAccount)}static deserialize(e){try{return new bS(Wb(this.schema,e))}catch{throw new lS("Failed to deserialize PrimaryDomainState data")}}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new Qb("The favourite account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await wh(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 gc({programAddress:e,seeds:[Hb.encode("favourite_domain"),Kb.encode(t)]});return n}}async function SS(e,t,n){const r=await(async(e,t)=>await mS(e,t,pS))(t,n),o=await dS.retrieve(e,r);if(!o.data)throw new tS("The registry data is empty");return function(e,t=!1){if(!e)return;const n=new DataView(e.buffer).getUint32(0,!0);return Hb.decode(e.subarray(4,4+n)).replace(/^\0/,t?"":"\0")}(o.data,!!n)}var ES;!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"}(ES||(ES={}));new Map([[ES.SOL,96],[ES.ETH,20],[ES.BSC,20],[ES.Injective,20],[ES.A,4],[ES.AAAA,16],[ES.Background,32]]);var kS;!function(e){e[e.V1=1]="V1",e[e.V2=2]="V2"}(kS||(kS={}));const TS=async(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const n=t===kS.V2?gS:void 0,r={[kS.V2]:"",[kS.V1]:""}[t]||"\0",o=e.split(".");if(2===o.length){const e=await mS(o[1],fS);return{address:await mS(r+o[0],e,n),parentAddress:e,isSub:!0}}if(3===o.length&&t){const e=await mS(o[2],fS),t=await mS("\0"+o[1],e);return{address:await mS(r+o[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(o.length>=3)throw new nS("The domain is malformed");return{address:await mS(e,fS),isSub:!1}};function IS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function xS(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function _S(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function CS(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function RS(e){if(!Array.isArray(e))throw new Error("array expected")}function PS(e,t){if(!xS(!0,t))throw new Error(`${e}: array of strings expected`)}function NS(e,t){if(!xS(!1,t))throw new Error(`${e}: array of numbers expected`)}const BS=(e,t)=>0===t?e:BS(t,e%t),OS=(e,t)=>e+(t-BS(e,t)),MS=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function zS(e,t,n,r){if(RS(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(OS(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${OS(t,n)}`);let o=0,i=0;const a=MS[t],s=MS[n]-1,c=[];for(const r of e){if(CS(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=MS[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 US(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 jS=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;PS("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(RS(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=>(RS(t),t.map((t=>{_S("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 _S("join",e),{encode:t=>(PS("join.decode",t),t.join(e)),decode:t=>(_S("join.decode",t),t.split(e))}}("")),LS=[996825010,642813549,513874426,1027748829,705979059];function DS(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<LS.length;e++)1==(t>>e&1)&&(n^=LS[e]);return n}function FS(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=DS(o)^n>>5}o=DS(o);for(let t=0;t<r;t++)o=DS(o)^31&e.charCodeAt(t);for(let e of t)o=DS(o)^e;for(let e=0;e<6;e++)o=DS(o);return o^=n,jS.encode(zS([o%MS[30]],30,5,!1))}!function(e){const t=function(e,t=!1){if(CS(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(OS(8,e)>32||OS(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!IS(n))throw new Error("radix2.encode input should be Uint8Array");return zS(Array.from(n),8,e,!t)},decode:n=>(NS("radix2.decode",n),Uint8Array.from(zS(n,e,8,t)))}}(5),n=t.decode,r=t.encode,o=US(n);function i(e,t,n=90){_S("bech32.encode prefix",e),IS(t)&&Array.from(t),NS("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=FS(i,t,1);return`${i}1${jS.encode(t)}${a}`}function a(e,t=90){_S("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=jS.decode(a).slice(0,-6),c=FS(i,s,1);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:s}}US(a)}();var $S,qS={exports:{}},WS=qS.exports;!function(){return $S||($S=1,e=qS,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}(WS)),qS.exports;var e}();Math.floor,String.fromCharCode;new Map([[ES.CNAME,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"],[ES.Url,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"]]),new Set([ES.BASE,ES.BSC,ES.ETH,ES.Injective]),new Set([ES.BASE,ES.BSC,ES.ETH]),new Set([ES.ARWV,ES.Backpack,ES.BTC,ES.CNAME,ES.Discord,ES.DOGE,ES.Email,ES.Github,ES.IPFS,ES.IPNS,ES.LTC,ES.Pic,ES.POINT,ES.Reddit,ES.SHDW,ES.Telegram,ES.Twitter,ES.TXT,ES.Url]),new Set([ES.BASE,ES.BSC,ES.ETH,ES.Injective,ES.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 VS;!function(e){e[e.None=0]="None",e[e.Solana=1]="Solana",e[e.Ethereum=2]="Ethereum",e[e.UnverifiedSolana=3]="UnverifiedSolana"}(VS||(VS={}));const KS=e=>{switch(e){case VS.None:return 0;case VS.Ethereum:return 20;case VS.Solana:case VS.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class GS{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 GS(Wb(this.schema,e,!0))}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new Error("Record header account not found");return this.deserialize(n.data.slice(96,96+this.LEN))}}class HS{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=GS.deserialize(e.slice(96,96+GS.LEN));return new HS(t,e.slice(96+GS.LEN))}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new Xb("Record account not found");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await wh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}getContent(){const e=KS(this.header.stalenessValidation)+KS(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){const e=KS(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=KS(this.header.stalenessValidation),t=e+KS(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}const ZS=57896044618658097711785492504343953926634992332820282019728792003956564819949n,JS=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function YS(e){const t=e%ZS;return t>=0n?t:ZS+t}function QS(e,t){let n=e;for(;t-- >0n;)n*=n,n%=ZS;return n}function XS(e,t){const n=YS(e*e),r=function(e,t){const n=YS(t*t*t),r=function(e){const t=e*e%ZS*e%ZS,n=QS(t,2n)*t%ZS,r=QS(n,1n)*e%ZS,o=QS(r,5n)*r%ZS,i=QS(o,10n)*o%ZS,a=QS(i,20n)*i%ZS,s=QS(a,40n)*a%ZS,c=QS(s,80n)*s%ZS,u=QS(c,80n)*s%ZS,l=QS(u,10n)*o%ZS;return QS(l,2n)*e%ZS}(e*YS(n*n*t));let o=YS(e*n*r);const i=YS(t*o*o),a=o,s=YS(o*JS),c=i===e,u=i===YS(-e),l=i===YS(-e*JS);return c&&(o=a),(u||l)&&(o=s),1n===(1n&YS(o))&&(o=YS(-o)),c||u?o:null}(YS(n-1n),YS(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}const eE=async(e,t,n={allowPda:!1})=>{const{address:r}=await TS(t),o=await vS.getAddress(r),i=await(async(e,t)=>{const{address:n}=await TS(t+"."+e,kS.V1);return n})(t,ES.SOL),a=await(async(e,t)=>{const{address:n}=await TS(e);return await mS(`${t}`,n,gS)})(t,ES.SOL),[s,c,u,l]=await wh(e,[r,o,i,a]);if(!s.exists)throw new aS(`Domain ${t} does not exist`);const d=dS.deserialize(s.data);if(c.exists&&vS.deserialize(c.data).tag===yS.ActiveRecord){const t=await AS(e,r);if(!t)throw new cS;return t}e:if(l.exists){const e=HS.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new sS("Record is malformed");if(e.header.rightOfAssociationValidation!==VS.Solana||e.header.stalenessValidation!==VS.Solana)throw new uS;if(d.owner!==Kb.decode(t))break e;if(((e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])))(n,r))return Kb.decode(r);throw new rS(`The RoA ID shoudl be ${Kb.decode(r)} but is ${Kb.decode(n)} `)}if(u.exists){const e=new Uint8Array([...u.data.slice(dS.HEADER_LEN,dS.HEADER_LEN+32),...Kb.encode(i)]),t=u.data.slice(dS.HEADER_LEN+32,dS.HEADER_LEN+32+64),n=await(async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=ec().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!0,["verify"])}(n),o=Hb.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 Kb.decode(u.data.slice(dS.HEADER_LEN,dS.HEADER_LEN+32))}if(!function(e){const t=Kb.encode(e);if(32!==t.byteLength)return!1;return XS(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 vh(e,d.owner);if(!t.exists)throw new iS("Invalid domain owner account");const r=n.programIds?.some((e=>t.programAddress===e));if(r)return d.owner;throw new iS(`The program ${t.programAddress} is not allowed`)}throw new iS}return d.owner};const tE=cu(5000n);class nE{#se;constructor(e){this.#se=e}#ce(){const e=this.#se.getComputeUnitLimit(),t=this.#se.getComputeUnitPriceMicroLamportsPerComputeUnit();return uu(e,(e=>xo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(rd.toString())),(e=>e.toString()),BigInt,cu)}getFee(){const e=this.#ce();return cu(tE+e)}}function rE(e){return e.includes("swift:0/iso4217:")}var oE=function(e){return e.Benign="Benign",e.Warning="Warning",e.Malicious="Malicious",e}({}),iE=function(e){return e.SUCCESS="SUCCESS",e.ERROR="ERROR",e}({});class aE{#ue;#k;#i;#le=4e4;#de=10000n;constructor(e,t,n){this.#ue=e,this.#k=t,this.#i=Xl(n,"[📩 SendSplTokenBuilder]")}async buildTransactionMessage(e){this.#i.log("Build transfer SPL token transaction message");const{from:t,to:n,mint:r,amount:o,network:i}=e;Wo(r,"Mint is required");const a=await this.#k.fetchMint(r,i),{programAddress:s,data:{decimals:c}}=a,u=await this.#ue.uiAmountToAmountForMint(r,i,o.toString()),l=await this.#k.getLatestBlockhash(i),{privateKeyBytes:d}=await ev({entropySource:t.entropySource,derivationPath:t.derivationPath}),f=await vl(d),[h,p]=await Promise.all([aE.deriveAssociatedTokenAccountAddress({mint:r,owner:f.address,tokenProgram:s}),aE.deriveAssociatedTokenAccountAddress({mint:r,owner:n,tokenProgram:s})]),g=uu($u({version:0}),(e=>Zu(f.address,e)),(e=>du(l,e)),(e=>Yu([Vf({mint:r,payer:f,tokenProgram:s,owner:n,ata:p}),fh({source:h,mint:r,destination:p,authority:f,amount:u,decimals:c},{programAddress:s})],e)));return Qu([of({units:this.#le}),lf({microLamports:this.#de})],g)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await $f({mint:e,owner:t,tokenProgram:n}))[0]}getComputeUnitLimit(){return this.#le}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#de}}const sE=new Sv,cE=new class{#i;#fe=new Map;constructor(e){this.#i=Xl(e,"[⚡ EventEmitter]")}on(e,t){this.#i.info(`Adding listener for event ${e}`),this.#fe.has(e)||this.#fe.set(e,new Set),this.#fe.get(e)?.add(t)}off(e,t){this.#i.info(`Removing listener for event ${e}`);const n=this.#fe.get(e);n&&(n.delete(t),0===n.size&&this.#fe.delete(e))}async emitSync(e,t){this.#i.info(`Emitting event ${e}`);const n=this.#fe.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.#fe.delete(e)):(this.#i.info("Removing all listeners for all events"),this.#fe.clear())}listenerCount(e){const t=this.#fe.get(e);return t?t.size:0}eventNames(){return Array.from(this.#fe.keys())}}(ed),uE=new class{#b;constructor(e,t){this.#b=t,e.on("onStart",this.#he.bind(this)),e.on("onUpdate",this.#he.bind(this)),e.on("onInstall",this.#he.bind(this))}async#he(){await this.update((e=>(0,Od.omit)(e,["assets"])))}async get(){const e=await snap.request({method:"snap_getState",params:{encrypted:this.#b.encrypted}}),t=tv(e??{});var n,r;return n=this.#b.defaultState,r=t,{...n,...Object.fromEntries(Object.entries(r).filter((([e,t])=>null!=t&&(!t||"object"!=typeof t||Object.keys(t).length>0))))}}async getKey(e){const t=await snap.request({method:"snap_getState",params:{key:e,encrypted:this.#b.encrypted}});if(null!==t)return tv(t)}async setKey(e,t){await snap.request({method:"snap_setState",params:{key:e,value:nv(t),encrypted:this.#b.encrypted}})}async update(e){return this.get().then((async t=>{const n=e(t);return await snap.request({method:"snap_manageState",params:{operation:"update",newState:nv(n),encrypted:this.#b.encrypted}}),n}))}async deleteKey(e){await this.update((t=>((0,Od.unset)(t,e),t)))}async deleteKeys(e){await this.update((t=>(e.forEach((e=>{(0,Od.unset)(t,e)})),t)))}}(cE,{encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},tokenPrices:{},subscriptions:{},webSocketConnections:{closeWebSocketConnectionsBackgroundEventId:null}}}),lE=new class{#pe;prefix;logger;constructor(e,t=console,n="__cache__default"){this.#pe=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.#ge(n),await this.#pe.setKey(`${this.prefix}.${e}`,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}#ge(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.#pe.setKey(this.prefix,{})}async has(e){return void 0!==await this.get(e)}async keys(){const e=await this.#pe.getKey(this.prefix);return Object.keys(e??{})}async size(){const e=await this.#pe.getKey(this.prefix);return Object.keys(e??{}).length}async peek(e){const t=await this.#pe.getKey(this.prefix),n=t?.[e];return n?.value}async mget(e){const t=await this.#pe.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.#ge(e)})),await this.#pe.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{Wo(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.#pe.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}}(uE,ed),dE=new class{#C=new Map;logger;constructor(e){this.logger=Xl(e,"[💾 InMemoryCache]")}#ge(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")}}#ae(e){return e.expiresAt<Date.now()}async#me(){const e=[];for(const[t,n]of this.#C.entries())this.#ae(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.#ge(n),this.#C.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.#C.clear()}async has(e){const t=this.#C.get(e);return!!t&&(!this.#ae(t)||(this.#C.delete(e),!1))}async keys(){return await this.#me(),Array.from(this.#C.keys())}async size(){return await this.#me(),this.#C.size}async peek(e){const t=this.#C.get(e);if(t){if(!this.#ae(t))return t.value;this.#C.delete(e)}}async mget(e){await this.#me();const t={};for(const n of e){const e=this.#C.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.#ge(e)})),e.forEach((({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#C.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}));else{Wo(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.#C.delete(e)])))}}(Ql),fE=new class{#i;constructor(e=ed){this.#i=Xl(e,"[📣 AnalyticsService]")}async#ye(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.#ye("Transaction Added",{message:"Snap transaction added",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventTransactionApproved(e,t){await this.#ye("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.#ye("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.#ye("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.#ye("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.#ye("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.#ye("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.#ye("WebSocket Connection Closed Not Cleanly",{message:"Snap WebSocket connection closed not cleanly",origin:e,code:t,reason:n})}}(ed),hE=new class{#T;#C;#ve={fetchMint:gv.Minute};#we=new Map;constructor(e,t){this.#T=e,this.#C=t}#Ae(e){const t=this.#T.getNetworkBy("caip2Id",e),n=wb(Pb(t.rpcUrls));return this.#we.set(e,n),n}getRpc(e){return M(e,Sd),this.#we.get(e)??this.#Ae(e)}async fetchMint(e,t,n){return nd((async(r,o,i)=>Oh(this.getRpc(t),Xs(e),n)),this.#C,{ttlMilliseconds:this.#ve.fetchMint,functionName:"SolanaConnection::fetchMint"})(Xs(e),t,n)}async getLatestBlockhash(e){return(await this.getRpc(e).getLatestBlockhash().send()).value}}(sE,dE),pE=new class{#T;constructor(e){this.#T=e}async getAll(){return(await snap.request({method:"snap_getWebSockets"})).map((e=>({...e,network:this.#be(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}})}#be(e){const t=this.#T.getNetworkBy("webSocketUrl",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(sE),gE=new class{#Se;#Ee;#T;#pe;#q;#i;#ke;#Te;#Ie=new Map;#xe=new Map;#_e;#Ce="webSocketConnections";constructor(e,t,n,r,o,i){const{maxReconnectAttempts:a,reconnectDelayMilliseconds:s,closeConnectionsGracePeriodMilliseconds:c}=n.get().subscriptions;this.#Se=e,this.#Ee=t,this.#T=n,this.#pe=r,this.#q=o,this.#i=Xl(i,"[🔌 WebSocketConnectionService]"),this.#ke=a,this.#Te=s,this.#_e=c,this.#V()}#V(){const e=this.#Re.bind(this),t=this.#Pe.bind(this),n=this.#K.bind(this),r=this.#Ne.bind(this),o=this.#G.bind(this);this.#q.on("onStart",e),this.#q.on("onUpdate",e),this.#q.on("onInstall",e),this.#q.on("onActive",t),this.#q.on("onInactive",n),this.#q.on("onWebSocketEvent",o),this.#q.on("onListWebSockets",r)}async#Re(){this.#i.log("Setting up connections");const{active:e}=await async function(){return await snap.request({method:"snap_getClientStatus"})}();e?await this.#Be():await this.closeAllConnections()}async#Be(){this.#i.log("Opening connections for active networks");const{activeNetworks:e}=this.#T.get();this.#xe.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.#T.getNetworkBy("caip2Id",e),{webSocketUrl:n}=t;await this.#Se.findByNetwork(e)?this.#i.log(`✅ Connection for network ${e} already exists`):await this.#Se.save({network:e,url:n,protocols:[]})}async closeAllConnections(){this.#i.log("Closing all connections");const e=await this.#Se.getAll();await Promise.allSettled(e.map(this.#Oe.bind(this))),await this.#pe.setKey(`${this.#Ce}.closeWebSocketConnectionsBackgroundEventId`,null)}async#Oe(e){this.#i.log(`Closing connection for network ${e.network}`),await this.#Se.delete(e.id)}onConnectionRecovery(e,t){const n=this.#Ie.get(e)??[];this.#Ie.set(e,[...n,t])}async findByNetwork(e){return await this.#Se.findByNetwork(e)??null}async findById(e){return this.#Se.getById(e)}async#G(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.#Me(e);break;case"close":await this.#ze(e);break;default:this.#i.warn(`Unknown connection event type: ${n}`)}}async#Me(e){const{id:t}=e,n=await this.#Se.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.#xe.delete(r);const o=this.#Ie.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#ze(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.#T.get(),a=i.find((e=>e.webSocketUrl.startsWith(n)));a?(await this.#Ee.trackEventWebSocketConnectionClosedNotCleanly(n,r,o),await this.#Ue(a.caip2Id)):this.#i.warn("No network found for origin",n)}async#Ue(e){const t=this.#xe.get(e)??0,n=t+1;if(this.#xe.set(e,n),n>this.#ke)return void this.#i.error(`❌ Failed to reconnect to ${e} after ${this.#ke}/${this.#ke} attempts. Giving up.`);const r=this.#Te*Math.pow(2,t);this.#i.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#ke})`),await new Promise((t=>{setTimeout((()=>{this.openConnection(e).catch((t=>{this.#i.info(`Error opening connection for ${e}`,t)})).finally((()=>t()))}),r)}))}async#Ne(){const e=await this.#Se.getAll();this.#i.log("All connections",{connections:e,connectionRecoveryHandlers:this.#Ie})}async#Pe(){this.#i.log("Client became active"),await this.#je(),await this.#Be()}async#K(){this.#i.log("Client became inactive"),await this.#je();const e=Math.floor(this.#_e/1e3),t=await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:`PT${e}S`,request:{method:"closeWebSocketConnections"}}});await this.#pe.setKey(`${this.#Ce}.closeWebSocketConnectionsBackgroundEventId`,t),this.#i.log(`Scheduled background event to close connections after ${e}s`,t)}async#je(){try{const e=await this.#pe.getKey(`${this.#Ce}.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.#pe.setKey(`${this.#Ce}.closeWebSocketConnectionsBackgroundEventId`,null)}}}(pE,fE,sE,uE,cE,ed),mE=new class{#pe;#Ce="subscriptions";constructor(e){this.#pe=e}async getAll(){const e=await this.#pe.getKey(`${this.#Ce}`);return Object.values(e??{})}async getById(e){return await this.#pe.getKey(`${this.#Ce}.${e}`)}async save(e){await this.#pe.setKey(`${this.#Ce}.${e.id}`,e)}async delete(e){await this.#pe.deleteKey(`${this.#Ce}.${e}`)}async deleteMany(e){const t=e.map((e=>`${this.#Ce}.${e}`));await this.#pe.deleteKeys(t)}async update(e){await this.#pe.setKey(`${this.#Ce}.${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.#pe.deleteKey(`${this.#Ce}`)}}(uE),yE=new Ew(gE,mE,sE,cE,ed),vE=new class{#k;constructor(e){this.#k=e}async uiAmountToAmountForMint(e,t,n){const r=await this.#k.fetchMint(e,t);return this.#Le(r,n)}async amountToUiAmountForMint(e,t,n){const r=await this.#k.fetchMint(e,t);return this.#De(r,n)}#Le(e,t){try{const o=(n=e.data?.extensions,mf(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 cu(BigInt(xo(t).multipliedBy(10**i).toString()));const c=Date.now()/1e3;if(a){return cu(_g(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 cu(Cg(t,i,e))}throw new Error("Unknown mint extension type")}catch(n){const r=e?.data?.decimals??9;return cu(BigInt(xo(t).multipliedBy(10**r).toString()))}var n,r}#De(e,t){try{const n=1000000000n,r=xo(this.#Le(e,n.toString()).toString()).dividedBy(n.toString());return xo(t.toString()).dividedBy(r).toString()}catch(n){const r=e.data?.decimals??9;return xo(t.toString()).dividedBy(10**r).toString()}}}(hE),wE=new Aw(hE,ed),AE=new class{#k;#i;#le=450;#de=10000n;constructor(e,t){this.#k=e,this.#i=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:o}=e,i=Xs(t.address),a=BigInt(wm(r).toString()),s=await this.#k.getLatestBlockhash(o),c=uu($u({version:0}),(e=>Zu(i,e)),(e=>du(s,e)),(e=>Ju(function(e,t){const n=t?.programAddress??Rl,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},o={...e},i=Ol(n);return{accounts:[i(r.source),i(r.destination)],programAddress:n,data:Kl().encode(o)}}({amount:a,destination:n,source:wl(i)}),e)));return Qu([of({units:this.#le}),lf({microLamports:this.#de})],c)}catch(e){throw this.#i.error({error:e},"Error building transaction message"),e}}getComputeUnitLimit(){return this.#le}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#de}}(hE,ed),bE=new aE(vE,hE,ed),SE=new class{#o;#i;#a;#s;#C;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=ed){const{baseUrl:o,chunkSize:i,cacheTtlsMilliseconds:a}=e.get().priceApi;M(o,gd),this.#o=n,this.#i=r,this.#a=o,this.#s=i,this.cacheTtlsMilliseconds=a,this.#C=t}async getFiatExchangeRates(){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#Fe(e,t="usd"){try{if(M(e,K(Lo)),M(t,jd),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=Bd({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 M(o,Ud),o}))),i=o.reduce(((e,t)=>({...e,...t})),{});return await this.#C.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#$e(e,t="usd"){const n=[...new Set(e)],r="PriceApiClient:getMultipleSpotPrices",o=e=>`${r}:${e}:${t}`,i=await this.#C.mget(n.map(o)),a=(0,Od.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.#Fe(s,t);return await this.#C.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.#$e(e,t)}async#qe(e){M(e,Ld);const t=Bd({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 M(r,Dd),r}async getHistoricalPrices(e){return nd(this.#qe.bind(this),this.#C,{functionName:"PriceApiClient:getHistoricalPrices",ttlMilliseconds:this.cacheTtlsMilliseconds.historicalPrices})(e)}}(sE,dE),EE=new Hd(sE),kE=new class{#o;#i;#a;#C;#ve;constructor(e,t,n=globalThis.fetch,r=ed){const{baseUrl:o,cacheTtlsMilliseconds:i}=e.get().nftApi;M(o,gd),this.#o=n,this.#i=r,this.#a=o,this.#ve=i,this.#C=t}#We(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.#Ve(e.nft_token)})))}}async#Ke(e){let t,n=[];do{const r=Bd({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.#We(i);n=[...n,...a.items],t=a.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return nd(this.#Ke.bind(this),this.#C,{functionName:"NftApiClient:listAddressSolanaNfts",ttlMilliseconds:this.#ve.listAddressSolanaNfts})(e)}#Ve(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#Ge(e){try{const t=Bd({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.#Ve(r)}catch(e){return null}}async getNftMetadata(e){return nd(this.#Ge.bind(this),this.#C,{functionName:"NftApiClient:getNftMetadata",ttlMilliseconds:this.#ve.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map((async e=>this.getNftMetadata(e))))}}(sE,dE),TE=new class{#He;#i;cacheTtlsMilliseconds;constructor({configProvider:e,priceApiClient:t,logger:n}){this.#He=t,this.#i=n;const{cacheTtlsMilliseconds:r}=e.get().priceApi;this.cacheTtlsMilliseconds=r}#Ze(e){if(!rE(e))throw new Error("Passed caipAssetType is not a fiat asset");return Fo(e).assetReference.toLowerCase()}async#Je(e){const t=e.filter((e=>!rE(e))),[n,r]=await Promise.all([this.#He.getFiatExchangeRates(),this.#He.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.#Je(t),o={};return e.forEach((e=>{const{from:t,to:i}=e;let a,s;if(o[t]||(o[t]={}),rE(t)){const e=n[this.#Ze(t)]?.value;if(!e)return void(o[t][i]=null);a=new xo(1).dividedBy(e)}else a=new xo(r[t]?.price??0);if(rE(i)){const e=n[this.#Ze(i)]?.value;if(!e)return void(o[t][i]=null);s=new xo(1).dividedBy(e)}else s=new xo(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}#Ye(e,t){const n=(0,Od.pick)(e,["marketCap","totalVolume","circulatingSupply","allTimeHigh","allTimeLow","pricePercentChange1h","pricePercentChange1d","pricePercentChange7d","pricePercentChange14d","pricePercentChange30d","pricePercentChange200d","pricePercentChange1y"]),r=e=>null==e?"":new xo(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.#Je(t),o={};return e.forEach((e=>{const{asset:t,unit:i}=e;if(!r[t])return;let a;if(rE(i)){const e=n[this.#Ze(i)]?.value;if(!e)return;a=new xo(1).dividedBy(e)}else a=new xo(r[i]?.price??0);a.isZero()||(o[t]||(o[t]={}),o[t][i]=this.#Ye(r[t],a))})),o}async getHistoricalPrice(e,t){M(e,it),M(t,it);const n=Fo(t).assetReference.toLowerCase();M(n,jd);const r=["1d","7d","1m","3m","1y","1000y"].map((async r=>this.#He.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:Fd}))))),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:sE,priceApiClient:SE,logger:ed}),IE=new class{#k;#i;tld=".sol";constructor(e,t){this.#k=e,this.#i=t}async resolveDomain(e,t){const n=this.#k.getRpc(e);return eE(n,t)}async resolveAddress(e,t){try{const n=this.#k.getRpc(e);return`${(await(async(e,t)=>{const n=await bS.getAddress("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29",t),r=await bS.retrieve(e,n),[o,i]=await Promise.all([dS.retrieve(e,r.nameAccount),AS(e,r.nameAccount)]),a=i||o.owner,s=o.parentName!==fS,c=[SS(e,r.nameAccount,s?o.parentName:void 0)];s&&c.push(SS(e,o.parentName));const u=(await Promise.all(c)).join(".");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})(n,Xs(t))).domainName}.sol`}catch(e){return this.#i.error("Error resolving address",e),null}}}(hE,ed),xE=new class{#pe;constructor(e){this.#pe=e}async findByKeyringAccountId(e){return await this.#pe.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#pe.getKey("assetEntities")??{};return Object.values(e).flat()}async saveMany(e){await this.#pe.update((t=>{const n=(0,Od.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,Od.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}))}}(uE),_E=new ww({connection:hE,logger:ed,configProvider:sE,assetsRepository:xE,tokenApiClient:EE,cache:dE,tokenPricesService:TE,nftApiClient:kE}),CE=new class{#pe;constructor(e){this.#pe=e}async getAll(){const e=await this.#pe.getKey("keyringAccounts");return Object.values(e??{})}async findById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByAddress(e){return(await this.getAll()).find((t=>t.address===e))??null}async save(e){await this.#pe.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#pe.deleteKey(`keyringAccounts.${e}`)}}(uE),RE=new class{#Qe;constructor(e){this.#Qe=e}async getAll(){return this.#Qe.getAll()}async findById(e){return this.#Qe.findById(e)}async findByAddress(e){return this.#Qe.findByAddress(e)}async save(e){return this.#Qe.save(e)}async delete(e){return this.#Qe.delete(e)}}(CE),PE=new class{#pe;#Ce="transactions";constructor(e){this.#pe=e}async getAll(){const e=await this.#pe.getKey(this.#Ce);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#pe.getKey(`${this.#Ce}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#pe.update((t=>{const n=t[this.#Ce];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,Od.chain)([...i,e]).uniqBy("id").sortBy((e=>-(e.timestamp??0))).value();t[this.#Ce][o]=s})),t}))}}(uE),NE=new class{#ue;#Xe;#i;constructor(e,t,n){this.#ue=e,this.#Xe=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.#et(e);let l=[],d=[],f=[];const h=(u===It.Failed?this.#tt.bind(this):this.#nt.bind(this))({scope:n,transactionData:e});l=h.fees,d=h.from,f=h.to;const{from:p,to:g}=await this.#rt({scope:n,transactionData:e});let m=[...p,...d],y=[...g,...f];const v=this.#ot({address:Xs(a),status:u,from:m,to:y});v===xt.Swap&&(m=m.filter((e=>e.address===a)),y=y.filter((e=>e.address===a))),v===xt.Receive&&(y=y.filter((e=>e.address===a)),l=[]);const w=[...new Set([...m,...y].filter((e=>e.asset?.fungible)).map((e=>e.asset.type)))],A=r??await this.#Xe.getAssetsMetadata(w);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:v,from:m,to:y,fees:l,events:[{status:u,timestamp:c}]}}catch(e){return this.#i.warn(e,"Error mapping transaction"),null}}#et(e){return e.meta?.err||e.meta?.status&&"Err"in e.meta.status?It.Failed:It.Confirmed}#ot({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===It.Failed)return xt.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?xt.Send:a&&s?xt.Swap:a?xt.Send:xt.Receive}#nt({scope:e,transactionData:t}){const n=this.#it({scope:e,transactionData:t}),r=[],o=[],i=new Map(t.meta?.preBalances?.map(((e,t)=>[t,new xo(e.toString())]))??[]),a=new Map(t.meta?.postBalances?.map(((e,t)=>[t,new xo(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 xo(0),l=a.get(n)??new xo(0),d=0===n?vm(t.meta?.fee??0):new xo(0),f=u.minus(l).dividedBy(new xo(od)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();u.isGreaterThan(l)&&r.push({address:c,asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:h}}),u.isLessThan(l)&&o.push({address:c,asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:h}})}const u=this.#at({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}}#tt({scope:e,transactionData:t}){const n=this.#it({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]!==Rl)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=qd.decode(a);if(2!==this.#st(f))return;const h=this.#ct(f);o.push({address:l,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}}),i.push({address:d,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}})}));return{fees:n,from:this.#ut(o),to:this.#ut(i)}}#at({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===Rl));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.#ct(qd.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}}),o.push({address:f,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}})})),{from:r,to:o}}async#rt({scope:e,transactionData:t}){const n=[],r=[],o=new Map(t.meta?.preTokenBalances?.map((e=>[e.accountIndex,new xo(e.uiTokenAmount.amount)]))??[]),i=new Map(t.meta?.postTokenBalances?.map((e=>[e.accountIndex,new xo(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 xo(0),c=(i.get(s)??new xo(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=vw(e,l),h=c.absoluteValue().toString(),p=(await this.#ue.amountToUiAmountForMint(l,e,cu(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=>em(e,t))).map(Xg).filter(this.#dt.bind(this)).forEach((n=>{const i=(0,Od.get)(n,"parsed.accounts.authority.address"),a=(0,Od.get)(n,"parsed.accounts.source.address");if(!i||!a)return;const s=t.transaction.message.accountKeys.indexOf(Xs(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=xo(l).dividedBy(new xo(10).pow(u)).toString(),f=vw(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}}#it({scope:e,transactionData:t}){const n=this.#ft(t),r=this.#ht(t),o=n.minus(r),i=[{type:"base",asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:r.toString()}}];return o?.isGreaterThan(0)&&i.push({type:"priority",asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:o.toString()}}),i}#ft(e){return new xo(e.meta?.fee?.toString()??"0").dividedBy(od)}#ht(e){const t=e.transaction.signatures.length;return xo(5e3).dividedBy(od).multipliedBy(t)}#ut(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 xo(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e}),[])}#st(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}#ct(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return xo(t.toString()).dividedBy(od)}#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}}(vE,_E,ed),BE=new class{#pt;#gt;#mt;#Xe;#k;#i;constructor(e,t,n,r,o,i){this.#pt=e,this.#gt=t,this.#mt=n,this.#Xe=r,this.#k=o,this.#i=Xl(i,"[💱 TransactionsService]")}async fetchBySignature(e,t,n){const r=await this.#k.getRpc(n).getTransaction(bc(e),{maxSupportedTransactionVersion:0}).send();return r?this.#gt.mapRpcTransaction(r,t,n):null}async fetchAssetsTransactions(e,t){const n=await this.#mt.getAll(),r=e.map((e=>e.assetType)),o=await this.#Xe.getAssetsMetadata(r),i=await this.#pt.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=>vw(t,n)===(0,Od.get)(e,"asset.type")))||e.to.some((e=>vw(t,n)===(0,Od.get)(e,"asset.type")))));return r||null})(e),o=r?bc(r?.id):void 0;return(await this.#k.getRpc(t).getSignaturesForAddress(Xs(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.#k.getRpc(n.network).getTransaction(bc(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.#gt.mapRpcTransaction(t,r,n.network,o):null})))).filter((e=>null!==e)).filter((e=>{const t=u(e.account);return!!t&&!Sw(e,t)}))}async fetchLatestSignatures(e,t,n){return(await this.#k.getRpc(e).getSignaturesForAddress(t,n).send()).map((({signature:e})=>e))}async findByAccounts(e){return(await Promise.all(e.map((async e=>this.#pt.findByAccountId(e.id))))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#pt.saveMany(e);const t=(0,Od.groupBy)(e,"account");await vn(snap,gn.AccountTransactionsUpdated,{transactions:t})}}(PE,NE,RE,_E,hE,ed),OE=new class{#mt;#Xe;#yt;#i;constructor(e,t,n,r){this.#mt=e,this.#Xe=t,this.#yt=n,this.#i=Xl(r,"[🔄 AccountsSynchronizer]")}async synchronize(e){const t=e??await this.#mt.getAll();this.#i.info("Synchronizing accounts",t);const n=(await Promise.allSettled(t.map((async e=>this.#Xe.fetch(e))))).map((e=>"fulfilled"===e.status?e.value:[])).flat();await this.#Xe.saveMany(n);const r=await this.#yt.fetchAssetsTransactions(n,{limit:20});await this.#yt.saveMany(r)}}(RE,_E,BE,ed),ME=new class{#vt;#i;#Ee;constructor(e,t,n){this.#vt=e,this.#Ee=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.#vt.scanTransactions({method:e,accountAddress:t,transactions:[n],scope:r,origin:o===id?"https://metamask.io":o,options:i}),c=this.#wt(s);if(!c?.status)return this.#i.warn("Invalid scan result received from security alerts API"),a&&await this.#Ee.trackEventSecurityScanCompleted(a,o,r,iE.ERROR,!1),null;if(a){const e=Object.values(iE).includes(c.status)?c.status:iE.ERROR,t=Boolean(c.validation?.type&&c.validation.type!==oE.Benign),n=[this.#Ee.trackEventSecurityScanCompleted(a,o,r,e,t)];if(t){const e=Object.values(oE).includes(c.validation.type)?c.validation.type:oE.Warning;n.push(this.#Ee.trackEventSecurityAlertDetected(a,o,r,e,c.validation.reason??"unknown",this.#At(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 ww.generateImageComponent(n,16,16).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.#Ee.trackEventSecurityScanCompleted(a,o,r,iE.ERROR,!1),null}}#At(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}`}#wt(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=ed){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=Wd.from(qd.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:Vd[r],transactions:n,options:i})})).json()}}(sE),fE,ed),zE=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case $t.SignAndSendTransaction:case $t.SignTransaction:return this.#bt(e,t);case $t.SignMessage:return this.#St(e,t);case $t.SignIn:return this.#Et(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#bt(e,t){M(e.request,ae([Ay,Ey]));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:Nv.OnTransactionAdded,params:{accountId:i,metadata:{scope:o,origin:a}}}}});return await NA({...PA,scope:o,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Nv.OnTransactionApproved,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!0):(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Nv.OnTransactionRejected,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!1)}async#St(e,t){const n=await async function(e,t){M(e.request,Sy);const{request:{params:{message:n}},scope:r,origin:o}=e,i=$s().encode(n),a=Gs().decode(i),s=await uv().then((e=>e.locale)).catch((()=>Kw));return cv(await iv(kw(gA,{message:a,account:t,scope:r,locale:s,networkImage:Iw,origin:o}),{}))}(e,t);return Boolean(n)}async#Et(e,t){const n=await async function(e,t){M(e.request,by);const{request:{params:n},scope:r,origin:o}=e,i=await uv();return cv(await iv(kw(fA,{params:n,account:t,scope:r,preferences:i,networkImage:Iw,origin:o}),{}))}(e,t);return Boolean(n)}},UE=new class{#kt;#Tt;#yt;#Ee;#k;#T;#i;#It=new Map;#xt=10*gv.Minute;constructor(e,t,n,r,o,i,a){this.#kt=e,this.#Tt=t,this.#yt=n,this.#Ee=r,this.#k=o,this.#T=i,this.#i=Xl(a,"[✍️ SignatureMonitor]"),this.#V()}#V(){const{activeNetworks:e}=this.#T.get();e.forEach((e=>{this.#kt.registerNotificationHandler("signatureSubscribe",e,this.#_t.bind(this)),this.#kt.registerConnectionRecoveryHandler(e,this.#Ct.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.#kt.subscribe(i);this.#It.set(a,i)}async#_t(e,t){try{const{network:e}=t,n=(0,Od.get)(t,"params[0]");M(n,re());const r=(0,Od.get)(t,"params[1].commitment");M(r,rm);const o=t.metadata?.accountId;M(o,re());const i=t.metadata?.origin;M(i,re());const a=await this.#Tt.findById(o);if(!a)throw new Error(`Account not found: ${o}`);const s=await this.#yt.fetchBySignature(n,a,e);if(!s)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(r){case"processed":await this.#yt.save(s),await this.#Ee.trackEventTransactionSubmitted(a,n,{scope:e,origin:i});break;case"confirmed":case"finalized":await this.#yt.save(s),await this.#Ee.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.#kt.unsubscribe(t.id),this.#It.delete(t.id)}}async#Ct(){this.#i.info("Handling connection recovery"),await Promise.all(Array.from(this.#It.entries()).map((async([e,t])=>{await this.#Rt(t,e)})))}async#Rt(e,t){try{const{network:n}=e;M(n,re());const r=(0,Od.get)(e,"params[0]");M(r,re());const o=(0,Od.get)(e,"params[1].commitment");M(o,rm);const i=await this.#Pt(r,n);if(!i)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#Nt(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.#_t(a,s),this.#It.delete(t)}catch(e){this.#i.error("Error handling connection recovery",e)}}async#Pt(e,t){const n=await this.#k.getRpc(t).getSignatureStatuses([bc(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}#Nt(e,t){return t===e||"processed"===t&&("confirmed"===e||"finalized"===e)||"confirmed"===t&&"finalized"===e}}(yE,RE,BE,fE,hE,sE,ed),jE=new class{#kt;#Tt;#Xe;#yt;#Bt;#ue;#T;#q;#i;#Ot=new Map;#Mt=[Cf,Uh];constructor(e,t,n,r,o,i,a,s,c){this.#kt=e,this.#Tt=t,this.#Xe=n,this.#yt=r,this.#Bt=o,this.#ue=i,this.#q=s,this.#T=a,this.#i=Xl(c,"[🗝️ KeyringAccountMonitor]"),this.#V()}#V(){this.#i.info("Binding handlers"),this.#q.on("onStart",this.#zt.bind(this)),this.#q.on("onUpdate",this.#zt.bind(this)),this.#q.on("onInstall",this.#zt.bind(this));const{activeNetworks:e}=this.#T.get();e.forEach((e=>{this.#kt.registerNotificationHandler("accountSubscribe",e,this.#Ut.bind(this)),this.#kt.registerNotificationHandler("programSubscribe",e,this.#jt.bind(this))})),e.forEach((e=>{this.#kt.registerConnectionRecoveryHandler(e,this.#Ct.bind(this))}))}async#zt(){this.#i.info("Handling onStart/onUpdate/onInstall");const e=await this.#Tt.getAll(),t=Array.from(this.#Ot.keys());await Promise.allSettled(t.map((async t=>{const n=e.find((e=>e.id===t));n&&await this.stopMonitorKeyringAccount(n)}))),await Promise.allSettled(e.map((async e=>{await this.monitorKeyringAccount(e)})))}async monitorKeyringAccount(e){try{this.#i.log("Monitoring keyring account",e);const{id:t}=e,{activeNetworks:n}=this.#T.get();if(this.#Ot.has(t))return void this.#i.log("Account is already being monitored",e);const r=t=>e.scopes.includes(t),o=n.filter(r).map((async t=>this.#Lt(e,t))),i=n.filter(r).map((async t=>{await Promise.all(this.#Mt.map((async n=>this.#Dt(e,n,t))))}));await Promise.all([...i,...o])}catch(t){throw this.#i.error("Error monitoring keyring account",t),await this.stopMonitorKeyringAccount(e),t}}async stopMonitorKeyringAccount(e){this.#i.log("Stopping to monitor all assets of account",e);const{id:t}=e,n=this.#Ot.get(t);n&&await Promise.allSettled(Array.from(n).map((async e=>this.#kt.unsubscribe(e)))),this.#Ot.delete(t)}async#Lt(e,t){this.#i.log("Monitoring native asset balance",{account:e,network:t});const{address:n,id:r}=e,o=await this.#kt.subscribe({method:"accountSubscribe",network:t,params:[n,{commitment:"confirmed",encoding:"jsonParsed"}]});this.#Ft(r,o)}async#Dt(e,t,n){this.#i.log("Monitoring token program by owner",{account:e,tokenProgramAddress:t,network:n});const{address:r,id:o}=e,i=await this.#kt.subscribe({method:"programSubscribe",network:n,params:[t,{commitment:"confirmed",encoding:"jsonParsed",filters:[{memcmp:{offset:32,bytes:r,encoding:"base58"}}]}]});this.#Ft(o,i)}async#Ut(e,t){this.#i.info("Account notification received",{notification:e,subscription:t});const{network:n}=t,r=(0,Od.get)(t,"params[0]");M(r,re());const o=await this.#Tt.findByAddress(r);if(!o)throw new Error(`No keyring account found for address: ${r}`);const{lamports:i}=e.params.result.value;M(i,X());await Promise.all([this.#Xe.save({assetType:`${n}/${ld.SOL}`,keyringAccountId:o.id,network:n,address:r,symbol:"SOL",decimals:9,rawAmount:i.toString(),uiAmount:mw(i,9)}),this.#$t(o,n,r)])}async#jt(e,t){this.#i.info("Handling program notification",{notification:e,subscription:t});const{network:n}=t,r=(0,Od.get)(t,"params[0]");if(M(r,re()),r!==Cf&&r!==Uh)throw new Error(`Program not supported: ${r}`);const{owner:o}=e.params.result.value.account.data.parsed.info;M(o,re());const{mint:i}=e.params.result.value.account.data.parsed.info;M(i,re());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;M(a,re()),M(s,X()),M(c,re());const{pubkey:u}=e.params.result.value;M(u,re());const l=vw(n,i),d=await this.#Tt.findByAddress(o);if(!d)throw new Error(`No keyring account found with address: ${o}`);const f=await this.#ue.amountToUiAmountForMint(i,n,cu(BigInt(a))).catch((e=>(this.#i.error("Error converting amount to uiAmount",e),c))),h=(await this.#Xe.getAssetsMetadata([l]))[l];await Promise.all([this.#Xe.save({assetType:l,keyringAccountId:d.id,network:n,mint:i,pubkey:u,symbol:h?.symbol??"UNKNOWN",decimals:s,rawAmount:a,uiAmount:f}),this.#$t(d,n,u)])}async#$t(e,t,n){const r=(await this.#yt.fetchLatestSignatures(t,Xs(n),{limit:1}))?.[0];if(!r)throw new Error("No signature found");const o=await this.#yt.fetchBySignature(r,e,t);if(!o)throw new Error("No transaction found");Sw(o,e)?this.#i.info(`Transaction ${r} is spam. Skipping.`):await this.#yt.save(o)}#Ft(e,t){this.#Ot.has(e)||this.#Ot.set(e,new Set),this.#Ot.get(e)?.add(t)}async#Ct(e){this.#i.info("Handling connection recovery",{network:e});const t=await this.#Tt.getAll(),n=(await this.#kt.getAll()).filter((t=>t.network===e&&"accountSubscribe"===t.method)),r=t.filter((e=>n.some((t=>(0,Od.get)(t,"params[0]")===e.address))));r.length&&await this.#Bt.synchronize(r)}}(yE,RE,_E,BE,OE,vE,sE,cE,ed),LE=new class{#k;#qt;#Wt;#i;constructor(e,t,n,r=ed){this.#k=e,this.#qt=t,this.#Wt=n,this.#i=Xl(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 $t.SignIn:{const{address:e}=o;if(!e)throw new Error("No address");a=e;break}case $t.SignAndSendTransaction:case $t.SignMessage:case $t.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 $w(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.#qt.partiallySignBase64String(t,e,n,i),s={signedTransaction:Fg(a)};M(s,Ty);try{sl(a);const t=il(a);await this.#Wt.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.#qt.partiallySignBase64String(t,e,n,i),s=il(a),c=function({rpc:e}){return async function(t,n){await jg({...n,rpc:e,transaction:t})}}({rpc:this.#k.getRpc(n)}),u=Dw(n,"tx",s);this.#i.info(`Sending transaction: ${u}`),sl(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.#Wt.monitor(s,e.id,o?.commitment??"confirmed",n,r);const d={signature:s};return M(d,ky),d}async signMessage(e,t){this.#i.log("Signing message",e,t);const{address:n,entropySource:r,derivationPath:o}=e,i=Xs(n),a=$s().encode(t),s=function(e,t={}){return Object.freeze({content:"string"==typeof e?(new El).encode(e):e,signatures:Object.freeze({...t})})}(Gs().decode(a)),{privateKeyBytes:c}=await ev({entropySource:r,derivationPath:o}),u=await vl(c),[l]=await u.signMessages([s]);M(l,ee());const d=l[i];var f;M(d,(f=Uint8Array,L("instance",(e=>e instanceof f||`Expected a \`${f.name}\` instance, but received: ${R(e)}`))));const h={signature:Ms().decode(d),signedMessage:t,signatureType:"ed25519"};return M(h,Iy),h}async signIn(e,t){this.#i.log("Signing in",e,t);const{address:n}=e,r=this.#Vt(t),o=Gs().encode(r),i=$s().decode(o),a={account:{address:n},...await this.signMessage(e,i)};return M(a,xy),a}async verifySignature(e,t,n){this.#i.log("Verifying signature",{account:e,signatureBase58:t,messageBase64:n}),M(t,Td),M(n,Id);const r=zs().encode(t),o=$s().encode(n),{privateKeyBytes:i}=await ev({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await vl(i);return await Sc(a.keyPair.publicKey,r,o)}#Vt(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}}(hE,wE,UE,ed),DE=new class{#pe;#i;#yt;#Xe;#Kt;#Gt;#Ht;#Zt;#Jt="Create Solana Account";constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:o,confirmationHandler:i,keyringAccountMonitor:a,nameResolutionService:s}){this.#pe=e,this.#i=Xl(t,"[🔑 Keyring]"),this.#yt=n,this.#Xe=r,this.#Kt=o,this.#Gt=i,this.#Ht=a,this.#Zt=s}async listAccounts(){try{const e=await this.#pe.getKey("keyringAccounts")??{};return(0,Od.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{Rv({accountId:e},md);const t=await this.#pe.getKey(`keyringAccounts.${e}`);return t&&(t.domain=await this.#Zt.resolveAddress(ad.Mainnet,t.address)),t}catch(e){throw this.#i.error({error:e},"Error getting account"),new $r(e)}}async getAccountOrThrow(e){const t=await this.getAccount(e);if(!t)throw new Error(`Account "${e}" not found`);return t}#Yt(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)))}#Qt(e){return`m/44'/501'/${e}'/0'`}#Xt(e){const t=e.split("/")[3];if(!t)throw new Error("Invalid derivation path");const n=parseInt(t.replace("'",""),10);return M(n,Z()),n}async#en(){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.#Jt);const n=await this.listAccounts(),r=e?.entropySource??await this.#en(),o=e?.derivationPath?this.#Xt(e.derivationPath):this.#Yt(n,r),i=e?.derivationPath?e.derivationPath:this.#Qt(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."),tm(a);const{publicKeyBytes:s}=await ev({entropySource:r,derivationPath:i}),c=tc().decode(s.slice(1)),{importedAccount:u,accountNameSuggestion:l,metamask:d,...f}=e??{},h={id:t,entropySource:r,derivationPath:i,index:o,type:dt.DataAccount,address:c,domain:null,scopes:[Dt.Mainnet,Dt.Testnet,Dt.Devnet],options:{...f,entropySource:r,derivationPath:i,index:o},methods:[$t.SignAndSendTransaction,$t.SignTransaction,$t.SignMessage,$t.SignIn]};await this.#pe.setKey(`keyringAccounts.${h.id}`,h),await this.#Ht.monitorKeyringAccount(h);const p=tm(h);return await this.emitEvent(gn.AccountCreated,{account:p,accountNameSuggestion:l??`Solana Account ${o+1}`,displayAccountNameSuggestion:!l,displayConfirmation:!1,...d?{metamask:d}:{}}),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Nv.OnSyncAccount,params:{accountId:t}}}}),await async function(e){try{return await snap.request({method:"snap_endTrace",params:{name:e}})}catch(e){return null}}(this.#Jt),p}catch(e){throw this.#i.error({error:e},"Error creating account"),await this.#tn(t),new Error(`Error creating account: ${e.message}`)}}async#tn(e){await Promise.all([this.#pe.deleteKey(`keyringAccounts.${e}`),this.#pe.deleteKey(`transactions.${e}`),this.#pe.deleteKey(`assets.${e}`)])}async deleteAccount(e){try{Rv({accountId:e},yd);const t=await this.getAccountOrThrow(e);await this.emitEvent(gn.AccountDeleted,{id:e}),await Promise.allSettled([this.#tn(e),this.#Ht.stopMonitorKeyringAccount(t)])}catch(e){throw this.#i.error({error:e},"Error deleting account"),e}}async listAccountAssets(e){try{Rv({accountId:e},vd);const t=await this.getAccountOrThrow(e),n=(await this.#Xe.findByAccount(t)).filter((e=>e.assetType.endsWith(ld.SOL)||Number(e.rawAmount)>0)).map((e=>e.assetType));return Pv(n,nn),n}catch(e){throw this.#i.error({error:e},"Error listing account assets"),e}}async getAccountBalances(e,t){try{Rv({accountId:e,assets:t},wd);const n=await this.getAccountOrThrow(e),r=(await this.#Xe.findByAccount(n)).filter((e=>t.includes(e.assetType))).filter((e=>e.assetType.endsWith(ld.SOL)||Number(e.rawAmount)>0)).reduce(((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e)),{});return Pv(r,bd),r}catch(e){throw this.#i.error({error:e},"Error getting account balances"),e}}async emitEvent(e,t){await vn(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.#nn(e)}}async#nn(e){M(e,Bv);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`);M(r,Sd);if(!await this.#Gt.handleKeyringRequest(e,a))throw new ao;switch(t){case $t.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#Kt.signAndSendTransaction(a,e,r,i,t)}case $t.SignTransaction:{this.#rn(a,e);const{transaction:t,options:o}=n;return this.#Kt.signTransaction(a,t,r,i,o)}case $t.SignMessage:{this.#rn(a,e);const{message:t}=n;return this.#Kt.signMessage(a,t)}case $t.SignIn:return this.#Kt.signIn(a,n);default:throw new Jr(`Unsupported method: ${t}`)}}#rn(e,t){const{address:n}=e,{account:r}=t.request.params;try{Xs(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{Rv({accountId:e,pagination:t},Ad);const{limit:n,next:r}=t,o=await this.getAccount(e);if(!o)throw new Error("Account not found");const i=await this.#yt.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{M(e,Sd);const{method:n,params:r}=t,o={method:n,params:r};M(o,_y);const i=await this.listAccounts();return{address:await this.#Kt.resolveAccountAddress(i,e,o)}}catch(e){return this.#i.error({error:e},"Error resolving account address"),null}}async discoverAccounts(e,t,n){try{M({scopes:e,entropySource:t,groupIndex:n},Ov);const r=this.#Qt(n),{publicKeyBytes:o}=await ev({entropySource:t,derivationPath:r}),i=tc().decode(o.slice(1)),a=[];for(const t of e)a.push(this.#yt.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}}}({state:uE,transactionsService:BE,logger:ed,assetsService:_E,walletService:LE,confirmationHandler:zE,keyringAccountMonitor:jE,nameResolutionService:IE}),FE=new class{#k;#i;constructor(e,t=ed){this.#k=e,this.#i=t}static isMaybeNonFungible(e){const{tokenAmount:t}=e,{decimals:n}=t;return!1}}(hE,ed),$E=new class{#k;#on;#i;#C;#in;#an;#Xe;#ve={minimumBalanceForRentExemption:5*gv.Minute};constructor(e,t,n,r,o,i,a){this.#k=e,this.#on=t,this.#C=r,this.#i=Xl(n,"[📬 SendService]"),this.#in=o,this.#an=i,this.#Xe=a}async#sn(e){return nd((async t=>this.#k.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>Io(e.toString())))),this.#C,{functionName:"SendService:getMinimumBalanceForRentExemption",ttlMilliseconds:this.#ve.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){const{fromAccountId:t,toAddress:n,amount:r,assetId:o}=e.params,i=await this.#on.getAccountOrThrow(t),{chainId:a,assetReference:s}=Fo(o),c=a,u=o===fd[c].nativeToken.caip19Id,l=u?this.#in:this.#an;this.#i.log("Confirming send transaction",{fromAccountId:t,toAddress:n,amount:r,assetId:o});const d={from:i,to:Xs(n),amount:r,network:c,...u?{}:{mint:Xs(s)}},f=ol(await l.buildTransactionMessage(d)),h=Fg(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:id,request:{method:$t.SignAndSendTransaction,params:{account:{address:i.address},transaction:h,scope:c}}};return this.#i.log("Submitting keyring request",p),this.#on.submitRequest(p)}async onAddressInput(e){const{params:{value:t}}=e;if(""===t)return{valid:!1,errors:[{code:Xm.Required}]};try{return Xs(t),{valid:!0,errors:[]}}catch(e){return{valid:!1,errors:[{code:Xm.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e,o=await this.#on.getAccountOrThrow(n),{chainId:i}=Fo(r),a=i,s=fd[a].nativeToken.caip19Id,c=r===s,u=await this.#Xe.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:Xm.Required}]};const f=wm(l.uiAmount??"0"),h=wm(d?.uiAmount??"0"),p=wm(t),g=await this.#sn(a),m=c?this.#in:this.#an,y=new nE(m).getFee(),v=Io(y.toString());if(h.isZero())return{valid:!1,errors:[{code:Xm.InsufficientBalance}]};if(c){if(p.gt(h))return{valid:!1,errors:[{code:Xm.InsufficientBalance}]};if(p.plus(v).plus(g).gt(h))return{valid:!1,errors:[{code:Xm.InsufficientBalanceToCoverFee}]}}else{if(p.gt(f))return{valid:!1,errors:[{code:Xm.InsufficientBalance}]};if(v.plus(g).gt(h))return{valid:!1,errors:[{code:Xm.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(hE,DE,ed,dE,AE,bE,_E),qE=new class{#mt;#Kt;#i;#cn;constructor(e,t,n,r){this.#mt=e,this.#Kt=t,this.#i=Xl(n,"[👋 ClientRequestHandler]"),this.#cn=r}async handle(e){this.#i.log("Handling client request",e);const{method:t}=e;switch(t){case Am.SignAndSendTransactionWithoutConfirmation:return this.#un(e);case Am.ConfirmSend:return this.#ln(e);case Am.SignAndSendTransaction:return this.#dn(e);case Am.ComputeFee:return this.#fn(e);case Am.OnAddressInput:return this.#hn(e);case Am.OnAmountInput:return this.#pn(e);case Am.SignRewardsMessage:return this.#gn(e);default:throw new Jr}}async#un(e){try{M(e,Cy)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:o}}=e,i=await this.#mt.findByAddress(r);if(!i)throw new Gr(`Account not found: ${r}`);return this.#Kt.signAndSendTransaction(i,t,o,id,n)}async#dn(e){try{M(e,Py)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:o}}=e,i=await this.#mt.findById(r);if(!i)throw new Gr(`Account not found: ${r}`);const{signature:a}=await this.#Kt.signAndSendTransaction(i,t,o,id,n),s={transactionId:a};return M(s,Ny),s}async#ln(e){try{M(e,Oy)}catch(e){const t=new Gr;throw t.cause=e,t}return await this.#cn.confirmSend(e)}async#fn(e){try{M(e,Vy)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,{baseFee:r,priorityFee:o}=ym.calculateFee(t),i=fd[n].nativeToken.symbol,a=fd[n].nativeToken.caip19Id,s=[{type:kt.Base,asset:{unit:i,type:a,amount:vm(r).toString(),fungible:!0}},{type:kt.Priority,asset:{unit:i,type:a,amount:vm(o).toString(),fungible:!0}}];return M(s,Ky),s}async#hn(e){try{M(e,zy)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#cn.onAddressInput(e);return M(t,qy),t}async#pn(e){try{M(e,jy)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#cn.onAmountInput(e);return M(t,qy),t}async#gn(e){M(e,$y);const{params:{account:{address:t},message:n}}=e,r=await this.#mt.findByAddress(t);if(!r)throw new Gr(`Account not found: ${t}`);const{address:o}=Ly(n);if(o!==t)throw new Gr(`Address in rewards message (${o}) does not match signing account address (${t})`);return await this.#Kt.signMessage(r,n)}}(RE,LE,ed,$E),WE={configProvider:sE,connection:hE,keyring:DE,priceApiClient:SE,state:uE,cache:lE,assetsService:_E,tokenPricesService:TE,signer:wE,transactionsService:BE,sendSolBuilder:AE,sendSplTokenBuilder:bE,walletService:LE,transactionScanService:ME,analyticsService:fE,confirmationHandler:zE,nftService:FE,clientRequestHandler:qE,webSocketConnectionService:gE,subscriptionService:yE,eventEmitter:cE,nameResolutionService:IE,accountsService:RE,accountsSynchronizer:OE,tokenHelper:vE},VE=ee({id:re(),jsonrpc:J("2.0"),method:J(Nv.OnSyncAccount),params:ee({accountId:hd})}),KE=ee({id:re(),jsonrpc:J("2.0"),method:J(Nv.OnTransactionAdded),params:ee({accountId:hd,metadata:ee({scope:Sd,origin:re()})})}),GE=ee({id:re(),jsonrpc:J("2.0"),method:J(Nv.OnTransactionApproved),params:ee({accountId:hd,metadata:ee({scope:Sd,origin:re()})})}),HE=ee({id:re(),jsonrpc:J("2.0"),method:J(Nv.OnTransactionRejected),params:ee({accountId:hd,metadata:ee({scope:Sd,origin:re()})})}),ZE=_w("Form"),JE=_w("Field"),YE=_w("AccountSelector"),QE=_w("AssetSelector"),XE=({title:e,backButtonName:t})=>Tw(Rw,{direction:"horizontal",alignment:"space-between",center:!0,children:[t?kw(jw,{name:t,children:kw(iA,{name:"arrow-left",color:"primary",size:"md"})}):null,kw(Pw,{size:"sm",children:e}),Tw(Rw,{direction:"horizontal",children:[kw(Rw,{children:null}),kw(Rw,{children:null}),kw(Rw,{children:null}),kw(Rw,{children:null})]})]}),ek=_w("Input");var tk=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}({}),nk=function(e){return e.TOKEN="TOKEN",e.FIAT="USD",e}({});const rk=({name:e,value:t,tokenSymbol:n,currency:r,currencyType:o,locale:i,swapCurrencyButtonDisabled:a=!1})=>{const s=Gw(i),c=o===nk.FIAT?r.toUpperCase():n;return Tw(JE,{label:s("send.amountField"),children:[kw(ek,{name:e,type:"number",min:0,placeholder:"0",step:.01,value:t??void 0}),Tw(Rw,{direction:"horizontal",center:!0,children:[kw(Rw,{direction:"vertical",alignment:"center",children:kw(Nw,{size:"sm",children:c})}),kw(jw,{name:tk.SwapCurrencyButton,disabled:a,children:kw(iA,{name:"swap-vertical",color:a?"muted":"primary",size:"md"})})]})]})},ok={initial:null,fetching:"default",fetched:"success",error:null},ik=({name:e,value:t,error:n,locale:r,showClearButton:o,disabled:i,domainResolutionStatus:a})=>{const s=Gw(r);return Tw(Rw,{children:[Tw(JE,{label:s("send.toField"),error:n,children:[kw(ek,{name:e,placeholder:i?"":s("send.toPlaceholder"),value:t??void 0,disabled:i}),o?kw(Rw,{children:kw(jw,{name:tk.ClearButton,children:kw(iA,{name:oA.Close,color:"primary"})})}):null]}),a&&null!==ok[a]&&kw(Nw,{size:"sm",color:ok[a],children:s(`send.toDomainResolutionStatus.${a}`)})]})},ak=e=>{const{amount:t,tokenPrices:n,tokenCaipId:r,currencyType:o}=e,i=n?.[r]?.price;if(o===nk.TOKEN)return t;if(void 0===i)throw new Error("Token price is undefined, cannot convert to fiat amount.");return null===t?null:xo(t).dividedBy(xo(i)).toString()},sk=e=>{const{selectedTokenMetadata:t}=e;return{...t??{},tokenSymbol:t?.symbol??"UNKNOWN",tokenImage:t?.imageSvg??gw}},ck=e=>{const{tokenCaipId:t,tokenPrices:n}=e;return n?.[t]?.price},uk=e=>{const{balances:t,fromAccountId:n,tokenCaipId:r}=e;return t?.[n]?.[r]?.amount??"0"},lk=e=>{const{tokenCaipId:t,scope:n}=e;return t===fd[n]?.nativeToken?.caip19Id},dk=_w("Spinner"),fk=({title:e,subtitle:t,iconSrc:n,isLoading:r})=>Tw(Rw,{alignment:"center",center:!0,children:[Tw(Rw,{direction:"horizontal",center:!0,children:[r?kw(dk,{}):null,n&&!r?kw(zw,{borderRadius:"full",src:n}):null]}),kw(Pw,{size:"lg",children:e}),t?kw(Nw,{color:"muted",children:t}):null]}),hk=_w("Value"),pk=({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=Gw(a),p=fd[t],g=o.find((e=>e.id===n))?.address,m=$w(t,g),y=p.name,v=p.nativeToken.symbol,w=l[p.nativeToken.caip19Id]?.price,A=c?u:i,b=A?xA(A,v,a):"",S=void 0===w||null===A?"":tA(_A(A,w),s,a);return Tw(Rw,{children:[Tw(Bw,{children:[kw(Ow,{label:h("send.confirmation.from"),children:d?kw(Fw,{domain:d,scope:t,address:g}):kw(Lw,{href:Dw(t,"address",g),children:kw(Mw,{address:m,displayName:!0})})}),r?kw(Ow,{label:h("send.confirmation.recipient"),children:f?kw(Fw,{domain:f,scope:t,address:r}):kw(Lw,{href:Dw(t,"address",r),children:kw(Mw,{address:$w(t,r),displayName:!0})})}):null]}),Tw(Bw,{children:[kw(Ow,{label:h("send.confirmation.network"),children:kw(Nw,{children:y})}),kw(Ow,{label:h("send.confirmation.transactionSpeed"),children:kw(Nw,{children:"<1s"})}),kw(Ow,{label:h("send.confirmation.fee"),children:kw(hk,{extra:S,value:b})})]})]})};var gk=function(e){return e.BackButton="transaction-confirmation-back-button",e.CancelButton="transaction-confirmation-cancel-button",e.ConfirmButton="transaction-confirmation-submit-button",e}({});const mk={"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:v,currency:w}}=e,A=Gw(v),b=f[o]?.[l],S=b?.amount,E=b?.unit??"",k=void 0!==S,T=r.find((e=>e.id===o)),I=T?.address?$w(d,T.address):void 0,x=ck(e),_=void 0===S||"0"===S,C=void 0===x,R="error"===h||"fetched"===h&&C,P=(k?{[nk.FIAT]:tA(_A(S,x??0),w,v),[nk.TOKEN]:xA(S,E,v)}:{[nk.FIAT]:"",[nk.TOKEN]:""})[u],N=o.length>0&&!!a&&a.length>0&&Um(c?.[tk.DestinationAccountInput]),B=!Um(y)&&""!==y,O=Boolean(a&&a.length>0),M=Boolean(c?.[tk.AmountInput]?.message),z=M?c?.[tk.AmountInput]?.message??"":`${A("send.balance")}: ${P}`,U=o.length>0&&!!i&&i.length>0&&!!a&&a.length>0&&Object.values(c).every(Um)&&k&&!p&&B;return Tw(Cw,{backgroundColor:"alternative",children:[Tw(Rw,{children:[kw(XE,{title:A("send.title"),backButtonName:tk.BackButton}),Tw(ZE,{name:tk.Form,children:[R&&kw(SA,{title:"",severity:"info",children:kw(Nw,{children:A("send.selectedTokenPriceNotAvailable",{currency:w})})}),kw(Rw,{children:null}),kw(Rw,{children:null}),kw(Rw,{children:null}),kw(JE,{label:A("send.fromField"),error:c?.[tk.SourceAccountSelector]?.message??"",children:kw(YE,{name:tk.SourceAccountSelector,chainIds:[d],value:I??void 0,hideExternalAccounts:!0,switchGlobalAccount:!0})}),kw(Rw,{children:null}),kw(Rw,{children:null}),kw(Rw,{children:null}),kw(ik,{locale:v,disabled:m,name:tk.DestinationAccountInput,value:t??null,showClearButton:O,domainResolutionStatus:s,error:c?.[tk.DestinationAccountInput]?.message??""}),N&&Tw(Rw,{children:[kw(Rw,{children:null}),kw(Rw,{children:null}),kw(Rw,{children:null}),Tw(Rw,{direction:"horizontal",children:[kw(JE,{label:A("send.assetField"),children:kw(QE,{chainIds:[d],value:l,name:tk.AssetSelector,addresses:I?[I]:[]})}),kw(rk,{name:tk.AmountInput,currencyType:u,tokenSymbol:E,currency:w,value:n??null,locale:v,swapCurrencyButtonDisabled:C||_})]}),Tw(Rw,{direction:"horizontal",alignment:"space-between",crossAlignment:"start",children:[kw(Rw,{direction:"vertical",alignment:"start",children:kw(Nw,{size:"sm",color:M?"error":"muted",children:z})}),kw(jw,{size:"sm",name:tk.MaxAmountButton,disabled:_,children:A("send.maxButton")})]})]}),g&&Tw(Rw,{children:[kw(Rw,{children:null}),kw(SA,{title:A(g.title),severity:"warning",children:kw(Nw,{children:A(g.message)})})]})]})]}),Tw(Uw,{children:[kw(jw,{name:tk.CancelButton,children:A("send.cancelButton")}),kw(jw,{name:tk.SendButton,disabled:!U,loading:p,children:A("send.continueButton")})]})]})},"transaction-confirmation":({context:e})=>{const{preferences:{currency:t,locale:n}}=e,r=Gw(n),{tokenImage:o,tokenSymbol:i}=sk(e),a=ak(e),s=ck(e),c=void 0===s?"":tA(_A(a??"0",s),t,n);return Tw(Cw,{children:[Tw(Rw,{children:[kw(XE,{title:r("send.confirmation.title"),backButtonName:"transaction-confirmation-back-button"}),kw(fk,{title:xA(a??"0",i,n),subtitle:c,iconSrc:o}),kw(pk,{context:e})]}),Tw(Uw,{children:[kw(jw,{name:"transaction-confirmation-cancel-button",children:r("send.confirmation.cancelButton")}),kw(jw,{name:"transaction-confirmation-submit-button",loading:e.loading,disabled:e.loading,children:r("send.confirmation.sendButton")})]})]})},"send-pending":({context:e})=>{const t=Gw(e.preferences.locale);return kw(Cw,{children:Tw(Rw,{children:[kw(Rw,{children:null}),kw(fk,{title:t("send.send-pending.title"),subtitle:t("send.send-pending.subtitle"),isLoading:!0}),kw(pk,{context:e})]})})},"transaction-success":({context:e})=>{const{preferences:t,transaction:n,scope:r}=e,o=Gw(t.locale),{tokenSymbol:i}=sk(e),a=ak(e);return kw(Cw,{children:Tw(Rw,{children:[kw(Rw,{children:null}),kw(fk,{title:o("send.transaction-success.title"),subtitle:o("send.transaction-success.subtitle",{amount:eA(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'}),kw(pk,{context:e}),n?.signature?kw(Rw,{alignment:"center",center:!0,children:kw(Lw,{href:Dw(r,"tx",n?.signature),children:o("send.confirmation.viewTransaction")})}):null]})})},"transaction-failure":({context:e})=>{const{preferences:t}=e,n=Gw(t.locale),{tokenSymbol:r}=sk(e),o=ak(e);return kw(Cw,{children:Tw(Rw,{children:[kw(Rw,{children:null}),kw(fk,{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'}),kw(pk,{context:e})]})})}},yk=({context:e,inputToAddress:t,inputAmount:n})=>{const r=e.stage??"send-form";return kw(mk[r],{context:e,inputToAddress:t,inputAmount:n})};function vk(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 wk(e,t,n){return n[e]?n[e]?.map((e=>e(t))).find((e=>null!==e))??null:null}function Ak(e){const t=Tk(e),n={[tk.SourceAccountSelector]:e.fromAccountId,[tk.AmountInput]:e.amount,[tk.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=Gw(t);return t=>{const r=""===t?{message:n(e),value:t}:null;return r?{message:r.message,value:t}:null}},Sk=(e,t)=>{const n=Gw(t);return t=>{try{return vk(t)||Xs(t),null}catch{return{message:n(e),value:t}}}},Ek=e=>{const{minimumBalanceForRentExemptionSol:t,preferences:{locale:n},feeEstimatedInSol:r,selectedTokenMetadata:o}=e,i=Gw(n);return n=>{if(""===n)return{message:"",value:n};const a=ak({...e,amount:n}),s=wm(a??"0"),c=uk(e),u=wm(c),l=wm(r??"0"),d=wm(t??"0"),f=(e=>uk({...e,tokenCaipId:fd[e.scope].nativeToken.caip19Id}))(e),h=wm(f),p=lk(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}},kk=ee({scope:H([...Object.values(ad)]),account:hd,assetId:te(Lo)}),Tk=e=>({[tk.SourceAccountSelector]:[bk("send.fromRequiredError",e.preferences.locale)],[tk.AmountInput]:[Ek(e),bk("send.amountRequiredError",e.preferences.locale)],[tk.DestinationAccountInput]:[bk("send.toRequiredError",e.preferences.locale),Sk("send.toInvalidError",e.preferences.locale)]}),Ik={scope:ad.Mainnet,fromAccountId:"",fromDomain:null,amount:"",destinationAddressOrDomain:null,toDomain:null,toAddress:null,domainResolutionStatus:null,feeEstimatedInSol:"0",feePaidInSol:"0",tokenCaipId:sd.SolMainnet,accounts:[],currencyType:nk.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},xk={[Nv.OnTransactionAdded]:async({request:e})=>{try{ed.info("[onTransactionAdded] Cronjob triggered",e),M(e,KE);const{accountId:t,metadata:n}=e.params,r=await DE.getAccountOrThrow(t);await fE.trackEventTransactionAdded(r,n)}catch(e){throw ed.error(e),new Vr(e)}},[Nv.OnTransactionApproved]:async({request:e})=>{try{ed.info("[onTransactionApproved] Cronjob triggered",e),M(e,GE);const{accountId:t,metadata:n}=e.params,r=await DE.getAccountOrThrow(t);await fE.trackEventTransactionApproved(r,n)}catch(e){throw ed.error(e),new Vr(e)}},[Nv.OnTransactionRejected]:async({request:e})=>{try{ed.info("[onTransactionRejected] Cronjob triggered",e),M(e,HE);const{accountId:t,metadata:n}=e.params,r=await DE.getAccountOrThrow(t);await fE.trackEventTransactionRejected(r,n)}catch(e){throw ed.error(e),new Vr(e)}},[Nv.OnSyncAccount]:async({request:e})=>{M(e,VE);const{accountId:t}=e.params,n=await RE.findById(t);if(!n)throw new Error("Account not found");const r=await _E.fetch(n);await _E.saveMany(r);const o=await BE.fetchAssetsTransactions(r,{limit:20});await BE.saveMany(o)},[Nv.RefreshSend]:async()=>{const e=Xl(ed,"[refreshSend]");e.info("Background event triggered");const[t,n,r]=await Promise.all([_E.getAll(),uE.getKey("mapInterfaceNameToId"),uv().catch((()=>Ik.preferences))]),o=t.flatMap((e=>e.assetType)),i=n?.[rv];if(!i)return void e.info("No send form interface found");const a=await lv(i),s=await SE.getMultipleSpotPrices(o,r.currency);await uE.setKey("tokenPrices",s);const c={...a,tokenPrices:{...a.tokenPrices,...s}};await av(i,kw(yk,{context:c}),c),e.info("✅ Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}})},[Nv.RefreshConfirmationEstimation]:async()=>{const e=Xl(ed,"[refreshConfirmationEstimation]");e.info("Background event triggered");const t=(await uE.getKey("mapInterfaceNameToId")??{})[ov];if(!t)return void e.info("No interface context found");const n=await lv(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 av(t,kw(RA,{context:r}),r);const[o,i]=await Promise.all([ME.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}),lv(t)]),a={...i,scanFetchStatus:"fetched",scan:o};e.info("New scan fetched"),await av(t,kw(RA,{context:a}),a),e.info("Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}})}catch(n){const r={...await lv(t),scanFetchStatus:"fetched"};await av(t,kw(RA,{context:r}),r),e.warn({error:n},"Could not update the interface. But rolled back status to fetched.")}},[Nv.CloseWebSocketConnections]:async()=>{ed.info("Closing all WebSocket connections via background event"),await gE.closeAllConnections()}},_k={...xk};var Ck={};const Rk=ee({chainId:Sd,domain:te(re()),address:te(re())}),Pk="Solana Name Service",Nk={[mv.GetFeeForTransaction]:async({request:e})=>{M(e.params,Ed);const{transaction:t}=e.params;try{const{totalFee:e}=ym.calculateFee(t),n={value:e.toString()};return M(n,kd),n}catch(e){throw ed.error(e),new Vr(e)}},[mv.StartSendTransactionFlow]:async({request:e})=>{const{params:t}=e;M(t,kk);const{scope:n,account:r}=t,o=t.assetId??fd[n].nativeToken.caip19Id,i={...Ik,scope:n,fromAccountId:r,tokenCaipId:o,loading:!0},[a,s,c,u]=await Promise.all([_E.getAll(),RE.getAll(),uE.getKey("tokenPrices"),uv().catch((()=>Ik.preferences))]);i.balances=function(e,t){return t.filter((t=>{const n=t.assetType===fd[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 iv(kw(yk,{context:i}),i),d=cv(l),f=_E.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=SE.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=hE.getRpc(n).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>{i.minimumBalanceForRentExemptionSol=vm(e).toString()})).catch((()=>{}));return i.loading=!0,await av(l,kw(yk,{context:i}),i),i.loading=!1,await Promise.all([h,f,p]),await av(l,kw(yk,{context:i}),i),await uE.setKey(`mapInterfaceNameToId.${rv}`,l),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}}),d},[yv.ListWebSockets]:async()=>(await cE.emitSync("onListWebSockets"),null),[yv.ListSubscriptions]:async()=>(await cE.emitSync("onListSubscriptions"),null),[yv.TestOnStart]:async()=>(await cE.emitSync("onStart"),null),[yv.TestOnInstall]:async()=>(await cE.emitSync("onInstall"),null),[yv.TestOnUpdate]:async()=>(await cE.emitSync("onUpdate"),null),[yv.SynchronizeAccounts]:async()=>(await OE.synchronize(),null)};const Bk=async e=>{try{return await e()}catch(e){const t=function(e){return[$r,Jr,ao,Yr,Jr,Qr,Xr,eo,to,no,ro,oo,io,Vr,Kr,Gr,Hr,Zr].some((t=>e instanceof t))}(e)?e:new $r(e);throw ed.error({error:t},`[SnapError] ${JSON.stringify(t.toJSON(),null,2)}`),t}};var Ok=n(4255),Mk=n.n(Ok),zk=n(3804),Uk=n.n(zk);class jk extends Error{constructor(e="Operation cancelled"){super(e),this.name="CancellationError"}}const Lk=async e=>{const{fromAccountId:t,tokenCaipId:n,scope:r,toAddress:o}=e,i=ak(e),a=await DE.getAccountOrThrow(t);if(!o||!i)throw new Error("Invalid transaction parameters");const s=n===fd[r].nativeToken.caip19Id,c=s?AE:bE,u=new nE(c),l={from:a,to:Xs(o),amount:i,network:r,...s?{}:{mint:Xs(Fo(n).assetReference)}},d=await c.buildTransactionMessage(l),f=await(async e=>uu(e,Fu,Bu().encode,Fs().decode))(d);return{feeInLamports:u.getFee(),base64EncodedTransactionMessage:f}},Dk=Uk()((async(e,t)=>{try{if(!Ak(t))return;const n={buildingTransaction:!0,transactionMessage:null,feeEstimatedInSol:null};await av(e,kw(yk,{context:{...t,...n}}),{...t,...n});const{feeInLamports:r,base64EncodedTransactionMessage:o}=await Lk(t),i={transactionMessage:o,feeEstimatedInSol:r?vm(r).toString():null,buildingTransaction:!1},a=await lv(e);await av(e,kw(yk,{context:{...a,...i}}),{...a,...i})}catch(t){ed.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 lv(e);await av(e,kw(yk,{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 jk)}))}))]);return o.cancel=()=>n.abort(),o})(e);let n=null;return async(...e)=>{if(n&&"function"==typeof n.cancel){const e="Cancelling previous task";ed.warn(e),n.cancel()}const r=t(...e);n=r;try{return await r}finally{n===r&&(n=null)}}}),Mk()(500));const Fk={[tk.BackButton]:async function({id:e}){await sv(e,!1),await uE.deleteKey(`mapInterfaceNameToId.${rv}`)},[tk.SourceAccountSelector]:async function({id:e,event:t,context:n}){const r=t.value;n.fromAccountId=r.accountId,n.error=null,n.validation[tk.SourceAccountSelector]=wk(tk.SourceAccountSelector,n.fromAccountId,Tk(n)),n.amount&&(n.validation[tk.AmountInput]=wk(tk.AmountInput,n.amount,Tk(n))),await av(e,kw(yk,{context:n}),n),await Dk(e,n)},[tk.AmountInput]:async function({id:e,event:t,context:n}){const r={...n};r.amount=t.value,r.error=null;const o=wk(tk.AmountInput,r.amount,Tk(r));if(o&&r.validation[tk.AmountInput]?.message!==o?.message)return r.validation[tk.AmountInput]=o,void await av(e,kw(yk,{context:r}),r);null===o&&(r.validation[tk.AmountInput]=null,await av(e,kw(yk,{context:r}),r),await Dk(e,r))},[tk.AssetSelector]:async function({id:e,event:t,context:n}){if("object"!=typeof t.value||!("asset"in t.value))return;const r=t.value.asset;if(n.tokenCaipId===r)return;const o=r===fd[n.scope].nativeToken.caip19Id?AE:bE,i=new nE(o).getFee(),a={tokenCaipId:r,feeEstimatedInSol:vm(i).toString(),selectedTokenMetadata:{symbol:t.value.symbol,name:t.value.name,asset:t.value.asset,imageSvg:null},amount:"",error:null},s=(0,Od.merge)(n,a);await av(e,kw(yk,{context:s,inputAmount:""}),s),await Dk(e,n)},[tk.SwapCurrencyButton]:async function({id:e,context:t}){if(t.error=null,t.currencyType=t.currencyType===nk.TOKEN?nk.FIAT:nk.TOKEN,!t.amount)return void await av(e,kw(yk,{context:t}),t);const n=xo(t.amount??"0"),{price:r}=t.tokenPrices[t.tokenCaipId]??{price:0};t.currencyType===nk.TOKEN&&(t.amount=n.dividedBy(r).toString()),t.currencyType===nk.FIAT&&(t.amount=n.multipliedBy(r).toString()),await av(e,kw(yk,{context:t,inputAmount:t.amount}),t)},[tk.MaxAmountButton]:async function({id:e,context:t}){const{currencyType:n,minimumBalanceForRentExemptionSol:r,tokenCaipId:o,tokenPrices:i}=t,a={...t},s=uk(t);if(lk(t)){const e=wm(s),t=new nE(AE).getFee().toString(),n=wm(r),o=e.minus(t).minus(n).minus(1),i=xo.maximum(o,o.isNegative()?e:xo(0)),c=vm(i);a.amount=c.toString()}else a.amount=s;if(n===nk.FIAT){const{price:e}=i[o]??{price:0};a.amount=_A(a.amount,e)}a.error=null,a.validation[tk.AmountInput]=wk(tk.AmountInput,a.amount,Tk(a)),await av(e,kw(yk,{context:a,inputAmount:a.amount}),a),await Dk(e,a)},[tk.DestinationAccountInput]:async function({id:e,event:t,context:n}){const r={...n};r.destinationAddressOrDomain=t.value,r.domainResolutionStatus=null,r.error=null;const o=wk(tk.DestinationAccountInput,r.destinationAddressOrDomain,Tk(r));r.validation[tk.DestinationAccountInput]=o,vk(r?.destinationAddressOrDomain)?(r.domainResolutionStatus="fetching",await av(e,kw(yk,{context:r}),r),r.toAddress=await IE.resolveDomain(r.scope,r.destinationAddressOrDomain).catch((()=>{const e=Gw(r.preferences.locale);return r.validation[tk.DestinationAccountInput]={message:e("send.toInvalidErrorDomain"),value:r.destinationAddressOrDomain??""},null})),r.domainResolutionStatus=r.toAddress?"fetched":"error"):r.toAddress=r.destinationAddressOrDomain,await av(e,kw(yk,{context:r}),r),null===o&&await Dk(e,r)},[tk.ClearButton]:async function({id:e,context:t}){t.destinationAddressOrDomain="",t.toAddress="",t.domainResolutionStatus=null,t.error=null,t.validation[tk.DestinationAccountInput]=null,await av(e,kw(yk,{context:t,inputToAddress:t.toAddress}),t)},[tk.CancelButton]:async function({id:e}){await sv(e,!1),await uE.deleteKey(`mapInterfaceNameToId.${rv}`)},[tk.SendButton]:async function({id:e,context:t}){if(!Ak(t))return;const n={...t};n.stage="transaction-confirmation",n.loading=!0,await av(e,kw(yk,{context:n}),n);const r=t.accounts.find((e=>e.id===t.fromAccountId))?.address,[o,i,a,s]=await Promise.all([r?IE.resolveAddress(t.scope,r):null,t.toAddress?IE.resolveAddress(t.scope,t.toAddress):null,SE.getMultipleSpotPrices(t.assets,t.preferences.currency).then((e=>e)).catch((()=>null)),t.selectedTokenMetadata?ww.generateImageComponent(Bd({baseUrl:sE.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 av(e,kw(yk,{context:n}),n),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Nv.OnTransactionAdded,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:id}}}}})}};const $k={[gk.BackButton]:async function({id:e,context:t}){const n={...t,stage:"send-form"};await av(e,kw(yk,{context:n,inputAmount:t.amount??"",inputToAddress:t.destinationAddressOrDomain??""}),n)},[gk.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:Nv.OnTransactionRejected,params:{accountId:n,metadata:{scope:o,origin:id}}}}}),await sv(e,!1),await uE.deleteKey(`mapInterfaceNameToId.${rv}`)},[gk.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 av(e,kw(yk,{context:t}),t);await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Nv.OnTransactionApproved,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:id}}}}});const a={...t,stage:"send-pending"};await av(e,kw(yk,{context:a}),a);let s=null;try{const e=await DE.getAccountOrThrow(r);s=(await LE.signAndSendTransaction(e,i,n,id)).signature}catch(e){ed.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 av(e,kw(yk,{context:c}),c),await uE.deleteKey(`mapInterfaceNameToId.${rv}`)}};const qk=2n**255n-19n,Wk=2n**252n+27742317777372353535851937790883648493n,Vk=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Kk=0x6666666666666666666666666666666666666666666666666666666666666658n,Gk={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:qk,n:Wk,h:8,Gx:Vk,Gy:Kk},Hk=(e="")=>{throw new Error(e)},Zk=e=>"string"==typeof e,Jk=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name)(e)||"number"==typeof t&&t>0&&e.length!==t?Hk("Uint8Array of valid length expected"):e,Yk=e=>new Uint8Array(e),Qk=(e,t)=>Jk(Zk(e)?aT(e):Yk(Jk(e)),t),Xk=(e,t=qk)=>{let n=e%t;return n>=0n?n:t+n},eT=e=>e instanceof tT?e:Hk("Point expected");class tT{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new tT(e.x,e.y,1n,Xk(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=Gk,r=(e=Qk(e,32)).slice(),o=e[31];r[31]=-129&o;const i=cT(r);!t||0n<=i&&i<2n**256n||Hk("bad y coord 1"),t||0n<=i&&i<qk||Hk("bad y coord 2");const a=Xk(i*i),s=Xk(a-1n),c=Xk(n*a+1n);let{isValid:u,value:l}=hT(s,c);u||Hk("bad y coordinate 3");const d=1n===(1n&l),f=0!=(128&o);return!t&&0n===l&&f&&Hk("bad y coord 3"),f!==d&&(l=Xk(-l)),new tT(l,i,1n,Xk(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}=eT(e),s=Xk(t*a),c=Xk(o*r),u=Xk(n*a),l=Xk(i*r);return s===c&&u===l}is0(){return this.equals(rT)}negate(){return new tT(Xk(-this.ex),this.ey,this.ez,Xk(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=Gk,o=Xk(e*e),i=Xk(t*t),a=Xk(2n*Xk(n*n)),s=Xk(r*o),c=e+t,u=Xk(Xk(c*c)-o-i),l=s+i,d=l-a,f=s-i,h=Xk(u*d),p=Xk(l*f),g=Xk(u*f),m=Xk(d*l);return new tT(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:o}=this,{ex:i,ey:a,ez:s,et:c}=eT(e),{a:u,d:l}=Gk,d=Xk(t*i),f=Xk(n*a),h=Xk(o*l*c),p=Xk(r*s),g=Xk((t+n)*(i+a)-d-f),m=Xk(p-h),y=Xk(p+h),v=Xk(f-u*d),w=Xk(g*m),A=Xk(y*v),b=Xk(g*v),S=Xk(m*y);return new tT(w,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?Hk("cannot multiply by 0"):rT;if("bigint"==typeof e&&0n<e&&e<Wk||Hk("invalid scalar, must be < L"),!t&&this.is0()||1n===e)return this;if(this.equals(nT))return NT(e).p;let n=rT,r=nT;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(Gk.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(Wk/2n,!1).double();return Wk%2n&&(e=e.add(this)),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(rT))return{x:0n,y:1n};const r=lT(n);return 1n!==Xk(n*r)&&Hk("invalid inverse"),{x:Xk(e*r),y:Xk(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=sT(t);return n[31]|=1n&e?128:0,n}toHex(){return iT(this.toRawBytes())}}tT.BASE=new tT(Vk,Kk,1n,Xk(Vk*Kk)),tT.ZERO=new tT(0n,1n,1n,0n);const{BASE:nT,ZERO:rT}=tT,oT=(e,t)=>e.toString(16).padStart(t,"0"),iT=e=>Array.from(e).map((e=>oT(e,2))).join(""),aT=e=>{const t=e.length;(!Zk(e)||t%2)&&Hk("hex invalid 1");const n=Yk(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)&&Hk("hex invalid 2"),n[t]=i}return n},sT=e=>aT(oT(e,64)).reverse(),cT=e=>BigInt("0x"+iT(Yk(Jk(e)).reverse())),uT=(...e)=>{const t=Yk(e.reduce(((e,t)=>e+Jk(t).length),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.length})),t},lT=(e,t=qk)=>{(0n===e||t<=0n)&&Hk("no inverse n="+e+" mod="+t);let n=Xk(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?Xk(o,t):Hk("no inverse")},dT=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=qk;return n},fT=19681161376707505956807079304988542015446066515923890162744021073123829784752n,hT=(e,t)=>{const n=Xk(t*t*t),r=(e=>{const t=e*e%qk*e%qk,n=dT(t,2n)*t%qk,r=dT(n,1n)*e%qk,o=dT(r,5n)*r%qk,i=dT(o,10n)*o%qk,a=dT(i,20n)*i%qk,s=dT(a,40n)*a%qk,c=dT(s,80n)*s%qk,u=dT(c,80n)*s%qk,l=dT(u,10n)*o%qk;return{pow_p_5_8:dT(l,2n)*e%qk,b2:t}})(e*Xk(n*n*t)).pow_p_5_8;let o=Xk(e*n*r);const i=Xk(t*o*o),a=o,s=Xk(o*fT),c=i===e,u=i===Xk(-e),l=i===Xk(-e*fT);return c&&(o=a),(u||l)&&(o=s),1n===(1n&Xk(o))&&(o=Xk(-o)),{isValid:c||u,value:o}},pT=e=>Xk(cT(e),Wk);let gT;const mT=(...e)=>CT.sha512Async(...e),yT=(...e)=>"function"==typeof gT?gT(...e):Hk("etc.sha512Sync not set"),vT=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=pT(t),o=nT.mul(r),i=o.toRawBytes();return{head:t,prefix:n,scalar:r,point:o,pointBytes:i}},wT=e=>mT(Qk(e,32)).then(vT),AT=e=>vT(yT(Qk(e,32))),bT=e=>wT(e).then((e=>e.pointBytes));function ST(e,t){return e?mT(t.hashable).then(t.finish):t.finish(yT(t.hashable))}const ET=(e,t,n)=>{const{pointBytes:r,scalar:o}=e,i=pT(t),a=nT.mul(i).toRawBytes();return{hashable:uT(a,r,n),finish:e=>{const t=Xk(i+pT(e)*o,Wk);return Jk(uT(a,sT(t)),64)}}},kT=async(e,t)=>{const n=Qk(e),r=await wT(t),o=await mT(r.prefix,n);return ST(!0,ET(r,o,n))},TT={zip215:!0},IT=(e,t,n,r=TT)=>{t=Qk(t),e=Qk(e,64);const{zip215:o}=r;let i,a,s,c,u=new Uint8Array;try{i=tT.fromHex(n,o),a=tT.fromHex(e.slice(0,32),o),s=cT(e.slice(32,64)),c=nT.mul(s,!1),u=uT(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=pT(e);return a.add(i.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},xT=async(e,t,n,r=TT)=>ST(!0,IT(e,t,n,r)),_T=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,CT={bytesToHex:iT,hexToBytes:aT,concatBytes:uT,mod:Xk,invert:lT,randomBytes:(e=32)=>{const t=_T();return t&&t.getRandomValues||Hk("crypto.getRandomValues must be defined"),t.getRandomValues(Yk(e))},sha512Async:async(...e)=>{const t=_T();t&&t.subtle||Hk("crypto.subtle or etc.sha512Async must be defined");const n=uT(...e);return Yk(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(CT,{sha512Sync:{configurable:!1,get:()=>gT,set(e){gT||(gT=e)}}});const RT={getExtendedPublicKeyAsync:wT,getExtendedPublicKey:AT,randomPrivateKey:()=>CT.randomBytes(32),precompute:(e=8,t=nT)=>(t.multiply(3n),t)};let PT;const NT=e=>{const t=PT||(PT=(()=>{const e=[];let t=nT,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=rT,o=nT;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 BT(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var OT=n(1048).hp;const MT="8d9df0f7-1363-4d2c-8152-ce4ed78f27d8",zT=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function UT(e){return OT.from(e).toString("base64").replace(/\+/gu,"-").replace(/\//gu,"_").replace(/[=]/gu,"")}function jT(e){const t=e.replace(/-/gu,"+").replace(/_/gu,"/");return new Uint8Array(OT.from(t,"base64"))}function LT(e){return"Ed25519"===e||"object"==typeof e&&"Ed25519"===e.name}function DT(){const{subtle:e}=globalThis.crypto;Object.defineProperty(globalThis,"isSecureContext",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,"generateKey",{value:async(...e)=>LT(e[0])?await async function(e,t,n){const r=RT.randomPrivateKey(),o=await bT(r),i=Array.from(n);return{privateKey:{algorithm:{name:"Ed25519"},extractable:t,type:"private",usages:i,[MT]:r},publicKey:{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i,[MT]:o}}}(...e):await globalThis.crypto.subtle.generateKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"exportKey",{value:async(...e)=>LT(e[1].algorithm)?await async function(e,t){if(!t.extractable)throw new DOMException("key is not extractable","InvalidAccessException");const n=t[MT];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([...zT,...n]).buffer;case"jwk":{const e={crv:"Ed25519",ext:t.extractable,key_ops:t.usages,kty:"OKP"};if("private"===t.type){const t=await bT(n);return Object.freeze({...e,d:UT(n),x:UT(t)})}return Object.freeze({...e,x:UT(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 LT(t)&<(n.algorithm)?await async function(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=BT(n),o=t[MT],i=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(await kT(r,o));return i}(...e):await globalThis.crypto.subtle.sign(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"verify",{value:async(...e)=>{const[t,n]=e;return LT(t)&<(n.algorithm)?await async function(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=BT(n),i=BT(r),a=t[MT];return await xT(o,i,a)}(...e):await globalThis.crypto.subtle.verify(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"importKey",{value:async(...e)=>LT(e[2])?await async function(e,t,n,r,o){const i=Array.from(o);switch(e){case"raw":{const e=BT(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)),[MT]:e}}case"pkcs8":{const e=BT(t);if(48!==e.length)throw new DOMException("Invalid PKCS8 key data length","DataError");if(!e.slice(0,16).every(((e,t)=>e===zT[t])))throw new DOMException("Invalid PKCS8 header","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"private",usages:i.filter((e=>"sign"===e)),[MT]: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)),[MT]:jT(o)}}case"spki":{const e=BT(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)),[MT]:e.slice(r)}}default:throw new Error(`Unsupported import format: ${e}`)}}(...e):await globalThis.crypto.subtle.importKey(...e),writable:!0,configurable:!0})}const FT=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,"DOMException",{value:Error,writable:!0,configurable:!0,enumerable:!0}),DT(),Object.defineProperty(globalThis,"queueMicrotask",{value:FT,writable:!0,configurable:!0,enumerable:!0}),xo.config({EXPONENTIAL_AT:16});const $T=async({origin:e,request:t})=>{ed.log("[🔄 onRpcRequest]",t.method,t);const{method:n}=t;Cv(e,n);const r=Nk[n];if(!r)throw new Jr(`RpcRequest method ${n} not found. Available methods: ${Object.values(mv).toString()}`);return await Bk((async()=>r({origin:e,request:t})))??null},qT=async({origin:e,request:t})=>{ed.log("[🔑 onKeyringRequest]",t.method,t),Cv(e,t.method),t.method===Ht.SubmitRequest&&t.params&&!("origin"in t.params)&&(t.params.origin="https://metamask.io");return await Bk((async()=>yn(DE,t)))??null},WT=async({id:e,event:t,context:n})=>{if(ed.log("[👇 onUserInput]",e,t),!t.name)return;const r={...Fk,...$k,...yA,...pA,...dA}[t.name];r&&await Bk((async()=>r({id:e,event:t,context:n,snapContext:WE})))},VT=async({request:e})=>{const t=Xl(ed,"[⏱️ onCronjob]");t.log(e.method,e);const{method:n}=e;M(n,H([...Object.values(Ck),...Object.values(Nv)]));return await Bk((async()=>{t.log("Running cronjob",{method:n});const r=_k[n];if(!r)throw new Jr(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${Object.values([...Object.values(Ck),...Object.values(Nv)]).toString()}`);return r({request:e})}))??null},KT=async e=>{const t=await Bk((async()=>(async e=>{ed.log("[🔍 onAssetsLookup]",e);const{assets:t}=e,n=t.filter((e=>{const{assetNamespace:t}=Fo(e);return"token"===t||"slip44"===t}));return{assets:await _E.getAssetsMetadata(n)}})(e)));return t??null},GT=async e=>{const t=await Bk((async()=>(async e=>{ed.log("[💱 onAssetsConversion]",e);const{conversions:t}=e;return{conversionRates:await TE.getMultipleTokenConversions(t)}})(e)));return t??null},HT=async e=>{const{origin:t,request:n}=e;Cv(t,n.method);const r=await Bk((async()=>(async({scope:e,request:t})=>{switch(M(e,Sd),t.method){case dv.GetGenesisHash:return M(t,fv),hE.getRpc(e).getGenesisHash().send();case dv.GetLatestBlockhash:return M(t,hv),(await hE.getLatestBlockhash(e)).blockhash;case dv.GetMinimumBalanceForRentExemption:return M(t,pv),(await hE.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)));return r??null},ZT=async e=>{const t=await Bk((async()=>(async e=>{ed.log("[📈 onAssetHistoricalPrice]",e);const{from:t,to:n}=e;return M(t,Lo),M(n,Lo),{historicalPrice:await TE.getHistoricalPrice(t,n)}})(e)));return t??null},JT=async({request:e})=>await Bk((async()=>qE.handle(e)))??null,YT=async({event:e})=>Bk((async()=>{await cE.emitSync("onWebSocketEvent",e)})),QT=async()=>Bk((async()=>{await cE.emitSync("onStart")})),XT=async()=>Bk((async()=>{await cE.emitSync("onUpdate")})),eI=async()=>Bk((async()=>{await cE.emitSync("onInstall")})),tI=async()=>Bk((async()=>{await cE.emitSync("onActive")})),nI=async()=>Bk((async()=>{await cE.emitSync("onInactive")})),rI=async e=>{const t=await Bk((async()=>(async e=>{M(e,Rk);const{chainId:t,domain:n,address:r}=e,o=new RegExp(`^.+\\${IE.tld}$`,"u");if(n&&o.test(n)){const e=await IE.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:Pk,domainName:n}]}}if(r){const e=await IE.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:Pk}]}}return null})(e)));return t??null},oI=async e=>{const t=await Bk((async()=>(async e=>{ed.log("[💰 onAssetsMarketData]",e);const{assets:t}=e;return{marketData:await _E.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 v=c(e),w=c(t),A=v?f:s(e),b=w?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;v=!0,S=!1}if(k&&!S)return y||(y=new r),v||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 v(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:w(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):w(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function w(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 v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(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 O(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 M(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(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 O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(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 O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return M(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){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function q(e,t){if("number"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw q(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]],v=t[f];if(i)var w=c?i(v,y,f,t,e,s):i(y,v,f,e,t,s);if(!(void 0===w?y===v||a(y,v,n,i,s):w)){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==-Infinity?"-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 v(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function w(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function A(){var e=o();if(w(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?v(e):(c=u=void 0,d)}function S(){var e=o(),n=w(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(A,t),g?v(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(A,t),v(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,v,w){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<w){var N=l(_,R);return s(t,n,e,I.placeholder,f,_,N,y,v,w-x)}var B=b?f:this,O=S?B[t]:t;return x=_.length,y?_=u(_,y):k&&x>1&&_.reverse(),A&&v<x&&(_.length=v),this&&this!==d&&this instanceof I&&(O=T||a(O)),O.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:!("cap"in l)||l.cap,curry:!("curry"in l)||l.curry,fixed:!("fixed"in l)||l.fixed,immutable:!("immutable"in l)||l.immutable,rearg:!("rearg"in l)||l.rearg},p=d?u:o,g="curry"in l&&l.curry,m="fixed"in l&&l.fixed,y="rearg"in l&&l.rearg,v=d?u.runInContext():void 0,w=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},A=w.ary,b=w.assign,S=w.clone,E=w.curry,k=w.forEach,T=w.isArray,I=w.isError,x=w.isFunction,_=w.isWeakMap,C=w.keys,R=w.rearg,P=w.toInteger,N=w.toPath,B=C(r.aryMethod),O={castArray:function(e){return function(){var t=arguments[0];return T(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.cap&&"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(!x(n))return e(n,Object(t));var r=[];return k(C(t),(function(e){x(t[e])&&r.push([e,n.prototype[e]])})),e(n,Object(t)),k(r,(function(e){var t=e[1];x(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]})),n}},nthArg:function(e){return function(t){var n=t<0?1:P(t)+1;return E(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return E(e(t,n),r)}},runInContext:function(n){return function(r){return e(t,n(r),l)}}};function M(e,t){if(h.cap){var n=r.iterateeRearg[e];if(n)return function(e,t){return D(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)}}(R(a(e,n),t),n)}))}(t,n);var o=!d&&r.iterateeAry[e];if(o)return function(e,t){return D(e,(function(e){return"function"==typeof e?a(e,t):e}))}(t,o)}return t}function z(e,t,n){if(h.fixed&&(m||!r.skipFixed[e])){var o=r.methodSpread[e],a=o&&o.start;return void 0===a?A(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 U(e,t,n){return h.rearg&&n>1&&(y||!r.skipRearg[e])?R(t,r.methodRearg[e]||r.aryRearg[n]):t}function j(e,t){for(var n=-1,r=(t=N(t)).length,o=r-1,i=S(Object(e)),a=i;null!=a&&++n<r;){var s=t[n],c=a[s];null==c||x(c)||I(c)||_(c)||(a[s]=S(n==o?c:Object(c))),a=a[s]}return i}function L(t,n){var o=r.aliasToReal[t]||t,i=r.remap[o]||o,a=l;return function(t){var r=d?v:w,s=d?v[i]:n,c=b(b({},a),t);return e(r,o,s,c)}}function D(e,t){return function(){var n=arguments.length;if(!n)return e();for(var r=Array(n);n--;)r[n]=arguments[n];var o=h.rearg?0:n-1;return r[o]=t(r[o]),e.apply(void 0,r)}}function F(e,t,n){var o,i=r.aliasToReal[e]||e,a=t,u=O[i];return u?a=u(t):h.immutable&&(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,j))),k(B,(function(e){return k(r.aryMethod[e],(function(t){if(i==t){var n=r.methodSpread[i],s=n&&n.afterRearg;return o=s?z(i,U(i,a,e),e):U(i,z(i,a,e),e),o=function(e,t,n){return g||h.curry&&n>1?E(t,n):t}(0,o=M(i,o),e),!1}})),!o})),o||(o=a),o==t&&(o=g?E(o,1):function(){return t.apply(this,arguments)}),o.convert=L(i,t),o.placeholder=t.placeholder=n,o}if(!f)return F(n,u,p);var $=u,q=[];return k(B,(function(e){k(r.aryMethod[e],(function(e){var t=$[r.remap[e]||e];t&&q.push([e,F(e,t,$)])}))})),k(C($),(function(e){var t=$[e];if("function"==typeof t){for(var n=q.length;n--;)if(q[n][0]==e)return;t.convert=L(e,t),q.push([e,t])}})),k(q,(function(e){$[e[0]]=e[1]})),$.convert=function(e){return $.runInContext.convert(e)(void 0)},$.placeholder=$,k(C($),(function(e){k(r.realToAlias[e]||[],(function(t){$[t]=$[e]}))})),$}},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],v=t[p];if(a)var w=u?a(v,y,p,t,e,c):a(y,v,p,e,t,c);if(void 0!==w){if(w)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!==v&&!s(y,v,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]],v="[object Arguments]",w="[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]",O="[object ArrayBuffer]",M="[object DataView]",z="[object Float32Array]",U="[object Float64Array]",j="[object Int8Array]",L="[object Int16Array]",D="[object Int32Array]",F="[object Uint8Array]",$="[object Uint8ClampedArray]",q="[object Uint16Array]",W="[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,ve=/^\[object .+?Constructor\]$/,we=/^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+"]",Oe="["+Te+"]",Me="\\d+",ze="["+Ie+"]",Ue="["+xe+"]",je="[^"+ke+Re+Me+Ie+xe+_e+"]",Le="\\ud83c[\\udffb-\\udfff]",De="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+_e+"]",We="\\u200d",Ve="(?:"+Ue+"|"+je+")",Ke="(?:"+qe+"|"+je+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",He="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Oe+"|"+Le+")"+"?",Je="["+Ce+"]?",Ye=Je+Ze+("(?:"+We+"(?:"+[De,Fe,$e].join("|")+")"+Je+Ze+")*"),Qe="(?:"+[ze,Fe,$e].join("|")+")"+Ye,Xe="(?:"+[De+Oe+"?",Oe,Fe,$e,Ne].join("|")+")",et=RegExp(Pe,"g"),tt=RegExp(Oe,"g"),nt=RegExp(Le+"(?="+Le+")|"+Xe+Ye,"g"),rt=RegExp([qe+"?"+Ue+"+"+Ge+"(?="+[Be,qe,"$"].join("|")+")",Ke+"+"+He+"(?="+[Be,qe+Ve,"$"].join("|")+")",qe+"?"+Ve+"+"+Ge,qe+"+"+He,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Me,Qe].join("|"),"g"),ot=RegExp("["+We+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[q]=ct[W]=!0,ct[v]=ct[w]=ct[O]=ct[A]=ct[M]=ct[b]=ct[S]=ct[E]=ct[T]=ct[I]=ct[x]=ct[C]=ct[R]=ct[P]=ct[B]=!1;var ut={};ut[v]=ut[w]=ut[O]=ut[M]=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[q]=ut[W]=!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,vt=yt&&yt.exports===mt,wt=vt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||wt&&wt.binding&&wt.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)&&qt(e,t,0)>-1}function Ot(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 Mt(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 qt(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 Wt(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 Mt(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&&qt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&qt(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({"&":"&","<":"<",">":">",'"':""","'":"'"});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({"&":"&","<":"<",">":">",""":'"',"'":"'"});var vn=function e(t){var n,r=(t=null==t?gt:vn.defaults(gt.Object(),t,vn.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,Oe=t["__core-js_shared__"],Me=Ne.toString,ze=Be.hasOwnProperty,Ue=0,je=(n=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Le=Be.toString,De=Me.call(xe),Fe=gt._,$e=_e("^"+Me.call(ze).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=vt?t.Buffer:o,We=t.Symbol,Ve=t.Uint8Array,Ke=qe?qe.allocUnsafe:o,Ge=ln(xe.getPrototypeOf,xe),He=xe.create,Ze=Be.propertyIsEnumerable,Je=Pe.splice,Ye=We?We.isConcatSpreadable:o,Qe=We?We.iterator:o,Xe=We?We.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,wt=qe?qe.isBuffer:o,At=t.isFinite,Dt=Pe.join,Ht=ln(xe.keys,xe),wn=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),On=Li(In),Mn=Li(xn),zn=Li(_n),Un=Li(Cn),jn=We?We.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 Wn)return e;if(ze.call(e,"__wrapped__"))return Di(e)}return new Wn(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 qn(){}function Wn(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&&Wa(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==v||h&&!i){if(s=u||h?{}:vi(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 O:return Io(e);case A:case b:return new r(+e);case M: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 q:case W: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=Mt(t,Xt(n))),r?(i=Ot,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=qn.prototype,Fn.prototype.constructor=Fn,Wn.prototype=$n(qn.prototype),Wn.prototype.constructor=Wn,Vn.prototype=$n(qn.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=Mo(br),pr=Mo(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 vr(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=wi),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?vr(s,t-1,n,r,o):zt(o,s):r||(o[o.length]=s)}return o}var wr=zo(),Ar=zo(!0);function br(e,t){return e&&wr(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?Ot: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=Mt(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)==v}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?w:mi(e),l=c?w:mi(t),d=(u=u==v?x:u)==x,f=(l=l==v?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 M:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case O: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 v=e[h=c[f]],w=t[h];if(r)var A=s?r(w,v,h,t,e,a):r(v,w,h,e,t,a);if(!(A===o?v===w||i(v,w,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 Or(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 Mr(e){return!(!ts(e)||(t=e,je&&je in t))&&(Qa(e)?$e:ve).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||Or(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 qr(e,t,n,r,i){e!==t&&wr(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)||Wa(u)?(d=c,Wa(c)?d=vs(c):ts(c)&&!Qa(c)||(d=vi(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,qr,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 Wr(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?Mt(t,(function(e){return Va(e)?function(t){return kr(t,1===e.length?e[0]:e)}:e})):[oc];var r=-1;t=Mt(t,Xt(li()));var o=Dr(e,(function(e,n,o){var i=Mt(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?Wt:qt,i=-1,a=t.length,s=e;for(e===t&&(t=Po(t)),n&&(s=Mt(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 Mt(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=Ot;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(vr(a,1),t,n)}function vo(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 wo(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(ws(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=wn(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=wn(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 Oo(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 Mo(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=ws(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(Ws(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=Wn.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 Wn([],!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,v=g?o:Lo(e);return function d(){for(var w=arguments.length,A=r(w),b=w;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)),w-=E,m&&w<f){var k=dn(A,S);return Zo(e,t,$o,d.placeholder,n,A,k,u,l,f-w)}var T=p?n:this,I=g?T[e]:e;return w=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&&w>1&&A.reverse(),h&&l<w&&(A.length=l),this&&this!==gt&&this instanceof d&&(I=v||Lo(I)),I.apply(T,A)}}function qo(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 Wo(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=Mt(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=wn(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,Oi(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=(ws(e)+"e").split("e");return+((r=(ws(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 Mt(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 v=a?a.length:0;if(v||(t&=-97,a=h=o),g=g===o?g:wn(gs(g),0),m=m===o?m:gs(m),v-=h?h.length:0,t&l){var w=a,A=h;a=h=o}var b=y?o:si(e),S=[e,t,n,a,h,w,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:wn(S[9]-v,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 Oi((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),qr(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 Mr(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)||Wa(e))}function vi(e){return"function"!=typeof e.constructor||Ti(e)?{}:$n(Ge(e))}function wi(e){return Va(e)||Wa(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)))!=M||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 M;case On:return T;case Mn:return _;case zn:return R;case Un:return B}return t});var ki=Oe?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=wn(t===o?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=wn(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=Mi(to),Ni=ht||function(e,t){return gt.setTimeout(e,t)},Bi=Mi(no);function Oi(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 Mi(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=Ma(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 Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Di(e){if(e instanceof Vn)return e.clone();var t=new Wn(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,vr(t,1,Ha,!0)):[]})),$i=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),li(n,2)):[]})),qi=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),o,n):[]}));function Wi(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=wn(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?wn(r+i,0):An(i,r-1)),$t(e,li(t,3),i,!0)}function Ki(e){return(null==e?0:e.length)?vr(e,1):[]}function Gi(e){return e&&e.length?e[0]:o}var Hi=Yr((function(e){var t=Mt(e,wo);return t.length&&t[0]===e[0]?Rr(t):[]})),Zi=Yr((function(e){var t=Yi(e),n=Mt(e,wo);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=Mt(e,wo);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,Mt(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(vr(e,1,Ha,!0))})),ra=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),fo(vr(e,1,Ha,!0),li(t,2))})),oa=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,fo(vr(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=wn(e.length,t),!0})),Yt(t,(function(t){return Mt(e,Gt(t))}))}function aa(e,t){if(!e||!e.length)return[];var n=ia(e);return null==t?n:Mt(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 Wn(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(Wi),va=Do(Vi);function wa(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)?Mt: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,vr(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 v(e);u=Ni(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function v(e){return u=o,p&&r?g(e):(r=a=o,c)}function w(){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)?wn(ys(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),w.cancel=function(){u!==o&&ko(u),d=0,r=l=a=u=o},w.flush=function(){return u===o?c:v(xa())},w}var Ba=Yr((function(e,t){return dr(e,1,t)})),Oa=Yr((function(e,t,n){return dr(e,ys(t)||0,n)}));function Ma(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(Ma.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)}}Ma.Cache=Hn;var Ua=So((function(e,t){var n=(t=1==t.length&&Va(t[0])?Mt(t[0],Xt(li())):Mt(vr(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),qa=Ho((function(e,t){return e>=t})),Wa=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)==O};function Ga(e){return null!=e&&es(e.length)&&!Qa(e)}function Ha(e){return ns(e)&&Ga(e)}var Za=wt||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&&Me.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||we.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function vs(e){return No(e,Bs(e))}function ws(e){return null==e?"":lo(e)}var As=Oo((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=Oo((function(e,t){No(t,Bs(t),e)})),Ss=Oo((function(e,t,n,r){No(t,Bs(t),e,r)})),Es=Oo((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(Ms,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=qo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Le.call(t)),e[t]=n}),tc(oc)),Rs=qo((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 Os=Oo((function(e,t,n){qr(e,t,n)})),Ms=Oo((function(e,t,n,r){qr(e,t,n,r)})),zs=oi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Mt(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=Mt(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?qs(t):t)}));function qs(e){return Ys(ws(e).toLowerCase())}function Ws(e){return(e=ws(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=ws(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(Mt),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 vc=Wo((function(e,t){return e+t}),0),wc=Jo("ceil"),Ac=Wo((function(e,t){return e/t}),1),bc=Jo("floor");var Sc,Ec=Wo((function(e,t){return e*t}),1),kc=Jo("round"),Tc=Wo((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:wn(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],vr(t,1))},Fn.cond=function(e){var t=null==e?0:e.length,n=li();return e=t?Mt(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=Oa,Fn.difference=Fi,Fn.differenceBy=$i,Fn.differenceWith=qi,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 vr(ka(e,t),1)},Fn.flatMapDeep=function(e,t){return vr(ka(e,t),h)},Fn.flatMapDepth=function(e,t,n){return n=n===o?1:gs(n),vr(ka(e,t),n)},Fn.flatten=Ki,Fn.flattenDeep=function(e){return(null==e?0:e.length)?vr(e,h):[]},Fn.flattenDepth=function(e,t){return(null==e?0:e.length)?vr(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=Ma,Fn.merge=Os,Fn.mergeWith=Ms,Fn.method=ac,Fn.methodOf=sc,Fn.mixin=cc,Fn.negate=za,Fn.nthArg=function(e){return e=gs(e),Yr((function(t){return Wr(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=ws(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:wn(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)?Mt(e,ji):us(e)?[e]:Po(Ui(ws(e)))},Fn.toPlainObject=vs,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 vo(e||[],t||[],nr)},Fn.zipObjectDeep=function(e,t){return vo(e||[],t||[],eo)},Fn.zipWith=fa,Fn.entries=Ls,Fn.entriesIn=Ds,Fn.extend=bs,Fn.extendWith=Ss,cc(Fn,Fn),Fn.add=vc,Fn.attempt=Xs,Fn.camelCase=$s,Fn.capitalize=qs,Fn.ceil=wc,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=Ws,Fn.defaultTo=function(e,t){return null==e||e!=e?t:e},Fn.divide=Ac,Fn.endsWith=function(e,t,n){e=ws(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=ws(e))&&Y.test(e)?e.replace(Z,an):e},Fn.escapeRegExp=function(e){return(e=ws(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=Wi,Fn.findKey=function(e,t){return Ft(e,li(t,3),br)},Fn.findLast=va,Fn.findLastIndex=Vi,Fn.findLastKey=function(e,t){return Ft(e,li(t,3),Sr)},Fn.floor=bc,Fn.forEach=wa,Fn.forEachRight=Aa,Fn.forIn=function(e,t){return null==e?e:wr(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=qa,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=wn(o+n,0)),cs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&qt(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=wn(r+o,0)),qt(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<wn(t,n)}(e=ys(e),t,n)},Fn.invoke=Ps,Fn.isArguments=Wa,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)||Wa(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||Or(e,t,fi(t))},Fn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,Or(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 Mr(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?wn(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?Wr(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=ws(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=ws(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=ws(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(ws(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(ws(e),t)},Fn.replace=function(){var e=arguments,t=ws(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=ws(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=ws(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 ws(e).toLowerCase()},Fn.toNumber=ys,Fn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},Fn.toString=ws,Fn.toUpper=function(e){return ws(e).toUpperCase()},Fn.trim=function(e,t,n){if((e=ws(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=ws(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=ws(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=ws(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,ws(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=ws(e))&&J.test(e)?e.replace(H,yn):e},Fn.uniqueId=function(e){var t=++Ue;return ws(e)+t},Fn.upperCase=Js,Fn.upperFirst=Ys,Fn.each=wa,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:wn(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 Wn(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=wn(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],v=y.iteratee,w=y.type,A=v(m);if(2==w)m=A;else if(!A){if(1==w)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 Wn(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 qn;){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 Wn(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._=vn,(r=function(){return vn}.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==-Infinity?"-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),v=u(a),w=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 v:return f;case w: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,v){var w=2&t;if(!w&&"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),v=void 0===v?v:f(v),A-=g?g.length:0,64&t){var b=p,S=g;p=g=void 0}var E=w?void 0:c(e),k=[e,t,n,p,g,b,S,m,y,v];if(E&&u(k,E),e=k[0],t=k[1],n=k[2],p=k[3],g=k[4],!(v=k[9]=void 0===k[9]?w?0:e.length:h(k[9]-A,0))&&24&t&&(t&=-25),t&&1!=t)T=8==t||16==t?i(e,t,v):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),v=n(3142),w=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,O=1&n,M=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=v(t);if(U){if(B=g(t),!O)return u(t,B)}else{var j=p(t),L=j==I||"[object GeneratorFunction]"==j;if(w(t))return c(t,O);if(j==x||j==T||L&&!P){if(B=M||L?{}:y(t),!O)return M?d(t,s(B,t)):l(t,a(B,t))}else{if(!_[j])return P?t:{};B=m(t,j,O)}}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?M?h:f:M?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:()=>nI,onAssetHistoricalPrice:()=>JT,onAssetsConversion:()=>HT,onAssetsLookup:()=>GT,onAssetsMarketData:()=>iI,onClientRequest:()=>YT,onCronjob:()=>KT,onInactive:()=>rI,onInstall:()=>tI,onKeyringRequest:()=>WT,onNameLookup:()=>oI,onProtocolRequest:()=>ZT,onRpcRequest:()=>qT,onStart:()=>XT,onUpdate:()=>eI,onUserInput:()=>VT,onWebSocketEvent:()=>QT});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&-(t>>0&1)^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!=0)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=w(n)+v(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),v=(e,t,n)=>e&t|n&(e|t),w=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){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function P(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: \`${R(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*N(e,t,n,r){(function(e){return C(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=P(o,t,n,r);e&&(yield e)}}function*B(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=B(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)=>N(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>N(o(e,t),t,this,e):()=>[]}assert(e,t){return M(e,this,t)}create(e,t){return z(e,this,t)}is(e){return U(e,this)}mask(e,t){return function(e,t,n){const r=j(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return j(e,this,t)}}function M(e,t,n){const r=j(e,t,{message:n});if(r[0])throw r[0]}function z(e,t,n){const r=j(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function U(e,t){return!j(e,t)[0]}function j(e,t,n={}){const r=B(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 L(e,t){return new O({type:e,schema:null,validator:t})}function D(e,t){return L(e,(e=>"string"==typeof e&&t.test(e)))}const F=D("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),$=F,q=L("Url",(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})),W=D("StringNumber",/^\d+(\.\d+)?$/u);function V(){return L("any",(()=>!0))}function K(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: ${R(e)}`})}function G(){return L("boolean",(e=>"boolean"==typeof e))}function H(e){const t={},n=e.map((e=>R(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: ${R(t)}`})}function Z(){return L("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${R(e)}`))}function J(e){const t=R(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: ${R(n)}`})}function Y(){return L("never",(()=>!1))}function Q(e){return new O({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function X(){return L("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${R(e)}`))}function ee(e){const t=e?Object.keys(e):[],n=Y();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),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: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function te(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 ne(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: ${R(e)}`})}function re(){return L("string",(e=>"string"==typeof e||`Expected a string, but received: ${R(e)}`))}function oe(e){const t=Y();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: ${R(e)}`})}function ie(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: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function ae(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]=B(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: ${R(n)}`,...o]}})}function se(){return L("unknown",(()=>!0))}function ce(e){return ee(e)}function ue(e){return e.path[e.path.length-1]in e.branch[e.branch.length-2]}function le(e){return new O({...e,validator:(t,n)=>!ue(n)||e.validator(t,n),refiner:(t,n)=>!ue(n)||e.refiner(t,n)})}function de(e,t,n){return new O({...e,coercer:(r,o)=>U(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function fe(e){return e instanceof Map||e instanceof Set?e.size:e.length}function he(e,t,n={}){const{exclusive:r}=n;return me(e,"min",(n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))}function pe(e){return me(e,"nonempty",(t=>fe(t)>0||`Expected a nonempty ${e.type} but received an empty one`))}function ge(e,t){return me(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function me(e,t,n){return new O({...e,*refiner(r,o){yield*e.refiner(r,o);const i=N(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const ye=(e,t)=>Object.hasOwnProperty.call(e,t);var ve;!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"}(ve=ve||(ve={}));const we=e=>ee(e);function Ae({path:e,branch:t}){const n=e[e.length-1];return ye(t[t.length-2],n)}function be(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Ae(n)||e.validator(t,n),refiner:(t,n)=>!Ae(n)||e.refiner(t,n)})}function Se(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(!Se(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]||!Se(n[e][1])){t=!1;break}return t}return!1}const Ee=L("JSON",(e=>Se(e))),ke=de(Ee,me(V(),"JSON",(e=>U(e,Ee))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Te=J("2.0"),Ie=Q(ae([X(),re()])),xe=we({code:Z(),message:re(),data:be(ke),stack:be(re())}),_e=ae([ne(re(),ke),K(ke)]);we({id:Ie,jsonrpc:Te,method:re(),params:be(_e)}),we({jsonrpc:Te,method:re(),params:be(_e)});ee({id:Ie,jsonrpc:Te,result:te(se()),error:te(xe)});const Ce=we({id:Ie,jsonrpc:Te,result:ke}),Re=we({id:Ie,jsonrpc:Te,error:xe});ae([Ce,Re]);const Pe=ce({jsonrpc:J("2.0"),id:ae([re(),X(),J(null)]),method:re(),params:le(ae([K(ke),ne(re(),ke)]))});const Ne=(e,t)=>Object.hasOwnProperty.call(e,t);var Be;!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"}(Be=Be||(Be={}));const Oe=e=>ee(e);function Me({path:e,branch:t}){const n=e[e.length-1];return Ne(t[t.length-2],n)}function ze(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Me(n)||e.validator(t,n),refiner:(t,n)=>!Me(n)||e.refiner(t,n)})}function Ue(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(!Ue(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]||!Ue(n[e][1])){t=!1;break}return t}return!1}const je=L("JSON",(e=>Ue(e))),Le=de(je,me(V(),"JSON",(e=>U(e,je))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const De=J("2.0"),Fe=Q(ae([X(),re()])),$e=Oe({code:Z(),message:re(),data:ze(Le),stack:ze(re())}),qe=ae([ne(re(),Le),K(Le)]);Oe({id:Fe,jsonrpc:De,method:re(),params:ze(qe)}),Oe({jsonrpc:De,method:re(),params:ze(qe)});ee({id:Fe,jsonrpc:De,result:te(se()),error:te($e)});const We=Oe({id:Fe,jsonrpc:De,result:Le}),Ve=Oe({id:Fe,jsonrpc:De,error:$e});ae([We,Ve]);function Ke(e,t){return L(e,(e=>"string"==typeof e&&t.test(e)))}const Ge=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,He=/^[-a-z0-9]{3,8}$/u,Ze=/^[-_a-zA-Z0-9]{1,32}$/u,Je=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Ye=/^[-.%a-zA-Z0-9]{1,128}$/u,Qe=/^[-a-z0-9]{3,8}$/u,Xe=/^[-.%a-zA-Z0-9]{1,128}$/u,et=/^[-.%a-zA-Z0-9]{1,78}$/u,tt=/^(?<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,nt=/^(?<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,rt=Ke("CaipChainId",Ge),ot=(Ke("CaipNamespace",He),Ke("CaipReference",Ze),Ke("CaipAccountId",Je)),it=(Ke("CaipAccountAddress",Ye),Ke("CaipAssetNamespace",Qe),Ke("CaipAssetReference",Xe),Ke("CaipTokenId",et),Ke("CaipAssetType",tt)),at=Ke("CaipAssetId",nt),st=Ke("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 ct,ut,lt,dt;!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(ct=ct||(ct={})),function(e){e.Eoa="eip155:eoa",e.Erc4337="eip155:erc4337"}(ut||(ut={})),function(e){e.P2pkh="bip122:p2pkh",e.P2sh="bip122:p2sh",e.P2wpkh="bip122:p2wpkh",e.P2tr="bip122:p2tr"}(lt||(lt={})),function(e){e.DataAccount="solana:data-account"}(dt||(dt={}));const ft=ce({id:$,type:H([`${ut.Eoa}`,`${ut.Erc4337}`,`${lt.P2pkh}`,`${lt.P2sh}`,`${lt.P2wpkh}`,`${lt.P2tr}`,`${dt.DataAccount}`]),address:re(),scopes:pe(K(rt)),options:ne(re(),Le),methods:K(re())}),ht=(ee({address:ot}),ce({unit:re(),amount:W})),pt=ce({fungible:J(!0),type:it,...ht.schema}),gt=ce({fungible:J(!1),id:at}),mt=(yt=e=>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}}(e)&&!e.fungible?gt:pt,new O({type:"union",schema:null,*entries(e,t){yield*yt(e).entries(e,t)},*refiner(e,t){yield*yt(e).refiner(e,t)},coercer:(e,t)=>yt(e).coercer(e,t),validator:(e,t)=>yt(e).validator(e,t)}));var yt;const vt=ce({amount:W,unit:re()}),wt=Ke("DerivationPath",/^m(?:\/\d+'?)+$/u);var At;!function(e){e.Bip44="bip44"}(At||(At={}));const bt=ee({type:J(`${At.Bip44}`),scopes:K(rt),derivationPath:wt}),St=(ne(re(),Le),ce({id:F,scope:re(),account:F,origin:re(),request:ce({method:re(),params:le(ae([K(Le),ne(re(),Le)]))})})),Et=(ae([ce({pending:J(!0),redirect:le(ce({message:le(re()),url:le(re())}))}),ce({pending:J(!1),result:Le})]),ce({address:re(),asset:Q(mt)}));var kt;!function(e){e.Base="base",e.Priority="priority"}(kt||(kt={}));const Tt=ce({type:H([`${kt.Base}`,`${kt.Priority}`]),asset:mt});var It,xt;!function(e){e.Submitted="submitted",e.Unconfirmed="unconfirmed",e.Confirmed="confirmed",e.Failed="failed"}(It||(It={})),function(e){e.Send="send",e.Receive="receive",e.Swap="swap",e.BridgeSend="bridge:send",e.BridgeReceive="bridge:receive",e.Unknown="unknown"}(xt||(xt={}));const _t=ce({status:H([`${It.Submitted}`,`${It.Unconfirmed}`,`${It.Confirmed}`,`${It.Failed}`]),timestamp:Q(X())}),Ct=ce({id:re(),chain:rt,account:F,status:H([`${It.Submitted}`,`${It.Unconfirmed}`,`${It.Confirmed}`,`${It.Failed}`]),timestamp:Q(X()),type:H([`${xt.Send}`,`${xt.Receive}`,`${xt.Swap}`,`${xt.BridgeSend}`,`${xt.BridgeReceive}`,`${xt.Unknown}`]),from:K(Et),to:K(Et),fees:K(Tt),events:K(_t)}),Rt=(ce({data:K(Ct),next:Q(re())}),ce({limit:X(),next:le(Q(re()))})),Pt=ce({metamask:le(ce({correlationId:F}))});var Nt;!function(e){e.Mainnet="bip122:000000000019d6689c085ae165831e93",e.Testnet="bip122:000000000933ea01ad0ee984209779ba",e.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",e.Signet="bip122:00000008819873e925422c1ff0f99f7c",e.Regtest="bip122:regtest"}(Nt||(Nt={}));const Bt=(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}`)}},Ot=me(re(),"BtcP2pkhAddressStruct",(e=>Bt(e,k.p2pkh))),Mt=me(re(),"BtcP2shAddressStruct",(e=>Bt(e,k.p2sh))),zt=me(re(),"BtcP2wpkhAddressStruct",(e=>Bt(e,k.p2wpkh))),Ut=me(re(),"BtcP2trAddressStruct",(e=>Bt(e,k.p2tr)));var jt;!function(e){e.SendBitcoin="sendBitcoin"}(jt||(jt={}));const Lt=ce({...ft.schema,scopes:pe(K(rt)),methods:K(H([`${jt.SendBitcoin}`]))});ce({...Lt.schema,address:Ot,type:J(`${lt.P2pkh}`)}),ce({...Lt.schema,address:Mt,type:J(`${lt.P2sh}`)}),ce({...Lt.schema,address:zt,type:J(`${lt.P2wpkh}`)}),ce({...Lt.schema,address:Ut,type:J(`${lt.P2tr}`)});var Dt;!function(e){e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Dt||(Dt={}));const Ft=Ke("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var $t;!function(e){e.SendAndConfirmTransaction="sendAndConfirmTransaction",e.SignAndSendTransaction="signAndSendTransaction",e.SignTransaction="signTransaction",e.SignMessage="signMessage",e.SignIn="signIn"}($t||($t={}));ce({...ft.schema,address:Ft,type:J(`${dt.DataAccount}`),scopes:pe(K(rt)),methods:K(H(Object.values($t)))});var qt;!function(e){e.Eoa="eip155:0",e.Mainnet="eip155:1",e.Testnet="eip155:11155111"}(qt||(qt={}));const Wt=Ke("EthBytes",/^0x[0-9a-f]*$/iu),Vt=Ke("EthAddress",/^0x[0-9a-f]{40}$/iu),Kt=Ke("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu);var Gt;!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"}(Gt||(Gt={}));ce({...ft.schema,address:Vt,type:J(`${ut.Eoa}`),scopes:pe(K(J(qt.Eoa))),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTransaction}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`]))}),ce({...ft.schema,address:Vt,type:J(`${ut.Erc4337}`),scopes:pe(K(rt)),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`,`${Gt.PrepareUserOperation}`,`${Gt.PatchUserOperation}`,`${Gt.SignUserOperation}`]))}),ce({sender:Vt,nonce:Kt,initCode:Wt,callData:Wt,callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt,maxFeePerGas:Kt,maxPriorityFeePerGas:Kt,paymasterAndData:Wt,signature:Wt}),ce({to:Vt,value:Kt,data:Wt}),ce({nonce:Kt,initCode:Wt,callData:Wt,gasLimits:le(ce({callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt})),dummyPaymasterAndData:Wt,dummySignature:Wt,bundlerUrl:q}),ce({paymasterAndData:Wt,callGasLimit:le(Kt),verificationGasLimit:le(Kt),preVerificationGas:le(Kt)});var Ht;!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"}(Ht||(Ht={}));const Zt={jsonrpc:J("2.0"),id:ae([re(),X(),J(null)])},Jt=ce({...Zt,method:J("keyring_listAccounts")}),Yt=(K(ft),ce({...Zt,method:J("keyring_getAccount"),params:ce({id:F})})),Qt=ce({...Zt,method:J("keyring_createAccount"),params:ce({options:ne(re(),Le)})}),Xt=ce({...Zt,method:J("keyring_discoverAccounts"),params:ce({scopes:K(rt),entropySource:re(),groupIndex:X()})}),en=(K(bt),ce({...Zt,method:J("keyring_listAccountTransactions"),params:ce({id:F,pagination:Rt})})),tn=ce({...Zt,method:J("keyring_listAccountAssets"),params:ce({id:F})}),nn=K(st),rn=ce({...Zt,method:J(`${Ht.GetAccountBalances}`),params:ce({id:F,assets:K(it)})}),on=(ne(it,vt),ce({...Zt,method:J("keyring_resolveAccountAddress"),params:ce({scope:rt,request:Pe})})),an=(Q(ce({address:ot})),ce({...Zt,method:J("keyring_filterAccountChains"),params:ce({id:F,chains:K(re())})})),sn=(K(re()),ce({...Zt,method:J("keyring_updateAccount"),params:ce({account:ft})})),cn=(J(null),ce({...Zt,method:J("keyring_deleteAccount"),params:ce({id:F})})),un=(J(null),ce({...Zt,method:J("keyring_exportAccount"),params:ce({id:F})})),ln=ce({...Zt,method:J("keyring_listRequests")}),dn=(K(St),ce({...Zt,method:J("keyring_getRequest"),params:ce({id:F})})),fn=ce({...Zt,method:J("keyring_submitRequest"),params:St}),hn=ce({...Zt,method:J("keyring_approveRequest"),params:ce({id:F,data:ne(re(),Le)})}),pn=(J(null),ce({...Zt,method:J("keyring_rejectRequest"),params:ce({id:F})}));J(null);var gn;!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"}(gn||(gn={}));ce({method:J(`${gn.AccountCreated}`),params:ce({account:ft,accountNameSuggestion:le(re()),displayConfirmation:le(G()),displayAccountNameSuggestion:le(G()),...Pt.schema})}),ce({method:J(`${gn.AccountUpdated}`),params:ce({account:ft})}),ce({method:J(`${gn.AccountDeleted}`),params:ce({id:F})}),ce({method:J(`${gn.RequestApproved}`),params:ce({id:F,result:Le})}),ce({method:J(`${gn.RequestRejected}`),params:ce({id:F})}),ce({method:J(`${gn.AccountBalancesUpdated}`),params:ce({balances:ne($,ne(it,ht))})}),ce({method:J(`${gn.AccountTransactionsUpdated}`),params:ce({transactions:ne($,K(Ct))})}),ce({method:J(`${gn.AccountAssetListUpdated}`),params:ce({assets:ne($,ce({added:K(st),removed:K(st)}))})});class mn extends Error{constructor(e){super(`Method not supported: ${e}`)}}async function yn(e,t){try{return await async function(e,t){switch(M(t,Pe),t.method){case`${Ht.ListAccounts}`:return M(t,Jt),e.listAccounts();case`${Ht.GetAccount}`:return M(t,Yt),e.getAccount(t.params.id);case`${Ht.CreateAccount}`:return M(t,Qt),e.createAccount(t.params.options);case`${Ht.DiscoverAccounts}`:if(void 0===e.discoverAccounts)throw new mn(t.method);return M(t,Xt),e.discoverAccounts(t.params.scopes,t.params.entropySource,t.params.groupIndex);case`${Ht.ListAccountTransactions}`:if(void 0===e.listAccountTransactions)throw new mn(t.method);return M(t,en),e.listAccountTransactions(t.params.id,t.params.pagination);case`${Ht.ListAccountAssets}`:if(void 0===e.listAccountAssets)throw new mn(t.method);return M(t,tn),e.listAccountAssets(t.params.id);case`${Ht.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new mn(t.method);return M(t,rn),e.getAccountBalances(t.params.id,t.params.assets);case`${Ht.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new mn(t.method);return M(t,on),e.resolveAccountAddress(t.params.scope,t.params.request);case`${Ht.FilterAccountChains}`:return M(t,an),e.filterAccountChains(t.params.id,t.params.chains);case`${Ht.UpdateAccount}`:return M(t,sn),e.updateAccount(t.params.account);case`${Ht.DeleteAccount}`:return M(t,cn),e.deleteAccount(t.params.id);case`${Ht.ExportAccount}`:if(void 0===e.exportAccount)throw new mn(t.method);return M(t,un),e.exportAccount(t.params.id);case`${Ht.ListRequests}`:if(void 0===e.listRequests)throw new mn(t.method);return M(t,ln),e.listRequests();case`${Ht.GetRequest}`:if(void 0===e.getRequest)throw new mn(t.method);return M(t,dn),e.getRequest(t.params.id);case`${Ht.SubmitRequest}`:return M(t,fn),e.submitRequest(t.params);case`${Ht.ApproveRequest}`:if(void 0===e.approveRequest)throw new mn(t.method);return M(t,hn),e.approveRequest(t.params.id,t.params.data);case`${Ht.RejectRequest}`:if(void 0===e.rejectRequest)throw new mn(t.method);return M(t,pn),e.rejectRequest(t.params.id);default:throw new mn(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)}}async function vn(e,t,n){await e.request({method:"snap_manageAccounts",params:{method:t,params:{...n}}})}function wn(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const An=(e,t)=>Object.hasOwnProperty.call(e,t);var bn;!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"}(bn=bn||(bn={}));function Sn(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}}var En=n(282);class kn 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 Tn(e){return"object"==typeof e&&null!==e}function In(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function xn(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: \`${In(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*_n(e,t,n,r){(function(e){return Tn(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=xn(o,t,n,r);e&&(yield e)}}function*Cn(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&&Tn(t.schema)&&Tn(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=Cn(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):Tn(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 Rn{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)=>_n(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>_n(o(e,t),t,this,e):()=>[]}assert(e,t){return Pn(e,this,t)}create(e,t){return Nn(e,this,t)}is(e){return Bn(e,this)}mask(e,t){return function(e,t,n){const r=On(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return On(e,this,t)}}function Pn(e,t,n){const r=On(e,t,{message:n});if(r[0])throw r[0]}function Nn(e,t,n){const r=On(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Bn(e,t){return!On(e,t)[0]}function On(e,t,n={}){const r=Cn(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new kn(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Mn(e,t){return new Rn({type:e,schema:null,validator:t})}function zn(){return Mn("never",(()=>!1))}function Un(e){const t=e?Object.keys(e):[],n=zn();return new Rn({type:"object",schema:e??null,*entries(r){if(e&&Tn(r)){const o=new Set(Object.keys(r));for(const n of t)o.delete(n),yield[n,r[n],e[n]];for(const e of o)yield[e,r[e],n]}},validator:e=>Tn(e)||`Expected an object, but received: ${In(e)}`,coercer:e=>Tn(e)?{...e}:e})}function jn(e){return new Rn({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function Ln(){return Mn("string",(e=>"string"==typeof e||`Expected a string, but received: ${In(e)}`))}function Dn(e){const t=e.map((e=>e.type)).join(" | ");return new Rn({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]=Cn(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: ${In(n)}`,...o]}})}function Fn(e,t,n){return new Rn({...e,coercer:(r,o)=>Bn(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function $n(e,t,n){return new Rn({...e,*refiner(r,o){yield*e.refiner(r,o);const i=_n(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const qn=e=>Un(e);function Wn({path:e,branch:t}){const n=e[e.length-1];return An(t[t.length-2],n)}function Vn(e){return new Rn({...e,type:`optional ${e.type}`,validator:(t,n)=>!Wn(n)||e.validator(t,n),refiner:(t,n)=>!Wn(n)||e.refiner(t,n)})}function Kn(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(!Kn(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]||!Kn(n[e][1])){t=!1;break}return t}return!1}const Gn=Mn("JSON",(e=>Kn(e))),Hn=Fn(Gn,$n(Mn("any",(()=>!0)),"JSON",(e=>Bn(e,Gn))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Zn(e){try{return function(e){Nn(e,Hn)}(e),!0}catch{return!1}}const Jn=function(e){const t=In(e),n=typeof e;return new Rn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${In(n)}`})}("2.0"),Yn=(Qn=Dn([Mn("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${In(e)}`)),Ln()]),new Rn({...Qn,validator:(e,t)=>null===e||Qn.validator(e,t),refiner:(e,t)=>null===e||Qn.refiner(e,t)}));var Qn;const Xn=qn({code:Mn("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${In(e)}`)),message:Ln(),data:Vn(Hn),stack:Vn(Ln())}),er=Dn([function(e,t){return new Rn({type:"record",schema:null,*entries(n){if(Tn(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>Tn(e)||`Expected an object, but received: ${In(e)}`})}(Ln(),Hn),(tr=Hn,new Rn({type:"array",schema:tr,*entries(e){if(tr&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,tr]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${In(e)}`}))]);var tr;qn({id:Yn,jsonrpc:Jn,method:Ln(),params:Vn(er)}),qn({jsonrpc:Jn,method:Ln(),params:Vn(er)});Un({id:Yn,jsonrpc:Jn,result:jn(Mn("unknown",(()=>!0))),error:jn(Xn)});const nr=qn({id:Yn,jsonrpc:Jn,result:Hn}),rr=qn({id:Yn,jsonrpc:Jn,error:Xn});Dn([nr,rr]);const or={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},ir={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},ar={"-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."}},sr=or.internal,cr="Unspecified error message. This is a bug, please report it.",ur=(lr(sr),"Unspecified server error.");function lr(e,t=cr){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(An(ar,t))return ar[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return ur}return t}function dr(e){return Array.isArray(e)?e.map((e=>Zn(e)?e:wn(e)?fr(e):null)):wn(e)?fr(e):Zn(e)?e:null}function fr(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Zn(r)&&(t[n]=r),t}),{})}const hr=function(e){return e?.__esModule?e.default:e}(En);class pr 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 wn(e)&&An(e,"cause")&&wn(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),An(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,Sn(this.data)&&(e.data.cause=dr(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return hr(this.serialize(),mr,2)}}class gr extends pr{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 mr(e,t){if("[Circular]"!==t)return t}const yr=e=>Br(or.parse,e),vr=e=>Br(or.invalidRequest,e),wr=e=>Br(or.invalidParams,e),Ar=e=>Br(or.methodNotFound,e),br=e=>Br(or.internal,e),Sr=e=>Br(or.invalidInput,e),Er=e=>Br(or.resourceNotFound,e),kr=e=>Br(or.resourceUnavailable,e),Tr=e=>Br(or.transactionRejected,e),Ir=e=>Br(or.methodNotSupported,e),xr=e=>Br(or.limitExceeded,e),_r=e=>Or(ir.userRejectedRequest,e),Cr=e=>Or(ir.unauthorized,e),Rr=e=>Or(ir.unsupportedMethod,e),Pr=e=>Or(ir.disconnected,e),Nr=e=>Or(ir.chainDisconnected,e);function Br(e,t){const[n,r]=Mr(t);return new pr(e,n??lr(e),r)}function Or(e,t){const[n,r]=Mr(t);return new gr(e,n??lr(e),r)}function Mr(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[]}function zr(e,t,n=null){return wn(e)&&An(e,t)?e[t]:n}function Ur(e,t,n=String(e)){const r=zr(e,t);return"string"==typeof r?r:n}function jr(e){return Ur(e,"message")}function Lr(e){return Ur(e,"stack",null)}function Dr(e){return Ur(e,"name",e instanceof Error?e.name:"Error")}function Fr(e){const t=zr(e,"data");return null!==t&&Zn(t)&&!Array.isArray(t)?t:{}}class $r extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=jr(e);super(n),this.#t=n,this.#e=function(e){const t=zr(e,"code");return"number"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Fr(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 qr(e){if("string"==typeof e)return{name:"Error",message:e,stack:null,cause:null};if(Bn(e,Xn))return{name:"JsonRpcError",message:jr(e),stack:Lr(e)??Lr(e.data)??null,cause:null};const t=function(e){return zr(e,"cause")}(e);return{name:Dr(e),message:jr(e),stack:Lr(e)??null,cause:null===t?null:qr(t)}}function Wr(e){return class extends $r{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 Vr=Wr(br),Kr=Wr(Sr),Gr=Wr(wr),Hr=Wr(vr),Zr=Wr(xr),Jr=Wr(Ar),Yr=Wr(Ir),Qr=Wr(yr),Xr=Wr(Er),eo=Wr(kr),to=Wr(Tr),no=Wr(Nr),ro=Wr(Pr),oo=Wr(Cr),io=Wr(Rr),ao=Wr(_r);var so=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,co=Math.ceil,uo=Math.floor,lo="[BigNumber Error] ",fo=lo+"Number primitive has more than 15 significant digits: ",ho=1e14,po=14,go=9007199254740991,mo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yo=1e7,vo=1e9;function wo(e){var t=0|e;return e>0||e===t?t:t-1}function Ao(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=po-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function bo(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 So(e,t,n,r){if(e<t||e>n||e!==uo(e))throw Error(lo+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Eo(e){var t=e.c.length-1;return wo(e.e/po)==t&&e.c[t]%2!=0}function ko(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function To(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 Io=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,v=-1e7,w=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>w?f.c=f.e=null:e.e<v?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>w?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!so.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(So(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(fo+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>go||e!==uo(e)))throw Error(fo+f.s*e);if((s=s-c-1)>w)f.c=f.e=null;else if(s<v)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%po,s<0&&(c+=po),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=po;c<l;)f.c.push(+d.slice(c,c+=po));c=po-(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:So(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)c=Ao(e.c),c=1==r||2==r&&(a<=m||a>=y)?ko(c,a):To(c,a,"0");else if(i=(e=R(new I(e),t,n)).e,s=(c=Ao(e.c)).length,1==r||2==r&&(t<=i||i<=m)){for(;s<t;c+="0",s++);c=ko(c,i)}else if(t-=a,c=To(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=bo(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*po-1)>w?e.c=e.e=null:n<v?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=mo;if(d){e:{for(o=1,s=d[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=po,a=t,c=d[u=0],l=uo(c/f[o-a-1]%10);else if((u=co((i+1)/po))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,o=1,a=(i%=po)-po+1}else{for(c=s=d[u],o=1;s>=10;s/=10,o++);l=(a=(i%=po)-po+o)<0?0:uo(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[(po-t%po)%po],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[po-i],d[u]=a>0?uo(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]==ho&&(d[0]=1));break}if(d[u]+=s,d[u]!=ho)break;d[u--]=0,s=1}for(i=d.length;0===d[--i];d.pop());}e.e>w?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=Ao(e.c),t=n<=m||n>=y?ko(t,n):To(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(lo+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(So(n=e[t],0,vo,t),p=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(So(n=e[t],0,8,t),g=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(So(n[0],-vo,0,t),So(n[1],0,vo,t),m=n[0],y=n[1]):(So(n,-vo,vo,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)So(n[0],-vo,-1,t),So(n[1],1,vo,t),v=n[0],w=n[1];else{if(So(n,-vo,vo,t),!n)throw Error(lo+t+" cannot be zero: "+n);v=-(w=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(lo+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(lo+"crypto unavailable");A=n}else A=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(So(n=e[t],0,9,t),b=n),e.hasOwnProperty(t="POW_PRECISION")&&(So(n=e[t],0,vo,t),S=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(lo+t+" not an object: "+n);E=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(lo+t+" invalid: "+n);T="0123456789"==n.slice(0,10),k=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[v,w],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>=-vo&&o<=vo&&o===uo(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%po)<1&&(t+=po),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ho||n!==uo(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(lo+"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 uo(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:So(e,0,vo),o=co(e/po),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(lo+"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%=po,o&&e&&(i=mo[po-e],c[s]=uo(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-=po);for(s=1,i=c[0];i>=10;i/=10,s++);s<po&&(r-=po-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,v=r.indexOf("."),w=p,A=g;for(v>=0&&(d=S,S=0,r=r.replace(".",""),h=(y=new I(o)).pow(r.length-v),S=d,y.c=t(To(Ao(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(v<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,w,A,i)).c,f=h.r,l=h.e),v=m[u=l+w+1],d=i/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=v||f)&&(0==A||A==(h.s<0?3:2)):v>d||v==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?To(c.charAt(1),-w,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(v=0,r="";v<=d;r+=c.charAt(m[v++]));r=To(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%yo,l=t/yo|0;for(e=e.slice();c--;)s=((o=u*(i=e[c]%yo)+(r=l*i+(a=e[c]/yo|0)*u)%yo*yo+s)/n|0)+(r/yo|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,v,w,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=ho,u=wo(r.e/po)-wo(o.e/po),T=T/po|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=uo(s/(_[0]+1)))>1&&(_=e(_,f,s),x=e(x,f,s),E=_.length,b=x.length),A=E,v=(y=x.slice(0,E)).length;v<E;y[v++]=0);k=_.slice(),k=[0].concat(k),S=_[0],_[1]>=s/2&&S++;do{if(f=0,(c=t(_,y,E,v))<0){if(w=y[0],E!=v&&(w=w*s+(y[1]||0)),(f=uo(w/S))>1)for(f>=s&&(f=s-1),p=(h=e(_,f,s)).length,v=y.length;1==t(h,y,p,v);)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<v&&(h=[0].concat(h)),n(y,h,v,s),v=y.length,-1==c)for(;t(_,y,E,v)<1;)f++,n(y,E<v?k:_,v,s),v=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[v++]=x[A]||0:(y=[x[A]],v=1)}while((A++<b||null!=y[0])&&T--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==ho){for(l=1,T=m[0];T>=10;T/=10,l++);R(g,i+(g.e=l+u*po-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(lo+"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 bo(this,new I(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,o,i=this;if(null!=e)return So(e,0,vo),null==t?t=g:So(t,0,8),R(new I(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-wo(this.e/po))*po,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(lo+"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-Eo(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&&Eo(e)?-0:0,l.e>-1&&(i=1/i),new I(s?1/i:i);S&&(i=co(S/po+2))}for(a?(n=new I(.5),s&&(e.s=1),c=Eo(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=uo(o/2)))break;c=o%2}else if(R(e=e.times(n),e.e+1,1),e.e>14)c=Eo(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:So(e,0,8),R(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===bo(this,new I(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return bo(this,new I(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=bo(this,new I(e,t)))||0===t},f.isInteger=function(){return!!this.c&&wo(this.e/po)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return bo(this,new I(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=bo(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/po,u=e.e/po,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=wo(c),u=wo(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=ho-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=ho}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,v=y.c,w=(e=new I(e,t)).c;if(!(v&&w&&v[0]&&w[0]))return!y.s||!e.s||v&&!v[0]&&!w||w&&!w[0]&&!v?e.c=e.e=e.s=null:(e.s*=y.s,v&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=wo(y.e/po)+wo(e.e/po),e.s*=y.s,(c=v.length)<(d=w.length)&&(p=v,v=w,w=p,o=c,c=d,d=o),o=c+d,p=[];o--;p.push(0));for(g=ho,m=yo,o=d;--o>=0;){for(n=0,f=w[o]%m,h=w[o]/m|0,i=o+(a=c);i>o;)n=((u=f*(u=v[--a]%m)+(s=h*u+(l=v[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/po,a=e.e/po,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=wo(i),a=wo(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)/ho|0,s[t]=ho===s[t]?0:s[t]%ho;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 So(e,1,vo),null==t?t=g:So(t,0,8),R(new I(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*po+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 So(e,-9007199254740991,go),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=Ao(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=wo((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))),Ao(i.c).slice(0,c)===(t=Ao(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&&(So(e,0,vo),e++),x(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(So(e,0,vo),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(lo+"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(lo+"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=Ao(y),a=t.e=p.length-m.e-1,t.c[0]=mo[(s=a%po)<0?po+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=w,w=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],w=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&So(e,1,vo),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?ko(Ao(n.c),i):To(Ao(n.c),i,"0"):10===e&&T?t=To(Ao((n=R(new I(n),p+i+1,g)).c),n.e,"0"):(So(e,2,k.length,"Base"),t=r(To(Ao(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 xo=Io;function _o(e,t){return L(e,(e=>"string"==typeof e&&t.test(e)))}const Co=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Ro=/^[-a-z0-9]{3,8}$/u,Po=/^[-_a-zA-Z0-9]{1,32}$/u,No=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Bo=/^[-.%a-zA-Z0-9]{1,128}$/u,Oo=/^[-a-z0-9]{3,8}$/u,Mo=/^[-.%a-zA-Z0-9]{1,128}$/u,zo=/^[-.%a-zA-Z0-9]{1,78}$/u,Uo=/^(?<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,jo=/^(?<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,Lo=(_o("CaipChainId",Co),_o("CaipNamespace",Ro),_o("CaipReference",Po),_o("CaipAccountId",No),_o("CaipAccountAddress",Bo),_o("CaipAssetNamespace",Oo),_o("CaipAssetReference",Mo),_o("CaipTokenId",zo),_o("CaipAssetType",Uo));_o("CaipAssetId",jo),_o("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 Do;function Fo(e){const t=Uo.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 $o(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"}(Do=Do||(Do={}));class qo extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Wo(e,t="Assertion failed.",n=qo){if(!e){if(t instanceof Error)throw t;throw $o(n,t)}}var Vo=4,Ko=5,Go=6,Ho=10,Zo=-32700,Jo=-32603,Yo=-32602,Qo=-32601,Xo=-32600,ei=-32015,ti=-32014,ni=-32012,ri=-32010,oi=-32009,ii=-32007,ai=-32006,si=-32004,ci=-32002,ui=-32001,li=28e5,di=2800001,fi=2800003,hi=2800006,pi=2800007,gi=2800008,mi=2800009,yi=323e4,vi=32300001,wi=3230002,Ai=3230004,bi=361e4,Si=3610001,Ei=3610003,ki=3610005,Ti=3610006,Ii=3610007,xi=3704001,_i=3704002,Ci=3704003,Ri=4615e3,Pi=4615026,Ni=4615045,Bi=5508e3,Oi=5663e3,Mi=5663001,zi=5663004,Ui=5663005,ji=5663006,Li=5663007,Di=5663008,Fi=5663009,$i=5663012,qi=5663015,Wi=5663016,Vi=5663017,Ki=5663018,Gi=5663019,Hi=705e4,Zi=7050030,Ji=7050031,Yi=7050035,Qi=8078e3,Xi=8078001,ea=8078002,ta=8078004,na=8078005,ra=8078006,oa=8078007,ia=8078008,aa=8078010,sa=8078011,ca=8078012,ua=8078013,la=8078014,da=8078017,fa=8078018,ha=8078022,pa=81e5,ga=8100002,ma=8100003,ya=9900003;function va(e){if(Array.isArray(e)){return"%5B"+e.map(va).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function wa([e,t]){return`${e}=${va(t)}`}function Aa(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(wa).join("&");return btoa(t)}(t)}'`),`${n}\``}}function ba(e,t){return!!(e instanceof Error&&"SolanaError"===e.name)&&(void 0===t||e.context.__code===t)}var Sa=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(Aa(e,n),r),this.context={__code:e,...n},this.name="SolanaError"}};function Ea(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function ka({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 Sa(s,c);return Ea(u,o),u}var Ta=["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 Ia(e,t){const n=Number(e);return ka({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===Ri?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===Pi?{code:Number(r),index:n}:e===Ni?{encodedData:r,index:n}:{index:n},orderedErrorNames:Ta,rpcEnumError:t},Ia)}var xa=["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 _a(e){return"object"==typeof e&&"InstructionError"in e?Ia(...e.InstructionError):ka({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===Hi?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===Zi?{index:Number(n)}:e===Ji||e===Yi?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:xa,rpcEnumError:e},_a)}function Ca(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===ci){const{err:e,...n}=r,o=e?{cause:_a(e)}:null;t=new Sa(ci,{...n,...o})}else{let e;switch(i){case Jo:case Yo:case Xo:case Qo:case Zo:case ni:case ui:case si:case ti:case ri:case oi:case ii:case ai:case ei:e={__serverMessage:o};break;default:"object"!=typeof r||Array.isArray(r)||(e=r)}t=new Sa(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 Sa(Ho,{error:e,message:n})}var n;return Ea(t,Ca),t}var Ra=(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 Pa(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 Na(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function Ba(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(Na(t,e));return e.write(t,n,0),n}})}function Oa(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function Ma(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function za(e){if(!Ma(e))throw new Sa(ea)}function Ua(e){return!Ma(e)}function ja(e,t){if(Ma(e)!==Ma(t))throw new Sa(ta);if(Ma(e)&&Ma(t)&&e.fixedSize!==t.fixedSize)throw new Sa(na,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!Ma(e)&&!Ma(t)&&e.maxSize!==t.maxSize)throw new Sa(ra,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function La(e,t,n,r=0){const o=n.length-r;if(o<t)throw new Sa(Xi,{bytesLength:o,codecDescription:e,expected:t})}function Da(e,t,n){if(t<0||t>n)throw new Sa(la,{bytesLength:n,codecDescription:e,offset:t})}function Fa(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(Ma(t)&&Ma(e))return Ba({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=Ma(t)?t.fixedSize:t.maxSize??null,o=Ma(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Ba({...e,...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=Na(n,e);return Na(r,t)+r},write:n})}function $a(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)),La("addDecoderSizePrefix",a,n),[e.decode(n),r+a]};if(Ma(t)&&Ma(e))return Oa({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=Ma(t)?t.fixedSize:t.maxSize??null,o=Ma(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Oa({...e,...null!==i?{maxSize:i}:{},read:n})}function qa(e,t){return Ba({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 Wa(e,t){return Oa({fixedSize:t,read:(n,r)=>{La("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),Ma(e)&&(n=Ra(n,e.fixedSize));const[o]=e.read(n,0);return[o,r+t]}})}function Va(e,t){return Ba({...e,write:(n,r,o)=>{const i=e=>Ga(e,r.length),a=t.preOffset?t.preOffset({bytes:r,preOffset:o,wrapBytes:i}):o;Da("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 Da("offsetEncoder",c,r.length),c}})}function Ka(e,t){return Oa({...e,read:(n,r)=>{const o=e=>Ga(e,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Da("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 Da("offsetDecoder",c,n.length),[a,c]}})}function Ga(e,t){return 0===t?0:(e%t+t)%t}function Ha(e,t){if(Ma(e)){const n=t(e.fixedSize);if(n<0)throw new Sa(ua,{bytesLength:n,codecDescription:"resizeEncoder"});return Ba({...e,fixedSize:n})}return Ba({...e,getSizeFromValue:n=>{const r=t(e.getSizeFromValue(n));if(r<0)throw new Sa(ua,{bytesLength:r,codecDescription:"resizeEncoder"});return r}})}function Za(e,t){if(Ma(e)){const n=t(e.fixedSize);if(n<0)throw new Sa(ua,{bytesLength:n,codecDescription:"resizeDecoder"});return Oa({...e,fixedSize:n})}return e}function Ja(e,t){return Va(Ha(e,(e=>e+t)),{preOffset:({preOffset:e})=>e+t})}function Ya(e,t){return Ka(Za(e,(e=>e+t)),{postOffset:({postOffset:e})=>e+t})}function Qa(e,t){return Ba({...Ua(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function Xa(e,t){return Oa({...e,read:(n,r)=>{const[o,i]=e.read(n,r);return[t(o,n,r),i]}})}function es(e,t,n,r){if(r<t||r>n)throw new Sa(sa,{codecDescription:e,max:n,min:t,value:r})}var ts,ns=((ts=ns||{})[ts.Little=0]="Little",ts[ts.Big=1]="Big",ts);function rs(e){return 1!==e?.endian}function os(e){return Ba({fixedSize:e.size,write(t,n,r){e.range&&es(e.name,e.range[0],e.range[1],t);const o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,rs(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function is(e){return Oa({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Sa(Qi,{codecDescription:e})}(e.name,t,n),La(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,rs(e.config)),n+e.size]}})}var as=(e={})=>is({config:e,get:(e,t)=>e.getFloat64(0,t),name:"f64",size:8}),ss=(e={})=>is({config:e,get:(e,t)=>e.getInt16(0,t),name:"i16",size:2}),cs=(e={})=>is({config:e,get:(e,t)=>e.getBigInt64(0,t),name:"i64",size:8}),us=()=>is({get:e=>e.getInt8(0),name:"i8",size:1}),ls=()=>Ba({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{es("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}}),ds=()=>Oa({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,0==(128&i))break}return[n,t+r]}}),fs=(e={})=>is({config:e,get:(e,t)=>e.getUint16(0,t),name:"u16",size:2}),hs=(e={})=>os({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),ps=(e={})=>is({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),gs=(e={})=>os({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),ms=(e={})=>is({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}),ys=()=>os({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),vs=()=>is({get:e=>e.getUint8(0),name:"u8",size:1});var ws,As=((ws=As||{})[ws.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",ws[ws.READONLY_SIGNER=2]="READONLY_SIGNER",ws[ws.WRITABLE=1]="WRITABLE",ws[ws.READONLY=0]="READONLY",ws),bs=2,Ss=1;function Es(e){return e>=2}function ks(e){return 0!=(e&Ss)}function Ts(e,t){return e|t}function Is(e){return e|bs}function xs(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Sa(ca,{alphabet:e,base:e.length,value:n})}var _s=e=>Ba({getSizeFromValue:t=>{const[n,r]=Ps(t,e[0]);if(!r)return t.length;const o=Ns(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(xs(e,t),""===t)return r;const[o,i]=Ps(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=Ns(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}}),Cs=e=>Oa({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]}}),Rs=e=>ja(_s(e),Cs(e));function Ps(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function Ns(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 Bs="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Os=()=>_s(Bs),Ms=()=>Cs(Bs),zs=()=>Rs(Bs);var Us,js,Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ds=()=>Ba({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Sa(ca,{alphabet:Ls,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 Sa(ca,{alphabet:Ls,base:64,value:e})}}}),Fs=()=>Oa({read(e,t=0){const n=e.slice(t);return[btoa(String.fromCharCode(...n)),e.length]}}),$s=()=>ja(Ds(),Fs()),qs=e=>e.replace(/\u0000/g,""),Ws=globalThis.TextDecoder,Vs=globalThis.TextEncoder,Ks=()=>{let e;return Oa({read(t,n){const r=(e||=new Ws).decode(t.slice(n));return[qs(r),t.length]}})},Gs=()=>ja((()=>{let e;return Ba({getSizeFromValue:t=>(e||=new Vs).encode(t).length,write:(t,n,r)=>{const o=(e||=new Vs).encode(t);return n.set(o,r),r+o.length}})})(),Ks());function Hs(){if(!globalThis.isSecureContext)throw new Sa(bi)}function Zs(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new Sa(Ei)}function Js(){return Us||(Us=Os()),Us}function Ys(e){if(e.length<32||e.length>44)return!1;const t=Js();try{return 32===t.encode(e).byteLength}catch{return!1}}function Qs(e){if(e.length<32||e.length>44)throw new Sa(di,{actualLength:e.length});const t=Js().encode(e).byteLength;if(32!==t)throw new Sa(li,{actualLength:t})}function Xs(e){return Qs(e),e}function ec(){return Qa(qa(Js(),32),(e=>Xs(e)))}function tc(){return Wa((js||(js=Ms()),js),32)}function nc(){return ja(ec(),tc())}function rc(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var oc=37095705934669439343138083508754565189542113879843219016388785533085940283555n,ic=57896044618658097711785492504343953926634992332820282019728792003956564819949n,ac=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function sc(e){const t=e%ic;return t>=0n?t:ic+t}function cc(e,t){let n=e;for(;t-- >0n;)n*=n,n%=ic;return n}function uc(e,t){const n=sc(t*t*t),r=function(e){const t=e*e%ic*e%ic,n=cc(t,2n)*t%ic,r=cc(n,1n)*e%ic,o=cc(r,5n)*r%ic,i=cc(o,10n)*o%ic,a=cc(i,20n)*i%ic,s=cc(a,40n)*a%ic,c=cc(s,80n)*s%ic,u=cc(c,80n)*s%ic,l=cc(u,10n)*o%ic;return cc(l,2n)*e%ic}(e*sc(n*n*t));let o=sc(e*n*r);const i=sc(t*o*o),a=o,s=sc(o*ac),c=i===e,u=i===sc(-e),l=i===sc(-e*ac);return c&&(o=a),(u||l)&&(o=s),1n===(1n&sc(o))&&(o=sc(-o)),c||u?o:null}function lc(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=sc(e*e),r=uc(sc(n-1n),sc(oc*n+1n));return null!==r&&(0n!==r||!(0!=(128&t)))}(t,e[31])}var dc=32,fc=16,hc=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function pc({programAddress:e,seeds:t}){if(function(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new Sa(Si)}(),t.length>fc)throw new Sa(hi,{actual:t.length,maxSeeds:fc});let n;const r=t.reduce(((e,t,r)=>{const o="string"==typeof t?(n||=new TextEncoder).encode(t):t;if(o.byteLength>dc)throw new Sa(pi,{actual:o.byteLength,index:r,maxSeedLength:dc});return e.push(...o),e}),[]),o=nc(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...hc])),s=new Uint8Array(a);if(lc(s))throw new Sa(gi);return o.decode(s)}async function gc({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await pc({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!ba(e,gi))throw e;n--}throw new Sa(mi)}async function mc(e){if(Zs(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new Sa(fi);const t=await crypto.subtle.exportKey("raw",e);return tc().decode(new Uint8Array(t))}var yc,vc=Object.freeze({name:"Ed25519"});async function wc(e,t){const n=e.byteLength;if(32!==n)throw new Sa(xi,{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,vc,t??!1,["sign"])}async function Ac(e,t){!function(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new Sa(ki)}();const n=await crypto.subtle.sign(vc,e,t);return new Uint8Array(n)}function bc(e){return function(e){if(yc||(yc=Os()),e.length<64||e.length>88)throw new Sa(Ci,{actualLength:e.length});const t=yc.encode(e).byteLength;if(64!==t)throw new Sa(_i,{actualLength:t})}(e),e}async function Sc(e,t,n){return function(){if(Hs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new Sa(Ti)}(),await crypto.subtle.verify(vc,e,t,n)}async function Ec(e,t=!1){const n=wc(e,t),[r,o]=await Promise.all([(t?n:wc(e,!0)).then((async e=>await async function(e,t=!1){if(Zs(),!1===e.extractable)throw new Sa(Ii,{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 kc(e,t,n){if(t!==n)throw new Sa(oa,{actual:n,codecDescription:e,expected:t})}function Tc(e){return e.reduce(((e,t)=>null===e||null===t?null:e+t),0)}function Ic(e){return Ma(e)?e.fixedSize:null}function xc(e){return Ma(e)?e.fixedSize:e.maxSize??null}function _c(e,t={}){const n=t.size??hs(),r=Rc(n,Ic(e)),o=Rc(n,xc(e))??void 0;return Ba({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>("object"==typeof n?Na(t.length,n):0)+[...t].reduce(((t,n)=>t+Na(n,e)),0),maxSize:o},write:(t,r,o)=>("number"==typeof n&&kc("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 Cc(e,t={}){const n=t.size??ps(),r=Ic(e),o=Rc(n,r),i=Rc(n,xc(e))??void 0;return Oa({...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 Rc(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function Pc(e={}){return Qa(e.size??ys(),(e=>e?1:0))}function Nc(e={}){return Xa(e.size??vs(),(e=>1===Number(e)))}function Bc(){return Ba({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Oc(){return Oa({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}var Mc=()=>Oa({read(e,t){const n=e.slice(t).reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"");return[n,e.length]}});function zc(e){return Ba({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function Uc(e){return Oa({fixedSize:e.length,read:(t,n)=>{const r=Mc();if(!Pa(t,e,n))throw new Sa(fa,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function jc(e){const t=Tc(e.map(Ic)),n=Tc(e.map(xc))??void 0;return Ba({...null===t?{getSizeFromValue:t=>e.map(((e,n)=>Na(t[n],e))).reduce(((e,t)=>e+t),0),maxSize:n}:{fixedSize:t},write:(t,n,r)=>(kc("tuple",e.length,t.length),e.forEach(((e,o)=>{r=e.write(t[o],n,r)})),r)})}function Lc(e){const t=Tc(e.map(Ic)),n=Tc(e.map(xc))??void 0;return Oa({...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 Dc(e,t){const n=qc(e),r=(n,r,o)=>{const i=t(n);return $c(e,i),e[i].write(n,r,o)};if(null!==n)return Ba({fixedSize:n,write:r});const o=Wc(e);return Ba({...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=t(n);return $c(e,r),Na(n,e[r])},write:r})}function Fc(e,t){const n=qc(e),r=(n,r)=>{const o=t(n,r);return $c(e,o),e[o].read(n,r)};if(null!==n)return Oa({fixedSize:n,read:r});const o=Wc(e);return Oa({...null!==o?{maxSize:o}:{},read:r})}function $c(e,t){if(void 0===e[t])throw new Sa(da,{maxRange:e.length-1,minRange:0,variant:t})}function qc(e){if(0===e.length)return 0;if(!Ma(e[0]))return null;const t=e[0].fixedSize;return e.every((e=>Ma(e)&&e.fixedSize===t))?t:null}function Wc(e){return e.map((e=>xc(e))).reduce(((e,t)=>null===e||null===t?null:Math.max(e,t)),0)}function Vc(e,t={}){const n=t.discriminator??"__kind",r=t.size??vs();return Fc(e.map((([e,t])=>Xa(Lc([r,t]),(([,t])=>({[n]:e,...t}))))),((e,t)=>Number(r.read(e,t)[0])))}function Kc(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 Gc(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function Hc(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 Zc(e,t={}){const n=t.size??ys(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=Kc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Sa(ha,{stringValues:i.filter((e=>"string"==typeof e))});return Qa(n,(e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=Gc(t,(e=>e===n));return r>=0?r:e.findIndex((e=>e===n))}({enumKeys:o,enumValues:i,variant:e});if(t<0)throw new Sa(aa,{formattedNumericalValues:Hc(a),numericalValues:a,stringValues:s,variant:e});return r?i[t]:t}))}function Jc(e,t={}){const n=t.size??vs(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a}=Kc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Sa(ha,{stringValues:i.filter((e=>"string"==typeof e))});return Xa(n,(e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?Gc(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 Sa(ia,{discriminator:t,formattedValidDiscriminators:Hc(e),validDiscriminators:e})}return i[n]}))}var Yc;function Qc(e,t){return Xa(Lc([...t,e]),(e=>e[e.length-1]))}function Xc(e,t,n={}){return Xa(Cc(Lc([e,t]),n),(e=>new Map(e)))}function eu(){return Ba({fixedSize:0,write:(e,t,n)=>n})}function tu(){return Oa({fixedSize:0,read:(e,t)=>[void 0,t]})}function nu(e){const t=e.map((([,e])=>e)),n=Tc(t.map(Ic)),r=Tc(t.map(xc))??void 0;return Ba({...null===n?{getSizeFromValue:t=>e.map((([e,n])=>Na(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 ru(e){const t=e.map((([,e])=>e)),n=Tc(t.map(Ic)),r=Tc(t.map(xc))??void 0;return Oa({...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 ou(){return Yc||(Yc=Os()),Yc}function iu(e){if(e.length<32||e.length>44)throw new Sa(Vo,{actualLength:e.length});const t=ou().encode(e).byteLength;if(32!==t)throw new Sa(Ko,{actualLength:t})}function au(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new Sa(ya,{unexpectedValue:e})}}var su=18446744073709551615n;function cu(e){return function(e){if(e<0||e>su)throw new Sa(Go)}(e),e}function uu(e,...t){return t.reduce(((e,t)=>t(e)),e)}function lu(e){if(!("lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight))return!1;try{return iu(e.lifetimeConstraint.blockhash),!0}catch{return!1}}function du(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 fu=e=>Ba({getSizeFromValue:t=>{const[n,r]=pu(t,e[0]);if(!r)return t.length;const o=gu(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 Sa(ca,{alphabet:e,base:e.length,value:n})}(e,t),""===t)return r;const[o,i]=pu(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=gu(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}}),hu=e=>Oa({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 pu(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function gu(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 mu,yu,vu,wu,Au,bu,Su="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Eu=()=>fu(Su),ku=()=>hu(Su);function Tu(){return vu||(vu=ys()),vu}function Iu(){return wu||(wu=vs()),wu}var xu=128;function _u(){return Ba({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,n)=>{if("legacy"===e)return n;if(e<0||e>127)throw new Sa(zi,{actualVersion:e});return t.set([e|xu],n),n+1}})}function Cu(){return Oa({maxSize:1,read:(e,t)=>{const n=e[t];if(0==(n&xu))return["legacy",t];return[n^xu,t+1]}})}function Ru(){return nu(Nu())}function Pu(){return Qa(nu([...Nu(),["addressTableLookups",_c((mu||(mu=nu([["lookupTableAddress",ec()],["writableIndices",_c(ys(),{size:ls()})],["readableIndices",_c(ys(),{size:ls()})]])),mu),{size:ls()})]]),(e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]}))}function Nu(){return[["version",_u()],["header",nu([["numSignerAccounts",Tu()],["numReadonlySignerAccounts",Tu()],["numReadonlyNonSignerAccounts",Tu()]])],["staticAccounts",_c(ec(),{size:ls()})],["lifetimeToken",qa(Eu(),32)],["instructions",_c((Au||(Au=Qa(nu([["programAddressIndex",ys()],["accountIndices",_c(ys(),{size:ls()})],["data",Fa(Bc(),ls())]]),(e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)}))),Au),{size:ls()})]]}function Bu(){return Ba({getSizeFromValue:e=>"legacy"===e.version?Ru().getSizeFromValue(e):Pu().getSizeFromValue(e),write:(e,t,n)=>"legacy"===e.version?Ru().write(e,t,n):Pu().write(e,t,n)})}function Ou(){return Xa(ru([["version",Cu()],["header",ru([["numSignerAccounts",Iu()],["numReadonlySignerAccounts",Iu()],["numReadonlyNonSignerAccounts",Iu()]])],["staticAccounts",Cc(tc(),{size:ds()})],["lifetimeToken",Wa(ku(),32)],["instructions",Cc((bu||(bu=Xa(ru([["programAddressIndex",vs()],["accountIndices",Cc(vs(),{size:ds()})],["data",$a(Oc(),ds())]]),(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}}))),bu),{size:ds()})],["addressTableLookups",Cc((yu||(yu=ru([["lookupTableAddress",tc()],["writableIndices",Cc(vs(),{size:ds()})],["readableIndices",Cc(vs(),{size:ds()})]])),yu),{size:ds()})]]),(({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t))}function Mu(e,t,n){e[t]=n(e[t]??{role:As.READONLY})}var zu=Symbol("AddressMapTypeProperty");function Uu(e){const t={};for(const n of e){if(!("lookupTableAddress"in n))continue;const e=t[n.lookupTableAddress]||={readableIndices:[],writableIndices:[]};n.role===As.WRITABLE?e.writableIndices.push(n.addressIndex):e.readableIndices.push(n.addressIndex)}return Object.keys(t).sort(rc()).map((e=>({lookupTableAddress:e,...t[e]})))}function ju(e){let t=0,n=0,r=0;for(const o of e){if("lookupTableAddress"in o)break;const e=ks(o.role);Es(o.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Lu(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 Du(e){const t=e.findIndex((e=>"lookupTableAddress"in e));return(-1===t?e:e.slice(0,t)).map((({address:e})=>e))}function Fu(e){const t=function(e){let t;const n=Object.entries(e).sort((([e,n],[r,o])=>{if(n[zu]!==o[zu]){if(0===n[zu])return-1;if(0===o[zu])return 1;if(2===n[zu])return-1;if(2===o[zu])return 1}const i=Es(n.role);if(i!==Es(o.role))return i?-1:1;const a=ks(n.role);return a!==ks(o.role)?a?-1:1:(t||=rc(),1===n[zu]&&1===o[zu]&&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]:{[zu]:0,role:As.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(Mu(n,e.programAddress,(t=>{if(r.add(e.programAddress),zu in t){if(ks(t.role)){if(0===t[zu])throw new Sa(Oi,{programAddress:e.programAddress});throw new Sa(Mi,{programAddress:e.programAddress})}if(2===t[zu])return t}return{[zu]:2,role:As.READONLY}})),e.accounts)for(const o of e.accounts)Mu(n,o.address,(e=>{const{address:n,...i}=o;if(zu in e)switch(e[zu]){case 0:return e;case 1:{const n=Ts(e.role,i.role);if("lookupTableAddress"in i){if(e.lookupTableAddress!==i.lookupTableAddress&&(t||=rc())(i.lookupTableAddress,e.lookupTableAddress)<0)return{[zu]:1,...i,role:n}}else if(Es(i.role))return{[zu]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=Ts(e.role,i.role);if(r.has(o.address)){if(ks(i.role))throw new Sa(Mi,{programAddress:o.address});return e.role!==t?{...e,role:t}:e}return"lookupTableAddress"in i&&!Es(e.role)?{...i,[zu]:1,role:t}:e.role!==t?{...e,role:t}:e}}return"lookupTableAddress"in i?{...i,[zu]:1}:{...i,[zu]:2}}))}return n}(e.feePayer.address,e.instructions));return{..."legacy"!==e.version?{addressTableLookups:Uu(t)}:null,header:ju(t),instructions:Lu(e.instructions,t),lifetimeToken:(n=e.lifetimeConstraint,"nonce"in n?n.nonce:n.blockhash),staticAccounts:Du(t),version:e.version};var n}function $u({version:e}){return Object.freeze({instructions:Object.freeze([]),version:e})}var qu,Wu="SysvarRecentB1ockHashes11111111111111111111",Vu="11111111111111111111111111111111";function Ku(e,t){return{accounts:[{address:e,role:As.WRITABLE},{address:Wu,role:As.READONLY},{address:t,role:As.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Vu}}function Gu(e){return e.programAddress===Vu&&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===As.WRITABLE&&e.accounts[1].address===Wu&&e.accounts[1].role===As.READONLY&&null!=e.accounts[2].address&&Es(e.accounts[2].role);var t}function Hu(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&Gu(e.instructions[0])}function Zu(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 Ju(e,t){return Yu([e],t)}function Yu(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Qu(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Xu(e,t){const n=e.staticAccounts[0];if(!n)throw new Sa(Di);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:As.WRITABLE_SIGNER}),i++;for(let n=0;n<t.numReadonlySignerAccounts;n++)o.push({address:e.staticAccounts[i],role:As.READONLY_SIGNER}),i++;for(let t=0;t<r;t++)o.push({address:e.staticAccounts[i],role:As.WRITABLE}),i++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)o.push({address:e.staticAccounts[i],role:As.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 Sa(Ui,{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 Sa(ji,{highestKnownIndex:e.length-1,highestRequestedIndex:i,lookupTableAddress:n.lookupTableAddress});const a=n.readableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:As.READONLY})));r.push(...a);const s=n.writableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:As.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 Sa(Li,{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&&Gu(t)){const n=t.accounts[0].address;Qs(n);const r=t.accounts[2].address;return Qs(r),{nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}(e.lifetimeToken,i,t?.lastValidBlockHeight);return uu($u({version:e.version}),(e=>Zu(n,e)),(e=>o.reduce(((e,t)=>Ju(t,e)),e)),(e=>"blockhash"in a?du(a,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o;const i=r.instructions[0];if(i&&Gu(i))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(i,t,n)){if(Hu(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)]}else o=[Object.freeze(Ku(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Ku(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}(a,e)))}function el(e){const t=Object.values(e);if(0===t.length)throw new Sa(Wi);return t.map((e=>e||new Uint8Array(64).fill(0)))}function tl(){return nu([["signatures",Qa(_c(qa(Bc(),64),{size:ls()}),el)],["messageBytes",Bc()]])}function nl(){return Xa(ru([["signatures",Cc(Wa(Oc(),64),{size:ds()})],["messageBytes",Oc()]]),rl)}function rl(e){const{messageBytes:t,signatures:n}=e,r=Lc([Cu(),Ya(vs(),2),Cc(tc(),{size:ds()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new Sa(Vi,{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 ol(e){const t=Fu(e),n=Bu().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(const e of r)o[e]=null;let i;i=lu(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 il(e){qu||(qu=Ms());const t=Object.values(e.signatures)[0];if(!t)throw new Sa($i);return qu.decode(t)}async function al(e,t){let n,r;if(await Promise.all(e.map((async e=>{const o=await mc(e.publicKey),i=t.signatures[o];if(void 0===i)return r||=new Set,void r.add(o);if(r)return;const a=await Ac(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 Sa(qi,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function sl(e){const t=[];if(Object.entries(e.signatures).forEach((([e,n])=>{n||t.push(e)})),t.length>0)throw new Sa(Fi,{addresses:t})}function cl(e){const t=tl().encode(e);return Fs().decode(t)}function ul(e){const t={};return e.forEach((e=>{if(t[e.address]){if(t[e.address]!==e)throw new Sa(Bi,{address:e.address})}else t[e.address]=e})),Object.values(t)}function ll(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function dl(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function fl(e){return"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function hl(e){return dl(e)||ll(e)||fl(e)}function pl(e){return ul((e.accounts??[]).flatMap((e=>"signer"in e?e.signer:[])))}function gl(e){return ul([...e.feePayer&&hl(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(pl)])}function ml(e,t){const n=(r=t)&&"feePayer"in r&&r.feePayer&&"string"==typeof r.feePayer.address&&!hl(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(ul(e).map((e=>[e.address,e])));return Object.freeze({...t,accounts:t.accounts.map((e=>{const t=n.get(e.address);return Es(e.role)&&!("signer"in e)&&t?Object.freeze({...e,signer:t}):e}))})}(e,t)))}):t}async function yl(e){const t=await mc(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map((async n=>Object.freeze({[t]:await Ac(e.privateKey,n.content)})))),signTransactions:n=>Promise.all(n.map((async n=>{const r=await al([e],n);return Object.freeze({[t]:r.signatures[t]})})))};return Object.freeze(n)}async function vl(e,t){return await yl(await Ec(e,t))}function wl(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 Al(e,t){const{partialSigners:n,modifyingSigners:r}=bl(ul(gl(e).filter(hl)),{identifySendingSigner:!1});return await Sl(e,r,n,t)}function bl(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(fl);if(0===t.length)return null;const n=t.filter((e=>!ll(e)&&!dl(e)));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter((e=>e!==n&&(ll(e)||dl(e)))),o=function(e){const t=e.filter(ll);if(0===t.length)return[];const n=t.filter((e=>!dl(e)));return n.length>0?n:[t[0]]}(r),i=r.filter(dl).filter((e=>!o.includes(e)));return Object.freeze({modifyingSigners:o,partialSigners:i,sendingSigner:n})}async function Sl(e,t=[],n=[],r){const o=ol(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 El=globalThis.TextEncoder;var kl,Tl=((kl=Tl||{})[kl.Uninitialized=0]="Uninitialized",kl[kl.Initialized=1]="Initialized",kl);var Il,xl=((Il=xl||{})[Il.Legacy=0]="Legacy",Il[Il.Current=1]="Current",Il);var _l,Cl,Rl="11111111111111111111111111111111",Pl=((_l=Pl||{})[_l.Nonce=0]="Nonce",_l),Nl=((Cl=Nl||{})[Cl.CreateAccount=0]="CreateAccount",Cl[Cl.Assign=1]="Assign",Cl[Cl.TransferSol=2]="TransferSol",Cl[Cl.CreateAccountWithSeed=3]="CreateAccountWithSeed",Cl[Cl.AdvanceNonceAccount=4]="AdvanceNonceAccount",Cl[Cl.WithdrawNonceAccount=5]="WithdrawNonceAccount",Cl[Cl.InitializeNonceAccount=6]="InitializeNonceAccount",Cl[Cl.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",Cl[Cl.Allocate=8]="Allocate",Cl[Cl.AllocateWithSeed=9]="AllocateWithSeed",Cl[Cl.AssignWithSeed=10]="AssignWithSeed",Cl[Cl.TransferSolWithSeed=11]="TransferSolWithSeed",Cl[Cl.UpgradeNonceAccount=12]="UpgradeNonceAccount",Cl);function Bl(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 Ol(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:As.READONLY});const n=t.isWritable?As.WRITABLE:As.READONLY;return Object.freeze({address:Bl(t.value),role:Ml(t.value)?Is(n):n,...Ml(t.value)?{signer:t.value}:{}})}}function Ml(e){return!!e&&"object"==typeof e&&"address"in e&&hl(e)}function zl(){return ru([["discriminator",ps()]])}function Ul(){return ru([["discriminator",ps()],["space",ms()]])}function jl(){return ru([["discriminator",ps()],["base",tc()],["seed",$a(Ks(),ms())],["space",ms()],["programAddress",tc()]])}function Ll(){return ru([["discriminator",ps()],["programAddress",tc()]])}function Dl(){return ru([["discriminator",ps()],["base",tc()],["seed",$a(Ks(),ms())],["programAddress",tc()]])}function Fl(){return ru([["discriminator",ps()],["newNonceAuthority",tc()]])}function $l(){return ru([["discriminator",ps()],["lamports",ms()],["space",ms()],["programAddress",tc()]])}function ql(){return ru([["discriminator",ps()],["base",tc()],["seed",$a(Ks(),ms())],["amount",ms()],["space",ms()],["programAddress",tc()]])}function Wl(){return ru([["discriminator",ps()],["nonceAuthority",tc()]])}var Vl=2;function Kl(){return Qa(nu([["discriminator",hs()],["amount",gs()]]),(e=>({...e,discriminator:Vl})))}function Gl(){return ru([["discriminator",ps()],["amount",ms()]])}function Hl(){return ru([["discriminator",ps()],["amount",ms()],["fromSeed",$a(Ks(),ms())],["fromOwner",tc()]])}function Zl(){return ru([["discriminator",ps()]])}function Jl(){return ru([["discriminator",ps()],["withdrawAmount",ms()]])}const Yl={log:(console.log,(...e)=>{}),info:(console.info,(...e)=>{}),warn:(console.warn,(...e)=>{}),debug:(console.debug,(...e)=>{}),error:(console.error,(...e)=>{})};const Ql={log:()=>{},info:()=>{},warn:()=>{},debug:()=>{},error:()=>{}},Xl=(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}}),ed=Yl;const td=(e,t)=>`${e}:${t.map((e=>JSON.stringify(e))).join(":")}`,nd=(e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:o})=>{const i=o??td,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){ed.error(`Cache get error for key "${o}":`,e)}const s=await e(...r);return t.set(o,s,n).catch((e=>{ed.error(`Cache set error for key "${o}":`,e)})),s}},rd=1000000n,od=1e9,id="metamask";var ad=function(e){return e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",e.Localnet="solana:123456789abcdef",e}({}),sd=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}({});ge(re(),/^solana:[a-zA-Z0-9]+\/slip44:501$/u);const cd=ge(re(),/^solana:[a-zA-Z0-9]+\/token:[a-zA-Z0-9]+$/u),ud=(ge(re(),/^solana:[a-zA-Z0-9]+\/nft:[a-zA-Z0-9]+$/u),L("TokenCaipAssetTypeFromString",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;const[t]=cd.validate(e);return t||!0})));var ld=function(e){return e.SOL="slip44:501",e}({});const dd={"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}},fd={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":{caip2Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",cluster:"mainnet",name:"Solana Mainnet",nativeToken:dd["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501"]},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":{caip2Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",cluster:"devnet",name:"Solana Devnet",nativeToken:dd["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501"]},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":{caip2Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",cluster:"testnet",name:"Solana Testnet",nativeToken:dd["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501"]},"solana:123456789abcdef":{caip2Id:"solana:123456789abcdef",cluster:"local",name:"Solana Localnet",nativeToken:dd["solana:123456789abcdef/slip44:501"]}},hd=ge(re(),/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),pd=ge(re(),/^(?!0\d)(\d+(\.\d+)?)$/u),gd=me(re(),"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"}})),md=ee({accountId:hd}),yd=ee({accountId:hd}),vd=ee({accountId:hd}),wd=ee({accountId:hd,assets:K(it)}),Ad=ee({accountId:hd,pagination:ee({limit:Z(),next:te(Q(re()))})}),bd=ne(it,ee({amount:pd,unit:re()})),Sd=(K(it),H(Object.values($t)),H(Object.values(ad))),Ed=(H(["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"]),ee({transaction:re(),scope:H(Object.values(ad))})),kd=ee({value:Q(pd)}),Td=L("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")),Id=ge(re(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),xd=ge(re(),/^m\/44'\/501'/u),_d=(ge(re(),/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/u),L("SolanaAddress",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;try{return Xs(e),!0}catch(e){return"Invalid Solana address"}})));function Cd(e){return e&&"string"==typeof e?e.replace(/[\u0000-\u0008\u000A-\u001F\u007F]/gu,""):""}function Rd(e,t=1e3){if(!e||"string"!=typeof e)return"";let n=Cd(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function Pd(e){if(!e||"string"!=typeof e)return"";const t=Cd(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?"":t:""}function Nd(e){if(!e||"string"!=typeof e)return"";const t=Cd(e);try{const e=new URL(t);return["http:","https:","wss:","ipfs:"].includes(e.protocol)?t.length>2048?"":t:""}catch{return""}}function Bd(e){const{baseUrl:t,path:n,pathParams:r,queryParams:o,encodePathParams:i=!0}=e,a=Nd(t);if(""===a)throw new Error("Invalid URL format");M(a,gd);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=Cd(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=Cd(t);c.searchParams.append(e,n)}}));const u=c.toString();return M(u,gd),u}var Od=n(5250);const Md=ae([H(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","bits","sats","sol","sei","sonic"]),H(["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"]),H(["xag","xau"])]),zd=ee({id:re(),price:he(X(),0),marketCap:te(Q(he(X(),0))),allTimeHigh:te(Q(he(X(),0))),allTimeLow:te(Q(he(X(),0))),totalVolume:te(Q(he(X(),0))),high1d:te(Q(he(X(),0))),low1d:te(Q(he(X(),0))),circulatingSupply:te(Q(he(X(),0))),dilutedMarketCap:te(Q(he(X(),0))),marketCapPercentChange1d:te(Q(X())),priceChange1d:te(Q(X())),pricePercentChange1h:te(Q(X())),pricePercentChange1d:te(Q(X())),pricePercentChange7d:te(Q(X())),pricePercentChange14d:te(Q(X())),pricePercentChange30d:te(Q(X())),pricePercentChange200d:te(Q(X())),pricePercentChange1y:te(Q(X())),bondingCurveProgressPercent:te(Q(X())),liquidity:te(Q(X())),totalSupply:te(Q(X())),holderCount:te(Q(X())),isMutable:te(Q(G()))}),Ud=ne(Lo,Q(zd)),jd=Md,Ld=ee({assetType:Lo,timePeriod:te(ge(re(),/^[1-9][0-9]*[dmy]$/u)),from:te(he(X(),0)),to:te(he(X(),0)),vsCurrency:te(jd)}),Dd=ee({prices:K(oe([X(),X()])),marketCaps:K(oe([X(),X()])),totalVolumes:K(oe([X(),X()]))}),Fd={prices:[],marketCaps:[],totalVolumes:[]};const $d=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 qd=$d("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Wd=n(1048).hp;const Vd={[ad.Mainnet]:"mainnet",[ad.Devnet]:"devnet",[ad.Testnet]:"testnet",[ad.Localnet]:"localnet"};const Kd=K(ee({decimals:Z(),assetId:ud,name:te(re()),symbol:te(re()),iconUrl:te(gd)})),Gd={name:"UNKNOWN",symbol:"UNKNOWN",fungible:!0,iconUrl:"",units:[{name:"UNKNOWN",symbol:"UNKNOWN",decimals:9}]};class Hd{#o;#i;#a;#s;#c;static supportedNetworks=[ad.Mainnet,ad.Devnet];constructor(e,t=globalThis.fetch,n=ed){this.#o=t,this.#i=n;const{tokenApi:r,staticApi:o}=e.get(),{baseUrl:i,chunkSize:a}=r;M(i,gd),this.#a=i,this.#s=a,this.#c=o.baseUrl}async#u(e){M(e,K(cd));const t=Bd({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 M(r,Kd),r}async getTokensMetadata(e){try{M(e,K(Lo));const t=e.filter((e=>{const{chainId:t}=Fo(e);return Hd.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: ${Hd.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;return e.forEach((e=>{const t=r.find((t=>t.assetId===e));if(!t)return this.#i.warn(`No metadata for ${e}. Returning default values.`),void o.set(e,Gd);const n=t.name??Gd.name,i=t.symbol??Gd.symbol,a=t.decimals??9,s={name:n,symbol:i,fungible:!0,iconUrl:t.iconUrl??Bd({baseUrl:this.#c,path:"/api/v2/tokenIcons/assets/{assetType}.png",pathParams:{assetType:e.replace(/:/gu,"/")},encodePathParams:!1}),units:[{name:n,symbol:i,decimals:a}]};o.set(e,s)})),Object.fromEntries(o)}catch(e){throw this.#i.error(e,"Error fetching token metadata"),e}}}var Zd,Jd="ComputeBudget111111111111111111111111111111",Yd=((Zd=Yd||{})[Zd.RequestUnits=0]="RequestUnits",Zd[Zd.RequestHeapFrame=1]="RequestHeapFrame",Zd[Zd.SetComputeUnitLimit=2]="SetComputeUnitLimit",Zd[Zd.SetComputeUnitPrice=3]="SetComputeUnitPrice",Zd[Zd.SetLoadedAccountsDataSizeLimit=4]="SetLoadedAccountsDataSizeLimit",Zd);function Qd(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;if(Pa(t,ys().encode(3),0))return 3;if(Pa(t,ys().encode(4),0))return 4;throw new Error("The provided instruction could not be identified as a computeBudget instruction.")}function Xd(){return ru([["discriminator",vs()],["bytes",ps()]])}function ef(){return ru([["discriminator",vs()],["units",ps()],["additionalFee",ps()]])}var tf=2;function nf(){return Qa(nu([["discriminator",ys()],["units",hs()]]),(e=>({...e,discriminator:tf})))}function rf(){return ru([["discriminator",vs()],["units",ps()]])}function of(e,t){const n={...e};return{programAddress:t?.programAddress??Jd,data:nf().encode(n)}}function af(e){return{programAddress:e.programAddress,data:rf().decode(e.data)}}var sf=3;function cf(){return Qa(nu([["discriminator",ys()],["microLamports",gs()]]),(e=>({...e,discriminator:sf})))}function uf(){return ru([["discriminator",vs()],["microLamports",ms()]])}function lf(e,t){const n={...e};return{programAddress:t?.programAddress??Jd,data:cf().encode(n)}}function df(e){return{programAddress:e.programAddress,data:uf().decode(e.data)}}function ff(){return ru([["discriminator",vs()],["accountDataSizeLimit",ps()]])}var hf=e=>({__option:"Some",value:e}),pf=()=>({__option:"None"}),gf=e=>!!(e&&"object"==typeof e&&"__option"in e&&("Some"===e.__option&&"value"in e||"None"===e.__option)),mf=e=>"Some"===e.__option;var yf=e=>null!==e?hf(e):pf();function vf(e,t={}){const n=null===t.prefix?Qa(eu(),(e=>{})):Pc({size:t.prefix??ys()});return Dc([Qa(jc([n,"zeroes"===t.noneValue?(za(e),qa(eu(),e.fixedSize)):t.noneValue?zc(t.noneValue):eu()]),(e=>[!1,void 0])),Qa(jc([n,e]),(e=>[!0,gf(e)&&mf(e)?e.value:e]))],(e=>{const t=gf(e)?e:yf(e);return Number(mf(t))}))}function wf(e,t={}){const n=null===t.prefix?Xa(tu(),(()=>!1)):Nc({size:t.prefix??vs()}),r="zeroes"===t.noneValue?(za(e),Wa(tu(),e.fixedSize)):t.noneValue?Uc(t.noneValue):tu();return Fc([Xa(Lc([n,r]),(()=>pf())),Xa(Lc([n,e]),(([,e])=>hf(e)))],((e,o)=>{if(null===t.prefix&&!t.noneValue)return Number(o<e.length);if(null===t.prefix&&null!=t.noneValue){return Pa(e,"zeroes"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,o)?0:1}return Number(n.read(e,o)[0])}))}var Af,bf=((Af=bf||{})[Af.Uninitialized=0]="Uninitialized",Af[Af.Initialized=1]="Initialized",Af[Af.Frozen=2]="Frozen",Af);var Sf,Ef=((Sf=Ef||{})[Sf.MintTokens=0]="MintTokens",Sf[Sf.FreezeAccount=1]="FreezeAccount",Sf[Sf.AccountOwner=2]="AccountOwner",Sf[Sf.CloseAccount=3]="CloseAccount",Sf);function kf(){return Jc(Ef)}var Tf,If="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",xf=((Tf=xf||{})[Tf.CreateAssociatedToken=0]="CreateAssociatedToken",Tf[Tf.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",Tf[Tf.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",Tf);var _f,Cf="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Rf=((_f=Rf||{})[_f.Mint=0]="Mint",_f[_f.Token=1]="Token",_f[_f.Multisig=2]="Multisig",_f);var Pf,Nf=((Pf=Nf||{})[Pf.InitializeMint=0]="InitializeMint",Pf[Pf.InitializeAccount=1]="InitializeAccount",Pf[Pf.InitializeMultisig=2]="InitializeMultisig",Pf[Pf.Transfer=3]="Transfer",Pf[Pf.Approve=4]="Approve",Pf[Pf.Revoke=5]="Revoke",Pf[Pf.SetAuthority=6]="SetAuthority",Pf[Pf.MintTo=7]="MintTo",Pf[Pf.Burn=8]="Burn",Pf[Pf.CloseAccount=9]="CloseAccount",Pf[Pf.FreezeAccount=10]="FreezeAccount",Pf[Pf.ThawAccount=11]="ThawAccount",Pf[Pf.TransferChecked=12]="TransferChecked",Pf[Pf.ApproveChecked=13]="ApproveChecked",Pf[Pf.MintToChecked=14]="MintToChecked",Pf[Pf.BurnChecked=15]="BurnChecked",Pf[Pf.InitializeAccount2=16]="InitializeAccount2",Pf[Pf.SyncNative=17]="SyncNative",Pf[Pf.InitializeAccount3=18]="InitializeAccount3",Pf[Pf.InitializeMultisig2=19]="InitializeMultisig2",Pf[Pf.InitializeMint2=20]="InitializeMint2",Pf[Pf.GetAccountDataSize=21]="GetAccountDataSize",Pf[Pf.InitializeImmutableOwner=22]="InitializeImmutableOwner",Pf[Pf.AmountToUiAmount=23]="AmountToUiAmount",Pf[Pf.UiAmountToAmount=24]="UiAmountToAmount",Pf);function Bf(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 Of(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:As.READONLY});const n=t.isWritable?As.WRITABLE:As.READONLY;return Object.freeze({address:Bf(t.value),role:Mf(t.value)?Is(n):n,...Mf(t.value)?{signer:t.value}:{}})}}function Mf(e){return!!e&&"object"==typeof e&&"address"in e&&hl(e)}function zf(){return ru([["discriminator",vs()],["amount",ms()]])}function Uf(){return ru([["discriminator",vs()],["amount",ms()]])}function jf(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Lf(){return ru([["discriminator",vs()],["amount",ms()]])}function Df(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Ff(){return ru([["discriminator",vs()]])}async function $f(e,t={}){const{programAddress:n="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=t;return await gc({programAddress:n,seeds:[ec().encode(e.owner),ec().encode(e.tokenProgram),ec().encode(e.mint)]})}var qf=1;function Wf(){return Qa(nu([["discriminator",ys()]]),(e=>({...e,discriminator:qf})))}function Vf(e,t){const n=t?.programAddress??If,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=Of(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:Wf().encode({})}}function Kf(){return ru([["discriminator",vs()]])}function Gf(){return ru([["discriminator",vs()]])}function Hf(){return ru([["discriminator",vs()]])}function Zf(){return ru([["discriminator",vs()],["owner",tc()]])}function Jf(){return ru([["discriminator",vs()],["owner",tc()]])}function Yf(){return ru([["discriminator",vs()]])}function Qf(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function Xf(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function eh(){return ru([["discriminator",vs()],["m",vs()]])}function th(){return ru([["discriminator",vs()],["m",vs()]])}function nh(){return ru([["discriminator",vs()],["amount",ms()]])}function rh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function oh(){return ru([["discriminator",vs()]])}function ih(){return ru([["discriminator",vs()],["authorityType",kf()],["newAuthority",wf(tc())]])}function ah(){return ru([["discriminator",vs()]])}function sh(){return ru([["discriminator",vs()]])}function ch(){return ru([["discriminator",vs()],["amount",ms()]])}var uh=12;function lh(){return Qa(nu([["discriminator",ys()],["amount",gs()],["decimals",ys()]]),(e=>({...e,discriminator:uh})))}function dh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function fh(e,t){const n=t?.programAddress??Cf,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:As.READONLY_SIGNER,signer:e}))),a=Of(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:lh().encode(o)}}function hh(){return ru([["discriminator",vs()],["uiAmount",Ks()]])}function ph(e){return!("exists"in e)||"exists"in e&&e.exists}function gh(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Ds().encode(t.data[0]);return Object.freeze({...yh(t),address:e,data:n,exists:!0})}function mh(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info;return Object.freeze({...yh(t),address:e,data:n,exists:!0})}function yh(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function vh(e,t,n={}){const{abortSignal:r,...o}=n;return gh(t,(await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r})).value)}async function wh(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map(((e,n)=>gh(t[n],e)))}var Ah=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Ah||{});function bh(){return Jc(Ah)}var Sh=(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))(Sh||{});function Eh(){return Jc(Sh)}function kh(){return Wa(Oc(),36)}function Th(){return Wa(Oc(),64)}function Ih(){return Vc([["Uninitialized",tu()],["TransferFeeConfig",$a(ru([["transferFeeConfigAuthority",tc()],["withdrawWithheldAuthority",tc()],["withheldAmount",ms()],["olderTransferFee",Ph()],["newerTransferFee",Ph()]]),fs())],["TransferFeeAmount",$a(ru([["withheldAmount",ms()]]),fs())],["MintCloseAuthority",$a(ru([["closeAuthority",tc()]]),fs())],["ConfidentialTransferMint",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Nc()],["auditorElgamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["ConfidentialTransferAccount",$a(ru([["approved",Nc()],["elgamalPubkey",tc()],["pendingBalanceLow",Th()],["pendingBalanceHigh",Th()],["availableBalance",Th()],["decryptableAvailableBalance",kh()],["allowConfidentialCredits",Nc()],["allowNonConfidentialCredits",Nc()],["pendingBalanceCreditCounter",ms()],["maximumPendingBalanceCreditCounter",ms()],["expectedPendingBalanceCreditCounter",ms()],["actualPendingBalanceCreditCounter",ms()]]),fs())],["DefaultAccountState",$a(ru([["state",bh()]]),fs())],["ImmutableOwner",$a(ru([]),fs())],["MemoTransfer",$a(ru([["requireIncomingTransferMemos",Nc()]]),fs())],["NonTransferable",$a(ru([]),fs())],["InterestBearingConfig",$a(ru([["rateAuthority",tc()],["initializationTimestamp",ms()],["preUpdateAverageRate",ss()],["lastUpdateTimestamp",ms()],["currentRate",ss()]]),fs())],["CpiGuard",$a(ru([["lockCpi",Nc()]]),fs())],["PermanentDelegate",$a(ru([["delegate",tc()]]),fs())],["NonTransferableAccount",$a(ru([]),fs())],["TransferHook",$a(ru([["authority",tc()],["programId",tc()]]),fs())],["TransferHookAccount",$a(ru([["transferring",Nc()]]),fs())],["ConfidentialTransferFee",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["elgamalPubkey",tc()],["harvestToMintEnabled",Nc()],["withheldAmount",Th()]]),fs())],["ConfidentialTransferFeeAmount",$a(ru([["withheldAmount",Th()]]),fs())],["MetadataPointer",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["TokenMetadata",$a(ru([["updateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["mint",tc()],["name",$a(Ks(),ps())],["symbol",$a(Ks(),ps())],["uri",$a(Ks(),ps())],["additionalMetadata",Xc($a(Ks(),ps()),$a(Ks(),ps()))]]),fs())],["GroupPointer",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["groupAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["TokenGroup",$a(ru([["updateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["mint",tc()],["size",ms()],["maxSize",ms()]]),fs())],["GroupMemberPointer",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["memberAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]]),fs())],["TokenGroupMember",$a(ru([["mint",tc()],["group",tc()],["memberNumber",ms()]]),fs())],["ConfidentialMintBurn",tu()],["ScaledUiAmountConfig",$a(ru([["authority",tc()],["multiplier",as()],["newMultiplierEffectiveTimestamp",ms()],["newMultiplier",as()]]),fs())],["PausableConfig",$a(ru([["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["paused",Nc()]]),fs())],["PausableAccount",tu()]],{size:fs()})}var xh,_h=((xh=_h||{})[xh.Uninitialized=0]="Uninitialized",xh[xh.TransferFeeConfig=1]="TransferFeeConfig",xh[xh.TransferFeeAmount=2]="TransferFeeAmount",xh[xh.MintCloseAuthority=3]="MintCloseAuthority",xh[xh.ConfidentialTransferMint=4]="ConfidentialTransferMint",xh[xh.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",xh[xh.DefaultAccountState=6]="DefaultAccountState",xh[xh.ImmutableOwner=7]="ImmutableOwner",xh[xh.MemoTransfer=8]="MemoTransfer",xh[xh.NonTransferable=9]="NonTransferable",xh[xh.InterestBearingConfig=10]="InterestBearingConfig",xh[xh.CpiGuard=11]="CpiGuard",xh[xh.PermanentDelegate=12]="PermanentDelegate",xh[xh.NonTransferableAccount=13]="NonTransferableAccount",xh[xh.TransferHook=14]="TransferHook",xh[xh.TransferHookAccount=15]="TransferHookAccount",xh[xh.ConfidentialTransferFee=16]="ConfidentialTransferFee",xh[xh.ConfidentialTransferFeeAmount=17]="ConfidentialTransferFeeAmount",xh[xh.ScaledUiAmountConfig=18]="ScaledUiAmountConfig",xh[xh.PausableConfig=19]="PausableConfig",xh[xh.PausableAccount=20]="PausableAccount",xh[xh.MetadataPointer=21]="MetadataPointer",xh[xh.TokenMetadata=22]="TokenMetadata",xh[xh.GroupPointer=23]="GroupPointer",xh[xh.TokenGroup=24]="TokenGroup",xh[xh.GroupMemberPointer=25]="GroupMemberPointer",xh[xh.TokenGroupMember=26]="TokenGroupMember",xh);function Ch(){return Jc(_h,{size:fs()})}function Rh(){return Vc([["Name",tu()],["Symbol",tu()],["Uri",tu()],["Key",ru([["fields",Lc([$a(Ks(),ps())])]])]])}function Ph(){return ru([["epoch",ms()],["maximumFee",ms()],["transferFeeBasisPoints",fs()]])}function Nh(){return ru([["mintAuthority",wf(tc(),{prefix:ps(),noneValue:"zeroes"})],["supply",ms()],["decimals",vs()],["isInitialized",Nc()],["freezeAuthority",wf(tc(),{prefix:ps(),noneValue:"zeroes"})],["extensions",wf(Qc(Cc(Ih(),{size:"remainder"}),[Uc(Ja(ys(),83).encode(1))]),{prefix:null})]])}function Bh(e){return function(e,t){try{return"exists"in e&&!e.exists?e:Object.freeze({...e,data:t.decode(e.data)})}catch{throw new Sa(wi,{address:e.address})}}(e,Nh())}async function Oh(e,t,n){const r=await async function(e,t,n){const r=await vh(e,t,n);return Bh(r)}(e,t,n);return function(e){if(!e.exists)throw new Sa(yi,{address:e.address})}(r),r}var Mh=(e=>(e[e.CreateAssociatedToken=0]="CreateAssociatedToken",e[e.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",e[e.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",e))(Mh||{});var zh,Uh="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",jh=((zh=jh||{})[zh.Mint=0]="Mint",zh[zh.Token=1]="Token",zh[zh.Multisig=2]="Multisig",zh);var Lh,Dh=((Lh=Dh||{})[Lh.InitializeMint=0]="InitializeMint",Lh[Lh.InitializeAccount=1]="InitializeAccount",Lh[Lh.InitializeMultisig=2]="InitializeMultisig",Lh[Lh.Transfer=3]="Transfer",Lh[Lh.Approve=4]="Approve",Lh[Lh.Revoke=5]="Revoke",Lh[Lh.SetAuthority=6]="SetAuthority",Lh[Lh.MintTo=7]="MintTo",Lh[Lh.Burn=8]="Burn",Lh[Lh.CloseAccount=9]="CloseAccount",Lh[Lh.FreezeAccount=10]="FreezeAccount",Lh[Lh.ThawAccount=11]="ThawAccount",Lh[Lh.TransferChecked=12]="TransferChecked",Lh[Lh.ApproveChecked=13]="ApproveChecked",Lh[Lh.MintToChecked=14]="MintToChecked",Lh[Lh.BurnChecked=15]="BurnChecked",Lh[Lh.InitializeAccount2=16]="InitializeAccount2",Lh[Lh.SyncNative=17]="SyncNative",Lh[Lh.InitializeAccount3=18]="InitializeAccount3",Lh[Lh.InitializeMultisig2=19]="InitializeMultisig2",Lh[Lh.InitializeMint2=20]="InitializeMint2",Lh[Lh.GetAccountDataSize=21]="GetAccountDataSize",Lh[Lh.InitializeImmutableOwner=22]="InitializeImmutableOwner",Lh[Lh.AmountToUiAmount=23]="AmountToUiAmount",Lh[Lh.UiAmountToAmount=24]="UiAmountToAmount",Lh[Lh.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",Lh[Lh.InitializeTransferFeeConfig=26]="InitializeTransferFeeConfig",Lh[Lh.TransferCheckedWithFee=27]="TransferCheckedWithFee",Lh[Lh.WithdrawWithheldTokensFromMint=28]="WithdrawWithheldTokensFromMint",Lh[Lh.WithdrawWithheldTokensFromAccounts=29]="WithdrawWithheldTokensFromAccounts",Lh[Lh.HarvestWithheldTokensToMint=30]="HarvestWithheldTokensToMint",Lh[Lh.SetTransferFee=31]="SetTransferFee",Lh[Lh.InitializeConfidentialTransferMint=32]="InitializeConfidentialTransferMint",Lh[Lh.UpdateConfidentialTransferMint=33]="UpdateConfidentialTransferMint",Lh[Lh.ConfigureConfidentialTransferAccount=34]="ConfigureConfidentialTransferAccount",Lh[Lh.ApproveConfidentialTransferAccount=35]="ApproveConfidentialTransferAccount",Lh[Lh.EmptyConfidentialTransferAccount=36]="EmptyConfidentialTransferAccount",Lh[Lh.ConfidentialDeposit=37]="ConfidentialDeposit",Lh[Lh.ConfidentialWithdraw=38]="ConfidentialWithdraw",Lh[Lh.ConfidentialTransfer=39]="ConfidentialTransfer",Lh[Lh.ApplyConfidentialPendingBalance=40]="ApplyConfidentialPendingBalance",Lh[Lh.EnableConfidentialCredits=41]="EnableConfidentialCredits",Lh[Lh.DisableConfidentialCredits=42]="DisableConfidentialCredits",Lh[Lh.EnableNonConfidentialCredits=43]="EnableNonConfidentialCredits",Lh[Lh.DisableNonConfidentialCredits=44]="DisableNonConfidentialCredits",Lh[Lh.ConfidentialTransferWithFee=45]="ConfidentialTransferWithFee",Lh[Lh.InitializeDefaultAccountState=46]="InitializeDefaultAccountState",Lh[Lh.UpdateDefaultAccountState=47]="UpdateDefaultAccountState",Lh[Lh.Reallocate=48]="Reallocate",Lh[Lh.EnableMemoTransfers=49]="EnableMemoTransfers",Lh[Lh.DisableMemoTransfers=50]="DisableMemoTransfers",Lh[Lh.CreateNativeMint=51]="CreateNativeMint",Lh[Lh.InitializeNonTransferableMint=52]="InitializeNonTransferableMint",Lh[Lh.InitializeInterestBearingMint=53]="InitializeInterestBearingMint",Lh[Lh.UpdateRateInterestBearingMint=54]="UpdateRateInterestBearingMint",Lh[Lh.EnableCpiGuard=55]="EnableCpiGuard",Lh[Lh.DisableCpiGuard=56]="DisableCpiGuard",Lh[Lh.InitializePermanentDelegate=57]="InitializePermanentDelegate",Lh[Lh.InitializeTransferHook=58]="InitializeTransferHook",Lh[Lh.UpdateTransferHook=59]="UpdateTransferHook",Lh[Lh.InitializeConfidentialTransferFee=60]="InitializeConfidentialTransferFee",Lh[Lh.WithdrawWithheldTokensFromMintForConfidentialTransferFee=61]="WithdrawWithheldTokensFromMintForConfidentialTransferFee",Lh[Lh.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=62]="WithdrawWithheldTokensFromAccountsForConfidentialTransferFee",Lh[Lh.HarvestWithheldTokensToMintForConfidentialTransferFee=63]="HarvestWithheldTokensToMintForConfidentialTransferFee",Lh[Lh.EnableHarvestToMint=64]="EnableHarvestToMint",Lh[Lh.DisableHarvestToMint=65]="DisableHarvestToMint",Lh[Lh.WithdrawExcessLamports=66]="WithdrawExcessLamports",Lh[Lh.InitializeMetadataPointer=67]="InitializeMetadataPointer",Lh[Lh.UpdateMetadataPointer=68]="UpdateMetadataPointer",Lh[Lh.InitializeGroupPointer=69]="InitializeGroupPointer",Lh[Lh.UpdateGroupPointer=70]="UpdateGroupPointer",Lh[Lh.InitializeGroupMemberPointer=71]="InitializeGroupMemberPointer",Lh[Lh.UpdateGroupMemberPointer=72]="UpdateGroupMemberPointer",Lh[Lh.InitializeScaledUiAmountMint=73]="InitializeScaledUiAmountMint",Lh[Lh.UpdateMultiplierScaledUiMint=74]="UpdateMultiplierScaledUiMint",Lh[Lh.InitializePausableConfig=75]="InitializePausableConfig",Lh[Lh.Pause=76]="Pause",Lh[Lh.Resume=77]="Resume",Lh[Lh.InitializeTokenMetadata=78]="InitializeTokenMetadata",Lh[Lh.UpdateTokenMetadataField=79]="UpdateTokenMetadataField",Lh[Lh.RemoveTokenMetadataKey=80]="RemoveTokenMetadataKey",Lh[Lh.UpdateTokenMetadataUpdateAuthority=81]="UpdateTokenMetadataUpdateAuthority",Lh[Lh.EmitTokenMetadata=82]="EmitTokenMetadata",Lh[Lh.InitializeTokenGroup=83]="InitializeTokenGroup",Lh[Lh.UpdateTokenGroupMaxSize=84]="UpdateTokenGroupMaxSize",Lh[Lh.UpdateTokenGroupUpdateAuthority=85]="UpdateTokenGroupUpdateAuthority",Lh[Lh.InitializeTokenGroupMember=86]="InitializeTokenGroupMember",Lh);function Fh(){return ru([["discriminator",vs()],["amount",ms()]])}function $h(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["expectedPendingBalanceCreditCounter",ms()],["newDecryptableAvailableBalance",kh()]])}function qh(){return ru([["discriminator",vs()],["amount",ms()]])}function Wh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Vh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function Kh(){return ru([["discriminator",vs()],["amount",ms()]])}function Gh(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Hh(){return ru([["discriminator",vs()]])}function Zh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["amount",ms()],["decimals",vs()]])}function Jh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["newSourceDecryptableAvailableBalance",kh()],["equalityProofInstructionOffset",us()],["ciphertextValidityProofInstructionOffset",us()],["rangeProofInstructionOffset",us()]])}function Yh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["newSourceDecryptableAvailableBalance",kh()],["equalityProofInstructionOffset",us()],["transferAmountCiphertextValidityProofInstructionOffset",us()],["feeSigmaProofInstructionOffset",us()],["feeCiphertextValidityProofInstructionOffset",us()],["rangeProofInstructionOffset",us()]])}function Qh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["amount",ms()],["decimals",vs()],["newDecryptableAvailableBalance",kh()],["equalityProofInstructionOffset",us()],["rangeProofInstructionOffset",us()]])}function Xh(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["decryptableZeroBalance",kh()],["maximumPendingBalanceCreditCounter",ms()],["proofInstructionOffset",us()]])}function ep(){return ru([["discriminator",vs()]])}function tp(){return ru([["discriminator",vs()]])}function np(){return ru([["discriminator",vs()]])}function rp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function op(){return ru([["discriminator",vs()],["cpiGuardDiscriminator",vs()]])}function ip(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()]])}function ap(){return ru([["discriminator",vs()],["memoTransfersDiscriminator",vs()]])}function sp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}new Uint8Array([250,166,180,250,13,12,184,70]);function cp(){return ru([["discriminator",Oc()],["start",wf(ms())],["end",wf(ms())]])}function up(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["proofInstructionOffset",us()]])}function lp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function dp(){return ru([["discriminator",vs()],["cpiGuardDiscriminator",vs()]])}function fp(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()]])}function hp(){return ru([["discriminator",vs()],["memoTransfersDiscriminator",vs()]])}function pp(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()]])}function gp(){return ru([["discriminator",vs()]])}function mp(){return ru([["discriminator",vs()]])}function yp(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()]])}function vp(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()]])}function wp(){return ru([["discriminator",vs()]])}function Ap(){return ru([["discriminator",vs()],["owner",tc()]])}function bp(){return ru([["discriminator",vs()],["owner",tc()]])}function Sp(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["withdrawWithheldAuthorityElGamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Ep(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",Nc()],["auditorElgamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function kp(){return ru([["discriminator",vs()],["defaultAccountStateDiscriminator",vs()],["state",bh()]])}function Tp(){return ru([["discriminator",vs()],["groupMemberPointerDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["memberAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Ip(){return ru([["discriminator",vs()],["groupPointerDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["groupAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function xp(){return ru([["discriminator",vs()]])}function _p(){return ru([["discriminator",vs()],["interestBearingMintDiscriminator",vs()],["rateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["rate",ss()]])}function Cp(){return ru([["discriminator",vs()],["metadataPointerDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Rp(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function Pp(){return ru([["discriminator",vs()],["decimals",vs()],["mintAuthority",tc()],["freezeAuthority",wf(tc())]])}function Np(){return ru([["discriminator",vs()],["closeAuthority",wf(tc())]])}function Bp(){return ru([["discriminator",vs()],["m",vs()]])}function Op(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:Bp().decode(e.data)}}function Mp(){return ru([["discriminator",vs()]])}function zp(){return ru([["discriminator",vs()],["pausableDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Up(){return ru([["discriminator",vs()],["delegate",tc()]])}function jp(){return ru([["discriminator",vs()],["scaledUiAmountMintDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["multiplier",as()]])}new Uint8Array([121,113,108,39,54,51,0,4]);function Lp(){return ru([["discriminator",Oc()],["updateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["maxSize",ms()]])}new Uint8Array([152,32,222,176,223,237,116,134]);function Dp(){return ru([["discriminator",Oc()]])}new Uint8Array([210,225,30,162,88,184,77,141]);function Fp(){return ru([["discriminator",Oc()],["name",$a(Ks(),ps())],["symbol",$a(Ks(),ps())],["uri",$a(Ks(),ps())]])}function $p(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["transferFeeConfigAuthority",wf(tc())],["withdrawWithheldAuthority",wf(tc())],["transferFeeBasisPoints",fs()],["maximumFee",ms()]])}function qp(){return ru([["discriminator",vs()],["transferHookDiscriminator",vs()],["authority",wf(tc(),{prefix:null,noneValue:"zeroes"})],["programId",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function Wp(){return ru([["discriminator",vs()],["amount",ms()]])}function Vp(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function Kp(){return ru([["discriminator",vs()],["pausableDiscriminator",vs()]])}function Gp(){return ru([["discriminator",vs()],["newExtensionTypes",Cc(Ch(),{size:"remainder"})]])}function Hp(){return ru([["discriminator",vs()]])}new Uint8Array([234,18,32,56,89,141,37,181]);function Zp(){return ru([["discriminator",Oc()],["idempotent",Nc()],["key",$a(Ks(),ps())]])}function Jp(){return ru([["discriminator",vs()],["pausableDiscriminator",vs()]])}function Yp(){return ru([["discriminator",vs()]])}function Qp(){return ru([["discriminator",vs()],["authorityType",Eh()],["newAuthority",wf(tc())]])}function Xp(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["transferFeeBasisPoints",fs()],["maximumFee",ms()]])}function eg(){return ru([["discriminator",vs()]])}function tg(){return ru([["discriminator",vs()]])}function ng(){return ru([["discriminator",vs()],["amount",ms()]])}function rg(){return ru([["discriminator",vs()],["amount",ms()],["decimals",vs()]])}function og(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["amount",ms()],["decimals",vs()],["fee",ms()]])}function ig(){return ru([["discriminator",vs()],["uiAmount",Ks()]])}function ag(){return ru([["discriminator",vs()],["confidentialTransferDiscriminator",vs()],["autoApproveNewAccounts",Nc()],["auditorElgamalPubkey",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function sg(){return ru([["discriminator",vs()],["defaultAccountStateDiscriminator",vs()],["state",bh()]])}function cg(){return ru([["discriminator",vs()],["groupMemberPointerDiscriminator",vs()],["memberAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function ug(){return ru([["discriminator",vs()],["groupPointerDiscriminator",vs()],["groupAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function lg(){return ru([["discriminator",vs()],["metadataPointerDiscriminator",vs()],["metadataAddress",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function dg(){return ru([["discriminator",vs()],["scaledUiAmountMintDiscriminator",vs()],["multiplier",as()],["effectiveTimestamp",cs()]])}function fg(){return ru([["discriminator",vs()],["interestBearingMintDiscriminator",vs()],["rate",ss()]])}new Uint8Array([108,37,171,143,248,30,18,110]);function hg(){return ru([["discriminator",Oc()],["maxSize",ms()]])}new Uint8Array([161,105,88,1,237,221,216,203]);function pg(){return ru([["discriminator",Oc()],["newUpdateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}new Uint8Array([221,233,49,45,181,202,220,200]);function gg(){return ru([["discriminator",Oc()],["field",Rh()],["value",$a(Ks(),ps())]])}new Uint8Array([215,228,166,228,84,100,86,123]);function mg(){return ru([["discriminator",Oc()],["newUpdateAuthority",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function yg(){return ru([["discriminator",vs()],["transferHookDiscriminator",vs()],["programId",wf(tc(),{prefix:null,noneValue:"zeroes"})]])}function vg(){return ru([["discriminator",vs()]])}function wg(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()],["numTokenAccounts",vs()]])}function Ag(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()],["numTokenAccounts",vs()],["proofInstructionOffset",us()],["newDecryptableAvailableBalance",kh()]])}function bg(){return ru([["discriminator",vs()],["transferFeeDiscriminator",vs()]])}function Sg(){return ru([["discriminator",vs()],["confidentialTransferFeeDiscriminator",vs()],["proofInstructionOffset",us()],["newDecryptableAvailableBalance",kh()]])}var Eg=1e4,kg=31556736;function Tg(e,t,n){const r=t-e;if(r<0)throw new Error("Invalid timespan: end time before start time");const o=n*r/(kg*Eg);return Math.exp(o)}function Ig({currentTimestamp:e,lastUpdateTimestamp:t,initializationTimestamp:n,preUpdateAverageRate:r,currentRate:o}){return Tg(n,t,r)*Tg(t,e,o)}function xg(e){return Math.pow(10,e)}function _g(e,t,n,r,o,i,a){const s=parseFloat(e)*xg(t)/Ig({currentTimestamp:n,lastUpdateTimestamp:r,initializationTimestamp:o,preUpdateAverageRate:i,currentRate:a});return BigInt(Math.trunc(s))}function Cg(e,t,n){const r=parseFloat(e)*xg(t)/n;return BigInt(Math.trunc(r))}var Rg="ComputeBudget111111111111111111111111111111",Pg={blockhash:"11111111111111111111111111111111",lastValidBlockHeight:0n},Ng=2;function Bg(e){return function(e,t){return e.programAddress===t}(e,Rg)&&function(e){return void 0!==e.data}(e)&&e.data[0]===Ng}async function Og({abortSignal:e,rpc:t,transactionMessage:n,...r}){const o=Hu(n);let i;i=o||lu(n)?n:du(Pg,n);const a=n.instructions.findIndex(Bg),s=function(e){const t=new Uint8Array(5);return t[0]=Ng,hs().write(e,t,1),Object.freeze({data:t,programAddress:Rg})}(14e5);if(-1===a)i=Ju(s,i);else{const e=[...i.instructions];e.splice(a,1,s),i=Object.freeze({...i,instructions:e})}const c=cl(ol(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 Sa(Ki);const a=i>4294967295n?4294967295:Number(i);if(n)throw new Sa(Gi,{cause:n,unitsConsumed:a});return a}catch(e){if(ba(e,Gi))throw e;throw new Sa(Ki,{cause:e})}}async function Mg(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?mh(t[n],e):gh(t[n],e)))}(t,e,n);return function(e){const t=e.filter((e=>ph(e)&&e.data instanceof Uint8Array));if(t.length>0){const e=t.map((e=>e.address));throw new Sa(Ai,{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 Sa(vi,{addresses:e})}}(r),r.reduce(((e,t)=>({...e,[t.address]:t.data.addresses})),{})}async function zg(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 Xu(e,{addressesByLookupTableAddress:r.length>0?await Mg(r,t,i):{},lastValidBlockHeight:o})}function Ug(e,t){return!t?.preflightCommitment&&function(e,t){return e===t?0:au(e)<au(t)?-1:1}(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function jg({abortSignal:e,commitment:t,rpc:n,transaction:r,...o}){const i=cl(r);return await n.sendTransaction(i,{...Ug(t,o),encoding:"base64"}).send({abortSignal:e})}const Lg=async(e,t,n)=>uu(e,Ds().encode,Ou().decode,(async e=>zg(e,t,n))),Dg=async(e,t,n)=>uu(e,Ou().decode,(async e=>zg(e,t,n))),Fg=e=>uu(e,tl().encode,Fs().decode),$g=async e=>uu(e,Ds().encode,nl().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"))}))}))})))([$g(e),Lg(e,t,n)]),Wg=Xs("KeccakSecp256k11111111111111111111111111111"),Vg=Xs("Secp256r1SigVerify1111111111111111111111111");var Kg=function(e){return e[e.Verify=0]="Verify",e}({});const Gg=e=>0,Hg=e=>e.programAddress===Wg,Zg=e=>e.programAddress===Vg,Jg=()=>{return e=[["numSignatures",ja(ys(),vs())]],ja(nu(e),ru(e));var e},Yg=e=>({programAddress:e.programAddress,data:Jg().decode(e.data??new Uint8Array)});const Qg={[Rl]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,hs().encode(0),0))return 0;if(Pa(t,hs().encode(1),0))return 1;if(Pa(t,hs().encode(2),0))return 2;if(Pa(t,hs().encode(3),0))return 3;if(Pa(t,hs().encode(4),0))return 4;if(Pa(t,hs().encode(5),0))return 5;if(Pa(t,hs().encode(6),0))return 6;if(Pa(t,hs().encode(7),0))return 7;if(Pa(t,hs().encode(8),0))return 8;if(Pa(t,hs().encode(9),0))return 9;if(Pa(t,hs().encode(10),0))return 10;if(Pa(t,hs().encode(11),0))return 11;if(Pa(t,hs().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")},instructionEnum:Nl,typeToParserMap:{[Nl.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:Ll().decode(e.data)}},[Nl.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:Gl().decode(e.data)}},[Nl.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:$l().decode(e.data)}},[Nl.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:ql().decode(e.data)}},[Nl.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:zl().decode(e.data)}},[Nl.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:Jl().decode(e.data)}},[Nl.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:Wl().decode(e.data)}},[Nl.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:Fl().decode(e.data)}},[Nl.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:Ul().decode(e.data)}},[Nl.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:jl().decode(e.data)}},[Nl.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:Dl().decode(e.data)}},[Nl.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:Hl().decode(e.data)}},[Nl.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:Zl().decode(e.data)}}}},[Jd]:{identifier:Qd,instructionEnum:Yd,typeToParserMap:{[Yd.RequestUnits]:function(e){return{programAddress:e.programAddress,data:ef().decode(e.data)}},[Yd.RequestHeapFrame]:function(e){return{programAddress:e.programAddress,data:Xd().decode(e.data)}},[Yd.SetComputeUnitPrice]:df,[Yd.SetComputeUnitLimit]:af,[Yd.SetLoadedAccountsDataSizeLimit]:function(e){return{programAddress:e.programAddress,data:ff().decode(e.data)}}}},[Cf]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;if(Pa(t,ys().encode(3),0))return 3;if(Pa(t,ys().encode(4),0))return 4;if(Pa(t,ys().encode(5),0))return 5;if(Pa(t,ys().encode(6),0))return 6;if(Pa(t,ys().encode(7),0))return 7;if(Pa(t,ys().encode(8),0))return 8;if(Pa(t,ys().encode(9),0))return 9;if(Pa(t,ys().encode(10),0))return 10;if(Pa(t,ys().encode(11),0))return 11;if(Pa(t,ys().encode(12),0))return 12;if(Pa(t,ys().encode(13),0))return 13;if(Pa(t,ys().encode(14),0))return 14;if(Pa(t,ys().encode(15),0))return 15;if(Pa(t,ys().encode(16),0))return 16;if(Pa(t,ys().encode(17),0))return 17;if(Pa(t,ys().encode(18),0))return 18;if(Pa(t,ys().encode(19),0))return 19;if(Pa(t,ys().encode(20),0))return 20;if(Pa(t,ys().encode(21),0))return 21;if(Pa(t,ys().encode(22),0))return 22;if(Pa(t,ys().encode(23),0))return 23;if(Pa(t,ys().encode(24),0))return 24;throw new Error("The provided instruction could not be identified as a token instruction.")},instructionEnum:Nf,typeToParserMap:{[Nf.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:Qf().decode(e.data)}},[Nf.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:Hf().decode(e.data)}},[Nf.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:eh().decode(e.data)}},[Nf.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:ch().decode(e.data)}},[Nf.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:Uf().decode(e.data)}},[Nf.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:oh().decode(e.data)}},[Nf.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:ih().decode(e.data)}},[Nf.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:nh().decode(e.data)}},[Nf.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:Lf().decode(e.data)}},[Nf.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:Ff().decode(e.data)}},[Nf.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:Kf().decode(e.data)}},[Nf.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:sh().decode(e.data)}},[Nf.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:dh().decode(e.data)}},[Nf.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:jf().decode(e.data)}},[Nf.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:rh().decode(e.data)}},[Nf.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:Df().decode(e.data)}},[Nf.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:Zf().decode(e.data)}},[Nf.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:ah().decode(e.data)}},[Nf.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:Jf().decode(e.data)}},[Nf.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:th().decode(e.data)}},[Nf.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:Xf().decode(e.data)}},[Nf.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:Gf().decode(e.data)}},[Nf.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:Yf().decode(e.data)}},[Nf.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:zf().decode(e.data)}},[Nf.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:hh().decode(e.data)}}}},[Uh]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;if(Pa(t,ys().encode(3),0))return 3;if(Pa(t,ys().encode(4),0))return 4;if(Pa(t,ys().encode(5),0))return 5;if(Pa(t,ys().encode(6),0))return 6;if(Pa(t,ys().encode(7),0))return 7;if(Pa(t,ys().encode(8),0))return 8;if(Pa(t,ys().encode(9),0))return 9;if(Pa(t,ys().encode(10),0))return 10;if(Pa(t,ys().encode(11),0))return 11;if(Pa(t,ys().encode(12),0))return 12;if(Pa(t,ys().encode(13),0))return 13;if(Pa(t,ys().encode(14),0))return 14;if(Pa(t,ys().encode(15),0))return 15;if(Pa(t,ys().encode(16),0))return 16;if(Pa(t,ys().encode(17),0))return 17;if(Pa(t,ys().encode(18),0))return 18;if(Pa(t,ys().encode(19),0))return 19;if(Pa(t,ys().encode(20),0))return 20;if(Pa(t,ys().encode(21),0))return 21;if(Pa(t,ys().encode(22),0))return 22;if(Pa(t,ys().encode(23),0))return 23;if(Pa(t,ys().encode(24),0))return 24;if(Pa(t,ys().encode(25),0))return 25;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(0),1))return 26;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(1),1))return 27;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(2),1))return 28;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(3),1))return 29;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(4),1))return 30;if(Pa(t,ys().encode(26),0)&&Pa(t,ys().encode(5),1))return 31;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(0),1))return 32;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(1),1))return 33;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(2),1))return 34;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(3),1))return 35;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(4),1))return 36;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(5),1))return 37;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(6),1))return 38;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(7),1))return 39;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(8),1))return 40;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(9),1))return 41;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(10),1))return 42;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(11),1))return 43;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(12),1))return 44;if(Pa(t,ys().encode(27),0)&&Pa(t,ys().encode(13),1))return 45;if(Pa(t,ys().encode(28),0)&&Pa(t,ys().encode(0),1))return 46;if(Pa(t,ys().encode(28),0)&&Pa(t,ys().encode(1),1))return 47;if(Pa(t,ys().encode(29),0))return 48;if(Pa(t,ys().encode(30),0)&&Pa(t,ys().encode(0),1))return 49;if(Pa(t,ys().encode(30),0)&&Pa(t,ys().encode(1),1))return 50;if(Pa(t,ys().encode(31),0))return 51;if(Pa(t,ys().encode(32),0))return 52;if(Pa(t,ys().encode(33),0)&&Pa(t,ys().encode(0),1))return 53;if(Pa(t,ys().encode(33),0)&&Pa(t,ys().encode(1),1))return 54;if(Pa(t,ys().encode(34),0)&&Pa(t,ys().encode(0),1))return 55;if(Pa(t,ys().encode(34),0)&&Pa(t,ys().encode(1),1))return 56;if(Pa(t,ys().encode(35),0))return 57;if(Pa(t,ys().encode(36),0)&&Pa(t,ys().encode(0),1))return 58;if(Pa(t,ys().encode(36),0)&&Pa(t,ys().encode(1),1))return 59;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(0),1))return 60;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(1),1))return 61;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(2),1))return 62;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(3),1))return 63;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(4),1))return 64;if(Pa(t,ys().encode(37),0)&&Pa(t,ys().encode(5),1))return 65;if(Pa(t,ys().encode(38),0))return 66;if(Pa(t,ys().encode(39),0)&&Pa(t,ys().encode(0),1))return 67;if(Pa(t,ys().encode(39),0)&&Pa(t,ys().encode(1),1))return 68;if(Pa(t,ys().encode(40),0)&&Pa(t,ys().encode(0),1))return 69;if(Pa(t,ys().encode(40),0)&&Pa(t,ys().encode(1),1))return 70;if(Pa(t,ys().encode(41),0)&&Pa(t,ys().encode(0),1))return 71;if(Pa(t,ys().encode(41),0)&&Pa(t,ys().encode(1),1))return 72;if(Pa(t,ys().encode(43),0)&&Pa(t,ys().encode(0),1))return 73;if(Pa(t,ys().encode(43),0)&&Pa(t,ys().encode(1),1))return 74;if(Pa(t,ys().encode(44),0)&&Pa(t,ys().encode(0),1))return 75;if(Pa(t,ys().encode(44),0)&&Pa(t,ys().encode(1),1))return 76;if(Pa(t,ys().encode(44),0)&&Pa(t,ys().encode(2),1))return 77;if(Pa(t,new Uint8Array([210,225,30,162,88,184,77,141]),0))return 78;if(Pa(t,new Uint8Array([221,233,49,45,181,202,220,200]),0))return 79;if(Pa(t,new Uint8Array([234,18,32,56,89,141,37,181]),0))return 80;if(Pa(t,new Uint8Array([215,228,166,228,84,100,86,123]),0))return 81;if(Pa(t,new Uint8Array([250,166,180,250,13,12,184,70]),0))return 82;if(Pa(t,new Uint8Array([121,113,108,39,54,51,0,4]),0))return 83;if(Pa(t,new Uint8Array([108,37,171,143,248,30,18,110]),0))return 84;if(Pa(t,new Uint8Array([161,105,88,1,237,221,216,203]),0))return 85;if(Pa(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:Dh,typeToParserMap:{[Dh.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:Rp().decode(e.data)}},[Dh.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:wp().decode(e.data)}},[Dh.InitializeMultisig]:Op,[Dh.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:ng().decode(e.data)}},[Dh.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:qh().decode(e.data)}},[Dh.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:Yp().decode(e.data)}},[Dh.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:Qp().decode(e.data)}},[Dh.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:Wp().decode(e.data)}},[Dh.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)}},[Dh.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)}},[Dh.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:gp().decode(e.data)}},[Dh.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:tg().decode(e.data)}},[Dh.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:rg().decode(e.data)}},[Dh.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)}},[Dh.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:Vp().decode(e.data)}},[Dh.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)}},[Dh.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:Ap().decode(e.data)}},[Dh.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:eg().decode(e.data)}},[Dh.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:bp().decode(e.data)}},[Dh.InitializeMultisig2]:Op,[Dh.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:Pp().decode(e.data)}},[Dh.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:mp().decode(e.data)}},[Dh.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:xp().decode(e.data)}},[Dh.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:Fh().decode(e.data)}},[Dh.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:ig().decode(e.data)}},[Dh.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:Np().decode(e.data)}},[Dh.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:$p().decode(e.data)}},[Dh.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:og().decode(e.data)}},[Dh.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:bg().decode(e.data)}},[Dh.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:wg().decode(e.data)}},[Dh.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:yp().decode(e.data)}},[Dh.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:Xp().decode(e.data)}},[Dh.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:Ep().decode(e.data)}},[Dh.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:ag().decode(e.data)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:Xh().decode(e.data)}},[Dh.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)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:up().decode(e.data)}},[Dh.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)}},[Dh.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===Uh?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)}},[Dh.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===Uh?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)}},[Dh.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:$h().decode(e.data)}},[Dh.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:lp().decode(e.data)}},[Dh.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:rp().decode(e.data)}},[Dh.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:pp().decode(e.data)}},[Dh.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:sp().decode(e.data)}},[Dh.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===Uh?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)}},[Dh.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:kp().decode(e.data)}},[Dh.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:sg().decode(e.data)}},[Dh.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:Gp().decode(e.data)}},[Dh.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:hp().decode(e.data)}},[Dh.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:ap().decode(e.data)}},[Dh.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:np().decode(e.data)}},[Dh.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:Mp().decode(e.data)}},[Dh.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:_p().decode(e.data)}},[Dh.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:fg().decode(e.data)}},[Dh.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:dp().decode(e.data)}},[Dh.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:op().decode(e.data)}},[Dh.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:Up().decode(e.data)}},[Dh.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:qp().decode(e.data)}},[Dh.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:yg().decode(e.data)}},[Dh.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:Sp().decode(e.data)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:Sg().decode(e.data)}},[Dh.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===Uh?void 0:e})(),authority:n()},data:Ag().decode(e.data)}},[Dh.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:vp().decode(e.data)}},[Dh.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:fp().decode(e.data)}},[Dh.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:ip().decode(e.data)}},[Dh.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:vg().decode(e.data)}},[Dh.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:Cp().decode(e.data)}},[Dh.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:lg().decode(e.data)}},[Dh.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:Ip().decode(e.data)}},[Dh.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:ug().decode(e.data)}},[Dh.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:Tp().decode(e.data)}},[Dh.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:cg().decode(e.data)}},[Dh.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:jp().decode(e.data)}},[Dh.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:dg().decode(e.data)}},[Dh.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:zp().decode(e.data)}},[Dh.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:Kp().decode(e.data)}},[Dh.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:Jp().decode(e.data)}},[Dh.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:Fp().decode(e.data)}},[Dh.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:gg().decode(e.data)}},[Dh.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:Zp().decode(e.data)}},[Dh.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:mg().decode(e.data)}},[Dh.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:cp().decode(e.data)}},[Dh.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:Lp().decode(e.data)}},[Dh.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:hg().decode(e.data)}},[Dh.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:pg().decode(e.data)}},[Dh.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:Dp().decode(e.data)}}}},[If]:{identifier:function(e){const t="data"in e?e.data:e;if(Pa(t,ys().encode(0),0))return 0;if(Pa(t,ys().encode(1),0))return 1;if(Pa(t,ys().encode(2),0))return 2;throw new Error("The provided instruction could not be identified as a associatedToken instruction.")},instructionEnum:Mh,typeToParserMap:{[Mh.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)}},[Mh.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:tp().decode(e.data)}},[Mh.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:Hp().decode(e.data)}}}},[Wg]:{identifier:Gg,instructionEnum:Kg,typeToParserMap:{[Kg.Verify]:Yg}},[Vg]:{identifier:Gg,instructionEnum:Kg,typeToParserMap:{[Kg.Verify]:Yg}}},Xg=e=>{const{programAddress:t}=e,n={...e,dataBase58:zs().decode(e.data??new Uint8Array)};try{const r=Qg[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}}},em=(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:zs().encode(e.data),programAddress:r}};function tm(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 nm={accountSubscribe:"accountUnsubscribe",programSubscribe:"programUnsubscribe",signatureSubscribe:"signatureUnsubscribe"},rm=H(["processed","confirmed","finalized"]),om=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:Zu(e,t),im=e=>e.programAddress===Jd&&Qd({data:new Uint8Array,...e})===Yd.SetComputeUnitPrice,am=e=>e.instructions.filter(Boolean).some(im),sm=e=>e.programAddress===Jd&&Qd({data:new Uint8Array,...e})===Yd.SetComputeUnitLimit,cm=e=>e.instructions.filter(Boolean).some(sm),um=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(ba(e,Gi))return e.context.unitsConsumed;throw e}));return{...(0,Od.cloneDeep)(e),instructions:[...r.filter((e=>!sm(e))),of({units:i},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}};class lm extends Error{constructor(e){super(e),this.name="FeeCalculatorError"}}class dm extends lm{constructor(e){super(e),this.name="FeeCalculatorUnsupportedInputTypeError"}}const fm=e=>({ed25519Signatures:["signature"],instructions:e.instructions.map((t=>({accounts:[],data:t.data??new Uint8Array,programAddress:e.staticAccounts[t.programAddressIndex]})))}),hm=e=>({...uu(e.messageBytes,Ou().decode,fm),ed25519Signatures:Object.values(e.signatures)}),pm=e=>uu(e,Ds().encode,nl().decode,hm),gm=e=>uu(e,Ds().encode,Ou().decode,fm),mm=5000n;class ym{static calculateFee(e){const t=this.#l(e),{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i}=this.#d(t),a=this.#f(i),s=this.#h(t),c=this.#p(t),u=this.#g(s,c);return{ed25519SignaturesCount:n,secp256k1SignaturesCount:r,secp256r1SignaturesCount:o,totalSignaturesCount:i,baseFee:a,computeUnitLimit:s,computeUnitPriceMicroLamportsPerComputeUnit:c,priorityFee:u,totalFee:cu(a+u)}}static#f(e){return cu(mm*BigInt(e))}static#h(e){const{instructions:t}=e,n=t.find(sm);return n?af(n).data.units:0}static#p(e){const{instructions:t}=e,n=t.find(im);return n?df(n).data.microLamports:0n}static#g(e,t){return uu(e,(e=>xo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(rd.toString())),(e=>e.toString()),BigInt,cu)}static#d(e){const{ed25519Signatures:t,instructions:n}=e,r=t.length,o=n.filter(Hg).map(Xg).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0),i=n.filter(Zg).map(Xg).reduce(((e,t)=>e+(t.parsed?.data.numSignatures??0)),0);return{ed25519SignaturesCount:r,secp256k1SignaturesCount:o,secp256r1SignaturesCount:i,totalSignaturesCount:r+o+i}}static#l(e){if(this.#m(e))return pm(e);if(this.#y(e))return gm(e);if(this.#v(e))return fm(e);if(this.#w(e))return hm(e);if(this.#A(e))return(e=>({ed25519Signatures:e.transaction.signatures,instructions:e.transaction.message.instructions.map((t=>em(t,e)))}))(e);throw new dm("The fee calculator could not recognize the input type. It supports SolanaTransactions, kit Transactions, and base64 strings.")}static#m(e){try{return"string"==typeof e&&(pm(e),!0)}catch(e){return!1}}static#y(e){try{return"string"==typeof e&&(gm(e),!0)}catch(e){return!1}}static#v(e){return"object"==typeof e&&"instructions"in e&&"staticAccounts"in e}static#A(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#w(e){return"object"==typeof e&&"messageBytes"in e&&"object"==typeof e.messageBytes&&"signatures"in e}}const vm=e=>xo(e.toString()).dividedBy(od),wm=e=>xo(e.toString()).multipliedBy(od).integerValue(xo.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}({});class bm 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 Sm(e){return"object"==typeof e&&null!==e}function Em(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function km(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: \`${Em(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*Tm(e,t,n,r){(function(e){return Sm(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=km(o,t,n,r);e&&(yield e)}}function*Im(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&&Sm(t.schema)&&Sm(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=Im(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):Sm(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 xm{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)=>Tm(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Tm(o(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,n){const r=Rm(e,t,{message:n});if(r[0])throw r[0]}(e,this,t)}create(e,t){return function(e,t,n){const r=Rm(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}is(e){return function(e,t){const n=Rm(e,t);return!n[0]}(e,this)}mask(e,t){return function(e,t,n){const r=Rm(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Rm(e,this,t)}}const _m="EXACT_OPTIONAL";class Cm extends xm{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=_m}static isExactOptional(e){return Sm(e)&&"brand"in e&&e.brand===_m}}function Rm(e,t,n={}){const r=Im(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new bm(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Pm(){return Mm("never",(()=>!1))}function Nm(e){const t=e?Object.keys(e):[],n=Pm();return new xm({type:"object",schema:e??null,*entries(r){if(e&&Sm(r)){const o=new Set(Object.keys(r));for(const n of t){o.delete(n);const t=e[n];Cm.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=>Sm(e)||`Expected an object, but received: ${Em(e)}`,coercer:e=>Sm(e)?{...e}:e})}function Bm(){return Mm("string",(e=>"string"==typeof e||`Expected a string, but received: ${Em(e)}`))}function Om(...e){const t="type"===e[0]?.type,n=e.map((({schema:e})=>e)),r=Object.assign({},...n);return t?function(e){const t=Object.keys(e);return new xm({type:"type",schema:e,*entries(n){if(Sm(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>Sm(e)||`Expected an object, but received: ${Em(e)}`,coercer:e=>Sm(e)?{...e}:e})}(r):Nm(r)}function Mm(e,t){return new xm({type:e,schema:null,validator:t})}function zm(e){return Mm(JSON.stringify(e),function(e){const t=Em(e),n=typeof e;return new xm({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Em(n)}`})}(e).validator)}function Um(e){return null==e}const jm=(e,t)=>Object.hasOwnProperty.call(e,t);var Lm;!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"}(Lm=Lm||(Lm={}));const Dm=e=>ee(e);function Fm({path:e,branch:t}){const n=e[e.length-1];return jm(t[t.length-2],n)}function $m(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Fm(n)||e.validator(t,n),refiner:(t,n)=>!Fm(n)||e.refiner(t,n)})}function qm(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(!qm(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]||!qm(n[e][1])){t=!1;break}return t}return!1}const Wm=L("JSON",(e=>qm(e))),Vm=de(Wm,me(V(),"JSON",(e=>U(e,Wm))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Km=J("2.0"),Gm=Q(ae([X(),re()])),Hm=Dm({code:Z(),message:re(),data:$m(Vm),stack:$m(re())}),Zm=ae([ne(re(),Vm),K(Vm)]);Dm({id:Gm,jsonrpc:Km,method:re(),params:$m(Zm)}),Dm({jsonrpc:Km,method:re(),params:$m(Zm)});ee({id:Gm,jsonrpc:Km,result:te(se()),error:te(Hm)});const Jm=Dm({id:Gm,jsonrpc:Km,result:Vm}),Ym=Dm({id:Gm,jsonrpc:Km,error:Hm});ae([Jm,Ym]);function Qm(e){return U(e,Ym)}var Xm=function(e){return e.Required="Required",e.Invalid="Invalid",e.InsufficientBalanceToCoverFee="InsufficientBalanceToCoverFee",e.InsufficientBalance="InsufficientBalance",e}({});const ey=H(Object.values(ad)),ty=ie({address:de(re(),re(),(e=>{if(!e||""===e)throw new Error("Account address is required");const t=Pd(e);if(""===t)throw new Error("Invalid Solana address format");return t}))}),ny=J("ed25519"),ry=de(re(),re(),(e=>{const t=function(e){if(!e||"string"!=typeof e)return"";let t=Cd(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})),oy=de(re(),re(),(e=>{const t=Pd(e);if(""===t)throw new Error("Invalid Solana address format");return t})),iy=de(re(),re(),(e=>{const t=Rd(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})),ay=de(re(),re(),(e=>Nd(e))),sy=de(re(),re(),(e=>Rd(e,10))),cy=de(re(),re(),(e=>Rd(e,50))),uy=de(re(),re(),(e=>Rd(e,100))),ly=de(re(),re(),(e=>function(e){if(!e||"string"!=typeof e)return"";const t=Cd(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))),dy=de(re(),re(),(e=>Rd(e,100))),fy=de(K(re()),K(re()),(e=>{var t;return t=e,Array.isArray(t)?t.filter((e=>"string"==typeof e)).map((e=>Nd(e))).filter((e=>""!==e)):[]})),hy=ie({domain:te(ry),address:te(oy),statement:te(iy),uri:te(ay),version:te(sy),chainId:te(cy),nonce:te(uy),issuedAt:te(ly),expirationTime:te(ly),notBefore:te(ly),requestId:te(dy),resources:te(fy)}),py=ie({account:ty,message:Id}),gy=H(["processed","confirmed","finalized"]),my=ie({preflightCommitment:te(gy),minContextSlot:te(X())}),yy=ie({account:ty,transaction:Id,scope:ey,options:te(my)}),vy=ie({...my.schema,commitment:te(gy),skipPreflight:te(G()),maxRetries:te(X())}),wy=ie({...yy.schema,scope:ey,options:te(vy)}),Ay=ee({method:H([$t.SignAndSendTransaction]),params:wy}),by=ee({method:H([$t.SignIn]),params:hy}),Sy=ee({method:H([$t.SignMessage]),params:py}),Ey=ee({method:H([$t.SignTransaction]),params:yy}),ky=ee({signature:Td}),Ty=ee({signedTransaction:Id}),Iy=ee({signature:Td,signedMessage:Id,signatureType:ny}),xy=ee({account:ty,...Iy.schema}),_y=ae([Ay,by,Sy,Ey]),Cy=ee({jsonrpc:Km,id:Gm,method:zm(Am.SignAndSendTransactionWithoutConfirmation),params:wy}),Ry=ee({transaction:Id,accountId:hd,scope:ey,options:te(vy)}),Py=ee({jsonrpc:Km,id:Gm,method:zm(Am.SignAndSendTransaction),params:Ry}),Ny=ee({transactionId:Td}),By=ee({fromAccountId:hd,toAddress:_d,amount:pd,assetId:Lo}),Oy=ee({jsonrpc:Km,id:Gm,method:zm(Am.ConfirmSend),params:By}),My=ee({value:re()}),zy=ee({jsonrpc:Km,id:Gm,method:zm(Am.OnAddressInput),params:My}),Uy=ee({value:pd,accountId:hd,assetId:Lo}),jy=ee({jsonrpc:Km,id:Gm,method:zm(Am.OnAmountInput),params:Uy});function Ly(e){const t=uu(e,$s().encode,Gs().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(!U(o,_d))throw new Error("Invalid Solana address");if(!U(i,pd))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 Dy=me(Id,"RewardsMessage",(e=>{try{return Ly(e),!0}catch(e){return e instanceof Error?e.message:"Invalid rewards message"}})),Fy=ee({account:ee({address:_d}),message:Dy}),$y=ee({jsonrpc:Km,id:Gm,method:zm(Am.SignRewardsMessage),params:Fy}),qy=ee({valid:G(),errors:K(ee({code:H(Object.values(Xm))}))}),Wy=ee({transaction:Id,accountId:hd,scope:ey}),Vy=ee({jsonrpc:Km,id:Gm,method:zm(Am.ComputeFee),params:Wy}),Ky=K(ee({type:H(Object.values(kt)),asset:mt}));const Gy=ge(re(),/^(?:0x)?[0-9a-f]+$/iu);ge(re(),/^0x[0-9a-f]+$/iu),ge(re(),/^0x[0-9a-f]{40}$/u),ge(re(),/^0x[0-9a-fA-F]{40}$/u);function Hy(e){Wo(function(e){return U(e,Gy)}(e),"Value must be a hexadecimal string.")}function Zy(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}n(1048).hp;const Jy=48,Yy=58,Qy=87;!function(){const e=[]}();function Xy(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;Hy(e);const t=Zy(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<Yy?Jy:Qy),a=o-(o<Yy?Jy:Qy);r[e]=16*i+a}return r}async function ev({entropySource:e,derivationPath:t}){ed.log({derivationPath:t},"Generating solana wallet"),M(t,xd);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:Xy(t.privateKey),publicKeyBytes:Xy(t.publicKey)}}catch(e){throw ed.error({error:e},"Error deriving keypair"),new Error(e)}}const tv=e=>JSON.parse(JSON.stringify(e),((e,t)=>t?"undefined"!==t.__type?"BigNumber"===t.__type?new xo(t.value):"bigint"===t.__type?BigInt(t.value):"Uint8Array"===t.__type?$s().encode(t.value):t:void 0:t)),nv=e=>(0,Od.cloneDeepWith)(e,(e=>void 0===e?{__type:"undefined"}:e instanceof xo?{__type:"BigNumber",value:e.toString()}:"bigint"==typeof e?{__type:"bigint",value:e.toString()}:e instanceof Uint8Array?{__type:"Uint8Array",value:$s().decode(e)}:void 0)),rv="send-form",ov="confirm-sign-and-send-transaction";async function iv(e,t){const n=nv(t);return snap.request({method:"snap_createInterface",params:{ui:e,context:n}})}async function av(e,t,n){const r=nv(n);return snap.request({method:"snap_updateInterface",params:{id:e,ui:t,context:r}})}async function sv(e,t){return snap.request({method:"snap_resolveInterface",params:{id:e,value:t}})}async function cv(e){return snap.request({method:"snap_dialog",params:{id:e}})}async function uv(){return snap.request({method:"snap_getPreferences"})}async function lv(e){const t=await async function(e){const t=await snap.request({method:"snap_getInterfaceContext",params:{id:e}});return t?tv(t):null}(e);if(!t)throw new Error("Interface context not found");return t}var dv=function(e){return e.GetGenesisHash="getGenesisHash",e.GetLatestBlockhash="getLatestBlockhash",e.GetMinimumBalanceForRentExemption="getMinimumBalanceForRentExemption",e}({});const fv=ee({jsonrpc:Km,id:Gm,method:J("getGenesisHash"),params:te(K())}),hv=ee({jsonrpc:Km,id:Gm,method:J("getLatestBlockhash")}),pv=ee({jsonrpc:Km,id:Gm,method:J("getMinimumBalanceForRentExemption"),params:oe([X(),te(ee())])});var gv,mv=function(e){return e.StartSendTransactionFlow="startSendTransactionFlow",e.GetFeeForTransaction="getFeeForTransaction",e}({}),yv=function(e){return e.ListWebSockets="listWebSockets",e.ListSubscriptions="listSubscriptions",e.TestOnStart="testOnStart",e.TestOnInstall="testOnInstall",e.TestOnUpdate="testOnUpdate",e.SynchronizeAccounts="synchronizeAccounts",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"}(gv=gv||(gv={}));const vv=[ad.Mainnet,ad.Devnet],wv={production:[ad.Mainnet],local:[ad.Mainnet],test:[ad.Localnet]},Av=de(K(gd),re(),(e=>e.split(","))),bv=de(K(re()),re(),(e=>e.split(","))),Sv=ee({ENVIRONMENT:H(["local","test","production"]),RPC_URL_MAINNET_LIST:Av,RPC_URL_DEVNET_LIST:Av,RPC_URL_TESTNET_LIST:Av,RPC_URL_LOCALNET_LIST:bv,RPC_WEB_SOCKET_URL_MAINNET:gd,RPC_WEB_SOCKET_URL_DEVNET:gd,RPC_WEB_SOCKET_URL_TESTNET:gd,RPC_WEB_SOCKET_URL_LOCALNET:gd,EXPLORER_BASE_URL:gd,PRICE_API_BASE_URL:gd,TOKEN_API_BASE_URL:gd,STATIC_API_BASE_URL:gd,SECURITY_ALERTS_API_BASE_URL:gd,NFT_API_BASE_URL:gd,LOCAL_API_BASE_URL:re()});class Ev{#b;#S;constructor(){const e=this.#E();this.#b=this.#k(e),this.#S=[]}#E(){return z({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"},Sv)}#k(e){return{environment:e.ENVIRONMENT,networks:[{...fd[ad.Mainnet],rpcUrls:e.RPC_URL_MAINNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_MAINNET},{...fd[ad.Devnet],rpcUrls:e.RPC_URL_DEVNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_DEVNET},{...fd[ad.Testnet],rpcUrls:e.RPC_URL_TESTNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_TESTNET},{...fd[ad.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:gv.Minute,spotPrices:gv.Minute,historicalPrices:gv.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:gv.Minute,getNftMetadata:gv.Minute}},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:gv.Second,closeConnectionsGracePeriodMilliseconds:5*gv.Minute}}}get(){return this.#b}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.#S.length>0)return this.#S;const e=(0,Od.uniq)([ad.Mainnet,...wv[this.#b.environment]??[]]);try{const t=await ethereum.request({method:"web3_clientVersion"}),n=t?.includes("flask"),r=n?[ad.Devnet]:[],o=(0,Od.uniq)([...e,...r]);return this.#S=o,this.#S}catch(t){return e}}}const kv=(new Ev).get(),Tv=["local","test"].includes(kv.environment),Iv=Tv?["http://localhost:3000"]:["https://portfolio.metamask.io"],xv=Tv?new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.FilterAccountChains,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,mv.StartSendTransactionFlow,mv.GetFeeForTransaction,dv.GetGenesisHash,dv.GetLatestBlockhash,Am.SignAndSendTransactionWithoutConfirmation,yv.ListWebSockets,yv.ListSubscriptions,yv.TestOnStart,yv.TestOnInstall,yv.TestOnUpdate,yv.SynchronizeAccounts]):new Set([]),_v=new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,Ht.ResolveAccountAddress,mv.StartSendTransactionFlow,mv.GetFeeForTransaction,Am.SignAndSendTransactionWithoutConfirmation]),Cv=new Map([]);for(const e of Iv)Cv.set(e,xv);Cv.set("metamask",_v);const Rv=(e,t)=>{if(!e)throw new oo("Origin not found");if(!Cv.get(e)?.has(t))throw new oo("Permission denied")};function Pv(e,t){try{M(e,t)}catch(e){throw new Gr(e.message)}}function Nv(e,t){try{M(e,t)}catch(e){throw new $r("Invalid Response")}}var Bv=function(e){return e.OnTransactionAdded="onTransactionAdded",e.OnTransactionApproved="onTransactionApproved",e.OnTransactionRejected="onTransactionRejected",e.OnSyncAccount="onSyncAccount",e.RefreshSend="refreshSend",e.RefreshConfirmationEstimation="refreshConfirmationEstimation",e.CloseWebSocketConnections="closeWebSocketConnections",e}({});const Ov=ee({...St.schema,scope:Sd,request:_y}),Mv=ee({scopes:pe(K(Sd)),entropySource:re(),groupIndex:he(X(),0)});Error;function zv(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 Uv(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class jv extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Lv(e,t="Assertion failed.",n=jv){if(!e){if(t instanceof Error)throw t;throw Uv(n,t)}}function Dv(e,t,n="Assertion failed",r=jv){try{Pn(e,t)}catch(e){throw Uv(r,`${n}: ${zv(e)}.`)}}function Fv(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function $v(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function qv(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(Fv(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function Wv(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function Vv(e,t="="){if(Fv(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Kv(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function Gv(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],i=Array.from(e);for(i.forEach((e=>{if(Fv(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,a=!0;for(let o=r;o<i.length;o++){const s=i[o],c=t*e+s;if(!Number.isSafeInteger(c)||t*e/t!==e||c-s!=t*e)throw new Error("convertRadix: carry overflow");e=c%n;const u=Math.floor(c/n);if(i[o]=u,!Number.isSafeInteger(u)||u*n+e!==c)throw new Error("convertRadix: carry overflow");a&&(u?a=!1:r=o)}if(o.push(e),a)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}const Hv=(e,t)=>t?Hv(t,e%t):e,Zv=(e,t)=>e+(t-Hv(e,t));function Jv(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Zv(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Zv(t,n)}`);let o=0,i=0;const a=2**n-1,s=[];for(const r of e){if(Fv(r),r>=2**t)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)s.push((o>>i-n&a)>>>0);o&=2**i-1}if(o=o<<n-i&a,!r&&i>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&s.push(o>>>0),s}function Yv(e){return Fv(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Gv(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Gv(t,e,256))}}}function Qv(e,t=!1){if(Fv(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Zv(8,e)>32||Zv(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Jv(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Jv(n,e,8,t))}}}const Xv=$v(Qv(4),qv("0123456789ABCDEF"),Wv("")),ew=$v(Qv(5),qv("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Vv(5),Wv("")),tw=($v(Qv(5),qv("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Vv(5),Wv("")),$v(Qv(5),qv("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Wv(""),Kv((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),$v(Qv(6),qv("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Vv(6),Wv(""))),nw=$v(Qv(6),qv("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Vv(6),Wv("")),rw=($v(Qv(6),qv("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Wv("")),e=>$v(Yv(58),qv(e),Wv(""))),ow=rw("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),iw=[0,2,3,5,6,7,9,10,11],aw={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=ow.encode(r).padStart(iw[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=iw.indexOf(r.length),i=ow.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)}};$v(qv("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Wv(""));const sw={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)};$v(Qv(4),qv("0123456789abcdef"),Wv(""),Kv((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));n(1048).hp;!function(){const e=[]}();function cw(e){return e instanceof Uint8Array}function uw(e){Lv(cw(e),"Value must be a Uint8Array.")}function lw(e,t,n){return new xm({...e,*refiner(r,o){yield*e.refiner(r,o);const i=Tm(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}var dw;!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"}(dw||(dw={}));const fw=Nm({type:Bm()}),hw=(Om(fw,Nm({value:Mm("unknown",(()=>!0))})),Om(fw,Nm({type:zm(dw.Image),value:lw(Bm(),"SVG",(e=>!!e.includes("<svg")||"Value is not a valid SVG."))}))),pw=function(e,t,n=[]){return(...r)=>{if(1===r.length&&Sn(r[0])){const n={...r[0],type:e};return Dv(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 Dv(o,t,`Invalid ${e} component`),o}}(dw.Image,hw,["value"]);async function gw(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 Lv("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 uw(e),tw.encode(e)}(r)}`}const mw='<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 yw(e,t){return new xo(e.toString()).div(10**t).toFixed()}function vw(e){return e.split("/")[0]}function ww(e,t){return`${e}/token:${t}`}class Aw{#i;#T;#I;#x;#_;#C;#R;#P;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*gv.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,tokenApiClient:o,tokenPricesService:i,cache:a,nftApiClient:s}){this.#i=Xl(t,"[🪙 AssetsService]"),this.#T=e,this.#I=n,this.#x=r,this.#C=o,this.#_=i,this.#R=a,this.#P=s}#N(e){return{nativeAssetTypes:e.filter((e=>e.endsWith(ld.SOL))),tokenAssetTypes:e.filter((e=>e.includes("/token:"))),nftAssetTypes:e.filter((e=>e.includes("/nft:")))}}#B(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:o,assetReference:i}=Fo(n);t[n]={name:"Solana",symbol:"SOL",fungible:!0,iconUrl:`${this.#I.get().staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${o}/${i}.png`,units:[{name:"Solana",symbol:"SOL",decimals:9}]}}return t}async#O(e){const t=await this.#P.getNftsMetadata(e.map((e=>{const{assetReference:t}=Fo(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.#N(e),[o,i]=await Promise.all([this.#B(t),this.#C.getTokensMetadata(n)]);return{...o,...i}}async#M(e,t=[Cf,Uh],n=[ad.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=nd(this.#z.bind(this),this.#R,{functionName:"AssetsService:fetchTokenAccounts",ttlMilliseconds:Aw.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#z(e,t=Cf,n=ad.Mainnet){return(await this.#T.getRpc(n).getTokenAccountsByOwner(Xs(e.address),{programId:t},{encoding:"jsonParsed"}).send()).value.map((t=>({token:t,scope:n,assetType:ww(n,t.account.data.parsed.info.mint),keyringAccount:e})))}async fetch(e){const[t,n]=await Promise.all([this.#U(e),this.#M([e],[Cf,Uh],await this.#I.getActiveNetworks())]),r=n.map((e=>e.assetType)),o=await this.#C.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??yw(r,n)}}))]}async getNativeAssetTypes(){return(await this.#I.getActiveNetworks()).map((e=>`${e}/${ld.SOL}`))}async#U(e){const t=await this.getNativeAssetTypes(),n=Xs(e.address),r=t.map((async t=>{const r=await this.#T.getRpc(vw(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:vw(t),address:n,symbol:"SOL",decimals:9,rawAmount:r.value.toString(),uiAmount:yw(r.value,9)}}));return(await Promise.allSettled(r)).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#j(e,t){const n=Xs(e.address),r=await this.#P.listAddressSolanaNfts(n),o={};for(const e of t){const{assetReference:t}=Fo(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.#_.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.#x.saveMany(e);const n=e=>t(e)&&!(e=>e.assetType.includes(ld.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 vn(snap,gn.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 vn(snap,gn.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.#x.getAll()}async findByAccount(e){const{id:t,address:n}=e,r=await this.#x.findByKeyringAccountId(t),o=await this.getNativeAssetTypes(),i=[];for(const t of o){if(!r.some((e=>e.assetType===t))){const r=vw(t);i.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:"SOL",decimals:9,rawAmount:"0",uiAmount:"0"})}}return[...r,...i]}static generateImageComponent=async(e,t=48,n=48)=>e?async function(e,{width:t,height:n=t,request:r}){Lv("number"==typeof t&&t>0,"Expected width to be a number greater than 0."),Lv("number"==typeof n&&n>0,"Expected height to be a number greater than 0.");const o=await gw(e,r),i=`width="${t}" height="${n}"`;return pw(`<svg ${i.trim()} xmlns="http://www.w3.org/2000/svg"><image ${i.trim()} href="${o}" /></svg>`)}(e,{width:t,height:n}).then((e=>e.value)).catch((()=>mw)):mw}class bw{#T;#i;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#T=e,this.#i=Xl(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.#T.getRpc(n),i=await qg(e,o,r);if("instructions"in i)return this.#L(i,t,n);if(Object.values(i.signatures).every((e=>!e))){const{messageBytes:e}=i,a=await Dg(e,o,r);return this.#L(a,t,n)}return this.#D(i,t)}async#L(e,t,n){const r=lu(e)?e.lifetimeConstraint:await this.#T.getLatestBlockhash(n),o=am(e),i=bw.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,a=!cm(e)||!o,{privateKeyBytes:s}=await ev({entropySource:t.entropySource,derivationPath:t.derivationPath}),c=await vl(s),u=await uu(e,(e=>om(c.address,e)),(e=>{return t=r,lu(n=e)?n:du(t,n);var t,n}),(e=>((e,t,n)=>am(e)?e:Qu([lf(t,n)],e))(e,{microLamports:i})),(async e=>a?um(e,this.#T.getRpc(n)):e)),l=ml([c],u);return await Al(l)}async#D(e,t){const{privateKeyBytes:n}=await ev({entropySource:t.entropySource,derivationPath:t.derivationPath});return al([await Ec(n)],e)}}const Sw=(e,t)=>{const{to:n,type:r,status:o}=e,{address:i}=t;if(!(r===xt.Receive||o===It.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce(((e,t)=>t.address!==i||!t.asset?.fungible||t.asset.type!==sd.SolMainnet&&t.asset.type!==sd.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)}),{hasReceivedSOL:!1,receivedSOLAmount:new xo(0)});return a&&s.isLessThan(.001)};function Ew(e,t){return[Sw].some((n=>n(e,t)))}class kw{#F;#$;#I;#q;#i;#W=new Map;constructor(e,t,n,r,o){this.#F=e,this.#$=t,this.#I=n,this.#q=r,this.#i=Xl(o,"[🔔 SubscriptionService]"),this.#V()}#V(){this.#q.on("onInactive",this.#K.bind(this)),this.#q.on("onWebSocketEvent",this.#G.bind(this)),this.#q.on("onListSubscriptions",this.#H.bind(this)),vv.forEach((e=>{this.#F.onConnectionRecovery(e,this.#Z.bind(this))}))}registerNotificationHandler(e,t,n){this.#i.info("Registering notification handler",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#W.has(r)||this.#W.set(r,new Set),this.#W.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#F.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.#J(e),a=await this.#$.getById(i);if(a){if("confirmed"===a.status)return i;await this.#$.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.#$.save(s);const c=await this.#F.findByNetwork(r),u=async e=>{const r={jsonrpc:"2.0",id:i,method:t,params:n};e&&await this.#Y(e,r)};return c&&await u(c.id),s.id}async unsubscribe(e){this.#i.info("Unsubscribing from",e);const t=await this.#$.getById(e);if(!t)return void this.#i.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:o}=t,i=nm[o];if("confirmed"===t.status){const e=await this.#F.findByNetwork(r);e&&await this.#Y(e.id,{jsonrpc:"2.0",id:globalThis.crypto.randomUUID(),method:i,params:[t.rpcSubscriptionId]})}await this.#$.delete(n)}async getAll(){return this.#$.getAll()}async#G(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.#F.findById(e.id);if(n)switch(this.#i.info("Received message",e),t.method){case"accountNotification":case"programNotification":case"signatureNotification":await this.#Q(t,n.network);break;default:this.#X(t)?await this.#ee(t):Qm(t)?await this.#te(t):this.#i.warn("Received unknown message",t)}}async#Q(e,t){const{subscription:n}=e.params,r=await this.#$.findBy("rpcSubscriptionId",n);if(!r)return void this.#i.warn("No subscription found for RPC ID:",n);const o=`${r.method}:${t}`,i=this.#W.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#Y(e,t){this.#i.info(`Sending message to connection ${e}`,t),await snap.request({method:"snap_sendWebSocketMessage",params:{id:e,message:JSON.stringify(t)}})}#X(e){return"jsonrpc"in e&&"2.0"===e.jsonrpc&&"id"in e&&"result"in e}async#ee(e){const{id:t,result:n}=e,r=await this.#$.getById(String(t));r?"confirmed"!==r.status?(await this.#$.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 the subscription is already confirmed for request ID: ${t}.`):this.#i.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#te(e){if("id"in e&&void 0!==e.id){const t=await this.#$.getById(String(e.id));"pending"===t?.status?(await this.#$.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#J(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#ne(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}#ne(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.#ne(e))).join(",")}]`;const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));return`{${t.map((t=>`"${t}":${this.#ne(e[t])}`)).join(",")}}`}async#H(){const e=await this.#$.getAll();this.#i.info("Subscriptions",{subscriptions:e,notificationHandlers:this.#W})}#re(e){return{method:e.method,params:e.params,network:e.network,...e.expiryMilliseconds?{expiryMilliseconds:e.expiryMilliseconds}:{},...e.metadata?{metadata:e.metadata}:{}}}async#Z(e){this.#i.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#$.getAll()).filter((t=>t.network===e)).filter(kw.#oe),n=t.map((e=>e.id));await this.#$.deleteMany(n),await Promise.allSettled(t.map((async e=>{await this.subscribe(this.#re(e))})))}async#K(){this.#i.info("Client became inactive"),await this.#ie()}async#ie(){this.#i.info("Removing expired subscriptions");const e=(await this.#$.getAll()).filter(kw.#ae);await Promise.allSettled(e.map((async e=>{await this.unsubscribe(e.id)})))}static#ae(e){const t=new Date;return Boolean(e.expiresAt&&new Date(e.expiresAt)<t)}static#oe(e){return!kw.#ae(e)}}function Tw(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 Iw(e,t,n){return Tw(e,t,n)}const xw='<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 _w(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function Cw(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:_w(r),key:n}}}const Rw=Cw("Container"),Pw=Cw("Box"),Nw=Cw("Heading"),Bw=Cw("Text"),Ow=Cw("Section"),Mw=Cw("Row"),zw=Cw("Address"),Uw=Cw("Image"),jw=Cw("Footer"),Lw=Cw("Button"),Dw=Cw("Link");function Fw(e,t,n){const{cluster:r}=fd[e];return Bd({baseUrl:"https://solscan.io",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const $w=({domain:e,scope:t,address:n})=>Tw(Pw,{direction:"horizontal",alignment:"center",children:Tw(Dw,{href:Fw(t,"address",n),children:e})});function qw(e,t){return`${e}:${t}`}const Ww=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."}}}'),Vw=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."}}}'),Kw={en:Ww.D,es:Vw.D},Gw="en";function Hw(e){const t=Kw[e]??Kw[Gw];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 Zw(e){if(e===id)return"MetaMask";try{return new URL(e).hostname}catch(e){throw new Error("Invalid URL")}}const Jw=({label:e,value:t})=>null!=t?Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:e}),Tw(Bw,{children:t})]}):null,Yw=1e-6,Qw=3,Xw="0",eA=new xo(Yw).decimalPlaces();function tA(e,t){const[n]=t.split("_");try{const r=new xo(e);if(r.isNaN())return Xw;if(r.isZero())return Xw;if(r.abs().lt(Yw))return`<${function(e,t){const n=new xo(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,Yw)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:Qw}).format(Number(r.toFixed(eA??0)));const o=r.abs().integerValue().toString().length,i=Math.max(0,Qw-o+1);return new Intl.NumberFormat(t,{maximumFractionDigits:i}).format(r.toFixed(i))}catch(e){return ed.error(e),Xw}}function nA(e,t,n){const r=new xo(e).toNumber(),[o]=n.split("_");return r.toLocaleString(o,{style:"currency",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const rA=({asset:e,preferences:t})=>{const n=e.type;return Iw(Pw,{direction:"vertical",crossAlignment:"end",children:[Iw(Pw,{direction:"horizontal",alignment:"center",children:[Iw(Bw,{color:"in"===n?"success":"error",children:["in"===n?"+":"-",tA(e.value??0,t.locale)]}),e.imageSvg?Tw(Pw,{alignment:"center",center:!0,children:Tw(Uw,{borderRadius:"full",src:e.imageSvg})}):null,Tw(Bw,{children:e.symbol??""})]}),e.price?Tw(Bw,{color:"muted",children:nA(e.price.toString(),t.currency,t.locale)}):null]})},oA=Cw("Tooltip");var iA;!function(e){e.AddSquare="add-square",e.Add="add",e.Arrow2Down="arrow-2-down",e.Arrow2Left="arrow-2-left",e.Arrow2Right="arrow-2-right",e.Arrow2Up="arrow-2-up",e.Arrow2UpRight="arrow-2-up-right",e.ArrowDoubleLeft="arrow-double-left",e.ArrowDoubleRight="arrow-double-right",e.ArrowDown="arrow-down",e.ArrowLeft="arrow-left",e.ArrowRight="arrow-right",e.ArrowUp="arrow-up",e.BankToken="bank-token",e.Bank="bank",e.Book="book",e.Bookmark="bookmark",e.Bridge="bridge",e.Calculator="calculator",e.CardPos="card-pos",e.CardToken="card-token",e.Card="card",e.Category="category",e.Chart="chart",e.CheckBold="check-bold",e.Check="check",e.Clock="clock",e.Close="close",e.CodeCircle="code-circle",e.Coin="coin",e.Confirmation="confirmation",e.Connect="connect",e.CopySuccess="copy-success",e.Copy="copy",e.Customize="customize",e.Danger="danger",e.Dark="dark",e.Data="data",e.Diagram="diagram",e.DocumentCode="document-code",e.DragDrop="drag-drop",e.DraggingAnimation="dragging-animation",e.PinningAnimation="pinning-animation",e.Edit="edit",e.Eraser="eraser",e.Ethereum="ethereum",e.Expand="expand",e.Explore="explore",e.Export="export",e.EyeSlash="eye-slash",e.Eye="eye",e.Filter="filter",e.Flag="flag",e.FlashSlash="flash-slash",e.Flash="flash",e.FullCircle="full-circle",e.Gas="gas",e.GlobalSearch="global-search",e.Global="global",e.Graph="graph",e.Hardware="hardware",e.Heart="heart",e.Hierarchy="hierarchy",e.Home="home",e.Import="import",e.Info="info",e.Key="key",e.Light="light",e.Link="link",e.Loading="loading",e.LockCircle="lock-circle",e.LockSlash="lock-slash",e.Lock="lock",e.Login="login",e.Logout="logout",e.Menu="menu",e.MessageQuestion="message-question",e.Messages="messages",e.MinusBold="minus-bold",e.MinusSquare="minus-square",e.Minus="minus",e.Mobile="mobile",e.Money="money",e.Monitor="monitor",e.MoreHorizontal="more-horizontal",e.MoreVertical="more-vertical",e.NotificationCircle="notification-circle",e.Notification="notification",e.PasswordCheck="password-check",e.People="people",e.Pin="pin",e.ProgrammingArrows="programming-arrows",e.Custody="custody",e.Question="question",e.Received="received",e.Refresh="refresh",e.Save="save",e.ScanBarcode="scan-barcode",e.ScanFocus="scan-focus",e.Scan="scan",e.Scroll="scroll",e.Search="search",e.SecurityCard="security-card",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.Send1="send-1",e.Send2="send-2",e.Setting="setting",e.Slash="slash",e.SnapsMobile="snaps-mobile",e.SnapsPlus="snaps-plus",e.Snaps="snaps",e.Speedometer="speedometer",e.Star="star",e.Stake="stake",e.Student="student",e.SwapHorizontal="swap-horizontal",e.SwapVertical="swap-vertical",e.Tag="tag",e.Tilde="tilde",e.Timer="timer",e.Trash="trash",e.TrendDown="trend-down",e.TrendUp="trend-up",e.UserCircleAdd="user-circle-add",e.UserCircleLink="user-circle-link",e.UserCircleRemove="user-circle-remove",e.UserCircle="user-circle",e.User="user",e.WalletCard="wallet-card",e.WalletMoney="wallet-money",e.Wallet="wallet",e.Warning="warning",e.Twitter="twitter",e.QrCode="qr-code",e.UserCheck="user-check",e.Unpin="unpin",e.Ban="ban",e.Bold="bold",e.CircleX="circle-x",e.Download="download",e.FileIcon="file",e.Flask="flask",e.Plug="plug",e.Share="share",e.Square="square",e.Tint="tint",e.Upload="upload",e.Usb="usb",e.Wifi="wifi",e.PlusMinus="plus-minus"}(iA||(iA={}));const aA=Cw("Icon"),sA=({preferences:e})=>{const t=Hw(e.locale);return Iw(Pw,{direction:"horizontal",center:!0,children:[Tw(Bw,{fontWeight:"medium",children:t("confirmation.estimatedChanges")}),Tw(oA,{content:t("confirmation.estimatedChanges.tooltip"),children:Tw(aA,{name:"info"})})]})},cA=Cw("Skeleton"),uA=({preferences:e})=>{const t=Hw(e.locale);return Iw(Ow,{direction:"vertical",children:[Tw(sA,{preferences:e}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.send")}),Tw(Pw,{children:Iw(Pw,{direction:"vertical",crossAlignment:"end",children:[Tw(cA,{width:100,height:20}),Tw(cA,{width:40,height:20})]})})]}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.receive")}),Tw(Pw,{children:Iw(Pw,{direction:"vertical",crossAlignment:"end",children:[Tw(cA,{width:100,height:20}),Tw(cA,{width:40,height:20})]})})]})]})},lA=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const o=Hw(t.locale),i="fetched"===n,a="error"===n;if("fetching"===n)return Tw(uA,{preferences:t});if(a||i&&"ERROR"===r)return Iw(Ow,{direction:"vertical",children:[Tw(sA,{preferences:t}),Tw(Bw,{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 Iw(Ow,i&&!u?{direction:"vertical",children:[Tw(sA,{preferences:t}),Tw(Bw,{color:"alternative",children:o("confirmation.estimatedChanges.noChanges")})]}:{children:[Tw(sA,{preferences:t}),s?.length>0?Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.send")}),Tw(Pw,{children:Tw(Pw,{children:s?.map((e=>Tw(rA,{asset:e,preferences:t})))})})]}):null,Tw(Pw,{children:null}),c?.length>0?Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.receive")}),Tw(Pw,{children:Tw(Pw,{children:c?.map((e=>Tw(rA,{asset:e,preferences:t})))})})]}):null]})};var dA=function(e){return e.Cancel="confirm-sign-in-cancel",e.Confirm="confirm-sign-in-confirm",e}({});const fA={"confirm-sign-in-cancel":async function({id:e}){await sv(e,!1)},"confirm-sign-in-confirm":async function({id:e}){await sv(e,!0)}},hA=({params:e,origin:t,account:n,scope:r,preferences:o,networkImage:i})=>{const a=Hw(o.locale),s=t?Zw(t):null,{domain:c,statement:u,uri:l,version:d,chainId:f,nonce:h,issuedAt:p,expirationTime:g,notBefore:m,requestId:y,resources:v,address:w}=e,A=qw(r,n.address),b=w?qw(r,w):null,S=b!==A,E=c!==s;return Iw(Rw,{children:[Iw(Pw,{children:[Iw(Pw,{alignment:"center",center:!0,children:[Tw(Pw,{children:null}),Tw(Nw,{size:"lg",children:a("confirmation.signIn.title")}),Tw(Bw,{color:"muted",alignment:"center",children:a("confirmation.signIn.description")})]}),o.simulateOnChainActions?Tw(lA,{changes:null,scanStatus:null,preferences:o,scanFetchStatus:"fetched"}):null,Iw(Ow,{children:[s?Tw(Mw,{label:a("confirmation.origin"),tooltip:a("confirmation.origin.tooltip"),children:Tw(Bw,{children:s})}):null,Tw(Mw,{variant:E?"critical":"default",label:a("confirmation.signIn.domain"),tooltip:E?a("confirmation.signIn.badDomain"):void 0,children:Tw(Bw,{children:c??a("confirmation.signIn.unknownDomain")})}),Tw(Mw,{label:a("confirmation.signIn.signingInWith"),tooltip:S?a("confirmation.signIn.badAccount"):void 0,variant:S?"warning":"default",children:n.domain?Tw($w,{domain:n.domain,scope:r,address:n.address}):Tw(zw,{address:A,truncate:!0,displayName:!0,avatar:!0})})]}),Iw(Ow,{children:[Tw(Bw,{fontWeight:"medium",children:a("confirmation.signIn.message")}),Tw(Bw,{children:u??""}),Tw(Jw,{label:"URL",value:l??""}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Iw(Pw,{direction:"horizontal",alignment:"center",children:[Tw(Pw,{alignment:"center",center:!0,children:Tw(Uw,{borderRadius:"medium",src:i??xw})}),Tw(Bw,{children:fd[r].name})]})]}),b?Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),Tw(zw,{address:b,truncate:!0,displayName:!0,avatar:!0})]}):null,Tw(Jw,{label:a("confirmation.signIn.version"),value:d??""}),Tw(Jw,{label:a("confirmation.signIn.chainId"),value:f??""}),Tw(Jw,{label:a("confirmation.signIn.nonce"),value:h??""}),Tw(Jw,{label:a("confirmation.signIn.issuedAt"),value:p??""}),Tw(Jw,{label:a("confirmation.signIn.expirationTime"),value:g??""}),Tw(Jw,{label:a("confirmation.signIn.notBefore"),value:m??""}),Tw(Jw,{label:a("confirmation.signIn.requestId"),value:y??""}),v&&v.length>0?Iw(Pw,{alignment:"space-between",direction:"vertical",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:a("confirmation.signIn.resources")}),Tw(Pw,{direction:"vertical",children:v.map((e=>Tw(Bw,{children:e},e)))})]}):null]})]}),Iw(jw,{children:[Tw(Lw,{name:dA.Cancel,children:a("confirmation.cancelButton")}),Tw(Lw,{name:dA.Confirm,variant:E?"destructive":"primary",children:a("confirmation.confirmButton")})]})]})};var pA=function(e){return e.Cancel="confirm-sign-message-cancel",e.Confirm="confirm-sign-message-confirm",e}({});const gA={"confirm-sign-message-cancel":async function({id:e}){await sv(e,!1)},"confirm-sign-message-confirm":async function({id:e}){await sv(e,!0)}},mA=({message:e,account:t,scope:n,locale:r,networkImage:o,origin:i})=>{const a=Hw(r),{address:s}=t,c=i?Zw(i):null,u=qw(n,s);return Iw(Rw,{children:[Iw(Pw,{children:[Iw(Pw,{alignment:"center",center:!0,children:[Tw(Pw,{children:null}),Tw(Nw,{size:"lg",children:a("confirmation.signMessage.title")})]}),Iw(Ow,{children:[Tw(Pw,{direction:"horizontal",center:!0,children:Tw(Bw,{fontWeight:"medium",children:a("confirmation.signMessage.message")})}),Tw(Pw,{alignment:"space-between",children:Tw(Bw,{children:e})})]}),Iw(Ow,{children:[c?Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Iw(Pw,{alignment:"space-between",direction:"horizontal",center:!0,children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:a("confirmation.origin")}),Tw(oA,{content:a("confirmation.origin.tooltip"),children:Tw(aA,{name:"question",color:"muted"})})]}),Tw(Bw,{children:c})]}):null,Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),t.domain?Tw($w,{domain:t.domain,scope:n,address:s}):Tw(zw,{address:u,truncate:!0,displayName:!0,avatar:!0})]}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Iw(Pw,{direction:"horizontal",alignment:"center",children:[Tw(Pw,{alignment:"center",center:!0,children:Tw(Uw,{borderRadius:"medium",src:o??xw})}),Tw(Bw,{children:fd[n].name})]})]})]})]}),Iw(jw,{children:[Tw(Lw,{name:pA.Cancel,children:a("confirmation.cancelButton")}),Tw(Lw,{name:pA.Confirm,children:a("confirmation.confirmButton")})]})]})};var yA=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 vA={"confirm-sign-and-send-transaction-show-advanced":async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await av(e,Tw(PA,{context:n}),n)},"confirm-sign-and-send-transaction-cancel":async function({id:e}){await sv(e,!1)},"confirm-sign-and-send-transaction-confirm":async function({id:e}){await sv(e,!0)}},wA=e=>e.replace(/([A-Z])/gu," $1").trim().replace(/^./u,(e=>e.toUpperCase())),AA=({address:e,scope:t})=>Tw(Dw,{href:Fw(t,"address",e),children:Tw(zw,{avatar:!1,address:qw(t,e),truncate:!0})}),bA=({instruction:e,scope:t,locale:n})=>{const r=Hw(n),{type:o,encoded:i,parsed:a}=e,{programAddress:s,dataBase58:c}=i,u=null!==a,l=wA(o);return Iw(Ow,{alignment:"start",children:[Tw(Bw,{color:"alternative",fontWeight:"bold",children:l}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{color:"alternative",alignment:"start",children:r("confirmation.advanced.programId")}),Tw(AA,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map((([e,n])=>Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{color:"alternative",children:wA(e)}),Ys(n.address)?Tw(AA,{address:n.address,scope:t}):Tw(Bw,{children:tv(n.address)?.toString()??""})]}))),u&&Object.entries(a.data).map((([e,n])=>Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{color:"alternative",children:wA(e)}),Ys(n)?Tw(AA,{address:n,scope:t}):Tw(Bw,{children:tv(n)?.toString()??""})]}))),!u&&Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{color:"alternative",children:r("confirmation.advanced.data")}),Tw(Bw,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},SA=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const o=Hw(n),i=t?"hide":"show",a=t?"arrow-up":"arrow-down";return Iw(Pw,{alignment:"start",children:[Iw(Lw,{name:yA.ShowAdvanced,children:[o(`confirmation.advanced.${i}`)," ",Tw(aA,{name:a,color:"primary"})]}),t&&Tw(Pw,{children:e.map((e=>Tw(bA,{locale:n,scope:r,instruction:e})))})]})},EA=Cw("Banner"),kA={AccountAlreadyInUse:"transactionScan.errors.accountAlreadyInUse",ResultWithNegativeLamports:"transactionScan.errors.insufficientSol",SlippageToleranceExceeded:"transactionScan.errors.slippageToleranceExceeded",ExceededDesiredSlippageLimit:"transactionScan.errors.slippageToleranceExceeded"};function TA(e,t){const n=Hw(t.locale),{code:r}=e;return n((r&&kA[r])??"transactionScan.errors.unknownError")}const IA={Malicious:"danger",Warning:"warning"},xA=({preferences:e,validation:t,error:n,scanFetchStatus:r})=>{const o=Hw(e.locale);if("error"===r)return Tw(EA,{title:o("send.simulationTitleAPIError"),severity:"danger",children:Tw(Bw,{children:o("send.simulationMessageAPIError")})});if(!n&&!t)return Tw(Pw,{children:null});if(n)return Tw(EA,{title:o("confirmation.simulationErrorTitle"),severity:"warning",children:Tw(Bw,{children:o("confirmation.simulationErrorSubtitle",{reason:TA(n,e)})})});if(!t)return Tw(Pw,{children:null});const i=t?.type?IA[t.type]:void 0;return i?Iw(EA,{title:o("confirmation.validationErrorTitle"),severity:i,children:[Tw(Bw,{children:o("confirmation.validationErrorSubtitle")}),Tw(Bw,{size:"sm",children:Tw(Dw,{href:"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/",children:o("confirmation.validationErrorLearnMore")})}),Iw(Bw,{size:"sm",children:[Tw(aA,{color:"primary",name:"security-tick"})," ",o("confirmation.validationErrorSecurityAdviced")," ",Tw(Dw,{href:"https://www.blockaid.io",children:"Blockaid"})]})]}):Tw(Pw,{children:null})};function _A(e,t,n){return`${tA(e,n)} ${t}`}function CA(e,t){return new xo(e).multipliedBy(t).toString()}const RA=({origin:e,accountAddress:t,scope:n,feeInSol:r,nativePrice:o,fetchingPricesStatus:i,preferences:a,networkImage:s})=>{const{currency:c,locale:u}=a,l=Hw(u),d=e?Zw(e):null,f="fetching"===i,h=r&&o&&!("error"===i)?nA(CA(r,o),c,u):"";return Iw(Ow,{children:[d?Iw(Pw,{children:[Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Iw(Pw,{alignment:"space-between",direction:"horizontal",center:!0,children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:l("confirmation.origin")}),Tw(oA,{content:l("confirmation.origin.tooltip"),children:Tw(aA,{name:"question",color:"muted"})})]}),Tw(Bw,{children:d})]}),Tw(Pw,{children:null})]}):null,Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:l("confirmation.account")}),Tw(zw,{address:qw(n,t),truncate:!0,displayName:!0,avatar:!0})]}),Tw(Pw,{children:null}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:l("confirmation.network")}),Iw(Pw,{direction:"horizontal",alignment:"center",children:[Tw(Pw,{alignment:"center",center:!0,children:Tw(Uw,{borderRadius:"medium",src:s??""})}),Tw(Bw,{children:fd[n].name})]})]}),Tw(Pw,{children:null}),Iw(Pw,{alignment:"space-between",direction:"horizontal",children:[Tw(Bw,{fontWeight:"medium",color:"alternative",children:l("confirmation.fee")}),r?Iw(Pw,{direction:"horizontal",alignment:"center",children:[f?Tw(cA,{width:80}):Tw(Bw,{color:"muted",children:h}),Tw(Bw,{children:_A(r,fd[n].nativeToken.symbol,u)})]}):Tw(oA,{content:l("confirmation.feeError"),children:Tw(aA,{name:"warning"})})]})]})},PA=({context:e})=>{const t=Hw(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=fd[e.scope],o=e.tokenPrices[r.caip19Id]?.price??null,i="fetching"===e.scanFetchStatus||"ERROR"===e.scan?.status;return Iw(Rw,{children:[Iw(Pw,{children:[e.preferences.useSecurityAlerts?Tw(xA,{scanFetchStatus:e.scanFetchStatus,validation:e.scan?.validation??null,error:e.scan?.error??null,preferences:e.preferences}):null,Iw(Pw,{alignment:"center",center:!0,children:[Tw(Pw,{children:null}),Tw(Nw,{size:"lg",children:t(`confirmation.${e.method}.title`)}),Tw(Pw,{children:null})]}),e.preferences.simulateOnChainActions?Tw(lA,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,Tw(RA,{accountAddress:e.account?.address??null,scope:e.scope,feeInSol:n,nativePrice:o,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),Tw(SA,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),Iw(jw,{children:[Tw(Lw,{name:yA.Cancel,children:t("confirmation.cancelButton")}),Tw(Lw,{name:yA.Confirm,disabled:i,children:t("confirmation.confirmButton")})]})]})},NA={method:$t.SignAndSendTransaction,scope:ad.Mainnet,networkImage:xw,account: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 BA(e){const t={...NA,...e},n=uv().then((e=>{t.preferences=e})).catch((()=>{t.preferences=NA.preferences})),r=(async(e,t)=>{const n=await qg(t,e),r="instructions"in n?n:await Dg(n.messageBytes,e),{instructions:o}=r;return o.map(Xg)})(pE.getRpc(t.scope),t.transaction).then((e=>{t.advanced.instructions=e})).catch((e=>{ed.error(e),t.advanced.instructions=[]}));await Promise.all([n,r]);const{currency:o,useExternalPricingData:i,useSecurityAlerts:a,simulateOnChainActions:s}=t.preferences,c=await iv(Tw(PA,{context:t}),t),u=cv(c),l={...t},d=[fd[t.scope].nativeToken.caip19Id];i?await EE.getMultipleSpotPrices(d,o).then((e=>{l.tokenPrices=e,l.tokenPricesFetchStatus="fetched"})).catch((()=>{l.tokenPricesFetchStatus="error"})):(l.tokenPricesFetchStatus="fetched",l.tokenPrices={});let f=null;try{const{totalFee:e}=ym.calculateFee(t.transaction);f=vm(e).toString()}catch{f=null}l.feeEstimatedInSol=f,await av(c,Tw(PA,{context:l}),l);const h={...l},p=[];if(s&&p.push("simulation"),a&&p.push("validation"),s||a){const e=zE.scanTransaction({method:h.method,accountAddress:h.account?.address??"",transaction:h.transaction,scope:h.scope,origin:h.origin,options:p}).then((async e=>{h.scan=e,h.scanFetchStatus=e?"fetched":"error"})).catch((()=>{h.scan=null,h.scanFetchStatus="error"}));await Promise.all([e])}else h.scanFetchStatus="fetched",h.scan=null;return await av(c,Tw(PA,{context:h}),h),await lE.setKey(`mapInterfaceNameToId.${ov}`,c),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}}),u}function OA(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=MA(e,r);if(n?.length){r+=n.length-1,n.match(/\.|[eE]-/)?t.push(n):t.push(zA(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 MA(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 zA(e){return`{"$n":"${e}"}`}var UA=0n;function jA(){const e=UA;return UA++,e.toString()}function LA(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 Sa(ma,{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 DA(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:jA(),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 FA(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 $A={};function qA(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 WA(e,t){return n=>{const r=qA(e);return Object.freeze({...n,params:r(n.params,t)})}}function VA(e){return"bigint"==typeof e?Number(e):e}function KA({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 GA(e){return(t,{keyPath:n})=>("bigint"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var HA={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 ZA(e){const t=e?.onIntegerOverflow;return n=>{return uu(n,t?(r=t,e=>WA([GA(((...t)=>r(e,...t)))],{keyPath:[]})(e)):e=>e,WA([VA],{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:KA({commitmentPropertyName:"sendTransaction"===o?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:HA}));var r}}function JA(e){return t=[YA(e)],n={keyPath:[]},e=>qA(t)(e,n);var t,n}function YA(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!==$A||"number"!=typeof r))return!1}return!0}))}(n,e)?Number(t):BigInt(t):t}}function QA(e){return(t,n)=>{const r=n.methodName,o=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return uu(t,(e=>(e=>{const t=e;if("error"in t)throw Ca(t.error);return t})(e)),(e=>e.result),(e=>JA(o??[])(e,n)))}}var XA,eb=[["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",$A,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",$A,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",$A,"state","preUpdateAverageRate"],["data","parsed","info","extensions",$A,"state","currentRate"]],tb=[...eb,["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",$A,"confirmationCount"]],nb=[["index"],["instructions",$A,"accounts",$A],["instructions",$A,"programIdIndex"],["instructions",$A,"stackHeight"]],rb=[["addressTableLookups",$A,"writableIndexes",$A],["addressTableLookups",$A,"readonlyIndexes",$A],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",$A,"accounts",$A],["instructions",$A,"programIdIndex"],["instructions",$A,"stackHeight"]];function ob(e){return DA({requestTransformer:ZA(e),responseTransformer:QA({allowedNumericKeyPaths:ib()})})}function ib(){return XA||(XA={getAccountInfo:tb.map((e=>["value",...e])),getBlock:[["transactions",$A,"meta","preTokenBalances",$A,"accountIndex"],["transactions",$A,"meta","preTokenBalances",$A,"uiTokenAmount","decimals"],["transactions",$A,"meta","postTokenBalances",$A,"accountIndex"],["transactions",$A,"meta","postTokenBalances",$A,"uiTokenAmount","decimals"],["transactions",$A,"meta","rewards",$A,"commission"],...nb.map((e=>["transactions",$A,"meta","innerInstructions",$A,...e])),...rb.map((e=>["transactions",$A,"transaction","message",...e])),["rewards",$A,"commission"]],getClusterNodes:[[$A,"featureSet"],[$A,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[$A,"commission"]],getMultipleAccounts:tb.map((e=>["value",$A,...e])),getProgramAccounts:tb.flatMap((e=>[["value",$A,"account",...e],[$A,"account",...e]])),getRecentPerformanceSamples:[[$A,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:eb.map((e=>["value",$A,"account",...e])),getTokenAccountsByOwner:eb.map((e=>["value",$A,"account",...e])),getTokenLargestAccounts:[["value",$A,"decimals"],["value",$A,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",$A,"accountIndex"],["meta","preTokenBalances",$A,"uiTokenAmount","decimals"],["meta","postTokenBalances",$A,"accountIndex"],["meta","postTokenBalances",$A,"uiTokenAmount","decimals"],["meta","rewards",$A,"commission"],...nb.map((e=>["meta","innerInstructions",$A,...e])),...rb.map((e=>["transaction","message",...e]))],getVersion:[["feature-set"]],getVoteAccounts:[["current",$A,"commission"],["delinquent",$A,"commission"]],simulateTransaction:[...tb.map((e=>["value","accounts",$A,...e])),...nb.map((e=>["value","innerInstructions",$A,...e]))]}),XA}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 ab=["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 sb(e){return FA(e)&&ab.includes(e.method)}function cb(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 Sa(ga,{headers:c.headers,message:c.statusText,statusCode:c.status});return t?t(await c.text(),e):await c.json()}}({...e,fromJson:(e,t)=>sb(t)?OA(e):JSON.parse(e),toJson:e=>{return sb(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 ub=Object.prototype.toString,lb=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function db(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 db(e.toJSON(),t);if(c=ub.call(e),"[object Array]"===c){for(o="[",r=e.length-1,n=0;n<r;n++)o+=db(e[n],!0)+",";return r>-1&&(o+=db(e[n],!0)),o+"]"}if("[object Object]"===c){for(i=lb(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=db(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 fb(e){const t=db(e,!1);if(void 0!==t)return""+t}function hb(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 Sa(pa,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...void 0!==o?{path:o}:void 0});return Ea(i,hb),i}var pb,gb={defaultCommitment:"confirmed",onIntegerOverflow(e,t,n){throw hb(e.methodName,t,n)}},mb=globalThis.AbortController;function yb(e){return FA(e)?fb([e.method,e.params]):void 0}function vb(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function wb(e){return uu(cb({...e,headers:{...!1,...e.headers?vb(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 mb,o=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(pb||={}))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(pb||={})})),n(e.target.reason)};i.addEventListener("abort",r),e.then(t).catch(n).finally((()=>{i.removeEventListener("abort",r)}))}))}return await s.responsePromise}}(e,yb)))}function Ab(e){return LA({api:ob(gb),transport:e})}const bb=Ql,Sb=["getTransaction","getSignaturesForAddress"],Eb=e=>{const t=wb({url:e}),n=wb({url:e,headers:{"x-bigtable":"disabled"}});return async(...e)=>{const{payload:r}=e[0],{method:o}=r,i=Sb.includes(o);return bb.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${o}. ${i?"Enabling":"Disabling"} BigTable lookups.`),i?t(...e):n(...e)}},kb=Ql;async function Tb(e){try{await snap.request({method:"snap_trackError",params:{error:qr(new Error(JSON.stringify(e)))}}),kb.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){kb.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}function Ib(e){return!(!U(e,Hm)&&!Qm(e))||!!ba(e)}const xb=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{kb.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const o=await e(...t);if(Ib(o)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(o)}`,responseData:o,requestParams:n};return await Tb(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 Tb(t),e instanceof Error?e:new Error(t.errorMessage)}},_b=Ql;async function Cb(e){return new Promise((t=>setTimeout(t,e)))}const Rb=Ql;const Pb=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;let o;for(let n=0;n<4;n++)try{return Rb.info(`[🚌 RetryingTransport] Attempt "${r}" ${n+1} of 4`),await e(...t)}catch(e){if(Rb.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));Rb.info(`[🚌 RetryingTransport] Sleeping for ${e}ms`),await Cb(e)}}var i;throw o},Nb=e=>{return uu(e,(t=Eb,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 _b.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;_b.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)),Pb,(e=>xb(e)));var t};var Bb,Ob=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Mb=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}(),zb=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}(),Ub=(Bb=function(e,t){return Bb=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])},Bb(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}Bb(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function jb(e,t,n){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}function Lb(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 Db=Ob.concat(["bool","string"]),Fb=["option","enum","array","set","map","struct"],$b=function(e){function t(t,n){var r="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return e.call(this,r)||this}return Ub(t,e),t}(Error);function qb(e){if("string"!=typeof e||!Db.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&Fb.includes(t[0])){var n=t[0];if("option"===n)return qb(e[n]);if("enum"===n)return function(e){if(!Array.isArray(e))throw new $b(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');qb({struct:r.struct})}}(e[n]);if("array"===n)return function(e){if("object"!=typeof e)throw new $b(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return qb(e.type);throw new $b(e,"{ type, len? }")}(e[n]);if("set"===n)return qb(e[n]);if("map"===n)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new $b(e,"{ key, value }");qb(e.key),qb(e.value)}(e[n]);if("struct"===n)return function(e){if("object"!=typeof e)throw new $b(e,"object");for(var t in e)qb(e[t])}(e[n])}}throw new $b(e,Fb.join(", ")+" or "+Db.join(", "))}}!function(){function e(e){this.encoded=new Mb,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(Ob.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&&jb(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&&jb(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&&jb(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?Lb(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?Lb(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&&jb(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&&jb(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&&jb(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 Wb=function(){function e(e){this.buffer=new zb(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(Ob.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 Vb(e,t,n){return void 0===n&&(n=!0),n&&qb(e),new Wb(t).decode(e)}var Kb=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Kb||{});const Gb=nc(),Hb=(zs(),$s()),Zb=Gs(),Jb=ja(nu([["mint",ec()],["owner",ec()],["amount",gs()],["delegate",vf(ec(),{prefix:hs(),noneValue:"zeroes"})],["state",Zc(Kb)],["isNative",vf(gs(),{prefix:hs(),noneValue:"zeroes"})],["delegatedAmount",gs()],["closeAuthority",vf(ec(),{prefix:hs(),noneValue:"zeroes"})]]),ru([["mint",tc()],["owner",tc()],["amount",ms()],["delegate",wf(tc(),{prefix:ps(),noneValue:"zeroes"})],["state",Jc(Kb)],["isNative",wf(ms(),{prefix:ps(),noneValue:"zeroes"})],["delegatedAmount",ms()],["closeAuthority",wf(tc(),{prefix:ps(),noneValue:"zeroes"})]]));var Yb;!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"}(Yb||(Yb={}));class Qb extends Error{type;constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,Qb)}}class Xb extends Qb{constructor(e){super(Yb.PrimaryDomainNotFound,e)}}class eS extends Qb{constructor(e){super(Yb.NoRecordData,e)}}class tS extends Qb{constructor(e){super(Yb.AccountDoesNotExist,e)}}class nS extends Qb{constructor(e){super(Yb.NoAccountData,e)}}class rS extends Qb{constructor(e){super(Yb.InvalidInput,e)}}class oS extends Qb{constructor(e){super(Yb.InvalidRoA,e)}}class iS extends Qb{constructor(e){super(Yb.NftAccountNotFound,e)}}class aS extends Qb{constructor(e){super(Yb.PdaOwnerNotAllowed,e)}}class sS extends Qb{constructor(e){super(Yb.DomainDoesNotExist,e)}}class cS extends Qb{constructor(e){super(Yb.RecordMalformed,e)}}class uS extends Qb{constructor(e){super(Yb.CouldNotFindNftOwner,e)}}class lS extends Qb{constructor(e){super(Yb.InvalidValidation,e)}}class dS extends Qb{constructor(e){super(Yb.InvalidSerializedData,e)}}class fS{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=Gb.decode(e.parentName),this.owner=Gb.decode(e.owner),this.class=Gb.decode(e.class)}static deserialize(e){try{const t=new fS(Vb(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 vh(e,t);if(!n.exists)throw new tS("The domain account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await wh(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 hS="58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx",pS="nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk",gS="33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z",mS="2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo",yS=async(e,t,n)=>{const r=await(async e=>{const t=Zb.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?Gb.encode(n):new Uint8Array(32)),r.push(t?Gb.encode(t):new Uint8Array(32));const[o]=await gc({programAddress:"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX",seeds:r});return o})(r,t,n)};var vS;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(vS||(vS={}));class wS{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=Gb.decode(e.nameAccount),this.owner=Gb.decode(e.owner),this.nftMint=Gb.decode(e.nftMint)}static deserialize(e){try{return new wS(Vb(this.schema,e))}catch{throw new dS("Failed to deserialize NftState data")}}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new iS(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(pS,{encoding:"base64",filters:[{dataSize:BigInt(wS.LEN)},{memcmp:{offset:BigInt(0),bytes:"3",encoding:"base58"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:"base58"}}]}).send();if(1!==n.length)throw new iS(`NFT not found: ${t}`);return this.deserialize(Hb.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await gc({programAddress:pS,seeds:[Zb.encode("nft_record"),Gb.encode(e)]});return t}}const AS=Zb.encode("tokenized_name"),bS=async(e,t)=>{try{const n=await(async e=>{const[t]=await gc({programAddress:pS,seeds:[AS,Gb.encode(e)]});return t})(t),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const o=await vh(e,r.value[0].address);if(!o.exists)return null;const i=Jb.decode(o.data);return"1"===i.amount.toString()?i.owner:null}catch(e){if(ba(e,Yo))return null;throw e}};class SS{tag;nameAccount;static schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=Gb.decode(e.nameAccount)}static deserialize(e){try{return new SS(Vb(this.schema,e))}catch{throw new dS("Failed to deserialize PrimaryDomainState data")}}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new Xb("The favourite account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await wh(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 gc({programAddress:e,seeds:[Zb.encode("favourite_domain"),Gb.encode(t)]});return n}}async function ES(e,t,n){const r=await(async(e,t)=>await yS(e,t,gS))(t,n),o=await fS.retrieve(e,r);if(!o.data)throw new nS("The registry data is empty");return function(e,t=!1){if(!e)return;const n=new DataView(e.buffer).getUint32(0,!0);return Zb.decode(e.subarray(4,4+n)).replace(/^\0/,t?"":"\0")}(o.data,!!n)}var kS;!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"}(kS||(kS={}));new Map([[kS.SOL,96],[kS.ETH,20],[kS.BSC,20],[kS.Injective,20],[kS.A,4],[kS.AAAA,16],[kS.Background,32]]);var TS;!function(e){e[e.V1=1]="V1",e[e.V2=2]="V2"}(TS||(TS={}));const IS=async(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const n=t===TS.V2?mS:void 0,r={[TS.V2]:"",[TS.V1]:""}[t]||"\0",o=e.split(".");if(2===o.length){const e=await yS(o[1],hS);return{address:await yS(r+o[0],e,n),parentAddress:e,isSub:!0}}if(3===o.length&&t){const e=await yS(o[2],hS),t=await yS("\0"+o[1],e);return{address:await yS(r+o[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(o.length>=3)throw new rS("The domain is malformed");return{address:await yS(e,hS),isSub:!1}};function xS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function _S(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function CS(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function RS(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function PS(e){if(!Array.isArray(e))throw new Error("array expected")}function NS(e,t){if(!_S(!0,t))throw new Error(`${e}: array of strings expected`)}function BS(e,t){if(!_S(!1,t))throw new Error(`${e}: array of numbers expected`)}const OS=(e,t)=>0===t?e:OS(t,e%t),MS=(e,t)=>e+(t-OS(e,t)),zS=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function US(e,t,n,r){if(PS(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(MS(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${MS(t,n)}`);let o=0,i=0;const a=zS[t],s=zS[n]-1,c=[];for(const r of e){if(RS(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=zS[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 jS(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 LS=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;NS("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(PS(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=>(PS(t),t.map((t=>{CS("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 CS("join",e),{encode:t=>(NS("join.decode",t),t.join(e)),decode:t=>(CS("join.decode",t),t.split(e))}}("")),DS=[996825010,642813549,513874426,1027748829,705979059];function FS(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<DS.length;e++)1==(t>>e&1)&&(n^=DS[e]);return n}function $S(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=FS(o)^n>>5}o=FS(o);for(let t=0;t<r;t++)o=FS(o)^31&e.charCodeAt(t);for(let e of t)o=FS(o)^e;for(let e=0;e<6;e++)o=FS(o);return o^=n,LS.encode(US([o%zS[30]],30,5,!1))}!function(e){const t=function(e,t=!1){if(RS(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(MS(8,e)>32||MS(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!xS(n))throw new Error("radix2.encode input should be Uint8Array");return US(Array.from(n),8,e,!t)},decode:n=>(BS("radix2.decode",n),Uint8Array.from(US(n,e,8,t)))}}(5),n=t.decode,r=t.encode,o=jS(n);function i(e,t,n=90){CS("bech32.encode prefix",e),xS(t)&&Array.from(t),BS("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=$S(i,t,1);return`${i}1${LS.encode(t)}${a}`}function a(e,t=90){CS("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=LS.decode(a).slice(0,-6),c=$S(i,s,1);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:s}}jS(a)}();var qS,WS={exports:{}},VS=WS.exports;!function(){return qS||(qS=1,e=WS,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}(VS)),WS.exports;var e}();Math.floor,String.fromCharCode;new Map([[kS.CNAME,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"],[kS.Url,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"]]),new Set([kS.BASE,kS.BSC,kS.ETH,kS.Injective]),new Set([kS.BASE,kS.BSC,kS.ETH]),new Set([kS.ARWV,kS.Backpack,kS.BTC,kS.CNAME,kS.Discord,kS.DOGE,kS.Email,kS.Github,kS.IPFS,kS.IPNS,kS.LTC,kS.Pic,kS.POINT,kS.Reddit,kS.SHDW,kS.Telegram,kS.Twitter,kS.TXT,kS.Url]),new Set([kS.BASE,kS.BSC,kS.ETH,kS.Injective,kS.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 KS;!function(e){e[e.None=0]="None",e[e.Solana=1]="Solana",e[e.Ethereum=2]="Ethereum",e[e.UnverifiedSolana=3]="UnverifiedSolana"}(KS||(KS={}));const GS=e=>{switch(e){case KS.None:return 0;case KS.Ethereum:return 20;case KS.Solana:case KS.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class HS{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 HS(Vb(this.schema,e,!0))}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new Error("Record header account not found");return this.deserialize(n.data.slice(96,96+this.LEN))}}class ZS{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=HS.deserialize(e.slice(96,96+HS.LEN));return new ZS(t,e.slice(96+HS.LEN))}static async retrieve(e,t){const n=await vh(e,t);if(!n.exists)throw new eS("Record account not found");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await wh(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}getContent(){const e=GS(this.header.stalenessValidation)+GS(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){const e=GS(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=GS(this.header.stalenessValidation),t=e+GS(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}const JS=57896044618658097711785492504343953926634992332820282019728792003956564819949n,YS=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function QS(e){const t=e%JS;return t>=0n?t:JS+t}function XS(e,t){let n=e;for(;t-- >0n;)n*=n,n%=JS;return n}function eE(e,t){const n=QS(e*e),r=function(e,t){const n=QS(t*t*t),r=function(e){const t=e*e%JS*e%JS,n=XS(t,2n)*t%JS,r=XS(n,1n)*e%JS,o=XS(r,5n)*r%JS,i=XS(o,10n)*o%JS,a=XS(i,20n)*i%JS,s=XS(a,40n)*a%JS,c=XS(s,80n)*s%JS,u=XS(c,80n)*s%JS,l=XS(u,10n)*o%JS;return XS(l,2n)*e%JS}(e*QS(n*n*t));let o=QS(e*n*r);const i=QS(t*o*o),a=o,s=QS(o*YS),c=i===e,u=i===QS(-e),l=i===QS(-e*YS);return c&&(o=a),(u||l)&&(o=s),1n===(1n&QS(o))&&(o=QS(-o)),c||u?o:null}(QS(n-1n),QS(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}const tE=async(e,t,n={allowPda:!1})=>{const{address:r}=await IS(t),o=await wS.getAddress(r),i=await(async(e,t)=>{const{address:n}=await IS(t+"."+e,TS.V1);return n})(t,kS.SOL),a=await(async(e,t)=>{const{address:n}=await IS(e);return await yS(`${t}`,n,mS)})(t,kS.SOL),[s,c,u,l]=await wh(e,[r,o,i,a]);if(!s.exists)throw new sS(`Domain ${t} does not exist`);const d=fS.deserialize(s.data);if(c.exists&&wS.deserialize(c.data).tag===vS.ActiveRecord){const t=await bS(e,r);if(!t)throw new uS;return t}e:if(l.exists){const e=ZS.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new cS("Record is malformed");if(e.header.rightOfAssociationValidation!==KS.Solana||e.header.stalenessValidation!==KS.Solana)throw new lS;if(d.owner!==Gb.decode(t))break e;if(((e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])))(n,r))return Gb.decode(r);throw new oS(`The RoA ID shoudl be ${Gb.decode(r)} but is ${Gb.decode(n)} `)}if(u.exists){const e=new Uint8Array([...u.data.slice(fS.HEADER_LEN,fS.HEADER_LEN+32),...Gb.encode(i)]),t=u.data.slice(fS.HEADER_LEN+32,fS.HEADER_LEN+32+64),n=await(async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=ec().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!0,["verify"])}(n),o=Zb.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 Gb.decode(u.data.slice(fS.HEADER_LEN,fS.HEADER_LEN+32))}if(!function(e){const t=Gb.encode(e);if(32!==t.byteLength)return!1;return eE(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 vh(e,d.owner);if(!t.exists)throw new aS("Invalid domain owner account");const r=n.programIds?.some((e=>t.programAddress===e));if(r)return d.owner;throw new aS(`The program ${t.programAddress} is not allowed`)}throw new aS}return d.owner};const nE=cu(5000n);class rE{#se;constructor(e){this.#se=e}#ce(){const e=this.#se.getComputeUnitLimit(),t=this.#se.getComputeUnitPriceMicroLamportsPerComputeUnit();return uu(e,(e=>xo(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(rd.toString())),(e=>e.toString()),BigInt,cu)}getFee(){const e=this.#ce();return cu(nE+e)}}function oE(e){return e.includes("swift:0/iso4217:")}var iE=function(e){return e.Benign="Benign",e.Warning="Warning",e.Malicious="Malicious",e}({}),aE=function(e){return e.SUCCESS="SUCCESS",e.ERROR="ERROR",e}({});class sE{#ue;#T;#i;#le=4e4;#de=10000n;constructor(e,t,n){this.#ue=e,this.#T=t,this.#i=Xl(n,"[📩 SendSplTokenBuilder]")}async buildTransactionMessage(e){this.#i.log("Build transfer SPL token transaction message");const{from:t,to:n,mint:r,amount:o,network:i}=e;Wo(r,"Mint is required");const a=await this.#T.fetchMint(r,i),{programAddress:s,data:{decimals:c}}=a,u=await this.#ue.uiAmountToAmountForMint(r,i,o.toString()),l=await this.#T.getLatestBlockhash(i),{privateKeyBytes:d}=await ev({entropySource:t.entropySource,derivationPath:t.derivationPath}),f=await vl(d),[h,p]=await Promise.all([sE.deriveAssociatedTokenAccountAddress({mint:r,owner:f.address,tokenProgram:s}),sE.deriveAssociatedTokenAccountAddress({mint:r,owner:n,tokenProgram:s})]),g=uu($u({version:0}),(e=>Zu(f.address,e)),(e=>du(l,e)),(e=>Yu([Vf({mint:r,payer:f,tokenProgram:s,owner:n,ata:p}),fh({source:h,mint:r,destination:p,authority:f,amount:u,decimals:c},{programAddress:s})],e)));return Qu([of({units:this.#le}),lf({microLamports:this.#de})],g)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await $f({mint:e,owner:t,tokenProgram:n}))[0]}getComputeUnitLimit(){return this.#le}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#de}}const cE=new Ev,uE=new class{#i;#fe=new Map;constructor(e){this.#i=Xl(e,"[⚡ EventEmitter]")}on(e,t){this.#i.info(`Adding listener for event ${e}`),this.#fe.has(e)||this.#fe.set(e,new Set),this.#fe.get(e)?.add(t)}off(e,t){this.#i.info(`Removing listener for event ${e}`);const n=this.#fe.get(e);n&&(n.delete(t),0===n.size&&this.#fe.delete(e))}async emitSync(e,t){this.#i.info(`Emitting event ${e}`);const n=this.#fe.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.#fe.delete(e)):(this.#i.info("Removing all listeners for all events"),this.#fe.clear())}listenerCount(e){const t=this.#fe.get(e);return t?t.size:0}eventNames(){return Array.from(this.#fe.keys())}}(ed),lE=new class{#b;constructor(e,t){this.#b=t,e.on("onStart",this.#he.bind(this)),e.on("onUpdate",this.#he.bind(this)),e.on("onInstall",this.#he.bind(this))}async#he(){await this.update((e=>(0,Od.omit)(e,["assets"])))}async get(){const e=await snap.request({method:"snap_getState",params:{encrypted:this.#b.encrypted}}),t=tv(e??{});var n,r;return n=this.#b.defaultState,r=t,{...n,...Object.fromEntries(Object.entries(r).filter((([e,t])=>null!=t&&(!t||"object"!=typeof t||Object.keys(t).length>0))))}}async getKey(e){const t=await snap.request({method:"snap_getState",params:{key:e,encrypted:this.#b.encrypted}});if(null!==t)return tv(t)}async setKey(e,t){await snap.request({method:"snap_setState",params:{key:e,value:nv(t),encrypted:this.#b.encrypted}})}async update(e){return this.get().then((async t=>{const n=e(t);return await snap.request({method:"snap_manageState",params:{operation:"update",newState:nv(n),encrypted:this.#b.encrypted}}),n}))}async deleteKey(e){await this.update((t=>((0,Od.unset)(t,e),t)))}async deleteKeys(e){await this.update((t=>(e.forEach((e=>{(0,Od.unset)(t,e)})),t)))}}(uE,{encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},tokenPrices:{},subscriptions:{},webSocketConnections:{closeWebSocketConnectionsBackgroundEventId:null}}}),dE=new class{#pe;prefix;logger;constructor(e,t=console,n="__cache__default"){this.#pe=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.#ge(n),await this.#pe.setKey(`${this.prefix}.${e}`,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}#ge(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.#pe.setKey(this.prefix,{})}async has(e){return void 0!==await this.get(e)}async keys(){const e=await this.#pe.getKey(this.prefix);return Object.keys(e??{})}async size(){const e=await this.#pe.getKey(this.prefix);return Object.keys(e??{}).length}async peek(e){const t=await this.#pe.getKey(this.prefix),n=t?.[e];return n?.value}async mget(e){const t=await this.#pe.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.#ge(e)})),await this.#pe.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{Wo(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.#pe.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}}(lE,ed),fE=new class{#R=new Map;logger;constructor(e){this.logger=Xl(e,"[💾 InMemoryCache]")}#ge(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")}}#ae(e){return e.expiresAt<Date.now()}async#me(){const e=[];for(const[t,n]of this.#R.entries())this.#ae(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.#ge(n),this.#R.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.#R.clear()}async has(e){const t=this.#R.get(e);return!!t&&(!this.#ae(t)||(this.#R.delete(e),!1))}async keys(){return await this.#me(),Array.from(this.#R.keys())}async size(){return await this.#me(),this.#R.size}async peek(e){const t=this.#R.get(e);if(t){if(!this.#ae(t))return t.value;this.#R.delete(e)}}async mget(e){await this.#me();const t={};for(const n of e){const e=this.#R.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.#ge(e)})),e.forEach((({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#R.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}));else{Wo(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.#R.delete(e)])))}}(Ql),hE=new class{#i;constructor(e=ed){this.#i=Xl(e,"[📣 AnalyticsService]")}async#ye(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.#ye("Transaction Added",{message:"Snap transaction added",origin:t.origin,account_type:e.type,chain_id_caip:t.scope})}async trackEventTransactionApproved(e,t){await this.#ye("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.#ye("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.#ye("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.#ye("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.#ye("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.#ye("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.#ye("WebSocket Connection Closed Not Cleanly",{message:"Snap WebSocket connection closed not cleanly",origin:e,code:t,reason:n})}}(ed),pE=new class{#I;#R;#ve={fetchMint:gv.Minute};#we=new Map;constructor(e,t){this.#I=e,this.#R=t}#Ae(e){const t=this.#I.getNetworkBy("caip2Id",e),n=Ab(Nb(t.rpcUrls));return this.#we.set(e,n),n}getRpc(e){return M(e,Sd),this.#we.get(e)??this.#Ae(e)}async fetchMint(e,t,n){return nd((async(r,o,i)=>Oh(this.getRpc(t),Xs(e),n)),this.#R,{ttlMilliseconds:this.#ve.fetchMint,functionName:"SolanaConnection::fetchMint"})(Xs(e),t,n)}async getLatestBlockhash(e){return(await this.getRpc(e).getLatestBlockhash().send()).value}}(cE,fE),gE=new class{#I;constructor(e){this.#I=e}async getAll(){return(await snap.request({method:"snap_getWebSockets"})).map((e=>({...e,network:this.#be(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}})}#be(e){const t=this.#I.getNetworkBy("webSocketUrl",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(cE),mE=new class{#Se;#Ee;#I;#pe;#q;#i;#ke;#Te;#Ie=new Map;#xe=new Map;#_e;#Ce="webSocketConnections";constructor(e,t,n,r,o,i){const{maxReconnectAttempts:a,reconnectDelayMilliseconds:s,closeConnectionsGracePeriodMilliseconds:c}=n.get().subscriptions;this.#Se=e,this.#Ee=t,this.#I=n,this.#pe=r,this.#q=o,this.#i=Xl(i,"[🔌 WebSocketConnectionService]"),this.#ke=a,this.#Te=s,this.#_e=c,this.#V()}#V(){const e=this.#Re.bind(this),t=this.#Pe.bind(this),n=this.#K.bind(this),r=this.#Ne.bind(this),o=this.#G.bind(this);this.#q.on("onStart",e),this.#q.on("onUpdate",e),this.#q.on("onInstall",e),this.#q.on("onActive",t),this.#q.on("onInactive",n),this.#q.on("onWebSocketEvent",o),this.#q.on("onListWebSockets",r)}async#Re(){this.#i.log("Setting up connections");const{active:e}=await async function(){return await snap.request({method:"snap_getClientStatus"})}();e?await this.#Be():await this.closeAllConnections()}async#Be(){this.#i.log("Opening connections for active networks");const e=await this.#I.getActiveNetworks();this.#xe.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.#I.getNetworkBy("caip2Id",e),{webSocketUrl:n}=t;await this.#Se.findByNetwork(e)?this.#i.log(`✅ Connection for network ${e} already exists`):await this.#Se.save({network:e,url:n,protocols:[]})}async closeAllConnections(){this.#i.log("Closing all connections");const e=await this.#Se.getAll();await Promise.allSettled(e.map(this.#Oe.bind(this))),await this.#pe.setKey(`${this.#Ce}.closeWebSocketConnectionsBackgroundEventId`,null)}async#Oe(e){this.#i.log(`Closing connection for network ${e.network}`),await this.#Se.delete(e.id)}onConnectionRecovery(e,t){const n=this.#Ie.get(e)??[];this.#Ie.set(e,[...n,t])}async findByNetwork(e){return await this.#Se.findByNetwork(e)??null}async findById(e){return this.#Se.getById(e)}async#G(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.#Me(e);break;case"close":await this.#ze(e);break;default:this.#i.warn(`Unknown connection event type: ${n}`)}}async#Me(e){const{id:t}=e,n=await this.#Se.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.#xe.delete(r);const o=this.#Ie.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#ze(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.#I.get(),a=i.find((e=>e.webSocketUrl.startsWith(n)));a?(await this.#Ee.trackEventWebSocketConnectionClosedNotCleanly(n,r,o),await this.#Ue(a.caip2Id)):this.#i.warn("No network found for origin",n)}async#Ue(e){const t=this.#xe.get(e)??0,n=t+1;if(this.#xe.set(e,n),n>this.#ke)return void this.#i.error(`❌ Failed to reconnect to ${e} after ${this.#ke}/${this.#ke} attempts. Giving up.`);const r=this.#Te*Math.pow(2,t);this.#i.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#ke})`),await new Promise((t=>{setTimeout((()=>{this.openConnection(e).catch((t=>{this.#i.info(`Error opening connection for ${e}`,t)})).finally((()=>t()))}),r)}))}async#Ne(){const e=await this.#Se.getAll();this.#i.log("All connections",{connections:e,connectionRecoveryHandlers:this.#Ie})}async#Pe(){this.#i.log("Client became active"),await this.#je(),await this.#Be()}async#K(){this.#i.log("Client became inactive"),await this.#je();const e=Math.floor(this.#_e/1e3),t=await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:`PT${e}S`,request:{method:"closeWebSocketConnections"}}});await this.#pe.setKey(`${this.#Ce}.closeWebSocketConnectionsBackgroundEventId`,t),this.#i.log(`Scheduled background event to close connections after ${e}s`,t)}async#je(){try{const e=await this.#pe.getKey(`${this.#Ce}.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.#pe.setKey(`${this.#Ce}.closeWebSocketConnectionsBackgroundEventId`,null)}}}(gE,hE,cE,lE,uE,ed),yE=new class{#pe;#Ce="subscriptions";constructor(e){this.#pe=e}async getAll(){const e=await this.#pe.getKey(`${this.#Ce}`);return Object.values(e??{})}async getById(e){return await this.#pe.getKey(`${this.#Ce}.${e}`)}async save(e){await this.#pe.setKey(`${this.#Ce}.${e.id}`,e)}async delete(e){await this.#pe.deleteKey(`${this.#Ce}.${e}`)}async deleteMany(e){const t=e.map((e=>`${this.#Ce}.${e}`));await this.#pe.deleteKeys(t)}async update(e){await this.#pe.setKey(`${this.#Ce}.${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.#pe.deleteKey(`${this.#Ce}`)}}(lE),vE=new kw(mE,yE,cE,uE,ed),wE=new class{#T;constructor(e){this.#T=e}async uiAmountToAmountForMint(e,t,n){const r=await this.#T.fetchMint(e,t);return this.#Le(r,n)}async amountToUiAmountForMint(e,t,n){const r=await this.#T.fetchMint(e,t);return this.#De(r,n)}#Le(e,t){try{const o=(n=e.data?.extensions,mf(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 cu(BigInt(xo(t).multipliedBy(10**i).toString()));const c=Date.now()/1e3;if(a){return cu(_g(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 cu(Cg(t,i,e))}throw new Error("Unknown mint extension type")}catch(n){const r=e?.data?.decimals??9;return cu(BigInt(xo(t).multipliedBy(10**r).toString()))}var n,r}#De(e,t){try{const n=1000000000n,r=xo(this.#Le(e,n.toString()).toString()).dividedBy(n.toString());return xo(t.toString()).dividedBy(r).toString()}catch(n){const r=e.data?.decimals??9;return xo(t.toString()).dividedBy(10**r).toString()}}}(pE),AE=new bw(pE,ed),bE=new class{#T;#i;#le=450;#de=10000n;constructor(e,t){this.#T=e,this.#i=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:o}=e,i=Xs(t.address),a=BigInt(wm(r).toString()),s=await this.#T.getLatestBlockhash(o),c=uu($u({version:0}),(e=>Zu(i,e)),(e=>du(s,e)),(e=>Ju(function(e,t){const n=t?.programAddress??Rl,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},o={...e},i=Ol(n);return{accounts:[i(r.source),i(r.destination)],programAddress:n,data:Kl().encode(o)}}({amount:a,destination:n,source:wl(i)}),e)));return Qu([of({units:this.#le}),lf({microLamports:this.#de})],c)}catch(e){throw this.#i.error({error:e},"Error building transaction message"),e}}getComputeUnitLimit(){return this.#le}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#de}}(pE,ed),SE=new sE(wE,pE,ed),EE=new class{#o;#i;#a;#s;#R;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=ed){const{baseUrl:o,chunkSize:i,cacheTtlsMilliseconds:a}=e.get().priceApi;M(o,gd),this.#o=n,this.#i=r,this.#a=o,this.#s=i,this.cacheTtlsMilliseconds=a,this.#R=t}async getFiatExchangeRates(){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#Fe(e,t="usd"){try{if(M(e,K(Lo)),M(t,jd),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=Bd({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 M(o,Ud),o}))),i=o.reduce(((e,t)=>({...e,...t})),{});return await this.#R.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#$e(e,t="usd"){const n=[...new Set(e)],r="PriceApiClient:getMultipleSpotPrices",o=e=>`${r}:${e}:${t}`,i=await this.#R.mget(n.map(o)),a=(0,Od.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.#Fe(s,t);return await this.#R.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.#$e(e,t)}async#qe(e){M(e,Ld);const t=Bd({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 M(r,Dd),r}async getHistoricalPrices(e){return nd(this.#qe.bind(this),this.#R,{functionName:"PriceApiClient:getHistoricalPrices",ttlMilliseconds:this.cacheTtlsMilliseconds.historicalPrices})(e)}}(cE,fE),kE=new Hd(cE),TE=new class{#o;#i;#a;#R;#ve;constructor(e,t,n=globalThis.fetch,r=ed){const{baseUrl:o,cacheTtlsMilliseconds:i}=e.get().nftApi;M(o,gd),this.#o=n,this.#i=r,this.#a=o,this.#ve=i,this.#R=t}#We(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.#Ve(e.nft_token)})))}}async#Ke(e){let t,n=[];do{const r=Bd({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.#We(i);n=[...n,...a.items],t=a.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return nd(this.#Ke.bind(this),this.#R,{functionName:"NftApiClient:listAddressSolanaNfts",ttlMilliseconds:this.#ve.listAddressSolanaNfts})(e)}#Ve(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#Ge(e){try{const t=Bd({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.#Ve(r)}catch(e){return null}}async getNftMetadata(e){return nd(this.#Ge.bind(this),this.#R,{functionName:"NftApiClient:getNftMetadata",ttlMilliseconds:this.#ve.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map((async e=>this.getNftMetadata(e))))}}(cE,fE),IE=new class{#He;#i;cacheTtlsMilliseconds;constructor({configProvider:e,priceApiClient:t,logger:n}){this.#He=t,this.#i=n;const{cacheTtlsMilliseconds:r}=e.get().priceApi;this.cacheTtlsMilliseconds=r}#Ze(e){if(!oE(e))throw new Error("Passed caipAssetType is not a fiat asset");return Fo(e).assetReference.toLowerCase()}async#Je(e){const t=e.filter((e=>!oE(e))),[n,r]=await Promise.all([this.#He.getFiatExchangeRates(),this.#He.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.#Je(t),o={};return e.forEach((e=>{const{from:t,to:i}=e;let a,s;if(o[t]||(o[t]={}),oE(t)){const e=n[this.#Ze(t)]?.value;if(!e)return void(o[t][i]=null);a=new xo(1).dividedBy(e)}else a=new xo(r[t]?.price??0);if(oE(i)){const e=n[this.#Ze(i)]?.value;if(!e)return void(o[t][i]=null);s=new xo(1).dividedBy(e)}else s=new xo(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}#Ye(e,t){const n=(0,Od.pick)(e,["marketCap","totalVolume","circulatingSupply","allTimeHigh","allTimeLow","pricePercentChange1h","pricePercentChange1d","pricePercentChange7d","pricePercentChange14d","pricePercentChange30d","pricePercentChange200d","pricePercentChange1y"]),r=e=>null==e?"":new xo(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.#Je(t),o={};return e.forEach((e=>{const{asset:t,unit:i}=e;if(!r[t])return;let a;if(oE(i)){const e=n[this.#Ze(i)]?.value;if(!e)return;a=new xo(1).dividedBy(e)}else a=new xo(r[i]?.price??0);a.isZero()||(o[t]||(o[t]={}),o[t][i]=this.#Ye(r[t],a))})),o}async getHistoricalPrice(e,t){M(e,it),M(t,it);const n=Fo(t).assetReference.toLowerCase();M(n,jd);const r=["1d","7d","1m","3m","1y","1000y"].map((async r=>this.#He.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:Fd}))))),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:cE,priceApiClient:EE,logger:ed}),xE=new class{#T;#i;tld=".sol";constructor(e,t){this.#T=e,this.#i=t}async resolveDomain(e,t){const n=this.#T.getRpc(e);return tE(n,t)}async resolveAddress(e,t){try{const n=this.#T.getRpc(e);return`${(await(async(e,t)=>{const n=await SS.getAddress("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29",t),r=await SS.retrieve(e,n),[o,i]=await Promise.all([fS.retrieve(e,r.nameAccount),bS(e,r.nameAccount)]),a=i||o.owner,s=o.parentName!==hS,c=[ES(e,r.nameAccount,s?o.parentName:void 0)];s&&c.push(ES(e,o.parentName));const u=(await Promise.all(c)).join(".");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})(n,Xs(t))).domainName}.sol`}catch(e){return this.#i.error("Error resolving address",e),null}}}(pE,ed),_E=new class{#pe;constructor(e){this.#pe=e}async findByKeyringAccountId(e){return await this.#pe.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#pe.getKey("assetEntities")??{};return Object.values(e).flat()}async saveMany(e){await this.#pe.update((t=>{const n=(0,Od.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,Od.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}))}}(lE),CE=new Aw({connection:pE,logger:ed,configProvider:cE,assetsRepository:_E,tokenApiClient:kE,cache:fE,tokenPricesService:IE,nftApiClient:TE}),RE=new class{#pe;constructor(e){this.#pe=e}async getAll(){const e=await this.#pe.getKey("keyringAccounts");return Object.values(e??{})}async findById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByAddress(e){return(await this.getAll()).find((t=>t.address===e))??null}async save(e){await this.#pe.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#pe.deleteKey(`keyringAccounts.${e}`)}}(lE),PE=new class{#Qe;constructor(e){this.#Qe=e}async getAll(){return this.#Qe.getAll()}async findById(e){return this.#Qe.findById(e)}async findByAddress(e){return this.#Qe.findByAddress(e)}async save(e){return this.#Qe.save(e)}async delete(e){return this.#Qe.delete(e)}}(RE),NE=new class{#pe;#Ce="transactions";constructor(e){this.#pe=e}async getAll(){const e=await this.#pe.getKey(this.#Ce);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#pe.getKey(`${this.#Ce}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#pe.update((t=>{const n=t[this.#Ce];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,Od.chain)([...i,e]).uniqBy("id").sortBy((e=>-(e.timestamp??0))).value();t[this.#Ce][o]=s})),t}))}}(lE),BE=new class{#ue;#Xe;#i;constructor(e,t,n){this.#ue=e,this.#Xe=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.#et(e);let l=[],d=[],f=[];const h=(u===It.Failed?this.#tt.bind(this):this.#nt.bind(this))({scope:n,transactionData:e});l=h.fees,d=h.from,f=h.to;const{from:p,to:g}=await this.#rt({scope:n,transactionData:e});let m=[...p,...d],y=[...g,...f];const v=this.#ot({address:Xs(a),status:u,from:m,to:y});v===xt.Swap&&(m=m.filter((e=>e.address===a)),y=y.filter((e=>e.address===a))),v===xt.Receive&&(y=y.filter((e=>e.address===a)),l=[]);const w=[...new Set([...m,...y].filter((e=>e.asset?.fungible)).map((e=>e.asset.type)))],A=r??await this.#Xe.getAssetsMetadata(w);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:v,from:m,to:y,fees:l,events:[{status:u,timestamp:c}]}}catch(e){return this.#i.warn(e,"Error mapping transaction"),null}}#et(e){return e.meta?.err||e.meta?.status&&"Err"in e.meta.status?It.Failed:It.Confirmed}#ot({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===It.Failed)return xt.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?xt.Send:a&&s?xt.Swap:a?xt.Send:xt.Receive}#nt({scope:e,transactionData:t}){const n=this.#it({scope:e,transactionData:t}),r=[],o=[],i=new Map(t.meta?.preBalances?.map(((e,t)=>[t,new xo(e.toString())]))??[]),a=new Map(t.meta?.postBalances?.map(((e,t)=>[t,new xo(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 xo(0),l=a.get(n)??new xo(0),d=0===n?vm(t.meta?.fee??0):new xo(0),f=u.minus(l).dividedBy(new xo(od)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();u.isGreaterThan(l)&&r.push({address:c,asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:h}}),u.isLessThan(l)&&o.push({address:c,asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:h}})}const u=this.#at({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}}#tt({scope:e,transactionData:t}){const n=this.#it({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]!==Rl)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=qd.decode(a);if(2!==this.#st(f))return;const h=this.#ct(f);o.push({address:l,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}}),i.push({address:d,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}})}));return{fees:n,from:this.#ut(o),to:this.#ut(i)}}#at({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===Rl));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.#ct(qd.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}}),o.push({address:f,asset:{amount:h.toString(),fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol}})})),{from:r,to:o}}async#rt({scope:e,transactionData:t}){const n=[],r=[],o=new Map(t.meta?.preTokenBalances?.map((e=>[e.accountIndex,new xo(e.uiTokenAmount.amount)]))??[]),i=new Map(t.meta?.postTokenBalances?.map((e=>[e.accountIndex,new xo(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 xo(0),c=(i.get(s)??new xo(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=ww(e,l),h=c.absoluteValue().toString(),p=(await this.#ue.amountToUiAmountForMint(l,e,cu(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=>em(e,t))).map(Xg).filter(this.#dt.bind(this)).forEach((n=>{const i=(0,Od.get)(n,"parsed.accounts.authority.address"),a=(0,Od.get)(n,"parsed.accounts.source.address");if(!i||!a)return;const s=t.transaction.message.accountKeys.indexOf(Xs(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=xo(l).dividedBy(new xo(10).pow(u)).toString(),f=ww(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}}#it({scope:e,transactionData:t}){const n=this.#ft(t),r=this.#ht(t),o=n.minus(r),i=[{type:"base",asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:r.toString()}}];return o?.isGreaterThan(0)&&i.push({type:"priority",asset:{fungible:!0,type:fd[e].nativeToken.caip19Id,unit:fd[e].nativeToken.symbol,amount:o.toString()}}),i}#ft(e){return new xo(e.meta?.fee?.toString()??"0").dividedBy(od)}#ht(e){const t=e.transaction.signatures.length;return xo(5e3).dividedBy(od).multipliedBy(t)}#ut(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 xo(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e}),[])}#st(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}#ct(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return xo(t.toString()).dividedBy(od)}#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}}(wE,CE,ed),OE=new class{#pt;#gt;#mt;#Xe;#T;#i;constructor(e,t,n,r,o,i){this.#pt=e,this.#gt=t,this.#mt=n,this.#Xe=r,this.#T=o,this.#i=Xl(i,"[💱 TransactionsService]")}async fetchBySignature(e,t,n){const r=await this.#T.getRpc(n).getTransaction(bc(e),{maxSupportedTransactionVersion:0}).send();return r?this.#gt.mapRpcTransaction(r,t,n):null}async fetchAssetsTransactions(e,t){const n=await this.#mt.getAll(),r=e.map((e=>e.assetType)),o=await this.#Xe.getAssetsMetadata(r),i=await this.#pt.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=>ww(t,n)===(0,Od.get)(e,"asset.type")))||e.to.some((e=>ww(t,n)===(0,Od.get)(e,"asset.type")))));return r||null})(e),o=r?bc(r?.id):void 0;return(await this.#T.getRpc(t).getSignaturesForAddress(Xs(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.#T.getRpc(n.network).getTransaction(bc(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.#gt.mapRpcTransaction(t,r,n.network,o):null})))).filter((e=>null!==e)).filter((e=>{const t=u(e.account);return!!t&&!Ew(e,t)}))}async fetchLatestSignatures(e,t,n){return(await this.#T.getRpc(e).getSignaturesForAddress(t,n).send()).map((({signature:e})=>e))}async findByAccounts(e){return(await Promise.all(e.map((async e=>this.#pt.findByAccountId(e.id))))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#pt.saveMany(e);const t=(0,Od.groupBy)(e,"account");await vn(snap,gn.AccountTransactionsUpdated,{transactions:t})}}(NE,BE,PE,CE,pE,ed),ME=new class{#mt;#Xe;#yt;#i;constructor(e,t,n,r){this.#mt=e,this.#Xe=t,this.#yt=n,this.#i=Xl(r,"[🔄 AccountsSynchronizer]")}async synchronize(e){const t=e??await this.#mt.getAll();this.#i.info("Synchronizing accounts",t);const n=(await Promise.allSettled(t.map((async e=>this.#Xe.fetch(e))))).map((e=>"fulfilled"===e.status?e.value:[])).flat();await this.#Xe.saveMany(n);const r=await this.#yt.fetchAssetsTransactions(n,{limit:20});await this.#yt.saveMany(r)}}(PE,CE,OE,ed),zE=new class{#vt;#i;#Ee;constructor(e,t,n){this.#vt=e,this.#Ee=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.#vt.scanTransactions({method:e,accountAddress:t,transactions:[n],scope:r,origin:o===id?"https://metamask.io":o,options:i}),c=this.#wt(s);if(!c?.status)return this.#i.warn("Invalid scan result received from security alerts API"),a&&await this.#Ee.trackEventSecurityScanCompleted(a,o,r,aE.ERROR,!1),null;if(a){const e=Object.values(aE).includes(c.status)?c.status:aE.ERROR,t=Boolean(c.validation?.type&&c.validation.type!==iE.Benign),n=[this.#Ee.trackEventSecurityScanCompleted(a,o,r,e,t)];if(t){const e=Object.values(iE).includes(c.validation.type)?c.validation.type:iE.Warning;n.push(this.#Ee.trackEventSecurityAlertDetected(a,o,r,e,c.validation.reason??"unknown",this.#At(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 Aw.generateImageComponent(n,16,16).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.#Ee.trackEventSecurityScanCompleted(a,o,r,aE.ERROR,!1),null}}#At(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}`}#wt(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=ed){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=Wd.from(qd.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:Vd[r],transactions:n,options:i})})).json()}}(cE),hE,ed),UE=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case $t.SignAndSendTransaction:case $t.SignTransaction:return this.#bt(e,t);case $t.SignMessage:return this.#St(e,t);case $t.SignIn:return this.#Et(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#bt(e,t){M(e.request,ae([Ay,Ey]));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:Bv.OnTransactionAdded,params:{accountId:i,metadata:{scope:o,origin:a}}}}});return await BA({...NA,scope:o,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Bv.OnTransactionApproved,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!0):(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Bv.OnTransactionRejected,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!1)}async#St(e,t){const n=await async function(e,t){M(e.request,Sy);const{request:{params:{message:n}},scope:r,origin:o}=e,i=$s().encode(n),a=Gs().decode(i),s=await uv().then((e=>e.locale)).catch((()=>Gw));return cv(await iv(Tw(mA,{message:a,account:t,scope:r,locale:s,networkImage:xw,origin:o}),{}))}(e,t);return Boolean(n)}async#Et(e,t){const n=await async function(e,t){M(e.request,by);const{request:{params:n},scope:r,origin:o}=e,i=await uv();return cv(await iv(Tw(hA,{params:n,account:t,scope:r,preferences:i,networkImage:xw,origin:o}),{}))}(e,t);return Boolean(n)}},jE=new class{#kt;#Tt;#yt;#Ee;#T;#I;#i;#It=new Map;#xt=10*gv.Minute;constructor(e,t,n,r,o,i,a){this.#kt=e,this.#Tt=t,this.#yt=n,this.#Ee=r,this.#T=o,this.#I=i,this.#i=Xl(a,"[✍️ SignatureMonitor]"),this.#V()}#V(){vv.forEach((e=>{this.#kt.registerNotificationHandler("signatureSubscribe",e,this.#_t.bind(this)),this.#kt.registerConnectionRecoveryHandler(e,this.#Ct.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.#kt.subscribe(i);this.#It.set(a,i)}async#_t(e,t){try{const{network:e}=t,n=(0,Od.get)(t,"params[0]");M(n,re());const r=(0,Od.get)(t,"params[1].commitment");M(r,rm);const o=t.metadata?.accountId;M(o,re());const i=t.metadata?.origin;M(i,re());const a=await this.#Tt.findById(o);if(!a)throw new Error(`Account not found: ${o}`);const s=await this.#yt.fetchBySignature(n,a,e);if(!s)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(r){case"processed":await this.#yt.save(s),await this.#Ee.trackEventTransactionSubmitted(a,n,{scope:e,origin:i});break;case"confirmed":case"finalized":await this.#yt.save(s),await this.#Ee.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.#kt.unsubscribe(t.id),this.#It.delete(t.id)}}async#Ct(){this.#i.info("Handling connection recovery"),await Promise.all(Array.from(this.#It.entries()).map((async([e,t])=>{await this.#Rt(t,e)})))}async#Rt(e,t){try{const{network:n}=e;M(n,re());const r=(0,Od.get)(e,"params[0]");M(r,re());const o=(0,Od.get)(e,"params[1].commitment");M(o,rm);const i=await this.#Pt(r,n);if(!i)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#Nt(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.#_t(a,s),this.#It.delete(t)}catch(e){this.#i.error("Error handling connection recovery",e)}}async#Pt(e,t){const n=await this.#T.getRpc(t).getSignatureStatuses([bc(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}#Nt(e,t){return t===e||"processed"===t&&("confirmed"===e||"finalized"===e)||"confirmed"===t&&"finalized"===e}}(vE,PE,OE,hE,pE,cE,ed),LE=new class{#kt;#Tt;#Xe;#yt;#Bt;#ue;#I;#q;#i;#Ot=new Map;#Mt=[Cf,Uh];constructor(e,t,n,r,o,i,a,s,c){this.#kt=e,this.#Tt=t,this.#Xe=n,this.#yt=r,this.#Bt=o,this.#ue=i,this.#q=s,this.#I=a,this.#i=Xl(c,"[🗝️ KeyringAccountMonitor]"),this.#V()}#V(){this.#i.info("Binding handlers"),this.#q.on("onStart",this.#zt.bind(this)),this.#q.on("onUpdate",this.#zt.bind(this)),this.#q.on("onInstall",this.#zt.bind(this)),vv.forEach((e=>{this.#kt.registerNotificationHandler("accountSubscribe",e,this.#Ut.bind(this)),this.#kt.registerNotificationHandler("programSubscribe",e,this.#jt.bind(this))})),vv.forEach((e=>{this.#kt.registerConnectionRecoveryHandler(e,this.#Ct.bind(this))}))}async#zt(){this.#i.info("Handling onStart/onUpdate/onInstall");const e=await this.#Tt.getAll(),t=Array.from(this.#Ot.keys());await Promise.allSettled(t.map((async t=>{const n=e.find((e=>e.id===t));n&&await this.stopMonitorKeyringAccount(n)}))),await Promise.allSettled(e.map((async e=>{await this.monitorKeyringAccount(e)})))}async monitorKeyringAccount(e){try{this.#i.log("Monitoring keyring account",e);const{id:t}=e,n=await this.#I.getActiveNetworks();if(this.#Ot.has(t))return void this.#i.log("Account is already being monitored",e);const r=t=>e.scopes.includes(t),o=n.filter(r).map((async t=>this.#Lt(e,t))),i=n.filter(r).map((async t=>{await Promise.all(this.#Mt.map((async n=>this.#Dt(e,n,t))))}));await Promise.all([...i,...o])}catch(t){throw this.#i.error("Error monitoring keyring account",t),await this.stopMonitorKeyringAccount(e),t}}async stopMonitorKeyringAccount(e){this.#i.log("Stopping to monitor all assets of account",e);const{id:t}=e,n=this.#Ot.get(t);n&&await Promise.allSettled(Array.from(n).map((async e=>this.#kt.unsubscribe(e)))),this.#Ot.delete(t)}async#Lt(e,t){this.#i.log("Monitoring native asset balance",{account:e,network:t});const{address:n,id:r}=e,o=await this.#kt.subscribe({method:"accountSubscribe",network:t,params:[n,{commitment:"confirmed",encoding:"jsonParsed"}]});this.#Ft(r,o)}async#Dt(e,t,n){this.#i.log("Monitoring token program by owner",{account:e,tokenProgramAddress:t,network:n});const{address:r,id:o}=e,i=await this.#kt.subscribe({method:"programSubscribe",network:n,params:[t,{commitment:"confirmed",encoding:"jsonParsed",filters:[{memcmp:{offset:32,bytes:r,encoding:"base58"}}]}]});this.#Ft(o,i)}async#Ut(e,t){this.#i.info("Account notification received",{notification:e,subscription:t});const{network:n}=t,r=(0,Od.get)(t,"params[0]");M(r,re());const o=await this.#Tt.findByAddress(r);if(!o)throw new Error(`No keyring account found for address: ${r}`);const{lamports:i}=e.params.result.value;M(i,X());await Promise.all([this.#Xe.save({assetType:`${n}/${ld.SOL}`,keyringAccountId:o.id,network:n,address:r,symbol:"SOL",decimals:9,rawAmount:i.toString(),uiAmount:yw(i,9)}),this.#$t(o,n,r)])}async#jt(e,t){this.#i.info("Handling program notification",{notification:e,subscription:t});const{network:n}=t,r=(0,Od.get)(t,"params[0]");if(M(r,re()),r!==Cf&&r!==Uh)throw new Error(`Program not supported: ${r}`);const{owner:o}=e.params.result.value.account.data.parsed.info;M(o,re());const{mint:i}=e.params.result.value.account.data.parsed.info;M(i,re());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;M(a,re()),M(s,X()),M(c,re());const{pubkey:u}=e.params.result.value;M(u,re());const l=ww(n,i),d=await this.#Tt.findByAddress(o);if(!d)throw new Error(`No keyring account found with address: ${o}`);const f=await this.#ue.amountToUiAmountForMint(i,n,cu(BigInt(a))).catch((e=>(this.#i.error("Error converting amount to uiAmount",e),c))),h=(await this.#Xe.getAssetsMetadata([l]))[l];await Promise.all([this.#Xe.save({assetType:l,keyringAccountId:d.id,network:n,mint:i,pubkey:u,symbol:h?.symbol??"UNKNOWN",decimals:s,rawAmount:a,uiAmount:f}),this.#$t(d,n,u)])}async#$t(e,t,n){const r=(await this.#yt.fetchLatestSignatures(t,Xs(n),{limit:1}))?.[0];if(!r)throw new Error("No signature found");const o=await this.#yt.fetchBySignature(r,e,t);if(!o)throw new Error("No transaction found");Ew(o,e)?this.#i.info(`Transaction ${r} is spam. Skipping.`):await this.#yt.save(o)}#Ft(e,t){this.#Ot.has(e)||this.#Ot.set(e,new Set),this.#Ot.get(e)?.add(t)}async#Ct(e){this.#i.info("Handling connection recovery",{network:e});const t=await this.#Tt.getAll(),n=(await this.#kt.getAll()).filter((t=>t.network===e&&"accountSubscribe"===t.method)),r=t.filter((e=>n.some((t=>(0,Od.get)(t,"params[0]")===e.address))));r.length&&await this.#Bt.synchronize(r)}}(vE,PE,CE,OE,ME,wE,cE,uE,ed),DE=new class{#T;#qt;#Wt;#i;constructor(e,t,n,r=ed){this.#T=e,this.#qt=t,this.#Wt=n,this.#i=Xl(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 $t.SignIn:{const{address:e}=o;if(!e)throw new Error("No address");a=e;break}case $t.SignAndSendTransaction:case $t.SignMessage:case $t.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 qw(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.#qt.partiallySignBase64String(t,e,n,i),s={signedTransaction:Fg(a)};M(s,Ty);try{sl(a);const t=il(a);await this.#Wt.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.#qt.partiallySignBase64String(t,e,n,i),s=il(a),c=function({rpc:e}){return async function(t,n){await jg({...n,rpc:e,transaction:t})}}({rpc:this.#T.getRpc(n)}),u=Fw(n,"tx",s);this.#i.info(`Sending transaction: ${u}`),sl(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.#Wt.monitor(s,e.id,o?.commitment??"confirmed",n,r);const d={signature:s};return M(d,ky),d}async signMessage(e,t){this.#i.log("Signing message",e,t);const{address:n,entropySource:r,derivationPath:o}=e,i=Xs(n),a=$s().encode(t),s=function(e,t={}){return Object.freeze({content:"string"==typeof e?(new El).encode(e):e,signatures:Object.freeze({...t})})}(Gs().decode(a)),{privateKeyBytes:c}=await ev({entropySource:r,derivationPath:o}),u=await vl(c),[l]=await u.signMessages([s]);M(l,ee());const d=l[i];var f;M(d,(f=Uint8Array,L("instance",(e=>e instanceof f||`Expected a \`${f.name}\` instance, but received: ${R(e)}`))));const h={signature:Ms().decode(d),signedMessage:t,signatureType:"ed25519"};return M(h,Iy),h}async signIn(e,t){this.#i.log("Signing in",e,t);const{address:n}=e,r=this.#Vt(t),o=Gs().encode(r),i=$s().decode(o),a={account:{address:n},...await this.signMessage(e,i)};return M(a,xy),a}async verifySignature(e,t,n){this.#i.log("Verifying signature",{account:e,signatureBase58:t,messageBase64:n}),M(t,Td),M(n,Id);const r=zs().encode(t),o=$s().encode(n),{privateKeyBytes:i}=await ev({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await vl(i);return await Sc(a.keyPair.publicKey,r,o)}#Vt(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}}(pE,AE,jE,ed),FE=new class{#pe;#i;#yt;#Xe;#Kt;#Gt;#Ht;#Zt;#Jt="Create Solana Account";constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:o,confirmationHandler:i,keyringAccountMonitor:a,nameResolutionService:s}){this.#pe=e,this.#i=Xl(t,"[🔑 Keyring]"),this.#yt=n,this.#Xe=r,this.#Kt=o,this.#Gt=i,this.#Ht=a,this.#Zt=s}async listAccounts(){try{const e=await this.#pe.getKey("keyringAccounts")??{};return(0,Od.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{Pv({accountId:e},md);const t=await this.#pe.getKey(`keyringAccounts.${e}`);return t&&(t.domain=await this.#Zt.resolveAddress(ad.Mainnet,t.address)),t}catch(e){throw this.#i.error({error:e},"Error getting account"),new $r(e)}}async getAccountOrThrow(e){const t=await this.getAccount(e);if(!t)throw new Error(`Account "${e}" not found`);return t}#Yt(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)))}#Qt(e){return`m/44'/501'/${e}'/0'`}#Xt(e){const t=e.split("/")[3];if(!t)throw new Error("Invalid derivation path");const n=parseInt(t.replace("'",""),10);return M(n,Z()),n}async#en(){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.#Jt);const n=await this.listAccounts(),r=e?.entropySource??await this.#en(),o=e?.derivationPath?this.#Xt(e.derivationPath):this.#Yt(n,r),i=e?.derivationPath?e.derivationPath:this.#Qt(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."),tm(a);const{publicKeyBytes:s}=await ev({entropySource:r,derivationPath:i}),c=tc().decode(s.slice(1)),{importedAccount:u,accountNameSuggestion:l,metamask:d,...f}=e??{},h={id:t,entropySource:r,derivationPath:i,index:o,type:dt.DataAccount,address:c,domain:null,scopes:[Dt.Mainnet,Dt.Testnet,Dt.Devnet],options:{...f,entropySource:r,derivationPath:i,index:o},methods:[$t.SignAndSendTransaction,$t.SignTransaction,$t.SignMessage,$t.SignIn]};await this.#pe.setKey(`keyringAccounts.${h.id}`,h),await this.#Ht.monitorKeyringAccount(h);const p=tm(h);return await this.emitEvent(gn.AccountCreated,{account:p,accountNameSuggestion:l??`Solana Account ${o+1}`,displayAccountNameSuggestion:!l,displayConfirmation:!1,...d?{metamask:d}:{}}),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Bv.OnSyncAccount,params:{accountId:t}}}}),await async function(e){try{return await snap.request({method:"snap_endTrace",params:{name:e}})}catch(e){return null}}(this.#Jt),p}catch(e){throw this.#i.error({error:e},"Error creating account"),await this.#tn(t),new Error(`Error creating account: ${e.message}`)}}async#tn(e){await Promise.all([this.#pe.deleteKey(`keyringAccounts.${e}`),this.#pe.deleteKey(`transactions.${e}`),this.#pe.deleteKey(`assets.${e}`)])}async deleteAccount(e){try{Pv({accountId:e},yd);const t=await this.getAccountOrThrow(e);await this.emitEvent(gn.AccountDeleted,{id:e}),await Promise.allSettled([this.#tn(e),this.#Ht.stopMonitorKeyringAccount(t)])}catch(e){throw this.#i.error({error:e},"Error deleting account"),e}}async listAccountAssets(e){try{Pv({accountId:e},vd);const t=await this.getAccountOrThrow(e),n=(await this.#Xe.findByAccount(t)).filter((e=>e.assetType.endsWith(ld.SOL)||Number(e.rawAmount)>0)).map((e=>e.assetType));return Nv(n,nn),n}catch(e){throw this.#i.error({error:e},"Error listing account assets"),e}}async getAccountBalances(e,t){try{Pv({accountId:e,assets:t},wd);const n=await this.getAccountOrThrow(e),r=(await this.#Xe.findByAccount(n)).filter((e=>t.includes(e.assetType))).filter((e=>e.assetType.endsWith(ld.SOL)||Number(e.rawAmount)>0)).reduce(((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e)),{});return Nv(r,bd),r}catch(e){throw this.#i.error({error:e},"Error getting account balances"),e}}async emitEvent(e,t){await vn(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.#nn(e)}}async#nn(e){M(e,Ov);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`);M(r,Sd);if(!await this.#Gt.handleKeyringRequest(e,a))throw new ao;switch(t){case $t.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#Kt.signAndSendTransaction(a,e,r,i,t)}case $t.SignTransaction:{this.#rn(a,e);const{transaction:t,options:o}=n;return this.#Kt.signTransaction(a,t,r,i,o)}case $t.SignMessage:{this.#rn(a,e);const{message:t}=n;return this.#Kt.signMessage(a,t)}case $t.SignIn:return this.#Kt.signIn(a,n);default:throw new Jr(`Unsupported method: ${t}`)}}#rn(e,t){const{address:n}=e,{account:r}=t.request.params;try{Xs(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{Pv({accountId:e,pagination:t},Ad);const{limit:n,next:r}=t,o=await this.getAccount(e);if(!o)throw new Error("Account not found");const i=await this.#yt.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{M(e,Sd);const{method:n,params:r}=t,o={method:n,params:r};M(o,_y);const i=await this.listAccounts();return{address:await this.#Kt.resolveAccountAddress(i,e,o)}}catch(e){return this.#i.error({error:e},"Error resolving account address"),null}}async discoverAccounts(e,t,n){try{M({scopes:e,entropySource:t,groupIndex:n},Mv);const r=this.#Qt(n),{publicKeyBytes:o}=await ev({entropySource:t,derivationPath:r}),i=tc().decode(o.slice(1)),a=[];for(const t of e)a.push(this.#yt.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}}}({state:lE,transactionsService:OE,logger:ed,assetsService:CE,walletService:DE,confirmationHandler:UE,keyringAccountMonitor:LE,nameResolutionService:xE}),$E=new class{#T;#i;constructor(e,t=ed){this.#T=e,this.#i=t}static isMaybeNonFungible(e){const{tokenAmount:t}=e,{decimals:n}=t;return!1}}(pE,ed),qE=new class{#T;#on;#i;#R;#in;#an;#Xe;#ve={minimumBalanceForRentExemption:5*gv.Minute};constructor(e,t,n,r,o,i,a){this.#T=e,this.#on=t,this.#R=r,this.#i=Xl(n,"[📬 SendService]"),this.#in=o,this.#an=i,this.#Xe=a}async#sn(e){return nd((async t=>this.#T.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>Io(e.toString())))),this.#R,{functionName:"SendService:getMinimumBalanceForRentExemption",ttlMilliseconds:this.#ve.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){const{fromAccountId:t,toAddress:n,amount:r,assetId:o}=e.params,i=await this.#on.getAccountOrThrow(t),{chainId:a,assetReference:s}=Fo(o),c=a,u=o===fd[c].nativeToken.caip19Id,l=u?this.#in:this.#an;this.#i.log("Confirming send transaction",{fromAccountId:t,toAddress:n,amount:r,assetId:o});const d={from:i,to:Xs(n),amount:r,network:c,...u?{}:{mint:Xs(s)}},f=ol(await l.buildTransactionMessage(d)),h=Fg(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:id,request:{method:$t.SignAndSendTransaction,params:{account:{address:i.address},transaction:h,scope:c}}};return this.#i.log("Submitting keyring request",p),this.#on.submitRequest(p)}async onAddressInput(e){const{params:{value:t}}=e;if(""===t)return{valid:!1,errors:[{code:Xm.Required}]};try{return Xs(t),{valid:!0,errors:[]}}catch(e){return{valid:!1,errors:[{code:Xm.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e,o=await this.#on.getAccountOrThrow(n),{chainId:i}=Fo(r),a=i,s=fd[a].nativeToken.caip19Id,c=r===s,u=await this.#Xe.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:Xm.Required}]};const f=wm(l.uiAmount??"0"),h=wm(d?.uiAmount??"0"),p=wm(t),g=await this.#sn(a),m=c?this.#in:this.#an,y=new rE(m).getFee(),v=Io(y.toString());if(h.isZero())return{valid:!1,errors:[{code:Xm.InsufficientBalance}]};if(c){if(p.gt(h))return{valid:!1,errors:[{code:Xm.InsufficientBalance}]};if(p.plus(v).plus(g).gt(h))return{valid:!1,errors:[{code:Xm.InsufficientBalanceToCoverFee}]}}else{if(p.gt(f))return{valid:!1,errors:[{code:Xm.InsufficientBalance}]};if(v.plus(g).gt(h))return{valid:!1,errors:[{code:Xm.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(pE,FE,ed,fE,bE,SE,CE),WE=new class{#mt;#Kt;#i;#cn;constructor(e,t,n,r){this.#mt=e,this.#Kt=t,this.#i=Xl(n,"[👋 ClientRequestHandler]"),this.#cn=r}async handle(e){this.#i.log("Handling client request",e);const{method:t}=e;switch(t){case Am.SignAndSendTransactionWithoutConfirmation:return this.#un(e);case Am.ConfirmSend:return this.#ln(e);case Am.SignAndSendTransaction:return this.#dn(e);case Am.ComputeFee:return this.#fn(e);case Am.OnAddressInput:return this.#hn(e);case Am.OnAmountInput:return this.#pn(e);case Am.SignRewardsMessage:return this.#gn(e);default:throw new Jr}}async#un(e){try{M(e,Cy)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:o}}=e,i=await this.#mt.findByAddress(r);if(!i)throw new Gr(`Account not found: ${r}`);return this.#Kt.signAndSendTransaction(i,t,o,id,n)}async#dn(e){try{M(e,Py)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:o}}=e,i=await this.#mt.findById(r);if(!i)throw new Gr(`Account not found: ${r}`);const{signature:a}=await this.#Kt.signAndSendTransaction(i,t,o,id,n),s={transactionId:a};return M(s,Ny),s}async#ln(e){try{M(e,Oy)}catch(e){const t=new Gr;throw t.cause=e,t}return await this.#cn.confirmSend(e)}async#fn(e){try{M(e,Vy)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,{baseFee:r,priorityFee:o}=ym.calculateFee(t),i=fd[n].nativeToken.symbol,a=fd[n].nativeToken.caip19Id,s=[{type:kt.Base,asset:{unit:i,type:a,amount:vm(r).toString(),fungible:!0}},{type:kt.Priority,asset:{unit:i,type:a,amount:vm(o).toString(),fungible:!0}}];return M(s,Ky),s}async#hn(e){try{M(e,zy)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#cn.onAddressInput(e);return M(t,qy),t}async#pn(e){try{M(e,jy)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#cn.onAmountInput(e);return M(t,qy),t}async#gn(e){M(e,$y);const{params:{account:{address:t},message:n}}=e,r=await this.#mt.findByAddress(t);if(!r)throw new Gr(`Account not found: ${t}`);const{address:o}=Ly(n);if(o!==t)throw new Gr(`Address in rewards message (${o}) does not match signing account address (${t})`);return await this.#Kt.signMessage(r,n)}}(PE,DE,ed,qE),VE={configProvider:cE,connection:pE,keyring:FE,priceApiClient:EE,state:lE,cache:dE,assetsService:CE,tokenPricesService:IE,signer:AE,transactionsService:OE,sendSolBuilder:bE,sendSplTokenBuilder:SE,walletService:DE,transactionScanService:zE,analyticsService:hE,confirmationHandler:UE,nftService:$E,clientRequestHandler:WE,webSocketConnectionService:mE,subscriptionService:vE,eventEmitter:uE,nameResolutionService:xE,accountsService:PE,accountsSynchronizer:ME,tokenHelper:wE},KE=ee({id:re(),jsonrpc:J("2.0"),method:J(Bv.OnSyncAccount),params:ee({accountId:hd})}),GE=ee({id:re(),jsonrpc:J("2.0"),method:J(Bv.OnTransactionAdded),params:ee({accountId:hd,metadata:ee({scope:Sd,origin:re()})})}),HE=ee({id:re(),jsonrpc:J("2.0"),method:J(Bv.OnTransactionApproved),params:ee({accountId:hd,metadata:ee({scope:Sd,origin:re()})})}),ZE=ee({id:re(),jsonrpc:J("2.0"),method:J(Bv.OnTransactionRejected),params:ee({accountId:hd,metadata:ee({scope:Sd,origin:re()})})}),JE=Cw("Form"),YE=Cw("Field"),QE=Cw("AccountSelector"),XE=Cw("AssetSelector"),ek=({title:e,backButtonName:t})=>Iw(Pw,{direction:"horizontal",alignment:"space-between",center:!0,children:[t?Tw(Lw,{name:t,children:Tw(aA,{name:"arrow-left",color:"primary",size:"md"})}):null,Tw(Nw,{size:"sm",children:e}),Iw(Pw,{direction:"horizontal",children:[Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(Pw,{children:null})]})]}),tk=Cw("Input");var nk=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}({}),rk=function(e){return e.TOKEN="TOKEN",e.FIAT="USD",e}({});const ok=({name:e,value:t,tokenSymbol:n,currency:r,currencyType:o,locale:i,swapCurrencyButtonDisabled:a=!1})=>{const s=Hw(i),c=o===rk.FIAT?r.toUpperCase():n;return Iw(YE,{label:s("send.amountField"),children:[Tw(tk,{name:e,type:"number",min:0,placeholder:"0",step:.01,value:t??void 0}),Iw(Pw,{direction:"horizontal",center:!0,children:[Tw(Pw,{direction:"vertical",alignment:"center",children:Tw(Bw,{size:"sm",children:c})}),Tw(Lw,{name:nk.SwapCurrencyButton,disabled:a,children:Tw(aA,{name:"swap-vertical",color:a?"muted":"primary",size:"md"})})]})]})},ik={initial:null,fetching:"default",fetched:"success",error:null},ak=({name:e,value:t,error:n,locale:r,showClearButton:o,disabled:i,domainResolutionStatus:a})=>{const s=Hw(r);return Iw(Pw,{children:[Iw(YE,{label:s("send.toField"),error:n,children:[Tw(tk,{name:e,placeholder:i?"":s("send.toPlaceholder"),value:t??void 0,disabled:i}),o?Tw(Pw,{children:Tw(Lw,{name:nk.ClearButton,children:Tw(aA,{name:iA.Close,color:"primary"})})}):null]}),a&&null!==ik[a]&&Tw(Bw,{size:"sm",color:ik[a],children:s(`send.toDomainResolutionStatus.${a}`)})]})},sk=e=>{const{amount:t,tokenPrices:n,tokenCaipId:r,currencyType:o}=e,i=n?.[r]?.price;if(o===rk.TOKEN)return t;if(void 0===i)throw new Error("Token price is undefined, cannot convert to fiat amount.");return null===t?null:xo(t).dividedBy(xo(i)).toString()},ck=e=>{const{selectedTokenMetadata:t}=e;return{...t??{},tokenSymbol:t?.symbol??"UNKNOWN",tokenImage:t?.imageSvg??mw}},uk=e=>{const{tokenCaipId:t,tokenPrices:n}=e;return n?.[t]?.price},lk=e=>{const{balances:t,fromAccountId:n,tokenCaipId:r}=e;return t?.[n]?.[r]?.amount??"0"},dk=e=>{const{tokenCaipId:t,scope:n}=e;return t===fd[n]?.nativeToken?.caip19Id},fk=Cw("Spinner"),hk=({title:e,subtitle:t,iconSrc:n,isLoading:r})=>Iw(Pw,{alignment:"center",center:!0,children:[Iw(Pw,{direction:"horizontal",center:!0,children:[r?Tw(fk,{}):null,n&&!r?Tw(Uw,{borderRadius:"full",src:n}):null]}),Tw(Nw,{size:"lg",children:e}),t?Tw(Bw,{color:"muted",children:t}):null]}),pk=Cw("Value"),gk=({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=Hw(a),p=fd[t],g=o.find((e=>e.id===n))?.address,m=qw(t,g),y=p.name,v=p.nativeToken.symbol,w=l[p.nativeToken.caip19Id]?.price,A=c?u:i,b=A?_A(A,v,a):"",S=void 0===w||null===A?"":nA(CA(A,w),s,a);return Iw(Pw,{children:[Iw(Ow,{children:[Tw(Mw,{label:h("send.confirmation.from"),children:d?Tw($w,{domain:d,scope:t,address:g}):Tw(Dw,{href:Fw(t,"address",g),children:Tw(zw,{address:m,displayName:!0})})}),r?Tw(Mw,{label:h("send.confirmation.recipient"),children:f?Tw($w,{domain:f,scope:t,address:r}):Tw(Dw,{href:Fw(t,"address",r),children:Tw(zw,{address:qw(t,r),displayName:!0})})}):null]}),Iw(Ow,{children:[Tw(Mw,{label:h("send.confirmation.network"),children:Tw(Bw,{children:y})}),Tw(Mw,{label:h("send.confirmation.transactionSpeed"),children:Tw(Bw,{children:"<1s"})}),Tw(Mw,{label:h("send.confirmation.fee"),children:Tw(pk,{extra:S,value:b})})]})]})};var mk=function(e){return e.BackButton="transaction-confirmation-back-button",e.CancelButton="transaction-confirmation-cancel-button",e.ConfirmButton="transaction-confirmation-submit-button",e}({});const yk={"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:v,currency:w}}=e,A=Hw(v),b=f[o]?.[l],S=b?.amount,E=b?.unit??"",k=void 0!==S,T=r.find((e=>e.id===o)),I=T?.address?qw(d,T.address):void 0,x=uk(e),_=void 0===S||"0"===S,C=void 0===x,R="error"===h||"fetched"===h&&C,P=(k?{[rk.FIAT]:nA(CA(S,x??0),w,v),[rk.TOKEN]:_A(S,E,v)}:{[rk.FIAT]:"",[rk.TOKEN]:""})[u],N=o.length>0&&!!a&&a.length>0&&Um(c?.[nk.DestinationAccountInput]),B=!Um(y)&&""!==y,O=Boolean(a&&a.length>0),M=Boolean(c?.[nk.AmountInput]?.message),z=M?c?.[nk.AmountInput]?.message??"":`${A("send.balance")}: ${P}`,U=o.length>0&&!!i&&i.length>0&&!!a&&a.length>0&&Object.values(c).every(Um)&&k&&!p&&B;return Iw(Rw,{backgroundColor:"alternative",children:[Iw(Pw,{children:[Tw(ek,{title:A("send.title"),backButtonName:nk.BackButton}),Iw(JE,{name:nk.Form,children:[R&&Tw(EA,{title:"",severity:"info",children:Tw(Bw,{children:A("send.selectedTokenPriceNotAvailable",{currency:w})})}),Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(YE,{label:A("send.fromField"),error:c?.[nk.SourceAccountSelector]?.message??"",children:Tw(QE,{name:nk.SourceAccountSelector,chainIds:[d],value:I??void 0,hideExternalAccounts:!0,switchGlobalAccount:!0})}),Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(ak,{locale:v,disabled:m,name:nk.DestinationAccountInput,value:t??null,showClearButton:O,domainResolutionStatus:s,error:c?.[nk.DestinationAccountInput]?.message??""}),N&&Iw(Pw,{children:[Tw(Pw,{children:null}),Tw(Pw,{children:null}),Tw(Pw,{children:null}),Iw(Pw,{direction:"horizontal",children:[Tw(YE,{label:A("send.assetField"),children:Tw(XE,{chainIds:[d],value:l,name:nk.AssetSelector,addresses:I?[I]:[]})}),Tw(ok,{name:nk.AmountInput,currencyType:u,tokenSymbol:E,currency:w,value:n??null,locale:v,swapCurrencyButtonDisabled:C||_})]}),Iw(Pw,{direction:"horizontal",alignment:"space-between",crossAlignment:"start",children:[Tw(Pw,{direction:"vertical",alignment:"start",children:Tw(Bw,{size:"sm",color:M?"error":"muted",children:z})}),Tw(Lw,{size:"sm",name:nk.MaxAmountButton,disabled:_,children:A("send.maxButton")})]})]}),g&&Iw(Pw,{children:[Tw(Pw,{children:null}),Tw(EA,{title:A(g.title),severity:"warning",children:Tw(Bw,{children:A(g.message)})})]})]})]}),Iw(jw,{children:[Tw(Lw,{name:nk.CancelButton,children:A("send.cancelButton")}),Tw(Lw,{name:nk.SendButton,disabled:!U,loading:p,children:A("send.continueButton")})]})]})},"transaction-confirmation":({context:e})=>{const{preferences:{currency:t,locale:n}}=e,r=Hw(n),{tokenImage:o,tokenSymbol:i}=ck(e),a=sk(e),s=uk(e),c=void 0===s?"":nA(CA(a??"0",s),t,n);return Iw(Rw,{children:[Iw(Pw,{children:[Tw(ek,{title:r("send.confirmation.title"),backButtonName:"transaction-confirmation-back-button"}),Tw(hk,{title:_A(a??"0",i,n),subtitle:c,iconSrc:o}),Tw(gk,{context:e})]}),Iw(jw,{children:[Tw(Lw,{name:"transaction-confirmation-cancel-button",children:r("send.confirmation.cancelButton")}),Tw(Lw,{name:"transaction-confirmation-submit-button",loading:e.loading,disabled:e.loading,children:r("send.confirmation.sendButton")})]})]})},"send-pending":({context:e})=>{const t=Hw(e.preferences.locale);return Tw(Rw,{children:Iw(Pw,{children:[Tw(Pw,{children:null}),Tw(hk,{title:t("send.send-pending.title"),subtitle:t("send.send-pending.subtitle"),isLoading:!0}),Tw(gk,{context:e})]})})},"transaction-success":({context:e})=>{const{preferences:t,transaction:n,scope:r}=e,o=Hw(t.locale),{tokenSymbol:i}=ck(e),a=sk(e);return Tw(Rw,{children:Iw(Pw,{children:[Tw(Pw,{children:null}),Tw(hk,{title:o("send.transaction-success.title"),subtitle:o("send.transaction-success.subtitle",{amount:tA(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'}),Tw(gk,{context:e}),n?.signature?Tw(Pw,{alignment:"center",center:!0,children:Tw(Dw,{href:Fw(r,"tx",n?.signature),children:o("send.confirmation.viewTransaction")})}):null]})})},"transaction-failure":({context:e})=>{const{preferences:t}=e,n=Hw(t.locale),{tokenSymbol:r}=ck(e),o=sk(e);return Tw(Rw,{children:Iw(Pw,{children:[Tw(Pw,{children:null}),Tw(hk,{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'}),Tw(gk,{context:e})]})})}},vk=({context:e,inputToAddress:t,inputAmount:n})=>{const r=e.stage??"send-form";return Tw(yk[r],{context:e,inputToAddress:t,inputAmount:n})};function wk(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 Ak(e,t,n){return n[e]?n[e]?.map((e=>e(t))).find((e=>null!==e))??null:null}function bk(e){const t=Ik(e),n={[nk.SourceAccountSelector]:e.fromAccountId,[nk.AmountInput]:e.amount,[nk.DestinationAccountInput]:e.toAddress};return Object.entries(t).every((([e,t])=>{const r=n[e];return!!r&&t.every((e=>null===e(r)))}))}const Sk=(e,t)=>{const n=Hw(t);return t=>{const r=""===t?{message:n(e),value:t}:null;return r?{message:r.message,value:t}:null}},Ek=(e,t)=>{const n=Hw(t);return t=>{try{return wk(t)||Xs(t),null}catch{return{message:n(e),value:t}}}},kk=e=>{const{minimumBalanceForRentExemptionSol:t,preferences:{locale:n},feeEstimatedInSol:r,selectedTokenMetadata:o}=e,i=Hw(n);return n=>{if(""===n)return{message:"",value:n};const a=sk({...e,amount:n}),s=wm(a??"0"),c=lk(e),u=wm(c),l=wm(r??"0"),d=wm(t??"0"),f=(e=>lk({...e,tokenCaipId:fd[e.scope].nativeToken.caip19Id}))(e),h=wm(f),p=dk(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}},Tk=ee({scope:H([...Object.values(ad)]),account:hd,assetId:te(Lo)}),Ik=e=>({[nk.SourceAccountSelector]:[Sk("send.fromRequiredError",e.preferences.locale)],[nk.AmountInput]:[kk(e),Sk("send.amountRequiredError",e.preferences.locale)],[nk.DestinationAccountInput]:[Sk("send.toRequiredError",e.preferences.locale),Ek("send.toInvalidError",e.preferences.locale)]}),xk={scope:ad.Mainnet,fromAccountId:"",fromDomain:null,amount:"",destinationAddressOrDomain:null,toDomain:null,toAddress:null,domainResolutionStatus:null,feeEstimatedInSol:"0",feePaidInSol:"0",tokenCaipId:sd.SolMainnet,accounts:[],currencyType:rk.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},_k={[Bv.OnTransactionAdded]:async({request:e})=>{try{ed.info("[onTransactionAdded] Cronjob triggered",e),M(e,GE);const{accountId:t,metadata:n}=e.params,r=await FE.getAccountOrThrow(t);await hE.trackEventTransactionAdded(r,n)}catch(e){throw ed.error(e),new Vr(e)}},[Bv.OnTransactionApproved]:async({request:e})=>{try{ed.info("[onTransactionApproved] Cronjob triggered",e),M(e,HE);const{accountId:t,metadata:n}=e.params,r=await FE.getAccountOrThrow(t);await hE.trackEventTransactionApproved(r,n)}catch(e){throw ed.error(e),new Vr(e)}},[Bv.OnTransactionRejected]:async({request:e})=>{try{ed.info("[onTransactionRejected] Cronjob triggered",e),M(e,ZE);const{accountId:t,metadata:n}=e.params,r=await FE.getAccountOrThrow(t);await hE.trackEventTransactionRejected(r,n)}catch(e){throw ed.error(e),new Vr(e)}},[Bv.OnSyncAccount]:async({request:e})=>{M(e,KE);const{accountId:t}=e.params,n=await PE.findById(t);if(!n)throw new Error("Account not found");const r=await CE.fetch(n);await CE.saveMany(r);const o=await OE.fetchAssetsTransactions(r,{limit:20});await OE.saveMany(o)},[Bv.RefreshSend]:async()=>{const e=Xl(ed,"[refreshSend]");e.info("Background event triggered");const[t,n,r]=await Promise.all([CE.getAll(),lE.getKey("mapInterfaceNameToId"),uv().catch((()=>xk.preferences))]),o=t.flatMap((e=>e.assetType)),i=n?.[rv];if(!i)return void e.info("No send form interface found");const a=await lv(i),s=await EE.getMultipleSpotPrices(o,r.currency);await lE.setKey("tokenPrices",s);const c={...a,tokenPrices:{...a.tokenPrices,...s}};await av(i,Tw(vk,{context:c}),c),e.info("✅ Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}})},[Bv.RefreshConfirmationEstimation]:async()=>{const e=Xl(ed,"[refreshConfirmationEstimation]");e.info("Background event triggered");const t=(await lE.getKey("mapInterfaceNameToId")??{})[ov];if(!t)return void e.info("No interface context found");const n=await lv(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 av(t,Tw(PA,{context:r}),r);const[o,i]=await Promise.all([zE.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}),lv(t)]),a={...i,scanFetchStatus:"fetched",scan:o};e.info("New scan fetched"),await av(t,Tw(PA,{context:a}),a),e.info("Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}})}catch(n){const r={...await lv(t),scanFetchStatus:"fetched"};await av(t,Tw(PA,{context:r}),r),e.warn({error:n},"Could not update the interface. But rolled back status to fetched.")}},[Bv.CloseWebSocketConnections]:async()=>{ed.info("Closing all WebSocket connections via background event"),await mE.closeAllConnections()}},Ck={..._k};var Rk={};const Pk=ee({chainId:Sd,domain:te(re()),address:te(re())}),Nk="Solana Name Service",Bk={[mv.GetFeeForTransaction]:async({request:e})=>{M(e.params,Ed);const{transaction:t}=e.params;try{const{totalFee:e}=ym.calculateFee(t),n={value:e.toString()};return M(n,kd),n}catch(e){throw ed.error(e),new Vr(e)}},[mv.StartSendTransactionFlow]:async({request:e})=>{const{params:t}=e;M(t,Tk);const{scope:n,account:r}=t,o=t.assetId??fd[n].nativeToken.caip19Id,i={...xk,scope:n,fromAccountId:r,tokenCaipId:o,loading:!0},[a,s,c,u]=await Promise.all([CE.getAll(),PE.getAll(),lE.getKey("tokenPrices"),uv().catch((()=>xk.preferences))]);i.balances=function(e,t){return t.filter((t=>{const n=t.assetType===fd[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 iv(Tw(vk,{context:i}),i),d=cv(l),f=CE.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=EE.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=pE.getRpc(n).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>{i.minimumBalanceForRentExemptionSol=vm(e).toString()})).catch((()=>{}));return i.loading=!0,await av(l,Tw(vk,{context:i}),i),i.loading=!1,await Promise.all([h,f,p]),await av(l,Tw(vk,{context:i}),i),await lE.setKey(`mapInterfaceNameToId.${rv}`,l),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}}),d},[yv.ListWebSockets]:async()=>(await uE.emitSync("onListWebSockets"),null),[yv.ListSubscriptions]:async()=>(await uE.emitSync("onListSubscriptions"),null),[yv.TestOnStart]:async()=>(await uE.emitSync("onStart"),null),[yv.TestOnInstall]:async()=>(await uE.emitSync("onInstall"),null),[yv.TestOnUpdate]:async()=>(await uE.emitSync("onUpdate"),null),[yv.SynchronizeAccounts]:async()=>(await ME.synchronize(),null)};const Ok=async e=>{try{return await e()}catch(e){const t=function(e){return[$r,Jr,ao,Yr,Jr,Qr,Xr,eo,to,no,ro,oo,io,Vr,Kr,Gr,Hr,Zr].some((t=>e instanceof t))}(e)?e:new $r(e);throw ed.error({error:t},`[SnapError] ${JSON.stringify(t.toJSON(),null,2)}`),t}};var Mk=n(4255),zk=n.n(Mk),Uk=n(3804),jk=n.n(Uk);class Lk extends Error{constructor(e="Operation cancelled"){super(e),this.name="CancellationError"}}const Dk=async e=>{const{fromAccountId:t,tokenCaipId:n,scope:r,toAddress:o}=e,i=sk(e),a=await FE.getAccountOrThrow(t);if(!o||!i)throw new Error("Invalid transaction parameters");const s=n===fd[r].nativeToken.caip19Id,c=s?bE:SE,u=new rE(c),l={from:a,to:Xs(o),amount:i,network:r,...s?{}:{mint:Xs(Fo(n).assetReference)}},d=await c.buildTransactionMessage(l),f=await(async e=>uu(e,Fu,Bu().encode,Fs().decode))(d);return{feeInLamports:u.getFee(),base64EncodedTransactionMessage:f}},Fk=jk()((async(e,t)=>{try{if(!bk(t))return;const n={buildingTransaction:!0,transactionMessage:null,feeEstimatedInSol:null};await av(e,Tw(vk,{context:{...t,...n}}),{...t,...n});const{feeInLamports:r,base64EncodedTransactionMessage:o}=await Dk(t),i={transactionMessage:o,feeEstimatedInSol:r?vm(r).toString():null,buildingTransaction:!1},a=await lv(e);await av(e,Tw(vk,{context:{...a,...i}}),{...a,...i})}catch(t){ed.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 lv(e);await av(e,Tw(vk,{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 Lk)}))}))]);return o.cancel=()=>n.abort(),o})(e);let n=null;return async(...e)=>{if(n&&"function"==typeof n.cancel){const e="Cancelling previous task";ed.warn(e),n.cancel()}const r=t(...e);n=r;try{return await r}finally{n===r&&(n=null)}}}),zk()(500));const $k={[nk.BackButton]:async function({id:e}){await sv(e,!1),await lE.deleteKey(`mapInterfaceNameToId.${rv}`)},[nk.SourceAccountSelector]:async function({id:e,event:t,context:n}){const r=t.value;n.fromAccountId=r.accountId,n.error=null,n.validation[nk.SourceAccountSelector]=Ak(nk.SourceAccountSelector,n.fromAccountId,Ik(n)),n.amount&&(n.validation[nk.AmountInput]=Ak(nk.AmountInput,n.amount,Ik(n))),await av(e,Tw(vk,{context:n}),n),await Fk(e,n)},[nk.AmountInput]:async function({id:e,event:t,context:n}){const r={...n};r.amount=t.value,r.error=null;const o=Ak(nk.AmountInput,r.amount,Ik(r));if(o&&r.validation[nk.AmountInput]?.message!==o?.message)return r.validation[nk.AmountInput]=o,void await av(e,Tw(vk,{context:r}),r);null===o&&(r.validation[nk.AmountInput]=null,await av(e,Tw(vk,{context:r}),r),await Fk(e,r))},[nk.AssetSelector]:async function({id:e,event:t,context:n}){if("object"!=typeof t.value||!("asset"in t.value))return;const r=t.value.asset;if(n.tokenCaipId===r)return;const o=r===fd[n.scope].nativeToken.caip19Id?bE:SE,i=new rE(o).getFee(),a={tokenCaipId:r,feeEstimatedInSol:vm(i).toString(),selectedTokenMetadata:{symbol:t.value.symbol,name:t.value.name,asset:t.value.asset,imageSvg:null},amount:"",error:null},s=(0,Od.merge)(n,a);await av(e,Tw(vk,{context:s,inputAmount:""}),s),await Fk(e,n)},[nk.SwapCurrencyButton]:async function({id:e,context:t}){if(t.error=null,t.currencyType=t.currencyType===rk.TOKEN?rk.FIAT:rk.TOKEN,!t.amount)return void await av(e,Tw(vk,{context:t}),t);const n=xo(t.amount??"0"),{price:r}=t.tokenPrices[t.tokenCaipId]??{price:0};t.currencyType===rk.TOKEN&&(t.amount=n.dividedBy(r).toString()),t.currencyType===rk.FIAT&&(t.amount=n.multipliedBy(r).toString()),await av(e,Tw(vk,{context:t,inputAmount:t.amount}),t)},[nk.MaxAmountButton]:async function({id:e,context:t}){const{currencyType:n,minimumBalanceForRentExemptionSol:r,tokenCaipId:o,tokenPrices:i}=t,a={...t},s=lk(t);if(dk(t)){const e=wm(s),t=new rE(bE).getFee().toString(),n=wm(r),o=e.minus(t).minus(n).minus(1),i=xo.maximum(o,o.isNegative()?e:xo(0)),c=vm(i);a.amount=c.toString()}else a.amount=s;if(n===rk.FIAT){const{price:e}=i[o]??{price:0};a.amount=CA(a.amount,e)}a.error=null,a.validation[nk.AmountInput]=Ak(nk.AmountInput,a.amount,Ik(a)),await av(e,Tw(vk,{context:a,inputAmount:a.amount}),a),await Fk(e,a)},[nk.DestinationAccountInput]:async function({id:e,event:t,context:n}){const r={...n};r.destinationAddressOrDomain=t.value,r.domainResolutionStatus=null,r.error=null;const o=Ak(nk.DestinationAccountInput,r.destinationAddressOrDomain,Ik(r));r.validation[nk.DestinationAccountInput]=o,wk(r?.destinationAddressOrDomain)?(r.domainResolutionStatus="fetching",await av(e,Tw(vk,{context:r}),r),r.toAddress=await xE.resolveDomain(r.scope,r.destinationAddressOrDomain).catch((()=>{const e=Hw(r.preferences.locale);return r.validation[nk.DestinationAccountInput]={message:e("send.toInvalidErrorDomain"),value:r.destinationAddressOrDomain??""},null})),r.domainResolutionStatus=r.toAddress?"fetched":"error"):r.toAddress=r.destinationAddressOrDomain,await av(e,Tw(vk,{context:r}),r),null===o&&await Fk(e,r)},[nk.ClearButton]:async function({id:e,context:t}){t.destinationAddressOrDomain="",t.toAddress="",t.domainResolutionStatus=null,t.error=null,t.validation[nk.DestinationAccountInput]=null,await av(e,Tw(vk,{context:t,inputToAddress:t.toAddress}),t)},[nk.CancelButton]:async function({id:e}){await sv(e,!1),await lE.deleteKey(`mapInterfaceNameToId.${rv}`)},[nk.SendButton]:async function({id:e,context:t}){if(!bk(t))return;const n={...t};n.stage="transaction-confirmation",n.loading=!0,await av(e,Tw(vk,{context:n}),n);const r=t.accounts.find((e=>e.id===t.fromAccountId))?.address,[o,i,a,s]=await Promise.all([r?xE.resolveAddress(t.scope,r):null,t.toAddress?xE.resolveAddress(t.scope,t.toAddress):null,EE.getMultipleSpotPrices(t.assets,t.preferences.currency).then((e=>e)).catch((()=>null)),t.selectedTokenMetadata?Aw.generateImageComponent(Bd({baseUrl:cE.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 av(e,Tw(vk,{context:n}),n),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Bv.OnTransactionAdded,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:id}}}}})}};const qk={[mk.BackButton]:async function({id:e,context:t}){const n={...t,stage:"send-form"};await av(e,Tw(vk,{context:n,inputAmount:t.amount??"",inputToAddress:t.destinationAddressOrDomain??""}),n)},[mk.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:Bv.OnTransactionRejected,params:{accountId:n,metadata:{scope:o,origin:id}}}}}),await sv(e,!1),await lE.deleteKey(`mapInterfaceNameToId.${rv}`)},[mk.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 av(e,Tw(vk,{context:t}),t);await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Bv.OnTransactionApproved,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:id}}}}});const a={...t,stage:"send-pending"};await av(e,Tw(vk,{context:a}),a);let s=null;try{const e=await FE.getAccountOrThrow(r);s=(await DE.signAndSendTransaction(e,i,n,id)).signature}catch(e){ed.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 av(e,Tw(vk,{context:c}),c),await lE.deleteKey(`mapInterfaceNameToId.${rv}`)}};const Wk=2n**255n-19n,Vk=2n**252n+27742317777372353535851937790883648493n,Kk=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gk=0x6666666666666666666666666666666666666666666666666666666666666658n,Hk={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:Wk,n:Vk,h:8,Gx:Kk,Gy:Gk},Zk=(e="")=>{throw new Error(e)},Jk=e=>"string"==typeof e,Yk=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name)(e)||"number"==typeof t&&t>0&&e.length!==t?Zk("Uint8Array of valid length expected"):e,Qk=e=>new Uint8Array(e),Xk=(e,t)=>Yk(Jk(e)?sT(e):Qk(Yk(e)),t),eT=(e,t=Wk)=>{let n=e%t;return n>=0n?n:t+n},tT=e=>e instanceof nT?e:Zk("Point expected");class nT{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new nT(e.x,e.y,1n,eT(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=Hk,r=(e=Xk(e,32)).slice(),o=e[31];r[31]=-129&o;const i=uT(r);!t||0n<=i&&i<2n**256n||Zk("bad y coord 1"),t||0n<=i&&i<Wk||Zk("bad y coord 2");const a=eT(i*i),s=eT(a-1n),c=eT(n*a+1n);let{isValid:u,value:l}=pT(s,c);u||Zk("bad y coordinate 3");const d=1n===(1n&l),f=0!=(128&o);return!t&&0n===l&&f&&Zk("bad y coord 3"),f!==d&&(l=eT(-l)),new nT(l,i,1n,eT(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}=tT(e),s=eT(t*a),c=eT(o*r),u=eT(n*a),l=eT(i*r);return s===c&&u===l}is0(){return this.equals(oT)}negate(){return new nT(eT(-this.ex),this.ey,this.ez,eT(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=Hk,o=eT(e*e),i=eT(t*t),a=eT(2n*eT(n*n)),s=eT(r*o),c=e+t,u=eT(eT(c*c)-o-i),l=s+i,d=l-a,f=s-i,h=eT(u*d),p=eT(l*f),g=eT(u*f),m=eT(d*l);return new nT(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:o}=this,{ex:i,ey:a,ez:s,et:c}=tT(e),{a:u,d:l}=Hk,d=eT(t*i),f=eT(n*a),h=eT(o*l*c),p=eT(r*s),g=eT((t+n)*(i+a)-d-f),m=eT(p-h),y=eT(p+h),v=eT(f-u*d),w=eT(g*m),A=eT(y*v),b=eT(g*v),S=eT(m*y);return new nT(w,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?Zk("cannot multiply by 0"):oT;if("bigint"==typeof e&&0n<e&&e<Vk||Zk("invalid scalar, must be < L"),!t&&this.is0()||1n===e)return this;if(this.equals(rT))return BT(e).p;let n=oT,r=rT;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(Hk.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(Vk/2n,!1).double();return Vk%2n&&(e=e.add(this)),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(oT))return{x:0n,y:1n};const r=dT(n);return 1n!==eT(n*r)&&Zk("invalid inverse"),{x:eT(e*r),y:eT(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=cT(t);return n[31]|=1n&e?128:0,n}toHex(){return aT(this.toRawBytes())}}nT.BASE=new nT(Kk,Gk,1n,eT(Kk*Gk)),nT.ZERO=new nT(0n,1n,1n,0n);const{BASE:rT,ZERO:oT}=nT,iT=(e,t)=>e.toString(16).padStart(t,"0"),aT=e=>Array.from(e).map((e=>iT(e,2))).join(""),sT=e=>{const t=e.length;(!Jk(e)||t%2)&&Zk("hex invalid 1");const n=Qk(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)&&Zk("hex invalid 2"),n[t]=i}return n},cT=e=>sT(iT(e,64)).reverse(),uT=e=>BigInt("0x"+aT(Qk(Yk(e)).reverse())),lT=(...e)=>{const t=Qk(e.reduce(((e,t)=>e+Yk(t).length),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.length})),t},dT=(e,t=Wk)=>{(0n===e||t<=0n)&&Zk("no inverse n="+e+" mod="+t);let n=eT(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?eT(o,t):Zk("no inverse")},fT=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Wk;return n},hT=19681161376707505956807079304988542015446066515923890162744021073123829784752n,pT=(e,t)=>{const n=eT(t*t*t),r=(e=>{const t=e*e%Wk*e%Wk,n=fT(t,2n)*t%Wk,r=fT(n,1n)*e%Wk,o=fT(r,5n)*r%Wk,i=fT(o,10n)*o%Wk,a=fT(i,20n)*i%Wk,s=fT(a,40n)*a%Wk,c=fT(s,80n)*s%Wk,u=fT(c,80n)*s%Wk,l=fT(u,10n)*o%Wk;return{pow_p_5_8:fT(l,2n)*e%Wk,b2:t}})(e*eT(n*n*t)).pow_p_5_8;let o=eT(e*n*r);const i=eT(t*o*o),a=o,s=eT(o*hT),c=i===e,u=i===eT(-e),l=i===eT(-e*hT);return c&&(o=a),(u||l)&&(o=s),1n===(1n&eT(o))&&(o=eT(-o)),{isValid:c||u,value:o}},gT=e=>eT(uT(e),Vk);let mT;const yT=(...e)=>RT.sha512Async(...e),vT=(...e)=>"function"==typeof mT?mT(...e):Zk("etc.sha512Sync not set"),wT=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=gT(t),o=rT.mul(r),i=o.toRawBytes();return{head:t,prefix:n,scalar:r,point:o,pointBytes:i}},AT=e=>yT(Xk(e,32)).then(wT),bT=e=>wT(vT(Xk(e,32))),ST=e=>AT(e).then((e=>e.pointBytes));function ET(e,t){return e?yT(t.hashable).then(t.finish):t.finish(vT(t.hashable))}const kT=(e,t,n)=>{const{pointBytes:r,scalar:o}=e,i=gT(t),a=rT.mul(i).toRawBytes();return{hashable:lT(a,r,n),finish:e=>{const t=eT(i+gT(e)*o,Vk);return Yk(lT(a,cT(t)),64)}}},TT=async(e,t)=>{const n=Xk(e),r=await AT(t),o=await yT(r.prefix,n);return ET(!0,kT(r,o,n))},IT={zip215:!0},xT=(e,t,n,r=IT)=>{t=Xk(t),e=Xk(e,64);const{zip215:o}=r;let i,a,s,c,u=new Uint8Array;try{i=nT.fromHex(n,o),a=nT.fromHex(e.slice(0,32),o),s=uT(e.slice(32,64)),c=rT.mul(s,!1),u=lT(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=gT(e);return a.add(i.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},_T=async(e,t,n,r=IT)=>ET(!0,xT(e,t,n,r)),CT=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,RT={bytesToHex:aT,hexToBytes:sT,concatBytes:lT,mod:eT,invert:dT,randomBytes:(e=32)=>{const t=CT();return t&&t.getRandomValues||Zk("crypto.getRandomValues must be defined"),t.getRandomValues(Qk(e))},sha512Async:async(...e)=>{const t=CT();t&&t.subtle||Zk("crypto.subtle or etc.sha512Async must be defined");const n=lT(...e);return Qk(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(RT,{sha512Sync:{configurable:!1,get:()=>mT,set(e){mT||(mT=e)}}});const PT={getExtendedPublicKeyAsync:AT,getExtendedPublicKey:bT,randomPrivateKey:()=>RT.randomBytes(32),precompute:(e=8,t=rT)=>(t.multiply(3n),t)};let NT;const BT=e=>{const t=NT||(NT=(()=>{const e=[];let t=rT,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=oT,o=rT;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 OT(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var MT=n(1048).hp;const zT="8d9df0f7-1363-4d2c-8152-ce4ed78f27d8",UT=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function jT(e){return MT.from(e).toString("base64").replace(/\+/gu,"-").replace(/\//gu,"_").replace(/[=]/gu,"")}function LT(e){const t=e.replace(/-/gu,"+").replace(/_/gu,"/");return new Uint8Array(MT.from(t,"base64"))}function DT(e){return"Ed25519"===e||"object"==typeof e&&"Ed25519"===e.name}function FT(){const{subtle:e}=globalThis.crypto;Object.defineProperty(globalThis,"isSecureContext",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,"generateKey",{value:async(...e)=>DT(e[0])?await async function(e,t,n){const r=PT.randomPrivateKey(),o=await ST(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)=>DT(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([...UT,...n]).buffer;case"jwk":{const e={crv:"Ed25519",ext:t.extractable,key_ops:t.usages,kty:"OKP"};if("private"===t.type){const t=await ST(n);return Object.freeze({...e,d:jT(n),x:jT(t)})}return Object.freeze({...e,x:jT(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 DT(t)&&DT(n.algorithm)?await async function(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=OT(n),o=t[zT],i=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(await TT(r,o));return i}(...e):await globalThis.crypto.subtle.sign(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"verify",{value:async(...e)=>{const[t,n]=e;return DT(t)&&DT(n.algorithm)?await async function(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=OT(n),i=OT(r),a=t[zT];return await _T(o,i,a)}(...e):await globalThis.crypto.subtle.verify(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"importKey",{value:async(...e)=>DT(e[2])?await async function(e,t,n,r,o){const i=Array.from(o);switch(e){case"raw":{const e=OT(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=OT(t);if(48!==e.length)throw new DOMException("Invalid PKCS8 key data length","DataError");if(!e.slice(0,16).every(((e,t)=>e===UT[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]:LT(o)}}case"spki":{const e=OT(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 $T=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,"DOMException",{value:Error,writable:!0,configurable:!0,enumerable:!0}),FT(),Object.defineProperty(globalThis,"queueMicrotask",{value:$T,writable:!0,configurable:!0,enumerable:!0}),xo.config({EXPONENTIAL_AT:16});const qT=async({origin:e,request:t})=>{ed.log("[🔄 onRpcRequest]",t.method,t);const{method:n}=t;Rv(e,n);const r=Bk[n];if(!r)throw new Jr(`RpcRequest method ${n} not found. Available methods: ${Object.values(mv).toString()}`);return await Ok((async()=>r({origin:e,request:t})))??null},WT=async({origin:e,request:t})=>{ed.log("[🔑 onKeyringRequest]",t.method,t),Rv(e,t.method),t.method===Ht.SubmitRequest&&t.params&&!("origin"in t.params)&&(t.params.origin="https://metamask.io");return await Ok((async()=>yn(FE,t)))??null},VT=async({id:e,event:t,context:n})=>{if(ed.log("[👇 onUserInput]",e,t),!t.name)return;const r={...$k,...qk,...vA,...gA,...fA}[t.name];r&&await Ok((async()=>r({id:e,event:t,context:n,snapContext:VE})))},KT=async({request:e})=>{const t=Xl(ed,"[⏱️ onCronjob]");t.log(e.method,e);const{method:n}=e;M(n,H([...Object.values(Rk),...Object.values(Bv)]));return await Ok((async()=>{t.log("Running cronjob",{method:n});const r=Ck[n];if(!r)throw new Jr(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${Object.values([...Object.values(Rk),...Object.values(Bv)]).toString()}`);return r({request:e})}))??null},GT=async e=>{const t=await Ok((async()=>(async e=>{ed.log("[🔍 onAssetsLookup]",e);const{assets:t}=e,n=t.filter((e=>{const{assetNamespace:t}=Fo(e);return"token"===t||"slip44"===t}));return{assets:await CE.getAssetsMetadata(n)}})(e)));return t??null},HT=async e=>{const t=await Ok((async()=>(async e=>{ed.log("[💱 onAssetsConversion]",e);const{conversions:t}=e;return{conversionRates:await IE.getMultipleTokenConversions(t)}})(e)));return t??null},ZT=async e=>{const{origin:t,request:n}=e;Rv(t,n.method);const r=await Ok((async()=>(async({scope:e,request:t})=>{switch(M(e,Sd),t.method){case dv.GetGenesisHash:return M(t,fv),pE.getRpc(e).getGenesisHash().send();case dv.GetLatestBlockhash:return M(t,hv),(await pE.getLatestBlockhash(e)).blockhash;case dv.GetMinimumBalanceForRentExemption:return M(t,pv),(await pE.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)));return r??null},JT=async e=>{const t=await Ok((async()=>(async e=>{ed.log("[📈 onAssetHistoricalPrice]",e);const{from:t,to:n}=e;return M(t,Lo),M(n,Lo),{historicalPrice:await IE.getHistoricalPrice(t,n)}})(e)));return t??null},YT=async({request:e})=>await Ok((async()=>WE.handle(e)))??null,QT=async({event:e})=>Ok((async()=>{await uE.emitSync("onWebSocketEvent",e)})),XT=async()=>Ok((async()=>{await uE.emitSync("onStart")})),eI=async()=>Ok((async()=>{await uE.emitSync("onUpdate")})),tI=async()=>Ok((async()=>{await uE.emitSync("onInstall")})),nI=async()=>Ok((async()=>{await uE.emitSync("onActive")})),rI=async()=>Ok((async()=>{await uE.emitSync("onInactive")})),oI=async e=>{const t=await Ok((async()=>(async e=>{M(e,Pk);const{chainId:t,domain:n,address:r}=e,o=new RegExp(`^.+\\${xE.tld}$`,"u");if(n&&o.test(n)){const e=await xE.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:Nk,domainName:n}]}}if(r){const e=await xE.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:Nk}]}}return null})(e)));return t??null},iI=async e=>{const t=await Ok((async()=>(async e=>{ed.log("[💰 onAssetsMarketData]",e);const{assets:t}=e;return{marketData:await CE.fetchAssetsMarketData(t)}})(e)));return t??null}})(),module.exports=r})();
|