@bonfida/spl-name-service 2.3.3 → 2.3.5

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.cjs CHANGED
@@ -7,14 +7,14 @@ read:function(t,e,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,f=-7,h=r?o-1:0,d=r?
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
9
  */
10
- !function(t){const e=o,r=d,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function s(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(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 c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=s(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if($(t,Uint8Array)){const e=new Uint8Array(t);return p(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($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return p(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 a.from(n,e,r);const o=function(t){if(a.isBuffer(t)){const e=0|l(t.length),r=s(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)?s(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.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 u(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 u(t),s(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(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,a.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 y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(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 o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(o)return n?-1:G(t).length;e=(""+e).toLowerCase(),o=!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 T(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(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,o){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=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){let i,s=1,a=t.length,c=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,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(t,i+n)!==u(e,n)){r=!1;break}if(r)return i}return-1}function v(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/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 Y(G(e,t.length-r),t,r,n)}function x(t,e,r,n){return Y(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 A(t,e,r,n){return Y(q(e),t,r,n)}function I(t,e,r,n){return Y(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(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 B(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(i=c));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}t.kMaxLength=i,a.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}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return f(t)},a.allocUnsafeSlow=function(t){return f(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),$(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.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 o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=a.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if($(e,Uint8Array))o+e.length>n.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.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},a.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},a.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},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.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&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,o){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.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===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const c=Math.min(i,s),u=this.slice(n,o),f=t.slice(e,r);for(let t=0;t<c;++t)if(u[t]!==f[t]){i=u[t],s=f[t];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.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 o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!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 x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=X[t[n]];return o}function _(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function U(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 L(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)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,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;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,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;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,o,i){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,o,i){return e=+e,n>>>=0,i||N(t,0,n,4),r.write(t,e,n,o,23,4),n+4}function M(t,e,n,o,i){return e=+e,n>>>=0,i||N(t,0,n,8),r.write(t,e,n,o,52,8),n+8}a.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,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),a.prototype.readBigUInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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)})),a.prototype.readBigInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.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 o=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),o},a.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&&!a.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 o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=a.isBuffer(t)?t:a.from(t,n),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%s]}return this};const V={};function z(t,e,r){V[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 W(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 j(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||K(e,t.length-(r+1))}(n,o,i)}function F(t,e){if("number"!=typeof t)throw new V.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.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.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=W(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(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 X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(n);const p=new t.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const l=new t.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t.PublicKey("So11111111111111111111111111111111111111112"),new t.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.s16=y.s8=y.nu64be=y.u48be=y.u40be=y.u32be=y.u24be=y.u16be=y.nu64=y.u48=y.u40=tt=y.u32=y.u24=y.u16=J=y.u8=y.offset=y.greedy=y.Constant=y.UTF8=y.CString=y.Blob=y.Boolean=y.BitField=y.BitStructure=y.VariantLayout=y.Union=y.UnionLayoutDiscriminator=y.UnionDiscriminator=y.Structure=y.Sequence=y.DoubleBE=y.Double=y.FloatBE=y.Float=y.NearInt64BE=y.NearInt64=y.NearUInt64BE=y.NearUInt64=y.IntBE=y.Int=y.UIntBE=y.UInt=y.OffsetLayout=y.GreedyCount=y.ExternalLayout=y.bindConstructorLayout=y.nameWithProperty=y.Layout=y.uint8ArrayToBuffer=y.checkUint8Array=void 0,y.constant=y.utf8=y.cstr=rt=y.blob=y.unionLayoutDiscriminator=y.union=y.seq=y.bits=et=y.struct=y.f64be=y.f64=y.f32be=y.f32=y.ns64be=y.s48be=y.s40be=y.s32be=y.s24be=y.s16be=y.ns64=y.s48=y.s40=y.s32=y.s24=void 0;const g=n;function w(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function b(t){return w(t),g.Buffer.from(t.buffer,t.byteOffset,t.length)}y.checkUint8Array=w,y.uint8ArrayToBuffer=b;class m{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 v(t,e){return e.property?t+"["+e.property+"]":t}y.Layout=m,y.nameWithProperty=v,y.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 m))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 E extends m{isCount(){throw new Error("ExternalLayout is abstract")}}y.ExternalLayout=E;class x extends E{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){w(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}y.GreedyCount=x;class A extends E{constructor(t,e=0,r){if(!(t instanceof m))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 I||this.layout instanceof S}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)}}y.OffsetLayout=A;class I extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntLE(t,r,this.span),this.span}}y.UInt=I;class S extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntBE(t,r,this.span),this.span}}y.UIntBE=S;class B extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeIntLE(t,r,this.span),this.span}}y.Int=B;class R extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeIntBE(t,r,this.span),this.span}}y.IntBE=R;const P=Math.pow(2,32);function k(t){const e=Math.floor(t/P);return{hi32:e,lo32:t-e*P}}function T(t,e){return t*P+e}class _ extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeUInt32LE(n.hi32,r+4),8}}y.NearUInt64=_;class U extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearUInt64BE=U;class L extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeInt32LE(n.hi32,r+4),8}}y.NearInt64=L;class C extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearInt64BE=C;class O extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatLE(e)}encode(t,e,r=0){return b(e).writeFloatLE(t,r),4}}y.Float=O;class N extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatBE(e)}encode(t,e,r=0){return b(e).writeFloatBE(t,r),4}}y.FloatBE=N;class D extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleLE(e)}encode(t,e,r=0){return b(e).writeDoubleLE(t,r),8}}y.Double=D;class M extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleBE(e)}encode(t,e,r=0){return b(e).writeDoubleBE(t,r),8}}y.DoubleBE=M;class V extends m{constructor(t,e,r){if(!(t instanceof m))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof E&&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 E)&&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 E&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let o=0;for(;o<n;)r+=this.elementLayout.getSpan(t,e+r),++o}return r}decode(t,e=0){const r=[];let n=0,o=this.count;for(o instanceof E&&(o=o.decode(t,e));n<o;)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,o=t.reduce(((t,o)=>t+n.encode(o,e,r+t)),0);return this.count instanceof E&&this.count.encode(t.length,e,r),o}}y.Sequence=V;class z extends m{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof m),!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 o=n.getSpan(t,e);return e+=o,r+o}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){w(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 o=0,i=0;for(const n of this.fields){let s=n.span;if(i=0<s?s:0,void 0!==n.property){const o=t[n.property];void 0!==o&&(i=n.encode(o,e,r),0>s&&(s=n.getSpan(e,r)))}o=r,r+=s}return o+i-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)}}}y.Structure=z;class W{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}y.UnionDiscriminator=W;class j extends W{constructor(t,e){if(!(t instanceof E&&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)}}y.UnionLayoutDiscriminator=j;class F extends m{constructor(t,e,r){let n;if(t instanceof I||t instanceof S)n=new j(new A(t));else if(t instanceof E&&t.isCount())n=new j(t);else{if(!(t instanceof W))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 m))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 o=-1;e&&(o=e.span,0<=o&&(t instanceof I||t instanceof S)&&(o+=n.layout.span)),super(o,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof I||t instanceof S,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return i(t)},this.configGetSourceVariant=function(t){i=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,o=n.decode(t,e),i=this.registry[o];if(void 0===i){const i=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=o,r[i.property]=i.decode(t,e+s)}else r=i.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=n.layout.span),n.encode(t[n.property],e,r),i+o.encode(t[o.property],e,r+i)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new K(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]}}y.Union=F;class K extends m{constructor(t,e,r,n){if(!(t instanceof F))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 m))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 o=t.span;0>t.span&&(o=r?r.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,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 o=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),o+=this.layout.getSpan(e,r+n),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function H(t){return 0>t&&(t+=4294967296),t}y.VariantLayout=K;class G extends m{constructor(t,e,r){if(!(t instanceof I||t instanceof S))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=H(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 q(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new Y(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}}y.BitStructure=G;class q{constructor(t,e,r){if(!(t instanceof G))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,o=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+o>n)throw new Error("bits too long for span remainder ("+(n-o)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=n-o-e),this.wordMask=H(this.valueMask<<this.start),this.property=r}decode(t,e){return H(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==H(t&this.valueMask))throw new TypeError(v("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=H(t<<this.start);this.container._packedSetValue(H(e&~this.wordMask)|r)}}y.BitField=q;class Y extends q{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)}}y.Boolean=Y;class $ extends m{constructor(t,e){if(!(t instanceof E&&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 E||(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)),b(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof E&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(v("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const o=b(t);return b(e).write(o.toString("hex"),r,n,"hex"),this.length instanceof E&&this.length.encode(n,e,r),n}}y.Blob=$;class Z extends m{constructor(t){super(-1,t)}getSpan(t,e=0){w(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 b(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(r+o>e.length)throw new RangeError("encoding overruns Buffer");const i=b(e);return n.copy(i,r),i[r+o]=0,o+1}}y.CString=Z;class X extends m{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 w(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 b(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(r+o>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(b(e),r),o}}y.UTF8=X;class Q extends m{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}y.Constant=Q,y.greedy=(t,e)=>new x(t,e),y.offset=(t,e,r)=>new A(t,e,r);var J=y.u8=t=>new I(1,t);y.u16=t=>new I(2,t),y.u24=t=>new I(3,t);var tt=y.u32=t=>new I(4,t);y.u40=t=>new I(5,t),y.u48=t=>new I(6,t),y.nu64=t=>new _(t),y.u16be=t=>new S(2,t),y.u24be=t=>new S(3,t),y.u32be=t=>new S(4,t),y.u40be=t=>new S(5,t),y.u48be=t=>new S(6,t),y.nu64be=t=>new U(t),y.s8=t=>new B(1,t),y.s16=t=>new B(2,t),y.s24=t=>new B(3,t),y.s32=t=>new B(4,t),y.s40=t=>new B(5,t),y.s48=t=>new B(6,t),y.ns64=t=>new L(t),y.s16be=t=>new R(2,t),y.s24be=t=>new R(3,t),y.s32be=t=>new R(4,t),y.s40be=t=>new R(5,t),y.s48be=t=>new R(6,t),y.ns64be=t=>new C(t),y.f32=t=>new O(t),y.f32be=t=>new N(t),y.f64=t=>new D(t),y.f64be=t=>new M(t);var et=y.struct=(t,e,r)=>new z(t,e,r);y.bits=(t,e,r)=>new G(t,e,r),y.seq=(t,e,r)=>new V(t,e,r),y.union=(t,e,r)=>new F(t,e,r),y.unionLayoutDiscriminator=(t,e)=>new j(t,e);var rt=y.blob=(t,e)=>new $(t,e);y.cstr=t=>new Z(t),y.utf8=(t,e)=>new X(t,e),y.constant=(t,e)=>new Q(t,e);const nt=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var ot={};Object.defineProperty(ot,"__esModule",{value:!0});var it=ot.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};ot.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var st=ot.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}};ot.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const at=(ct=8,t=>{const e=rt(ct,t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>{const r=n(t,e);return it(Buffer.from(r))},o.encode=(t,e,n)=>{const o=st(t,ct);return r(o,e,n)},o});var ct;const ut=t=>{const e=J(t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>!!n(t,e),o.encode=(t,e,n)=>{const o=Number(t);return r(o,e,n)},o},ft=e=>{const r=rt(32,e),{encode:n,decode:o}=nt(r),i=r;return i.decode=(e,r)=>{const n=o(e,r);return new t.PublicKey(n)},i.encode=(t,e,r)=>{const o=t.toBuffer();return n(o,e,r)},i};class ht extends Error{constructor(t){super(t)}}class dt extends ht{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class pt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class lt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class yt extends ht{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class gt extends ht{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var wt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(wt||(wt={}));const bt=1,mt=et([J("m"),J("n"),ut("isInitialized"),ft("signer1"),ft("signer2"),ft("signer3"),ft("signer4"),ft("signer5"),ft("signer6"),ft("signer7"),ft("signer8"),ft("signer9"),ft("signer10"),ft("signer11")]).span;var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(vt||(vt={}));const Et=et([ft("mint"),ft("owner"),at("amount"),tt("delegateOption"),ft("delegate"),J("state"),tt("isNativeOption"),at("isNative"),at("delegatedAmount"),tt("closeAuthorityOption"),ft("closeAuthority")]),xt=Et.span,At=et([tt("mintAuthorityOption"),ft("mintAuthority"),at("supply"),J("decimals"),ut("isInitialized"),tt("freezeAuthorityOption"),ft("freezeAuthority")]),It=At.span;async function St(t,e,r,n=p){return function(t,e,r=p){if(!e)throw new dt;if(!e.owner.equals(r))throw new pt;if(e.data.length<It)throw new lt;const n=At.decode(e.data.slice(0,It));let o=Buffer.alloc(0);if(e.data.length>It){if(e.data.length<=xt)throw new lt;if(e.data.length===mt)throw new lt;if(e.data[xt]!=wt.Mint)throw new yt;o=e.data.slice(xt+bt)}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:o}}(e,await t.getAccountInfo(e,r),n)}function Bt(e,r,n=!1,o=p,i=l){if(!n&&!t.PublicKey.isOnCurve(r.toBuffer()))throw new gt;const[s]=t.PublicKey.findProgramAddressSync([r.toBuffer(),o.toBuffer(),e.toBuffer()],i);return s}function Rt(e,r,n,o,i=p,s=l){return function(e,r,n,o,i,s=p,a=l){const c=[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:c,programId:a,data:i})}(e,r,n,o,Buffer.from([1]),i,s)}var Pt;exports.ErrorType=void 0,(Pt=exports.ErrorType||(exports.ErrorType={})).SymbolNotFound="SymbolNotFound",Pt.InvalidSubdomain="InvalidSubdomain",Pt.FavouriteDomainNotFound="FavouriteDomainNotFound",Pt.MissingParentOwner="MissingParentOwner",Pt.U32Overflow="U32Overflow",Pt.InvalidBufferLength="InvalidBufferLength",Pt.U64Overflow="U64Overflow",Pt.NoRecordData="NoRecordData",Pt.InvalidRecordData="InvalidRecordData",Pt.UnsupportedRecord="UnsupportedRecord",Pt.InvalidEvmAddress="InvalidEvmAddress",Pt.InvalidInjectiveAddress="InvalidInjectiveAddress",Pt.InvalidARecord="InvalidARecord",Pt.InvalidAAAARecord="InvalidAAAARecord",Pt.InvalidRecordInput="InvalidRecordInput",Pt.InvalidSignature="InvalidSignature",Pt.AccountDoesNotExist="AccountDoesNotExist",Pt.MultipleRegistries="MultipleRegistries",Pt.InvalidReverseTwitter="InvalidReverseTwitter",Pt.NoAccountData="NoAccountData",Pt.InvalidInput="InvalidInput",Pt.InvalidDomain="InvalidDomain",Pt.InvalidCustomBg="InvalidCustomBackground",Pt.UnsupportedSignature="UnsupportedSignature",Pt.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",Pt.RecordIsNotSigned="RecordIsNotSigned",Pt.UnsupportedSignatureType="UnsupportedSignatureType",Pt.InvalidSolRecordV2="InvalidSolRecordV2",Pt.MissingVerifier="MissingVerifier",Pt.PythFeedNotFound="PythFeedNotFound";class kt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,kt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new kt(exports.ErrorType.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 _t{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new kt(exports.ErrorType.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new _t(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ut,Lt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ct=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 o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](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}(),Ot=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),o=this.view[n](this.offset,!0);return this.offset+=r,o},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}(),Nt=(Ut=function(t,e){return Ut=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])},Ut(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}Ut(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Dt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function Mt(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=Lt.concat(["bool","string"]),zt=["option","enum","array","set","map","struct"],Wt=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Nt(e,t),e}(Error);function jt(t){if("string"!=typeof t||!Vt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&zt.includes(e[0])){var r=e[0];if("option"===r)return jt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Wt(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');jt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return jt(t.type);throw new Wt(t,"{ type, len? }")}(t[r]);if("set"===r)return jt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Wt(t,"{ key, value }");jt(t.key),jt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"object");for(var e in t)jt(t[e])}(t[r])}}throw new Wt(t,zt.join(", ")+" or "+Vt.join(", "))}}var Ft=function(){function t(t){this.encoded=new Ct,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(Lt.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&&Dt(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),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Dt(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&&Dt(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 o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}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?Mt(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?Mt(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&&Dt(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,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Dt(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 o=0,i=n;o<i.length;o++){var s=i[o];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&&Dt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),Kt=function(){function t(t){this.buffer=new Ot(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Lt.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)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},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,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),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 o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}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 Ht(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Ft(r).encode(e,t)}function Gt(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Kt(e).decode(t)}function qt(e,r,o,i,s,a,c,u,f,h,d){const p=[n.Buffer.from(Int8Array.from([0])),new Tt(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(p),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1}];return f?y.push({pubkey:f,isSigner:!0,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),h?y.push({pubkey:h,isSigner:!1,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d&&y.push({pubkey:d,isSigner:!0,isWritable:!1}),new t.TransactionInstruction({keys:y,programId:e,data:l})}function Yt(e,r,o,i,s){const a=[n.Buffer.from(Int8Array.from([1])),o.toBuffer(),new Tt(i.length).toBuffer(),i],c=n.Buffer.concat(a),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new t.TransactionInstruction({keys:u,programId:e,data:c})}function $t(e,r,o,i,s,a,c){const u=[n.Buffer.from(Int8Array.from([2])),o.toBuffer()],f=n.Buffer.concat(u),h=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c||i,isSigner:!0,isWritable:!1}];return s&&h.push({pubkey:s,isSigner:!0,isWritable:!1}),c&&a&&(s||h.push({pubkey:t.PublicKey.default,isSigner:!1,isWritable:!1}),h.push({pubkey:a,isSigner:!1,isWritable:!1})),new t.TransactionInstruction({keys:h,programId:e,data:f})}function Zt(e,r,o,i){const s=[n.Buffer.from(Int8Array.from([3]))],a=n.Buffer.concat(s),c=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!0}];return new t.TransactionInstruction({keys:c,programId:e,data:a})}class Xt{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Ht(Xt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d){const l=n.Buffer.from(this.serialize()),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!0,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:y,programId:e,data:l})}}Xt.schema={struct:{tag:"u8",name:"string",space:"u32"}};class Qt{constructor(t){this.tag=12,this.name=t.name}serialize(){return Ht(Qt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!1}),p.push({pubkey:a,isSigner:!1,isWritable:!1}),p.push({pubkey:c,isSigner:!0,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&p.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&p.push({pubkey:h,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}Qt.schema={struct:{tag:"u8",name:"string"}};class Jt{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Ht(Jt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,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:p,isSigner:!1,isWritable:!1}),v.push({pubkey:l,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 t.TransactionInstruction({keys:v,programId:e,data:m})}}Jt.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class te{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Ht(te.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,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:p,isSigner:!1,isWritable:!0}),v.push({pubkey:l,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 t.TransactionInstruction({keys:v,programId:e,data:m})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(){this.tag=16}serialize(){return Ht(ee.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!0}),p.push({pubkey:a,isSigner:!1,isWritable:!0}),p.push({pubkey:c,isSigner:!1,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),p.push({pubkey:f,isSigner:!0,isWritable:!1}),p.push({pubkey:h,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}ee.schema={struct:{tag:"u8"}};const re=new t.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ne=n.Buffer.from("tokenized_name"),oe=e=>{const[r]=t.PublicKey.findProgramAddressSync([ne,e.toBuffer()],re);return r};var ie;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(ie||(ie={}));class se{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t.PublicKey(e.nameAccount),this.owner=new t.PublicKey(e.owner),this.nftMint=new t.PublicKey(e.nftMint)}static deserialize(t){return new se(Gt(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.PublicKey.findProgramAddress([n.Buffer.from("nft_record"),e.toBuffer()],r)}}se.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 ae=async(e,r)=>{try{const[n]=await t.PublicKey.findProgramAddress([ne,r.toBuffer()],re);if("0"===(await St(e,n)).supply.toString())return;const o=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],i=await e.getProgramAccounts(p,{filters:o});if(1!=i.length)return;return new t.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ce=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ue=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(re,{filters:r})})(t,e.mint);if(1===r.length)return se.deserialize(r[0].account.data)},fe=async(t,e)=>{const r=[...ce(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(p,{filters:r})).map((t=>Et.decode(t.account.data))).map((e=>ue(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class he{constructor(e){this.parentName=new t.PublicKey(e.parentName),this.owner=new t.PublicKey(e.owner),this.class=new t.PublicKey(e.class)}static deserialize(t){const e=new he(Gt(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 kt(exports.ErrorType.AccountDoesNotExist);const o=new he(Gt(this.schema,n.data));o.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:o,nftOwner:await ae(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new he(Gt(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 de(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 pe(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")}he.HEADER_LEN=96,he.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const le="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
11
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ye(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const ge=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),we=(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 me(t){if("string"==typeof t&&(t=be(t)),!ye(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class ve{clone(){return this._cloneInto()}}function Ee(t){const e=e=>t().update(me(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class xe extends ve{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=ge(this.buffer)}update(t){pe(this);const{view:e,buffer:r,blockLen:n}=this,o=(t=me(t)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=ge(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){pe(this),function(t,e){de(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:o}=this;let{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let t=i;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=ge(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)s.setUint32(4*t,u[t],o)}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:o,destroyed:i,pos:s}=this;return t.length=n,t.pos=s,t.finished=o,t.destroyed=i,n%e&&t.buffer.set(r),t}}const Ae=(t,e,r)=>t&e^~t&r,Ie=(t,e,r)=>t&e^t&r^e&r,Se=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]),Be=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Re=new Uint32Array(64);class Pe extends xe{constructor(){super(64,32,8,!1),this.A=0|Be[0],this.B=0|Be[1],this.C=0|Be[2],this.D=0|Be[3],this.E=0|Be[4],this.F=0|Be[5],this.G=0|Be[6],this.H=0|Be[7]}get(){const{A:t,B:e,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[t,e,r,n,o,i,s,a]}set(t,e,r,n,o,i,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Re[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Re[t-15],r=Re[t-2],n=we(e,7)^we(e,18)^e>>>3,o=we(r,17)^we(r,19)^r>>>10;Re[t]=o+Re[t-7]+n+Re[t-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let t=0;t<64;t++){const e=u+(we(s,6)^we(s,11)^we(s,25))+Ae(s,a,c)+Se[t]+Re[t]|0,f=(we(r,2)^we(r,13)^we(r,22))+Ie(r,n,o)|0;u=c,c=a,a=s,s=i+e|0,i=o,o=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,o,i,s,a,c,u)}roundClean(){Re.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ke=Ee((()=>new Pe)),Te=new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),_e="SPL Name Service",Ue=new t.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Le=new t.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ce=new t.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Oe=new t.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Ne=new t.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),De=new t.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Me=new t.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ve=new t.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),ze=new t.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),We=[new t.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t.PublicKey("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new t.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM")],je=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Fe=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.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),He=new t.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Ge=new t.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),qe=new t.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),Ye=new t.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function $e(t,e){if(!await t.getAccountInfo(e))throw new kt(exports.ErrorType.AccountDoesNotExist);return he.retrieve(t,e)}async function Ze(t){const e=_e+t,r=ke(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)}async function Xe(e,r,o){const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=await t.PublicKey.findProgramAddress(i,Te);return s}const Qe=async(t,e=Ue)=>{let r=await Ze(t);return{pubkey:await Xe(r,void 0,e),hashed:r}},Je=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=n.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:o}=await Qe(r[1]);return{...await Qe(t,o),isSub:!0,parent:o}}if(3===r.length&&e){const{pubkey:t}=await Qe(r[2]),{pubkey:e}=await Qe("\0".concat(r[1]),t),o=n.Buffer.from([1]).toString();return{...await Qe(o.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...await Qe(t,Ue),isSub:!1,parent:void 0}};var tr,er=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],rr=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 o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](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}(),nr=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),o=this.view[n](this.offset,!0);return this.offset+=r,o},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}(),or=(tr=function(t,e){return tr=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])},tr(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}tr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function ir(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function sr(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 ar=er.concat(["bool","string"]),cr=["option","enum","array","set","map","struct"],ur=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return or(e,t),e}(Error);function fr(t){if("string"!=typeof t||!ar.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&cr.includes(e[0])){var r=e[0];if("option"===r)return fr(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new ur(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');fr({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new ur(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return fr(t.type);throw new ur(t,"{ type, len? }")}(t[r]);if("set"===r)return fr(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new ur(t,"{ key, value }");fr(t.key),fr(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new ur(t,"object");for(var e in t)fr(t[e])}(t[r])}}throw new ur(t,cr.join(", ")+" or "+ar.join(", "))}}var hr=function(){function t(t){this.encoded=new rr,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(er.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&&ir(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),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&ir(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&&ir(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 o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}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?sr(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?sr(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&&ir(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,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&ir(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 o=0,i=n;o<i.length;o++){var s=i[o];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&&ir(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),dr=function(){function t(t){this.buffer=new nr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(er.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)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},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,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),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 o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}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 pr(t,e,r){return void 0===r&&(r=!0),r&&fr(t),new hr(r).encode(e,t)}class lr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return pr(lr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}lr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class yr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return pr(yr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}yr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class gr{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return pr(gr.schema,this)}getInstruction(e,r,n,o,i,s,a,c,u){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:o,isSigner:!0,isWritable:!0}),h.push({pubkey:i,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:c,isSigner:!1,isWritable:!1}),h.push({pubkey:u,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:h,programId:e,data:f})}}gr.schema={struct:{tag:"u8",staleness:"bool"}};class wr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return pr(wr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}wr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class br{constructor(){this.tag=5}serialize(){return pr(br.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}br.schema={struct:{tag:"u8"}};class mr{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return pr(mr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}mr.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const vr=new t.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Er]=t.PublicKey.findProgramAddressSync([vr.toBuffer()],vr);var xr,Ar;(Ar=xr||(xr={}))[Ar.None=0]="None",Ar[Ar.Solana=1]="Solana",Ar[Ar.Ethereum=2]="Ethereum",Ar[Ar.UnverifiedSolana=3]="UnverifiedSolana";const Ir=t=>{switch(t){case xr.None:return 0;case xr.Ethereum:return 20;case xr.Solana:case xr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Sr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Sr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&fr(e),new dr(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))}}Sr.LEN=8,Sr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Br{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Sr.deserialize(t.slice(96,96+Sr.LEN)),r=t.slice(96+Sr.LEN);return new Br(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=Ir(this.header.stalenessValidation)+Ir(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Ir(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Ir(this.header.stalenessValidation),e=t+Ir(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var Rr;exports.Record=void 0,(Rr=exports.Record||(exports.Record={})).IPFS="IPFS",Rr.ARWV="ARWV",Rr.SOL="SOL",Rr.ETH="ETH",Rr.BTC="BTC",Rr.LTC="LTC",Rr.DOGE="DOGE",Rr.Email="email",Rr.Url="url",Rr.Discord="discord",Rr.Github="github",Rr.Reddit="reddit",Rr.Twitter="twitter",Rr.Telegram="telegram",Rr.Pic="pic",Rr.SHDW="SHDW",Rr.POINT="POINT",Rr.BSC="BSC",Rr.Injective="INJ",Rr.Backpack="backpack",Rr.A="A",Rr.AAAA="AAAA",Rr.CNAME="CNAME",Rr.TXT="TXT",Rr.Background="background";const Pr=new Map([[exports.Record.SOL,96],[exports.Record.ETH,20],[exports.Record.BSC,20],[exports.Record.Injective,20],[exports.Record.A,4],[exports.Record.AAAA,16],[exports.Record.Background,32]]);var kr;exports.RecordVersion=void 0,(kr=exports.RecordVersion||(exports.RecordVersion={}))[kr.V1=1]="V1",kr[kr.V2=2]="V2";var Tr="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=",_r="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Ur=0,Lr=-3;function Cr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Or(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Cr,this.dtree=new Cr}var Nr=new Cr,Dr=new Cr,Mr=new Uint8Array(30),Vr=new Uint16Array(30),zr=new Uint8Array(30),Wr=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]),Fr=new Cr,Kr=new Uint8Array(320);function Hr(t,e,r,n){var o,i;for(o=0;o<r;++o)t[o]=0;for(o=0;o<30-r;++o)t[o+r]=o/r|0;for(i=n,o=0;o<30;++o)e[o]=i,i+=1<<t[o]}var Gr=new Uint16Array(16);function qr(t,e,r,n){var o,i;for(o=0;o<16;++o)t.table[o]=0;for(o=0;o<n;++o)t.table[e[r+o]]++;for(t.table[0]=0,i=0,o=0;o<16;++o)Gr[o]=i,i+=t.table[o];for(o=0;o<n;++o)e[r+o]&&(t.trans[Gr[e[r+o]]++]=o)}function Yr(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function $r(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 Zr(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,o=0,i=t.tag;do{n=2*n+(1&i),i>>>=1,++o,r+=e.table[o],n-=e.table[o]}while(n>=0);return t.tag=i,t.bitcount-=o,e.trans[r+n]}function Xr(t,e,r){var n,o,i,s,a,c;for(n=$r(t,5,257),o=$r(t,5,1),i=$r(t,4,4),s=0;s<19;++s)Kr[s]=0;for(s=0;s<i;++s){var u=$r(t,3,0);Kr[jr[s]]=u}for(qr(Fr,Kr,0,19),a=0;a<n+o;){var f=Zr(t,Fr);switch(f){case 16:var h=Kr[a-1];for(c=$r(t,2,3);c;--c)Kr[a++]=h;break;case 17:for(c=$r(t,3,3);c;--c)Kr[a++]=0;break;case 18:for(c=$r(t,7,11);c;--c)Kr[a++]=0;break;default:Kr[a++]=f}}qr(e,Kr,0,n),qr(r,Kr,n,o)}function Qr(t,e,r){for(;;){var n,o,i,s,a=Zr(t,e);if(256===a)return Ur;if(a<256)t.dest[t.destLen++]=a;else for(n=$r(t,Mr[a-=257],Vr[a]),o=Zr(t,r),s=i=t.destLen-$r(t,zr[o],Wr[o]);s<i+n;++s)t.dest[t.destLen++]=t.dest[s]}}function Jr(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 Lr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Ur}!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}(Nr,Dr),Hr(Mr,Vr,4,3),Hr(zr,Wr,2,1),Mr[28]=0,Vr[28]=258;var tn=function(t,e){var r,n,o=new Or(t,e);do{switch(r=Yr(o),$r(o,2,0)){case 0:n=Jr(o);break;case 1:n=Qr(o,Nr,Dr);break;case 2:Xr(o,o.ltree,o.dtree),n=Qr(o,o.ltree,o.dtree);break;default:n=Lr}if(n!==Ur)throw new Error("Data error")}while(!r);return o.destLen<o.dest.length?"function"==typeof o.dest.slice?o.dest.slice(0,o.destLen):o.dest.subarray(0,o.destLen):o.dest};const en=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],rn=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var nn={swap32LE:t=>{en&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)rn(t,r,r+3),rn(t,r+1,r+2)})(t)}};const on=tn,{swap32LE:sn}=nn;var an=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=on(t,new Uint8Array(r)),t=on(t,new Uint8Array(r)),sn(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]}},cn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,cn.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof Buffer,i="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=Array.prototype.slice.call(a),u=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(c),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))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},l=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,o,i="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(o=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");i+=c[(e=r<<16|n<<8|o)>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}return s?i.slice(0,s-3)+"===".substring(s):i},g=n?function(t){return btoa(t)}:o?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=o?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,o=t.length;n<o;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?p(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)},x=o?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},A=function(t,e){return void 0===e&&(e=!1),e?p(x(t)):x(t)},I=function(t){return A(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=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))}},R=function(t){return t.replace(S,B)},P=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,o="",i=0;i<t.length;)e=u[t.charAt(i++)]<<18|u[t.charAt(i++)]<<12|(r=u[t.charAt(i++)])<<6|(n=u[t.charAt(i++)]),o+=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 o},k=r?function(t){return atob(l(t))}:o?function(t){return Buffer.from(t,"base64").toString("binary")}:P,T=o?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(k(t).split("").map((function(t){return t.charCodeAt(0)})))},_=function(t){return T(L(t))},U=o?function(t){return Buffer.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(T(t))}:function(t){return R(k(t))},L=function(t){return l(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return U(L(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 A(this,t)})),t("toBase64URI",(function(){return A(this,!0)})),t("toBase64URL",(function(){return A(this,!0)})),t("toUint8Array",(function(){return _(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)}))},V=function(){D(),M()},z={version:t,VERSION:e,atob:k,atobPolyfill:P,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:A,encode:A,encodeURI:I,encodeURL:I,utob:E,btou:R,decode:C,isValid:O,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:M,extendBuiltins:V,Base64:{}};return Object.keys(z).forEach((function(t){return z.Base64[t]=z[t]})),z}();const un={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},fn=Tr,hn=_r,dn=an,pn=cn.exports.Base64,ln=new dn(pn.toUint8Array(fn)),yn=new dn(pn.toUint8Array(hn));function gn(t,e){return 0!=(t&e)}const wn=0,bn=1,mn=2;function vn(t,e){const r=t.length;let n=0,o=wn;for(let i=e;i+1<r;i++){const r=t[i+0],s=t[i+1];switch(gn(r,un.Regional_Indicator)||(n=0),o){case mn:case wn:o=gn(r,un.Extended_Pictographic)?bn:wn;break;case bn:o=gn(r,un.Extend)?bn:gn(r,un.ZWJ)&&gn(s,un.Extended_Pictographic)?mn:wn}if(!gn(r,un.CR)||!gn(s,un.LF)){if(gn(r,un.Control|un.CR|un.LF))return i+1-e;if(gn(s,un.Control|un.CR|un.LF))return i+1-e;if(!(gn(r,un.L)&&gn(s,un.L|un.V|un.LV|un.LVT)||gn(r,un.LV|un.V)&&gn(s,un.V|un.T)||gn(r,un.LVT|un.T)&&gn(s,un.T)||gn(s,un.Extend|un.ZWJ)||gn(s,un.SpacingMark)||gn(r,un.Prepend)||o===mn)){if(!gn(r,un.Regional_Indicator)||!gn(s,un.Regional_Indicator)||n%2!=0)return i+1-e;n++}}}return r-e}var En=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const o=t.codePointAt(e);n.push(ln.get(o)|yn.get(o)),e+=o>65535?2:1,r.push(e)}for(let o=0;o<n.length;){const i=vn(n,o),s=r[o],a=r[o+i];e.push(t.slice(s,a)),o+=i}return e},xn=r(En);const An=t=>{const e=_e+t,r=ke(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)},In=(e,r,o)=>{const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=t.PublicKey.findProgramAddressSync(i,Te);return s};async function Sn(t,e){const r=An(e.toBase58()),n=In(r,Ne),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Ln(o.data)}async function Bn(t,e){let r=[];for(let t of e){const e=An(t.toBase58()),n=In(e,Ne);r.push(n)}return(await he.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Ln(t.data)}))}const Rn=(t,e=Ue,r)=>{let n=An(t);return{pubkey:In(n,r,e),hashed:n}},Pn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?Er:void 0,o=t.split(".");if(2===o.length){const t=n.Buffer.from([e||0]).toString().concat(o[0]),{pubkey:i}=Rn(o[1]);return{...Rn(t,i,r),isSub:!0,parent:i}}if(3===o.length&&e){const{pubkey:t}=Rn(o[2]),{pubkey:n}=Rn("\0".concat(o[1]),t),i=e===exports.RecordVersion.V2?"":"";return{...Rn(i.concat(o[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(o.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...Rn(t,Ue),isSub:!1,parent:void 0}};async function kn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:Ue.toBase58()}}];return(await t.getProgramAccounts(Te,{filters:r})).map((t=>t.pubkey))}const Tn=(t,e)=>{const{pubkey:r,parent:n}=Pn(t),o=An(r.toBase58());return In(o,Ne,e?n:void 0)},_n=(t,e)=>{const r=An(t.toBase58());return In(r,Ne,e)},Un=(t,e)=>{if(!t)throw new kt(e)};function Ln(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var Cn=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 o=t.charAt(n),i=o.charCodeAt(0);if(255!==e[i])throw new TypeError(o+" is ambiguous");e[i]=n}var s=t.length,a=t.charAt(0),c=Math.log(s)/Math.log(256),u=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,o=0;t[r]===a;)n++,r++;for(var i=(t.length-r)*c+1>>>0,u=new Uint8Array(i);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=i-1;(0!==f||h<o)&&-1!==d;d--,h++)f+=s*u[d]>>>0,u[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,r++}for(var p=i-o;p!==i&&0===u[p];)p++;for(var l=new Uint8Array(n+(i-p)),y=n;p!==i;)l[y++]=u[p++];return l}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,o=0,i=e.length;o!==i&&0===e[o];)o++,r++;for(var c=(i-o)*u+1>>>0,f=new Uint8Array(c);o!==i;){for(var h=e[o],d=0,p=c-1;(0!==h||d<n)&&-1!==p;p--,d++)h+=256*f[p]>>>0,f[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,o++}for(var l=c-n;l!==c&&0===f[l];)l++;for(var y=a.repeat(r);l<c;++l)y+=t.charAt(f[l]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var On,Nn=Cn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Dn={exports:{}};On=Dn,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"),o=new RegExp("^0x[a-f0-9]+$","i"),i="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(i,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${i})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${i})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,o=0,i=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(i=t.indexOf(":",i+1))>=0;)o++;if("::"===t.substr(0,2)&&o--,"::"===t.substr(-2,2)&&o--,o>e)return null;for(n=e-o,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 u(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;n>0;){if(o=r-n,o<0&&(o=0),t[i]>>o!=e[i]>>o)return!1;n-=r,i+=1}return!0}function f(t){if(o.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 u(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,o,i;for(n=3;n>=0;n-=1){if(o=this.octets[n],!(o in r))return null;if(i=r[o],e&&0!==i)return null;8!==i&&(e=!0),t+=i}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(),o=[];let i=0;for(;i<4;)o.push(parseInt(r[i],10)|255^parseInt(n[i],10)),i++;return new this(o)}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,o,i;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}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,o;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(o=f(e[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(o>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(o=f(t[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(o>>16&255),r.push(o>>8&255),r.push(255&o),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(o=f(t[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(o>>8&255),r.push(255&o),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 u(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,o;for(let i=7;i>=0;i-=1){if(n=this.parts[i],!(n in r))return null;if(o=r[n],e&&0!==o)return null;16!==o&&(e=!0),t+=o}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,o=-1;for(;r=t.exec(e);)r[0].length>o&&(n=r.index,o=r[0].length);return o<0?e:`${e.substring(0,n)}::${e.substring(n+o)}`},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(),o=[];let i=0;for(;i<16;)o.push(parseInt(r[i],10)|255^parseInt(n[i],10)),i++;return new this(o)}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,o,i;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}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,o,i,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return c(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=c(n[1].slice(0,-1)+s,6),e.parts)){for(i=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<i.length;r++)if(o=i[r],!(0<=o&&o<=255))return null;return e.parts.push(i[0]<<8|i[1]),e.parts.push(i[2]<<8|i[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,o,i,s;for(o in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,o))for(i=e[o],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(s=i[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return o;return r},On.exports?On.exports=d:t.ipaddr=d}(e);var Mn=Dn.exports;const Vn=2147483647,zn=36,Wn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},jn=Math.floor,Fn=String.fromCharCode;function Kn(t){throw new RangeError(Wn[t])}const Hn=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},Gn=function(t,e,r){let n=0;for(t=r?jn(t/700):t>>1,t+=jn(t/e);t>455;n+=zn)t=jn(t/35);return jn(n+36*t/(t+38))},qn=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const o=t.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&o)<<10)+(1023&n)+65536):(e.push(o),r--)}else e.push(o)}return e}(t);const r=t.length;let n=128,o=0,i=72;for(const r of t)r<128&&e.push(Fn(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=Vn;for(const e of t)e>=n&&e<r&&(r=e);const c=a+1;r-n>jn((Vn-o)/c)&&Kn("overflow"),o+=(r-n)*c,n=r;for(const r of t)if(r<n&&++o>Vn&&Kn("overflow"),r===n){let t=o;for(let r=zn;;r+=zn){const n=r<=i?1:r>=i+26?26:r-i;if(t<n)break;const o=t-n,s=zn-n;e.push(Fn(Hn(n+o%s,0))),t=jn(o/s)}e.push(Fn(Hn(t,0))),i=Gn(o,c,a===s),o=0,++a}++o,++n}return e.join("")},Yn=BigInt(2**32-1),$n=BigInt(32);function Zn(t,e=!1){return e?{h:Number(t&Yn),l:Number(t>>$n&Yn)}:{h:0|Number(t>>$n&Yn),l:0|Number(t&Yn)}}const Xn={fromBig:Zn,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:i,l:s}=Zn(t[o],e);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<$n|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 o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}},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,o)=>e+r+n+o+(t/2**32|0)|0,add5H:(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0,add5L:(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0)};var Qn=Xn;const[Jn,to]=(()=>Qn.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)))))(),eo=new Uint32Array(80),ro=new Uint32Array(80);class no extends xe{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:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:f,Fl:h,Gh:d,Gl:p,Hh:l,Hl:y}=this;return[t,e,r,n,o,i,s,a,c,u,f,h,d,p,l,y]}set(t,e,r,n,o,i,s,a,c,u,f,h,d,p,l,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|p,this.Hh=0|l,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)eo[r]=t.getUint32(e),ro[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|eo[t-15],r=0|ro[t-15],n=Qn.rotrSH(e,r,1)^Qn.rotrSH(e,r,8)^Qn.shrSH(e,r,7),o=Qn.rotrSL(e,r,1)^Qn.rotrSL(e,r,8)^Qn.shrSL(e,r,7),i=0|eo[t-2],s=0|ro[t-2],a=Qn.rotrSH(i,s,19)^Qn.rotrBH(i,s,61)^Qn.shrSH(i,s,6),c=Qn.rotrSL(i,s,19)^Qn.rotrBL(i,s,61)^Qn.shrSL(i,s,6),u=Qn.add4L(o,c,ro[t-7],ro[t-16]),f=Qn.add4H(u,n,a,eo[t-7],eo[t-16]);eo[t]=0|f,ro[t]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:h,Fh:d,Fl:p,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=Qn.rotrSH(f,h,14)^Qn.rotrSH(f,h,18)^Qn.rotrBH(f,h,41),b=Qn.rotrSL(f,h,14)^Qn.rotrSL(f,h,18)^Qn.rotrBL(f,h,41),m=f&d^~f&l,v=h&p^~h&y,E=Qn.add5L(w,b,v,to[t],ro[t]),x=Qn.add5H(E,g,e,m,Jn[t],eo[t]),A=0|E,I=Qn.rotrSH(r,n,28)^Qn.rotrBH(r,n,34)^Qn.rotrBH(r,n,39),S=Qn.rotrSL(r,n,28)^Qn.rotrBL(r,n,34)^Qn.rotrBL(r,n,39),B=r&o^r&s^o&s,R=n&i^n&a^i&a;g=0|l,w=0|y,l=0|d,y=0|p,d=0|f,p=0|h,({h:f,l:h}=Qn.add(0|c,0|u,0|x,0|A)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const P=Qn.add3L(A,S,R);r=Qn.add3H(P,x,I,B),n=0|P}({h:r,l:n}=Qn.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=Qn.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=Qn.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=Qn.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:h}=Qn.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:p}=Qn.add(0|this.Fh,0|this.Fl,0|d,0|p)),({h:l,l:y}=Qn.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=Qn.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,h,d,p,l,y,g,w)}roundClean(){eo.fill(0),ro.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 oo=Ee((()=>new no));
12
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const io=BigInt(1),so=BigInt(2);function ao(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const co=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function uo(t){if(!ao(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=co[t[r]];return e}function fo(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const ho={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function po(t){return t>=ho._0&&t<=ho._9?t-ho._0:t>=ho._A&&t<=ho._F?t-(ho._A-10):t>=ho._a&&t<=ho._f?t-(ho._a-10):void 0}function lo(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,o=0;e<r;e++,o+=2){const r=po(t.charCodeAt(o)),i=po(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function yo(t){if(!ao(t))throw new Error("Uint8Array expected");return fo(uo(Uint8Array.from(t).reverse()))}function go(t,e){return lo(t.toString(16).padStart(2*e,"0"))}function wo(t,e){return go(t,e).reverse()}function bo(t,e,r){let n;if("string"==typeof e)try{n=lo(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!ao(e))throw new Error(`${t} must be hex string or Uint8Array`);n=Uint8Array.from(e)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${t} expected ${r} bytes, got ${o}`);return n}function mo(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!ao(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 o=t[e];r.set(o,n),n+=o.length}return r}const vo=t=>(so<<BigInt(t-1))-io,Eo={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||ao(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 xo(t,e,r={}){const n=(e,r,n)=>{const o=Eo[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=t[e];if(!(n&&void 0===i||o(i,t)))throw new Error(`Invalid param ${String(e)}=${i} (${typeof i}), 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 Ao=BigInt(0),Io=BigInt(1),So=BigInt(2),Bo=BigInt(3),Ro=BigInt(4),Po=BigInt(5),ko=BigInt(8);function To(t,e){const r=t%e;return r>=Ao?r:e+r}function _o(t,e,r){if(r<=Ao||e<Ao)throw new Error("Expected power/modulo > 0");if(r===Io)return Ao;let n=Io;for(;e>Ao;)e&Io&&(n=n*t%r),t=t*t%r,e>>=Io;return n}function Uo(t,e,r){let n=t;for(;e-- >Ao;)n*=n,n%=r;return n}function Lo(t,e){if(t===Ao||e<=Ao)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=To(t,e),n=e,o=Ao,i=Io;for(;r!==Ao;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==Io)throw new Error("invert: does not exist");return To(o,e)}function Co(t){if(t%Ro===Bo){const e=(t+Io)/Ro;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%ko===Po){const e=(t-Po)/ko;return function(t,r){const n=t.mul(r,So),o=t.pow(n,e),i=t.mul(r,o),s=t.mul(t.mul(i,So),o),a=t.mul(i,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-Io)/So;let r,n,o;for(r=t-Io,n=0;r%So===Ao;r/=So,n++);for(o=So;o<t&&_o(o,e,t)!==t-Io;o++);if(1===n){const e=(t+Io)/Ro;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 i=(r+Io)/So;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=n,c=t.pow(t.mul(t.ONE,o),r),u=t.pow(s,i),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(c,Io<<BigInt(a-e-1));c=t.sqr(r),u=t.mul(u,r),f=t.mul(f,c),a=e}return u}}(t)}BigInt(9),BigInt(16);const Oo=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function No(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=o,r=d,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function s(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(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 c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=s(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if($(t,Uint8Array)){const e=new Uint8Array(t);return p(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($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return p(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 a.from(n,e,r);const o=function(t){if(a.isBuffer(t)){const e=0|l(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?s(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.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 u(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 u(t),s(t<0?0:0|l(t))}function h(t){const e=t.length<0?0:0|l(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(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,a.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 y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(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 o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(o)return n?-1:G(t).length;e=(""+e).toLowerCase(),o=!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 T(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(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,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){let i,s=1,a=t.length,c=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,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(t,i+n)!==u(e,n)){r=!1;break}if(r)return i}return-1}function v(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(X(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return Y(G(e,t.length-r),t,r,n)}function x(t,e,r,n){return Y(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 A(t,e,r,n){return Y(q(e),t,r,n)}function I(t,e,r,n){return Y(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(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 B(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(i=c));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}t.kMaxLength=i,a.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}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return f(t)},a.allocUnsafeSlow=function(t){return f(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),$(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.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 o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=a.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if($(e,Uint8Array))o+e.length>n.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.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},a.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},a.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},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.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&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,o){if($(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.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===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const c=Math.min(i,s),u=this.slice(n,o),f=t.slice(e,r);for(let t=0;t<c;++t)if(u[t]!==f[t]){i=u[t],s=f[t];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.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 o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!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 x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=Z[t[n]];return o}function _(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function U(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 L(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)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,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;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,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;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,o,i){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,o,i){return e=+e,n>>>=0,i||N(t,0,n,4),r.write(t,e,n,o,23,4),n+4}function M(t,e,n,o,i){return e=+e,n>>>=0,i||N(t,0,n,8),r.write(t,e,n,o,52,8),n+8}a.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,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),a.prototype.readBigUInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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)})),a.prototype.readBigInt64BE=Q((function(t){F(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(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)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),r.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),r.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){L(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeBigUInt64LE=Q((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Q((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(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},a.prototype.writeBigInt64LE=Q((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Q((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.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 o=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),o},a.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&&!a.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 o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=a.isBuffer(t)?t:a.from(t,n),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%s]}return this};const V={};function z(t,e,r){V[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 W(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 j(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){F(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||K(e,t.length-(r+1))}(n,o,i)}function F(t,e){if("number"!=typeof t)throw new V.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.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.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=W(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Q(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}}(n);const p=new t.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new t.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const l=new t.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new t.PublicKey("So11111111111111111111111111111111111111112"),new t.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.s16=y.s8=y.nu64be=y.u48be=y.u40be=y.u32be=y.u24be=y.u16be=y.nu64=y.u48=y.u40=tt=y.u32=y.u24=y.u16=J=y.u8=y.offset=y.greedy=y.Constant=y.UTF8=y.CString=y.Blob=y.Boolean=y.BitField=y.BitStructure=y.VariantLayout=y.Union=y.UnionLayoutDiscriminator=y.UnionDiscriminator=y.Structure=y.Sequence=y.DoubleBE=y.Double=y.FloatBE=y.Float=y.NearInt64BE=y.NearInt64=y.NearUInt64BE=y.NearUInt64=y.IntBE=y.Int=y.UIntBE=y.UInt=y.OffsetLayout=y.GreedyCount=y.ExternalLayout=y.bindConstructorLayout=y.nameWithProperty=y.Layout=y.uint8ArrayToBuffer=y.checkUint8Array=void 0,y.constant=y.utf8=y.cstr=rt=y.blob=y.unionLayoutDiscriminator=y.union=y.seq=y.bits=et=y.struct=y.f64be=y.f64=y.f32be=y.f32=y.ns64be=y.s48be=y.s40be=y.s32be=y.s24be=y.s16be=y.ns64=y.s48=y.s40=y.s32=y.s24=void 0;const g=n;function w(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function b(t){return w(t),g.Buffer.from(t.buffer,t.byteOffset,t.length)}y.checkUint8Array=w,y.uint8ArrayToBuffer=b;class m{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 v(t,e){return e.property?t+"["+e.property+"]":t}y.Layout=m,y.nameWithProperty=v,y.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 m))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 E extends m{isCount(){throw new Error("ExternalLayout is abstract")}}y.ExternalLayout=E;class x extends E{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){w(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}y.GreedyCount=x;class A extends E{constructor(t,e=0,r){if(!(t instanceof m))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 I||this.layout instanceof S}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)}}y.OffsetLayout=A;class I extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntLE(t,r,this.span),this.span}}y.UInt=I;class S extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readUIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeUIntBE(t,r,this.span),this.span}}y.UIntBE=S;class B extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntLE(e,this.span)}encode(t,e,r=0){return b(e).writeIntLE(t,r,this.span),this.span}}y.Int=B;class R extends m{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return b(t).readIntBE(e,this.span)}encode(t,e,r=0){return b(e).writeIntBE(t,r,this.span),this.span}}y.IntBE=R;const P=Math.pow(2,32);function k(t){const e=Math.floor(t/P);return{hi32:e,lo32:t-e*P}}function T(t,e){return t*P+e}class _ extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeUInt32LE(n.hi32,r+4),8}}y.NearUInt64=_;class U extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearUInt64BE=U;class L extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t),n=r.readUInt32LE(e);return T(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeUInt32LE(n.lo32,r),o.writeInt32LE(n.hi32,r+4),8}}y.NearInt64=L;class C extends m{constructor(t){super(8,t)}decode(t,e=0){const r=b(t);return T(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=k(t),o=b(e);return o.writeInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearInt64BE=C;class O extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatLE(e)}encode(t,e,r=0){return b(e).writeFloatLE(t,r),4}}y.Float=O;class N extends m{constructor(t){super(4,t)}decode(t,e=0){return b(t).readFloatBE(e)}encode(t,e,r=0){return b(e).writeFloatBE(t,r),4}}y.FloatBE=N;class D extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleLE(e)}encode(t,e,r=0){return b(e).writeDoubleLE(t,r),8}}y.Double=D;class M extends m{constructor(t){super(8,t)}decode(t,e=0){return b(t).readDoubleBE(e)}encode(t,e,r=0){return b(e).writeDoubleBE(t,r),8}}y.DoubleBE=M;class V extends m{constructor(t,e,r){if(!(t instanceof m))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof E&&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 E)&&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 E&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let o=0;for(;o<n;)r+=this.elementLayout.getSpan(t,e+r),++o}return r}decode(t,e=0){const r=[];let n=0,o=this.count;for(o instanceof E&&(o=o.decode(t,e));n<o;)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,o=t.reduce(((t,o)=>t+n.encode(o,e,r+t)),0);return this.count instanceof E&&this.count.encode(t.length,e,r),o}}y.Sequence=V;class z extends m{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof m),!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 o=n.getSpan(t,e);return e+=o,r+o}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){w(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 o=0,i=0;for(const n of this.fields){let s=n.span;if(i=0<s?s:0,void 0!==n.property){const o=t[n.property];void 0!==o&&(i=n.encode(o,e,r),0>s&&(s=n.getSpan(e,r)))}o=r,r+=s}return o+i-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)}}}y.Structure=z;class W{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}y.UnionDiscriminator=W;class j extends W{constructor(t,e){if(!(t instanceof E&&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)}}y.UnionLayoutDiscriminator=j;class F extends m{constructor(t,e,r){let n;if(t instanceof I||t instanceof S)n=new j(new A(t));else if(t instanceof E&&t.isCount())n=new j(t);else{if(!(t instanceof W))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 m))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 o=-1;e&&(o=e.span,0<=o&&(t instanceof I||t instanceof S)&&(o+=n.layout.span)),super(o,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof I||t instanceof S,this.defaultLayout=e,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return i(t)},this.configGetSourceVariant=function(t){i=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,o=n.decode(t,e),i=this.registry[o];if(void 0===i){const i=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=o,r[i.property]=i.decode(t,e+s)}else r=i.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=n.layout.span),n.encode(t[n.property],e,r),i+o.encode(t[o.property],e,r+i)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new K(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]}}y.Union=F;class K extends m{constructor(t,e,r,n){if(!(t instanceof F))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 m))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 o=t.span;0>t.span&&(o=r?r.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,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 o=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),o+=this.layout.getSpan(e,r+n),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function H(t){return 0>t&&(t+=4294967296),t}y.VariantLayout=K;class G extends m{constructor(t,e,r){if(!(t instanceof I||t instanceof S))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=H(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 q(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new Y(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}}y.BitStructure=G;class q{constructor(t,e,r){if(!(t instanceof G))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,o=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+o>n)throw new Error("bits too long for span remainder ("+(n-o)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=n-o-e),this.wordMask=H(this.valueMask<<this.start),this.property=r}decode(t,e){return H(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==H(t&this.valueMask))throw new TypeError(v("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=H(t<<this.start);this.container._packedSetValue(H(e&~this.wordMask)|r)}}y.BitField=q;class Y extends q{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)}}y.Boolean=Y;class $ extends m{constructor(t,e){if(!(t instanceof E&&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 E||(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)),b(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof E&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(v("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const o=b(t);return b(e).write(o.toString("hex"),r,n,"hex"),this.length instanceof E&&this.length.encode(n,e,r),n}}y.Blob=$;class X extends m{constructor(t){super(-1,t)}getSpan(t,e=0){w(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 b(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(r+o>e.length)throw new RangeError("encoding overruns Buffer");const i=b(e);return n.copy(i,r),i[r+o]=0,o+1}}y.CString=X;class Z extends m{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 w(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 b(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=g.Buffer.from(t,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(r+o>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(b(e),r),o}}y.UTF8=Z;class Q extends m{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}y.Constant=Q,y.greedy=(t,e)=>new x(t,e),y.offset=(t,e,r)=>new A(t,e,r);var J=y.u8=t=>new I(1,t);y.u16=t=>new I(2,t),y.u24=t=>new I(3,t);var tt=y.u32=t=>new I(4,t);y.u40=t=>new I(5,t),y.u48=t=>new I(6,t),y.nu64=t=>new _(t),y.u16be=t=>new S(2,t),y.u24be=t=>new S(3,t),y.u32be=t=>new S(4,t),y.u40be=t=>new S(5,t),y.u48be=t=>new S(6,t),y.nu64be=t=>new U(t),y.s8=t=>new B(1,t),y.s16=t=>new B(2,t),y.s24=t=>new B(3,t),y.s32=t=>new B(4,t),y.s40=t=>new B(5,t),y.s48=t=>new B(6,t),y.ns64=t=>new L(t),y.s16be=t=>new R(2,t),y.s24be=t=>new R(3,t),y.s32be=t=>new R(4,t),y.s40be=t=>new R(5,t),y.s48be=t=>new R(6,t),y.ns64be=t=>new C(t),y.f32=t=>new O(t),y.f32be=t=>new N(t),y.f64=t=>new D(t),y.f64be=t=>new M(t);var et=y.struct=(t,e,r)=>new z(t,e,r);y.bits=(t,e,r)=>new G(t,e,r),y.seq=(t,e,r)=>new V(t,e,r),y.union=(t,e,r)=>new F(t,e,r),y.unionLayoutDiscriminator=(t,e)=>new j(t,e);var rt=y.blob=(t,e)=>new $(t,e);y.cstr=t=>new X(t),y.utf8=(t,e)=>new Z(t,e),y.constant=(t,e)=>new Q(t,e);const nt=t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)});var ot={};Object.defineProperty(ot,"__esModule",{value:!0});var it=ot.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};ot.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var st=ot.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}};ot.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};const at=(ct=8,t=>{const e=rt(ct,t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>{const r=n(t,e);return it(Buffer.from(r))},o.encode=(t,e,n)=>{const o=st(t,ct);return r(o,e,n)},o});var ct;const ut=t=>{const e=J(t),{encode:r,decode:n}=nt(e),o=e;return o.decode=(t,e)=>!!n(t,e),o.encode=(t,e,n)=>{const o=Number(t);return r(o,e,n)},o},ft=e=>{const r=rt(32,e),{encode:n,decode:o}=nt(r),i=r;return i.decode=(e,r)=>{const n=o(e,r);return new t.PublicKey(n)},i.encode=(t,e,r)=>{const o=t.toBuffer();return n(o,e,r)},i};class ht extends Error{constructor(t){super(t)}}class dt extends ht{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class pt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class lt extends ht{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class yt extends ht{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class gt extends ht{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var wt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Mint=1]="Mint",t[t.Account=2]="Account"}(wt||(wt={}));const bt=1,mt=et([J("m"),J("n"),ut("isInitialized"),ft("signer1"),ft("signer2"),ft("signer3"),ft("signer4"),ft("signer5"),ft("signer6"),ft("signer7"),ft("signer8"),ft("signer9"),ft("signer10"),ft("signer11")]).span;var vt;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initialized=1]="Initialized",t[t.Frozen=2]="Frozen"}(vt||(vt={}));const Et=et([ft("mint"),ft("owner"),at("amount"),tt("delegateOption"),ft("delegate"),J("state"),tt("isNativeOption"),at("isNative"),at("delegatedAmount"),tt("closeAuthorityOption"),ft("closeAuthority")]),xt=Et.span,At=et([tt("mintAuthorityOption"),ft("mintAuthority"),at("supply"),J("decimals"),ut("isInitialized"),tt("freezeAuthorityOption"),ft("freezeAuthority")]),It=At.span;async function St(t,e,r,n=p){return function(t,e,r=p){if(!e)throw new dt;if(!e.owner.equals(r))throw new pt;if(e.data.length<It)throw new lt;const n=At.decode(e.data.slice(0,It));let o=Buffer.alloc(0);if(e.data.length>It){if(e.data.length<=xt)throw new lt;if(e.data.length===mt)throw new lt;if(e.data[xt]!=wt.Mint)throw new yt;o=e.data.slice(xt+bt)}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:o}}(e,await t.getAccountInfo(e,r),n)}function Bt(e,r,n=!1,o=p,i=l){if(!n&&!t.PublicKey.isOnCurve(r.toBuffer()))throw new gt;const[s]=t.PublicKey.findProgramAddressSync([r.toBuffer(),o.toBuffer(),e.toBuffer()],i);return s}function Rt(e,r,n,o,i=p,s=l){return function(e,r,n,o,i,s=p,a=l){const c=[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:c,programId:a,data:i})}(e,r,n,o,Buffer.from([1]),i,s)}var Pt;exports.ErrorType=void 0,(Pt=exports.ErrorType||(exports.ErrorType={})).SymbolNotFound="SymbolNotFound",Pt.InvalidSubdomain="InvalidSubdomain",Pt.FavouriteDomainNotFound="FavouriteDomainNotFound",Pt.MissingParentOwner="MissingParentOwner",Pt.U32Overflow="U32Overflow",Pt.InvalidBufferLength="InvalidBufferLength",Pt.U64Overflow="U64Overflow",Pt.NoRecordData="NoRecordData",Pt.InvalidRecordData="InvalidRecordData",Pt.UnsupportedRecord="UnsupportedRecord",Pt.InvalidEvmAddress="InvalidEvmAddress",Pt.InvalidInjectiveAddress="InvalidInjectiveAddress",Pt.InvalidARecord="InvalidARecord",Pt.InvalidAAAARecord="InvalidAAAARecord",Pt.InvalidRecordInput="InvalidRecordInput",Pt.InvalidSignature="InvalidSignature",Pt.AccountDoesNotExist="AccountDoesNotExist",Pt.MultipleRegistries="MultipleRegistries",Pt.InvalidReverseTwitter="InvalidReverseTwitter",Pt.NoAccountData="NoAccountData",Pt.InvalidInput="InvalidInput",Pt.InvalidDomain="InvalidDomain",Pt.InvalidCustomBg="InvalidCustomBackground",Pt.UnsupportedSignature="UnsupportedSignature",Pt.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",Pt.RecordIsNotSigned="RecordIsNotSigned",Pt.UnsupportedSignatureType="UnsupportedSignatureType",Pt.InvalidSolRecordV2="InvalidSolRecordV2",Pt.MissingVerifier="MissingVerifier",Pt.PythFeedNotFound="PythFeedNotFound";class kt extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,kt)}}class Tt{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(4);return t.writeUInt32LE(Number(this.value)),t}static fromBuffer(t){if(4!==t.length)throw new kt(exports.ErrorType.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 _t{constructor(t){this.value=BigInt(t)}toBuffer(){const t=n.Buffer.alloc(8);return t.writeBigUInt64LE(this.value),t}static fromBuffer(t){if(8!==t.length)throw new kt(exports.ErrorType.U64Overflow,`Invalid buffer length: ${t.length}`);const e=t.readBigUInt64LE(0);return new _t(e)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ut,Lt=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ct=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 o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](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}(),Ot=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),o=this.view[n](this.offset,!0);return this.offset+=r,o},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}(),Nt=(Ut=function(t,e){return Ut=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])},Ut(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}Ut(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function Dt(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function Mt(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=Lt.concat(["bool","string"]),zt=["option","enum","array","set","map","struct"],Wt=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Nt(e,t),e}(Error);function jt(t){if("string"!=typeof t||!Vt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&zt.includes(e[0])){var r=e[0];if("option"===r)return jt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new Wt(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');jt({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return jt(t.type);throw new Wt(t,"{ type, len? }")}(t[r]);if("set"===r)return jt(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new Wt(t,"{ key, value }");jt(t.key),jt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new Wt(t,"object");for(var e in t)jt(t[e])}(t[r])}}throw new Wt(t,zt.join(", ")+" or "+Vt.join(", "))}}var Ft=function(){function t(t){this.encoded=new Ct,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(Lt.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&&Dt(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),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&Dt(t,"string",this.fieldPath);for(var e=t,r=[],n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r.push(o):o<2048?r.push(192|o>>6,128|63&o):o<55296||o>=57344?r.push(224|o>>12,128|o>>6&63,128|63&o):(n++,o=65536+((1023&o)<<10|1023&e.charCodeAt(n)),r.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o))}this.encoded.store_value(r.length,"u32"),this.encoded.store_bytes(new Uint8Array(r))},t.prototype.encode_boolean=function(t){this.checkTypes&&Dt(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 o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}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?Mt(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?Mt(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&&Dt(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,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&Dt(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 o=0,i=n;o<i.length;o++){var s=i[o];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&&Dt(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),Kt=function(){function t(t){this.buffer=new Ot(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(Lt.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)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},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 o=e[n];if(o<128)r.push(o);else if(o<224)r.push((31&o)<<6|63&e[++n]);else if(o<240)r.push((15&o)<<12|(63&e[++n])<<6|63&e[++n]);else{var i=(7&o)<<18|(63&e[++n])<<12|(63&e[++n])<<6|63&e[++n];r.push(i)}}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,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),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 o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}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 Ht(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Ft(r).encode(e,t)}function Gt(t,e,r){return void 0===r&&(r=!0),r&&jt(t),new Kt(e).decode(t)}function qt(e,r,o,i,s,a,c,u,f,h,d){const p=[n.Buffer.from(Int8Array.from([0])),new Tt(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(p),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1}];return f?y.push({pubkey:f,isSigner:!0,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),h?y.push({pubkey:h,isSigner:!1,isWritable:!1}):y.push({pubkey:new t.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d&&y.push({pubkey:d,isSigner:!0,isWritable:!1}),new t.TransactionInstruction({keys:y,programId:e,data:l})}function Yt(e,r,o,i,s){const a=[n.Buffer.from(Int8Array.from([1])),o.toBuffer(),new Tt(i.length).toBuffer(),i],c=n.Buffer.concat(a),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new t.TransactionInstruction({keys:u,programId:e,data:c})}function $t(e,r,o,i,s,a,c){const u=[n.Buffer.from(Int8Array.from([2])),o.toBuffer()],f=n.Buffer.concat(u),h=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c||i,isSigner:!0,isWritable:!1}];return s&&h.push({pubkey:s,isSigner:!0,isWritable:!1}),c&&a&&(s||h.push({pubkey:t.PublicKey.default,isSigner:!1,isWritable:!1}),h.push({pubkey:a,isSigner:!1,isWritable:!1})),new t.TransactionInstruction({keys:h,programId:e,data:f})}function Xt(e,r,o,i){const s=[n.Buffer.from(Int8Array.from([3]))],a=n.Buffer.concat(s),c=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!0}];return new t.TransactionInstruction({keys:c,programId:e,data:a})}class Zt{constructor(t){this.tag=9,this.name=t.name,this.space=t.space}serialize(){return Ht(Zt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d){const l=n.Buffer.from(this.serialize()),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!0,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!1}];return new t.TransactionInstruction({keys:y,programId:e,data:l})}}Zt.schema={struct:{tag:"u8",name:"string",space:"u32"}};class Qt{constructor(t){this.tag=12,this.name=t.name}serialize(){return Ht(Qt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!1}),p.push({pubkey:a,isSigner:!1,isWritable:!1}),p.push({pubkey:c,isSigner:!0,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&p.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&p.push({pubkey:h,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}Qt.schema={struct:{tag:"u8",name:"string"}};class Jt{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return Ht(Jt.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,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:p,isSigner:!1,isWritable:!1}),v.push({pubkey:l,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 t.TransactionInstruction({keys:v,programId:e,data:m})}}Jt.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class te{constructor(t){this.tag=17,this.name=t.name,this.space=t.space}serialize(){return Ht(te.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h,d,p,l,y,g,w,b){const m=n.Buffer.from(this.serialize());let v=[];return v.push({pubkey:r,isSigner:!1,isWritable:!1}),v.push({pubkey:o,isSigner:!1,isWritable:!1}),v.push({pubkey:i,isSigner:!1,isWritable:!0}),v.push({pubkey:s,isSigner:!1,isWritable:!0}),v.push({pubkey:a,isSigner:!1,isWritable:!1}),v.push({pubkey:c,isSigner:!1,isWritable:!1}),v.push({pubkey:u,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:p,isSigner:!1,isWritable:!0}),v.push({pubkey:l,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 t.TransactionInstruction({keys:v,programId:e,data:m})}}te.schema={struct:{tag:"u8",name:"string",space:"u32"}};class ee{constructor(){this.tag=16}serialize(){return Ht(ee.schema,this)}getInstruction(e,r,o,i,s,a,c,u,f,h){const d=n.Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!1,isWritable:!1}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!0}),p.push({pubkey:a,isSigner:!1,isWritable:!0}),p.push({pubkey:c,isSigner:!1,isWritable:!0}),p.push({pubkey:u,isSigner:!1,isWritable:!1}),p.push({pubkey:f,isSigner:!0,isWritable:!1}),p.push({pubkey:h,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:p,programId:e,data:d})}}ee.schema={struct:{tag:"u8"}};const re=new t.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),ne=n.Buffer.from("tokenized_name"),oe=e=>{const[r]=t.PublicKey.findProgramAddressSync([ne,e.toBuffer()],re);return r};var ie;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(ie||(ie={}));class se{constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=new t.PublicKey(e.nameAccount),this.owner=new t.PublicKey(e.owner),this.nftMint=new t.PublicKey(e.nftMint)}static deserialize(t){return new se(Gt(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.PublicKey.findProgramAddress([n.Buffer.from("nft_record"),e.toBuffer()],r)}}se.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 ae=async(e,r)=>{try{const[n]=await t.PublicKey.findProgramAddress([ne,r.toBuffer()],re);if("0"===(await St(e,n)).supply.toString())return;const o=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],i=await e.getProgramAccounts(p,{filters:o});if(1!=i.length)return;return new t.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ce=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],ue=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(re,{filters:r})})(t,e.mint);if(1===r.length)return se.deserialize(r[0].account.data)},fe=async(t,e)=>{const r=[...ce(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(p,{filters:r})).map((t=>Et.decode(t.account.data))).map((e=>ue(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class he{constructor(e){this.parentName=new t.PublicKey(e.parentName),this.owner=new t.PublicKey(e.owner),this.class=new t.PublicKey(e.class)}static deserialize(t){const e=new he(Gt(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 kt(exports.ErrorType.AccountDoesNotExist);const o=new he(Gt(this.schema,n.data));o.data=null===(r=n.data)||void 0===r?void 0:r.slice(this.HEADER_LEN);return{registry:o,nftOwner:await ae(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new he(Gt(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 de(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 pe(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")}he.HEADER_LEN=96,he.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const le="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
11
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ye(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const ge=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),we=(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 me(t){if("string"==typeof t&&(t=be(t)),!ye(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class ve{clone(){return this._cloneInto()}}function Ee(t){const e=e=>t().update(me(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class xe extends ve{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=ge(this.buffer)}update(t){pe(this);const{view:e,buffer:r,blockLen:n}=this,o=(t=me(t)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=ge(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){pe(this),function(t,e){de(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:o}=this;let{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let t=i;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=ge(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)s.setUint32(4*t,u[t],o)}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:o,destroyed:i,pos:s}=this;return t.length=n,t.pos=s,t.finished=o,t.destroyed=i,n%e&&t.buffer.set(r),t}}const Ae=(t,e,r)=>t&e^~t&r,Ie=(t,e,r)=>t&e^t&r^e&r,Se=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]),Be=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Re=new Uint32Array(64);class Pe extends xe{constructor(){super(64,32,8,!1),this.A=0|Be[0],this.B=0|Be[1],this.C=0|Be[2],this.D=0|Be[3],this.E=0|Be[4],this.F=0|Be[5],this.G=0|Be[6],this.H=0|Be[7]}get(){const{A:t,B:e,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[t,e,r,n,o,i,s,a]}set(t,e,r,n,o,i,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Re[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Re[t-15],r=Re[t-2],n=we(e,7)^we(e,18)^e>>>3,o=we(r,17)^we(r,19)^r>>>10;Re[t]=o+Re[t-7]+n+Re[t-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let t=0;t<64;t++){const e=u+(we(s,6)^we(s,11)^we(s,25))+Ae(s,a,c)+Se[t]+Re[t]|0,f=(we(r,2)^we(r,13)^we(r,22))+Ie(r,n,o)|0;u=c,c=a,a=s,s=i+e|0,i=o,o=n,n=r,r=e+f|0}r=r+this.A|0,n=n+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,o,i,s,a,c,u)}roundClean(){Re.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ke=Ee((()=>new Pe)),Te=new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),_e="SPL Name Service",Ue=new t.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Le=new t.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ce=new t.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Oe=new t.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Ne=new t.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),De=new t.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Me=new t.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ve=new t.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),ze=new t.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),We=[new t.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t.PublicKey("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new t.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM")],je=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Fe=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.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),He=new t.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Ge=new t.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),qe=new t.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),Ye=new t.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function $e(t,e){if(!await t.getAccountInfo(e))throw new kt(exports.ErrorType.AccountDoesNotExist);return he.retrieve(t,e)}async function Xe(t){const e=_e+t,r=ke(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)}async function Ze(e,r,o){const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=await t.PublicKey.findProgramAddress(i,Te);return s}const Qe=async(t,e=Ue)=>{let r=await Xe(t);return{pubkey:await Ze(r,void 0,e),hashed:r}},Je=async(t,e=!1)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=t.split(".");if(2===r.length){const t=n.Buffer.from([e?1:0]).toString().concat(r[0]),{pubkey:o}=await Qe(r[1]);return{...await Qe(t,o),isSub:!0,parent:o}}if(3===r.length&&e){const{pubkey:t}=await Qe(r[2]),{pubkey:e}=await Qe("\0".concat(r[1]),t),o=n.Buffer.from([1]).toString();return{...await Qe(o.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...await Qe(t,Ue),isSub:!1,parent:void 0}};var tr,er=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],rr=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 o="f"===e[0]?"setFloat".concat(r):"i"===e[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](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}(),nr=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),o=this.view[n](this.offset,!0);return this.offset+=r,o},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}(),or=(tr=function(t,e){return tr=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])},tr(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}tr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function ir(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function sr(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 ar=er.concat(["bool","string"]),cr=["option","enum","array","set","map","struct"],ur=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return or(e,t),e}(Error);function fr(t){if("string"!=typeof t||!ar.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&cr.includes(e[0])){var r=e[0];if("option"===r)return fr(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new ur(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');fr({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new ur(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return fr(t.type);throw new ur(t,"{ type, len? }")}(t[r]);if("set"===r)return fr(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new ur(t,"{ key, value }");fr(t.key),fr(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new ur(t,"object");for(var e in t)fr(t[e])}(t[r])}}throw new ur(t,cr.join(", ")+" or "+ar.join(", "))}}var hr=function(){function t(t){this.encoded=new rr,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(er.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&&ir(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),o=0;o<r;o++)n[o]=Number(t&BigInt(255)),t>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},t.prototype.encode_string=function(t){this.checkTypes&&ir(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&&ir(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 o=e.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(t,o)}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?sr(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?sr(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&&ir(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,o=r;n<o.length;n++){var i=o[n];this.encode_value(i,e.set)}},t.prototype.encode_map=function(t,e){this.checkTypes&&ir(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 o=0,i=n;o<i.length;o++){var s=i[o];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&&ir(t,"object",this.fieldPath);for(var r=0,n=Object.keys(e.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(t[o],e.struct[o]),this.fieldPath.pop()}},t}(),dr=function(){function t(t){this.buffer=new nr(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(er.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)),o=n.reduceRight((function(t,e){return t+e.toString(16).padStart(2,"0")}),"");return e&&n[r-1]?BigInt.asIntN(t,BigInt("0x".concat(o))):BigInt("0x".concat(o))},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,o=Object.keys(n)[0];return(e={})[o]=this.decode_value(n[o]),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 o=this.decode_value(t.map.key),i=this.decode_value(t.map.value);r.set(o,i)}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 pr(t,e,r){return void 0===r&&(r=!0),r&&fr(t),new hr(r).encode(e,t)}class lr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return pr(lr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}lr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class yr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return pr(yr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}yr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class gr{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return pr(gr.schema,this)}getInstruction(e,r,n,o,i,s,a,c,u){const f=Buffer.from(this.serialize());let h=[];return h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:n,isSigner:!1,isWritable:!1}),h.push({pubkey:o,isSigner:!0,isWritable:!0}),h.push({pubkey:i,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!0}),h.push({pubkey:a,isSigner:!1,isWritable:!0}),h.push({pubkey:c,isSigner:!1,isWritable:!1}),h.push({pubkey:u,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:h,programId:e,data:f})}}gr.schema={struct:{tag:"u8",staleness:"bool"}};class wr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return pr(wr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}wr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class br{constructor(){this.tag=5}serialize(){return pr(br.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}br.schema={struct:{tag:"u8"}};class mr{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return pr(mr.schema,this)}getInstruction(e,r,n,o,i,s,a,c){const u=Buffer.from(this.serialize());let f=[];return f.push({pubkey:r,isSigner:!1,isWritable:!1}),f.push({pubkey:n,isSigner:!1,isWritable:!1}),f.push({pubkey:o,isSigner:!0,isWritable:!0}),f.push({pubkey:i,isSigner:!1,isWritable:!0}),f.push({pubkey:s,isSigner:!1,isWritable:!0}),f.push({pubkey:a,isSigner:!0,isWritable:!0}),f.push({pubkey:c,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:f,programId:e,data:u})}}mr.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const vr=new t.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Er]=t.PublicKey.findProgramAddressSync([vr.toBuffer()],vr);var xr,Ar;(Ar=xr||(xr={}))[Ar.None=0]="None",Ar[Ar.Solana=1]="Solana",Ar[Ar.Ethereum=2]="Ethereum",Ar[Ar.UnverifiedSolana=3]="UnverifiedSolana";const Ir=t=>{switch(t){case xr.None:return 0;case xr.Ethereum:return 20;case xr.Solana:case xr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Sr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Sr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&fr(e),new dr(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))}}Sr.LEN=8,Sr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Br{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Sr.deserialize(t.slice(96,96+Sr.LEN)),r=t.slice(96+Sr.LEN);return new Br(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=Ir(this.header.stalenessValidation)+Ir(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Ir(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Ir(this.header.stalenessValidation),e=t+Ir(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var Rr;exports.Record=void 0,(Rr=exports.Record||(exports.Record={})).IPFS="IPFS",Rr.ARWV="ARWV",Rr.SOL="SOL",Rr.ETH="ETH",Rr.BTC="BTC",Rr.LTC="LTC",Rr.DOGE="DOGE",Rr.Email="email",Rr.Url="url",Rr.Discord="discord",Rr.Github="github",Rr.Reddit="reddit",Rr.Twitter="twitter",Rr.Telegram="telegram",Rr.Pic="pic",Rr.SHDW="SHDW",Rr.POINT="POINT",Rr.BSC="BSC",Rr.Injective="INJ",Rr.Backpack="backpack",Rr.A="A",Rr.AAAA="AAAA",Rr.CNAME="CNAME",Rr.TXT="TXT",Rr.Background="background";const Pr=new Map([[exports.Record.SOL,96],[exports.Record.ETH,20],[exports.Record.BSC,20],[exports.Record.Injective,20],[exports.Record.A,4],[exports.Record.AAAA,16],[exports.Record.Background,32]]);var kr;exports.RecordVersion=void 0,(kr=exports.RecordVersion||(exports.RecordVersion={}))[kr.V1=1]="V1",kr[kr.V2=2]="V2";var Tr="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=",_r="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Ur=0,Lr=-3;function Cr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Or(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Cr,this.dtree=new Cr}var Nr=new Cr,Dr=new Cr,Mr=new Uint8Array(30),Vr=new Uint16Array(30),zr=new Uint8Array(30),Wr=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]),Fr=new Cr,Kr=new Uint8Array(320);function Hr(t,e,r,n){var o,i;for(o=0;o<r;++o)t[o]=0;for(o=0;o<30-r;++o)t[o+r]=o/r|0;for(i=n,o=0;o<30;++o)e[o]=i,i+=1<<t[o]}var Gr=new Uint16Array(16);function qr(t,e,r,n){var o,i;for(o=0;o<16;++o)t.table[o]=0;for(o=0;o<n;++o)t.table[e[r+o]]++;for(t.table[0]=0,i=0,o=0;o<16;++o)Gr[o]=i,i+=t.table[o];for(o=0;o<n;++o)e[r+o]&&(t.trans[Gr[e[r+o]]++]=o)}function Yr(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function $r(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 Xr(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,o=0,i=t.tag;do{n=2*n+(1&i),i>>>=1,++o,r+=e.table[o],n-=e.table[o]}while(n>=0);return t.tag=i,t.bitcount-=o,e.trans[r+n]}function Zr(t,e,r){var n,o,i,s,a,c;for(n=$r(t,5,257),o=$r(t,5,1),i=$r(t,4,4),s=0;s<19;++s)Kr[s]=0;for(s=0;s<i;++s){var u=$r(t,3,0);Kr[jr[s]]=u}for(qr(Fr,Kr,0,19),a=0;a<n+o;){var f=Xr(t,Fr);switch(f){case 16:var h=Kr[a-1];for(c=$r(t,2,3);c;--c)Kr[a++]=h;break;case 17:for(c=$r(t,3,3);c;--c)Kr[a++]=0;break;case 18:for(c=$r(t,7,11);c;--c)Kr[a++]=0;break;default:Kr[a++]=f}}qr(e,Kr,0,n),qr(r,Kr,n,o)}function Qr(t,e,r){for(;;){var n,o,i,s,a=Xr(t,e);if(256===a)return Ur;if(a<256)t.dest[t.destLen++]=a;else for(n=$r(t,Mr[a-=257],Vr[a]),o=Xr(t,r),s=i=t.destLen-$r(t,zr[o],Wr[o]);s<i+n;++s)t.dest[t.destLen++]=t.dest[s]}}function Jr(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 Lr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Ur}!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}(Nr,Dr),Hr(Mr,Vr,4,3),Hr(zr,Wr,2,1),Mr[28]=0,Vr[28]=258;var tn=function(t,e){var r,n,o=new Or(t,e);do{switch(r=Yr(o),$r(o,2,0)){case 0:n=Jr(o);break;case 1:n=Qr(o,Nr,Dr);break;case 2:Zr(o,o.ltree,o.dtree),n=Qr(o,o.ltree,o.dtree);break;default:n=Lr}if(n!==Ur)throw new Error("Data error")}while(!r);return o.destLen<o.dest.length?"function"==typeof o.dest.slice?o.dest.slice(0,o.destLen):o.dest.subarray(0,o.destLen):o.dest};const en=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],rn=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var nn={swap32LE:t=>{en&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)rn(t,r,r+3),rn(t,r+1,r+2)})(t)}};const on=tn,{swap32LE:sn}=nn;var an=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=on(t,new Uint8Array(r)),t=on(t,new Uint8Array(r)),sn(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]}},cn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,cn.exports=function(){var t="3.7.5",e=t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof Buffer,i="function"==typeof TextDecoder?new TextDecoder:void 0,s="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=Array.prototype.slice.call(a),u=function(t){var e={};return t.forEach((function(t,r){return e[t]=r})),e}(c),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))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},l=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var e,r,n,o,i="",s=t.length%3,a=0;a<t.length;){if((r=t.charCodeAt(a++))>255||(n=t.charCodeAt(a++))>255||(o=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");i+=c[(e=r<<16|n<<8|o)>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}return s?i.slice(0,s-3)+"===".substring(s):i},g=n?function(t){return btoa(t)}:o?function(t){return Buffer.from(t,"binary").toString("base64")}:y,w=o?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=4096,r=[],n=0,o=t.length;n<o;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?p(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)},x=o?function(t){return Buffer.from(t,"utf8").toString("base64")}:s?function(t){return w(s.encode(t))}:function(t){return g(E(t))},A=function(t,e){return void 0===e&&(e=!1),e?p(x(t)):x(t)},I=function(t){return A(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=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))}},R=function(t){return t.replace(S,B)},P=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,o="",i=0;i<t.length;)e=u[t.charAt(i++)]<<18|u[t.charAt(i++)]<<12|(r=u[t.charAt(i++)])<<6|(n=u[t.charAt(i++)]),o+=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 o},k=r?function(t){return atob(l(t))}:o?function(t){return Buffer.from(t,"base64").toString("binary")}:P,T=o?function(t){return d(Buffer.from(t,"base64"))}:function(t){return d(k(t).split("").map((function(t){return t.charCodeAt(0)})))},_=function(t){return T(L(t))},U=o?function(t){return Buffer.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(T(t))}:function(t){return R(k(t))},L=function(t){return l(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},C=function(t){return U(L(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 A(this,t)})),t("toBase64URI",(function(){return A(this,!0)})),t("toBase64URL",(function(){return A(this,!0)})),t("toUint8Array",(function(){return _(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)}))},V=function(){D(),M()},z={version:t,VERSION:e,atob:k,atobPolyfill:P,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:A,encode:A,encodeURI:I,encodeURL:I,utob:E,btou:R,decode:C,isValid:O,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:M,extendBuiltins:V,Base64:{}};return Object.keys(z).forEach((function(t){return z.Base64[t]=z[t]})),z}();const un={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},fn=Tr,hn=_r,dn=an,pn=cn.exports.Base64,ln=new dn(pn.toUint8Array(fn)),yn=new dn(pn.toUint8Array(hn));function gn(t,e){return 0!=(t&e)}const wn=0,bn=1,mn=2;function vn(t,e){const r=t.length;let n=0,o=wn;for(let i=e;i+1<r;i++){const r=t[i+0],s=t[i+1];switch(gn(r,un.Regional_Indicator)||(n=0),o){case mn:case wn:o=gn(r,un.Extended_Pictographic)?bn:wn;break;case bn:o=gn(r,un.Extend)?bn:gn(r,un.ZWJ)&&gn(s,un.Extended_Pictographic)?mn:wn}if(!gn(r,un.CR)||!gn(s,un.LF)){if(gn(r,un.Control|un.CR|un.LF))return i+1-e;if(gn(s,un.Control|un.CR|un.LF))return i+1-e;if(!(gn(r,un.L)&&gn(s,un.L|un.V|un.LV|un.LVT)||gn(r,un.LV|un.V)&&gn(s,un.V|un.T)||gn(r,un.LVT|un.T)&&gn(s,un.T)||gn(s,un.Extend|un.ZWJ)||gn(s,un.SpacingMark)||gn(r,un.Prepend)||o===mn)){if(!gn(r,un.Regional_Indicator)||!gn(s,un.Regional_Indicator)||n%2!=0)return i+1-e;n++}}}return r-e}var En=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const o=t.codePointAt(e);n.push(ln.get(o)|yn.get(o)),e+=o>65535?2:1,r.push(e)}for(let o=0;o<n.length;){const i=vn(n,o),s=r[o],a=r[o+i];e.push(t.slice(s,a)),o+=i}return e},xn=r(En);const An=t=>{const e=_e+t,r=ke(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)},In=(e,r,o)=>{const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=t.PublicKey.findProgramAddressSync(i,Te);return s};async function Sn(t,e){const r=An(e.toBase58()),n=In(r,Ne),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Ln(o.data)}async function Bn(t,e){let r=[];for(let t of e){const e=An(t.toBase58()),n=In(e,Ne);r.push(n)}return(await he.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Ln(t.data)}))}const Rn=(t,e=Ue,r)=>{let n=An(t);return{pubkey:In(n,r,e),hashed:n}},Pn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?Er:void 0,o=t.split(".");if(2===o.length){const t=n.Buffer.from([e||0]).toString().concat(o[0]),{pubkey:i}=Rn(o[1]);return{...Rn(t,i,r),isSub:!0,parent:i}}if(3===o.length&&e){const{pubkey:t}=Rn(o[2]),{pubkey:n}=Rn("\0".concat(o[1]),t),i=e===exports.RecordVersion.V2?"":"";return{...Rn(i.concat(o[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(o.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...Rn(t,Ue),isSub:!1,parent:void 0}};async function kn(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:Ue.toBase58()}}];return(await t.getProgramAccounts(Te,{filters:r})).map((t=>t.pubkey))}const Tn=(t,e)=>{const{pubkey:r,parent:n}=Pn(t),o=An(r.toBase58());return In(o,Ne,e?n:void 0)},_n=(t,e)=>{const r=An(t.toBase58());return In(r,Ne,e)},Un=(t,e)=>{if(!t)throw new kt(e)};function Ln(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var Cn=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 o=t.charAt(n),i=o.charCodeAt(0);if(255!==e[i])throw new TypeError(o+" is ambiguous");e[i]=n}var s=t.length,a=t.charAt(0),c=Math.log(s)/Math.log(256),u=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,o=0;t[r]===a;)n++,r++;for(var i=(t.length-r)*c+1>>>0,u=new Uint8Array(i);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,d=i-1;(0!==f||h<o)&&-1!==d;d--,h++)f+=s*u[d]>>>0,u[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,r++}for(var p=i-o;p!==i&&0===u[p];)p++;for(var l=new Uint8Array(n+(i-p)),y=n;p!==i;)l[y++]=u[p++];return l}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,o=0,i=e.length;o!==i&&0===e[o];)o++,r++;for(var c=(i-o)*u+1>>>0,f=new Uint8Array(c);o!==i;){for(var h=e[o],d=0,p=c-1;(0!==h||d<n)&&-1!==p;p--,d++)h+=256*f[p]>>>0,f[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,o++}for(var l=c-n;l!==c&&0===f[l];)l++;for(var y=a.repeat(r);l<c;++l)y+=t.charAt(f[l]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}};var On,Nn=Cn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Dn={exports:{}};On=Dn,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"),o=new RegExp("^0x[a-f0-9]+$","i"),i="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(i,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${i})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${i})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,n,o=0,i=-1,s=(t.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),t=t.replace(/%.+$/,""));(i=t.indexOf(":",i+1))>=0;)o++;if("::"===t.substr(0,2)&&o--,"::"===t.substr(-2,2)&&o--,o>e)return null;for(n=e-o,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 u(t,e,r,n){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;n>0;){if(o=r-n,o<0&&(o=0),t[i]>>o!=e[i]>>o)return!1;n-=r,i+=1}return!0}function f(t){if(o.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 u(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,o,i;for(n=3;n>=0;n-=1){if(o=this.octets[n],!(o in r))return null;if(i=r[o],e&&0!==i)return null;8!==i&&(e=!0),t+=i}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(),o=[];let i=0;for(;i<4;)o.push(parseInt(r[i],10)|255^parseInt(n[i],10)),i++;return new this(o)}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,o,i;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}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,o;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(o=f(e[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(o>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),r=[];if(o=f(t[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(o>>16&255),r.push(o>>8&255),r.push(255&o),r}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),r=[];if(o=f(t[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(t[0])),r.push(f(t[1])),r.push(o>>8&255),r.push(255&o),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 u(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,o;for(let i=7;i>=0;i-=1){if(n=this.parts[i],!(n in r))return null;if(o=r[n],e&&0!==o)return null;16!==o&&(e=!0),t+=o}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,o=-1;for(;r=t.exec(e);)r[0].length>o&&(n=r.index,o=r[0].length);return o<0?e:`${e.substring(0,n)}::${e.substring(n+o)}`},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(),o=[];let i=0;for(;i<16;)o.push(parseInt(r[i],10)|255^parseInt(n[i],10)),i++;return new this(o)}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,o,i;try{for(e=this.parseCIDR(t),n=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}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,o,i,s;if(n=t.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(t))return c(t,8);if((n=t.match(a.transitional))&&(s=n[6]||"",e=c(n[1].slice(0,-1)+s,6),e.parts)){for(i=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<i.length;r++)if(o=i[r],!(0<=o&&o<=255))return null;return e.parts.push(i[0]<<8|i[1]),e.parts.push(i[2]<<8|i[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,o,i,s;for(o in null==r&&(r="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,o))for(i=e[o],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(s=i[n],t.kind()===s[0].kind()&&t.match.apply(t,s))return o;return r},On.exports?On.exports=d:t.ipaddr=d}(e);var Mn=Dn.exports;const Vn=2147483647,zn=36,Wn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},jn=Math.floor,Fn=String.fromCharCode;function Kn(t){throw new RangeError(Wn[t])}const Hn=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},Gn=function(t,e,r){let n=0;for(t=r?jn(t/700):t>>1,t+=jn(t/e);t>455;n+=zn)t=jn(t/35);return jn(n+36*t/(t+38))},qn=function(t){const e=[],r=t.length;let n=0,o=128,i=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)t.charCodeAt(r)>=128&&Kn("not-basic"),e.push(t.charCodeAt(r));for(let c=s>0?s+1:0;c<r;){const s=n;for(let e=1,o=zn;;o+=zn){c>=r&&Kn("invalid-input");const s=(a=t.charCodeAt(c++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:zn;s>=zn&&Kn("invalid-input"),s>jn((Vn-n)/e)&&Kn("overflow"),n+=s*e;const u=o<=i?1:o>=i+26?26:o-i;if(s<u)break;const f=zn-u;e>jn(Vn/f)&&Kn("overflow"),e*=f}const u=e.length+1;i=Gn(n-s,u,0==s),jn(n/u)>Vn-o&&Kn("overflow"),o+=jn(n/u),n%=u,e.splice(n++,0,o)}var a;return String.fromCodePoint(...e)},Yn=function(t){const e=[];t=function(t){const e=[];let r=0;const n=t.length;for(;r<n;){const o=t.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){const n=t.charCodeAt(r++);56320==(64512&n)?e.push(((1023&o)<<10)+(1023&n)+65536):(e.push(o),r--)}else e.push(o)}return e}(t);const r=t.length;let n=128,o=0,i=72;for(const r of t)r<128&&e.push(Fn(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=Vn;for(const e of t)e>=n&&e<r&&(r=e);const c=a+1;r-n>jn((Vn-o)/c)&&Kn("overflow"),o+=(r-n)*c,n=r;for(const r of t)if(r<n&&++o>Vn&&Kn("overflow"),r===n){let t=o;for(let r=zn;;r+=zn){const n=r<=i?1:r>=i+26?26:r-i;if(t<n)break;const o=t-n,s=zn-n;e.push(Fn(Hn(n+o%s,0))),t=jn(o/s)}e.push(Fn(Hn(t,0))),i=Gn(o,c,a===s),o=0,++a}++o,++n}return e.join("")},$n=BigInt(2**32-1),Xn=BigInt(32);function Zn(t,e=!1){return e?{h:Number(t&$n),l:Number(t>>Xn&$n)}:{h:0|Number(t>>Xn&$n),l:0|Number(t&$n)}}const Qn={fromBig:Zn,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:i,l:s}=Zn(t[o],e);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<Xn|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 o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}},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,o)=>e+r+n+o+(t/2**32|0)|0,add5H:(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0,add5L:(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0)};var Jn=Qn;const[to,eo]=(()=>Jn.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)))))(),ro=new Uint32Array(80),no=new Uint32Array(80);class oo extends xe{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:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:f,Fl:h,Gh:d,Gl:p,Hh:l,Hl:y}=this;return[t,e,r,n,o,i,s,a,c,u,f,h,d,p,l,y]}set(t,e,r,n,o,i,s,a,c,u,f,h,d,p,l,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|p,this.Hh=0|l,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)ro[r]=t.getUint32(e),no[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|ro[t-15],r=0|no[t-15],n=Jn.rotrSH(e,r,1)^Jn.rotrSH(e,r,8)^Jn.shrSH(e,r,7),o=Jn.rotrSL(e,r,1)^Jn.rotrSL(e,r,8)^Jn.shrSL(e,r,7),i=0|ro[t-2],s=0|no[t-2],a=Jn.rotrSH(i,s,19)^Jn.rotrBH(i,s,61)^Jn.shrSH(i,s,6),c=Jn.rotrSL(i,s,19)^Jn.rotrBL(i,s,61)^Jn.shrSL(i,s,6),u=Jn.add4L(o,c,no[t-7],no[t-16]),f=Jn.add4H(u,n,a,ro[t-7],ro[t-16]);ro[t]=0|f,no[t]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:h,Fh:d,Fl:p,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=Jn.rotrSH(f,h,14)^Jn.rotrSH(f,h,18)^Jn.rotrBH(f,h,41),b=Jn.rotrSL(f,h,14)^Jn.rotrSL(f,h,18)^Jn.rotrBL(f,h,41),m=f&d^~f&l,v=h&p^~h&y,E=Jn.add5L(w,b,v,eo[t],no[t]),x=Jn.add5H(E,g,e,m,to[t],ro[t]),A=0|E,I=Jn.rotrSH(r,n,28)^Jn.rotrBH(r,n,34)^Jn.rotrBH(r,n,39),S=Jn.rotrSL(r,n,28)^Jn.rotrBL(r,n,34)^Jn.rotrBL(r,n,39),B=r&o^r&s^o&s,R=n&i^n&a^i&a;g=0|l,w=0|y,l=0|d,y=0|p,d=0|f,p=0|h,({h:f,l:h}=Jn.add(0|c,0|u,0|x,0|A)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const P=Jn.add3L(A,S,R);r=Jn.add3H(P,x,I,B),n=0|P}({h:r,l:n}=Jn.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=Jn.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=Jn.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=Jn.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:h}=Jn.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l:p}=Jn.add(0|this.Fh,0|this.Fl,0|d,0|p)),({h:l,l:y}=Jn.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=Jn.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,h,d,p,l,y,g,w)}roundClean(){ro.fill(0),no.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 io=Ee((()=>new oo));
12
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const so=BigInt(1),ao=BigInt(2);function co(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const uo=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function fo(t){if(!co(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=uo[t[r]];return e}function ho(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const po={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function lo(t){return t>=po._0&&t<=po._9?t-po._0:t>=po._A&&t<=po._F?t-(po._A-10):t>=po._a&&t<=po._f?t-(po._a-10):void 0}function yo(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,o=0;e<r;e++,o+=2){const r=lo(t.charCodeAt(o)),i=lo(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function go(t){if(!co(t))throw new Error("Uint8Array expected");return ho(fo(Uint8Array.from(t).reverse()))}function wo(t,e){return yo(t.toString(16).padStart(2*e,"0"))}function bo(t,e){return wo(t,e).reverse()}function mo(t,e,r){let n;if("string"==typeof e)try{n=yo(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!co(e))throw new Error(`${t} must be hex string or Uint8Array`);n=Uint8Array.from(e)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${t} expected ${r} bytes, got ${o}`);return n}function vo(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!co(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 o=t[e];r.set(o,n),n+=o.length}return r}const Eo=t=>(ao<<BigInt(t-1))-so,xo={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||co(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 Ao(t,e,r={}){const n=(e,r,n)=>{const o=xo[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=t[e];if(!(n&&void 0===i||o(i,t)))throw new Error(`Invalid param ${String(e)}=${i} (${typeof i}), 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 Io=BigInt(0),So=BigInt(1),Bo=BigInt(2),Ro=BigInt(3),Po=BigInt(4),ko=BigInt(5),To=BigInt(8);function _o(t,e){const r=t%e;return r>=Io?r:e+r}function Uo(t,e,r){if(r<=Io||e<Io)throw new Error("Expected power/modulo > 0");if(r===So)return Io;let n=So;for(;e>Io;)e&So&&(n=n*t%r),t=t*t%r,e>>=So;return n}function Lo(t,e,r){let n=t;for(;e-- >Io;)n*=n,n%=r;return n}function Co(t,e){if(t===Io||e<=Io)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=_o(t,e),n=e,o=Io,i=So;for(;r!==Io;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==So)throw new Error("invert: does not exist");return _o(o,e)}function Oo(t){if(t%Po===Ro){const e=(t+So)/Po;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%To===ko){const e=(t-ko)/To;return function(t,r){const n=t.mul(r,Bo),o=t.pow(n,e),i=t.mul(r,o),s=t.mul(t.mul(i,Bo),o),a=t.mul(i,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-So)/Bo;let r,n,o;for(r=t-So,n=0;r%Bo===Io;r/=Bo,n++);for(o=Bo;o<t&&Uo(o,e,t)!==t-So;o++);if(1===n){const e=(t+So)/Po;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 i=(r+So)/Bo;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=n,c=t.pow(t.mul(t.ONE,o),r),u=t.pow(s,i),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(c,So<<BigInt(a-e-1));c=t.sqr(r),u=t.mul(u,r),f=t.mul(f,c),a=e}return u}}(t)}BigInt(9),BigInt(16);const No=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Do(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 Do=BigInt(0),Mo=BigInt(1);function Vo(t){return xo(t.Fp,Oo.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),xo(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...No(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
16
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zo=BigInt(0),Wo=BigInt(1),jo=BigInt(2),Fo=BigInt(8),Ko={zip215:!0};function Ho(t){const e=function(t){const e=Vo(t);return xo(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:o,hash:i,randomBytes:s,nByteLength:a,h:c}=e,u=jo<<BigInt(8*a)-Wo,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:zo}}}),d=e.adjustScalarBytes||(t=>t),p=e.domain||((t,e,r)=>{if(e.length||r)throw new Error("Contexts/pre-hash are not supported");return t}),l=t=>"bigint"==typeof t&&zo<t,y=(t,e)=>l(t)&&l(e)&&t<e,g=t=>t===zo||y(t,u);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===zo?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,Wo,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:o,ez:i,et:s}=this,a=f(n*n),c=f(o*o),u=f(i*i),h=f(u*u),d=f(a*t);if(f(u*f(d+c))!==f(h+f(r*f(a*c))))throw new Error("bad point: equation left != right (1)");if(f(n*o)!==f(i*s))throw new Error("bad point: equation left != right (2)")}equals(t){v(t);const{ex:e,ey:r,ez:n}=this,{ex:o,ey:i,ez:s}=t,a=f(e*s),c=f(o*n),u=f(r*s),h=f(i*n);return a===c&&u===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:o}=this,i=f(r*r),s=f(n*n),a=f(jo*f(o*o)),c=f(t*i),u=r+n,h=f(f(u*u)-i-s),d=c+s,p=d-a,l=c-s,y=f(h*p),g=f(d*l),w=f(h*l),b=f(p*d);return new E(y,g,b,w)}add(t){v(t);const{a:r,d:n}=e,{ex:o,ey:i,ez:s,et:a}=this,{ex:c,ey:u,ez:h,et:d}=t;if(r===BigInt(-1)){const t=f((i-o)*(u+c)),e=f((i+o)*(u-c)),r=f(e-t);if(r===zo)return this.double();const n=f(s*jo*d),p=f(a*jo*h),l=p+n,y=e+t,g=p-n,w=f(l*r),b=f(y*g),m=f(l*g),v=f(r*y);return new E(w,b,v,m)}const p=f(o*c),l=f(i*u),y=f(a*n*d),g=f(s*h),w=f((o+i)*(c+u)-p-l),b=g-y,m=g+y,x=f(l-r*p),A=f(w*b),I=f(m*x),S=f(w*x),B=f(b*m);return new E(A,I,B,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===zo?A:this.equals(A)||e===Wo?this:this.equals(x)?this.wNAF(e).p:I.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(t){const{ex:e,ey:n,ez:o}=this,i=this.is0();null==t&&(t=i?Fo:r.inv(o));const s=f(e*t),a=f(n*t),c=f(o*t);if(i)return{x:zo,y:Wo};if(c!==Wo)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Wo?this:this.multiplyUnsafe(t)}static fromHex(t,n=!1){const{d:o,a:i}=e,s=r.BYTES,a=(t=bo("pointHex",t,s)).slice(),c=t[s-1];a[s-1]=-129&c;const d=yo(a);d===zo||w(d,n?u:r.ORDER);const p=f(d*d),l=f(p-Wo),y=f(o*p-i);let{isValid:g,value:b}=h(l,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&Wo)===Wo,v=0!=(128&c);if(!n&&b===zo&&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 R(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),n=wo(e,r.BYTES);return n[n.length-1]|=t&Wo?128:0,n}toHex(){return uo(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Wo,f(e.Gx*e.Gy)),E.ZERO=new E(zo,Wo,Wo,zo);const{BASE:x,ZERO:A}=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,o=e;for(;r>Do;)r&Mo&&(n=n.add(o)),o=o.double(),r>>=Mo;return n},precomputeWindow(t,e){const{windows:r,windowSize:o}=n(e),i=[];let s=t,a=s;for(let t=0;t<r;t++){a=s,i.push(a);for(let t=1;t<o;t++)a=a.add(s),i.push(a);s=a.double()}return i},wNAF(e,o,i){const{windows:s,windowSize:a}=n(e);let c=t.ZERO,u=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(i&f);i>>=d,n>a&&(n-=h,i+=Mo);const s=e,p=e+Math.abs(n)-1,l=t%2!=0,y=n<0;0===n?u=u.add(r(l,o[s])):c=c.add(r(y,o[p]))}return{p:c,f:u}},wNAFCached(t,e,r,n){const o=t._WINDOW_SIZE||1;let i=e.get(t);return i||(i=this.precomputeWindow(t,o),1!==o&&e.set(t,n(i))),this.wNAF(o,i,r)}}}(E,8*a);function S(t){return To(t,n)}function B(t){return S(yo(t))}function R(t){const e=a;t=bo("private key",t,e);const r=bo("hashed private key",i(t),2*e),n=d(r.slice(0,e)),o=r.slice(e,2*e),s=B(n),c=x.multiply(s),u=c.toRawBytes();return{head:n,prefix:o,scalar:s,point:c,pointBytes:u}}function P(t=new Uint8Array,...e){const r=mo(...e);return B(i(p(r,bo("context",t),!!o)))}const k=Ko;x._setWindowSize(8);return{CURVE:e,getPublicKey:function(t){return R(t).pointBytes},sign:function(t,e,n={}){t=bo("message",t),o&&(t=o(t));const{prefix:i,scalar:s,pointBytes:c}=R(e),u=P(n.context,i,t),f=x.multiply(u).toRawBytes(),h=S(u+P(n.context,f,c,t)*s);return b(h),bo("result",mo(f,wo(h,r.BYTES)),2*a)},verify:function(t,e,n,i=k){const{context:s,zip215:a}=i,c=r.BYTES;t=bo("signature",t,2*c),e=bo("message",e),o&&(e=o(e));const u=yo(t.slice(c,2*c));let f,h,d;try{f=E.fromHex(n,a),h=E.fromHex(t.slice(0,c),a),d=x.multiplyUnsafe(u)}catch(t){return!1}if(!a&&f.isSmallOrder())return!1;const p=P(s,h.toRawBytes(),f.toRawBytes(),e);return h.add(f.multiplyUnsafe(p)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:{getExtendedPublicKey:R,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 Go=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),qo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Yo=BigInt(1),$o=BigInt(2),Zo=BigInt(5),Xo=BigInt(10),Qo=BigInt(20),Jo=BigInt(40),ti=BigInt(80);const ei=function(t,e,r=!1,n={}){if(t<=Ao)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:o,nByteLength:i}=No(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Co(t),a=Object.freeze({ORDER:t,BITS:o,BYTES:i,MASK:vo(o),ZERO:Ao,ONE:Io,create:e=>To(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Ao<=e&&e<t},is0:t=>t===Ao,isOdd:t=>(t&Io)===Io,neg:e=>To(-e,t),eql:(t,e)=>t===e,sqr:e=>To(e*e,t),add:(e,r)=>To(e+r,t),sub:(e,r)=>To(e-r,t),mul:(e,r)=>To(e*r,t),pow:(t,e)=>function(t,e,r){if(r<Ao)throw new Error("Expected power > 0");if(r===Ao)return t.ONE;if(r===Io)return e;let n=t.ONE,o=e;for(;r>Ao;)r&Io&&(n=t.mul(n,o)),o=t.sqr(o),r>>=Io;return n}(a,t,e),div:(e,r)=>To(e*Lo(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Lo(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,o)=>t.is0(n)?e:(r[o]=e,t.mul(e,n))),t.ONE),o=t.inv(n);return e.reduceRight(((e,n,o)=>t.is0(n)?e:(r[o]=t.mul(e,r[o]),t.mul(e,n))),o),r}(a,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?wo(t,i):go(t,i),fromBytes:t=>{if(t.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${t.length}`);return r?yo(t):function(t){return fo(uo(t))}(t)}});return Object.freeze(a)}(Go,void 0,!0),ri={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ei,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:oo,randomBytes:function(t=32){if(le&&"function"==typeof le.getRandomValues)return le.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=Go,n=To(e*e*e,r),o=function(t){const e=Go,r=t*t%e*t%e,n=Uo(r,$o,e)*r%e,o=Uo(n,Yo,e)*t%e,i=Uo(o,Zo,e)*o%e,s=Uo(i,Xo,e)*i%e,a=Uo(s,Qo,e)*s%e,c=Uo(a,Jo,e)*a%e,u=Uo(c,ti,e)*c%e,f=Uo(u,ti,e)*c%e,h=Uo(f,Xo,e)*i%e;return{pow_p_5_8:Uo(h,$o,e)*t%e,b2:r}}(t*To(n*n*e,r)).pow_p_5_8;let i=To(t*n*o,r);const s=To(e*i*i,r),a=i,c=To(i*qo,r),u=s===t,f=s===To(-t,r),h=s===To(-t*qo,r);return u&&(i=a),(f||h)&&(i=c),(To(i,r)&Io)===Io&&(i=To(-i,r)),{isValid:u||f,value:i}}},ni=Ho(ri);const oi=(ei.ORDER+BigInt(3))/BigInt(8);
15
+ const Mo=BigInt(0),Vo=BigInt(1);function zo(t){return Ao(t.Fp,No.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Ao(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Do(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
16
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Wo=BigInt(0),jo=BigInt(1),Fo=BigInt(2),Ko=BigInt(8),Ho={zip215:!0};function Go(t){const e=function(t){const e=zo(t);return Ao(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:o,hash:i,randomBytes:s,nByteLength:a,h:c}=e,u=Fo<<BigInt(8*a)-jo,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:Wo}}}),d=e.adjustScalarBytes||(t=>t),p=e.domain||((t,e,r)=>{if(e.length||r)throw new Error("Contexts/pre-hash are not supported");return t}),l=t=>"bigint"==typeof t&&Wo<t,y=(t,e)=>l(t)&&l(e)&&t<e,g=t=>t===Wo||y(t,u);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===Wo?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,jo,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:o,ez:i,et:s}=this,a=f(n*n),c=f(o*o),u=f(i*i),h=f(u*u),d=f(a*t);if(f(u*f(d+c))!==f(h+f(r*f(a*c))))throw new Error("bad point: equation left != right (1)");if(f(n*o)!==f(i*s))throw new Error("bad point: equation left != right (2)")}equals(t){v(t);const{ex:e,ey:r,ez:n}=this,{ex:o,ey:i,ez:s}=t,a=f(e*s),c=f(o*n),u=f(r*s),h=f(i*n);return a===c&&u===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:o}=this,i=f(r*r),s=f(n*n),a=f(Fo*f(o*o)),c=f(t*i),u=r+n,h=f(f(u*u)-i-s),d=c+s,p=d-a,l=c-s,y=f(h*p),g=f(d*l),w=f(h*l),b=f(p*d);return new E(y,g,b,w)}add(t){v(t);const{a:r,d:n}=e,{ex:o,ey:i,ez:s,et:a}=this,{ex:c,ey:u,ez:h,et:d}=t;if(r===BigInt(-1)){const t=f((i-o)*(u+c)),e=f((i+o)*(u-c)),r=f(e-t);if(r===Wo)return this.double();const n=f(s*Fo*d),p=f(a*Fo*h),l=p+n,y=e+t,g=p-n,w=f(l*r),b=f(y*g),m=f(l*g),v=f(r*y);return new E(w,b,v,m)}const p=f(o*c),l=f(i*u),y=f(a*n*d),g=f(s*h),w=f((o+i)*(c+u)-p-l),b=g-y,m=g+y,x=f(l-r*p),A=f(w*b),I=f(m*x),S=f(w*x),B=f(b*m);return new E(A,I,B,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===Wo?A:this.equals(A)||e===jo?this:this.equals(x)?this.wNAF(e).p:I.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(t){const{ex:e,ey:n,ez:o}=this,i=this.is0();null==t&&(t=i?Ko:r.inv(o));const s=f(e*t),a=f(n*t),c=f(o*t);if(i)return{x:Wo,y:jo};if(c!==jo)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===jo?this:this.multiplyUnsafe(t)}static fromHex(t,n=!1){const{d:o,a:i}=e,s=r.BYTES,a=(t=mo("pointHex",t,s)).slice(),c=t[s-1];a[s-1]=-129&c;const d=go(a);d===Wo||w(d,n?u:r.ORDER);const p=f(d*d),l=f(p-jo),y=f(o*p-i);let{isValid:g,value:b}=h(l,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&jo)===jo,v=0!=(128&c);if(!n&&b===Wo&&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 R(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),n=bo(e,r.BYTES);return n[n.length-1]|=t&jo?128:0,n}toHex(){return fo(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,jo,f(e.Gx*e.Gy)),E.ZERO=new E(Wo,jo,jo,Wo);const{BASE:x,ZERO:A}=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,o=e;for(;r>Mo;)r&Vo&&(n=n.add(o)),o=o.double(),r>>=Vo;return n},precomputeWindow(t,e){const{windows:r,windowSize:o}=n(e),i=[];let s=t,a=s;for(let t=0;t<r;t++){a=s,i.push(a);for(let t=1;t<o;t++)a=a.add(s),i.push(a);s=a.double()}return i},wNAF(e,o,i){const{windows:s,windowSize:a}=n(e);let c=t.ZERO,u=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(i&f);i>>=d,n>a&&(n-=h,i+=Vo);const s=e,p=e+Math.abs(n)-1,l=t%2!=0,y=n<0;0===n?u=u.add(r(l,o[s])):c=c.add(r(y,o[p]))}return{p:c,f:u}},wNAFCached(t,e,r,n){const o=t._WINDOW_SIZE||1;let i=e.get(t);return i||(i=this.precomputeWindow(t,o),1!==o&&e.set(t,n(i))),this.wNAF(o,i,r)}}}(E,8*a);function S(t){return _o(t,n)}function B(t){return S(go(t))}function R(t){const e=a;t=mo("private key",t,e);const r=mo("hashed private key",i(t),2*e),n=d(r.slice(0,e)),o=r.slice(e,2*e),s=B(n),c=x.multiply(s),u=c.toRawBytes();return{head:n,prefix:o,scalar:s,point:c,pointBytes:u}}function P(t=new Uint8Array,...e){const r=vo(...e);return B(i(p(r,mo("context",t),!!o)))}const k=Ho;x._setWindowSize(8);return{CURVE:e,getPublicKey:function(t){return R(t).pointBytes},sign:function(t,e,n={}){t=mo("message",t),o&&(t=o(t));const{prefix:i,scalar:s,pointBytes:c}=R(e),u=P(n.context,i,t),f=x.multiply(u).toRawBytes(),h=S(u+P(n.context,f,c,t)*s);return b(h),mo("result",vo(f,bo(h,r.BYTES)),2*a)},verify:function(t,e,n,i=k){const{context:s,zip215:a}=i,c=r.BYTES;t=mo("signature",t,2*c),e=mo("message",e),o&&(e=o(e));const u=go(t.slice(c,2*c));let f,h,d;try{f=E.fromHex(n,a),h=E.fromHex(t.slice(0,c),a),d=x.multiplyUnsafe(u)}catch(t){return!1}if(!a&&f.isSmallOrder())return!1;const p=P(s,h.toRawBytes(),f.toRawBytes(),e);return h.add(f.multiplyUnsafe(p)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:{getExtendedPublicKey:R,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 qo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Yo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const $o=BigInt(1),Xo=BigInt(2),Zo=BigInt(5),Qo=BigInt(10),Jo=BigInt(20),ti=BigInt(40),ei=BigInt(80);const ri=function(t,e,r=!1,n={}){if(t<=Io)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:o,nByteLength:i}=Do(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Oo(t),a=Object.freeze({ORDER:t,BITS:o,BYTES:i,MASK:Eo(o),ZERO:Io,ONE:So,create:e=>_o(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Io<=e&&e<t},is0:t=>t===Io,isOdd:t=>(t&So)===So,neg:e=>_o(-e,t),eql:(t,e)=>t===e,sqr:e=>_o(e*e,t),add:(e,r)=>_o(e+r,t),sub:(e,r)=>_o(e-r,t),mul:(e,r)=>_o(e*r,t),pow:(t,e)=>function(t,e,r){if(r<Io)throw new Error("Expected power > 0");if(r===Io)return t.ONE;if(r===So)return e;let n=t.ONE,o=e;for(;r>Io;)r&So&&(n=t.mul(n,o)),o=t.sqr(o),r>>=So;return n}(a,t,e),div:(e,r)=>_o(e*Co(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Co(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,o)=>t.is0(n)?e:(r[o]=e,t.mul(e,n))),t.ONE),o=t.inv(n);return e.reduceRight(((e,n,o)=>t.is0(n)?e:(r[o]=t.mul(e,r[o]),t.mul(e,n))),o),r}(a,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?bo(t,i):wo(t,i),fromBytes:t=>{if(t.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${t.length}`);return r?go(t):function(t){return ho(fo(t))}(t)}});return Object.freeze(a)}(qo,void 0,!0),ni={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ri,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:io,randomBytes:function(t=32){if(le&&"function"==typeof le.getRandomValues)return le.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=qo,n=_o(e*e*e,r),o=function(t){const e=qo,r=t*t%e*t%e,n=Lo(r,Xo,e)*r%e,o=Lo(n,$o,e)*t%e,i=Lo(o,Zo,e)*o%e,s=Lo(i,Qo,e)*i%e,a=Lo(s,Jo,e)*s%e,c=Lo(a,ti,e)*a%e,u=Lo(c,ei,e)*c%e,f=Lo(u,ei,e)*c%e,h=Lo(f,Qo,e)*i%e;return{pow_p_5_8:Lo(h,Xo,e)*t%e,b2:r}}(t*_o(n*n*e,r)).pow_p_5_8;let i=_o(t*n*o,r);const s=_o(e*i*i,r),a=i,c=_o(i*Yo,r),u=s===t,f=s===_o(-t,r),h=s===_o(-t*Yo,r);return u&&(i=a),(f||h)&&(i=c),(_o(i,r)&So)===So&&(i=_o(-i,r)),{isValid:u||f,value:i}}},oi=Go(ni);const ii=(ri.ORDER+BigInt(3))/BigInt(8);
18
18
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
19
- function ii(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function si(...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 ai(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(ii(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 ci(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 ui(t,e="="){if(ii(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 fi(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}ei.pow($o,oi),ei.sqrt(ei.neg(ei.ONE)),ei.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)}(ei,ei.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const hi=(t,e)=>e?hi(e,t%e):t,di=(t,e)=>t+(e-hi(t,e));function pi(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(di(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${di(e,r)}`);let o=0,i=0;const s=2**r-1,a=[];for(const n of t){if(ii(n),n>=2**e)throw new Error(`convertRadix2: invalid data word=${n} from=${e}`);if(o=o<<e|n,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=r;i-=r)a.push((o>>i-r&s)>>>0);o&=2**i-1}if(o=o<<r-i&s,!n&&i>=e)throw new Error("Excess padding");if(!n&&o)throw new Error(`Non-zero padding: ${o}`);return n&&i>0&&a.push(o>>>0),a}function li(t,e=!1){if(ii(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(di(8,t)>32||di(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 pi(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(pi(r,t,8,e))}}}function yi(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}li(4),ai("0123456789ABCDEF"),ci(""),li(5),ai("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ui(5),ci(""),li(5),ai("0123456789ABCDEFGHIJKLMNOPQRSTUV"),ui(5),ci(""),li(5),ai("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),ci(""),fi((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),li(6),ai("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),ui(6),ci(""),li(6),ai("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),ui(6),ci(""),li(6),ai("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),ci("");const gi=si(ai("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),ci("")),wi=[996825010,642813549,513874426,1027748829,705979059];function bi(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<wi.length;t++)1==(e>>t&1)&&(r^=wi[t]);return r}function mi(t,e,r=1){const n=t.length;let o=1;for(let e=0;e<n;e++){const r=t.charCodeAt(e);if(r<33||r>126)throw new Error(`Invalid prefix (${t})`);o=bi(o)^r>>5}o=bi(o);for(let e=0;e<n;e++)o=bi(o)^31&t.charCodeAt(e);for(let t of e)o=bi(o)^t;for(let t=0;t<6;t++)o=bi(o);return o^=r,gi.encode(pi([o%2**30],30,5,!1))}function vi(t){const e="bech32"===t?1:734539939,r=li(5),n=r.decode,o=r.encode,i=yi(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 o=(t=n).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=t.slice(0,o),s=t.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=gi.decode(s).slice(0,-6),c=mi(i,a,e);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${t}: expected "${c}"`);return{prefix:i,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 o=t.length+7+r.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=t.toLowerCase(),s=mi(i,r,e);return`${i}1${gi.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:yi(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}const Ei=vi("bech32");li(4),ai("0123456789abcdef"),ci(""),fi((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 xi=(t,e,r)=>ni.verify(e,t,r.toBytes()),Ai=(t,e)=>{const{pubkey:r}=Pn(e+"."+t,exports.RecordVersion.V1);return r};async function Ii(t,e,r,n){const o=Ai(e,r);let{registry:i}=await he.retrieve(t,o);if(!i.data)throw new kt(exports.ErrorType.NoRecordData);if(n)return Bi(i,r,o);const s=Pr.get(r);return i.data=i.data.slice(0,s),i}const Si=async(t,e)=>await Ii(t,e,exports.Record.SOL),Bi=(e,r,o)=>{const i=null==e?void 0:e.data;if(!i)return;if(0===i.compare(n.Buffer.alloc(i.length)))return;const s=Pr.get(r),a=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!s)return i.slice(0,a).toString("utf-8");if(r===exports.Record.SOL){const t=new TextEncoder,r=n.Buffer.concat([i.slice(0,32),o.toBuffer()]),s=t.encode(r.toString("hex"));if(xi(s,i.slice(32,96),e.owner))return Nn.encode(i.slice(0,32))}if(s&&a!==s){const t=i.slice(0,a).toString("utf-8");if(r===exports.Record.Injective){const e=Ei.decodeToBytes(t);if("inj"===e.prefix&&20===e.bytes.length)return t}else if(r===exports.Record.BSC||r===exports.Record.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===n.Buffer.from(r,"hex").length)return t}else if((r===exports.Record.A||r===exports.Record.AAAA)&&Mn.isValid(t))return t;throw new kt(exports.ErrorType.InvalidRecordData)}if(r===exports.Record.ETH||r===exports.Record.BSC)return"0x"+i.slice(0,s).toString("hex");if(r===exports.Record.Injective)return Ei.encode("inj",Ei.toWords(i.slice(0,s)));if(r===exports.Record.A||r===exports.Record.AAAA)return Mn.fromByteArray([...i.slice(0,s)]).toString();if(r===exports.Record.Background)return new t.PublicKey(i.slice(0,s)).toString();throw new kt(exports.ErrorType.InvalidRecordData)},Ri=(e,r)=>{if(!Pr.get(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=qn(e)),n.Buffer.from(e,"utf-8");if(r===exports.Record.SOL)throw new kt(exports.ErrorType.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===exports.Record.ETH||r===exports.Record.BSC)return Un("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=Ei.decodeToBytes(e);return Un("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Un(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Mn.parse(e).toByteArray();return Un(4===t.length,exports.ErrorType.InvalidARecord),n.Buffer.from(t)}if(r===exports.Record.AAAA){const t=Mn.parse(e).toByteArray();return Un(16===t.length,exports.ErrorType.InvalidAAAARecord),n.Buffer.from(t)}if(r===exports.Record.Background)return new t.PublicKey(e).toBuffer();throw new kt(exports.ErrorType.InvalidRecordInput)},Pi=(t,e,r,o)=>{const i=n.Buffer.concat([t.toBuffer(),e.toBuffer()]),s=(new TextEncoder).encode(i.toString("hex")),a=xi(s,o,r);return Un(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([t.toBuffer(),o])},ki=new Map([[exports.Record.Url,new t.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),Ti=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC]),_i=new Set([exports.Record.IPFS,exports.Record.ARWV,exports.Record.LTC,exports.Record.DOGE,exports.Record.Email,exports.Record.Url,exports.Record.Discord,exports.Record.Github,exports.Record.Reddit,exports.Record.Twitter,exports.Record.Telegram,exports.Record.Pic,exports.Record.SHDW,exports.Record.POINT,exports.Record.Backpack,exports.Record.TXT,exports.Record.CNAME,exports.Record.BTC]),Ui=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),Li=(e,r)=>{if(_i.has(r)){const t=e.toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?function(t){const e=[],r=t.length;let n=0,o=128,i=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)t.charCodeAt(r)>=128&&Kn("not-basic"),e.push(t.charCodeAt(r));for(let c=s>0?s+1:0;c<r;){const s=n;for(let e=1,o=zn;;o+=zn){c>=r&&Kn("invalid-input");const s=(a=t.charCodeAt(c++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:zn;s>=zn&&Kn("invalid-input"),s>jn((Vn-n)/e)&&Kn("overflow"),n+=s*e;const u=o<=i?1:o>=i+26?26:o-i;if(s<u)break;const f=zn-u;e>jn(Vn/f)&&Kn("overflow"),e*=f}const u=e.length+1;i=Gn(n-s,u,0==s),jn(n/u)>Vn-o&&Kn("overflow"),o+=jn(n/u),n%=u,e.splice(n++,0,o)}var a;return String.fromCodePoint(...e)}(t):t}if(r===exports.Record.SOL)return new t.PublicKey(e).toBase58();if(r===exports.Record.ETH||r===exports.Record.BSC)return"0x"+e.toString("hex");if(r===exports.Record.Injective)return Ei.encode("inj",Ei.toWords(e));if(r===exports.Record.A||r===exports.Record.AAAA)return Mn.fromByteArray([...e]).toString();throw new kt(exports.ErrorType.InvalidARecord)},Ci=(e,r)=>{if(_i.has(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=qn(e)),Buffer.from(e,"utf-8");if(r===exports.Record.SOL)return new t.PublicKey(e).toBuffer();if(r===exports.Record.ETH||r===exports.Record.BSC)return Un("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=Ei.decodeToBytes(e);return Un("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Un(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Mn.parse(e).toByteArray();return Un(4===t.length,exports.ErrorType.InvalidARecord),Buffer.from(t)}if(r===exports.Record.AAAA){const t=Mn.parse(e).toByteArray();return Un(16===t.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(t)}throw new kt(exports.ErrorType.InvalidARecord)},Oi=(t,e)=>{const{pubkey:r}=Pn(t),n=An("".concat(e));return In(n,Er,r)};async function Ni(e,r,n,o,i,s,a,c){const u=An(r),f=In(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let d;if(c){const{registry:t}=await $e(e,c);d=t.owner}return qt(Te,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,d)}async function Di(t,e,r,n,o){const i=An(e),s=In(i,n,o);let a;a=n||(await he.retrieve(t,s)).registry.owner;return Zt(Te,s,r,a)}const Mi=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Le.toBuffer()],Le),a=An(e.toBase58()),c=In(a,s,o);return[[],[new Qt({name:r}).getInstruction(Le,Te,Ue,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},Vi=async(e,r,n,o,i,s)=>{Un(n!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:a,hashed:c,parent:u}=Pn(`${n}.${r}`,exports.RecordVersion.V1),f=Ri(o,n).length,h=await e.getMinimumBalanceForRentExemption(f+he.HEADER_LEN);return qt(Te,t.SystemProgram.programId,a,i,s,c,new _t(h),new Tt(f),void 0,u,i)},zi=async(e,r,n,o,i,s)=>{const{pubkey:a,hashed:c,parent:u}=Pn(`${exports.Record.SOL}.${r}`,exports.RecordVersion.V1),f=Pi(n,a,o,i).length,h=await e.getMinimumBalanceForRentExemption(f+he.HEADER_LEN);return[qt(Te,t.SystemProgram.programId,a,o,s,c,new _t(h),new Tt(f),void 0,u,o)]};class Wi{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 kt(exports.ErrorType.InvalidReverseTwitter);return new Wi(Gt(Wi.schema,r.data.slice(he.HEADER_LEN)))}}async function ji(e,r,o,i,s){const a=An(i.toString()),c=In(a,De,Me);let u=Ht(Wi.schema,new Wi({twitterRegistryKey:o.toBytes(),twitterHandle:r}));return[qt(Te,t.SystemProgram.programId,c,i,s,a,new _t(await e.getMinimumBalanceForRentExemption(u.length+he.HEADER_LEN)),new Tt(u.length),De,Me,De),Yt(Te,c,new Tt(0),n.Buffer.from(u),De)]}Wi.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}};const Fi=async(t,e)=>{const{pubkey:r}=Pn(e),{registry:n,nftOwner:o}=await he.retrieve(t,r);if(o)return o;try{const r=await Hi(t,n.owner,e);if(void 0!==r)return r;return await Ki(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},Ki=async(e,r,o)=>{const i=Ai(o,exports.Record.SOL),s=await Si(e,o);if(!(null==s?void 0:s.data))throw new kt(exports.ErrorType.NoRecordData);const a=new TextEncoder,c=n.Buffer.concat([s.data.slice(0,32),i.toBuffer()]),u=a.encode(c.toString("hex"));if(!xi(u,s.data.slice(32),r))throw new kt(exports.ErrorType.InvalidSignature);return new t.PublicKey(s.data.slice(0,32))},Hi=async(e,r,n)=>{try{const o=Oi(n,exports.Record.SOL),i=await Br.retrieve(e,o),s=i.getStalenessId(),a=i.getRoAId(),c=i.getContent();if(0===s.compare(r.toBuffer())&&i.header.stalenessValidation===xr.Solana&&0===a.compare(c)&&i.header.rightOfAssociationValidation===xr.Solana)return new t.PublicKey(c)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},Gi=new t.PublicKey("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class qi{constructor(e){this.tag=e.tag,this.nameAccount=new t.PublicKey(e.nameAccount)}static deserialize(t){return new qi(Gt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new kt(exports.ErrorType.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(e,r){return await t.PublicKey.findProgramAddress([n.Buffer.from("favourite_domain"),r.toBuffer()],e)}static getKeySync(e,r){return t.PublicKey.findProgramAddressSync([n.Buffer.from("favourite_domain"),r.toBuffer()],e)}}qi.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};var Yi;exports.CustomBg=void 0,(Yi=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",Yi.Rgb0x001="rgb0x00#1";const $i=new t.PublicKey("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),Zi=new t.PublicKey("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),Xi={NAME_PROGRAM_ID:new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new t.PublicKey("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new t.PublicKey("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new t.PublicKey("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new t.PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new t.PublicKey("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.PublicKey("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new t.PublicKey("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},Qi=(e,r,o)=>{const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=t.PublicKey.findProgramAddressSync(i,Xi.NAME_PROGRAM_ID);return s},Ji=(t,e=Xi.ROOT_DOMAIN_ACCOUNT,r)=>{let n=An(t);return{pubkey:Qi(n,r,e),hashed:n}},ts=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}=Ji(e[1]);return{...Ji(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...Ji(t,Xi.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},es=(t,e)=>{const{pubkey:r,parent:n}=ts(t),o=An(r.toBase58());return Qi(o,Xi.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function rs(e,r,n,o,i,s,a,c){const u=await Ze(r),f=await Qi(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let d;if(c){const{registry:t}=await $e(e,c);d=t.owner}return qt(Xi.NAME_PROGRAM_ID,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,d)}const ns=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Xi.REGISTER_PROGRAM_ID.toBuffer()],Xi.REGISTER_PROGRAM_ID),a=await Ze(e.toBase58()),c=Qi(a,s,o);return[[],[new Qt({name:r}).getInstruction(Xi.REGISTER_PROGRAM_ID,Xi.NAME_PROGRAM_ID,Xi.ROOT_DOMAIN_ACCOUNT,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},os={utils:{getNameAccountKeySync:Qi,reverseLookup:async(t,e)=>{const r=An(e.toBase58()),n=Qi(r,Xi.REVERSE_LOOKUP_CLASS),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Ln(o.data)},_deriveSync:Ji,getDomainKeySync:ts,getReverseKeySync:es},constants:Xi,bindings:{createNameRegistry:rs,updateNameRegistryData:async function(t,e,r,n,o,i){const s=await Ze(e),a=Qi(s,o,i);let c;return c=o||(await he.retrieve(t,a)).registry.owner,Yt(Xi.NAME_PROGRAM_ID,a,new Tt(r),n,c)},transferNameOwnership:async function(t,e,r,n,o,i){const s=await Ze(e),a=Qi(s,n,o);let c;return c=n||(await he.retrieve(t,a)).registry.owner,$t(Xi.NAME_PROGRAM_ID,a,r,c,n,o,i)},deleteNameRegistry:async function(t,e,r,n,o){const i=await Ze(e),s=Qi(i,n,o);let a;return a=n||(await he.retrieve(t,s)).registry.owner,Zt(Xi.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(e,r,n,o,i,s=Xi.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new kt(exports.ErrorType.InvalidDomain);const[c]=t.PublicKey.findProgramAddressSync([Xi.REGISTER_PROGRAM_ID.toBuffer()],Xi.REGISTER_PROGRAM_ID),u=An(r),f=Qi(u,void 0,Xi.ROOT_DOMAIN_ACCOUNT),h=An(f.toBase58()),d=Qi(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Xi.REGISTER_PROGRAM_ID),y=Xi.REFERRERS.findIndex((t=>null==a?void 0:a.equals(t)));let g;const w=[];if(-1!==y&&a){g=Bt(s,a,!0);const t=await e.getAccountInfo(g);if(!(null==t?void 0:t.data)){const t=Rt(o,g,a,s);w.push(t)}}const b=Bt(s,Xi.VAULT_OWNER),m=os.constants.PYTH_FEEDS.get(s.toBase58());if(!m)throw new kt(exports.ErrorType.PythFeedNotFound);const v=new Jt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Xi.REGISTER_PROGRAM_ID,Xi.NAME_PROGRAM_ID,Xi.ROOT_DOMAIN_ACCOUNT,f,d,t.SystemProgram.programId,c,o,i,Xi.PYTH_MAPPING_ACC,new t.PublicKey(m.product),new t.PublicKey(m.price),b,p,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},createReverseName:ns,createSubdomain:async(t,e,r,n=2e3)=>{const o=[],i=e.split(".")[0];if(!i)throw new kt(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=ts(e),c=await t.getMinimumBalanceForRentExemption(n+he.HEADER_LEN),u=await rs(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=es(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await ns(a,"\0".concat(i),r,s,r);o.push(...t)}return[[],o]},burnDomain:(e,r,n)=>{const{pubkey:o}=ts(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Xi.REGISTER_PROGRAM_ID),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Xi.REGISTER_PROGRAM_ID);return(new ee).getInstruction(Xi.REGISTER_PROGRAM_ID,Xi.NAME_PROGRAM_ID,t.SystemProgram.programId,o,es(e),s,i,Xi.REVERSE_LOOKUP_CLASS,r,n)},transferSubdomain:async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=ts(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await he.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await he.retrieve(t,a)).registry.owner);return $t(Xi.NAME_PROGRAM_ID,i,r,o,void 0,c,u)}}};exports.BONFIDA_FIDA_BNB=Oe,exports.BONFIDA_USDC_BNB=Ve,exports.CUSTOM_BG_TLD=Ge,exports.ETH_ROA_RECORDS=Ti,exports.FavouriteDomain=qi,exports.GUARDIANS=ki,exports.HASH_PREFIX=_e,exports.METAPLEX_ID=Ye,exports.NAME_OFFERS_ID=Gi,exports.NAME_PROGRAM_ID=Te,exports.NameRegistryState=he,exports.Numberu32=Tt,exports.Numberu64=_t,exports.PYTH_FEEDS=Fe,exports.PYTH_FIDA_PRICE_ACC=Ce,exports.PYTH_MAPPING_ACC=Ke,exports.RECORD_V1_SIZE=Pr,exports.REFERRERS=We,exports.REGISTER_PROGRAM_ID=Le,exports.REVERSE_LOOKUP_CLASS=Ne,exports.ROOT_DOMAIN_ACCOUNT=Ue,exports.ReverseTwitterRegistryState=Wi,exports.SELF_SIGNED=Ui,exports.SNSError=kt,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=je,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=Me,exports.TWITTER_VERIFICATION_AUTHORITY=De,exports.USDC_MINT=ze,exports.UTF8_ENCODED=_i,exports.VAULT_OWNER=He,exports.WOLVES_COLLECTION_METADATA=qe,exports.burnDomain=(e,r,n)=>{const{pubkey:o}=Pn(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Le),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Le);return(new ee).getInstruction(Le,Te,t.SystemProgram.programId,o,Tn(e),s,i,Ne,r,n)},exports.burnInstruction=ee,exports.changeTwitterRegistryData=async function(t,e,r,n){const o=An(t),i=In(o,void 0,Me);return[Yt(Te,i,new Tt(r),n,e)]},exports.changeVerifiedPubkey=async function(t,e,r,n,o){const i=An(e),s=In(i,void 0,Me);let a=[$t(Te,s,n,r,void 0)];return a.push(await Di(t,r.toString(),o,De,Me)),a=a.concat(await ji(t,e,s,n,o)),a},exports.check=Un,exports.checkSolRecord=xi,exports.createInstruction=qt,exports.createInstructionV3=Jt,exports.createNameRegistry=Ni,exports.createRecordInstruction=Vi,exports.createRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Pn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new lr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Er))(i,s,a,o,Te,"".concat(r),Ci(n,r),vr);return u},exports.createReverseInstruction=Qt,exports.createReverseName=Mi,exports.createReverseTwitterRegistry=ji,exports.createSolRecordInstruction=zi,exports.createSubdomain=async(t,e,r,n=2e3)=>{const o=[],i=e.split(".")[0];if(!i)throw new kt(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=Pn(e),c=await t.getMinimumBalanceForRentExemption(n+he.HEADER_LEN),u=await Ni(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=Tn(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Mi(a,"\0".concat(i),r,s,r);o.push(...t)}return[[],o]},exports.createV2Instruction=Xt,exports.createVerifiedTwitterRegistry=async function(e,r,n,o,i){const s=An(r),a=In(s,void 0,Me),c=await e.getMinimumBalanceForRentExemption(o+he.HEADER_LEN);let u=[qt(Te,t.SystemProgram.programId,a,n,i,s,new _t(c),new Tt(o),void 0,Me,De)];return u=u.concat(await ji(e,r,a,n,i)),u},exports.createWithNftInstruction=te,exports.deleteInstruction=Zt,exports.deleteNameRegistry=Di,exports.deleteRecordV2=(e,r,n,o)=>{let{pubkey:i,parent:s,isSub:a}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(a&&(s=Pn(e).pubkey),!s)throw new Error("Invalid parent");const c=((e,r,n,o,i,s)=>(new br).getInstruction(s,t.SystemProgram.programId,i,e,o,r,n,Er))(o,s,n,i,Te,vr);return c},exports.deleteTwitterRegistry=async function(t,e){const r=An(t),n=In(r,void 0,Me),o=An(e.toString()),i=In(o,De,Me);return[Zt(Te,n,e,e),Zt(Te,i,e,e)]},exports.deserializeRecord=Bi,exports.deserializeRecordV2Content=Li,exports.deserializeReverse=Ln,exports.devnet=os,exports.ethValidateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(u&&(c=Pn(e).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c,u)=>new yr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(c)}).getInstruction(u,t.SystemProgram.programId,i,e,r,n,o,Er))(o,a,c,n,Te,xr.Ethereum,i,s,vr);return f},exports.findSubdomains=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Ne.toBase58()}}],n=await t.getProgramAccounts(Te,{filters:r}),o=[{memcmp:{offset:0,bytes:e.toBase58()}}],i=await t.getProgramAccounts(Te,{filters:o,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Ln(t.account.data.slice(96))]))),a=[];return i.forEach((t=>{const r=_n(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=kn,exports.getAllRegisteredDomains=async t=>{const e=[{memcmp:{offset:0,bytes:Ue.toBase58()}}];return await t.getProgramAccounts(Te,{dataSlice:{offset:32,length:32},filters:e})},exports.getArtistPubkey=t=>{switch(t){case exports.CustomBg.DegenPoet1:return $i;case exports.CustomBg.Rgb0x001:return Zi;default:throw new kt(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(t,e)=>await Ii(t,e,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(t,e)=>await Ii(t,e,exports.Record.Background,!0),exports.getBackpackRecord=async(t,e)=>await Ii(t,e,exports.Record.Backpack,!0),exports.getBscRecord=async(t,e)=>await Ii(t,e,exports.Record.BSC,!0),exports.getBtcRecord=async(t,e)=>await Ii(t,e,exports.Record.BTC,!0),exports.getCustomBgKeys=(t,e)=>{const r=An(e),n=An(t),o=In(n,void 0,Ge);return{domainKey:o,bgKey:In(r,void 0,o)}},exports.getDiscordRecord=async(t,e)=>await Ii(t,e,exports.Record.Discord,!0),exports.getDogeRecord=async(t,e)=>await Ii(t,e,exports.Record.DOGE,!0),exports.getDomainKey=Je,exports.getDomainKeySync=Pn,exports.getDomainKeysWithReverses=async function(t,e){const r=await kn(t,e),n=await Bn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))},exports.getDomainMint=oe,exports.getDomainPriceFromName=t=>{switch(xn(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}},exports.getEmailRecord=async(t,e)=>await Ii(t,e,exports.Record.Email,!0),exports.getEthRecord=async(t,e)=>await Ii(t,e,exports.Record.ETH,!0),exports.getFavoriteDomain=async(e,r)=>{const[n]=qi.getKeySync(Gi,new t.PublicKey(r)),o=await qi.retrieve(e,n),i=await Sn(e,o.nameAccount),s=await Fi(e,i);return{domain:o.nameAccount,reverse:i,stale:!r.equals(s)}},exports.getGithubRecord=async(t,e)=>await Ii(t,e,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(e,r){const n=An(r.toString()),o=In(n,De,Me);let i=await Wi.retrieve(e,o);return[i.twitterHandle,new t.PublicKey(i.twitterRegistryKey)]},exports.getHashedName=Ze,exports.getHashedNameSync=An,exports.getInjectiveRecord=async(t,e)=>await Ii(t,e,exports.Record.Injective,!0),exports.getIpfsRecord=async(t,e)=>await Ii(t,e,exports.Record.IPFS,!0),exports.getLtcRecord=async(t,e)=>await Ii(t,e,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(e,r)=>{const n=[],o=r.map((t=>qi.getKeySync(Gi,t)[0])),i=(await e.getMultipleAccountsInfo(o)).map((e=>(null==e?void 0:e.data)?qi.deserialize(null==e?void 0:e.data).nameAccount:t.PublicKey.default)),s=i.map((t=>_n(t))),a=i.map(((t,e)=>Bt(oe(t),r[e],!0))),[c,u,f]=await Promise.all([e.getMultipleAccountsInfo(i),e.getMultipleAccountsInfo(s),e.getMultipleAccountsInfo(a)]);for(let e=0;e<r.length;e++){const o=c[e],i=u[e],s=f[e];if(!o||!i){n.push(void 0);continue}if(new t.PublicKey(null==o?void 0:o.data.slice(32,64)).equals(r[e])){n.push(Ln(null==i?void 0:i.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=Et.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Ln(null==i?void 0:i.data.slice(96)))}return n},exports.getMultipleRecordsV2=async function(t,e,r,n={}){const o=r.map((t=>Oi(e,t))),i=await Br.retrieveBatch(t,o);return n.deserialize?i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:Li(t.getContent(),r[e])}})):i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))},exports.getNameAccountKey=Xe,exports.getNameAccountKeySync=In,exports.getNameOwner=$e,exports.getPicRecord=async(t,e)=>await Ii(t,e,exports.Record.Pic,!0),exports.getPointRecord=async(t,e)=>await Ii(t,e,exports.Record.POINT,!0),exports.getRecord=Ii,exports.getRecordKeySync=Ai,exports.getRecordV2=async function(t,e,r,n={}){const o=Oi(e,r),i=await Br.retrieve(t,o);return n.deserialize?{retrievedRecord:i,deserializedContent:Li(i.getContent(),r)}:{retrievedRecord:i}},exports.getRecordV2Key=Oi,exports.getRecords=async function(t,e,r,n){const o=r.map((t=>Ai(e,t))),i=await he.retrieveBatch(t,o);return n?i.map(((t,n)=>{if(t)return Bi(t,r[n],Ai(e,r[n]))})):i},exports.getRedditRecord=async(t,e)=>await Ii(t,e,exports.Record.Reddit,!0),exports.getReverseKey=async(t,e)=>{const{pubkey:r,parent:n}=await Je(t),o=await Ze(r.toBase58());return await Xe(o,Ne,e?n:void 0)},exports.getReverseKeyFromDomainKey=_n,exports.getReverseKeySync=Tn,exports.getShdwRecord=async(t,e)=>await Ii(t,e,exports.Record.SHDW,!0),exports.getSolRecord=Si,exports.getTelegramRecord=async(t,e)=>await Ii(t,e,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(t,e)=>{const r=await fe(t,e),n=await Bn(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))},exports.getTwitterHandleandRegistryKeyViaFilters=async function(e,r){const n=[{memcmp:{offset:0,bytes:Me.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:De.toBase58()}}],o=await e.getProgramAccounts(Te,{filters:n});for(const e of o)if(e.account.data.length>he.HEADER_LEN+32){const r=e.account.data.slice(he.HEADER_LEN),n=new Wi(Gt(Wi.schema,r));return[n.twitterHandle,new t.PublicKey(n.twitterRegistryKey)]}throw new kt(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(t,e)=>await Ii(t,e,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(t,e){const r=An(e),n=In(r,void 0,Me),{registry:o}=await he.retrieve(t,n);return o},exports.getTwitterRegistryData=async function(e,r){const o=[{memcmp:{offset:0,bytes:Me.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t.PublicKey(n.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(Te,{filters:o});if(i.length>1)throw new kt(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(he.HEADER_LEN)},exports.getTwitterRegistryKey=async function(t){const e=An(t);return In(e,void 0,Me)},exports.getUrlRecord=async(t,e)=>await Ii(t,e,exports.Record.Url,!0),exports.performReverseLookup=async function(t,e){const r=await Ze(e.toBase58()),n=await Xe(r,Ne),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);const i=o.data.slice(0,4).readUInt32LE(0);return o.data.slice(4,4+i).toString()},exports.performReverseLookupBatch=async function(t,e){let r=[];for(let t of e){const e=await Ze(t.toBase58()),n=await Xe(e,Ne);r.push(n)}return(await he.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()}))},exports.reallocInstruction=function(e,r,o,i,s,a){const c=[n.Buffer.from(Int8Array.from([4])),a.toBuffer()],u=n.Buffer.concat(c),f=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new t.TransactionInstruction({keys:f,programId:e,data:u})},exports.registerDomainName=async(e,r,n,o,i,s=ze,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new kt(exports.ErrorType.InvalidDomain);const[c]=t.PublicKey.findProgramAddressSync([Le.toBuffer()],Le),u=An(r),f=In(u,void 0,Ue),h=An(f.toBase58()),d=In(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Le),y=We.findIndex((t=>null==a?void 0:a.equals(t)));let g;const w=[];if(-1!==y&&a){g=Bt(s,a,!0);const t=await e.getAccountInfo(g);if(!(null==t?void 0:t.data)){const t=Rt(o,g,a,s);w.push(t)}}const b=Bt(s,He),m=Fe.get(s.toBase58());if(!m)throw new kt(exports.ErrorType.PythFeedNotFound);const v=new Jt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Le,Te,Ue,f,d,t.SystemProgram.programId,c,o,i,Ke,new t.PublicKey(m.product),new t.PublicKey(m.price),b,p,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},exports.registerWithNft=(e,r,n,o,i,s,a,c,u)=>{const[f]=t.PublicKey.findProgramAddressSync([n.toBuffer()],Le);return new te({space:r,name:e}).getInstruction(Le,Te,Ue,n,o,t.SystemProgram.programId,Ne,i,s,a,c,u,qe,p,t.SYSVAR_RENT_PUBKEY,f,Ye)},exports.resolve=Fi,exports.resolveSolRecordV1=Ki,exports.resolveSolRecordV2=Hi,exports.retrieveNftOwner=ae,exports.retrieveNfts=async e=>{const r=await e.getProgramAccounts(re,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t.PublicKey(e.account.data.slice(66,98))))},exports.retrieveRecords=fe,exports.reverseLookup=Sn,exports.reverseLookupBatch=Bn,exports.serializeRecord=Ri,exports.serializeRecordV2Content=Ci,exports.serializeSolRecord=Pi,exports.transferInstruction=$t,exports.transferNameOwnership=async function(t,e,r,n,o,i){const s=An(e),a=In(s,n,o);let c;return c=n||(await he.retrieve(t,a)).registry.owner,$t(Te,a,r,c,n,o,i)},exports.transferSubdomain=async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=Pn(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await he.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await he.retrieve(t,a)).registry.owner);return $t(Te,i,r,o,void 0,c,u)},exports.updateInstruction=Yt,exports.updateNameRegistryData=async function(t,e,r,n,o,i){const s=An(e),a=In(s,o,i);let c;return c=o||(await he.retrieve(t,a)).registry.owner,Yt(Te,a,new Tt(r),n,c)},exports.updateRecordInstruction=async(t,e,r,n,o,i)=>{Un(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=Pn(`${r}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);Un(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const c=Ri(n,r);if((null==a?void 0:a.data.slice(96).length)!==c.length)return[Zt(Te,s,i,o),await Vi(t,e,r,n,o,i)];return[Yt(Te,s,new Tt(0),c,o)]},exports.updateRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Pn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new wr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Er))(i,s,a,o,Te,"".concat(r),Ci(n,r),vr);return u},exports.updateSolRecordInstruction=async(t,e,r,n,o,i)=>{const{pubkey:s}=Pn(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);if(Un(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Zt(Te,s,i,n),await zi(t,e,r,n,o,i)];const c=Pi(r,s,n,o);return[Yt(Te,s,new Tt(0),c,n)]},exports.validateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Pn(`${n}.${r}`,exports.RecordVersion.V2);if(u&&(c=Pn(r).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c)=>new gr({staleness:a}).getInstruction(c,t.SystemProgram.programId,s,e,r,n,o,Er,i))(i,a,c,o,s,Te,e,vr);return f},exports.verifyRightOfAssociation=async(t,e,r,n)=>{var o;const i=Oi(r,e),s=await Br.retrieve(t,i),a=s.getRoAId(),c=Ti.has(e)?xr.Ethereum:xr.Solana;if(!(n=null!=n?n:null===(o=ki.get(e))||void 0===o?void 0:o.toBuffer()))throw new kt(exports.ErrorType.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===c},exports.verifyStaleness=async(e,r,n)=>{const o=Oi(n,r),i=await Fi(e,n),s=await Br.retrieve(e,o),a=s.getStalenessId();return i.equals(new t.PublicKey(a))&&s.header.stalenessValidation===xr.Solana},exports.writRoaRecordV2=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Pn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a)=>new mr({roaId:Array.from(s.toBuffer())}).getInstruction(a,t.SystemProgram.programId,r,e,n,o,i,Er))(o,Te,s,a,n,i,vr);return u};
19
+ function si(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function ai(...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 ci(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(si(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 ui(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 fi(t,e="="){if(si(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 hi(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}ri.pow(Xo,ii),ri.sqrt(ri.neg(ri.ONE)),ri.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)}(ri,ri.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const di=(t,e)=>e?di(e,t%e):t,pi=(t,e)=>t+(e-di(t,e));function li(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(pi(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${pi(e,r)}`);let o=0,i=0;const s=2**r-1,a=[];for(const n of t){if(si(n),n>=2**e)throw new Error(`convertRadix2: invalid data word=${n} from=${e}`);if(o=o<<e|n,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=r;i-=r)a.push((o>>i-r&s)>>>0);o&=2**i-1}if(o=o<<r-i&s,!n&&i>=e)throw new Error("Excess padding");if(!n&&o)throw new Error(`Non-zero padding: ${o}`);return n&&i>0&&a.push(o>>>0),a}function yi(t,e=!1){if(si(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(pi(8,t)>32||pi(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 li(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(li(r,t,8,e))}}}function gi(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}yi(4),ci("0123456789ABCDEF"),ui(""),yi(5),ci("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),fi(5),ui(""),yi(5),ci("0123456789ABCDEFGHIJKLMNOPQRSTUV"),fi(5),ui(""),yi(5),ci("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),ui(""),hi((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),yi(6),ci("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),fi(6),ui(""),yi(6),ci("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),fi(6),ui(""),yi(6),ci("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),ui("");const wi=ai(ci("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),ui("")),bi=[996825010,642813549,513874426,1027748829,705979059];function mi(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<bi.length;t++)1==(e>>t&1)&&(r^=bi[t]);return r}function vi(t,e,r=1){const n=t.length;let o=1;for(let e=0;e<n;e++){const r=t.charCodeAt(e);if(r<33||r>126)throw new Error(`Invalid prefix (${t})`);o=mi(o)^r>>5}o=mi(o);for(let e=0;e<n;e++)o=mi(o)^31&t.charCodeAt(e);for(let t of e)o=mi(o)^t;for(let t=0;t<6;t++)o=mi(o);return o^=r,wi.encode(li([o%2**30],30,5,!1))}function Ei(t){const e="bech32"===t?1:734539939,r=yi(5),n=r.decode,o=r.encode,i=gi(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 o=(t=n).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=t.slice(0,o),s=t.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=wi.decode(s).slice(0,-6),c=vi(i,a,e);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${t}: expected "${c}"`);return{prefix:i,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 o=t.length+7+r.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=t.toLowerCase(),s=vi(i,r,e);return`${i}1${wi.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:gi(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}const xi=Ei("bech32");yi(4),ci("0123456789abcdef"),ui(""),hi((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 Ai=(t,e,r)=>oi.verify(e,t,r.toBytes()),Ii=(t,e)=>{const{pubkey:r}=Pn(e+"."+t,exports.RecordVersion.V1);return r};async function Si(t,e,r,n){const o=Ii(e,r);let{registry:i}=await he.retrieve(t,o);if(!i.data)throw new kt(exports.ErrorType.NoRecordData);if(n)return Ri(i,r,o);const s=Pr.get(r);return i.data=i.data.slice(0,s),i}const Bi=async(t,e)=>await Si(t,e,exports.Record.SOL),Ri=(e,r,o)=>{const i=null==e?void 0:e.data;if(!i)return;if(0===i.compare(n.Buffer.alloc(i.length)))return;const s=Pr.get(r),a=(t=>{const e=Array.from(t);return e.length-1-e.reverse().findIndex((t=>0!==t))+1})(i);if(!s){const t=i.slice(0,a).toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?qn(t):t}if(r===exports.Record.SOL){const t=new TextEncoder,r=n.Buffer.concat([i.slice(0,32),o.toBuffer()]),s=t.encode(r.toString("hex"));if(Ai(s,i.slice(32,96),e.owner))return Nn.encode(i.slice(0,32))}if(s&&a!==s){const t=i.slice(0,a).toString("utf-8");if(r===exports.Record.Injective){const e=xi.decodeToBytes(t);if("inj"===e.prefix&&20===e.bytes.length)return t}else if(r===exports.Record.BSC||r===exports.Record.ETH){const e=t.slice(0,2),r=t.slice(2);if("0x"===e&&20===n.Buffer.from(r,"hex").length)return t}else if((r===exports.Record.A||r===exports.Record.AAAA)&&Mn.isValid(t))return t;throw new kt(exports.ErrorType.InvalidRecordData)}if(r===exports.Record.ETH||r===exports.Record.BSC)return"0x"+i.slice(0,s).toString("hex");if(r===exports.Record.Injective)return xi.encode("inj",xi.toWords(i.slice(0,s)));if(r===exports.Record.A||r===exports.Record.AAAA)return Mn.fromByteArray([...i.slice(0,s)]).toString();if(r===exports.Record.Background)return new t.PublicKey(i.slice(0,s)).toString();throw new kt(exports.ErrorType.InvalidRecordData)},Pi=(e,r)=>{if(!Pr.get(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=Yn(e)),n.Buffer.from(e,"utf-8");if(r===exports.Record.SOL)throw new kt(exports.ErrorType.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===exports.Record.ETH||r===exports.Record.BSC)return Un("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=xi.decodeToBytes(e);return Un("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Un(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Mn.parse(e).toByteArray();return Un(4===t.length,exports.ErrorType.InvalidARecord),n.Buffer.from(t)}if(r===exports.Record.AAAA){const t=Mn.parse(e).toByteArray();return Un(16===t.length,exports.ErrorType.InvalidAAAARecord),n.Buffer.from(t)}if(r===exports.Record.Background)return new t.PublicKey(e).toBuffer();throw new kt(exports.ErrorType.InvalidRecordInput)},ki=(t,e,r,o)=>{const i=n.Buffer.concat([t.toBuffer(),e.toBuffer()]),s=(new TextEncoder).encode(i.toString("hex")),a=Ai(s,o,r);return Un(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([t.toBuffer(),o])},Ti=new Map([[exports.Record.Url,new t.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),_i=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC]),Ui=new Set([exports.Record.IPFS,exports.Record.ARWV,exports.Record.LTC,exports.Record.DOGE,exports.Record.Email,exports.Record.Url,exports.Record.Discord,exports.Record.Github,exports.Record.Reddit,exports.Record.Twitter,exports.Record.Telegram,exports.Record.Pic,exports.Record.SHDW,exports.Record.POINT,exports.Record.Backpack,exports.Record.TXT,exports.Record.CNAME,exports.Record.BTC]),Li=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),Ci=(e,r)=>{if(Ui.has(r)){const t=e.toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?qn(t):t}if(r===exports.Record.SOL)return new t.PublicKey(e).toBase58();if(r===exports.Record.ETH||r===exports.Record.BSC)return"0x"+e.toString("hex");if(r===exports.Record.Injective)return xi.encode("inj",xi.toWords(e));if(r===exports.Record.A||r===exports.Record.AAAA)return Mn.fromByteArray([...e]).toString();throw new kt(exports.ErrorType.InvalidARecord)},Oi=(e,r)=>{if(Ui.has(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=Yn(e)),Buffer.from(e,"utf-8");if(r===exports.Record.SOL)return new t.PublicKey(e).toBuffer();if(r===exports.Record.ETH||r===exports.Record.BSC)return Un("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=xi.decodeToBytes(e);return Un("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Un(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Mn.parse(e).toByteArray();return Un(4===t.length,exports.ErrorType.InvalidARecord),Buffer.from(t)}if(r===exports.Record.AAAA){const t=Mn.parse(e).toByteArray();return Un(16===t.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(t)}throw new kt(exports.ErrorType.InvalidARecord)},Ni=(t,e)=>{const{pubkey:r}=Pn(t),n=An("".concat(e));return In(n,Er,r)};async function Di(e,r,n,o,i,s,a,c){const u=An(r),f=In(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let d;if(c){const{registry:t}=await $e(e,c);d=t.owner}return qt(Te,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,d)}async function Mi(t,e,r,n,o){const i=An(e),s=In(i,n,o);let a;a=n||(await he.retrieve(t,s)).registry.owner;return Xt(Te,s,r,a)}const Vi=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Le.toBuffer()],Le),a=An(e.toBase58()),c=In(a,s,o);return[[],[new Qt({name:r}).getInstruction(Le,Te,Ue,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},zi=async(e,r,n,o,i,s)=>{Un(n!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:a,hashed:c,parent:u}=Pn(`${n}.${r}`,exports.RecordVersion.V1),f=Pi(o,n).length,h=await e.getMinimumBalanceForRentExemption(f+he.HEADER_LEN);return qt(Te,t.SystemProgram.programId,a,i,s,c,new _t(h),new Tt(f),void 0,u,i)},Wi=async(e,r,n,o,i,s)=>{const{pubkey:a,hashed:c,parent:u}=Pn(`${exports.Record.SOL}.${r}`,exports.RecordVersion.V1),f=ki(n,a,o,i).length,h=await e.getMinimumBalanceForRentExemption(f+he.HEADER_LEN);return[qt(Te,t.SystemProgram.programId,a,o,s,c,new _t(h),new Tt(f),void 0,u,o)]};class ji{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 kt(exports.ErrorType.InvalidReverseTwitter);return new ji(Gt(ji.schema,r.data.slice(he.HEADER_LEN)))}}async function Fi(e,r,o,i,s){const a=An(i.toString()),c=In(a,De,Me);let u=Ht(ji.schema,new ji({twitterRegistryKey:o.toBytes(),twitterHandle:r}));return[qt(Te,t.SystemProgram.programId,c,i,s,a,new _t(await e.getMinimumBalanceForRentExemption(u.length+he.HEADER_LEN)),new Tt(u.length),De,Me,De),Yt(Te,c,new Tt(0),n.Buffer.from(u),De)]}ji.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}};const Ki=async(t,e)=>{const{pubkey:r}=Pn(e),{registry:n,nftOwner:o}=await he.retrieve(t,r);if(o)return o;try{const r=await Gi(t,n.owner,e);if(void 0!==r)return r;return await Hi(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},Hi=async(e,r,o)=>{const i=Ii(o,exports.Record.SOL),s=await Bi(e,o);if(!(null==s?void 0:s.data))throw new kt(exports.ErrorType.NoRecordData);const a=new TextEncoder,c=n.Buffer.concat([s.data.slice(0,32),i.toBuffer()]),u=a.encode(c.toString("hex"));if(!Ai(u,s.data.slice(32),r))throw new kt(exports.ErrorType.InvalidSignature);return new t.PublicKey(s.data.slice(0,32))},Gi=async(e,r,n)=>{try{const o=Ni(n,exports.Record.SOL),i=await Br.retrieve(e,o),s=i.getStalenessId(),a=i.getRoAId(),c=i.getContent();if(0===s.compare(r.toBuffer())&&i.header.stalenessValidation===xr.Solana&&0===a.compare(c)&&i.header.rightOfAssociationValidation===xr.Solana)return new t.PublicKey(c)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},qi=new t.PublicKey("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Yi{constructor(e){this.tag=e.tag,this.nameAccount=new t.PublicKey(e.nameAccount)}static deserialize(t){return new Yi(Gt(this.schema,t))}static async retrieve(t,e){const r=await t.getAccountInfo(e);if(!r||!r.data)throw new kt(exports.ErrorType.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(e,r){return await t.PublicKey.findProgramAddress([n.Buffer.from("favourite_domain"),r.toBuffer()],e)}static getKeySync(e,r){return t.PublicKey.findProgramAddressSync([n.Buffer.from("favourite_domain"),r.toBuffer()],e)}}Yi.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};var $i;exports.CustomBg=void 0,($i=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",$i.Rgb0x001="rgb0x00#1";const Xi=new t.PublicKey("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),Zi=new t.PublicKey("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),Qi={NAME_PROGRAM_ID:new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new t.PublicKey("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new t.PublicKey("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new t.PublicKey("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new t.PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new t.PublicKey("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.PublicKey("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new t.PublicKey("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},Ji=(e,r,o)=>{const i=[e];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=t.PublicKey.findProgramAddressSync(i,Qi.NAME_PROGRAM_ID);return s},ts=(t,e=Qi.ROOT_DOMAIN_ACCOUNT,r)=>{let n=An(t);return{pubkey:Ji(n,r,e),hashed:n}},es=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}=ts(e[1]);return{...ts(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...ts(t,Qi.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},rs=(t,e)=>{const{pubkey:r,parent:n}=es(t),o=An(r.toBase58());return Ji(o,Qi.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function ns(e,r,n,o,i,s,a,c){const u=await Xe(r),f=await Ji(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let d;if(c){const{registry:t}=await $e(e,c);d=t.owner}return qt(Qi.NAME_PROGRAM_ID,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,d)}const os=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Qi.REGISTER_PROGRAM_ID.toBuffer()],Qi.REGISTER_PROGRAM_ID),a=await Xe(e.toBase58()),c=Ji(a,s,o);return[[],[new Qt({name:r}).getInstruction(Qi.REGISTER_PROGRAM_ID,Qi.NAME_PROGRAM_ID,Qi.ROOT_DOMAIN_ACCOUNT,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},is={utils:{getNameAccountKeySync:Ji,reverseLookup:async(t,e)=>{const r=An(e.toBase58()),n=Ji(r,Qi.REVERSE_LOOKUP_CLASS),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Ln(o.data)},_deriveSync:ts,getDomainKeySync:es,getReverseKeySync:rs},constants:Qi,bindings:{createNameRegistry:ns,updateNameRegistryData:async function(t,e,r,n,o,i){const s=await Xe(e),a=Ji(s,o,i);let c;return c=o||(await he.retrieve(t,a)).registry.owner,Yt(Qi.NAME_PROGRAM_ID,a,new Tt(r),n,c)},transferNameOwnership:async function(t,e,r,n,o,i){const s=await Xe(e),a=Ji(s,n,o);let c;return c=n||(await he.retrieve(t,a)).registry.owner,$t(Qi.NAME_PROGRAM_ID,a,r,c,n,o,i)},deleteNameRegistry:async function(t,e,r,n,o){const i=await Xe(e),s=Ji(i,n,o);let a;return a=n||(await he.retrieve(t,s)).registry.owner,Xt(Qi.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(e,r,n,o,i,s=Qi.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new kt(exports.ErrorType.InvalidDomain);const[c]=t.PublicKey.findProgramAddressSync([Qi.REGISTER_PROGRAM_ID.toBuffer()],Qi.REGISTER_PROGRAM_ID),u=An(r),f=Ji(u,void 0,Qi.ROOT_DOMAIN_ACCOUNT),h=An(f.toBase58()),d=Ji(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Qi.REGISTER_PROGRAM_ID),y=Qi.REFERRERS.findIndex((t=>null==a?void 0:a.equals(t)));let g;const w=[];if(-1!==y&&a){g=Bt(s,a,!0);const t=await e.getAccountInfo(g);if(!(null==t?void 0:t.data)){const t=Rt(o,g,a,s);w.push(t)}}const b=Bt(s,Qi.VAULT_OWNER),m=is.constants.PYTH_FEEDS.get(s.toBase58());if(!m)throw new kt(exports.ErrorType.PythFeedNotFound);const v=new Jt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Qi.REGISTER_PROGRAM_ID,Qi.NAME_PROGRAM_ID,Qi.ROOT_DOMAIN_ACCOUNT,f,d,t.SystemProgram.programId,c,o,i,Qi.PYTH_MAPPING_ACC,new t.PublicKey(m.product),new t.PublicKey(m.price),b,p,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},createReverseName:os,createSubdomain:async(t,e,r,n=2e3)=>{const o=[],i=e.split(".")[0];if(!i)throw new kt(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=es(e),c=await t.getMinimumBalanceForRentExemption(n+he.HEADER_LEN),u=await ns(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=rs(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await os(a,"\0".concat(i),r,s,r);o.push(...t)}return[[],o]},burnDomain:(e,r,n)=>{const{pubkey:o}=es(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Qi.REGISTER_PROGRAM_ID),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Qi.REGISTER_PROGRAM_ID);return(new ee).getInstruction(Qi.REGISTER_PROGRAM_ID,Qi.NAME_PROGRAM_ID,t.SystemProgram.programId,o,rs(e),s,i,Qi.REVERSE_LOOKUP_CLASS,r,n)},transferSubdomain:async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=es(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await he.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await he.retrieve(t,a)).registry.owner);return $t(Qi.NAME_PROGRAM_ID,i,r,o,void 0,c,u)}}};exports.BONFIDA_FIDA_BNB=Oe,exports.BONFIDA_USDC_BNB=Ve,exports.CUSTOM_BG_TLD=Ge,exports.ETH_ROA_RECORDS=_i,exports.FavouriteDomain=Yi,exports.GUARDIANS=Ti,exports.HASH_PREFIX=_e,exports.METAPLEX_ID=Ye,exports.NAME_OFFERS_ID=qi,exports.NAME_PROGRAM_ID=Te,exports.NameRegistryState=he,exports.Numberu32=Tt,exports.Numberu64=_t,exports.PYTH_FEEDS=Fe,exports.PYTH_FIDA_PRICE_ACC=Ce,exports.PYTH_MAPPING_ACC=Ke,exports.RECORD_V1_SIZE=Pr,exports.REFERRERS=We,exports.REGISTER_PROGRAM_ID=Le,exports.REVERSE_LOOKUP_CLASS=Ne,exports.ROOT_DOMAIN_ACCOUNT=Ue,exports.ReverseTwitterRegistryState=ji,exports.SELF_SIGNED=Li,exports.SNSError=kt,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=je,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=Me,exports.TWITTER_VERIFICATION_AUTHORITY=De,exports.USDC_MINT=ze,exports.UTF8_ENCODED=Ui,exports.VAULT_OWNER=He,exports.WOLVES_COLLECTION_METADATA=qe,exports.burnDomain=(e,r,n)=>{const{pubkey:o}=Pn(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Le),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Le);return(new ee).getInstruction(Le,Te,t.SystemProgram.programId,o,Tn(e),s,i,Ne,r,n)},exports.burnInstruction=ee,exports.changeTwitterRegistryData=async function(t,e,r,n){const o=An(t),i=In(o,void 0,Me);return[Yt(Te,i,new Tt(r),n,e)]},exports.changeVerifiedPubkey=async function(t,e,r,n,o){const i=An(e),s=In(i,void 0,Me);let a=[$t(Te,s,n,r,void 0)];return a.push(await Mi(t,r.toString(),o,De,Me)),a=a.concat(await Fi(t,e,s,n,o)),a},exports.check=Un,exports.checkSolRecord=Ai,exports.createInstruction=qt,exports.createInstructionV3=Jt,exports.createNameRegistry=Di,exports.createRecordInstruction=zi,exports.createRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Pn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new lr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Er))(i,s,a,o,Te,"".concat(r),Oi(n,r),vr);return u},exports.createReverseInstruction=Qt,exports.createReverseName=Vi,exports.createReverseTwitterRegistry=Fi,exports.createSolRecordInstruction=Wi,exports.createSubdomain=async(t,e,r,n=2e3)=>{const o=[],i=e.split(".")[0];if(!i)throw new kt(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=Pn(e),c=await t.getMinimumBalanceForRentExemption(n+he.HEADER_LEN),u=await Di(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=Tn(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Vi(a,"\0".concat(i),r,s,r);o.push(...t)}return[[],o]},exports.createV2Instruction=Zt,exports.createVerifiedTwitterRegistry=async function(e,r,n,o,i){const s=An(r),a=In(s,void 0,Me),c=await e.getMinimumBalanceForRentExemption(o+he.HEADER_LEN);let u=[qt(Te,t.SystemProgram.programId,a,n,i,s,new _t(c),new Tt(o),void 0,Me,De)];return u=u.concat(await Fi(e,r,a,n,i)),u},exports.createWithNftInstruction=te,exports.deleteInstruction=Xt,exports.deleteNameRegistry=Mi,exports.deleteRecordV2=(e,r,n,o)=>{let{pubkey:i,parent:s,isSub:a}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(a&&(s=Pn(e).pubkey),!s)throw new Error("Invalid parent");const c=((e,r,n,o,i,s)=>(new br).getInstruction(s,t.SystemProgram.programId,i,e,o,r,n,Er))(o,s,n,i,Te,vr);return c},exports.deleteTwitterRegistry=async function(t,e){const r=An(t),n=In(r,void 0,Me),o=An(e.toString()),i=In(o,De,Me);return[Xt(Te,n,e,e),Xt(Te,i,e,e)]},exports.deserializeRecord=Ri,exports.deserializeRecordV2Content=Ci,exports.deserializeReverse=Ln,exports.devnet=is,exports.ethValidateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(u&&(c=Pn(e).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c,u)=>new yr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(c)}).getInstruction(u,t.SystemProgram.programId,i,e,r,n,o,Er))(o,a,c,n,Te,xr.Ethereum,i,s,vr);return f},exports.findSubdomains=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:Ne.toBase58()}}],n=await t.getProgramAccounts(Te,{filters:r}),o=[{memcmp:{offset:0,bytes:e.toBase58()}}],i=await t.getProgramAccounts(Te,{filters:o,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Ln(t.account.data.slice(96))]))),a=[];return i.forEach((t=>{const r=_n(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=kn,exports.getAllRegisteredDomains=async t=>{const e=[{memcmp:{offset:0,bytes:Ue.toBase58()}}];return await t.getProgramAccounts(Te,{dataSlice:{offset:32,length:32},filters:e})},exports.getArtistPubkey=t=>{switch(t){case exports.CustomBg.DegenPoet1:return Xi;case exports.CustomBg.Rgb0x001:return Zi;default:throw new kt(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(t,e)=>await Si(t,e,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(t,e)=>await Si(t,e,exports.Record.Background,!0),exports.getBackpackRecord=async(t,e)=>await Si(t,e,exports.Record.Backpack,!0),exports.getBscRecord=async(t,e)=>await Si(t,e,exports.Record.BSC,!0),exports.getBtcRecord=async(t,e)=>await Si(t,e,exports.Record.BTC,!0),exports.getCustomBgKeys=(t,e)=>{const r=An(e),n=An(t),o=In(n,void 0,Ge);return{domainKey:o,bgKey:In(r,void 0,o)}},exports.getDiscordRecord=async(t,e)=>await Si(t,e,exports.Record.Discord,!0),exports.getDogeRecord=async(t,e)=>await Si(t,e,exports.Record.DOGE,!0),exports.getDomainKey=Je,exports.getDomainKeySync=Pn,exports.getDomainKeysWithReverses=async function(t,e){const r=await kn(t,e),n=await Bn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))},exports.getDomainMint=oe,exports.getDomainPriceFromName=t=>{switch(xn(t).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}},exports.getEmailRecord=async(t,e)=>await Si(t,e,exports.Record.Email,!0),exports.getEthRecord=async(t,e)=>await Si(t,e,exports.Record.ETH,!0),exports.getFavoriteDomain=async(e,r)=>{const[n]=Yi.getKeySync(qi,new t.PublicKey(r)),o=await Yi.retrieve(e,n),i=await Sn(e,o.nameAccount),s=await Ki(e,i);return{domain:o.nameAccount,reverse:i,stale:!r.equals(s)}},exports.getGithubRecord=async(t,e)=>await Si(t,e,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(e,r){const n=An(r.toString()),o=In(n,De,Me);let i=await ji.retrieve(e,o);return[i.twitterHandle,new t.PublicKey(i.twitterRegistryKey)]},exports.getHashedName=Xe,exports.getHashedNameSync=An,exports.getInjectiveRecord=async(t,e)=>await Si(t,e,exports.Record.Injective,!0),exports.getIpfsRecord=async(t,e)=>await Si(t,e,exports.Record.IPFS,!0),exports.getLtcRecord=async(t,e)=>await Si(t,e,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(e,r)=>{const n=[],o=r.map((t=>Yi.getKeySync(qi,t)[0])),i=(await e.getMultipleAccountsInfo(o)).map((e=>(null==e?void 0:e.data)?Yi.deserialize(null==e?void 0:e.data).nameAccount:t.PublicKey.default)),s=i.map((t=>_n(t))),a=i.map(((t,e)=>Bt(oe(t),r[e],!0))),[c,u,f]=await Promise.all([e.getMultipleAccountsInfo(i),e.getMultipleAccountsInfo(s),e.getMultipleAccountsInfo(a)]);for(let e=0;e<r.length;e++){const o=c[e],i=u[e],s=f[e];if(!o||!i){n.push(void 0);continue}if(new t.PublicKey(null==o?void 0:o.data.slice(32,64)).equals(r[e])){n.push(Ln(null==i?void 0:i.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=Et.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Ln(null==i?void 0:i.data.slice(96)))}return n},exports.getMultipleRecordsV2=async function(t,e,r,n={}){const o=r.map((t=>Ni(e,t))),i=await Br.retrieveBatch(t,o);return n.deserialize?i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:Ci(t.getContent(),r[e])}})):i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))},exports.getNameAccountKey=Ze,exports.getNameAccountKeySync=In,exports.getNameOwner=$e,exports.getPicRecord=async(t,e)=>await Si(t,e,exports.Record.Pic,!0),exports.getPointRecord=async(t,e)=>await Si(t,e,exports.Record.POINT,!0),exports.getRecord=Si,exports.getRecordKeySync=Ii,exports.getRecordV2=async function(t,e,r,n={}){const o=Ni(e,r),i=await Br.retrieve(t,o);return n.deserialize?{retrievedRecord:i,deserializedContent:Ci(i.getContent(),r)}:{retrievedRecord:i}},exports.getRecordV2Key=Ni,exports.getRecords=async function(t,e,r,n){const o=r.map((t=>Ii(e,t))),i=await he.retrieveBatch(t,o);return n?i.map(((t,n)=>{if(t)return Ri(t,r[n],Ii(e,r[n]))})):i},exports.getRedditRecord=async(t,e)=>await Si(t,e,exports.Record.Reddit,!0),exports.getReverseKey=async(t,e)=>{const{pubkey:r,parent:n}=await Je(t),o=await Xe(r.toBase58());return await Ze(o,Ne,e?n:void 0)},exports.getReverseKeyFromDomainKey=_n,exports.getReverseKeySync=Tn,exports.getShdwRecord=async(t,e)=>await Si(t,e,exports.Record.SHDW,!0),exports.getSolRecord=Bi,exports.getTelegramRecord=async(t,e)=>await Si(t,e,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(t,e)=>{const r=await fe(t,e),n=await Bn(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))},exports.getTwitterHandleandRegistryKeyViaFilters=async function(e,r){const n=[{memcmp:{offset:0,bytes:Me.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:De.toBase58()}}],o=await e.getProgramAccounts(Te,{filters:n});for(const e of o)if(e.account.data.length>he.HEADER_LEN+32){const r=e.account.data.slice(he.HEADER_LEN),n=new ji(Gt(ji.schema,r));return[n.twitterHandle,new t.PublicKey(n.twitterRegistryKey)]}throw new kt(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(t,e)=>await Si(t,e,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(t,e){const r=An(e),n=In(r,void 0,Me),{registry:o}=await he.retrieve(t,n);return o},exports.getTwitterRegistryData=async function(e,r){const o=[{memcmp:{offset:0,bytes:Me.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t.PublicKey(n.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(Te,{filters:o});if(i.length>1)throw new kt(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(he.HEADER_LEN)},exports.getTwitterRegistryKey=async function(t){const e=An(t);return In(e,void 0,Me)},exports.getUrlRecord=async(t,e)=>await Si(t,e,exports.Record.Url,!0),exports.performReverseLookup=async function(t,e){const r=await Xe(e.toBase58()),n=await Ze(r,Ne),{registry:o}=await he.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);const i=o.data.slice(0,4).readUInt32LE(0);return o.data.slice(4,4+i).toString()},exports.performReverseLookupBatch=async function(t,e){let r=[];for(let t of e){const e=await Xe(t.toBase58()),n=await Ze(e,Ne);r.push(n)}return(await he.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()}))},exports.reallocInstruction=function(e,r,o,i,s,a){const c=[n.Buffer.from(Int8Array.from([4])),a.toBuffer()],u=n.Buffer.concat(c),f=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new t.TransactionInstruction({keys:f,programId:e,data:u})},exports.registerDomainName=async(e,r,n,o,i,s=ze,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new kt(exports.ErrorType.InvalidDomain);const[c]=t.PublicKey.findProgramAddressSync([Le.toBuffer()],Le),u=An(r),f=In(u,void 0,Ue),h=An(f.toBase58()),d=In(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Le),y=We.findIndex((t=>null==a?void 0:a.equals(t)));let g;const w=[];if(-1!==y&&a){g=Bt(s,a,!0);const t=await e.getAccountInfo(g);if(!(null==t?void 0:t.data)){const t=Rt(o,g,a,s);w.push(t)}}const b=Bt(s,He),m=Fe.get(s.toBase58());if(!m)throw new kt(exports.ErrorType.PythFeedNotFound);const v=new Jt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Le,Te,Ue,f,d,t.SystemProgram.programId,c,o,i,Ke,new t.PublicKey(m.product),new t.PublicKey(m.price),b,p,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},exports.registerWithNft=(e,r,n,o,i,s,a,c,u)=>{const[f]=t.PublicKey.findProgramAddressSync([n.toBuffer()],Le);return new te({space:r,name:e}).getInstruction(Le,Te,Ue,n,o,t.SystemProgram.programId,Ne,i,s,a,c,u,qe,p,t.SYSVAR_RENT_PUBKEY,f,Ye)},exports.resolve=Ki,exports.resolveSolRecordV1=Hi,exports.resolveSolRecordV2=Gi,exports.retrieveNftOwner=ae,exports.retrieveNfts=async e=>{const r=await e.getProgramAccounts(re,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t.PublicKey(e.account.data.slice(66,98))))},exports.retrieveRecords=fe,exports.reverseLookup=Sn,exports.reverseLookupBatch=Bn,exports.serializeRecord=Pi,exports.serializeRecordV2Content=Oi,exports.serializeSolRecord=ki,exports.transferInstruction=$t,exports.transferNameOwnership=async function(t,e,r,n,o,i){const s=An(e),a=In(s,n,o);let c;return c=n||(await he.retrieve(t,a)).registry.owner,$t(Te,a,r,c,n,o,i)},exports.transferSubdomain=async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=Pn(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await he.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await he.retrieve(t,a)).registry.owner);return $t(Te,i,r,o,void 0,c,u)},exports.updateInstruction=Yt,exports.updateNameRegistryData=async function(t,e,r,n,o,i){const s=An(e),a=In(s,o,i);let c;return c=o||(await he.retrieve(t,a)).registry.owner,Yt(Te,a,new Tt(r),n,c)},exports.updateRecordInstruction=async(t,e,r,n,o,i)=>{Un(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=Pn(`${r}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);Un(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const c=Pi(n,r);if((null==a?void 0:a.data.slice(96).length)!==c.length)return[Xt(Te,s,i,o),await zi(t,e,r,n,o,i)];return[Yt(Te,s,new Tt(0),c,o)]},exports.updateRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Pn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new wr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Er))(i,s,a,o,Te,"".concat(r),Oi(n,r),vr);return u},exports.updateSolRecordInstruction=async(t,e,r,n,o,i)=>{const{pubkey:s}=Pn(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);if(Un(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Xt(Te,s,i,n),await Wi(t,e,r,n,o,i)];const c=ki(r,s,n,o);return[Yt(Te,s,new Tt(0),c,n)]},exports.validateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Pn(`${n}.${r}`,exports.RecordVersion.V2);if(u&&(c=Pn(r).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c)=>new gr({staleness:a}).getInstruction(c,t.SystemProgram.programId,s,e,r,n,o,Er,i))(i,a,c,o,s,Te,e,vr);return f},exports.verifyRightOfAssociation=async(t,e,r,n)=>{var o;const i=Ni(r,e),s=await Br.retrieve(t,i),a=s.getRoAId(),c=_i.has(e)?xr.Ethereum:xr.Solana;if(!(n=null!=n?n:null===(o=Ti.get(e))||void 0===o?void 0:o.toBuffer()))throw new kt(exports.ErrorType.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===c},exports.verifyStaleness=async(e,r,n)=>{const o=Ni(n,r),i=await Ki(e,n),s=await Br.retrieve(e,o),a=s.getStalenessId();return i.equals(new t.PublicKey(a))&&s.header.stalenessValidation===xr.Solana},exports.writRoaRecordV2=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Pn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Pn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a)=>new mr({roaId:Array.from(s.toBuffer())}).getInstruction(a,t.SystemProgram.programId,r,e,n,o,i,Er))(o,Te,s,a,n,i,vr);return u};
20
20
  //# sourceMappingURL=index.cjs.map