@bonfida/spl-name-service 2.3.8 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7,14 +7,14 @@ read:function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,h=r?i-1:0,d=r?
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
9
  */
10
- !function(t){const e=a,r=y,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|p(t,e);let n=o(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);const i=function(t){if(s.isBuffer(t)){const e=0|l(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?o(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return c(t),o(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(t,o+n)!==c(e,n)){r=!1;break}if(r)return o}return-1}function v(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(Z(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return X(q(e,t.length-r),t,r,n)}function A(t,e,r,n){return X(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function B(t,e,r,n){return X($(e),t,r,n)}function I(t,e,r,n){return X(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function x(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),s.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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},s.allocUnsafe=function(t){return f(t)},s.allocUnsafeSlow=function(t){return f(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))i+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)w(this,e,e+1);return this},s.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},s.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):g.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r);for(let t=0;t<u;++t)if(c[t]!==f[t]){o=c[t],a=f[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function _(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function U(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=K[t[n]];return i}function L(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,i){F(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function O(t,e,r,n,i){F(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function M(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Q((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=s.isBuffer(t)?t:s.from(t,n),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%a]}return this};const W={};function z(t,e,r){W[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function j(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function F(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new W.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(n,i,o)}function V(t,e){if("number"!=typeof t)throw new W.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw V(t,r),new W.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(s);const g=new t("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const w=new t("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t("So11111111111111111111111111111111111111112"),new t("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.s16=b.s8=b.nu64be=b.u48be=b.u40be=b.u32be=b.u24be=b.u16be=b.nu64=b.u48=b.u40=nt=b.u32=b.u24=b.u16=rt=b.u8=b.offset=b.greedy=b.Constant=b.UTF8=b.CString=b.Blob=b.Boolean=b.BitField=b.BitStructure=b.VariantLayout=b.Union=b.UnionLayoutDiscriminator=b.UnionDiscriminator=b.Structure=b.Sequence=b.DoubleBE=b.Double=b.FloatBE=b.Float=b.NearInt64BE=b.NearInt64=b.NearUInt64BE=b.NearUInt64=b.IntBE=b.Int=b.UIntBE=b.UInt=b.OffsetLayout=b.GreedyCount=b.ExternalLayout=b.bindConstructorLayout=b.nameWithProperty=b.Layout=b.uint8ArrayToBuffer=b.checkUint8Array=void 0,b.constant=b.utf8=b.cstr=ot=b.blob=b.unionLayoutDiscriminator=b.union=b.seq=b.bits=it=b.struct=b.f64be=b.f64=b.f32be=b.f32=b.ns64be=b.s48be=b.s40be=b.s32be=b.s24be=b.s16be=b.ns64=b.s48=b.s40=b.s32=b.s24=void 0;const m=s;function v(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function E(t){return v(t),m.Buffer.from(t.buffer,t.byteOffset,t.length)}b.checkUint8Array=v,b.uint8ArrayToBuffer=E;class A{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function B(t,e){return e.property?t+"["+e.property+"]":t}b.Layout=A,b.nameWithProperty=B,b.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof A))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,r)=>e.decode(t,r),writable:!0})};class I extends A{isCount(){throw new Error("ExternalLayout is abstract")}}b.ExternalLayout=I;class S extends I{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){v(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}b.GreedyCount=S;class x extends I{constructor(t,e=0,r){if(!(t instanceof A))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof k||this.layout instanceof R}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}b.OffsetLayout=x;class k extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntLE(t,r,this.span),this.span}}b.UInt=k;class R extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntBE(t,r,this.span),this.span}}b.UIntBE=R;class _ extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeIntLE(t,r,this.span),this.span}}b.Int=_;class U extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeIntBE(t,r,this.span),this.span}}b.IntBE=U;const L=Math.pow(2,32);function P(t){const e=Math.floor(t/L);return{hi32:e,lo32:t-e*L}}function T(t,e){return t*L+e}class C extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}b.NearUInt64=C;class O extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearUInt64BE=O;class N extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}b.NearInt64=N;class D extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearInt64BE=D;class M extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatLE(e)}encode(t,e,r=0){return E(e).writeFloatLE(t,r),4}}b.Float=M;class W extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatBE(e)}encode(t,e,r=0){return E(e).writeFloatBE(t,r),4}}b.FloatBE=W;class z extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleLE(e)}encode(t,e,r=0){return E(e).writeDoubleLE(t,r),8}}b.Double=z;class j extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleBE(e)}encode(t,e,r=0){return E(e).writeDoubleBE(t,r),8}}b.DoubleBE=j;class F extends A{constructor(t,e,r){if(!(t instanceof A))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof I&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(e instanceof I)&&0<t.span&&(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof I&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t,e=0){const r=[];let n=0,i=this.count;for(i instanceof I&&(i=i.decode(t,e));n<i;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e,r=0){const n=this.elementLayout,i=t.reduce(((t,i)=>t+n.encode(i,e,r+t)),0);return this.count instanceof I&&this.count.encode(t.length,e,r),i}}b.Sequence=F;class V extends A{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof A),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===r&&(r=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const i=n.getSpan(t,e);return e+=i,r+i}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){v(t);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const n=r;let i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-n}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}b.Structure=V;class H{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}b.UnionDiscriminator=H;class G extends H{constructor(t,e){if(!(t instanceof I&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}b.UnionLayoutDiscriminator=G;class q extends A{constructor(t,e,r){let n;if(t instanceof k||t instanceof R)n=new G(new x(t));else if(t instanceof I&&t.isCount())n=new G(t);else{if(!(t instanceof H))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=t}if(void 0===e&&(e=null),!(null===e||e instanceof A))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof k||t instanceof R)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof k||t instanceof R,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r;const n=this.discriminator,i=n.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=i,r[o.property]=o.decode(t,e+s)}else r=o.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(t[n.property],e,r),o+i.encode(t[i.property],e,r+o)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new $(this,t,e,r);return this.registry[t]=n,n}getVariant(t,e=0){let r;return r=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[r]}}b.Union=q;class $ extends A{constructor(t,e,r,n){if(!(t instanceof q))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof A))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof n)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=r?r.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,n),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(t,e+r)),r+n}decode(t,e=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let i=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),i+=this.layout.getSpan(e,r+n),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function X(t){return 0>t&&(t+=4294967296),t}b.VariantLayout=$;class Y extends A{constructor(t,e,r){if(!(t instanceof k||t instanceof R))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let n=0;this._packedSetValue=function(t){return n=X(t),this},this._packedGetValue=function(){return n}}decode(t,e=0){const r=this.makeDestinationObject(),n=this.word.decode(t,e);this._packedSetValue(n);for(const e of this.fields)void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){const n=this.word.decode(e,r);this._packedSetValue(n);for(const e of this.fields)if(void 0!==e.property){const r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){const r=new Z(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new K(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}b.BitStructure=Y;class Z{constructor(t,e,r){if(!(t instanceof Y))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const n=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>n)throw new Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-e),this.wordMask=X(this.valueMask<<this.start),this.property=r}decode(t,e){return X(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==X(t&this.valueMask))throw new TypeError(B("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=X(t<<this.start);this.container._packedSetValue(X(e&~this.wordMask)|r)}}b.BitField=Z;class K extends Z{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t=+t),super.encode(t)}}b.Boolean=K;class Q extends A{constructor(t,e){if(!(t instanceof I&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof I||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),E(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof I&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(B("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=E(t);return E(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof I&&this.length.encode(n,e,r),n}}b.Blob=Q;class J extends A{constructor(t){super(-1,t)}getSpan(t,e=0){v(t);let r=e;for(;r<t.length&&0!==t[r];)r+=1;return 1+r-e}decode(t,e=0){const r=this.getSpan(t,e);return E(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(r+i>e.length)throw new RangeError("encoding overruns Buffer");const o=E(e);return n.copy(o,r),o[r+i]=0,i+1}}b.CString=J;class tt extends A{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return v(t),t.length-e}decode(t,e=0){const r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return E(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(r+i>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(E(e),r),i}}b.UTF8=tt;class et extends A{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}b.Constant=et,b.greedy=(t,e)=>new S(t,e),b.offset=(t,e,r)=>new x(t,e,r);var rt=b.u8=t=>new k(1,t);b.u16=t=>new k(2,t),b.u24=t=>new k(3,t);var nt=b.u32=t=>new k(4,t);b.u40=t=>new k(5,t),b.u48=t=>new k(6,t),b.nu64=t=>new C(t),b.u16be=t=>new R(2,t),b.u24be=t=>new R(3,t),b.u32be=t=>new R(4,t),b.u40be=t=>new R(5,t),b.u48be=t=>new R(6,t),b.nu64be=t=>new O(t),b.s8=t=>new _(1,t),b.s16=t=>new _(2,t),b.s24=t=>new _(3,t),b.s32=t=>new _(4,t),b.s40=t=>new _(5,t),b.s48=t=>new _(6,t),b.ns64=t=>new N(t),b.s16be=t=>new U(2,t),b.s24be=t=>new U(3,t),b.s32be=t=>new U(4,t),b.s40be=t=>new U(5,t),b.s48be=t=>new U(6,t),b.ns64be=t=>new D(t),b.f32=t=>new M(t),b.f32be=t=>new W(t),b.f64=t=>new z(t),b.f64be=t=>new j(t);var it=b.struct=(t,e,r)=>new V(t,e,r);b.bits=(t,e,r)=>new Y(t,e,r),b.seq=(t,e,r)=>new F(t,e,r),b.union=(t,e,r)=>new q(t,e,r),b.unionLayoutDiscriminator=(t,e)=>new G(t,e);var ot=b.blob=(t,e)=>new Q(t,e);b.cstr=t=>new J(t),b.utf8=(t,e)=>new tt(t,e),b.constant=(t,e)=>new et(t,e);const st=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var at={};Object.defineProperty(at,"__esModule",{value:!0});var ut=at.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};at.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var ct=at.toBufferLE=function(t,e){{const r=t.toString(16),n=Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};at.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const ft=(ht=8,t=>{const e=ot(ht,t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>{const r=n(t,e);return ut(Buffer.from(r))},i.encode=(t,e,n)=>{const i=ct(t,ht);return r(i,e,n)},i});var ht;const dt=t=>{const e=rt(t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>!!n(t,e),i.encode=(t,e,n)=>{const i=Number(t);return r(i,e,n)},i},lt=e=>{const r=ot(32,e),{encode:n,decode:i}=st(r),o=r;return o.decode=(e,r)=>{const n=i(e,r);return new t(n)},o.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},o};class pt extends Error{constructor(t){super(t)}}class yt extends pt{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class gt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class wt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class bt extends pt{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class mt extends pt{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(vt||(vt={}));const Et=1,At=it([rt("m"),rt("n"),dt("isInitialized"),lt("signer1"),lt("signer2"),lt("signer3"),lt("signer4"),lt("signer5"),lt("signer6"),lt("signer7"),lt("signer8"),lt("signer9"),lt("signer10"),lt("signer11")]).span;var Bt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(Bt||(Bt={}));const It=it([lt("mint"),lt("owner"),ft("amount"),nt("delegateOption"),lt("delegate"),rt("state"),nt("isNativeOption"),ft("isNative"),ft("delegatedAmount"),nt("closeAuthorityOption"),lt("closeAuthority")]),St=It.span,xt=it([nt("mintAuthorityOption"),lt("mintAuthority"),ft("supply"),rt("decimals"),dt("isInitialized"),nt("freezeAuthorityOption"),lt("freezeAuthority")]),kt=xt.span;async function Rt(t,e,r,n=g){return function(t,e,r=g){if(!e)throw new yt;if(!e.owner.equals(r))throw new gt;if(e.data.length<kt)throw new wt;const n=xt.decode(e.data.slice(0,kt));let i=Buffer.alloc(0);if(e.data.length>kt){if(e.data.length<=St)throw new wt;if(e.data.length===At)throw new wt;if(e.data[St]!=vt.Mint)throw new bt;i=e.data.slice(St+Et)}return{address:t,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:i}}(e,await t.getAccountInfo(e,r),n)}function _t(e,r,n=!1,i=g,o=w){if(!n&&!t.isOnCurve(r.toBuffer()))throw new mt;const[s]=t.findProgramAddressSync([r.toBuffer(),i.toBuffer(),e.toBuffer()],o);return s}function Ut(t,n,i,o,s=g,a=w){return function(t,n,i,o,s,a=g,u=w){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new r({keys:c,programId:u,data:s})}(t,n,i,o,Buffer.from([1]),s,a)}var Lt;!function(t){t.SymbolNotFound="SymbolNotFound",t.InvalidSubdomain="InvalidSubdomain",t.FavouriteDomainNotFound="FavouriteDomainNotFound",t.MissingParentOwner="MissingParentOwner",t.U32Overflow="U32Overflow",t.InvalidBufferLength="InvalidBufferLength",t.U64Overflow="U64Overflow",t.NoRecordData="NoRecordData",t.InvalidRecordData="InvalidRecordData",t.UnsupportedRecord="UnsupportedRecord",t.InvalidEvmAddress="InvalidEvmAddress",t.InvalidInjectiveAddress="InvalidInjectiveAddress",t.InvalidARecord="InvalidARecord",t.InvalidAAAARecord="InvalidAAAARecord",t.InvalidRecordInput="InvalidRecordInput",t.InvalidSignature="InvalidSignature",t.AccountDoesNotExist="AccountDoesNotExist",t.MultipleRegistries="MultipleRegistries",t.InvalidReverseTwitter="InvalidReverseTwitter",t.NoAccountData="NoAccountData",t.InvalidInput="InvalidInput",t.InvalidDomain="InvalidDomain",t.InvalidCustomBg="InvalidCustomBackground",t.UnsupportedSignature="UnsupportedSignature",t.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",t.RecordIsNotSigned="RecordIsNotSigned",t.UnsupportedSignatureType="UnsupportedSignatureType",t.InvalidSolRecordV2="InvalidSolRecordV2",t.MissingVerifier="MissingVerifier",t.PythFeedNotFound="PythFeedNotFound"}(Lt||(Lt={}));class Pt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,Pt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new Pt(Lt.InvalidBufferLength,`Invalid buffer length: ${t.length}`);const e=BigInt(t.readUInt32LE(0));return new Tt(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}class Ct{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new Pt(Lt.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new Ct(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ot,Nt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Dt=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),Mt=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),i=this.view[n](this.offset,!0);return this.offset+=r,i},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),Wt=(Ot=function(t,e){return Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ot(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ot(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function zt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function jt(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var Ft=Nt.concat(["bool","string"]),Vt=["option","enum","array","set","map","struct"],Ht=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Wt(e,t),e}(Error);function Gt(t){if("string"!=typeof t||!Ft.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Vt.includes(e[0])){var r=e[0];if("option"===r)return Gt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Ht(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');Gt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Gt(t.type);throw new Ht(t,"{ type, len? }")}(t[r]);if("set"===r)return Gt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Ht(t,"{ key, value }");Gt(t.key),Gt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"object");for(var e in t)Gt(t[e])}(t[r])}}throw new Ht(t,Vt.join(", ")+" or "+Ft.join(", "))}}var qt=function(){function t(t){this.encoded=new Dt,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(Nt.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&zt(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&zt(t,"string",this.fieldPath);for(var e=t,r=[],n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?r.push(i):i<2048?r.push(192|i>>6,128|63&i):i<55296||i>=57344?r.push(224|i>>12,128|i>>6&63,128|63&i):(n++,i=65536+((1023&i)<<10|1023&e.charCodeAt(n)),r.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}this.encoded.store_value(r.length,"u32"),this.encoded.store_bytes(new Uint8Array(r))},t.prototype.encode_boolean=function(t){this.checkTypes&&zt(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?jt(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?jt(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&zt(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&zt(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var i=0,o=n;i<o.length;i++){var s=o[i];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&zt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),$t=function(){function t(t){this.buffer=new Mt(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Nt.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},t.prototype.decode_string=function(){for(var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t)),r=[],n=0;n<t;++n){var i=e[n];if(i<128)r.push(i);else if(i<224)r.push((31&i)<<6|63&e[++n]);else if(i<240)r.push((15&i)<<12|(63&e[++n])<<6|63&e[++n]);else{var o=(7&i)<<18|(63&e[++n])<<12|(63&e[++n])<<6|63&e[++n];r.push(o)}}return String.fromCodePoint.apply(String,r)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function Xt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new qt(r).encode(e,t)}function Yt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new $t(e).decode(t)}function Zt(e,n,i,o,a,u,c,f,h,d,l){const p=[s.Buffer.from(Int8Array.from([0])),new Tt(u.length).toBuffer(),u,c.toBuffer(),f.toBuffer()],y=s.Buffer.concat(p),g=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1}];return h?g.push({pubkey:h,isSigner:!0,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d?g.push({pubkey:d,isSigner:!1,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),l&&g.push({pubkey:l,isSigner:!0,isWritable:!1}),new r({keys:g,programId:e,data:y})}function Kt(t,e,n,i,o){const a=[s.Buffer.from(Int8Array.from([1])),n.toBuffer(),new Tt(i.length).toBuffer(),i],u=s.Buffer.concat(a);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:u})}function Qt(e,n,i,o,a,u,c){const f=[s.Buffer.from(Int8Array.from([2])),i.toBuffer()],h=s.Buffer.concat(f),d=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:c||o,isSigner:!0,isWritable:!1}];return a&&d.push({pubkey:a,isSigner:!0,isWritable:!1}),c&&u&&(a||d.push({pubkey:t.default,isSigner:!1,isWritable:!1}),d.push({pubkey:u,isSigner:!1,isWritable:!1})),new r({keys:d,programId:e,data:h})}function Jt(t,e,n,i){const o=[s.Buffer.from(Int8Array.from([3]))],a=s.Buffer.concat(o);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0}],programId:t,data:a})}class te{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Xt(te.schema,this)}getInstruction(t,n,i,o,a,u,c,f,h,d,l){const p=s.Buffer.from(this.serialize()),y=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!0},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:f,isSigner:!0,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:g,isSigner:!1,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!1}];return new r({keys:y,programId:t,data:p})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(t){this.tag=12,this.name=t.name}serialize(){return Xt(ee.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!1}),l.push({pubkey:a,isSigner:!1,isWritable:!1}),l.push({pubkey:u,isSigner:!0,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),f&&l.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&l.push({pubkey:h,isSigner:!0,isWritable:!0}),new r({keys:l,programId:t,data:d})}}ee.schema={struct:{tag:"u8",name:"string"}};class re{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Xt(re.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!1}),v.push({pubkey:d,isSigner:!1,isWritable:!1}),v.push({pubkey:l,isSigner:!1,isWritable:!1}),v.push({pubkey:p,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),b&&v.push({pubkey:b,isSigner:!1,isWritable:!0}),new r({keys:v,programId:t,data:m})}}re.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class ne{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Xt(ne.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey:p,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),v.push({pubkey:b,isSigner:!1,isWritable:!1}),new r({keys:v,programId:t,data:m})}}ne.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ie{constructor(){this.tag=16}serialize(){return Xt(ie.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!0}),l.push({pubkey:a,isSigner:!1,isWritable:!0}),l.push({pubkey:u,isSigner:!1,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),l.push({pubkey:f,isSigner:!0,isWritable:!1}),l.push({pubkey:h,isSigner:!1,isWritable:!0}),new r({keys:l,programId:t,data:d})}}function oe(t,e,n,i,o,a){const u=[s.Buffer.from(Int8Array.from([4])),a.toBuffer()],c=s.Buffer.concat(u);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:c})}ie.schema={struct:{tag:"u8"}};const se=new t("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ae=s.Buffer.from("tokenized_name"),ue=e=>{const[r]=t.findProgramAddressSync([ae,e.toBuffer()],se);return r};var ce;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(ce||(ce={}));class fe{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t(e.nameAccount),this.owner=new t(e.owner),this.nftMint=new t(e.nftMint)}static deserialize(t){return new fe(Yt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("NFT record not found");return this.deserialize(r.data)}static async findKey(e,r){return await t.findProgramAddress([s.Buffer.from("nft_record"),e.toBuffer()],r)}}fe.schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};const he=async(e,r)=>{try{const[n]=await t.findProgramAddress([ae,r.toBuffer()],se);if("0"===(await Rt(e,n)).supply.toString())return;const i=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],o=await e.getProgramAccounts(g,{filters:i});if(1!=o.length)return;return new t(o[0].account.data.slice(32,64))}catch{return}},de=async e=>{const r=await e.getProgramAccounts(se,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t(e.account.data.slice(66,98))))},le=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],pe=async(t,e)=>{const r=await(async(t,e)=>{const r=[{memcmp:{offset:0,bytes:"3"}},{memcmp:{offset:66,bytes:e.toBase58()}}];return await t.getProgramAccounts(se,{filters:r})})(t,e.mint);if(1===r.length)return fe.deserialize(r[0].account.data)},ye=async(t,e)=>{const r=[...le(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(g,{filters:r})).map((t=>It.decode(t.account.data))).map((e=>pe(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class ge{constructor(e){this.parentName=new t(e.parentName),this.owner=new t(e.owner),this.class=new t(e.class)}static deserialize(t){const e=new ge(Yt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e}static async retrieve(t,e){var r;const n=await t.getAccountInfo(e);if(!n)throw new Pt(Lt.AccountDoesNotExist);const i=new ge(Yt(this.schema,n.data));i.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:i,nftOwner:await he(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new ge(Yt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e};return r.map((t=>n(null==t?void 0:t.data)))}static async retrieveBatch(t,e){let r=[];const n=[...e];for(;n.length>0;)r.push(...await this._retrieveBatch(t,n.splice(0,100)));return r}}function we(t,...e){if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function be(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}ge.HEADER_LEN=96,ge.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const me="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
11
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ve(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Ee=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ae=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Be(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function Ie(t){if("string"==typeof t&&(t=Be(t)),!ve(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class Se{clone(){return this._cloneInto()}}function xe(t){const e=e=>t().update(Ie(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class ke extends Se{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Ee(this.buffer)}update(t){be(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=Ie(t)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=Ee(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){be(this),function(t,e){we(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Ee(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,c[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const Re=(t,e,r)=>t&e^~t&r,_e=(t,e,r)=>t&e^t&r^e&r,Ue=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Le=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pe=new Uint32Array(64);class Te extends ke{constructor(){super(64,32,8,!1),this.A=0|Le[0],this.B=0|Le[1],this.C=0|Le[2],this.D=0|Le[3],this.E=0|Le[4],this.F=0|Le[5],this.G=0|Le[6],this.H=0|Le[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Pe[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Pe[t-15],r=Pe[t-2],n=Ae(e,7)^Ae(e,18)^e>>>3,i=Ae(r,17)^Ae(r,19)^r>>>10;Pe[t]=i+Pe[t-7]+n+Pe[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(Ae(s,6)^Ae(s,11)^Ae(s,25))+Re(s,a,u)+Ue[t]+Pe[t]|0,f=(Ae(r,2)^Ae(r,13)^Ae(r,22))+_e(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Pe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Ce=xe((()=>new Te)),Oe=new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),Ne="SPL Name Service",De=new t("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Me=new t("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),We=new t("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),ze=new t("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),je=new t("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Fe=new t("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Ve=new t("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),He=96,Ge=new t("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),qe=new t("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),$e=[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new t("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new t("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new t("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ")],Xe=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ye=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",{price:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",product:"8GWTTbNiXdmyZREXbjsZBmCRuzdPrW55dnZGDkTRjWvb"}],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",{price:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",product:"Av6XyAMJnyi68FdsKSPYgzfXGjYrrt6jcAMwtvzLCqaM"}],["So11111111111111111111111111111111111111112",{price:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",product:"ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",product:"HyEB4Goiv7QyfFStaBn49JqQzSTV1ybtVikwsMLH1f2M"}],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",{price:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",product:"BS2iAqT67j8hA9Jji4B8UpL3Nfw9kwPfU5s4qeaf1e7r"}],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",{price:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",product:"FerFD54J6RgmQVCR5oNgpzXmz8BW2eBNhhirb1d5oifo"}],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",{price:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",product:"8xTEctXKo6Xo3EzNhSNp4TUe8mgfwWFbDUXJhuubvrKx"}],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",{price:"nrYkQQQur7z8rYTST3G9GqATviK5SxTDkrqd21MW6Ue",product:"AiQB4WngNPKDe3iWAwZmMzbULDAAfUD6Sr1knfZNJj3y"}],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",{price:"AFrYBhb5wKQtxRS9UA9YRS4V3dwFm7SqmS6DHKq6YVgo",product:"3RtUHQR2LQ7su5R4zWwjupx72sWRGvLA4cFmnbHnT9M7"}],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",{price:"9EdtbaivHQYA4Nh3XzGR6DwRaoorqXYnmpfsnFhvwuVj",product:"5Q5kyCVzssrGMd2BniSdVeRwjNWrGGrFhMrgGt4zURyA"}]]),Ze=new t("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),Ke=new t("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Qe=new t("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),Je=new t("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),tr=new t("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),er=new t("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function rr(t,e){if(!await t.getAccountInfo(e))throw new Pt(Lt.AccountDoesNotExist);return ge.retrieve(t,e)}async function nr(t){const e=Ne+t,r=Ce(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)}async function ir(e,r,n){const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=await t.findProgramAddress(i,Oe);return o}async function or(t,e){const r=await nr(e.toBase58()),n=await ir(r,je),{registry:i}=await ge.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);const o=i.data.slice(0,4).readUInt32LE(0);return i.data.slice(4,4+o).toString()}async function sr(t,e){let r=[];for(let t of e){const e=await nr(t.toBase58()),n=await ir(e,je);r.push(n)}return(await ge.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;const e=t.data.slice(0,4).readUInt32LE(0);return t.data.slice(4,4+e).toString()}))}const ar=async(t,e=De)=>{let r=await nr(t);return{pubkey:await ir(r,void 0,e),hashed:r}},ur=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=s.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:n}=await ar(r[1]);return{...await ar(t,n),isSub:!0,parent:n}}if(3===r.length&&e){const{pubkey:t}=await ar(r[2]),{pubkey:e}=await ar("\0".concat(r[1]),t),n=s.Buffer.from([1]).toString();return{...await ar(n.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new Pt(Lt.InvalidInput);return{...await ar(t,De),isSub:!1,parent:void 0}},cr=async(t,e)=>{const{pubkey:r,parent:n}=await ur(t),i=await nr(r.toBase58());return await ir(i,je,e?n:void 0)};var fr,hr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],dr=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),lr=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),i=this.view[n](this.offset,!0);return this.offset+=r,i},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),pr=(fr=function(t,e){return fr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},fr(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}fr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function yr(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function gr(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var wr=hr.concat(["bool","string"]),br=["option","enum","array","set","map","struct"],mr=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return pr(e,t),e}(Error);function vr(t){if("string"!=typeof t||!wr.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&br.includes(e[0])){var r=e[0];if("option"===r)return vr(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new mr(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');vr({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new mr(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return vr(t.type);throw new mr(t,"{ type, len? }")}(t[r]);if("set"===r)return vr(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new mr(t,"{ key, value }");vr(t.key),vr(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new mr(t,"object");for(var e in t)vr(t[e])}(t[r])}}throw new mr(t,br.join(", ")+" or "+wr.join(", "))}}var Er=function(){function t(t){this.encoded=new dr,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(hr.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&yr(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&yr(t,"string",this.fieldPath);var e=t;this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encoded.store_value(e.charCodeAt(r),"u8")},t.prototype.encode_boolean=function(t){this.checkTypes&&yr(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?gr(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?gr(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&yr(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&yr(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var i=0,o=n;i<o.length;i++){var s=o[i];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&yr(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),Ar=function(){function t(t){this.buffer=new lr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(hr.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},t.prototype.decode_string=function(){var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t));return String.fromCharCode.apply(null,e)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function Br(t,e,r){return void 0===r&&(r=!0),r&&vr(t),new Er(r).encode(e,t)}class Ir{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return Br(Ir.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Ir.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class Sr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return Br(Sr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Sr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class xr{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return Br(xr.schema,this)}getInstruction(t,e,n,i,o,s,a,u,c){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:e,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:i,isSigner:!0,isWritable:!0}),h.push({pubkey:o,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:u,isSigner:!1,isWritable:!1}),h.push({pubkey:c,isSigner:!0,isWritable:!0}),new r({keys:h,programId:t,data:f})}}xr.schema={struct:{tag:"u8",staleness:"bool"}};class kr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return Br(kr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}kr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class Rr{constructor(){this.tag=5}serialize(){return Br(Rr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Rr.schema={struct:{tag:"u8"}};class _r{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return Br(_r.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}_r.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const Ur=new t("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Lr]=t.findProgramAddressSync([Ur.toBuffer()],Ur);var Pr,Tr;(Tr=Pr||(Pr={}))[Tr.None=0]="None",Tr[Tr.Solana=1]="Solana",Tr[Tr.Ethereum=2]="Ethereum",Tr[Tr.UnverifiedSolana=3]="UnverifiedSolana";const Cr=t=>{switch(t){case Pr.None:return 0;case Pr.Ethereum:return 20;case Pr.Solana:case Pr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Or{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Or((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&vr(e),new Ar(r).decode(e)));var e,r,n}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data.slice(96,96+this.LEN))}}Or.LEN=8,Or.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Nr{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Or.deserialize(t.slice(96,96+Or.LEN)),r=t.slice(96+Or.LEN);return new Nr(e,r)}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data)}static async retrieveBatch(t,e){return(await t.getMultipleAccountsInfo(e)).map((t=>{if(null==t?void 0:t.data)return this.deserialize(t.data)}))}getContent(){let t=Cr(this.header.stalenessValidation)+Cr(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Cr(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Cr(this.header.stalenessValidation),e=t+Cr(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var Dr;!function(t){t.IPFS="IPFS",t.ARWV="ARWV",t.SOL="SOL",t.ETH="ETH",t.BTC="BTC",t.LTC="LTC",t.DOGE="DOGE",t.Email="email",t.Url="url",t.Discord="discord",t.Github="github",t.Reddit="reddit",t.Twitter="twitter",t.Telegram="telegram",t.Pic="pic",t.SHDW="SHDW",t.POINT="POINT",t.BSC="BSC",t.Injective="INJ",t.Backpack="backpack",t.A="A",t.AAAA="AAAA",t.CNAME="CNAME",t.TXT="TXT",t.Background="background"}(Dr||(Dr={}));const Mr=new Map([[Dr.SOL,96],[Dr.ETH,20],[Dr.BSC,20],[Dr.Injective,20],[Dr.A,4],[Dr.AAAA,16],[Dr.Background,32]]);var Wr;!function(t){t[t.V1=1]="V1",t[t.V2=2]="V2"}(Wr||(Wr={}));var zr="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",jr="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Fr=0,Vr=-3;function Hr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Gr(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Hr,this.dtree=new Hr}var qr=new Hr,$r=new Hr,Xr=new Uint8Array(30),Yr=new Uint16Array(30),Zr=new Uint8Array(30),Kr=new Uint16Array(30),Qr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jr=new Hr,tn=new Uint8Array(320);function en(t,e,r,n){var i,o;for(i=0;i<r;++i)t[i]=0;for(i=0;i<30-r;++i)t[i+r]=i/r|0;for(o=n,i=0;i<30;++i)e[i]=o,o+=1<<t[i]}var rn=new Uint16Array(16);function nn(t,e,r,n){var i,o;for(i=0;i<16;++i)t.table[i]=0;for(i=0;i<n;++i)t.table[e[r+i]]++;for(t.table[0]=0,o=0,i=0;i<16;++i)rn[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[rn[e[r+i]]++]=i)}function on(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function sn(t,e,r){if(!e)return r;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var n=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,n+r}function an(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,i=0,o=t.tag;do{n=2*n+(1&o),o>>>=1,++i,r+=e.table[i],n-=e.table[i]}while(n>=0);return t.tag=o,t.bitcount-=i,e.trans[r+n]}function un(t,e,r){var n,i,o,s,a,u;for(n=sn(t,5,257),i=sn(t,5,1),o=sn(t,4,4),s=0;s<19;++s)tn[s]=0;for(s=0;s<o;++s){var c=sn(t,3,0);tn[Qr[s]]=c}for(nn(Jr,tn,0,19),a=0;a<n+i;){var f=an(t,Jr);switch(f){case 16:var h=tn[a-1];for(u=sn(t,2,3);u;--u)tn[a++]=h;break;case 17:for(u=sn(t,3,3);u;--u)tn[a++]=0;break;case 18:for(u=sn(t,7,11);u;--u)tn[a++]=0;break;default:tn[a++]=f}}nn(e,tn,0,n),nn(r,tn,n,i)}function cn(t,e,r){for(;;){var n,i,o,s,a=an(t,e);if(256===a)return Fr;if(a<256)t.dest[t.destLen++]=a;else for(n=sn(t,Xr[a-=257],Yr[a]),i=an(t,r),s=o=t.destLen-sn(t,Zr[i],Kr[i]);s<o+n;++s)t.dest[t.destLen++]=t.dest[s]}}function fn(t){for(var e,r;t.bitcount>8;)t.sourceIndex--,t.bitcount-=8;if((e=256*(e=t.source[t.sourceIndex+1])+t.source[t.sourceIndex])!==(65535&~(256*t.source[t.sourceIndex+3]+t.source[t.sourceIndex+2])))return Vr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Fr}!function(t,e){var r;for(r=0;r<7;++r)t.table[r]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,r=0;r<24;++r)t.trans[r]=256+r;for(r=0;r<144;++r)t.trans[24+r]=r;for(r=0;r<8;++r)t.trans[168+r]=280+r;for(r=0;r<112;++r)t.trans[176+r]=144+r;for(r=0;r<5;++r)e.table[r]=0;for(e.table[5]=32,r=0;r<32;++r)e.trans[r]=r}(qr,$r),en(Xr,Yr,4,3),en(Zr,Kr,2,1),Xr[28]=0,Yr[28]=258;var hn=function(t,e){var r,n,i=new Gr(t,e);do{switch(r=on(i),sn(i,2,0)){case 0:n=fn(i);break;case 1:n=cn(i,qr,$r);break;case 2:un(i,i.ltree,i.dtree),n=cn(i,i.ltree,i.dtree);break;default:n=Vr}if(n!==Fr)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?"function"==typeof i.dest.slice?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest};const dn=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],ln=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var pn={swap32LE:t=>{dn&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)ln(t,r,r+3),ln(t,r+1,r+2)})(t)}};const yn=hn,{swap32LE:gn}=pn;var wn=class{constructor(t){const e="function"==typeof t.readUInt32BE&&"function"==typeof t.slice;if(e||t instanceof Uint8Array){let r;if(e)this.highStart=t.readUInt32LE(0),this.errorValue=t.readUInt32LE(4),r=t.readUInt32LE(8),t=t.slice(12);else{const e=new DataView(t.buffer);this.highStart=e.getUint32(0,!0),this.errorValue=e.getUint32(4,!0),r=e.getUint32(8,!0),t=t.subarray(12)}t=yn(t,new Uint8Array(r)),t=yn(t,new Uint8Array(r)),gn(t),this.data=new Uint32Array(t.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=t)}get(t){let e;return t<0||t>1114111?this.errorValue:t<55296||t>56319&&t<=65535?(e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t<this.highStart?(e=this.data[2080+(t>>11)],e=this.data[e+(t>>5&63)],e=(e<<2)+(31&t),this.data[e]):this.data[this.data.length-4]}},bn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,bn.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,i="function"==typeof Buffer,o="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(a),c=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(u),f=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,h=String.fromCharCode.bind(String),d="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},l=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},p=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,i,o="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");o+=u[(e=r<<16|n<<8|i)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},g=n?function(t){return btoa(t)}:i?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=i?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,i=t.length;n<i;n+=e)r.push(h.apply(null,t.subarray(n,n+e)));return g(r.join(""))},b=function(t,e){return void 0===e&&(e=!1),e?l(w(t)):w(t)},m=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?h(192|e>>>6)+h(128|63&e):h(224|e>>>12&15)+h(128|e>>>6&63)+h(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return h(240|e>>>18&7)+h(128|e>>>12&63)+h(128|e>>>6&63)+h(128|63&e)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,E=function(t){return t.replace(v,m)},A=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},B=function(t,e){return void 0===e&&(e=!1),e?l(A(t)):A(t)},I=function(t){return B(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return h(55296+(e>>>10))+h(56320+(1023&e));case 3:return h((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return h((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},k=function(t){return t.replace(S,x)},R=function(t){if(t=t.replace(/\s+/g,""),!f.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,i="",o=0;o<t.length;)e=c[t.charAt(o++)]<<18|c[t.charAt(o++)]<<12|(r=c[t.charAt(o++)])<<6|(n=c[t.charAt(o++)]),i+=64===r?h(e>>16&255):64===n?h(e>>16&255,e>>8&255):h(e>>16&255,e>>8&255,255&e);return i},_=r?function(t){return atob(p(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:R,U=i?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(_(t).split("").map((function(t){return t.charCodeAt(0)})))},L=function(t){return U(T(t))},P=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:o?function(t){return o.decode(U(t))}:function(t){return k(_(t))},T=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return P(T(t))},O=function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},N=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},D=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,N(e))};t("fromBase64",(function(){return C(this)})),t("toBase64",(function(t){return B(this,t)})),t("toBase64URI",(function(){return B(this,!0)})),t("toBase64URL",(function(){return B(this,!0)})),t("toUint8Array",(function(){return L(this)}))},M=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,N(e))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},W=function(){D(),M()},z={version:t,VERSION:e,atob:_,atobPolyfill:R,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:B,encode:B,encodeURI:I,encodeURL:I,utob:E,btou:k,decode:C,isValid:O,fromUint8Array:b,toUint8Array:L,extendString:D,extendUint8Array:M,extendBuiltins:W,Base64:{}};return Object.keys(z).forEach((function(t){return z.Base64[t]=z[t]})),z}();const mn={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},vn=zr,En=jr,An=wn,Bn=bn.exports.Base64,In=new An(Bn.toUint8Array(vn)),Sn=new An(Bn.toUint8Array(En));function xn(t,e){return 0!=(t&e)}const kn=0,Rn=1,_n=2;function Un(t,e){const r=t.length;let n=0,i=kn;for(let o=e;o+1<r;o++){const r=t[o+0],s=t[o+1];switch(xn(r,mn.Regional_Indicator)||(n=0),i){case _n:case kn:i=xn(r,mn.Extended_Pictographic)?Rn:kn;break;case Rn:i=xn(r,mn.Extend)?Rn:xn(r,mn.ZWJ)&&xn(s,mn.Extended_Pictographic)?_n:kn}if(!xn(r,mn.CR)||!xn(s,mn.LF)){if(xn(r,mn.Control|mn.CR|mn.LF))return o+1-e;if(xn(s,mn.Control|mn.CR|mn.LF))return o+1-e;if(!(xn(r,mn.L)&&xn(s,mn.L|mn.V|mn.LV|mn.LVT)||xn(r,mn.LV|mn.V)&&xn(s,mn.V|mn.T)||xn(r,mn.LVT|mn.T)&&xn(s,mn.T)||xn(s,mn.Extend|mn.ZWJ)||xn(s,mn.SpacingMark)||xn(r,mn.Prepend)||i===_n)){if(!xn(r,mn.Regional_Indicator)||!xn(s,mn.Regional_Indicator)||n%2!=0)return o+1-e;n++}}}return r-e}var Ln=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const i=t.codePointAt(e);n.push(In.get(i)|Sn.get(i)),e+=i>65535?2:1,r.push(e)}for(let i=0;i<n.length;){const o=Un(n,i),s=r[i],a=r[i+o];e.push(t.slice(s,a)),i+=o}return e},Pn=o(Ln);const Tn=t=>{const e=Ne+t,r=Ce(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)},Cn=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,Oe);return o};async function On(t,e){const r=Tn(e.toBase58()),n=Cn(r,je),{registry:i}=await ge.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Xn(i.data)}async function Nn(t,e){let r=[];for(let t of e){const e=Tn(t.toBase58()),n=Cn(e,je);r.push(n)}return(await ge.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Xn(t.data)}))}const Dn=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:je.toBase58()}}],n=await t.getProgramAccounts(Oe,{filters:r}),i=[{memcmp:{offset:0,bytes:e.toBase58()}}],o=await t.getProgramAccounts(Oe,{filters:i,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Xn(t.account.data.slice(96))]))),a=[];return o.forEach((t=>{const r=Hn(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},Mn=(t,e=De,r)=>{let n=Tn(t);return{pubkey:Cn(n,r,e),hashed:n}},Wn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===Wr.V2?Lr:void 0,n=t.split(".");if(2===n.length){const t=s.Buffer.from([e||0]).toString().concat(n[0]),{pubkey:i}=Mn(n[1]);return{...Mn(t,i,r),isSub:!0,parent:i}}if(3===n.length&&e){const{pubkey:t}=Mn(n[2]),{pubkey:i}=Mn("\0".concat(n[1]),t),o=e===Wr.V2?"":"";return{...Mn(o.concat(n[0]),i,r),isSub:!0,parent:t,isSubRecord:!0}}if(n.length>=3)throw new Pt(Lt.InvalidInput);return{...Mn(t,De),isSub:!1,parent:void 0}};async function zn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:De.toBase58()}}];return(await t.getProgramAccounts(Oe,{filters:r})).map((t=>t.pubkey))}async function jn(t,e){const r=await zn(t,e),n=await Nn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))}const Fn=async t=>{const e=[{memcmp:{offset:0,bytes:De.toBase58()}}];return await t.getProgramAccounts(Oe,{dataSlice:{offset:32,length:32},filters:e})},Vn=(t,e)=>{const{pubkey:r,parent:n}=Wn(t),i=Tn(r.toBase58());return Cn(i,je,e?n:void 0)},Hn=(t,e)=>{const r=Tn(t.toBase58());return Cn(r,je,e)},Gn=(t,e)=>{if(!t)throw new Pt(e)},qn=async(t,e)=>{const r=await ye(t,e),n=await Nn(t,r.map((t=>t.nameAccount)));return n.map(((t,e)=>({key:r[e].nameAccount,mint:r[e].nftMint,reverse:t}))).filter((t=>!!t.reverse))},$n=t=>{switch(Pn(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}};function Xn(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var Yn=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=o-1;(0!==f||h<i)&&-1!==d;d--,h++)f+=s*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,r++}for(var l=o-i;l!==o&&0===c[l];)l++;for(var p=new Uint8Array(n+(o-l)),y=n;l!==o;)p[y++]=c[l++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,l=u-1;(0!==h||d<n)&&-1!==l;l--,d++)h+=256*f[l]>>>0,f[l]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var y=a.repeat(r);p<u;++p)y+=t.charAt(f[p]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var Zn,Kn=Yn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Qn={exports:{}};Zn=Qn,function(t){const e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function u(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(o=t.indexOf(":",o+1))>=0;)i++;if("::"===t.substr(0,2)&&i--,"::"===t.substr(-2,2)&&i--,i>e)return null;for(n=e-i,r=":";n--;)r+="0:";return":"===(t=t.replace("::",r))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),e=function(){const e=t.split(":"),r=[];for(let t=0;t<e.length;t++)r.push(parseInt(e[t],16));return r}(),{parts:e,zoneId:s}}function c(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),t[o]>>i!=e[o]>>i)return!1;n-=r,o+=1}return!0}function f(t){if(i.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(n.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function h(t,e){for(;t.length<e;)t=`0${t}`;return t}const d={};d.IPv4=function(){function t(t){if(4!==t.length)throw new Error("ipaddr: ipv4 octet count should be 4");let e,r;for(e=0;e<t.length;e++)if(r=t[e],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=t}return t.prototype.SpecialRanges={unspecified:[[new t([0,0,0,0]),8]],broadcast:[[new t([255,255,255,255]),32]],multicast:[[new t([224,0,0,0]),4]],linkLocal:[[new t([169,254,0,0]),16]],loopback:[[new t([127,0,0,0]),8]],carrierGradeNat:[[new t([100,64,0,0]),10]],private:[[new t([10,0,0,0]),8],[new t([172,16,0,0]),12],[new t([192,168,0,0]),16]],reserved:[[new t([192,0,0,0]),24],[new t([192,0,2,0]),24],[new t([192,88,99,0]),24],[new t([198,18,0,0]),15],[new t([198,51,100,0]),24],[new t([203,0,113,0]),24],[new t([240,0,0,0]),4]]},t.prototype.kind=function(){return"ipv4"},t.prototype.match=function(t,e){let r;if(void 0===e&&(r=t,t=r[0],e=r[1]),"ipv4"!==t.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return c(this.octets,t.octets,8,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,i,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],e&&0!==o)return null;8!==o&&(e=!0),t+=o}return 32-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),d.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(t){return null!==this.parser(t)},d.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},d.IPv4.isValidFourPartDecimal=function(t){return!(!d.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(t){let e,r,n,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},d.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(t){let e,n,i;if(e=t.match(r.fourOctet))return function(){const t=e.slice(1,6),r=[];for(let e=0;e<t.length;e++)n=t[e],r.push(f(n));return r}();if(e=t.match(r.longValue)){if(i=f(e[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(i>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(i=f(t[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(i=f(t[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(i>>8&255),r.push(255&i),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r<n;)e[r]=255,r++;return n<4&&(e[n]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},d.IPv6=function(){function t(t,e){let r,n;if(16===t.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(t[r]<<8|t[r+1]);else{if(8!==t.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=t}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");e&&(this.zoneId=e)}return t.prototype.SpecialRanges={unspecified:[new t([0,0,0,0,0,0,0,0]),128],linkLocal:[new t([65152,0,0,0,0,0,0,0]),10],multicast:[new t([65280,0,0,0,0,0,0,0]),8],loopback:[new t([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new t([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new t([0,0,0,0,0,65535,0,0]),96],rfc6145:[new t([0,0,0,0,65535,0,0,0]),96],rfc6052:[new t([100,65435,0,0,0,0,0,0]),96],"6to4":[new t([8194,0,0,0,0,0,0,0]),16],teredo:[new t([8193,0,0,0,0,0,0,0]),32],reserved:[[new t([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new t([8193,2,0,0,0,0,0,0]),48],amt:[new t([8193,3,0,0,0,0,0,0]),32],as112v6:[new t([8193,4,274,0,0,0,0,0]),48],deprecated:[new t([8193,16,0,0,0,0,0,0]),28],orchid2:[new t([8193,32,0,0,0,0,0,0]),28]},t.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},t.prototype.kind=function(){return"ipv6"},t.prototype.match=function(t,e){let r;if(void 0===e&&(r=t,t=r[0],e=r[1]),"ipv6"!==t.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return c(this.parts,t.parts,16,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const r={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 n,i;for(let o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],e&&0!==i)return null;16!==i&&(e=!0),t+=i}return 128-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],r=this.parts;for(let n=0;n<r.length;n++)t=r[n],e.push(t>>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(h(this.parts[e].toString(16),4));return t}.call(this).join(":");let e="";return this.zoneId&&(e=`%${this.zoneId}`),t+e},t.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const t=this.parts.slice(-2),e=t[0],r=t[1];return new d.IPv4([e>>8,255&e,r>>8,255&r])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(this.parts[e].toString(16));return t}.call(this).join(":");let e="";return this.zoneId&&(e=`%${this.zoneId}`),t+e},t.prototype.toRFC5952String=function(){const t=/((^|:)(0(:|$)){2,})/g,e=this.toNormalizedString();let r,n=0,i=-1;for(;r=t.exec(e);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?e:`${e.substring(0,n)}::${e.substring(n+i)}`},t.prototype.toString=function(){return this.toRFC5952String()},t}(),d.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(t){return null!==this.parser(t)},d.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(t){return!1}},d.IPv6.networkAddressFromCIDR=function(t){let e,r,n,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},d.IPv6.parseCIDR=function(t){let e,r,n;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return n=[this.parse(r[1]),e],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(t){let e,r,n,i,o,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return u(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=u(n[1].slice(0,-1)+s,6),e.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return e.parts.push(o[0]<<8|o[1]),e.parts.push(o[2]<<8|o[3]),{parts:e.parts,zoneId:e.zoneId}}return null},d.IPv6.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r<n;)e[r]=255,r++;return n<16&&(e[n]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},d.fromByteArray=function(t){const e=t.length;if(4===e)return new d.IPv4(t);if(16===e)return new d.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},d.isValid=function(t){return d.IPv6.isValid(t)||d.IPv4.isValid(t)},d.parse=function(t){if(d.IPv6.isValid(t))return d.IPv6.parse(t);if(d.IPv4.isValid(t))return d.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},d.parseCIDR=function(t){try{return d.IPv6.parseCIDR(t)}catch(e){try{return d.IPv4.parseCIDR(t)}catch(t){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},d.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},d.subnetMatch=function(t,e,r){let n,i,o,s;for(i in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,i))for(o=e[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return i;return r},Zn.exports?Zn.exports=d:t.ipaddr=d}(i);var Jn=Qn.exports;const ti=2147483647,ei=36,ri={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ni=Math.floor,ii=String.fromCharCode;function oi(t){throw new RangeError(ri[t])}const si=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},ai=function(t,e,r){let n=0;for(t=r?ni(t/700):t>>1,t+=ni(t/e);t>455;n+=ei)t=ni(t/35);return ni(n+36*t/(t+38))},ui=function(t){const e=[],r=t.length;let n=0,i=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)t.charCodeAt(r)>=128&&oi("not-basic"),e.push(t.charCodeAt(r));for(let u=s>0?s+1:0;u<r;){const s=n;for(let e=1,i=ei;;i+=ei){u>=r&&oi("invalid-input");const s=(a=t.charCodeAt(u++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:ei;s>=ei&&oi("invalid-input"),s>ni((ti-n)/e)&&oi("overflow"),n+=s*e;const c=i<=o?1:i>=o+26?26:i-o;if(s<c)break;const f=ei-c;e>ni(ti/f)&&oi("overflow"),e*=f}const c=e.length+1;o=ai(n-s,c,0==s),ni(n/c)>ti-i&&oi("overflow"),i+=ni(n/c),n%=c,e.splice(n++,0,i)}var a;return String.fromCodePoint(...e)},ci=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const i=t.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&i)<<10)+(1023&n)+65536):(e.push(i),r--)}else e.push(i)}return e}(t);const r=t.length;let n=128,i=0,o=72;for(const r of t)r<128&&e.push(ii(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=ti;for(const e of t)e>=n&&e<r&&(r=e);const u=a+1;r-n>ni((ti-i)/u)&&oi("overflow"),i+=(r-n)*u,n=r;for(const r of t)if(r<n&&++i>ti&&oi("overflow"),r===n){let t=i;for(let r=ei;;r+=ei){const n=r<=o?1:r>=o+26?26:r-o;if(t<n)break;const i=t-n,s=ei-n;e.push(ii(si(n+i%s,0))),t=ni(i/s)}e.push(ii(si(t,0))),o=ai(i,u,a===s),i=0,++a}++i,++n}return e.join("")},fi=BigInt(2**32-1),hi=BigInt(32);function di(t,e=!1){return e?{h:Number(t&fi),l:Number(t>>hi&fi)}:{h:0|Number(t>>hi&fi),l:0|Number(t&fi)}}const li={fromBig:di,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=di(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<hi|BigInt(e>>>0),shrSH:(t,e,r)=>t>>>r,shrSL:(t,e,r)=>t<<32-r|e>>>r,rotrSH:(t,e,r)=>t>>>r|e<<32-r,rotrSL:(t,e,r)=>t<<32-r|e>>>r,rotrBH:(t,e,r)=>t<<64-r|e>>>r-32,rotrBL:(t,e,r)=>t>>>r-32|e<<64-r,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:(t,e,r)=>t<<r|e>>>32-r,rotlSL:(t,e,r)=>e<<r|t>>>32-r,rotlBH:(t,e,r)=>e<<r-32|t>>>64-r,rotlBL:(t,e,r)=>t<<r-32|e>>>64-r,add:function(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},add3L:(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),add3H:(t,e,r,n)=>e+r+n+(t/2**32|0)|0,add4L:(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),add4H:(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,add5H:(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,add5L:(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0)};var pi=li;const[yi,gi]=(()=>pi.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),wi=new Uint32Array(80),bi=new Uint32Array(80);class mi extends ke{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:f,Fl:h,Gh:d,Gl:l,Hh:p,Hl:y}=this;return[t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y]}set(t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)wi[r]=t.getUint32(e),bi[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|wi[t-15],r=0|bi[t-15],n=pi.rotrSH(e,r,1)^pi.rotrSH(e,r,8)^pi.shrSH(e,r,7),i=pi.rotrSL(e,r,1)^pi.rotrSL(e,r,8)^pi.shrSL(e,r,7),o=0|wi[t-2],s=0|bi[t-2],a=pi.rotrSH(o,s,19)^pi.rotrBH(o,s,61)^pi.shrSH(o,s,6),u=pi.rotrSL(o,s,19)^pi.rotrBL(o,s,61)^pi.shrSL(o,s,6),c=pi.add4L(i,u,bi[t-7],bi[t-16]),f=pi.add4H(c,n,a,wi[t-7],wi[t-16]);wi[t]=0|f,bi[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:f,El:h,Fh:d,Fl:l,Gh:p,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=pi.rotrSH(f,h,14)^pi.rotrSH(f,h,18)^pi.rotrBH(f,h,41),b=pi.rotrSL(f,h,14)^pi.rotrSL(f,h,18)^pi.rotrBL(f,h,41),m=f&d^~f&p,v=h&l^~h&y,E=pi.add5L(w,b,v,gi[t],bi[t]),A=pi.add5H(E,g,e,m,yi[t],wi[t]),B=0|E,I=pi.rotrSH(r,n,28)^pi.rotrBH(r,n,34)^pi.rotrBH(r,n,39),S=pi.rotrSL(r,n,28)^pi.rotrBL(r,n,34)^pi.rotrBL(r,n,39),x=r&i^r&s^i&s,k=n&o^n&a^o&a;g=0|p,w=0|y,p=0|d,y=0|l,d=0|f,l=0|h,({h:f,l:h}=pi.add(0|u,0|c,0|A,0|B)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const R=pi.add3L(B,S,k);r=pi.add3H(R,A,I,x),n=0|R}({h:r,l:n}=pi.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=pi.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=pi.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=pi.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l:h}=pi.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:l}=pi.add(0|this.Fh,0|this.Fl,0|d,0|l)),({h:p,l:y}=pi.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:w}=pi.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,i,o,s,a,u,c,f,h,d,l,p,y,g,w)}roundClean(){wi.fill(0),bi.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const vi=xe((()=>new mi));
12
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const Ei=BigInt(1),Ai=BigInt(2);function Bi(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Ii=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Si(t){if(!Bi(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Ii[t[r]];return e}function xi(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const ki={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Ri(t){return t>=ki._0&&t<=ki._9?t-ki._0:t>=ki._A&&t<=ki._F?t-(ki._A-10):t>=ki._a&&t<=ki._f?t-(ki._a-10):void 0}function _i(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){const r=Ri(t.charCodeAt(i)),o=Ri(t.charCodeAt(i+1));if(void 0===r||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}n[e]=16*r+o}return n}function Ui(t){if(!Bi(t))throw new Error("Uint8Array expected");return xi(Si(Uint8Array.from(t).reverse()))}function Li(t,e){return _i(t.toString(16).padStart(2*e,"0"))}function Pi(t,e){return Li(t,e).reverse()}function Ti(t,e,r){let n;if("string"==typeof e)try{n=_i(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!Bi(e))throw new Error(`${t} must be hex string or Uint8Array`);n=Uint8Array.from(e)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function Ci(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!Bi(n))throw new Error("Uint8Array expected");e+=n.length}let r=new Uint8Array(e),n=0;for(let e=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}const Oi=t=>(Ai<<BigInt(t-1))-Ei,Ni={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||Bi(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function Di(t,e,r={}){const n=(e,r,n)=>{const i=Ni[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=t[e];if(!(n&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${r}`)};for(const[t,r]of Object.entries(e))n(t,r,!1);for(const[t,e]of Object.entries(r))n(t,e,!0);return t}
13
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mi=BigInt(0),Wi=BigInt(1),zi=BigInt(2),ji=BigInt(3),Fi=BigInt(4),Vi=BigInt(5),Hi=BigInt(8);function Gi(t,e){const r=t%e;return r>=Mi?r:e+r}function qi(t,e,r){if(r<=Mi||e<Mi)throw new Error("Expected power/modulo > 0");if(r===Wi)return Mi;let n=Wi;for(;e>Mi;)e&Wi&&(n=n*t%r),t=t*t%r,e>>=Wi;return n}function $i(t,e,r){let n=t;for(;e-- >Mi;)n*=n,n%=r;return n}function Xi(t,e){if(t===Mi||e<=Mi)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Gi(t,e),n=e,i=Mi,o=Wi;for(;r!==Mi;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==Wi)throw new Error("invert: does not exist");return Gi(i,e)}function Yi(t){if(t%Fi===ji){const e=(t+Wi)/Fi;return function(t,r){const n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw new Error("Cannot find square root");return n}}if(t%Hi===Vi){const e=(t-Vi)/Hi;return function(t,r){const n=t.mul(r,zi),i=t.pow(n,e),o=t.mul(r,i),s=t.mul(t.mul(o,zi),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-Wi)/zi;let r,n,i;for(r=t-Wi,n=0;r%zi===Mi;r/=zi,n++);for(i=zi;i<t&&qi(i,e,t)!==t-Wi;i++);if(1===n){const e=(t+Wi)/Fi;return function(t,r){const n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw new Error("Cannot find square root");return n}}const o=(r+Wi)/zi;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=n,u=t.pow(t.mul(t.ONE,i),r),c=t.pow(s,o),f=t.pow(s,r);for(;!t.eql(f,t.ONE);){if(t.eql(f,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(f);e<a&&!t.eql(r,t.ONE);e++)r=t.sqr(r);const r=t.pow(u,Wi<<BigInt(a-e-1));u=t.sqr(r),c=t.mul(c,r),f=t.mul(f,u),a=e}return c}}(t)}BigInt(9),BigInt(16);const Zi=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ki(t,e){const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}
10
+ !function(t){const e=a,r=y,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|p(t,e);let n=o(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);const i=function(t){if(s.isBuffer(t)){const e=0|l(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?o(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return c(t),o(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(t,o+n)!==c(e,n)){r=!1;break}if(r)return o}return-1}function v(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(Z(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return X(q(e,t.length-r),t,r,n)}function A(t,e,r,n){return X(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function B(t,e,r,n){return X($(e),t,r,n)}function I(t,e,r,n){return X(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function x(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),s.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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},s.allocUnsafe=function(t){return f(t)},s.allocUnsafeSlow=function(t){return f(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))i+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)w(this,e,e+1);return this},s.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},s.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):g.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const u=Math.min(o,a),c=this.slice(n,i),f=t.slice(e,r);for(let t=0;t<u;++t)if(c[t]!==f[t]){o=c[t],a=f[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function _(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function U(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=K[t[n]];return i}function L(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,i){V(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function O(t,e,r,n,i){V(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function W(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return W(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return W(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=s.isBuffer(t)?t:s.from(t,n),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%a]}return this};const z={};function M(t,e,r){z[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function j(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function V(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(n,i,o)}function F(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}M("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),M("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),M("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(s);const g=new t("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const w=new t("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t("So11111111111111111111111111111111111111112"),new t("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.s16=b.s8=b.nu64be=b.u48be=b.u40be=b.u32be=b.u24be=b.u16be=b.nu64=b.u48=b.u40=nt=b.u32=b.u24=b.u16=rt=b.u8=b.offset=b.greedy=b.Constant=b.UTF8=b.CString=b.Blob=b.Boolean=b.BitField=b.BitStructure=b.VariantLayout=b.Union=b.UnionLayoutDiscriminator=b.UnionDiscriminator=b.Structure=b.Sequence=b.DoubleBE=b.Double=b.FloatBE=b.Float=b.NearInt64BE=b.NearInt64=b.NearUInt64BE=b.NearUInt64=b.IntBE=b.Int=b.UIntBE=b.UInt=b.OffsetLayout=b.GreedyCount=b.ExternalLayout=b.bindConstructorLayout=b.nameWithProperty=b.Layout=b.uint8ArrayToBuffer=b.checkUint8Array=void 0,b.constant=b.utf8=b.cstr=ot=b.blob=b.unionLayoutDiscriminator=b.union=b.seq=b.bits=it=b.struct=b.f64be=b.f64=b.f32be=b.f32=b.ns64be=b.s48be=b.s40be=b.s32be=b.s24be=b.s16be=b.ns64=b.s48=b.s40=b.s32=b.s24=void 0;const m=s;function v(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function E(t){return v(t),m.Buffer.from(t.buffer,t.byteOffset,t.length)}b.checkUint8Array=v,b.uint8ArrayToBuffer=E;class A{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function B(t,e){return e.property?t+"["+e.property+"]":t}b.Layout=A,b.nameWithProperty=B,b.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof A))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,r)=>e.decode(t,r),writable:!0})};class I extends A{isCount(){throw new Error("ExternalLayout is abstract")}}b.ExternalLayout=I;class S extends I{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){v(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}b.GreedyCount=S;class x extends I{constructor(t,e=0,r){if(!(t instanceof A))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof k||this.layout instanceof R}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}b.OffsetLayout=x;class k extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntLE(t,r,this.span),this.span}}b.UInt=k;class R extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readUIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeUIntBE(t,r,this.span),this.span}}b.UIntBE=R;class _ extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntLE(e,this.span)}encode(t,e,r=0){return E(e).writeIntLE(t,r,this.span),this.span}}b.Int=_;class U extends A{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return E(t).readIntBE(e,this.span)}encode(t,e,r=0){return E(e).writeIntBE(t,r,this.span),this.span}}b.IntBE=U;const L=Math.pow(2,32);function P(t){const e=Math.floor(t/L);return{hi32:e,lo32:t-e*L}}function T(t,e){return t*L+e}class C extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}b.NearUInt64=C;class O extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearUInt64BE=O;class N extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}b.NearInt64=N;class D extends A{constructor(t){super(8,t)}decode(t,e=0){const r=E(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=P(t),i=E(e);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}b.NearInt64BE=D;class W extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatLE(e)}encode(t,e,r=0){return E(e).writeFloatLE(t,r),4}}b.Float=W;class z extends A{constructor(t){super(4,t)}decode(t,e=0){return E(t).readFloatBE(e)}encode(t,e,r=0){return E(e).writeFloatBE(t,r),4}}b.FloatBE=z;class M extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleLE(e)}encode(t,e,r=0){return E(e).writeDoubleLE(t,r),8}}b.Double=M;class j extends A{constructor(t){super(8,t)}decode(t,e=0){return E(t).readDoubleBE(e)}encode(t,e,r=0){return E(e).writeDoubleBE(t,r),8}}b.DoubleBE=j;class V extends A{constructor(t,e,r){if(!(t instanceof A))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof I&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(e instanceof I)&&0<t.span&&(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof I&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t,e=0){const r=[];let n=0,i=this.count;for(i instanceof I&&(i=i.decode(t,e));n<i;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e,r=0){const n=this.elementLayout,i=t.reduce(((t,i)=>t+n.encode(i,e,r+t)),0);return this.count instanceof I&&this.count.encode(t.length,e,r),i}}b.Sequence=V;class F extends A{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof A),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===r&&(r=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const i=n.getSpan(t,e);return e+=i,r+i}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){v(t);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const n=r;let i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-n}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}b.Structure=F;class H{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}b.UnionDiscriminator=H;class G extends H{constructor(t,e){if(!(t instanceof I&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}b.UnionLayoutDiscriminator=G;class q extends A{constructor(t,e,r){let n;if(t instanceof k||t instanceof R)n=new G(new x(t));else if(t instanceof I&&t.isCount())n=new G(t);else{if(!(t instanceof H))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=t}if(void 0===e&&(e=null),!(null===e||e instanceof A))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof k||t instanceof R)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof k||t instanceof R,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r;const n=this.discriminator,i=n.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=i,r[o.property]=o.decode(t,e+s)}else r=o.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(t[n.property],e,r),o+i.encode(t[i.property],e,r+o)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new $(this,t,e,r);return this.registry[t]=n,n}getVariant(t,e=0){let r;return r=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[r]}}b.Union=q;class $ extends A{constructor(t,e,r,n){if(!(t instanceof q))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof A))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof n)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=r?r.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,n),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(t,e+r)),r+n}decode(t,e=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let i=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),i+=this.layout.getSpan(e,r+n),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function X(t){return 0>t&&(t+=4294967296),t}b.VariantLayout=$;class Y extends A{constructor(t,e,r){if(!(t instanceof k||t instanceof R))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let n=0;this._packedSetValue=function(t){return n=X(t),this},this._packedGetValue=function(){return n}}decode(t,e=0){const r=this.makeDestinationObject(),n=this.word.decode(t,e);this._packedSetValue(n);for(const e of this.fields)void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){const n=this.word.decode(e,r);this._packedSetValue(n);for(const e of this.fields)if(void 0!==e.property){const r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){const r=new Z(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new K(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}b.BitStructure=Y;class Z{constructor(t,e,r){if(!(t instanceof Y))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const n=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>n)throw new Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-e),this.wordMask=X(this.valueMask<<this.start),this.property=r}decode(t,e){return X(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==X(t&this.valueMask))throw new TypeError(B("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=X(t<<this.start);this.container._packedSetValue(X(e&~this.wordMask)|r)}}b.BitField=Z;class K extends Z{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t=+t),super.encode(t)}}b.Boolean=K;class Q extends A{constructor(t,e){if(!(t instanceof I&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof I||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),E(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof I&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(B("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=E(t);return E(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof I&&this.length.encode(n,e,r),n}}b.Blob=Q;class J extends A{constructor(t){super(-1,t)}getSpan(t,e=0){v(t);let r=e;for(;r<t.length&&0!==t[r];)r+=1;return 1+r-e}decode(t,e=0){const r=this.getSpan(t,e);return E(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(r+i>e.length)throw new RangeError("encoding overruns Buffer");const o=E(e);return n.copy(o,r),o[r+i]=0,i+1}}b.CString=J;class tt extends A{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return v(t),t.length-e}decode(t,e=0){const r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return E(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=m.Buffer.from(t,"utf8"),i=n.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(r+i>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(E(e),r),i}}b.UTF8=tt;class et extends A{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}b.Constant=et,b.greedy=(t,e)=>new S(t,e),b.offset=(t,e,r)=>new x(t,e,r);var rt=b.u8=t=>new k(1,t);b.u16=t=>new k(2,t),b.u24=t=>new k(3,t);var nt=b.u32=t=>new k(4,t);b.u40=t=>new k(5,t),b.u48=t=>new k(6,t),b.nu64=t=>new C(t),b.u16be=t=>new R(2,t),b.u24be=t=>new R(3,t),b.u32be=t=>new R(4,t),b.u40be=t=>new R(5,t),b.u48be=t=>new R(6,t),b.nu64be=t=>new O(t),b.s8=t=>new _(1,t),b.s16=t=>new _(2,t),b.s24=t=>new _(3,t),b.s32=t=>new _(4,t),b.s40=t=>new _(5,t),b.s48=t=>new _(6,t),b.ns64=t=>new N(t),b.s16be=t=>new U(2,t),b.s24be=t=>new U(3,t),b.s32be=t=>new U(4,t),b.s40be=t=>new U(5,t),b.s48be=t=>new U(6,t),b.ns64be=t=>new D(t),b.f32=t=>new W(t),b.f32be=t=>new z(t),b.f64=t=>new M(t),b.f64be=t=>new j(t);var it=b.struct=(t,e,r)=>new F(t,e,r);b.bits=(t,e,r)=>new Y(t,e,r),b.seq=(t,e,r)=>new V(t,e,r),b.union=(t,e,r)=>new q(t,e,r),b.unionLayoutDiscriminator=(t,e)=>new G(t,e);var ot=b.blob=(t,e)=>new Q(t,e);b.cstr=t=>new J(t),b.utf8=(t,e)=>new tt(t,e),b.constant=(t,e)=>new et(t,e);const st=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var at={};Object.defineProperty(at,"__esModule",{value:!0});var ut=at.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};at.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var ct=at.toBufferLE=function(t,e){{const r=t.toString(16),n=Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};at.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const ft=(ht=8,t=>{const e=ot(ht,t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>{const r=n(t,e);return ut(Buffer.from(r))},i.encode=(t,e,n)=>{const i=ct(t,ht);return r(i,e,n)},i});var ht;const dt=t=>{const e=rt(t),{encode:r,decode:n}=st(e),i=e;return i.decode=(t,e)=>!!n(t,e),i.encode=(t,e,n)=>{const i=Number(t);return r(i,e,n)},i},lt=e=>{const r=ot(32,e),{encode:n,decode:i}=st(r),o=r;return o.decode=(e,r)=>{const n=i(e,r);return new t(n)},o.encode=(t,e,r)=>{const i=t.toBuffer();return n(i,e,r)},o};class pt extends Error{constructor(t){super(t)}}class yt extends pt{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class gt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class wt extends pt{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class bt extends pt{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class mt extends pt{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(vt||(vt={}));const Et=1,At=it([rt("m"),rt("n"),dt("isInitialized"),lt("signer1"),lt("signer2"),lt("signer3"),lt("signer4"),lt("signer5"),lt("signer6"),lt("signer7"),lt("signer8"),lt("signer9"),lt("signer10"),lt("signer11")]).span;var Bt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(Bt||(Bt={}));const It=it([lt("mint"),lt("owner"),ft("amount"),nt("delegateOption"),lt("delegate"),rt("state"),nt("isNativeOption"),ft("isNative"),ft("delegatedAmount"),nt("closeAuthorityOption"),lt("closeAuthority")]),St=It.span,xt=it([nt("mintAuthorityOption"),lt("mintAuthority"),ft("supply"),rt("decimals"),dt("isInitialized"),nt("freezeAuthorityOption"),lt("freezeAuthority")]),kt=xt.span;async function Rt(t,e,r,n=g){return function(t,e,r=g){if(!e)throw new yt;if(!e.owner.equals(r))throw new gt;if(e.data.length<kt)throw new wt;const n=xt.decode(e.data.slice(0,kt));let i=Buffer.alloc(0);if(e.data.length>kt){if(e.data.length<=St)throw new wt;if(e.data.length===At)throw new wt;if(e.data[St]!=vt.Mint)throw new bt;i=e.data.slice(St+Et)}return{address:t,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:i}}(e,await t.getAccountInfo(e,r),n)}function _t(e,r,n=!1,i=g,o=w){if(!n&&!t.isOnCurve(r.toBuffer()))throw new mt;const[s]=t.findProgramAddressSync([r.toBuffer(),i.toBuffer(),e.toBuffer()],o);return s}function Ut(t,n,i,o,s=g,a=w){return function(t,n,i,o,s,a=g,u=w){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}];return new r({keys:c,programId:u,data:s})}(t,n,i,o,Buffer.from([1]),s,a)}var Lt;!function(t){t.SymbolNotFound="SymbolNotFound",t.InvalidSubdomain="InvalidSubdomain",t.FavouriteDomainNotFound="FavouriteDomainNotFound",t.MissingParentOwner="MissingParentOwner",t.U32Overflow="U32Overflow",t.InvalidBufferLength="InvalidBufferLength",t.U64Overflow="U64Overflow",t.NoRecordData="NoRecordData",t.InvalidRecordData="InvalidRecordData",t.UnsupportedRecord="UnsupportedRecord",t.InvalidEvmAddress="InvalidEvmAddress",t.InvalidInjectiveAddress="InvalidInjectiveAddress",t.InvalidARecord="InvalidARecord",t.InvalidAAAARecord="InvalidAAAARecord",t.InvalidRecordInput="InvalidRecordInput",t.InvalidSignature="InvalidSignature",t.AccountDoesNotExist="AccountDoesNotExist",t.MultipleRegistries="MultipleRegistries",t.InvalidReverseTwitter="InvalidReverseTwitter",t.NoAccountData="NoAccountData",t.InvalidInput="InvalidInput",t.InvalidDomain="InvalidDomain",t.InvalidCustomBg="InvalidCustomBackground",t.UnsupportedSignature="UnsupportedSignature",t.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",t.RecordIsNotSigned="RecordIsNotSigned",t.UnsupportedSignatureType="UnsupportedSignatureType",t.InvalidSolRecordV2="InvalidSolRecordV2",t.MissingVerifier="MissingVerifier",t.PythFeedNotFound="PythFeedNotFound"}(Lt||(Lt={}));class Pt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,Pt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new Pt(Lt.InvalidBufferLength,`Invalid buffer length: ${t.length}`);const e=BigInt(t.readUInt32LE(0));return new Tt(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}class Ct{constructor(t){this.value=BigInt(t)}toBuffer(){const t=s.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new Pt(Lt.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new Ct(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ot,Nt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Dt=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),Wt=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),i=this.view[n](this.offset,!0);return this.offset+=r,i},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),zt=(Ot=function(t,e){return Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Ot(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Ot(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Mt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function jt(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var Vt=Nt.concat(["bool","string"]),Ft=["option","enum","array","set","map","struct"],Ht=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return zt(e,t),e}(Error);function Gt(t){if("string"!=typeof t||!Vt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Ft.includes(e[0])){var r=e[0];if("option"===r)return Gt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Ht(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');Gt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Gt(t.type);throw new Ht(t,"{ type, len? }")}(t[r]);if("set"===r)return Gt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Ht(t,"{ key, value }");Gt(t.key),Gt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Ht(t,"object");for(var e in t)Gt(t[e])}(t[r])}}throw new Ht(t,Ft.join(", ")+" or "+Vt.join(", "))}}var qt=function(){function t(t){this.encoded=new Dt,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(Nt.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&Mt(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Mt(t,"string",this.fieldPath);for(var e=t,r=[],n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?r.push(i):i<2048?r.push(192|i>>6,128|63&i):i<55296||i>=57344?r.push(224|i>>12,128|i>>6&63,128|63&i):(n++,i=65536+((1023&i)<<10|1023&e.charCodeAt(n)),r.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}this.encoded.store_value(r.length,"u32"),this.encoded.store_bytes(new Uint8Array(r))},t.prototype.encode_boolean=function(t){this.checkTypes&&Mt(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?jt(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?jt(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&Mt(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Mt(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var i=0,o=n;i<o.length;i++){var s=o[i];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&Mt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),$t=function(){function t(t){this.buffer=new Wt(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Nt.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},t.prototype.decode_string=function(){for(var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t)),r=[],n=0;n<t;++n){var i=e[n];if(i<128)r.push(i);else if(i<224)r.push((31&i)<<6|63&e[++n]);else if(i<240)r.push((15&i)<<12|(63&e[++n])<<6|63&e[++n]);else{var o=(7&i)<<18|(63&e[++n])<<12|(63&e[++n])<<6|63&e[++n];r.push(o)}}return String.fromCodePoint.apply(String,r)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function Xt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new qt(r).encode(e,t)}function Yt(t,e,r){return void 0===r&&(r=!0),r&&Gt(t),new $t(e).decode(t)}function Zt(e,n,i,o,a,u,c,f,h,d,l){const p=[s.Buffer.from(Int8Array.from([0])),new Tt(u.length).toBuffer(),u,c.toBuffer(),f.toBuffer()],y=s.Buffer.concat(p),g=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1}];return h?g.push({pubkey:h,isSigner:!0,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d?g.push({pubkey:d,isSigner:!1,isWritable:!1}):g.push({pubkey:new t(s.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),l&&g.push({pubkey:l,isSigner:!0,isWritable:!1}),new r({keys:g,programId:e,data:y})}function Kt(t,e,n,i,o){const a=[s.Buffer.from(Int8Array.from([1])),n.toBuffer(),new Tt(i.length).toBuffer(),i],u=s.Buffer.concat(a);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:u})}function Qt(e,n,i,o,a,u,c){const f=[s.Buffer.from(Int8Array.from([2])),i.toBuffer()],h=s.Buffer.concat(f),d=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:c||o,isSigner:!0,isWritable:!1}];return a&&d.push({pubkey:a,isSigner:!0,isWritable:!1}),c&&u&&(a||d.push({pubkey:t.default,isSigner:!1,isWritable:!1}),d.push({pubkey:u,isSigner:!1,isWritable:!1})),new r({keys:d,programId:e,data:h})}function Jt(t,e,n,i){const o=[s.Buffer.from(Int8Array.from([3]))],a=s.Buffer.concat(o);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!0}],programId:t,data:a})}class te{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Xt(te.schema,this)}getInstruction(t,n,i,o,a,u,c,f,h,d,l){const p=s.Buffer.from(this.serialize()),y=[{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!0},{pubkey:e.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:f,isSigner:!0,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:g,isSigner:!1,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!1}];return new r({keys:y,programId:t,data:p})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(t){this.tag=12,this.name=t.name}serialize(){return Xt(ee.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!1}),l.push({pubkey:a,isSigner:!1,isWritable:!1}),l.push({pubkey:u,isSigner:!0,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),f&&l.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&l.push({pubkey:h,isSigner:!0,isWritable:!0}),new r({keys:l,programId:t,data:d})}}ee.schema={struct:{tag:"u8",name:"string"}};class re{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Xt(re.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!1}),v.push({pubkey:d,isSigner:!1,isWritable:!1}),v.push({pubkey:l,isSigner:!1,isWritable:!1}),v.push({pubkey:p,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),b&&v.push({pubkey:b,isSigner:!1,isWritable:!0}),new r({keys:v,programId:t,data:m})}}re.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class ne{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Xt(ne.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h,d,l,p,y,g,w,b){const m=s.Buffer.from(this.serialize());let v=[];return v.push({pubkey:e,isSigner:!1,isWritable:!1}),v.push({pubkey:n,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:o,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:u,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!0,isWritable:!0}),v.push({pubkey:f,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey:p,isSigner:!1,isWritable:!0}),v.push({pubkey:y,isSigner:!1,isWritable:!1}),v.push({pubkey:g,isSigner:!1,isWritable:!1}),v.push({pubkey:w,isSigner:!1,isWritable:!1}),v.push({pubkey:b,isSigner:!1,isWritable:!1}),new r({keys:v,programId:t,data:m})}}ne.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ie{constructor(){this.tag=16}serialize(){return Xt(ie.schema,this)}getInstruction(t,e,n,i,o,a,u,c,f,h){const d=s.Buffer.from(this.serialize());let l=[];return l.push({pubkey:e,isSigner:!1,isWritable:!1}),l.push({pubkey:n,isSigner:!1,isWritable:!1}),l.push({pubkey:i,isSigner:!1,isWritable:!0}),l.push({pubkey:o,isSigner:!1,isWritable:!0}),l.push({pubkey:a,isSigner:!1,isWritable:!0}),l.push({pubkey:u,isSigner:!1,isWritable:!0}),l.push({pubkey:c,isSigner:!1,isWritable:!1}),l.push({pubkey:f,isSigner:!0,isWritable:!1}),l.push({pubkey:h,isSigner:!1,isWritable:!0}),new r({keys:l,programId:t,data:d})}}function oe(t,e,n,i,o,a){const u=[s.Buffer.from(Int8Array.from([4])),a.toBuffer()],c=s.Buffer.concat(u);return new r({keys:[{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1}],programId:t,data:c})}ie.schema={struct:{tag:"u8"}};class se{constructor(){this.tag=6}serialize(){return Xt(se.schema,this)}getInstruction(t,e,n,i,o){const a=s.Buffer.from(this.serialize());let u=[];return u.push({pubkey:e,isSigner:!1,isWritable:!1}),u.push({pubkey:n,isSigner:!1,isWritable:!0}),u.push({pubkey:i,isSigner:!0,isWritable:!0}),u.push({pubkey:o,isSigner:!1,isWritable:!1}),new r({keys:u,programId:t,data:a})}}se.schema={struct:{tag:"u8"}};const ae=new t("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ue=s.Buffer.from("tokenized_name"),ce=e=>{const[r]=t.findProgramAddressSync([ue,e.toBuffer()],ae);return r};var fe;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(fe||(fe={}));class he{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t(e.nameAccount),this.owner=new t(e.owner),this.nftMint=new t(e.nftMint)}static deserialize(t){return new he(Yt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("NFT record not found");return this.deserialize(r.data)}static async findKey(e,r){return await t.findProgramAddress([s.Buffer.from("nft_record"),e.toBuffer()],r)}}he.schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};const de=async(e,r)=>{try{const n=ce(r);if("0"===(await Rt(e,n)).supply.toString())return;const i=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],o=await e.getProgramAccounts(g,{filters:i});if(1!=o.length)return;return new t(o[0].account.data.slice(32,64))}catch{return}},le=async e=>{const r=await e.getProgramAccounts(ae,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t(e.account.data.slice(66,98))))},pe=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ye=async(t,e)=>{const r=await(async(t,e)=>{const r=[{memcmp:{offset:0,bytes:"3"}},{memcmp:{offset:66,bytes:e.toBase58()}}];return await t.getProgramAccounts(ae,{filters:r})})(t,e.mint);if(1===r.length)return he.deserialize(r[0].account.data)},ge=async(t,e)=>{const r=[...pe(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(g,{filters:r})).map((t=>It.decode(t.account.data))).map((e=>ye(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class we{constructor(e){this.parentName=new t(e.parentName),this.owner=new t(e.owner),this.class=new t(e.class)}static deserialize(t){const e=new we(Yt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e}static async retrieve(t,e){var r;const n=await t.getAccountInfo(e);if(!n)throw new Pt(Lt.AccountDoesNotExist);const i=new we(Yt(this.schema,n.data));i.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:i,nftOwner:await de(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new we(Yt(this.schema,t));return e.data=null==t?void 0:t.slice(this.HEADER_LEN),e};return r.map((t=>n(null==t?void 0:t.data)))}static async retrieveBatch(t,e){let r=[];const n=[...e];for(;n.length>0;)r.push(...await this._retrieveBatch(t,n.splice(0,100)));return r}}function be(t,...e){if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function me(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}we.HEADER_LEN=96,we.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const ve="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
11
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ee(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Ae=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Be=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Ie(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function Se(t){if("string"==typeof t&&(t=Ie(t)),!Ee(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class xe{clone(){return this._cloneInto()}}function ke(t){const e=e=>t().update(Se(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class Re extends xe{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Ae(this.buffer)}update(t){me(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=Se(t)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=Ae(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){me(this),function(t,e){be(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Ae(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,c[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const _e=(t,e,r)=>t&e^~t&r,Ue=(t,e,r)=>t&e^t&r^e&r,Le=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Pe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=new Uint32Array(64);class Ce extends Re{constructor(){super(64,32,8,!1),this.A=0|Pe[0],this.B=0|Pe[1],this.C=0|Pe[2],this.D=0|Pe[3],this.E=0|Pe[4],this.F=0|Pe[5],this.G=0|Pe[6],this.H=0|Pe[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Te[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Te[t-15],r=Te[t-2],n=Be(e,7)^Be(e,18)^e>>>3,i=Be(r,17)^Be(r,19)^r>>>10;Te[t]=i+Te[t-7]+n+Te[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(Be(s,6)^Be(s,11)^Be(s,25))+_e(s,a,u)+Le[t]+Te[t]|0,f=(Be(r,2)^Be(r,13)^Be(r,22))+Ue(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Oe=ke((()=>new Ce)),Ne=new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),De="SPL Name Service",We=new t("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),ze=new t("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Me=new t("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),je=new t("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Ve=new t("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Fe=new t("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),He=new t("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ge=96,qe=new t("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),$e=new t("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Xe=[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new t("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new t("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new t("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ"),new t("XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL")],Ye=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ze=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",{price:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",product:"8GWTTbNiXdmyZREXbjsZBmCRuzdPrW55dnZGDkTRjWvb"}],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",{price:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",product:"Av6XyAMJnyi68FdsKSPYgzfXGjYrrt6jcAMwtvzLCqaM"}],["So11111111111111111111111111111111111111112",{price:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",product:"ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",product:"HyEB4Goiv7QyfFStaBn49JqQzSTV1ybtVikwsMLH1f2M"}],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",{price:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",product:"BS2iAqT67j8hA9Jji4B8UpL3Nfw9kwPfU5s4qeaf1e7r"}],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",{price:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",product:"FerFD54J6RgmQVCR5oNgpzXmz8BW2eBNhhirb1d5oifo"}],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",{price:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",product:"8xTEctXKo6Xo3EzNhSNp4TUe8mgfwWFbDUXJhuubvrKx"}],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",{price:"nrYkQQQur7z8rYTST3G9GqATviK5SxTDkrqd21MW6Ue",product:"AiQB4WngNPKDe3iWAwZmMzbULDAAfUD6Sr1knfZNJj3y"}],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",{price:"AFrYBhb5wKQtxRS9UA9YRS4V3dwFm7SqmS6DHKq6YVgo",product:"3RtUHQR2LQ7su5R4zWwjupx72sWRGvLA4cFmnbHnT9M7"}],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",{price:"9EdtbaivHQYA4Nh3XzGR6DwRaoorqXYnmpfsnFhvwuVj",product:"5Q5kyCVzssrGMd2BniSdVeRwjNWrGGrFhMrgGt4zURyA"}]]),Ke=new t("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),Qe=new t("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Je=new t("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),tr=new t("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),er=new t("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),rr=new t("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function nr(t,e){if(!await t.getAccountInfo(e))throw new Pt(Lt.AccountDoesNotExist);return we.retrieve(t,e)}async function ir(t){const e=De+t,r=Oe(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)}async function or(e,r,n){const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=await t.findProgramAddress(i,Ne);return o}async function sr(t,e){const r=await ir(e.toBase58()),n=await or(r,Ve),{registry:i}=await we.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);const o=i.data.slice(0,4).readUInt32LE(0);return i.data.slice(4,4+o).toString()}async function ar(t,e){let r=[];for(let t of e){const e=await ir(t.toBase58()),n=await or(e,Ve);r.push(n)}return(await we.retrieveBatch(t,r)).map((t=>{if(void 0===t||void 0===t.data)return;const e=t.data.slice(0,4).readUInt32LE(0);return t.data.slice(4,4+e).toString()}))}const ur=async(t,e=We)=>{let r=await ir(t);return{pubkey:await or(r,void 0,e),hashed:r}},cr=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=s.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:n}=await ur(r[1]);return{...await ur(t,n),isSub:!0,parent:n}}if(3===r.length&&e){const{pubkey:t}=await ur(r[2]),{pubkey:e}=await ur("\0".concat(r[1]),t),n=s.Buffer.from([1]).toString();return{...await ur(n.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new Pt(Lt.InvalidInput);return{...await ur(t,We),isSub:!1,parent:void 0}},fr=async(t,e)=>{const{pubkey:r,parent:n}=await cr(t),i=await ir(r.toBase58());return await or(i,Ve,e?n:void 0)};var hr,dr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],lr=function(){function t(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return t.prototype.resize_if_necessary=function(t){if(this.buffer_size-this.offset<t){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+t);var e=new ArrayBuffer(this.buffer_size);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}},t.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},t.prototype.store_value=function(t,e){var r=e.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var i="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[i](this.offset,t,!0),this.offset+=n},t.prototype.store_bytes=function(t){this.resize_if_necessary(t.length),new Uint8Array(this.buffer).set(new Uint8Array(t),this.offset),this.offset+=t.length},t}(),pr=function(){function t(t){this.offset=0,this.buffer_size=t.length,this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t),this.view=new DataView(this.buffer)}return t.prototype.assert_enough_buffer=function(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},t.prototype.consume_value=function(t){var e=t.substring(1),r=parseInt(e)/8;this.assert_enough_buffer(r);var n="f"===t[0]?"getFloat".concat(e):"i"===t[0]?"getInt".concat(e):"getUint".concat(e),i=this.view[n](this.offset,!0);return this.offset+=r,i},t.prototype.consume_bytes=function(t){this.assert_enough_buffer(t);var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},t}(),yr=(hr=function(t,e){return hr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},hr(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}hr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function gr(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function wr(t,e,r){if(t!==e)throw new Error("Array length ".concat(t," does not match schema length ").concat(e," at ").concat(r.join(".")))}var br=dr.concat(["bool","string"]),mr=["option","enum","array","set","map","struct"],vr=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return yr(e,t),e}(Error);function Er(t){if("string"!=typeof t||!br.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&mr.includes(e[0])){var r=e[0];if("option"===r)return Er(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new vr(t,"Array");for(var e=0,r=t;e<r.length;e++){var n=r[e];if("object"!=typeof n||!("struct"in n))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof n.struct||1!==Object.keys(n.struct).length)throw new Error('The "struct" in each enum must have a single key');Er({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new vr(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return Er(t.type);throw new vr(t,"{ type, len? }")}(t[r]);if("set"===r)return Er(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new vr(t,"{ key, value }");Er(t.key),Er(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new vr(t,"object");for(var e in t)Er(t[e])}(t[r])}}throw new vr(t,mr.join(", ")+" or "+br.join(", "))}}var Ar=function(){function t(t){this.encoded=new lr,this.fieldPath=["value"],this.checkTypes=t}return t.prototype.encode=function(t,e){return this.encode_value(t,e),this.encoded.get_used_buffer()},t.prototype.encode_value=function(t,e){if("string"==typeof e){if(dr.includes(e))return this.encode_integer(t,e);if("string"===e)return this.encode_string(t);if("bool"===e)return this.encode_boolean(t)}if("object"==typeof e){if("option"in e)return this.encode_option(t,e);if("enum"in e)return this.encode_enum(t,e);if("array"in e)return this.encode_array(t,e);if("set"in e)return this.encode_set(t,e);if("map"in e)return this.encode_map(t,e);if("struct"in e)return this.encode_struct(t,e)}},t.prototype.encode_integer=function(t,e){var r=parseInt(e.substring(1));r<=32||"f64"==e?(this.checkTypes&&gr(t,"number",this.fieldPath),this.encoded.store_value(t,e)):(this.checkTypes&&function(t,e){if(!(["number","string","bigint","boolean"].includes(typeof t)||"object"==typeof t&&null!==t&&"toString"in t))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath),this.encode_bigint(BigInt(t),r))},t.prototype.encode_bigint=function(t,e){for(var r=e/8,n=new Uint8Array(r),i=0;i<r;i++)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&gr(t,"string",this.fieldPath);var e=t;this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encoded.store_value(e.charCodeAt(r),"u8")},t.prototype.encode_boolean=function(t){this.checkTypes&&gr(t,"boolean",this.fieldPath),this.encoded.store_value(t?1:0,"u8")},t.prototype.encode_option=function(t,e){null==t?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(t,e.option))},t.prototype.encode_enum=function(t,e){this.checkTypes&&function(t,e){if("object"!=typeof t||null===t)throw new Error("Expected object not ".concat(typeof t,"(").concat(t,") at ").concat(e.join(".")))}(t,this.fieldPath);for(var r=Object.keys(t)[0],n=0;n<e.enum.length;n++){var i=e.enum[n];if(r===Object.keys(i.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,i)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(e)," at ").concat(this.fieldPath.join(".")))},t.prototype.encode_array=function(t,e){if(function(t){return Array.isArray(t)||!!t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&(0===t.length||t.length>0&&t.length-1 in t)}(t))return this.encode_arraylike(t,e);if(t instanceof ArrayBuffer)return this.encode_buffer(t,e);throw new Error("Expected Array-like not ".concat(typeof t,"(").concat(t,") at ").concat(this.fieldPath.join(".")))},t.prototype.encode_arraylike=function(t,e){e.array.len?wr(t.length,e.array.len,this.fieldPath):this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encode_value(t[r],e.array.type)},t.prototype.encode_buffer=function(t,e){e.array.len?wr(t.byteLength,e.array.len,this.fieldPath):this.encoded.store_value(t.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(t))},t.prototype.encode_set=function(t,e){this.checkTypes&&gr(t,"object",this.fieldPath);var r=t instanceof Set?Array.from(t.values()):Object.values(t);this.encoded.store_value(r.length,"u32");for(var n=0,i=r;n<i.length;n++){var o=i[n];this.encode_value(o,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&gr(t,"object",this.fieldPath);var r=t instanceof Map,n=r?Array.from(t.keys()):Object.keys(t);this.encoded.store_value(n.length,"u32");for(var i=0,o=n;i<o.length;i++){var s=o[i];this.encode_value(s,e.map.key),this.encode_value(r?t.get(s):t[s],e.map.value)}},t.prototype.encode_struct=function(t,e){this.checkTypes&&gr(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var i=n[r];this.fieldPath.push(i),this.encode_value(t[i],e.struct[i]),this.fieldPath.pop()}},t}(),Br=function(){function t(t){this.buffer=new pr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(dr.includes(t))return this.decode_integer(t);if("string"===t)return this.decode_string();if("bool"===t)return this.decode_boolean()}if("object"==typeof t){if("option"in t)return this.decode_option(t);if("enum"in t)return this.decode_enum(t);if("array"in t)return this.decode_array(t);if("set"in t)return this.decode_set(t);if("map"in t)return this.decode_map(t);if("struct"in t)return this.decode_struct(t)}throw new Error("Unsupported type: ".concat(t))},t.prototype.decode_integer=function(t){var e=parseInt(t.substring(1));return e<=32||"f64"==t?this.buffer.consume_value(t):this.decode_bigint(e,t.startsWith("i"))},t.prototype.decode_bigint=function(t,e){void 0===e&&(e=!1);var r=t/8,n=new Uint8Array(this.buffer.consume_bytes(r)),i=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(i))):BigInt("0x".concat(i))},t.prototype.decode_string=function(){var t=this.decode_integer("u32"),e=new Uint8Array(this.buffer.consume_bytes(t));return String.fromCharCode.apply(null,e)},t.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},t.prototype.decode_option=function(t){var e=this.buffer.consume_value("u8");if(1===e)return this.decode_value(t.option);if(0!==e)throw new Error("Invalid option ".concat(e));return null},t.prototype.decode_enum=function(t){var e,r=this.buffer.consume_value("u8");if(r>t.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=t.enum[r].struct,i=Object.keys(n)[0];return(e={})[i]=this.decode_value(n[i]),e},t.prototype.decode_array=function(t){for(var e=[],r=t.array.len?t.array.len:this.decode_integer("u32"),n=0;n<r;++n)e.push(this.decode_value(t.array.type));return e},t.prototype.decode_set=function(t){for(var e=this.decode_integer("u32"),r=new Set,n=0;n<e;++n)r.add(this.decode_value(t.set));return r},t.prototype.decode_map=function(t){for(var e=this.decode_integer("u32"),r=new Map,n=0;n<e;++n){var i=this.decode_value(t.map.key),o=this.decode_value(t.map.value);r.set(i,o)}return r},t.prototype.decode_struct=function(t){var e={};for(var r in t.struct)e[r]=this.decode_value(t.struct[r]);return e},t}();function Ir(t,e,r){return void 0===r&&(r=!0),r&&Er(t),new Ar(r).encode(e,t)}class Sr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return Ir(Sr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Sr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class xr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return Ir(xr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}xr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class kr{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return Ir(kr.schema,this)}getInstruction(t,e,n,i,o,s,a,u,c){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:e,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:i,isSigner:!0,isWritable:!0}),h.push({pubkey:o,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:u,isSigner:!1,isWritable:!1}),h.push({pubkey:c,isSigner:!0,isWritable:!0}),new r({keys:h,programId:t,data:f})}}kr.schema={struct:{tag:"u8",staleness:"bool"}};class Rr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return Ir(Rr.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Rr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class _r{constructor(){this.tag=5}serialize(){return Ir(_r.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}_r.schema={struct:{tag:"u8"}};class Ur{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return Ir(Ur.schema,this)}getInstruction(t,e,n,i,o,s,a,u){const c=Buffer.from(this.serialize());let f=[];return f.push({pubkey:e,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:i,isSigner:!0,isWritable:!0}),f.push({pubkey:o,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:u,isSigner:!1,isWritable:!1}),new r({keys:f,programId:t,data:c})}}Ur.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const Lr=new t("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Pr]=t.findProgramAddressSync([Lr.toBuffer()],Lr);var Tr,Cr;(Cr=Tr||(Tr={}))[Cr.None=0]="None",Cr[Cr.Solana=1]="Solana",Cr[Cr.Ethereum=2]="Ethereum",Cr[Cr.UnverifiedSolana=3]="UnverifiedSolana";const Or=t=>{switch(t){case Tr.None:return 0;case Tr.Ethereum:return 20;case Tr.Solana:case Tr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Nr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Nr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&Er(e),new Br(r).decode(e)));var e,r,n}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data.slice(96,96+this.LEN))}}Nr.LEN=8,Nr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Dr{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Nr.deserialize(t.slice(96,96+Nr.LEN)),r=t.slice(96+Nr.LEN);return new Dr(e,r)}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data)}static async retrieveBatch(t,e){return(await t.getMultipleAccountsInfo(e)).map((t=>{if(null==t?void 0:t.data)return this.deserialize(t.data)}))}getContent(){let t=Or(this.header.stalenessValidation)+Or(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Or(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Or(this.header.stalenessValidation),e=t+Or(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var Wr;!function(t){t.IPFS="IPFS",t.ARWV="ARWV",t.SOL="SOL",t.ETH="ETH",t.BTC="BTC",t.LTC="LTC",t.DOGE="DOGE",t.Email="email",t.Url="url",t.Discord="discord",t.Github="github",t.Reddit="reddit",t.Twitter="twitter",t.Telegram="telegram",t.Pic="pic",t.SHDW="SHDW",t.POINT="POINT",t.BSC="BSC",t.Injective="INJ",t.Backpack="backpack",t.A="A",t.AAAA="AAAA",t.CNAME="CNAME",t.TXT="TXT",t.Background="background"}(Wr||(Wr={}));const zr=new Map([[Wr.SOL,96],[Wr.ETH,20],[Wr.BSC,20],[Wr.Injective,20],[Wr.A,4],[Wr.AAAA,16],[Wr.Background,32]]);var Mr;!function(t){t[t.V1=1]="V1",t[t.V2=2]="V2"}(Mr||(Mr={}));var jr="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",Vr="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Fr=0,Hr=-3;function Gr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function qr(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Gr,this.dtree=new Gr}var $r=new Gr,Xr=new Gr,Yr=new Uint8Array(30),Zr=new Uint16Array(30),Kr=new Uint8Array(30),Qr=new Uint16Array(30),Jr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tn=new Gr,en=new Uint8Array(320);function rn(t,e,r,n){var i,o;for(i=0;i<r;++i)t[i]=0;for(i=0;i<30-r;++i)t[i+r]=i/r|0;for(o=n,i=0;i<30;++i)e[i]=o,o+=1<<t[i]}var nn=new Uint16Array(16);function on(t,e,r,n){var i,o;for(i=0;i<16;++i)t.table[i]=0;for(i=0;i<n;++i)t.table[e[r+i]]++;for(t.table[0]=0,o=0,i=0;i<16;++i)nn[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[nn[e[r+i]]++]=i)}function sn(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function an(t,e,r){if(!e)return r;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var n=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,n+r}function un(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,i=0,o=t.tag;do{n=2*n+(1&o),o>>>=1,++i,r+=e.table[i],n-=e.table[i]}while(n>=0);return t.tag=o,t.bitcount-=i,e.trans[r+n]}function cn(t,e,r){var n,i,o,s,a,u;for(n=an(t,5,257),i=an(t,5,1),o=an(t,4,4),s=0;s<19;++s)en[s]=0;for(s=0;s<o;++s){var c=an(t,3,0);en[Jr[s]]=c}for(on(tn,en,0,19),a=0;a<n+i;){var f=un(t,tn);switch(f){case 16:var h=en[a-1];for(u=an(t,2,3);u;--u)en[a++]=h;break;case 17:for(u=an(t,3,3);u;--u)en[a++]=0;break;case 18:for(u=an(t,7,11);u;--u)en[a++]=0;break;default:en[a++]=f}}on(e,en,0,n),on(r,en,n,i)}function fn(t,e,r){for(;;){var n,i,o,s,a=un(t,e);if(256===a)return Fr;if(a<256)t.dest[t.destLen++]=a;else for(n=an(t,Yr[a-=257],Zr[a]),i=un(t,r),s=o=t.destLen-an(t,Kr[i],Qr[i]);s<o+n;++s)t.dest[t.destLen++]=t.dest[s]}}function hn(t){for(var e,r;t.bitcount>8;)t.sourceIndex--,t.bitcount-=8;if((e=256*(e=t.source[t.sourceIndex+1])+t.source[t.sourceIndex])!==(65535&~(256*t.source[t.sourceIndex+3]+t.source[t.sourceIndex+2])))return Hr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Fr}!function(t,e){var r;for(r=0;r<7;++r)t.table[r]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,r=0;r<24;++r)t.trans[r]=256+r;for(r=0;r<144;++r)t.trans[24+r]=r;for(r=0;r<8;++r)t.trans[168+r]=280+r;for(r=0;r<112;++r)t.trans[176+r]=144+r;for(r=0;r<5;++r)e.table[r]=0;for(e.table[5]=32,r=0;r<32;++r)e.trans[r]=r}($r,Xr),rn(Yr,Zr,4,3),rn(Kr,Qr,2,1),Yr[28]=0,Zr[28]=258;var dn=function(t,e){var r,n,i=new qr(t,e);do{switch(r=sn(i),an(i,2,0)){case 0:n=hn(i);break;case 1:n=fn(i,$r,Xr);break;case 2:cn(i,i.ltree,i.dtree),n=fn(i,i.ltree,i.dtree);break;default:n=Hr}if(n!==Fr)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?"function"==typeof i.dest.slice?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest};const ln=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],pn=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var yn={swap32LE:t=>{ln&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)pn(t,r,r+3),pn(t,r+1,r+2)})(t)}};const gn=dn,{swap32LE:wn}=yn;var bn=class{constructor(t){const e="function"==typeof t.readUInt32BE&&"function"==typeof t.slice;if(e||t instanceof Uint8Array){let r;if(e)this.highStart=t.readUInt32LE(0),this.errorValue=t.readUInt32LE(4),r=t.readUInt32LE(8),t=t.slice(12);else{const e=new DataView(t.buffer);this.highStart=e.getUint32(0,!0),this.errorValue=e.getUint32(4,!0),r=e.getUint32(8,!0),t=t.subarray(12)}t=gn(t,new Uint8Array(r)),t=gn(t,new Uint8Array(r)),wn(t),this.data=new Uint32Array(t.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=t)}get(t){let e;return t<0||t>1114111?this.errorValue:t<55296||t>56319&&t<=65535?(e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t<this.highStart?(e=this.data[2080+(t>>11)],e=this.data[e+(t>>5&63)],e=(e<<2)+(31&t),this.data[e]):this.data[this.data.length-4]}},mn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,mn.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,i="function"==typeof Buffer,o="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(a),c=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(u),f=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,h=String.fromCharCode.bind(String),d="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},l=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},p=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,i,o="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");o+=u[(e=r<<16|n<<8|i)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},g=n?function(t){return btoa(t)}:i?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=i?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,i=t.length;n<i;n+=e)r.push(h.apply(null,t.subarray(n,n+e)));return g(r.join(""))},b=function(t,e){return void 0===e&&(e=!1),e?l(w(t)):w(t)},m=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?h(192|e>>>6)+h(128|63&e):h(224|e>>>12&15)+h(128|e>>>6&63)+h(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return h(240|e>>>18&7)+h(128|e>>>12&63)+h(128|e>>>6&63)+h(128|63&e)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,E=function(t){return t.replace(v,m)},A=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},B=function(t,e){return void 0===e&&(e=!1),e?l(A(t)):A(t)},I=function(t){return B(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return h(55296+(e>>>10))+h(56320+(1023&e));case 3:return h((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return h((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},k=function(t){return t.replace(S,x)},R=function(t){if(t=t.replace(/\s+/g,""),!f.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,i="",o=0;o<t.length;)e=c[t.charAt(o++)]<<18|c[t.charAt(o++)]<<12|(r=c[t.charAt(o++)])<<6|(n=c[t.charAt(o++)]),i+=64===r?h(e>>16&255):64===n?h(e>>16&255,e>>8&255):h(e>>16&255,e>>8&255,255&e);return i},_=r?function(t){return atob(p(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:R,U=i?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(_(t).split("").map((function(t){return t.charCodeAt(0)})))},L=function(t){return U(T(t))},P=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:o?function(t){return o.decode(U(t))}:function(t){return k(_(t))},T=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return P(T(t))},O=function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},N=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},D=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,N(e))};t("fromBase64",(function(){return C(this)})),t("toBase64",(function(t){return B(this,t)})),t("toBase64URI",(function(){return B(this,!0)})),t("toBase64URL",(function(){return B(this,!0)})),t("toUint8Array",(function(){return L(this)}))},W=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,N(e))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},z=function(){D(),W()},M={version:t,VERSION:e,atob:_,atobPolyfill:R,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:B,encode:B,encodeURI:I,encodeURL:I,utob:E,btou:k,decode:C,isValid:O,fromUint8Array:b,toUint8Array:L,extendString:D,extendUint8Array:W,extendBuiltins:z,Base64:{}};return Object.keys(M).forEach((function(t){return M.Base64[t]=M[t]})),M}();const vn={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},En=jr,An=Vr,Bn=bn,In=mn.exports.Base64,Sn=new Bn(In.toUint8Array(En)),xn=new Bn(In.toUint8Array(An));function kn(t,e){return 0!=(t&e)}const Rn=0,_n=1,Un=2;function Ln(t,e){const r=t.length;let n=0,i=Rn;for(let o=e;o+1<r;o++){const r=t[o+0],s=t[o+1];switch(kn(r,vn.Regional_Indicator)||(n=0),i){case Un:case Rn:i=kn(r,vn.Extended_Pictographic)?_n:Rn;break;case _n:i=kn(r,vn.Extend)?_n:kn(r,vn.ZWJ)&&kn(s,vn.Extended_Pictographic)?Un:Rn}if(!kn(r,vn.CR)||!kn(s,vn.LF)){if(kn(r,vn.Control|vn.CR|vn.LF))return o+1-e;if(kn(s,vn.Control|vn.CR|vn.LF))return o+1-e;if(!(kn(r,vn.L)&&kn(s,vn.L|vn.V|vn.LV|vn.LVT)||kn(r,vn.LV|vn.V)&&kn(s,vn.V|vn.T)||kn(r,vn.LVT|vn.T)&&kn(s,vn.T)||kn(s,vn.Extend|vn.ZWJ)||kn(s,vn.SpacingMark)||kn(r,vn.Prepend)||i===Un)){if(!kn(r,vn.Regional_Indicator)||!kn(s,vn.Regional_Indicator)||n%2!=0)return o+1-e;n++}}}return r-e}var Pn=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const i=t.codePointAt(e);n.push(Sn.get(i)|xn.get(i)),e+=i>65535?2:1,r.push(e)}for(let i=0;i<n.length;){const o=Ln(n,i),s=r[i],a=r[i+o];e.push(t.slice(s,a)),i+=o}return e},Tn=o(Pn);const Cn=t=>{const e=De+t,r=Oe(s.Buffer.from(e,"utf8"));return s.Buffer.from(r)},On=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,Ne);return o};async function Nn(t,e){const r=Cn(e.toBase58()),n=On(r,Ve),{registry:i}=await we.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Yn(i.data)}async function Dn(t,e){let r=[];for(let t of e){const e=Cn(t.toBase58()),n=On(e,Ve);r.push(n)}return(await we.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Yn(t.data)}))}const Wn=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Ve.toBase58()}}],n=await t.getProgramAccounts(Ne,{filters:r}),i=[{memcmp:{offset:0,bytes:e.toBase58()}}],o=await t.getProgramAccounts(Ne,{filters:i,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Yn(t.account.data.slice(96))]))),a=[];return o.forEach((t=>{const r=Gn(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},zn=(t,e=We,r)=>{let n=Cn(t);return{pubkey:On(n,r,e),hashed:n}},Mn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===Mr.V2?Pr:void 0,n=t.split(".");if(2===n.length){const t=s.Buffer.from([e||0]).toString().concat(n[0]),{pubkey:i}=zn(n[1]);return{...zn(t,i,r),isSub:!0,parent:i}}if(3===n.length&&e){const{pubkey:t}=zn(n[2]),{pubkey:i}=zn("\0".concat(n[1]),t),o=e===Mr.V2?"":"";return{...zn(o.concat(n[0]),i,r),isSub:!0,parent:t,isSubRecord:!0}}if(n.length>=3)throw new Pt(Lt.InvalidInput);return{...zn(t,We),isSub:!1,parent:void 0}};async function jn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:We.toBase58()}}];return(await t.getProgramAccounts(Ne,{filters:r})).map((t=>t.pubkey))}async function Vn(t,e){const r=await jn(t,e),n=await Dn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))}const Fn=async t=>{const e=[{memcmp:{offset:0,bytes:We.toBase58()}}];return await t.getProgramAccounts(Ne,{dataSlice:{offset:32,length:32},filters:e})},Hn=(t,e)=>{const{pubkey:r,parent:n}=Mn(t),i=Cn(r.toBase58());return On(i,Ve,e?n:void 0)},Gn=(t,e)=>{const r=Cn(t.toBase58());return On(r,Ve,e)},qn=(t,e)=>{if(!t)throw new Pt(e)},$n=async(t,e)=>{const r=await ge(t,e),n=await Dn(t,r.map((t=>t.nameAccount)));return n.map(((t,e)=>({key:r[e].nameAccount,mint:r[e].nftMint,reverse:t}))).filter((t=>!!t.reverse))},Xn=t=>{switch(Tn(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}};function Yn(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var Zn=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=o-1;(0!==f||h<i)&&-1!==d;d--,h++)f+=s*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,r++}for(var l=o-i;l!==o&&0===c[l];)l++;for(var p=new Uint8Array(n+(o-l)),y=n;l!==o;)p[y++]=c[l++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,l=u-1;(0!==h||d<n)&&-1!==l;l--,d++)h+=256*f[l]>>>0,f[l]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var y=a.repeat(r);p<u;++p)y+=t.charAt(f[p]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var Kn,Qn=Zn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Jn={exports:{}};Kn=Jn,function(t){const e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function u(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(o=t.indexOf(":",o+1))>=0;)i++;if("::"===t.substr(0,2)&&i--,"::"===t.substr(-2,2)&&i--,i>e)return null;for(n=e-i,r=":";n--;)r+="0:";return":"===(t=t.replace("::",r))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),e=function(){const e=t.split(":"),r=[];for(let t=0;t<e.length;t++)r.push(parseInt(e[t],16));return r}(),{parts:e,zoneId:s}}function c(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),t[o]>>i!=e[o]>>i)return!1;n-=r,o+=1}return!0}function f(t){if(i.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(n.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function h(t,e){for(;t.length<e;)t=`0${t}`;return t}const d={};d.IPv4=function(){function t(t){if(4!==t.length)throw new Error("ipaddr: ipv4 octet count should be 4");let e,r;for(e=0;e<t.length;e++)if(r=t[e],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=t}return t.prototype.SpecialRanges={unspecified:[[new t([0,0,0,0]),8]],broadcast:[[new t([255,255,255,255]),32]],multicast:[[new t([224,0,0,0]),4]],linkLocal:[[new t([169,254,0,0]),16]],loopback:[[new t([127,0,0,0]),8]],carrierGradeNat:[[new t([100,64,0,0]),10]],private:[[new t([10,0,0,0]),8],[new t([172,16,0,0]),12],[new t([192,168,0,0]),16]],reserved:[[new t([192,0,0,0]),24],[new t([192,0,2,0]),24],[new t([192,88,99,0]),24],[new t([198,18,0,0]),15],[new t([198,51,100,0]),24],[new t([203,0,113,0]),24],[new t([240,0,0,0]),4]]},t.prototype.kind=function(){return"ipv4"},t.prototype.match=function(t,e){let r;if(void 0===e&&(r=t,t=r[0],e=r[1]),"ipv4"!==t.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return c(this.octets,t.octets,8,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,i,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],e&&0!==o)return null;8!==o&&(e=!0),t+=o}return 32-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),d.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(t){return null!==this.parser(t)},d.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},d.IPv4.isValidFourPartDecimal=function(t){return!(!d.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(t){let e,r,n,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},d.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(t){let e,n,i;if(e=t.match(r.fourOctet))return function(){const t=e.slice(1,6),r=[];for(let e=0;e<t.length;e++)n=t[e],r.push(f(n));return r}();if(e=t.match(r.longValue)){if(i=f(e[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(i>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(i=f(t[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(i=f(t[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(i>>8&255),r.push(255&i),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r<n;)e[r]=255,r++;return n<4&&(e[n]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},d.IPv6=function(){function t(t,e){let r,n;if(16===t.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(t[r]<<8|t[r+1]);else{if(8!==t.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=t}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");e&&(this.zoneId=e)}return t.prototype.SpecialRanges={unspecified:[new t([0,0,0,0,0,0,0,0]),128],linkLocal:[new t([65152,0,0,0,0,0,0,0]),10],multicast:[new t([65280,0,0,0,0,0,0,0]),8],loopback:[new t([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new t([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new t([0,0,0,0,0,65535,0,0]),96],rfc6145:[new t([0,0,0,0,65535,0,0,0]),96],rfc6052:[new t([100,65435,0,0,0,0,0,0]),96],"6to4":[new t([8194,0,0,0,0,0,0,0]),16],teredo:[new t([8193,0,0,0,0,0,0,0]),32],reserved:[[new t([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new t([8193,2,0,0,0,0,0,0]),48],amt:[new t([8193,3,0,0,0,0,0,0]),32],as112v6:[new t([8193,4,274,0,0,0,0,0]),48],deprecated:[new t([8193,16,0,0,0,0,0,0]),28],orchid2:[new t([8193,32,0,0,0,0,0,0]),28]},t.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},t.prototype.kind=function(){return"ipv6"},t.prototype.match=function(t,e){let r;if(void 0===e&&(r=t,t=r[0],e=r[1]),"ipv6"!==t.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return c(this.parts,t.parts,16,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const r={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 n,i;for(let o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],e&&0!==i)return null;16!==i&&(e=!0),t+=i}return 128-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],r=this.parts;for(let n=0;n<r.length;n++)t=r[n],e.push(t>>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(h(this.parts[e].toString(16),4));return t}.call(this).join(":");let e="";return this.zoneId&&(e=`%${this.zoneId}`),t+e},t.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const t=this.parts.slice(-2),e=t[0],r=t[1];return new d.IPv4([e>>8,255&e,r>>8,255&r])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(this.parts[e].toString(16));return t}.call(this).join(":");let e="";return this.zoneId&&(e=`%${this.zoneId}`),t+e},t.prototype.toRFC5952String=function(){const t=/((^|:)(0(:|$)){2,})/g,e=this.toNormalizedString();let r,n=0,i=-1;for(;r=t.exec(e);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?e:`${e.substring(0,n)}::${e.substring(n+i)}`},t.prototype.toString=function(){return this.toRFC5952String()},t}(),d.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(t){return null!==this.parser(t)},d.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(t){return!1}},d.IPv6.networkAddressFromCIDR=function(t){let e,r,n,i,o;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),o=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},d.IPv6.parseCIDR=function(t){let e,r,n;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return n=[this.parse(r[1]),e],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(t){let e,r,n,i,o,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return u(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=u(n[1].slice(0,-1)+s,6),e.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return e.parts.push(o[0]<<8|o[1]),e.parts.push(o[2]<<8|o[3]),{parts:e.parts,zoneId:e.zoneId}}return null},d.IPv6.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(t/8);for(;r<n;)e[r]=255,r++;return n<16&&(e[n]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},d.fromByteArray=function(t){const e=t.length;if(4===e)return new d.IPv4(t);if(16===e)return new d.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},d.isValid=function(t){return d.IPv6.isValid(t)||d.IPv4.isValid(t)},d.parse=function(t){if(d.IPv6.isValid(t))return d.IPv6.parse(t);if(d.IPv4.isValid(t))return d.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},d.parseCIDR=function(t){try{return d.IPv6.parseCIDR(t)}catch(e){try{return d.IPv4.parseCIDR(t)}catch(t){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},d.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},d.subnetMatch=function(t,e,r){let n,i,o,s;for(i in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,i))for(o=e[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return i;return r},Kn.exports?Kn.exports=d:t.ipaddr=d}(i);var ti=Jn.exports;const ei=2147483647,ri=36,ni={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ii=Math.floor,oi=String.fromCharCode;function si(t){throw new RangeError(ni[t])}const ai=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},ui=function(t,e,r){let n=0;for(t=r?ii(t/700):t>>1,t+=ii(t/e);t>455;n+=ri)t=ii(t/35);return ii(n+36*t/(t+38))},ci=function(t){const e=[],r=t.length;let n=0,i=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)t.charCodeAt(r)>=128&&si("not-basic"),e.push(t.charCodeAt(r));for(let u=s>0?s+1:0;u<r;){const s=n;for(let e=1,i=ri;;i+=ri){u>=r&&si("invalid-input");const s=(a=t.charCodeAt(u++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:ri;s>=ri&&si("invalid-input"),s>ii((ei-n)/e)&&si("overflow"),n+=s*e;const c=i<=o?1:i>=o+26?26:i-o;if(s<c)break;const f=ri-c;e>ii(ei/f)&&si("overflow"),e*=f}const c=e.length+1;o=ui(n-s,c,0==s),ii(n/c)>ei-i&&si("overflow"),i+=ii(n/c),n%=c,e.splice(n++,0,i)}var a;return String.fromCodePoint(...e)},fi=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const i=t.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&i)<<10)+(1023&n)+65536):(e.push(i),r--)}else e.push(i)}return e}(t);const r=t.length;let n=128,i=0,o=72;for(const r of t)r<128&&e.push(oi(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=ei;for(const e of t)e>=n&&e<r&&(r=e);const u=a+1;r-n>ii((ei-i)/u)&&si("overflow"),i+=(r-n)*u,n=r;for(const r of t)if(r<n&&++i>ei&&si("overflow"),r===n){let t=i;for(let r=ri;;r+=ri){const n=r<=o?1:r>=o+26?26:r-o;if(t<n)break;const i=t-n,s=ri-n;e.push(oi(ai(n+i%s,0))),t=ii(i/s)}e.push(oi(ai(t,0))),o=ui(i,u,a===s),i=0,++a}++i,++n}return e.join("")},hi=BigInt(2**32-1),di=BigInt(32);function li(t,e=!1){return e?{h:Number(t&hi),l:Number(t>>di&hi)}:{h:0|Number(t>>di&hi),l:0|Number(t&hi)}}const pi={fromBig:li,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=li(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<di|BigInt(e>>>0),shrSH:(t,e,r)=>t>>>r,shrSL:(t,e,r)=>t<<32-r|e>>>r,rotrSH:(t,e,r)=>t>>>r|e<<32-r,rotrSL:(t,e,r)=>t<<32-r|e>>>r,rotrBH:(t,e,r)=>t<<64-r|e>>>r-32,rotrBL:(t,e,r)=>t>>>r-32|e<<64-r,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:(t,e,r)=>t<<r|e>>>32-r,rotlSL:(t,e,r)=>e<<r|t>>>32-r,rotlBH:(t,e,r)=>e<<r-32|t>>>64-r,rotlBL:(t,e,r)=>t<<r-32|e>>>64-r,add:function(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},add3L:(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),add3H:(t,e,r,n)=>e+r+n+(t/2**32|0)|0,add4L:(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),add4H:(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,add5H:(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,add5L:(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0)};var yi=pi;const[gi,wi]=(()=>yi.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),bi=new Uint32Array(80),mi=new Uint32Array(80);class vi extends Re{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:f,Fl:h,Gh:d,Gl:l,Hh:p,Hl:y}=this;return[t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y]}set(t,e,r,n,i,o,s,a,u,c,f,h,d,l,p,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)bi[r]=t.getUint32(e),mi[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|bi[t-15],r=0|mi[t-15],n=yi.rotrSH(e,r,1)^yi.rotrSH(e,r,8)^yi.shrSH(e,r,7),i=yi.rotrSL(e,r,1)^yi.rotrSL(e,r,8)^yi.shrSL(e,r,7),o=0|bi[t-2],s=0|mi[t-2],a=yi.rotrSH(o,s,19)^yi.rotrBH(o,s,61)^yi.shrSH(o,s,6),u=yi.rotrSL(o,s,19)^yi.rotrBL(o,s,61)^yi.shrSL(o,s,6),c=yi.add4L(i,u,mi[t-7],mi[t-16]),f=yi.add4H(c,n,a,bi[t-7],bi[t-16]);bi[t]=0|f,mi[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:f,El:h,Fh:d,Fl:l,Gh:p,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=yi.rotrSH(f,h,14)^yi.rotrSH(f,h,18)^yi.rotrBH(f,h,41),b=yi.rotrSL(f,h,14)^yi.rotrSL(f,h,18)^yi.rotrBL(f,h,41),m=f&d^~f&p,v=h&l^~h&y,E=yi.add5L(w,b,v,wi[t],mi[t]),A=yi.add5H(E,g,e,m,gi[t],bi[t]),B=0|E,I=yi.rotrSH(r,n,28)^yi.rotrBH(r,n,34)^yi.rotrBH(r,n,39),S=yi.rotrSL(r,n,28)^yi.rotrBL(r,n,34)^yi.rotrBL(r,n,39),x=r&i^r&s^i&s,k=n&o^n&a^o&a;g=0|p,w=0|y,p=0|d,y=0|l,d=0|f,l=0|h,({h:f,l:h}=yi.add(0|u,0|c,0|A,0|B)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const R=yi.add3L(B,S,k);r=yi.add3H(R,A,I,x),n=0|R}({h:r,l:n}=yi.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=yi.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=yi.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=yi.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l:h}=yi.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:l}=yi.add(0|this.Fh,0|this.Fl,0|d,0|l)),({h:p,l:y}=yi.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:w}=yi.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,i,o,s,a,u,c,f,h,d,l,p,y,g,w)}roundClean(){bi.fill(0),mi.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Ei=ke((()=>new vi));
12
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const Ai=BigInt(1),Bi=BigInt(2);function Ii(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Si=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function xi(t){if(!Ii(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Si[t[r]];return e}function ki(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const Ri={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function _i(t){return t>=Ri._0&&t<=Ri._9?t-Ri._0:t>=Ri._A&&t<=Ri._F?t-(Ri._A-10):t>=Ri._a&&t<=Ri._f?t-(Ri._a-10):void 0}function Ui(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){const r=_i(t.charCodeAt(i)),o=_i(t.charCodeAt(i+1));if(void 0===r||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}n[e]=16*r+o}return n}function Li(t){if(!Ii(t))throw new Error("Uint8Array expected");return ki(xi(Uint8Array.from(t).reverse()))}function Pi(t,e){return Ui(t.toString(16).padStart(2*e,"0"))}function Ti(t,e){return Pi(t,e).reverse()}function Ci(t,e,r){let n;if("string"==typeof e)try{n=Ui(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!Ii(e))throw new Error(`${t} must be hex string or Uint8Array`);n=Uint8Array.from(e)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function Oi(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!Ii(n))throw new Error("Uint8Array expected");e+=n.length}let r=new Uint8Array(e),n=0;for(let e=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}const Ni=t=>(Bi<<BigInt(t-1))-Ai,Di={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||Ii(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function Wi(t,e,r={}){const n=(e,r,n)=>{const i=Di[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=t[e];if(!(n&&void 0===o||i(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${r}`)};for(const[t,r]of Object.entries(e))n(t,r,!1);for(const[t,e]of Object.entries(r))n(t,e,!0);return t}
13
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zi=BigInt(0),Mi=BigInt(1),ji=BigInt(2),Vi=BigInt(3),Fi=BigInt(4),Hi=BigInt(5),Gi=BigInt(8);function qi(t,e){const r=t%e;return r>=zi?r:e+r}function $i(t,e,r){if(r<=zi||e<zi)throw new Error("Expected power/modulo > 0");if(r===Mi)return zi;let n=Mi;for(;e>zi;)e&Mi&&(n=n*t%r),t=t*t%r,e>>=Mi;return n}function Xi(t,e,r){let n=t;for(;e-- >zi;)n*=n,n%=r;return n}function Yi(t,e){if(t===zi||e<=zi)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=qi(t,e),n=e,i=zi,o=Mi;for(;r!==zi;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==Mi)throw new Error("invert: does not exist");return qi(i,e)}function Zi(t){if(t%Fi===Vi){const e=(t+Mi)/Fi;return function(t,r){const n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw new Error("Cannot find square root");return n}}if(t%Gi===Hi){const e=(t-Hi)/Gi;return function(t,r){const n=t.mul(r,ji),i=t.pow(n,e),o=t.mul(r,i),s=t.mul(t.mul(o,ji),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-Mi)/ji;let r,n,i;for(r=t-Mi,n=0;r%ji===zi;r/=ji,n++);for(i=ji;i<t&&$i(i,e,t)!==t-Mi;i++);if(1===n){const e=(t+Mi)/Fi;return function(t,r){const n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw new Error("Cannot find square root");return n}}const o=(r+Mi)/ji;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=n,u=t.pow(t.mul(t.ONE,i),r),c=t.pow(s,o),f=t.pow(s,r);for(;!t.eql(f,t.ONE);){if(t.eql(f,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(f);e<a&&!t.eql(r,t.ONE);e++)r=t.sqr(r);const r=t.pow(u,Mi<<BigInt(a-e-1));u=t.sqr(r),c=t.mul(c,r),f=t.mul(f,u),a=e}return c}}(t)}BigInt(9),BigInt(16);const Ki=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Qi(t,e){const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}
14
14
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
15
- const Qi=BigInt(0),Ji=BigInt(1);function to(t){return Di(t.Fp,Zi.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Di(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ki(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
16
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const eo=BigInt(0),ro=BigInt(1),no=BigInt(2),io=BigInt(8),oo={zip215:!0};function so(t){const e=function(t){const e=to(t);return Di(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:r,n:n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=no<<BigInt(8*a)-ro,f=r.create,h=e.uvRatio||((t,e)=>{try{return{isValid:!0,value:r.sqrt(t*r.inv(e))}}catch(t){return{isValid:!1,value:eo}}}),d=e.adjustScalarBytes||(t=>t),l=e.domain||((t,e,r)=>{if(e.length||r)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&eo<t,y=(t,e)=>p(t)&&p(e)&&t<e,g=t=>t===eo||y(t,c);function w(t,e){if(y(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===eo?t:w(t,n)}const m=new Map;function v(t){if(!(t instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(t,e,r,n){if(this.ex=t,this.ey=e,this.ez=r,this.et=n,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(r))throw new Error("z required");if(!g(n))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof E)throw new Error("extended point not allowed");const{x:e,y:r}=t||{};if(!g(e)||!g(r))throw new Error("invalid affine point");return new E(e,r,ro,f(e*r))}static normalizeZ(t){const e=r.invertBatch(t.map((t=>t.ez)));return t.map(((t,r)=>t.toAffine(e[r]))).map(E.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,m.delete(this)}assertValidity(){const{a:t,d:r}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:n,ey:i,ez:o,et:s}=this,a=f(n*n),u=f(i*i),c=f(o*o),h=f(c*c),d=f(a*t);if(f(c*f(d+u))!==f(h+f(r*f(a*u))))throw new Error("bad point: equation left != right (1)");if(f(n*i)!==f(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){v(t);const{ex:e,ey:r,ez:n}=this,{ex:i,ey:o,ez:s}=t,a=f(e*s),u=f(i*n),c=f(r*s),h=f(o*n);return a===u&&c===h}is0(){return this.equals(E.ZERO)}negate(){return new E(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){const{a:t}=e,{ex:r,ey:n,ez:i}=this,o=f(r*r),s=f(n*n),a=f(no*f(i*i)),u=f(t*o),c=r+n,h=f(f(c*c)-o-s),d=u+s,l=d-a,p=u-s,y=f(h*l),g=f(d*p),w=f(h*p),b=f(l*d);return new E(y,g,b,w)}add(t){v(t);const{a:r,d:n}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:h,et:d}=t;if(r===BigInt(-1)){const t=f((o-i)*(c+u)),e=f((o+i)*(c-u)),r=f(e-t);if(r===eo)return this.double();const n=f(s*no*d),l=f(a*no*h),p=l+n,y=e+t,g=l-n,w=f(p*r),b=f(y*g),m=f(p*g),v=f(r*y);return new E(w,b,v,m)}const l=f(i*u),p=f(o*c),y=f(a*n*d),g=f(s*h),w=f((i+o)*(u+c)-l-p),b=g-y,m=g+y,A=f(p-r*l),B=f(w*b),I=f(m*A),S=f(w*A),x=f(b*m);return new E(B,I,x,S)}subtract(t){return this.add(t.negate())}wNAF(t){return I.wNAFCached(this,m,t,E.normalizeZ)}multiply(t){const{p:e,f:r}=this.wNAF(w(t,n));return E.normalizeZ([e,r])[0]}multiplyUnsafe(t){let e=b(t);return e===eo?B:this.equals(B)||e===ro?this:this.equals(A)?this.wNAF(e).p:I.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(t){const{ex:e,ey:n,ez:i}=this,o=this.is0();null==t&&(t=o?io:r.inv(i));const s=f(e*t),a=f(n*t),u=f(i*t);if(o)return{x:eo,y:ro};if(u!==ro)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===ro?this:this.multiplyUnsafe(t)}static fromHex(t,n=!1){const{d:i,a:o}=e,s=r.BYTES,a=(t=Ti("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const d=Ui(a);d===eo||w(d,n?c:r.ORDER);const l=f(d*d),p=f(l-ro),y=f(i*l-o);let{isValid:g,value:b}=h(p,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&ro)===ro,v=0!=(128&u);if(!n&&b===eo&&v)throw new Error("Point.fromHex: x=0 and x_0=1");return v!==m&&(b=f(-b)),E.fromAffine({x:b,y:d})}static fromPrivateKey(t){return k(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),n=Pi(e,r.BYTES);return n[n.length-1]|=t&ro?128:0,n}toHex(){return Si(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,ro,f(e.Gx*e.Gy)),E.ZERO=new E(eo,ro,ro,eo);const{BASE:A,ZERO:B}=E,I=function(t,e){const r=(t,e)=>{const r=e.negate();return t?r:e},n=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:r,unsafeLadder(e,r){let n=t.ZERO,i=e;for(;r>Qi;)r&Ji&&(n=n.add(i)),i=i.double(),r>>=Ji;return n},precomputeWindow(t,e){const{windows:r,windowSize:i}=n(e),o=[];let s=t,a=s;for(let t=0;t<r;t++){a=s,o.push(a);for(let t=1;t<i;t++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(e,i,o){const{windows:s,windowSize:a}=n(e);let u=t.ZERO,c=t.BASE;const f=BigInt(2**e-1),h=2**e,d=BigInt(e);for(let t=0;t<s;t++){const e=t*a;let n=Number(o&f);o>>=d,n>a&&(n-=h,o+=Ji);const s=e,l=e+Math.abs(n)-1,p=t%2!=0,y=n<0;0===n?c=c.add(r(p,i[s])):u=u.add(r(y,i[l]))}return{p:u,f:c}},wNAFCached(t,e,r,n){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,n(o))),this.wNAF(i,o,r)}}}(E,8*a);function S(t){return Gi(t,n)}function x(t){return S(Ui(t))}function k(t){const e=a;t=Ti("private key",t,e);const r=Ti("hashed private key",o(t),2*e),n=d(r.slice(0,e)),i=r.slice(e,2*e),s=x(n),u=A.multiply(s),c=u.toRawBytes();return{head:n,prefix:i,scalar:s,point:u,pointBytes:c}}function R(t=new Uint8Array,...e){const r=Ci(...e);return x(o(l(r,Ti("context",t),!!i)))}const _=oo;A._setWindowSize(8);return{CURVE:e,getPublicKey:function(t){return k(t).pointBytes},sign:function(t,e,n={}){t=Ti("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=k(e),c=R(n.context,o,t),f=A.multiply(c).toRawBytes(),h=S(c+R(n.context,f,u,t)*s);return b(h),Ti("result",Ci(f,Pi(h,r.BYTES)),2*a)},verify:function(t,e,n,o=_){const{context:s,zip215:a}=o,u=r.BYTES;t=Ti("signature",t,2*u),e=Ti("message",e),i&&(e=i(e));const c=Ui(t.slice(u,2*u));let f,h,d;try{f=E.fromHex(n,a),h=E.fromHex(t.slice(0,u),a),d=A.multiplyUnsafe(c)}catch(t){return!1}if(!a&&f.isSmallOrder())return!1;const l=R(s,h.toRawBytes(),f.toRawBytes(),e);return h.add(f.multiplyUnsafe(l)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>s(r.BYTES),precompute:(t=8,e=E.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}
17
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ao=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),uo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const co=BigInt(1),fo=BigInt(2),ho=BigInt(5),lo=BigInt(10),po=BigInt(20),yo=BigInt(40),go=BigInt(80);const wo=function(t,e,r=!1,n={}){if(t<=Mi)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Ki(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Yi(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Oi(i),ZERO:Mi,ONE:Wi,create:e=>Gi(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Mi<=e&&e<t},is0:t=>t===Mi,isOdd:t=>(t&Wi)===Wi,neg:e=>Gi(-e,t),eql:(t,e)=>t===e,sqr:e=>Gi(e*e,t),add:(e,r)=>Gi(e+r,t),sub:(e,r)=>Gi(e-r,t),mul:(e,r)=>Gi(e*r,t),pow:(t,e)=>function(t,e,r){if(r<Mi)throw new Error("Expected power > 0");if(r===Mi)return t.ONE;if(r===Wi)return e;let n=t.ONE,i=e;for(;r>Mi;)r&Wi&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Wi;return n}(a,t,e),div:(e,r)=>Gi(e*Xi(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Xi(e,t),sqrt:n.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const r=new Array(e.length),n=e.reduce(((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n))),t.ONE),i=t.inv(n);return e.reduceRight(((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n))),i),r}(a,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?Pi(t,o):Li(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return r?Ui(t):function(t){return xi(Si(t))}(t)}});return Object.freeze(a)}(ao,void 0,!0),bo={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:wo,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:vi,randomBytes:function(t=32){if(me&&"function"==typeof me.getRandomValues)return me.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")},adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const r=ao,n=Gi(e*e*e,r),i=function(t){const e=ao,r=t*t%e*t%e,n=$i(r,fo,e)*r%e,i=$i(n,co,e)*t%e,o=$i(i,ho,e)*i%e,s=$i(o,lo,e)*o%e,a=$i(s,po,e)*s%e,u=$i(a,yo,e)*a%e,c=$i(u,go,e)*u%e,f=$i(c,go,e)*u%e,h=$i(f,lo,e)*o%e;return{pow_p_5_8:$i(h,fo,e)*t%e,b2:r}}(t*Gi(n*n*e,r)).pow_p_5_8;let o=Gi(t*n*i,r);const s=Gi(e*o*o,r),a=o,u=Gi(o*uo,r),c=s===t,f=s===Gi(-t,r),h=s===Gi(-t*uo,r);return c&&(o=a),(f||h)&&(o=u),(Gi(o,r)&Wi)===Wi&&(o=Gi(-o,r)),{isValid:c||f,value:o}}},mo=so(bo);const vo=(wo.ORDER+BigInt(3))/BigInt(8);
15
+ const Ji=BigInt(0),to=BigInt(1);function eo(t){return Wi(t.Fp,Ki.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Wi(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Qi(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
16
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ro=BigInt(0),no=BigInt(1),io=BigInt(2),oo=BigInt(8),so={zip215:!0};function ao(t){const e=function(t){const e=eo(t);return Wi(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:r,n:n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,c=io<<BigInt(8*a)-no,f=r.create,h=e.uvRatio||((t,e)=>{try{return{isValid:!0,value:r.sqrt(t*r.inv(e))}}catch(t){return{isValid:!1,value:ro}}}),d=e.adjustScalarBytes||(t=>t),l=e.domain||((t,e,r)=>{if(e.length||r)throw new Error("Contexts/pre-hash are not supported");return t}),p=t=>"bigint"==typeof t&&ro<t,y=(t,e)=>p(t)&&p(e)&&t<e,g=t=>t===ro||y(t,c);function w(t,e){if(y(t,e))return t;throw new Error(`Expected valid scalar < ${e}, got ${typeof t} ${t}`)}function b(t){return t===ro?t:w(t,n)}const m=new Map;function v(t){if(!(t instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(t,e,r,n){if(this.ex=t,this.ey=e,this.ez=r,this.et=n,!g(t))throw new Error("x required");if(!g(e))throw new Error("y required");if(!g(r))throw new Error("z required");if(!g(n))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(t){if(t instanceof E)throw new Error("extended point not allowed");const{x:e,y:r}=t||{};if(!g(e)||!g(r))throw new Error("invalid affine point");return new E(e,r,no,f(e*r))}static normalizeZ(t){const e=r.invertBatch(t.map((t=>t.ez)));return t.map(((t,r)=>t.toAffine(e[r]))).map(E.fromAffine)}_setWindowSize(t){this._WINDOW_SIZE=t,m.delete(this)}assertValidity(){const{a:t,d:r}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:n,ey:i,ez:o,et:s}=this,a=f(n*n),u=f(i*i),c=f(o*o),h=f(c*c),d=f(a*t);if(f(c*f(d+u))!==f(h+f(r*f(a*u))))throw new Error("bad point: equation left != right (1)");if(f(n*i)!==f(o*s))throw new Error("bad point: equation left != right (2)")}equals(t){v(t);const{ex:e,ey:r,ez:n}=this,{ex:i,ey:o,ez:s}=t,a=f(e*s),u=f(i*n),c=f(r*s),h=f(o*n);return a===u&&c===h}is0(){return this.equals(E.ZERO)}negate(){return new E(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){const{a:t}=e,{ex:r,ey:n,ez:i}=this,o=f(r*r),s=f(n*n),a=f(io*f(i*i)),u=f(t*o),c=r+n,h=f(f(c*c)-o-s),d=u+s,l=d-a,p=u-s,y=f(h*l),g=f(d*p),w=f(h*p),b=f(l*d);return new E(y,g,b,w)}add(t){v(t);const{a:r,d:n}=e,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:h,et:d}=t;if(r===BigInt(-1)){const t=f((o-i)*(c+u)),e=f((o+i)*(c-u)),r=f(e-t);if(r===ro)return this.double();const n=f(s*io*d),l=f(a*io*h),p=l+n,y=e+t,g=l-n,w=f(p*r),b=f(y*g),m=f(p*g),v=f(r*y);return new E(w,b,v,m)}const l=f(i*u),p=f(o*c),y=f(a*n*d),g=f(s*h),w=f((i+o)*(u+c)-l-p),b=g-y,m=g+y,A=f(p-r*l),B=f(w*b),I=f(m*A),S=f(w*A),x=f(b*m);return new E(B,I,x,S)}subtract(t){return this.add(t.negate())}wNAF(t){return I.wNAFCached(this,m,t,E.normalizeZ)}multiply(t){const{p:e,f:r}=this.wNAF(w(t,n));return E.normalizeZ([e,r])[0]}multiplyUnsafe(t){let e=b(t);return e===ro?B:this.equals(B)||e===no?this:this.equals(A)?this.wNAF(e).p:I.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(t){const{ex:e,ey:n,ez:i}=this,o=this.is0();null==t&&(t=o?oo:r.inv(i));const s=f(e*t),a=f(n*t),u=f(i*t);if(o)return{x:ro,y:no};if(u!==no)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===no?this:this.multiplyUnsafe(t)}static fromHex(t,n=!1){const{d:i,a:o}=e,s=r.BYTES,a=(t=Ci("pointHex",t,s)).slice(),u=t[s-1];a[s-1]=-129&u;const d=Li(a);d===ro||w(d,n?c:r.ORDER);const l=f(d*d),p=f(l-no),y=f(i*l-o);let{isValid:g,value:b}=h(p,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&no)===no,v=0!=(128&u);if(!n&&b===ro&&v)throw new Error("Point.fromHex: x=0 and x_0=1");return v!==m&&(b=f(-b)),E.fromAffine({x:b,y:d})}static fromPrivateKey(t){return k(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),n=Ti(e,r.BYTES);return n[n.length-1]|=t&no?128:0,n}toHex(){return xi(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,no,f(e.Gx*e.Gy)),E.ZERO=new E(ro,no,no,ro);const{BASE:A,ZERO:B}=E,I=function(t,e){const r=(t,e)=>{const r=e.negate();return t?r:e},n=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:r,unsafeLadder(e,r){let n=t.ZERO,i=e;for(;r>Ji;)r&to&&(n=n.add(i)),i=i.double(),r>>=to;return n},precomputeWindow(t,e){const{windows:r,windowSize:i}=n(e),o=[];let s=t,a=s;for(let t=0;t<r;t++){a=s,o.push(a);for(let t=1;t<i;t++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(e,i,o){const{windows:s,windowSize:a}=n(e);let u=t.ZERO,c=t.BASE;const f=BigInt(2**e-1),h=2**e,d=BigInt(e);for(let t=0;t<s;t++){const e=t*a;let n=Number(o&f);o>>=d,n>a&&(n-=h,o+=to);const s=e,l=e+Math.abs(n)-1,p=t%2!=0,y=n<0;0===n?c=c.add(r(p,i[s])):u=u.add(r(y,i[l]))}return{p:u,f:c}},wNAFCached(t,e,r,n){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,n(o))),this.wNAF(i,o,r)}}}(E,8*a);function S(t){return qi(t,n)}function x(t){return S(Li(t))}function k(t){const e=a;t=Ci("private key",t,e);const r=Ci("hashed private key",o(t),2*e),n=d(r.slice(0,e)),i=r.slice(e,2*e),s=x(n),u=A.multiply(s),c=u.toRawBytes();return{head:n,prefix:i,scalar:s,point:u,pointBytes:c}}function R(t=new Uint8Array,...e){const r=Oi(...e);return x(o(l(r,Ci("context",t),!!i)))}const _=so;A._setWindowSize(8);return{CURVE:e,getPublicKey:function(t){return k(t).pointBytes},sign:function(t,e,n={}){t=Ci("message",t),i&&(t=i(t));const{prefix:o,scalar:s,pointBytes:u}=k(e),c=R(n.context,o,t),f=A.multiply(c).toRawBytes(),h=S(c+R(n.context,f,u,t)*s);return b(h),Ci("result",Oi(f,Ti(h,r.BYTES)),2*a)},verify:function(t,e,n,o=_){const{context:s,zip215:a}=o,u=r.BYTES;t=Ci("signature",t,2*u),e=Ci("message",e),i&&(e=i(e));const c=Li(t.slice(u,2*u));let f,h,d;try{f=E.fromHex(n,a),h=E.fromHex(t.slice(0,u),a),d=A.multiplyUnsafe(c)}catch(t){return!1}if(!a&&f.isSmallOrder())return!1;const l=R(s,h.toRawBytes(),f.toRawBytes(),e);return h.add(f.multiplyUnsafe(l)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>s(r.BYTES),precompute:(t=8,e=E.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}
17
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const uo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),co=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const fo=BigInt(1),ho=BigInt(2),lo=BigInt(5),po=BigInt(10),yo=BigInt(20),go=BigInt(40),wo=BigInt(80);const bo=function(t,e,r=!1,n={}){if(t<=zi)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Qi(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Zi(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Ni(i),ZERO:zi,ONE:Mi,create:e=>qi(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return zi<=e&&e<t},is0:t=>t===zi,isOdd:t=>(t&Mi)===Mi,neg:e=>qi(-e,t),eql:(t,e)=>t===e,sqr:e=>qi(e*e,t),add:(e,r)=>qi(e+r,t),sub:(e,r)=>qi(e-r,t),mul:(e,r)=>qi(e*r,t),pow:(t,e)=>function(t,e,r){if(r<zi)throw new Error("Expected power > 0");if(r===zi)return t.ONE;if(r===Mi)return e;let n=t.ONE,i=e;for(;r>zi;)r&Mi&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Mi;return n}(a,t,e),div:(e,r)=>qi(e*Yi(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Yi(e,t),sqrt:n.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const r=new Array(e.length),n=e.reduce(((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n))),t.ONE),i=t.inv(n);return e.reduceRight(((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n))),i),r}(a,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?Ti(t,o):Pi(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return r?Li(t):function(t){return ki(xi(t))}(t)}});return Object.freeze(a)}(uo,void 0,!0),mo={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:bo,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Ei,randomBytes:function(t=32){if(ve&&"function"==typeof ve.getRandomValues)return ve.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")},adjustScalarBytes:function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function(t,e){const r=uo,n=qi(e*e*e,r),i=function(t){const e=uo,r=t*t%e*t%e,n=Xi(r,ho,e)*r%e,i=Xi(n,fo,e)*t%e,o=Xi(i,lo,e)*i%e,s=Xi(o,po,e)*o%e,a=Xi(s,yo,e)*s%e,u=Xi(a,go,e)*a%e,c=Xi(u,wo,e)*u%e,f=Xi(c,wo,e)*u%e,h=Xi(f,po,e)*o%e;return{pow_p_5_8:Xi(h,ho,e)*t%e,b2:r}}(t*qi(n*n*e,r)).pow_p_5_8;let o=qi(t*n*i,r);const s=qi(e*o*o,r),a=o,u=qi(o*co,r),c=s===t,f=s===qi(-t,r),h=s===qi(-t*co,r);return c&&(o=a),(f||h)&&(o=u),(qi(o,r)&Mi)===Mi&&(o=qi(-o,r)),{isValid:c||f,value:o}}},vo=ao(mo);const Eo=(bo.ORDER+BigInt(3))/BigInt(8);
18
18
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
19
- function Eo(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function Ao(...t){const e=t=>t,r=(t,e)=>r=>t(e(r));return{encode:t.map((t=>t.encode)).reduceRight(r,e),decode:t.map((t=>t.decode)).reduce(r,e)}}function Bo(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map((e=>{if(Eo(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]}))},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map((e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const r=t.indexOf(e);if(-1===r)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return r}))}}}function Io(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function So(t,e="="){if(Eo(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;r.length*t%8;)r.push(e);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let n=r.length;if(n*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if(!((n-1)*t%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function xo(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}wo.pow(fo,vo),wo.sqrt(wo.neg(wo.ONE)),wo.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const r=t.sqrt(e);t.isOdd(r)&&t.neg(r)}(wo,wo.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const ko=(t,e)=>e?ko(e,t%e):t,Ro=(t,e)=>t+(e-ko(t,e));function _o(t,e,r,n){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(Ro(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${Ro(e,r)}`);let i=0,o=0;const s=2**r-1,a=[];for(const n of t){if(Eo(n),n>=2**e)throw new Error(`convertRadix2: invalid data word=${n} from=${e}`);if(i=i<<e|n,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)a.push((i>>o-r&s)>>>0);i&=2**o-1}if(i=i<<r-o&s,!n&&o>=e)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&a.push(i>>>0),a}function Uo(t,e=!1){if(Eo(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(Ro(8,t)>32||Ro(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(r))throw new Error("radix2.encode input should be Uint8Array");return _o(Array.from(r),8,t,!e)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(_o(r,t,8,e))}}}function Lo(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}Uo(4),Bo("0123456789ABCDEF"),Io(""),Uo(5),Bo("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),So(5),Io(""),Uo(5),Bo("0123456789ABCDEFGHIJKLMNOPQRSTUV"),So(5),Io(""),Uo(5),Bo("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Io(""),xo((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),Uo(6),Bo("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),So(6),Io(""),Uo(6),Bo("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),So(6),Io(""),Uo(6),Bo("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Io("");const Po=Ao(Bo("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Io("")),To=[996825010,642813549,513874426,1027748829,705979059];function Co(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<To.length;t++)1==(e>>t&1)&&(r^=To[t]);return r}function Oo(t,e,r=1){const n=t.length;let i=1;for(let e=0;e<n;e++){const r=t.charCodeAt(e);if(r<33||r>126)throw new Error(`Invalid prefix (${t})`);i=Co(i)^r>>5}i=Co(i);for(let e=0;e<n;e++)i=Co(i)^31&t.charCodeAt(e);for(let t of e)i=Co(i)^t;for(let t=0;t<6;t++)i=Co(i);return i^=r,Po.encode(_o([i%2**30],30,5,!1))}function No(t){const e="bech32"===t?1:734539939,r=Uo(5),n=r.decode,i=r.encode,o=Lo(n);function s(t,r=90){if("string"!=typeof t)throw new Error("bech32.decode input should be string, not "+typeof t);if(t.length<8||!1!==r&&t.length>r)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${r})`);const n=t.toLowerCase();if(t!==n&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(t=n).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=Po.decode(s).slice(0,-6),u=Oo(o,a,e);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${t}: expected "${u}"`);return{prefix:o,words:a}}return{encode:function(t,r,n=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);const i=t.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=t.toLowerCase(),s=Oo(o,r,e);return`${o}1${Po.encode(r)}${s}`},decode:s,decodeToBytes:function(t){const{prefix:e,words:r}=s(t,!1);return{prefix:e,words:r,bytes:n(r)}},decodeUnsafe:Lo(s),fromWords:n,fromWordsUnsafe:o,toWords:i}}const Do=No("bech32");Uo(4),Bo("0123456789abcdef"),Io(""),xo((t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));const Mo=(t,e,r)=>mo.verify(e,t,r.toBytes()),Wo=(t,e)=>{const{pubkey:r}=Wn(e+"."+t,Wr.V1);return r};async function zo(t,e,r,n){const i=Wo(e,r);let{registry:o}=await ge.retrieve(t,i);if(!o.data)throw new Pt(Lt.NoRecordData);if(n)return cs(o,r,i);const s=Mr.get(r);return o.data=o.data.slice(0,s),o}async function jo(t,e,r,n){const i=r.map((t=>Wo(e,t))),o=await ge.retrieveBatch(t,i);return n?o.map(((t,n)=>{if(t)return cs(t,r[n],Wo(e,r[n]))})):o}const Fo=async(t,e)=>await zo(t,e,Dr.IPFS,!0),Vo=async(t,e)=>await zo(t,e,Dr.ARWV,!0),Ho=async(t,e)=>await zo(t,e,Dr.ETH,!0),Go=async(t,e)=>await zo(t,e,Dr.BTC,!0),qo=async(t,e)=>await zo(t,e,Dr.LTC,!0),$o=async(t,e)=>await zo(t,e,Dr.DOGE,!0),Xo=async(t,e)=>await zo(t,e,Dr.Email,!0),Yo=async(t,e)=>await zo(t,e,Dr.Url,!0),Zo=async(t,e)=>await zo(t,e,Dr.Discord,!0),Ko=async(t,e)=>await zo(t,e,Dr.Github,!0),Qo=async(t,e)=>await zo(t,e,Dr.Reddit,!0),Jo=async(t,e)=>await zo(t,e,Dr.Twitter,!0),ts=async(t,e)=>await zo(t,e,Dr.Telegram,!0),es=async(t,e)=>await zo(t,e,Dr.Pic,!0),rs=async(t,e)=>await zo(t,e,Dr.SHDW,!0),ns=async(t,e)=>await zo(t,e,Dr.SOL),is=async(t,e)=>await zo(t,e,Dr.POINT,!0),os=async(t,e)=>await zo(t,e,Dr.BSC,!0),ss=async(t,e)=>await zo(t,e,Dr.Injective,!0),as=async(t,e)=>await zo(t,e,Dr.Backpack,!0),us=async(t,e)=>await zo(t,e,Dr.Background,!0),cs=(e,r,n)=>{const i=null==e?void 0:e.data;if(!i)return;if(0===i.compare(s.Buffer.alloc(i.length)))return;const o=Mr.get(r),a=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!o){const t=i.slice(0,a).toString("utf-8");return r===Dr.CNAME||r===Dr.TXT?ui(t):t}if(r===Dr.SOL){const t=new TextEncoder,r=s.Buffer.concat([i.slice(0,32),n.toBuffer()]),o=t.encode(r.toString("hex"));if(Mo(o,i.slice(32,96),e.owner))return Kn.encode(i.slice(0,32))}if(o&&a!==o){const t=i.slice(0,a).toString("utf-8");if(r===Dr.Injective){const e=Do.decodeToBytes(t);if("inj"===e.prefix&&20===e.bytes.length)return t}else if(r===Dr.BSC||r===Dr.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===s.Buffer.from(r,"hex").length)return t}else if((r===Dr.A||r===Dr.AAAA)&&Jn.isValid(t))return t;throw new Pt(Lt.InvalidRecordData)}if(r===Dr.ETH||r===Dr.BSC)return"0x"+i.slice(0,o).toString("hex");if(r===Dr.Injective)return Do.encode("inj",Do.toWords(i.slice(0,o)));if(r===Dr.A||r===Dr.AAAA)return Jn.fromByteArray([...i.slice(0,o)]).toString();if(r===Dr.Background)return new t(i.slice(0,o)).toString();throw new Pt(Lt.InvalidRecordData)},fs=(e,r)=>{if(!Mr.get(r))return r!==Dr.CNAME&&r!==Dr.TXT||(e=ci(e)),s.Buffer.from(e,"utf-8");if(r===Dr.SOL)throw new Pt(Lt.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===Dr.ETH||r===Dr.BSC)return Gn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),s.Buffer.from(e.slice(2),"hex");if(r===Dr.Injective){const t=Do.decodeToBytes(e);return Gn("inj"===t.prefix,Lt.InvalidInjectiveAddress),Gn(20===t.bytes.length,Lt.InvalidInjectiveAddress),s.Buffer.from(t.bytes)}if(r===Dr.A){const t=Jn.parse(e).toByteArray();return Gn(4===t.length,Lt.InvalidARecord),s.Buffer.from(t)}if(r===Dr.AAAA){const t=Jn.parse(e).toByteArray();return Gn(16===t.length,Lt.InvalidAAAARecord),s.Buffer.from(t)}if(r===Dr.Background)return new t(e).toBuffer();throw new Pt(Lt.InvalidRecordInput)},hs=(t,e,r,n)=>{const i=s.Buffer.concat([t.toBuffer(),e.toBuffer()]),o=(new TextEncoder).encode(i.toString("hex")),a=Mo(o,n,r);return Gn(a,Lt.InvalidSignature),s.Buffer.concat([t.toBuffer(),n])},ds=new Map([[Dr.Url,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[Dr.CNAME,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),ls=new Set([Dr.ETH,Dr.Injective,Dr.BSC]),ps=async(t,e,r,n)=>{var i;const o=ms(r,e),s=await Nr.retrieve(t,o),a=s.getRoAId(),u=ls.has(e)?Pr.Ethereum:Pr.Solana;if(!(n=null!=n?n:null===(i=ds.get(e))||void 0===i?void 0:i.toBuffer()))throw new Pt(Lt.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===u},ys=new Set([Dr.IPFS,Dr.ARWV,Dr.LTC,Dr.DOGE,Dr.Email,Dr.Url,Dr.Discord,Dr.Github,Dr.Reddit,Dr.Twitter,Dr.Telegram,Dr.Pic,Dr.SHDW,Dr.POINT,Dr.Backpack,Dr.TXT,Dr.CNAME,Dr.BTC]),gs=new Set([Dr.ETH,Dr.Injective,Dr.SOL]),ws=(e,r)=>{if(ys.has(r)){const t=e.toString("utf-8");return r===Dr.CNAME||r===Dr.TXT?ui(t):t}if(r===Dr.SOL)return new t(e).toBase58();if(r===Dr.ETH||r===Dr.BSC)return"0x"+e.toString("hex");if(r===Dr.Injective)return Do.encode("inj",Do.toWords(e));if(r===Dr.A||r===Dr.AAAA)return Jn.fromByteArray([...e]).toString();throw new Pt(Lt.InvalidARecord)},bs=(e,r)=>{if(ys.has(r))return r!==Dr.CNAME&&r!==Dr.TXT||(e=ci(e)),Buffer.from(e,"utf-8");if(r===Dr.SOL)return new t(e).toBuffer();if(r===Dr.ETH||r===Dr.BSC)return Gn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===Dr.Injective){const t=Do.decodeToBytes(e);return Gn("inj"===t.prefix,Lt.InvalidInjectiveAddress),Gn(20===t.bytes.length,Lt.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===Dr.A){const t=Jn.parse(e).toByteArray();return Gn(4===t.length,Lt.InvalidARecord),Buffer.from(t)}if(r===Dr.AAAA){const t=Jn.parse(e).toByteArray();return Gn(16===t.length,Lt.InvalidAAAARecord),Buffer.from(t)}throw new Pt(Lt.InvalidARecord)},ms=(t,e)=>{const{pubkey:r}=Wn(t),n=Tn("".concat(e));return Cn(n,Lr,r)};async function vs(t,e,r,n={}){const i=ms(e,r),o=await Nr.retrieve(t,i);return n.deserialize?{retrievedRecord:o,deserializedContent:ws(o.getContent(),r)}:{retrievedRecord:o}}async function Es(t,e,r,n={}){const i=r.map((t=>ms(e,t))),o=await Nr.retrieveBatch(t,i);return n.deserialize?o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:ws(t.getContent(),r[e])}})):o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))}async function As(t,r,n,i,o,s,a,u){const c=Tn(r),f=Cn(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await rr(t,u);d=e.owner}return Zt(Oe,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}async function Bs(t,e,r,n,i,o){const s=Tn(e),a=Cn(s,i,o);let u;u=i||(await ge.retrieve(t,a)).registry.owner;return Kt(Oe,a,new Tt(r),n,u)}async function Is(t,e,r,n,i,o){const s=Tn(e),a=Cn(s,n,i);let u;u=n||(await ge.retrieve(t,a)).registry.owner;return Qt(Oe,a,r,u,n,i,o)}async function Ss(t,e,r,n,i){const o=Tn(e),s=Cn(o,n,i);let a;a=n||(await ge.retrieve(t,s)).registry.owner;return Jt(Oe,s,r,a)}const xs=async(r,i,o,s,a,u=qe,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([Me.toBuffer()],Me),h=Tn(i),d=Cn(h,void 0,De),l=Tn(d.toBase58()),p=Cn(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],Me),w=$e.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,Qe,!0),E=Ye.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(Me,Oe,De,d,p,e.programId,f,s,a,Ze,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},ks=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([Me.toBuffer()],Me),c=Tn(r.toBase58()),f=Cn(c,u,s);return[[],[new ee({name:i}).getInstruction(Me,Oe,De,f,e.programId,u,o,n,s,a)]]},Rs=async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=Wn(e),u=await t.getMinimumBalanceForRentExemption(n+ge.HEADER_LEN),c=await As(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=Vn(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await ks(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},_s=async(t,r,n,i,o,s)=>{Gn(n!==Dr.SOL,Lt.UnsupportedRecord);const{pubkey:a,hashed:u,parent:c}=Wn(`${n}.${r}`,Wr.V1),f=fs(i,n).length,h=await t.getMinimumBalanceForRentExemption(f+ge.HEADER_LEN);return Zt(Oe,e.programId,a,o,s,u,new Ct(h),new Tt(f),void 0,c,o)},Us=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Wn(`${r}.${t}`,Wr.V2);if(u&&(a=Wn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Ir({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Lr))(o,s,a,i,Oe,"".concat(r),bs(n,r),Ur);return c},Ls=async(t,e,r,n,i,o)=>{Gn(r!==Dr.SOL,Lt.UnsupportedRecord);const{pubkey:s}=Wn(`${r}.${e}`,Wr.V1),a=await t.getAccountInfo(s);Gn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist);const u=fs(n,r);if((null==a?void 0:a.data.slice(96).length)!==u.length)return[Jt(Oe,s,o,i),await _s(t,e,r,n,i,o)];return[Kt(Oe,s,new Tt(0),u,i)]},Ps=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Wn(`${r}.${t}`,Wr.V2);if(u&&(a=Wn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new kr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Lr))(o,s,a,i,Oe,"".concat(r),bs(n,r),Ur);return c},Ts=(t,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=Wn(`${r}.${t}`,Wr.V2);if(a&&(s=Wn(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,r,n,i,o,s)=>(new Rr).getInstruction(s,e.programId,o,t,i,r,n,Lr))(i,s,n,o,Oe,Ur);return u},Cs=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Wn(`${n}.${r}`,Wr.V2);if(c&&(u=Wn(r).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u)=>new xr({staleness:a}).getInstruction(u,e.programId,s,t,r,n,i,Lr,o))(o,a,u,i,s,Oe,t,Ur);return f},Os=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Wn(`${r}.${t}`,Wr.V2);if(u&&(a=Wn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a)=>new _r({roaId:Array.from(s.toBuffer())}).getInstruction(a,e.programId,r,t,n,i,o,Lr))(i,Oe,s,a,n,o,Ur);return c},Ns=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Wn(`${r}.${t}`,Wr.V2);if(c&&(u=Wn(t).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u,c)=>new Sr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(u)}).getInstruction(c,e.programId,o,t,r,n,i,Lr))(i,a,u,n,Oe,Pr.Ethereum,o,s,Ur);return f},Ds=async(t,r,n,i,o,s)=>{const{pubkey:a,hashed:u,parent:c}=Wn(`${Dr.SOL}.${r}`,Wr.V1),f=hs(n,a,i,o).length,h=await t.getMinimumBalanceForRentExemption(f+ge.HEADER_LEN);return[Zt(Oe,e.programId,a,i,s,u,new Ct(h),new Tt(f),void 0,c,i)]},Ms=async(t,e,r,n,i,o)=>{const{pubkey:s}=Wn(`${Dr.SOL}.${e}`,Wr.V1),a=await t.getAccountInfo(s);if(Gn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Jt(Oe,s,o,n),await Ds(t,e,r,n,i,o)];const u=hs(r,s,n,i);return[Kt(Oe,s,new Tt(0),u,n)]},Ws=(r,n,i)=>{const{pubkey:o}=Wn(r),[s]=t.findProgramAddressSync([o.toBuffer()],Me),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Me);return(new ie).getInstruction(Me,Oe,e.programId,o,Vn(r),a,s,je,n,i)},zs=(r,i,o,s,a,u,c,f,h)=>{const[d]=t.findProgramAddressSync([o.toBuffer()],Me);return new ne({space:i,name:r}).getInstruction(Me,Oe,De,o,s,e.programId,je,a,u,c,f,h,tr,g,n,d,er)},js=async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=Wn(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await ge.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await ge.retrieve(t,a)).registry.owner);return Qt(Oe,o,r,i,void 0,u,c)};async function Fs(t,r,n,i,o){const s=Tn(r),a=Cn(s,void 0,Ve),u=await t.getMinimumBalanceForRentExemption(i+ge.HEADER_LEN);let c=[Zt(Oe,e.programId,a,n,o,s,new Ct(u),new Tt(i),void 0,Ve,Fe)];return c=c.concat(await Qs(t,r,a,n,o)),c}async function Vs(t,e,r,n){const i=Tn(t),o=Cn(i,void 0,Ve);return[Kt(Oe,o,new Tt(r),n,e)]}async function Hs(t,e,r,n,i){const o=Tn(e),s=Cn(o,void 0,Ve);let a=[Qt(Oe,s,n,r,void 0)];return a.push(await Ss(t,r.toString(),i,Fe,Ve)),a=a.concat(await Qs(t,e,s,n,i)),a}async function Gs(t,e){const r=Tn(t),n=Cn(r,void 0,Ve),i=Tn(e.toString()),o=Cn(i,Fe,Ve);return[Jt(Oe,n,e,e),Jt(Oe,o,e,e)]}async function qs(t){const e=Tn(t);return Cn(e,void 0,Ve)}async function $s(t,e){const r=Tn(e),n=Cn(r,void 0,Ve),{registry:i}=await ge.retrieve(t,n);return i}async function Xs(e,r){const n=Tn(r.toString()),i=Cn(n,Fe,Ve);let o=await Ks.retrieve(e,i);return[o.twitterHandle,new t(o.twitterRegistryKey)]}async function Ys(e,r){const n=[{memcmp:{offset:0,bytes:Ve.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Fe.toBase58()}}],i=await e.getProgramAccounts(Oe,{filters:n});for(const e of i)if(e.account.data.length>ge.HEADER_LEN+32){const r=e.account.data.slice(ge.HEADER_LEN),n=new Ks(Yt(Ks.schema,r));return[n.twitterHandle,new t(n.twitterRegistryKey)]}throw new Pt(Lt.AccountDoesNotExist)}async function Zs(e,r){const n=[{memcmp:{offset:0,bytes:Ve.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t(s.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(Oe,{filters:n});if(i.length>1)throw new Pt(Lt.MultipleRegistries);return i[0].account.data.slice(ge.HEADER_LEN)}class Ks{constructor(t){this.twitterRegistryKey=t.twitterRegistryKey,this.twitterHandle=t.twitterHandle}static async retrieve(t,e){let r=await t.getAccountInfo(e,"processed");if(!r)throw new Pt(Lt.InvalidReverseTwitter);return new Ks(Yt(Ks.schema,r.data.slice(ge.HEADER_LEN)))}}async function Qs(t,r,n,i,o){const a=Tn(i.toString()),u=Cn(a,Fe,Ve);let c=Xt(Ks.schema,new Ks({twitterRegistryKey:n.toBytes(),twitterHandle:r}));return[Zt(Oe,e.programId,u,i,o,a,new Ct(await t.getMinimumBalanceForRentExemption(c.length+ge.HEADER_LEN)),new Tt(c.length),Fe,Ve,Fe),Kt(Oe,u,new Tt(0),s.Buffer.from(c),Fe)]}Ks.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}};const Js=new t("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class ta{constructor(e){this.tag=e.tag,this.nameAccount=new t(e.nameAccount)}static deserialize(t){return new ta(Yt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Pt(Lt.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(e,r){return await t.findProgramAddress([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}static getKeySync(e,r){return t.findProgramAddressSync([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}}ta.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};const ea=async(e,r)=>{const[n]=ta.getKeySync(Js,new t(r)),i=await ta.retrieve(e,n),o=await On(e,i.nameAccount),{registry:s,nftOwner:a}=await ge.retrieve(e,i.nameAccount),u=a||s.owner;return{domain:i.nameAccount,reverse:o,stale:!r.equals(u)}},ra=async(e,r)=>{const n=[],i=r.map((t=>ta.getKeySync(Js,t)[0])),o=(await e.getMultipleAccountsInfo(i)).map((e=>(null==e?void 0:e.data)?ta.deserialize(null==e?void 0:e.data).nameAccount:t.default)),s=o.map((t=>Hn(t))),a=o.map(((t,e)=>_t(ue(t),r[e],!0))),[u,c,f]=await Promise.all([e.getMultipleAccountsInfo(o),e.getMultipleAccountsInfo(s),e.getMultipleAccountsInfo(a)]);for(let e=0;e<r.length;e++){const i=u[e],o=c[e],s=f[e];if(!i||!o){n.push(void 0);continue}if(new t(null==i?void 0:i.data.slice(32,64)).equals(r[e])){n.push(Xn(null==o?void 0:o.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=It.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Xn(null==o?void 0:o.data.slice(96)))}return n};var na;!function(t){t.DegenPoet1="DegenPoet#1",t.Rgb0x001="rgb0x00#1"}(na||(na={}));const ia=async(t,e)=>{const{pubkey:r}=Wn(e),{registry:n,nftOwner:i}=await ge.retrieve(t,r);if(i)return i;try{const r=await sa(t,n.owner,e);if(void 0!==r)return r;return await oa(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},oa=async(e,r,n)=>{const i=Wo(n,Dr.SOL),o=await ns(e,n);if(!(null==o?void 0:o.data))throw new Pt(Lt.NoRecordData);const a=new TextEncoder,u=s.Buffer.concat([o.data.slice(0,32),i.toBuffer()]),c=a.encode(u.toString("hex"));if(!Mo(c,o.data.slice(32),r))throw new Pt(Lt.InvalidSignature);return new t(o.data.slice(0,32))},sa=async(e,r,n)=>{try{const i=ms(n,Dr.SOL),o=await Nr.retrieve(e,i),s=o.getStalenessId(),a=o.getRoAId(),u=o.getContent();if(0===s.compare(r.toBuffer())&&o.header.stalenessValidation===Pr.Solana&&0===a.compare(u)&&o.header.rightOfAssociationValidation===Pr.Solana)return new t(u)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},aa=new t("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),ua=new t("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),ca=(t,e)=>{const r=Tn(e),n=Tn(t),i=Cn(n,void 0,Je);return{domainKey:i,bgKey:Cn(r,void 0,i)}},fa=t=>{switch(t){case na.DegenPoet1:return aa;case na.Rgb0x001:return ua;default:throw new Pt(Lt.InvalidCustomBg)}},ha=async(e,r,n)=>{const i=ms(n,r),{registry:o,nftOwner:s}=await ge.retrieve(e,Wn(n).pubkey),a=s||o.owner,u=await Nr.retrieve(e,i),c=u.getStalenessId();return(null==a?void 0:a.equals(new t(c)))&&u.header.stalenessValidation===Pr.Solana},da={NAME_PROGRAM_ID:new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new t("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new t("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new t("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new t("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1")],TOKENS_SYM_MINT:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU","USDC"],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS","USDT"],["So11111111111111111111111111111111111111112","SOL"],["fidaWCioBQjieRrUQDxxS5Uxmq1CLi2VuVRyv4dEBey","FIDA"],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P","INJ"]]),PYTH_FEEDS:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",{price:"5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7",product:"6NpdXrQEpmDZ3jZKmM2rhdmkd3H6QAk23j2x8bkXcHKA"}],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS",{price:"38xoQ4oeJCBrcVvca2cGk7iV1dAfrmTR1kmhSCJQ8Jto",product:"C5wDxND9E61RZ1wZhaSTWkoA8udumaHnoQY6BBsiaVpn"}],["So11111111111111111111111111111111111111112",{price:"J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix",product:"3Mnn2fX6rQyUsyELYms1sBJyChWofzSNRoqYzvgMVz5E"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"7teETxN9Y8VK6uJxsctHEwST75mKLLwPH1jaFdvTQCpD",product:"5kWV4bhHeZANzg5MWaYCQYEEKHjur5uz1mu5vuLHwiLB"}],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P",{price:"44uRsNnT35kjkscSu59MxRr9CfkLZWf6gny8bWqUbVxE",product:"7UHB783Nh4avW3Yw9yoktf2KjxipU56KPahA51RnCCYE"}]]),PYTH_MAPPING_ACC:new t("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new t("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},la=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,da.NAME_PROGRAM_ID);return o},pa=(t,e=da.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Tn(t);return{pubkey:la(n,r,e),hashed:n}},ya=t=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const e=t.split(".");if(2===e.length){const t="\0".concat(e[0]),{pubkey:r}=pa(e[1]);return{...pa(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new Pt(Lt.InvalidInput);return{...pa(t,da.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ga=(t,e)=>{const{pubkey:r,parent:n}=ya(t),i=Tn(r.toBase58());return la(i,da.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function wa(t,r,n,i,o,s,a,u){const c=await nr(r),f=await la(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await rr(t,u);d=e.owner}return Zt(da.NAME_PROGRAM_ID,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}const ba=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([da.REGISTER_PROGRAM_ID.toBuffer()],da.REGISTER_PROGRAM_ID),c=await nr(r.toBase58()),f=la(c,u,s);return[[],[new ee({name:i}).getInstruction(da.REGISTER_PROGRAM_ID,da.NAME_PROGRAM_ID,da.ROOT_DOMAIN_ACCOUNT,f,e.programId,u,o,n,s,a)]]},ma={utils:{getNameAccountKeySync:la,reverseLookup:async(t,e)=>{const r=Tn(e.toBase58()),n=la(r,da.REVERSE_LOOKUP_CLASS),{registry:i}=await ge.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Xn(i.data)},_deriveSync:pa,getDomainKeySync:ya,getReverseKeySync:ga},constants:da,bindings:{createNameRegistry:wa,updateNameRegistryData:async function(t,e,r,n,i,o){const s=await nr(e),a=la(s,i,o);let u;return u=i||(await ge.retrieve(t,a)).registry.owner,Kt(da.NAME_PROGRAM_ID,a,new Tt(r),n,u)},transferNameOwnership:async function(t,e,r,n,i,o){const s=await nr(e),a=la(s,n,i);let u;return u=n||(await ge.retrieve(t,a)).registry.owner,Qt(da.NAME_PROGRAM_ID,a,r,u,n,i,o)},deleteNameRegistry:async function(t,e,r,n,i){const o=await nr(e),s=la(o,n,i);let a;return a=n||(await ge.retrieve(t,s)).registry.owner,Jt(da.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(r,i,o,s,a,u=da.USDC_MINT,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([da.REGISTER_PROGRAM_ID.toBuffer()],da.REGISTER_PROGRAM_ID),h=Tn(i),d=la(h,void 0,da.ROOT_DOMAIN_ACCOUNT),l=Tn(d.toBase58()),p=la(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],da.REGISTER_PROGRAM_ID),w=da.REFERRERS.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,da.VAULT_OWNER),E=ma.constants.PYTH_FEEDS.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(da.REGISTER_PROGRAM_ID,da.NAME_PROGRAM_ID,da.ROOT_DOMAIN_ACCOUNT,d,p,e.programId,f,s,a,da.PYTH_MAPPING_ACC,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},createReverseName:ba,createSubdomain:async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=ya(e),u=await t.getMinimumBalanceForRentExemption(n+ge.HEADER_LEN),c=await wa(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=ga(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await ba(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},burnDomain:(r,n,i)=>{const{pubkey:o}=ya(r),[s]=t.findProgramAddressSync([o.toBuffer()],da.REGISTER_PROGRAM_ID),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],da.REGISTER_PROGRAM_ID);return(new ie).getInstruction(da.REGISTER_PROGRAM_ID,da.NAME_PROGRAM_ID,e.programId,o,ga(r),a,s,da.REVERSE_LOOKUP_CLASS,n,i)},transferSubdomain:async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=ya(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await ge.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await ge.retrieve(t,a)).registry.owner);return Qt(da.NAME_PROGRAM_ID,o,r,i,void 0,u,c)}}};export{ze as BONFIDA_FIDA_BNB,Ge as BONFIDA_USDC_BNB,Je as CUSTOM_BG_TLD,na as CustomBg,ls as ETH_ROA_RECORDS,Lt as ErrorType,ta as FavouriteDomain,ds as GUARDIANS,Ne as HASH_PREFIX,er as METAPLEX_ID,Js as NAME_OFFERS_ID,Oe as NAME_PROGRAM_ID,ge as NameRegistryState,Tt as Numberu32,Ct as Numberu64,Ye as PYTH_FEEDS,We as PYTH_FIDA_PRICE_ACC,Ze as PYTH_MAPPING_ACC,Mr as RECORD_V1_SIZE,$e as REFERRERS,Me as REGISTER_PROGRAM_ID,je as REVERSE_LOOKUP_CLASS,De as ROOT_DOMAIN_ACCOUNT,Dr as Record,Wr as RecordVersion,Ks as ReverseTwitterRegistryState,gs as SELF_SIGNED,Pt as SNSError,He as SOL_RECORD_SIG_LEN,Xe as TOKENS_SYM_MINT,Ve as TWITTER_ROOT_PARENT_REGISTRY_KEY,Fe as TWITTER_VERIFICATION_AUTHORITY,qe as USDC_MINT,ys as UTF8_ENCODED,Qe as VAULT_OWNER,Ke as VAULT_OWNER_DEPRECATED,tr as WOLVES_COLLECTION_METADATA,Ws as burnDomain,ie as burnInstruction,Vs as changeTwitterRegistryData,Hs as changeVerifiedPubkey,Gn as check,Mo as checkSolRecord,Zt as createInstruction,re as createInstructionV3,As as createNameRegistry,_s as createRecordInstruction,Us as createRecordV2Instruction,ee as createReverseInstruction,ks as createReverseName,Qs as createReverseTwitterRegistry,Ds as createSolRecordInstruction,Rs as createSubdomain,te as createV2Instruction,Fs as createVerifiedTwitterRegistry,ne as createWithNftInstruction,Jt as deleteInstruction,Ss as deleteNameRegistry,Ts as deleteRecordV2,Gs as deleteTwitterRegistry,cs as deserializeRecord,ws as deserializeRecordV2Content,Xn as deserializeReverse,ma as devnet,Ns as ethValidateRecordV2Content,Dn as findSubdomains,zn as getAllDomains,Fn as getAllRegisteredDomains,fa as getArtistPubkey,Vo as getArweaveRecord,us as getBackgroundRecord,as as getBackpackRecord,os as getBscRecord,Go as getBtcRecord,ca as getCustomBgKeys,Zo as getDiscordRecord,$o as getDogeRecord,ur as getDomainKey,Wn as getDomainKeySync,jn as getDomainKeysWithReverses,ue as getDomainMint,$n as getDomainPriceFromName,Xo as getEmailRecord,Ho as getEthRecord,ea as getFavoriteDomain,Ko as getGithubRecord,Xs as getHandleAndRegistryKey,nr as getHashedName,Tn as getHashedNameSync,ss as getInjectiveRecord,Fo as getIpfsRecord,qo as getLtcRecord,ra as getMultipleFavoriteDomains,Es as getMultipleRecordsV2,ir as getNameAccountKey,Cn as getNameAccountKeySync,rr as getNameOwner,es as getPicRecord,is as getPointRecord,zo as getRecord,Wo as getRecordKeySync,vs as getRecordV2,ms as getRecordV2Key,jo as getRecords,Qo as getRedditRecord,cr as getReverseKey,Hn as getReverseKeyFromDomainKey,Vn as getReverseKeySync,rs as getShdwRecord,ns as getSolRecord,ts as getTelegramRecord,qn as getTokenizedDomains,Ys as getTwitterHandleandRegistryKeyViaFilters,Jo as getTwitterRecord,$s as getTwitterRegistry,Zs as getTwitterRegistryData,qs as getTwitterRegistryKey,Yo as getUrlRecord,or as performReverseLookup,sr as performReverseLookupBatch,oe as reallocInstruction,xs as registerDomainName,zs as registerWithNft,ia as resolve,oa as resolveSolRecordV1,sa as resolveSolRecordV2,he as retrieveNftOwner,de as retrieveNfts,ye as retrieveRecords,On as reverseLookup,Nn as reverseLookupBatch,fs as serializeRecord,bs as serializeRecordV2Content,hs as serializeSolRecord,Qt as transferInstruction,Is as transferNameOwnership,js as transferSubdomain,Kt as updateInstruction,Bs as updateNameRegistryData,Ls as updateRecordInstruction,Ps as updateRecordV2Instruction,Ms as updateSolRecordInstruction,Cs as validateRecordV2Content,ps as verifyRightOfAssociation,ha as verifyStaleness,Os as writRoaRecordV2};
19
+ function Ao(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function Bo(...t){const e=t=>t,r=(t,e)=>r=>t(e(r));return{encode:t.map((t=>t.encode)).reduceRight(r,e),decode:t.map((t=>t.decode)).reduce(r,e)}}function Io(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map((e=>{if(Ao(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]}))},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map((e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const r=t.indexOf(e);if(-1===r)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return r}))}}}function So(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function xo(t,e="="){if(Ao(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;r.length*t%8;)r.push(e);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let n=r.length;if(n*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if(!((n-1)*t%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function ko(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}bo.pow(ho,Eo),bo.sqrt(bo.neg(bo.ONE)),bo.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const r=t.sqrt(e);t.isOdd(r)&&t.neg(r)}(bo,bo.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ro=(t,e)=>e?Ro(e,t%e):t,_o=(t,e)=>t+(e-Ro(t,e));function Uo(t,e,r,n){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(_o(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${_o(e,r)}`);let i=0,o=0;const s=2**r-1,a=[];for(const n of t){if(Ao(n),n>=2**e)throw new Error(`convertRadix2: invalid data word=${n} from=${e}`);if(i=i<<e|n,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)a.push((i>>o-r&s)>>>0);i&=2**o-1}if(i=i<<r-o&s,!n&&o>=e)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&a.push(i>>>0),a}function Lo(t,e=!1){if(Ao(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(_o(8,t)>32||_o(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!function(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}(r))throw new Error("radix2.encode input should be Uint8Array");return Uo(Array.from(r),8,t,!e)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(Uo(r,t,8,e))}}}function Po(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}Lo(4),Io("0123456789ABCDEF"),So(""),Lo(5),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),xo(5),So(""),Lo(5),Io("0123456789ABCDEFGHIJKLMNOPQRSTUV"),xo(5),So(""),Lo(5),Io("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),So(""),ko((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),Lo(6),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),xo(6),So(""),Lo(6),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),xo(6),So(""),Lo(6),Io("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),So("");const To=Bo(Io("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),So("")),Co=[996825010,642813549,513874426,1027748829,705979059];function Oo(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<Co.length;t++)1==(e>>t&1)&&(r^=Co[t]);return r}function No(t,e,r=1){const n=t.length;let i=1;for(let e=0;e<n;e++){const r=t.charCodeAt(e);if(r<33||r>126)throw new Error(`Invalid prefix (${t})`);i=Oo(i)^r>>5}i=Oo(i);for(let e=0;e<n;e++)i=Oo(i)^31&t.charCodeAt(e);for(let t of e)i=Oo(i)^t;for(let t=0;t<6;t++)i=Oo(i);return i^=r,To.encode(Uo([i%2**30],30,5,!1))}function Do(t){const e="bech32"===t?1:734539939,r=Lo(5),n=r.decode,i=r.encode,o=Po(n);function s(t,r=90){if("string"!=typeof t)throw new Error("bech32.decode input should be string, not "+typeof t);if(t.length<8||!1!==r&&t.length>r)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${r})`);const n=t.toLowerCase();if(t!==n&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(t=n).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=To.decode(s).slice(0,-6),u=No(o,a,e);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${t}: expected "${u}"`);return{prefix:o,words:a}}return{encode:function(t,r,n=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);const i=t.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=t.toLowerCase(),s=No(o,r,e);return`${o}1${To.encode(r)}${s}`},decode:s,decodeToBytes:function(t){const{prefix:e,words:r}=s(t,!1);return{prefix:e,words:r,bytes:n(r)}},decodeUnsafe:Po(s),fromWords:n,fromWordsUnsafe:o,toWords:i}}const Wo=Do("bech32");Lo(4),Io("0123456789abcdef"),So(""),ko((t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));const zo=(t,e,r)=>vo.verify(e,t,r.toBytes()),Mo=(t,e)=>{const{pubkey:r}=Mn(e+"."+t,Mr.V1);return r};async function jo(t,e,r,n){const i=Mo(e,r);let{registry:o}=await we.retrieve(t,i);if(!o.data)throw new Pt(Lt.NoRecordData);if(n)return fs(o,r,i);const s=zr.get(r);return o.data=o.data.slice(0,s),o}async function Vo(t,e,r,n){const i=r.map((t=>Mo(e,t))),o=await we.retrieveBatch(t,i);return n?o.map(((t,n)=>{if(t)return fs(t,r[n],Mo(e,r[n]))})):o}const Fo=async(t,e)=>await jo(t,e,Wr.IPFS,!0),Ho=async(t,e)=>await jo(t,e,Wr.ARWV,!0),Go=async(t,e)=>await jo(t,e,Wr.ETH,!0),qo=async(t,e)=>await jo(t,e,Wr.BTC,!0),$o=async(t,e)=>await jo(t,e,Wr.LTC,!0),Xo=async(t,e)=>await jo(t,e,Wr.DOGE,!0),Yo=async(t,e)=>await jo(t,e,Wr.Email,!0),Zo=async(t,e)=>await jo(t,e,Wr.Url,!0),Ko=async(t,e)=>await jo(t,e,Wr.Discord,!0),Qo=async(t,e)=>await jo(t,e,Wr.Github,!0),Jo=async(t,e)=>await jo(t,e,Wr.Reddit,!0),ts=async(t,e)=>await jo(t,e,Wr.Twitter,!0),es=async(t,e)=>await jo(t,e,Wr.Telegram,!0),rs=async(t,e)=>await jo(t,e,Wr.Pic,!0),ns=async(t,e)=>await jo(t,e,Wr.SHDW,!0),is=async(t,e)=>await jo(t,e,Wr.SOL),os=async(t,e)=>await jo(t,e,Wr.POINT,!0),ss=async(t,e)=>await jo(t,e,Wr.BSC,!0),as=async(t,e)=>await jo(t,e,Wr.Injective,!0),us=async(t,e)=>await jo(t,e,Wr.Backpack,!0),cs=async(t,e)=>await jo(t,e,Wr.Background,!0),fs=(e,r,n)=>{const i=null==e?void 0:e.data;if(!i)return;if(0===i.compare(s.Buffer.alloc(i.length)))return;const o=zr.get(r),a=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!o){const t=i.slice(0,a).toString("utf-8");return r===Wr.CNAME||r===Wr.TXT?ci(t):t}if(r===Wr.SOL){const t=new TextEncoder,r=s.Buffer.concat([i.slice(0,32),n.toBuffer()]),o=t.encode(r.toString("hex"));if(zo(o,i.slice(32,96),e.owner))return Qn.encode(i.slice(0,32))}if(o&&a!==o){const t=i.slice(0,a).toString("utf-8");if(r===Wr.Injective){const e=Wo.decodeToBytes(t);if("inj"===e.prefix&&20===e.bytes.length)return t}else if(r===Wr.BSC||r===Wr.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===s.Buffer.from(r,"hex").length)return t}else if((r===Wr.A||r===Wr.AAAA)&&ti.isValid(t))return t;throw new Pt(Lt.InvalidRecordData)}if(r===Wr.ETH||r===Wr.BSC)return"0x"+i.slice(0,o).toString("hex");if(r===Wr.Injective)return Wo.encode("inj",Wo.toWords(i.slice(0,o)));if(r===Wr.A||r===Wr.AAAA)return ti.fromByteArray([...i.slice(0,o)]).toString();if(r===Wr.Background)return new t(i.slice(0,o)).toString();throw new Pt(Lt.InvalidRecordData)},hs=(e,r)=>{if(!zr.get(r))return r!==Wr.CNAME&&r!==Wr.TXT||(e=fi(e)),s.Buffer.from(e,"utf-8");if(r===Wr.SOL)throw new Pt(Lt.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===Wr.ETH||r===Wr.BSC)return qn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),s.Buffer.from(e.slice(2),"hex");if(r===Wr.Injective){const t=Wo.decodeToBytes(e);return qn("inj"===t.prefix,Lt.InvalidInjectiveAddress),qn(20===t.bytes.length,Lt.InvalidInjectiveAddress),s.Buffer.from(t.bytes)}if(r===Wr.A){const t=ti.parse(e).toByteArray();return qn(4===t.length,Lt.InvalidARecord),s.Buffer.from(t)}if(r===Wr.AAAA){const t=ti.parse(e).toByteArray();return qn(16===t.length,Lt.InvalidAAAARecord),s.Buffer.from(t)}if(r===Wr.Background)return new t(e).toBuffer();throw new Pt(Lt.InvalidRecordInput)},ds=(t,e,r,n)=>{const i=s.Buffer.concat([t.toBuffer(),e.toBuffer()]),o=(new TextEncoder).encode(i.toString("hex")),a=zo(o,n,r);return qn(a,Lt.InvalidSignature),s.Buffer.concat([t.toBuffer(),n])},ls=new Map([[Wr.Url,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[Wr.CNAME,new t("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),ps=new Set([Wr.ETH,Wr.Injective,Wr.BSC]),ys=async(t,e,r,n)=>{var i;const o=vs(r,e),s=await Dr.retrieve(t,o),a=s.getRoAId(),u=ps.has(e)?Tr.Ethereum:Tr.Solana;if(!(n=null!=n?n:null===(i=ls.get(e))||void 0===i?void 0:i.toBuffer()))throw new Pt(Lt.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===u},gs=new Set([Wr.IPFS,Wr.ARWV,Wr.LTC,Wr.DOGE,Wr.Email,Wr.Url,Wr.Discord,Wr.Github,Wr.Reddit,Wr.Twitter,Wr.Telegram,Wr.Pic,Wr.SHDW,Wr.POINT,Wr.Backpack,Wr.TXT,Wr.CNAME,Wr.BTC]),ws=new Set([Wr.ETH,Wr.Injective,Wr.SOL]),bs=(e,r)=>{if(gs.has(r)){const t=e.toString("utf-8");return r===Wr.CNAME||r===Wr.TXT?ci(t):t}if(r===Wr.SOL)return new t(e).toBase58();if(r===Wr.ETH||r===Wr.BSC)return"0x"+e.toString("hex");if(r===Wr.Injective)return Wo.encode("inj",Wo.toWords(e));if(r===Wr.A||r===Wr.AAAA)return ti.fromByteArray([...e]).toString();throw new Pt(Lt.InvalidARecord)},ms=(e,r)=>{if(gs.has(r))return r!==Wr.CNAME&&r!==Wr.TXT||(e=fi(e)),Buffer.from(e,"utf-8");if(r===Wr.SOL)return new t(e).toBuffer();if(r===Wr.ETH||r===Wr.BSC)return qn("0x"===e.slice(0,2),Lt.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===Wr.Injective){const t=Wo.decodeToBytes(e);return qn("inj"===t.prefix,Lt.InvalidInjectiveAddress),qn(20===t.bytes.length,Lt.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===Wr.A){const t=ti.parse(e).toByteArray();return qn(4===t.length,Lt.InvalidARecord),Buffer.from(t)}if(r===Wr.AAAA){const t=ti.parse(e).toByteArray();return qn(16===t.length,Lt.InvalidAAAARecord),Buffer.from(t)}throw new Pt(Lt.InvalidARecord)},vs=(t,e)=>{const{pubkey:r}=Mn(t),n=Cn("".concat(e));return On(n,Pr,r)};async function Es(t,e,r,n={}){const i=vs(e,r),o=await Dr.retrieve(t,i);return n.deserialize?{retrievedRecord:o,deserializedContent:bs(o.getContent(),r)}:{retrievedRecord:o}}async function As(t,e,r,n={}){const i=r.map((t=>vs(e,t))),o=await Dr.retrieveBatch(t,i);return n.deserialize?o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:bs(t.getContent(),r[e])}})):o.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))}const Bs=new t("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Is{constructor(e){this.tag=e.tag,this.nameAccount=new t(e.nameAccount)}static deserialize(t){return new Is(Yt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new Pt(Lt.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(e,r){return await t.findProgramAddress([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}static getKeySync(e,r){return t.findProgramAddressSync([s.Buffer.from("favourite_domain"),r.toBuffer()],e)}}Is.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};const Ss=async(e,r)=>{const[n]=Is.getKeySync(Bs,new t(r)),i=await Is.retrieve(e,n),o=await Nn(e,i.nameAccount),{registry:s,nftOwner:a}=await we.retrieve(e,i.nameAccount),u=a||s.owner;return{domain:i.nameAccount,reverse:o,stale:!r.equals(u)}},xs=async(e,r)=>{const n=[],i=r.map((t=>Is.getKeySync(Bs,t)[0])),o=(await e.getMultipleAccountsInfo(i)).map((e=>(null==e?void 0:e.data)?Is.deserialize(null==e?void 0:e.data).nameAccount:t.default)),s=o.map((t=>Gn(t))),a=o.map(((t,e)=>_t(ce(t),r[e],!0))),[u,c,f]=await Promise.all([e.getMultipleAccountsInfo(o),e.getMultipleAccountsInfo(s),e.getMultipleAccountsInfo(a)]);for(let e=0;e<r.length;e++){const i=u[e],o=c[e],s=f[e];if(!i||!o){n.push(void 0);continue}if(new t(null==i?void 0:i.data.slice(32,64)).equals(r[e])){n.push(Yn(null==o?void 0:o.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=It.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Yn(null==o?void 0:o.data.slice(96)))}return n};async function ks(t,r,n,i,o,s,a,u){const c=Cn(r),f=On(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await nr(t,u);d=e.owner}return Zt(Ne,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}async function Rs(t,e,r,n,i,o){const s=Cn(e),a=On(s,i,o);let u;u=i||(await we.retrieve(t,a)).registry.owner;return Kt(Ne,a,new Tt(r),n,u)}async function _s(t,e,r,n,i,o){const s=Cn(e),a=On(s,n,i);let u;u=n||(await we.retrieve(t,a)).registry.owner;return Qt(Ne,a,r,u,n,i,o)}async function Us(t,e,r,n,i){const o=Cn(e),s=On(o,n,i);let a;a=n||(await we.retrieve(t,s)).registry.owner;return Jt(Ne,s,r,a)}const Ls=async(r,i,o,s,a,u=$e,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([ze.toBuffer()],ze),h=Cn(i),d=On(h,void 0,We),l=Cn(d.toBase58()),p=On(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],ze),w=Xe.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,Je,!0),E=Ze.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(ze,Ne,We,d,p,e.programId,f,s,a,Ke,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},Ps=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([ze.toBuffer()],ze),c=Cn(r.toBase58()),f=On(c,u,s);return[[],[new ee({name:i}).getInstruction(ze,Ne,We,f,e.programId,u,o,n,s,a)]]},Ts=async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=Mn(e),u=await t.getMinimumBalanceForRentExemption(n+we.HEADER_LEN),c=await ks(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=Hn(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Ps(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},Cs=async(t,r,n,i,o,s)=>{qn(n!==Wr.SOL,Lt.UnsupportedRecord);const{pubkey:a,hashed:u,parent:c}=Mn(`${n}.${r}`,Mr.V1),f=hs(i,n).length,h=await t.getMinimumBalanceForRentExemption(f+we.HEADER_LEN);return Zt(Ne,e.programId,a,o,s,u,new Ct(h),new Tt(f),void 0,c,o)},Os=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Mn(`${r}.${t}`,Mr.V2);if(u&&(a=Mn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Sr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Pr))(o,s,a,i,Ne,"".concat(r),ms(n,r),Lr);return c},Ns=async(t,e,r,n,i,o)=>{qn(r!==Wr.SOL,Lt.UnsupportedRecord);const{pubkey:s}=Mn(`${r}.${e}`,Mr.V1),a=await t.getAccountInfo(s);qn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist);const u=hs(n,r);if((null==a?void 0:a.data.slice(96).length)!==u.length)return[Jt(Ne,s,o,i),await Cs(t,e,r,n,i,o)];return[Kt(Ne,s,new Tt(0),u,i)]},Ds=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Mn(`${r}.${t}`,Mr.V2);if(u&&(a=Mn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a,u)=>new Rr({record:s,content:Array.from(a)}).getInstruction(u,e.programId,o,t,r,n,i,Pr))(o,s,a,i,Ne,"".concat(r),ms(n,r),Lr);return c},Ws=(t,r,n,i)=>{let{pubkey:o,parent:s,isSub:a}=Mn(`${r}.${t}`,Mr.V2);if(a&&(s=Mn(t).pubkey),!s)throw new Error("Invalid parent");const u=((t,r,n,i,o,s)=>(new _r).getInstruction(s,e.programId,o,t,i,r,n,Pr))(i,s,n,o,Ne,Lr);return u},zs=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Mn(`${n}.${r}`,Mr.V2);if(c&&(u=Mn(r).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u)=>new kr({staleness:a}).getInstruction(u,e.programId,s,t,r,n,i,Pr,o))(o,a,u,i,s,Ne,t,Lr);return f},Ms=(t,r,n,i,o)=>{let{pubkey:s,parent:a,isSub:u}=Mn(`${r}.${t}`,Mr.V2);if(u&&(a=Mn(t).pubkey),!a)throw new Error("Invalid parent");const c=((t,r,n,i,o,s,a)=>new Ur({roaId:Array.from(s.toBuffer())}).getInstruction(a,e.programId,r,t,n,i,o,Pr))(i,Ne,s,a,n,o,Lr);return c},js=(t,r,n,i,o,s)=>{let{pubkey:a,parent:u,isSub:c}=Mn(`${r}.${t}`,Mr.V2);if(c&&(u=Mn(t).pubkey),!u)throw new Error("Invalid parent");const f=((t,r,n,i,o,s,a,u,c)=>new xr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(u)}).getInstruction(c,e.programId,o,t,r,n,i,Pr))(i,a,u,n,Ne,Tr.Ethereum,o,s,Lr);return f},Vs=async(t,r,n,i,o,s)=>{const{pubkey:a,hashed:u,parent:c}=Mn(`${Wr.SOL}.${r}`,Mr.V1),f=ds(n,a,i,o).length,h=await t.getMinimumBalanceForRentExemption(f+we.HEADER_LEN);return[Zt(Ne,e.programId,a,i,s,u,new Ct(h),new Tt(f),void 0,c,i)]},Fs=async(t,e,r,n,i,o)=>{const{pubkey:s}=Mn(`${Wr.SOL}.${e}`,Mr.V1),a=await t.getAccountInfo(s);if(qn(!!(null==a?void 0:a.data),Lt.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Jt(Ne,s,o,n),await Vs(t,e,r,n,i,o)];const u=ds(r,s,n,i);return[Kt(Ne,s,new Tt(0),u,n)]},Hs=(r,n,i)=>{const{pubkey:o}=Mn(r),[s]=t.findProgramAddressSync([o.toBuffer()],ze),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],ze);return(new ie).getInstruction(ze,Ne,e.programId,o,Hn(r),a,s,Ve,n,i)},Gs=(r,i,o,s,a,u,c,f,h)=>{const[d]=t.findProgramAddressSync([o.toBuffer()],ze);return new ne({space:i,name:r}).getInstruction(ze,Ne,We,o,s,e.programId,Ve,a,u,c,f,h,er,g,n,d,rr)},qs=async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=Mn(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await we.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await we.retrieve(t,a)).registry.owner);return Qt(Ne,o,r,i,void 0,u,c)},$s=(t,r)=>{const[n]=Is.getKeySync(Bs,r);return[(new se).getInstruction(Bs,t,n,r,e.programId)]};async function Xs(t,r,n,i,o){const s=Cn(r),a=On(s,void 0,He),u=await t.getMinimumBalanceForRentExemption(i+we.HEADER_LEN);let c=[Zt(Ne,e.programId,a,n,o,s,new Ct(u),new Tt(i),void 0,He,Fe)];return c=c.concat(await ia(t,r,a,n,o)),c}async function Ys(t,e,r,n){const i=Cn(t),o=On(i,void 0,He);return[Kt(Ne,o,new Tt(r),n,e)]}async function Zs(t,e,r,n,i){const o=Cn(e),s=On(o,void 0,He);let a=[Qt(Ne,s,n,r,void 0)];return a.push(await Us(t,r.toString(),i,Fe,He)),a=a.concat(await ia(t,e,s,n,i)),a}async function Ks(t,e){const r=Cn(t),n=On(r,void 0,He),i=Cn(e.toString()),o=On(i,Fe,He);return[Jt(Ne,n,e,e),Jt(Ne,o,e,e)]}async function Qs(t){const e=Cn(t);return On(e,void 0,He)}async function Js(t,e){const r=Cn(e),n=On(r,void 0,He),{registry:i}=await we.retrieve(t,n);return i}async function ta(e,r){const n=Cn(r.toString()),i=On(n,Fe,He);let o=await na.retrieve(e,i);return[o.twitterHandle,new t(o.twitterRegistryKey)]}async function ea(e,r){const n=[{memcmp:{offset:0,bytes:He.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Fe.toBase58()}}],i=await e.getProgramAccounts(Ne,{filters:n});for(const e of i)if(e.account.data.length>we.HEADER_LEN+32){const r=e.account.data.slice(we.HEADER_LEN),n=new na(Yt(na.schema,r));return[n.twitterHandle,new t(n.twitterRegistryKey)]}throw new Pt(Lt.AccountDoesNotExist)}async function ra(e,r){const n=[{memcmp:{offset:0,bytes:He.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t(s.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(Ne,{filters:n});if(i.length>1)throw new Pt(Lt.MultipleRegistries);return i[0].account.data.slice(we.HEADER_LEN)}class na{constructor(t){this.twitterRegistryKey=t.twitterRegistryKey,this.twitterHandle=t.twitterHandle}static async retrieve(t,e){let r=await t.getAccountInfo(e,"processed");if(!r)throw new Pt(Lt.InvalidReverseTwitter);return new na(Yt(na.schema,r.data.slice(we.HEADER_LEN)))}}async function ia(t,r,n,i,o){const a=Cn(i.toString()),u=On(a,Fe,He);let c=Xt(na.schema,new na({twitterRegistryKey:n.toBytes(),twitterHandle:r}));return[Zt(Ne,e.programId,u,i,o,a,new Ct(await t.getMinimumBalanceForRentExemption(c.length+we.HEADER_LEN)),new Tt(c.length),Fe,He,Fe),Kt(Ne,u,new Tt(0),s.Buffer.from(c),Fe)]}var oa;na.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},function(t){t.DegenPoet1="DegenPoet#1",t.Rgb0x001="rgb0x00#1"}(oa||(oa={}));const sa=async(t,e)=>{const{pubkey:r}=Mn(e),{registry:n,nftOwner:i}=await we.retrieve(t,r);if(i)return i;try{const r=await ua(t,n.owner,e);if(void 0!==r)return r;return await aa(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},aa=async(e,r,n)=>{const i=Mo(n,Wr.SOL),o=await is(e,n);if(!(null==o?void 0:o.data))throw new Pt(Lt.NoRecordData);const a=new TextEncoder,u=s.Buffer.concat([o.data.slice(0,32),i.toBuffer()]),c=a.encode(u.toString("hex"));if(!zo(c,o.data.slice(32),r))throw new Pt(Lt.InvalidSignature);return new t(o.data.slice(0,32))},ua=async(e,r,n)=>{try{const i=vs(n,Wr.SOL),o=await Dr.retrieve(e,i),s=o.getStalenessId(),a=o.getRoAId(),u=o.getContent();if(0===s.compare(r.toBuffer())&&o.header.stalenessValidation===Tr.Solana&&0===a.compare(u)&&o.header.rightOfAssociationValidation===Tr.Solana)return new t(u)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},ca=new t("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),fa=new t("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),ha=(t,e)=>{const r=Cn(e),n=Cn(t),i=On(n,void 0,tr);return{domainKey:i,bgKey:On(r,void 0,i)}},da=t=>{switch(t){case oa.DegenPoet1:return ca;case oa.Rgb0x001:return fa;default:throw new Pt(Lt.InvalidCustomBg)}},la=async(e,r,n)=>{const i=vs(n,r),{registry:o,nftOwner:s}=await we.retrieve(e,Mn(n).pubkey),a=s||o.owner,u=await Dr.retrieve(e,i),c=u.getStalenessId();return(null==a?void 0:a.equals(new t(c)))&&u.header.stalenessValidation===Tr.Solana},pa={NAME_PROGRAM_ID:new t("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new t("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new t("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new t("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new t("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new t("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1")],TOKENS_SYM_MINT:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU","USDC"],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS","USDT"],["So11111111111111111111111111111111111111112","SOL"],["fidaWCioBQjieRrUQDxxS5Uxmq1CLi2VuVRyv4dEBey","FIDA"],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P","INJ"]]),PYTH_FEEDS:new Map([["4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",{price:"5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7",product:"6NpdXrQEpmDZ3jZKmM2rhdmkd3H6QAk23j2x8bkXcHKA"}],["EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS",{price:"38xoQ4oeJCBrcVvca2cGk7iV1dAfrmTR1kmhSCJQ8Jto",product:"C5wDxND9E61RZ1wZhaSTWkoA8udumaHnoQY6BBsiaVpn"}],["So11111111111111111111111111111111111111112",{price:"J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix",product:"3Mnn2fX6rQyUsyELYms1sBJyChWofzSNRoqYzvgMVz5E"}],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",{price:"7teETxN9Y8VK6uJxsctHEwST75mKLLwPH1jaFdvTQCpD",product:"5kWV4bhHeZANzg5MWaYCQYEEKHjur5uz1mu5vuLHwiLB"}],["DL4ivZm3NVHWk9ZvtcqTchxoKArDK4rT3vbDx2gYVr7P",{price:"44uRsNnT35kjkscSu59MxRr9CfkLZWf6gny8bWqUbVxE",product:"7UHB783Nh4avW3Yw9yoktf2KjxipU56KPahA51RnCCYE"}]]),PYTH_MAPPING_ACC:new t("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new t("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},ya=(e,r,n)=>{const i=[e];r?i.push(r.toBuffer()):i.push(s.Buffer.alloc(32)),n?i.push(n.toBuffer()):i.push(s.Buffer.alloc(32));const[o]=t.findProgramAddressSync(i,pa.NAME_PROGRAM_ID);return o},ga=(t,e=pa.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Cn(t);return{pubkey:ya(n,r,e),hashed:n}},wa=t=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const e=t.split(".");if(2===e.length){const t="\0".concat(e[0]),{pubkey:r}=ga(e[1]);return{...ga(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new Pt(Lt.InvalidInput);return{...ga(t,pa.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ba=(t,e)=>{const{pubkey:r,parent:n}=wa(t),i=Cn(r.toBase58());return ya(i,pa.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function ma(t,r,n,i,o,s,a,u){const c=await ir(r),f=await ya(c,a,u),h=s||await t.getMinimumBalanceForRentExemption(n);let d;if(u){const{registry:e}=await nr(t,u);d=e.owner}return Zt(pa.NAME_PROGRAM_ID,e.programId,f,o,i,c,new Ct(h),new Tt(n),a,u,d)}const va=async(r,i,o,s,a)=>{let[u]=await t.findProgramAddress([pa.REGISTER_PROGRAM_ID.toBuffer()],pa.REGISTER_PROGRAM_ID),c=await ir(r.toBase58()),f=ya(c,u,s);return[[],[new ee({name:i}).getInstruction(pa.REGISTER_PROGRAM_ID,pa.NAME_PROGRAM_ID,pa.ROOT_DOMAIN_ACCOUNT,f,e.programId,u,o,n,s,a)]]},Ea={utils:{getNameAccountKeySync:ya,reverseLookup:async(t,e)=>{const r=Cn(e.toBase58()),n=ya(r,pa.REVERSE_LOOKUP_CLASS),{registry:i}=await we.retrieve(t,n);if(!i.data)throw new Pt(Lt.NoAccountData);return Yn(i.data)},_deriveSync:ga,getDomainKeySync:wa,getReverseKeySync:ba},constants:pa,bindings:{createNameRegistry:ma,updateNameRegistryData:async function(t,e,r,n,i,o){const s=await ir(e),a=ya(s,i,o);let u;return u=i||(await we.retrieve(t,a)).registry.owner,Kt(pa.NAME_PROGRAM_ID,a,new Tt(r),n,u)},transferNameOwnership:async function(t,e,r,n,i,o){const s=await ir(e),a=ya(s,n,i);let u;return u=n||(await we.retrieve(t,a)).registry.owner,Qt(pa.NAME_PROGRAM_ID,a,r,u,n,i,o)},deleteNameRegistry:async function(t,e,r,n,i){const o=await ir(e),s=ya(o,n,i);let a;return a=n||(await we.retrieve(t,s)).registry.owner,Jt(pa.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(r,i,o,s,a,u=pa.USDC_MINT,c)=>{if(i.includes(".")||i.trim().toLowerCase()!==i)throw new Pt(Lt.InvalidDomain);const[f]=t.findProgramAddressSync([pa.REGISTER_PROGRAM_ID.toBuffer()],pa.REGISTER_PROGRAM_ID),h=Cn(i),d=ya(h,void 0,pa.ROOT_DOMAIN_ACCOUNT),l=Cn(d.toBase58()),p=ya(l,f),[y]=t.findProgramAddressSync([d.toBuffer()],pa.REGISTER_PROGRAM_ID),w=pa.REFERRERS.findIndex((t=>null==c?void 0:c.equals(t)));let b;const m=[];if(-1!==w&&c){b=_t(u,c,!0);const t=await r.getAccountInfo(b);if(!(null==t?void 0:t.data)){const t=Ut(s,b,c,u);m.push(t)}}const v=_t(u,pa.VAULT_OWNER),E=Ea.constants.PYTH_FEEDS.get(u.toBase58());if(!E)throw new Pt(Lt.PythFeedNotFound);const A=new re({name:i,space:o,referrerIdxOpt:-1!=w?w:null}).getInstruction(pa.REGISTER_PROGRAM_ID,pa.NAME_PROGRAM_ID,pa.ROOT_DOMAIN_ACCOUNT,d,p,e.programId,f,s,a,pa.PYTH_MAPPING_ACC,new t(E.product),new t(E.price),v,g,n,y,b);return m.push(A),[[],m]},createReverseName:va,createSubdomain:async(t,e,r,n=2e3)=>{const i=[],o=e.split(".")[0];if(!o)throw new Pt(Lt.InvalidSubdomain);const{parent:s,pubkey:a}=wa(e),u=await t.getMinimumBalanceForRentExemption(n+we.HEADER_LEN),c=await ma(t,"\0".concat(o),n,r,r,u,void 0,s);i.push(c);const f=ba(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await va(a,"\0".concat(o),r,s,r);i.push(...t)}return[[],i]},burnDomain:(r,n,i)=>{const{pubkey:o}=wa(r),[s]=t.findProgramAddressSync([o.toBuffer()],pa.REGISTER_PROGRAM_ID),[a]=t.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],pa.REGISTER_PROGRAM_ID);return(new ie).getInstruction(pa.REGISTER_PROGRAM_ID,pa.NAME_PROGRAM_ID,e.programId,o,ba(r),a,s,pa.REVERSE_LOOKUP_CLASS,n,i)},transferSubdomain:async(t,e,r,n,i)=>{const{pubkey:o,isSub:s,parent:a}=wa(e);if(!a||!s)throw new Pt(Lt.InvalidSubdomain);if(!i){const{registry:e}=await we.retrieve(t,o);i=e.owner}let u,c;n&&(u=a,c=(await we.retrieve(t,a)).registry.owner);return Qt(pa.NAME_PROGRAM_ID,o,r,i,void 0,u,c)}}};export{je as BONFIDA_FIDA_BNB,qe as BONFIDA_USDC_BNB,tr as CUSTOM_BG_TLD,oa as CustomBg,ps as ETH_ROA_RECORDS,Lt as ErrorType,Is as FavouriteDomain,ls as GUARDIANS,De as HASH_PREFIX,rr as METAPLEX_ID,Bs as NAME_OFFERS_ID,Ne as NAME_PROGRAM_ID,we as NameRegistryState,Tt as Numberu32,Ct as Numberu64,Ze as PYTH_FEEDS,Me as PYTH_FIDA_PRICE_ACC,Ke as PYTH_MAPPING_ACC,zr as RECORD_V1_SIZE,Xe as REFERRERS,ze as REGISTER_PROGRAM_ID,Ve as REVERSE_LOOKUP_CLASS,We as ROOT_DOMAIN_ACCOUNT,Wr as Record,Mr as RecordVersion,na as ReverseTwitterRegistryState,ws as SELF_SIGNED,Pt as SNSError,Ge as SOL_RECORD_SIG_LEN,Ye as TOKENS_SYM_MINT,He as TWITTER_ROOT_PARENT_REGISTRY_KEY,Fe as TWITTER_VERIFICATION_AUTHORITY,$e as USDC_MINT,gs as UTF8_ENCODED,Je as VAULT_OWNER,Qe as VAULT_OWNER_DEPRECATED,er as WOLVES_COLLECTION_METADATA,Hs as burnDomain,ie as burnInstruction,Ys as changeTwitterRegistryData,Zs as changeVerifiedPubkey,qn as check,zo as checkSolRecord,Zt as createInstruction,re as createInstructionV3,ks as createNameRegistry,Cs as createRecordInstruction,Os as createRecordV2Instruction,ee as createReverseInstruction,Ps as createReverseName,ia as createReverseTwitterRegistry,Vs as createSolRecordInstruction,Ts as createSubdomain,te as createV2Instruction,Xs as createVerifiedTwitterRegistry,ne as createWithNftInstruction,Jt as deleteInstruction,Us as deleteNameRegistry,Ws as deleteRecordV2,Ks as deleteTwitterRegistry,fs as deserializeRecord,bs as deserializeRecordV2Content,Yn as deserializeReverse,Ea as devnet,js as ethValidateRecordV2Content,Wn as findSubdomains,jn as getAllDomains,Fn as getAllRegisteredDomains,da as getArtistPubkey,Ho as getArweaveRecord,cs as getBackgroundRecord,us as getBackpackRecord,ss as getBscRecord,qo as getBtcRecord,ha as getCustomBgKeys,Ko as getDiscordRecord,Xo as getDogeRecord,cr as getDomainKey,Mn as getDomainKeySync,Vn as getDomainKeysWithReverses,ce as getDomainMint,Xn as getDomainPriceFromName,Yo as getEmailRecord,Go as getEthRecord,Ss as getFavoriteDomain,Qo as getGithubRecord,ta as getHandleAndRegistryKey,ir as getHashedName,Cn as getHashedNameSync,as as getInjectiveRecord,Fo as getIpfsRecord,$o as getLtcRecord,xs as getMultipleFavoriteDomains,As as getMultipleRecordsV2,or as getNameAccountKey,On as getNameAccountKeySync,nr as getNameOwner,rs as getPicRecord,os as getPointRecord,jo as getRecord,Mo as getRecordKeySync,Es as getRecordV2,vs as getRecordV2Key,Vo as getRecords,Jo as getRedditRecord,fr as getReverseKey,Gn as getReverseKeyFromDomainKey,Hn as getReverseKeySync,ns as getShdwRecord,is as getSolRecord,es as getTelegramRecord,$n as getTokenizedDomains,ea as getTwitterHandleandRegistryKeyViaFilters,ts as getTwitterRecord,Js as getTwitterRegistry,ra as getTwitterRegistryData,Qs as getTwitterRegistryKey,Zo as getUrlRecord,sr as performReverseLookup,ar as performReverseLookupBatch,oe as reallocInstruction,Ls as registerDomainName,$s as registerFavorite,se as registerFavoriteInstruction,Gs as registerWithNft,sa as resolve,aa as resolveSolRecordV1,ua as resolveSolRecordV2,de as retrieveNftOwner,le as retrieveNfts,ge as retrieveRecords,Nn as reverseLookup,Dn as reverseLookupBatch,hs as serializeRecord,ms as serializeRecordV2Content,ds as serializeSolRecord,Qt as transferInstruction,_s as transferNameOwnership,qs as transferSubdomain,Kt as updateInstruction,Rs as updateNameRegistryData,Ns as updateRecordInstruction,Ds as updateRecordV2Instruction,Fs as updateSolRecordInstruction,zs as validateRecordV2Content,ys as verifyRightOfAssociation,la as verifyStaleness,Ms as writRoaRecordV2};
20
20
  //# sourceMappingURL=index.mjs.map