@bonfida/spl-name-service 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,p=r?
|
|
|
7
7
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8
8
|
* @license MIT
|
|
9
9
|
*/
|
|
10
|
-
!function(t){const e=o,r=p,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 d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return 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 d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,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 N(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 O(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||O(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||O(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 N(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 N(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 W={};function V(t,e,r){W[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function z(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 W.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 W.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new W.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("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=z(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=z(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 d=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 N 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=N;class O 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=O;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 W 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=W;class V 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=V;class z{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=z;class j extends z{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 z))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 N(t),y.f32be=t=>new O(t),y.f64=t=>new D(t),y.f64be=t=>new M(t);var et=y.struct=(t,e,r)=>new V(t,e,r);y.bits=(t,e,r)=>new G(t,e,r),y.seq=(t,e,r)=>new W(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 pt extends ht{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class dt 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=d){return function(t,e,r=d){if(!e)throw new pt;if(!e.owner.equals(r))throw new dt;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=d,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=d,s=l){return function(e,r,n,o,i,s=d,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}(),Nt=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}(),Ot=(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 Wt=Lt.concat(["bool","string"]),Vt=["option","enum","array","set","map","struct"],zt=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Ot(e,t),e}(Error);function jt(t){if("string"!=typeof t||!Wt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Vt.includes(e[0])){var r=e[0];if("option"===r)return jt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new zt(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 zt(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 zt(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 zt(t,"{ key, value }");jt(t.key),jt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new zt(t,"object");for(var e in t)jt(t[e])}(t[r])}}throw new zt(t,Vt.join(", ")+" or "+Wt.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 Nt(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,p){const d=[n.Buffer.from(Int8Array.from([0])),new Tt(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(d),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}),p&&y.push({pubkey:p,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,p){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:d,isSigner:!1,isWritable:!1},{pubkey:p,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 p=n.Buffer.from(this.serialize());let d=[];return d.push({pubkey:r,isSigner:!1,isWritable:!1}),d.push({pubkey:o,isSigner:!1,isWritable:!1}),d.push({pubkey:i,isSigner:!1,isWritable:!0}),d.push({pubkey:s,isSigner:!1,isWritable:!1}),d.push({pubkey:a,isSigner:!1,isWritable:!1}),d.push({pubkey:c,isSigner:!0,isWritable:!0}),d.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&d.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&d.push({pubkey:h,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:d,programId:e,data:p})}}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,p,d,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:p,isSigner:!1,isWritable:!1}),v.push({pubkey:d,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,p,d,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:p,isSigner:!1,isWritable:!0}),v.push({pubkey:d,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 p=n.Buffer.from(this.serialize());let d=[];return d.push({pubkey:r,isSigner:!1,isWritable:!1}),d.push({pubkey:o,isSigner:!1,isWritable:!1}),d.push({pubkey:i,isSigner:!1,isWritable:!0}),d.push({pubkey:s,isSigner:!1,isWritable:!0}),d.push({pubkey:a,isSigner:!1,isWritable:!0}),d.push({pubkey:c,isSigner:!1,isWritable:!0}),d.push({pubkey:u,isSigner:!1,isWritable:!1}),d.push({pubkey:f,isSigner:!0,isWritable:!1}),d.push({pubkey:h,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:d,programId:e,data:p})}}ee.schema={struct:{tag:"u8"}};class re{constructor(){this.tag=6}serialize(){return Ht(re.schema,this)}getInstruction(e,r,o,i,s){const a=n.Buffer.from(this.serialize());let c=[];return c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:i,isSigner:!0,isWritable:!0}),c.push({pubkey:s,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:c,programId:e,data:a})}}re.schema={struct:{tag:"u8"}};const ne=new t.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),oe=n.Buffer.from("tokenized_name"),ie=e=>{const[r]=t.PublicKey.findProgramAddressSync([oe,e.toBuffer()],ne);return r};var se;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(se||(se={}));class ae{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 ae(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)}}ae.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 ce=async(e,r)=>{try{const n=ie(r);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(d,{filters:o});if(1!=i.length)return;return new t.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ue=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],fe=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(ne,{filters:r})})(t,e.mint);if(1===r.length)return ae.deserialize(r[0].account.data)},he=async(t,e)=>{const r=[...ue(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(d,{filters:r})).map((t=>Et.decode(t.account.data))).map((e=>fe(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class pe{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 pe(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 pe(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 ce(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new pe(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 le(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")}pe.HEADER_LEN=96,pe.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const ye="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
|
|
11
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ge(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const we=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),be=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function me(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function ve(t){if("string"==typeof t&&(t=me(t)),!ge(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class Ee{clone(){return this._cloneInto()}}function xe(t){const e=e=>t().update(ve(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class Ae extends Ee{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=we(this.buffer)}update(t){le(this);const{view:e,buffer:r,blockLen:n}=this,o=(t=ve(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=we(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){le(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=we(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 Ie=(t,e,r)=>t&e^~t&r,Se=(t,e,r)=>t&e^t&r^e&r,Be=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]),Re=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pe=new Uint32Array(64);class ke extends Ae{constructor(){super(64,32,8,!1),this.A=0|Re[0],this.B=0|Re[1],this.C=0|Re[2],this.D=0|Re[3],this.E=0|Re[4],this.F=0|Re[5],this.G=0|Re[6],this.H=0|Re[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)Pe[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Pe[t-15],r=Pe[t-2],n=be(e,7)^be(e,18)^e>>>3,o=be(r,17)^be(r,19)^r>>>10;Pe[t]=o+Pe[t-7]+n+Pe[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+(be(s,6)^be(s,11)^be(s,25))+Ie(s,a,c)+Be[t]+Pe[t]|0,f=(be(r,2)^be(r,13)^be(r,22))+Se(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(){Pe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Te=xe((()=>new ke)),_e=new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),Ue="SPL Name Service",Le=new t.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Ce=new t.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ne=new t.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Oe=new t.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),De=new t.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Me=new t.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),We=new t.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ve=new t.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),ze=new t.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),je=[new t.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t.PublicKey("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new t.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new t.PublicKey("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new t.PublicKey("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ")],Fe=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ke=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"}]]),He=new t.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),Ge=new t.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),qe=new t.PublicKey("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),Ye=new t.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),$e=new t.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),Xe=new t.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function Ze(t,e){if(!await t.getAccountInfo(e))throw new kt(exports.ErrorType.AccountDoesNotExist);return pe.retrieve(t,e)}async function Qe(t){const e=Ue+t,r=Te(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)}async function Je(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,_e);return s}const tr=async(t,e=Le)=>{let r=await Qe(t);return{pubkey:await Je(r,void 0,e),hashed:r}},er=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 tr(r[1]);return{...await tr(t,o),isSub:!0,parent:o}}if(3===r.length&&e){const{pubkey:t}=await tr(r[2]),{pubkey:e}=await tr("\0".concat(r[1]),t),o=n.Buffer.from([1]).toString();return{...await tr(o.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...await tr(t,Le),isSub:!1,parent:void 0}};var rr,nr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],or=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}(),ir=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}(),sr=(rr=function(t,e){return rr=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])},rr(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}rr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function ar(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function cr(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 ur=nr.concat(["bool","string"]),fr=["option","enum","array","set","map","struct"],hr=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return sr(e,t),e}(Error);function pr(t){if("string"!=typeof t||!ur.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&fr.includes(e[0])){var r=e[0];if("option"===r)return pr(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new hr(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');pr({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new hr(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return pr(t.type);throw new hr(t,"{ type, len? }")}(t[r]);if("set"===r)return pr(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new hr(t,"{ key, value }");pr(t.key),pr(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new hr(t,"object");for(var e in t)pr(t[e])}(t[r])}}throw new hr(t,fr.join(", ")+" or "+ur.join(", "))}}var dr=function(){function t(t){this.encoded=new or,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(nr.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&&ar(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&&ar(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&&ar(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?cr(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?cr(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&&ar(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&&ar(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&&ar(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}(),lr=function(){function t(t){this.buffer=new ir(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(nr.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 yr(t,e,r){return void 0===r&&(r=!0),r&&pr(t),new dr(r).encode(e,t)}class gr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return yr(gr.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})}}gr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class wr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return yr(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",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class br{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return yr(br.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})}}br.schema={struct:{tag:"u8",staleness:"bool"}};class mr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return yr(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",record:"string",content:{array:{type:"u8"}}}};class vr{constructor(){this.tag=5}serialize(){return yr(vr.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})}}vr.schema={struct:{tag:"u8"}};class Er{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return yr(Er.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})}}Er.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const xr=new t.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Ar]=t.PublicKey.findProgramAddressSync([xr.toBuffer()],xr);var Ir,Sr;(Sr=Ir||(Ir={}))[Sr.None=0]="None",Sr[Sr.Solana=1]="Solana",Sr[Sr.Ethereum=2]="Ethereum",Sr[Sr.UnverifiedSolana=3]="UnverifiedSolana";const Br=t=>{switch(t){case Ir.None:return 0;case Ir.Ethereum:return 20;case Ir.Solana:case Ir.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Rr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Rr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&pr(e),new lr(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))}}Rr.LEN=8,Rr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Pr{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Rr.deserialize(t.slice(96,96+Rr.LEN)),r=t.slice(96+Rr.LEN);return new Pr(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=Br(this.header.stalenessValidation)+Br(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Br(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Br(this.header.stalenessValidation),e=t+Br(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var kr;exports.Record=void 0,(kr=exports.Record||(exports.Record={})).IPFS="IPFS",kr.ARWV="ARWV",kr.SOL="SOL",kr.ETH="ETH",kr.BTC="BTC",kr.LTC="LTC",kr.DOGE="DOGE",kr.Email="email",kr.Url="url",kr.Discord="discord",kr.Github="github",kr.Reddit="reddit",kr.Twitter="twitter",kr.Telegram="telegram",kr.Pic="pic",kr.SHDW="SHDW",kr.POINT="POINT",kr.BSC="BSC",kr.Injective="INJ",kr.Backpack="backpack",kr.A="A",kr.AAAA="AAAA",kr.CNAME="CNAME",kr.TXT="TXT",kr.Background="background";const Tr=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 _r;exports.RecordVersion=void 0,(_r=exports.RecordVersion||(exports.RecordVersion={}))[_r.V1=1]="V1",_r[_r.V2=2]="V2";var Ur="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=",Lr="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Cr=0,Nr=-3;function Or(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Dr(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Or,this.dtree=new Or}var Mr=new Or,Wr=new Or,Vr=new Uint8Array(30),zr=new Uint16Array(30),jr=new Uint8Array(30),Fr=new Uint16Array(30),Kr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hr=new Or,Gr=new Uint8Array(320);function qr(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 Yr=new Uint16Array(16);function $r(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)Yr[o]=i,i+=t.table[o];for(o=0;o<n;++o)e[r+o]&&(t.trans[Yr[e[r+o]]++]=o)}function Xr(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function Zr(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 Qr(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 Jr(t,e,r){var n,o,i,s,a,c;for(n=Zr(t,5,257),o=Zr(t,5,1),i=Zr(t,4,4),s=0;s<19;++s)Gr[s]=0;for(s=0;s<i;++s){var u=Zr(t,3,0);Gr[Kr[s]]=u}for($r(Hr,Gr,0,19),a=0;a<n+o;){var f=Qr(t,Hr);switch(f){case 16:var h=Gr[a-1];for(c=Zr(t,2,3);c;--c)Gr[a++]=h;break;case 17:for(c=Zr(t,3,3);c;--c)Gr[a++]=0;break;case 18:for(c=Zr(t,7,11);c;--c)Gr[a++]=0;break;default:Gr[a++]=f}}$r(e,Gr,0,n),$r(r,Gr,n,o)}function tn(t,e,r){for(;;){var n,o,i,s,a=Qr(t,e);if(256===a)return Cr;if(a<256)t.dest[t.destLen++]=a;else for(n=Zr(t,Vr[a-=257],zr[a]),o=Qr(t,r),s=i=t.destLen-Zr(t,jr[o],Fr[o]);s<i+n;++s)t.dest[t.destLen++]=t.dest[s]}}function en(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 Nr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Cr}!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}(Mr,Wr),qr(Vr,zr,4,3),qr(jr,Fr,2,1),Vr[28]=0,zr[28]=258;var rn=function(t,e){var r,n,o=new Dr(t,e);do{switch(r=Xr(o),Zr(o,2,0)){case 0:n=en(o);break;case 1:n=tn(o,Mr,Wr);break;case 2:Jr(o,o.ltree,o.dtree),n=tn(o,o.ltree,o.dtree);break;default:n=Nr}if(n!==Cr)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 nn=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],on=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var sn={swap32LE:t=>{nn&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)on(t,r,r+3),on(t,r+1,r+2)})(t)}};const an=rn,{swap32LE:cn}=sn;var un=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=an(t,new Uint8Array(r)),t=an(t,new Uint8Array(r)),cn(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]}},fn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,fn.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),p="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},d=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?d(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?d(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 p(Buffer.from(t,"base64"))}:function(t){return p(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))},N=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)},O=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},D=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,O(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,O(e))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},W=function(){D(),M()},V={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:N,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:M,extendBuiltins:W,Base64:{}};return Object.keys(V).forEach((function(t){return V.Base64[t]=V[t]})),V}();const hn={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},pn=Ur,dn=Lr,ln=un,yn=fn.exports.Base64,gn=new ln(yn.toUint8Array(pn)),wn=new ln(yn.toUint8Array(dn));function bn(t,e){return 0!=(t&e)}const mn=0,vn=1,En=2;function xn(t,e){const r=t.length;let n=0,o=mn;for(let i=e;i+1<r;i++){const r=t[i+0],s=t[i+1];switch(bn(r,hn.Regional_Indicator)||(n=0),o){case En:case mn:o=bn(r,hn.Extended_Pictographic)?vn:mn;break;case vn:o=bn(r,hn.Extend)?vn:bn(r,hn.ZWJ)&&bn(s,hn.Extended_Pictographic)?En:mn}if(!bn(r,hn.CR)||!bn(s,hn.LF)){if(bn(r,hn.Control|hn.CR|hn.LF))return i+1-e;if(bn(s,hn.Control|hn.CR|hn.LF))return i+1-e;if(!(bn(r,hn.L)&&bn(s,hn.L|hn.V|hn.LV|hn.LVT)||bn(r,hn.LV|hn.V)&&bn(s,hn.V|hn.T)||bn(r,hn.LVT|hn.T)&&bn(s,hn.T)||bn(s,hn.Extend|hn.ZWJ)||bn(s,hn.SpacingMark)||bn(r,hn.Prepend)||o===En)){if(!bn(r,hn.Regional_Indicator)||!bn(s,hn.Regional_Indicator)||n%2!=0)return i+1-e;n++}}}return r-e}var An=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const o=t.codePointAt(e);n.push(gn.get(o)|wn.get(o)),e+=o>65535?2:1,r.push(e)}for(let o=0;o<n.length;){const i=xn(n,o),s=r[o],a=r[o+i];e.push(t.slice(s,a)),o+=i}return e},In=r(An);const Sn=t=>{const e=Ue+t,r=Te(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)},Bn=(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,_e);return s};async function Rn(t,e){const r=Sn(e.toBase58()),n=Bn(r,De),{registry:o}=await pe.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Nn(o.data)}async function Pn(t,e){let r=[];for(let t of e){const e=Sn(t.toBase58()),n=Bn(e,De);r.push(n)}return(await pe.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Nn(t.data)}))}const kn=(t,e=Le,r)=>{let n=Sn(t);return{pubkey:Bn(n,r,e),hashed:n}},Tn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?Ar:void 0,o=t.split(".");if(2===o.length){const t=n.Buffer.from([e||0]).toString().concat(o[0]),{pubkey:i}=kn(o[1]);return{...kn(t,i,r),isSub:!0,parent:i}}if(3===o.length&&e){const{pubkey:t}=kn(o[2]),{pubkey:n}=kn("\0".concat(o[1]),t),i=e===exports.RecordVersion.V2?"":"";return{...kn(i.concat(o[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(o.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...kn(t,Le),isSub:!1,parent:void 0}};async function _n(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:Le.toBase58()}}];return(await t.getProgramAccounts(_e,{filters:r})).map((t=>t.pubkey))}const Un=(t,e)=>{const{pubkey:r,parent:n}=Tn(t),o=Sn(r.toBase58());return Bn(o,De,e?n:void 0)},Ln=(t,e)=>{const r=Sn(t.toBase58());return Bn(r,De,e)},Cn=(t,e)=>{if(!t)throw new kt(e)};function Nn(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var On=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,p=i-1;(0!==f||h<o)&&-1!==p;p--,h++)f+=s*u[p]>>>0,u[p]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,r++}for(var d=i-o;d!==i&&0===u[d];)d++;for(var l=new Uint8Array(n+(i-d)),y=n;d!==i;)l[y++]=u[d++];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],p=0,d=c-1;(0!==h||p<n)&&-1!==d;d--,p++)h+=256*f[d]>>>0,f[d]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=p,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 Dn,Mn=On("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Wn={exports:{}};Dn=Wn,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 p={};p.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 p.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),p.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")}},p.IPv4.isIPv4=function(t){return null!==this.parser(t)},p.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},p.IPv4.isValidFourPartDecimal=function(t){return!(!p.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.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")}},p.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)},p.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")},p.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},p.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)},p.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 p.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 p.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}(),p.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})`)}},p.IPv6.isIPv6=function(t){return null!==this.parser(t)},p.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}},p.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})`)}},p.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)},p.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")},p.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},p.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)},p.fromByteArray=function(t){const e=t.length;if(4===e)return new p.IPv4(t);if(16===e)return new p.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(t){return p.IPv6.isValid(t)||p.IPv4.isValid(t)},p.parse=function(t){if(p.IPv6.isValid(t))return p.IPv6.parse(t);if(p.IPv4.isValid(t))return p.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(t){try{return p.IPv6.parseCIDR(t)}catch(e){try{return p.IPv4.parseCIDR(t)}catch(t){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},p.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},Dn.exports?Dn.exports=p:t.ipaddr=p}(e);var Vn=Wn.exports;const zn=2147483647,jn=36,Fn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Kn=Math.floor,Hn=String.fromCharCode;function Gn(t){throw new RangeError(Fn[t])}const qn=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},Yn=function(t,e,r){let n=0;for(t=r?Kn(t/700):t>>1,t+=Kn(t/e);t>455;n+=jn)t=Kn(t/35);return Kn(n+36*t/(t+38))},$n=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&&Gn("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=jn;;o+=jn){c>=r&&Gn("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:jn;s>=jn&&Gn("invalid-input"),s>Kn((zn-n)/e)&&Gn("overflow"),n+=s*e;const u=o<=i?1:o>=i+26?26:o-i;if(s<u)break;const f=jn-u;e>Kn(zn/f)&&Gn("overflow"),e*=f}const u=e.length+1;i=Yn(n-s,u,0==s),Kn(n/u)>zn-o&&Gn("overflow"),o+=Kn(n/u),n%=u,e.splice(n++,0,o)}var a;return String.fromCodePoint(...e)},Xn=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(Hn(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=zn;for(const e of t)e>=n&&e<r&&(r=e);const c=a+1;r-n>Kn((zn-o)/c)&&Gn("overflow"),o+=(r-n)*c,n=r;for(const r of t)if(r<n&&++o>zn&&Gn("overflow"),r===n){let t=o;for(let r=jn;;r+=jn){const n=r<=i?1:r>=i+26?26:r-i;if(t<n)break;const o=t-n,s=jn-n;e.push(Hn(qn(n+o%s,0))),t=Kn(o/s)}e.push(Hn(qn(t,0))),i=Yn(o,c,a===s),o=0,++a}++o,++n}return e.join("")},Zn=BigInt(2**32-1),Qn=BigInt(32);function Jn(t,e=!1){return e?{h:Number(t&Zn),l:Number(t>>Qn&Zn)}:{h:0|Number(t>>Qn&Zn),l:0|Number(t&Zn)}}const to={fromBig:Jn,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}=Jn(t[o],e);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<Qn|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 eo=to;const[ro,no]=(()=>eo.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)))))(),oo=new Uint32Array(80),io=new Uint32Array(80);class so extends Ae{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:p,Gl:d,Hh:l,Hl:y}=this;return[t,e,r,n,o,i,s,a,c,u,f,h,p,d,l,y]}set(t,e,r,n,o,i,s,a,c,u,f,h,p,d,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|p,this.Gl=0|d,this.Hh=0|l,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)oo[r]=t.getUint32(e),io[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|oo[t-15],r=0|io[t-15],n=eo.rotrSH(e,r,1)^eo.rotrSH(e,r,8)^eo.shrSH(e,r,7),o=eo.rotrSL(e,r,1)^eo.rotrSL(e,r,8)^eo.shrSL(e,r,7),i=0|oo[t-2],s=0|io[t-2],a=eo.rotrSH(i,s,19)^eo.rotrBH(i,s,61)^eo.shrSH(i,s,6),c=eo.rotrSL(i,s,19)^eo.rotrBL(i,s,61)^eo.shrSL(i,s,6),u=eo.add4L(o,c,io[t-7],io[t-16]),f=eo.add4H(u,n,a,oo[t-7],oo[t-16]);oo[t]=0|f,io[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:p,Fl:d,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=eo.rotrSH(f,h,14)^eo.rotrSH(f,h,18)^eo.rotrBH(f,h,41),b=eo.rotrSL(f,h,14)^eo.rotrSL(f,h,18)^eo.rotrBL(f,h,41),m=f&p^~f&l,v=h&d^~h&y,E=eo.add5L(w,b,v,no[t],io[t]),x=eo.add5H(E,g,e,m,ro[t],oo[t]),A=0|E,I=eo.rotrSH(r,n,28)^eo.rotrBH(r,n,34)^eo.rotrBH(r,n,39),S=eo.rotrSL(r,n,28)^eo.rotrBL(r,n,34)^eo.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|p,y=0|d,p=0|f,d=0|h,({h:f,l:h}=eo.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=eo.add3L(A,S,R);r=eo.add3H(P,x,I,B),n=0|P}({h:r,l:n}=eo.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=eo.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=eo.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=eo.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:h}=eo.add(0|this.Eh,0|this.El,0|f,0|h)),({h:p,l:d}=eo.add(0|this.Fh,0|this.Fl,0|p,0|d)),({h:l,l:y}=eo.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=eo.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,h,p,d,l,y,g,w)}roundClean(){oo.fill(0),io.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 ao=xe((()=>new so));
|
|
10
|
+
!function(t){const e=o,r=p,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(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return 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||$(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 d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,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)||X(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),$(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($(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(X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),X(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(X(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(X(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 N(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 O(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||O(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||O(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 N(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 N(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 W={};function V(t,e,r){W[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function z(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 W.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 W.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw F(t,r),new W.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("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=z(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=z(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 X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(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 d=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 N 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=N;class O 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=O;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 W 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=W;class V 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=V;class z{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=z;class j extends z{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 z))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 X 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=X;class $ 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=$;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 N(t),y.f32be=t=>new O(t),y.f64=t=>new D(t),y.f64be=t=>new M(t);var et=y.struct=(t,e,r)=>new V(t,e,r);y.bits=(t,e,r)=>new G(t,e,r),y.seq=(t,e,r)=>new W(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 X(t,e);y.cstr=t=>new $(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 pt extends ht{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class dt 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=d){return function(t,e,r=d){if(!e)throw new pt;if(!e.owner.equals(r))throw new dt;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=d,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=d,s=l){return function(e,r,n,o,i,s=d,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}(),Nt=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}(),Ot=(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 Wt=Lt.concat(["bool","string"]),Vt=["option","enum","array","set","map","struct"],zt=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return Ot(e,t),e}(Error);function jt(t){if("string"!=typeof t||!Wt.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&Vt.includes(e[0])){var r=e[0];if("option"===r)return jt(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new zt(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 zt(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 zt(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 zt(t,"{ key, value }");jt(t.key),jt(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new zt(t,"object");for(var e in t)jt(t[e])}(t[r])}}throw new zt(t,Vt.join(", ")+" or "+Wt.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 Nt(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,p){const d=[n.Buffer.from(Int8Array.from([0])),new Tt(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(d),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}),p&&y.push({pubkey:p,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 Xt(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 $t(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,p){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:d,isSigner:!1,isWritable:!1},{pubkey:p,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 p=n.Buffer.from(this.serialize());let d=[];return d.push({pubkey:r,isSigner:!1,isWritable:!1}),d.push({pubkey:o,isSigner:!1,isWritable:!1}),d.push({pubkey:i,isSigner:!1,isWritable:!0}),d.push({pubkey:s,isSigner:!1,isWritable:!1}),d.push({pubkey:a,isSigner:!1,isWritable:!1}),d.push({pubkey:c,isSigner:!0,isWritable:!0}),d.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&d.push({pubkey:f,isSigner:!1,isWritable:!0}),h&&d.push({pubkey:h,isSigner:!0,isWritable:!0}),new t.TransactionInstruction({keys:d,programId:e,data:p})}}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,p,d,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:p,isSigner:!1,isWritable:!1}),v.push({pubkey:d,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,p,d,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:p,isSigner:!1,isWritable:!0}),v.push({pubkey:d,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 p=n.Buffer.from(this.serialize());let d=[];return d.push({pubkey:r,isSigner:!1,isWritable:!1}),d.push({pubkey:o,isSigner:!1,isWritable:!1}),d.push({pubkey:i,isSigner:!1,isWritable:!0}),d.push({pubkey:s,isSigner:!1,isWritable:!0}),d.push({pubkey:a,isSigner:!1,isWritable:!0}),d.push({pubkey:c,isSigner:!1,isWritable:!0}),d.push({pubkey:u,isSigner:!1,isWritable:!1}),d.push({pubkey:f,isSigner:!0,isWritable:!1}),d.push({pubkey:h,isSigner:!1,isWritable:!0}),new t.TransactionInstruction({keys:d,programId:e,data:p})}}ee.schema={struct:{tag:"u8"}};class re{constructor(){this.tag=6}serialize(){return Ht(re.schema,this)}getInstruction(e,r,o,i,s){const a=n.Buffer.from(this.serialize());let c=[];return c.push({pubkey:r,isSigner:!1,isWritable:!1}),c.push({pubkey:o,isSigner:!1,isWritable:!0}),c.push({pubkey:i,isSigner:!0,isWritable:!0}),c.push({pubkey:s,isSigner:!1,isWritable:!1}),new t.TransactionInstruction({keys:c,programId:e,data:a})}}re.schema={struct:{tag:"u8"}};const ne=new t.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),oe=n.Buffer.from("tokenized_name"),ie=e=>{const[r]=t.PublicKey.findProgramAddressSync([oe,e.toBuffer()],ne);return r};var se;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.CentralState=1]="CentralState",t[t.ActiveRecord=2]="ActiveRecord",t[t.InactiveRecord=3]="InactiveRecord"}(se||(se={}));class ae{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 ae(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)}}ae.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 ce=async(e,r)=>{try{const n=ie(r);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(d,{filters:o});if(1!=i.length)return;return new t.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ue=t=>[{memcmp:{offset:32,bytes:t}},{memcmp:{offset:64,bytes:"2"}}],fe=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(ne,{filters:r})})(t,e.mint);if(1===r.length)return ae.deserialize(r[0].account.data)},he=async(t,e)=>{const r=[...ue(e.toBase58()),{dataSize:165}],n=(await t.getProgramAccounts(d,{filters:r})).map((t=>Et.decode(t.account.data))).map((e=>fe(t,e)));return(await Promise.all(n)).filter((t=>void 0!==t))};class pe{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 pe(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 pe(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 ce(t,e)}}static async _retrieveBatch(t,e){const r=await t.getMultipleAccountsInfo(e),n=t=>{if(!t)return;const e=new pe(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 le(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")}pe.HEADER_LEN=96,pe.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const ye="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
|
|
11
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ge(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const we=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),be=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function me(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function ve(t){if("string"==typeof t&&(t=me(t)),!ge(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class Ee{clone(){return this._cloneInto()}}function xe(t){const e=e=>t().update(ve(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class Ae extends Ee{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=we(this.buffer)}update(t){le(this);const{view:e,buffer:r,blockLen:n}=this,o=(t=ve(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=we(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){le(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=we(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 Ie=(t,e,r)=>t&e^~t&r,Se=(t,e,r)=>t&e^t&r^e&r,Be=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]),Re=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pe=new Uint32Array(64);class ke extends Ae{constructor(){super(64,32,8,!1),this.A=0|Re[0],this.B=0|Re[1],this.C=0|Re[2],this.D=0|Re[3],this.E=0|Re[4],this.F=0|Re[5],this.G=0|Re[6],this.H=0|Re[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)Pe[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Pe[t-15],r=Pe[t-2],n=be(e,7)^be(e,18)^e>>>3,o=be(r,17)^be(r,19)^r>>>10;Pe[t]=o+Pe[t-7]+n+Pe[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+(be(s,6)^be(s,11)^be(s,25))+Ie(s,a,c)+Be[t]+Pe[t]|0,f=(be(r,2)^be(r,13)^be(r,22))+Se(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(){Pe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Te=xe((()=>new ke)),_e=new t.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),Ue="SPL Name Service",Le=new t.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Ce=new t.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ne=new t.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Oe=new t.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),De=new t.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Me=new t.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),We=new t.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),Ve=new t.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),ze=new t.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),je=[new t.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new t.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new t.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new t.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new t.PublicKey("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new t.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new t.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new t.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new t.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new t.PublicKey("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new t.PublicKey("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ"),new t.PublicKey("XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL")],Fe=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ke=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"}]]),He=new t.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),Ge=new t.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),qe=new t.PublicKey("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),Ye=new t.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),Xe=new t.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),$e=new t.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");async function Ze(t,e){if(!await t.getAccountInfo(e))throw new kt(exports.ErrorType.AccountDoesNotExist);return pe.retrieve(t,e)}async function Qe(t){const e=Ue+t,r=Te(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)}async function Je(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,_e);return s}const tr=async(t,e=Le)=>{let r=await Qe(t);return{pubkey:await Je(r,void 0,e),hashed:r}},er=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 tr(r[1]);return{...await tr(t,o),isSub:!0,parent:o}}if(3===r.length&&e){const{pubkey:t}=await tr(r[2]),{pubkey:e}=await tr("\0".concat(r[1]),t),o=n.Buffer.from([1]).toString();return{...await tr(o.concat(r[0]),e),isSub:!0,parent:t,isSubRecord:!0}}if(r.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...await tr(t,Le),isSub:!1,parent:void 0}};var rr,nr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],or=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}(),ir=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}(),sr=(rr=function(t,e){return rr=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])},rr(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}rr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function ar(t,e,r){if(typeof t!==e)throw new Error("Expected ".concat(e," not ").concat(typeof t,"(").concat(t,") at ").concat(r.join(".")))}function cr(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 ur=nr.concat(["bool","string"]),fr=["option","enum","array","set","map","struct"],hr=function(t){function e(e,r){var n="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(r);return t.call(this,n)||this}return sr(e,t),e}(Error);function pr(t){if("string"!=typeof t||!ur.includes(t)){if(t&&"object"==typeof t){var e=Object.keys(t);if(1===e.length&&fr.includes(e[0])){var r=e[0];if("option"===r)return pr(t[r]);if("enum"===r)return function(t){if(!Array.isArray(t))throw new hr(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');pr({struct:n.struct})}}(t[r]);if("array"===r)return function(t){if("object"!=typeof t)throw new hr(t,"{ type, len? }");if(t.len&&"number"!=typeof t.len)throw new Error("Invalid schema: ".concat(t));if("type"in t)return pr(t.type);throw new hr(t,"{ type, len? }")}(t[r]);if("set"===r)return pr(t[r]);if("map"===r)return function(t){if("object"!=typeof t||!("key"in t)||!("value"in t))throw new hr(t,"{ key, value }");pr(t.key),pr(t.value)}(t[r]);if("struct"===r)return function(t){if("object"!=typeof t)throw new hr(t,"object");for(var e in t)pr(t[e])}(t[r])}}throw new hr(t,fr.join(", ")+" or "+ur.join(", "))}}var dr=function(){function t(t){this.encoded=new or,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(nr.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&&ar(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&&ar(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&&ar(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?cr(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?cr(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&&ar(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&&ar(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&&ar(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}(),lr=function(){function t(t){this.buffer=new ir(t)}return t.prototype.decode=function(t){return this.decode_value(t)},t.prototype.decode_value=function(t){if("string"==typeof t){if(nr.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 yr(t,e,r){return void 0===r&&(r=!0),r&&pr(t),new dr(r).encode(e,t)}class gr{constructor(t){this.tag=1,this.record=t.record,this.content=t.content}serialize(){return yr(gr.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})}}gr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class wr{constructor(t){this.tag=4,this.validation=t.validation,this.signature=t.signature,this.expectedPubkey=t.expectedPubkey}serialize(){return yr(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",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class br{constructor(t){this.tag=3,this.staleness=t.staleness}serialize(){return yr(br.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})}}br.schema={struct:{tag:"u8",staleness:"bool"}};class mr{constructor(t){this.tag=2,this.record=t.record,this.content=t.content}serialize(){return yr(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",record:"string",content:{array:{type:"u8"}}}};class vr{constructor(){this.tag=5}serialize(){return yr(vr.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})}}vr.schema={struct:{tag:"u8"}};class Er{constructor(t){this.tag=6,this.roaId=t.roaId}serialize(){return yr(Er.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})}}Er.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const xr=new t.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Ar]=t.PublicKey.findProgramAddressSync([xr.toBuffer()],xr);var Ir,Sr;(Sr=Ir||(Ir={}))[Sr.None=0]="None",Sr[Sr.Solana=1]="Solana",Sr[Sr.Ethereum=2]="Ethereum",Sr[Sr.UnverifiedSolana=3]="UnverifiedSolana";const Br=t=>{switch(t){case Ir.None:return 0;case Ir.Ethereum:return 20;case Ir.Solana:case Ir.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Rr{constructor(t){this.stalenessValidation=t.stalenessValidation,this.rightOfAssociationValidation=t.rightOfAssociationValidation,this.contentLength=t.contentLength}static deserialize(t){return new Rr((e=this.schema,r=t,void 0===(n=!0)&&(n=!0),n&&pr(e),new lr(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))}}Rr.LEN=8,Rr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class Pr{constructor(t,e){this.data=e,this.header=t}static deserialize(t){const e=Rr.deserialize(t.slice(96,96+Rr.LEN)),r=t.slice(96+Rr.LEN);return new Pr(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=Br(this.header.stalenessValidation)+Br(this.header.rightOfAssociationValidation);return this.data.slice(t)}getStalenessId(){let t=Br(this.header.stalenessValidation);return this.data.slice(0,t)}getRoAId(){let t=Br(this.header.stalenessValidation),e=t+Br(this.header.rightOfAssociationValidation);return this.data.slice(t,e)}}var kr;exports.Record=void 0,(kr=exports.Record||(exports.Record={})).IPFS="IPFS",kr.ARWV="ARWV",kr.SOL="SOL",kr.ETH="ETH",kr.BTC="BTC",kr.LTC="LTC",kr.DOGE="DOGE",kr.Email="email",kr.Url="url",kr.Discord="discord",kr.Github="github",kr.Reddit="reddit",kr.Twitter="twitter",kr.Telegram="telegram",kr.Pic="pic",kr.SHDW="SHDW",kr.POINT="POINT",kr.BSC="BSC",kr.Injective="INJ",kr.Backpack="backpack",kr.A="A",kr.AAAA="AAAA",kr.CNAME="CNAME",kr.TXT="TXT",kr.Background="background";const Tr=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 _r;exports.RecordVersion=void 0,(_r=exports.RecordVersion||(exports.RecordVersion={}))[_r.V1=1]="V1",_r[_r.V2=2]="V2";var Ur="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=",Lr="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Cr=0,Nr=-3;function Or(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Dr(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new Or,this.dtree=new Or}var Mr=new Or,Wr=new Or,Vr=new Uint8Array(30),zr=new Uint16Array(30),jr=new Uint8Array(30),Fr=new Uint16Array(30),Kr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hr=new Or,Gr=new Uint8Array(320);function qr(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 Yr=new Uint16Array(16);function Xr(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)Yr[o]=i,i+=t.table[o];for(o=0;o<n;++o)e[r+o]&&(t.trans[Yr[e[r+o]]++]=o)}function $r(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function Zr(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 Qr(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 Jr(t,e,r){var n,o,i,s,a,c;for(n=Zr(t,5,257),o=Zr(t,5,1),i=Zr(t,4,4),s=0;s<19;++s)Gr[s]=0;for(s=0;s<i;++s){var u=Zr(t,3,0);Gr[Kr[s]]=u}for(Xr(Hr,Gr,0,19),a=0;a<n+o;){var f=Qr(t,Hr);switch(f){case 16:var h=Gr[a-1];for(c=Zr(t,2,3);c;--c)Gr[a++]=h;break;case 17:for(c=Zr(t,3,3);c;--c)Gr[a++]=0;break;case 18:for(c=Zr(t,7,11);c;--c)Gr[a++]=0;break;default:Gr[a++]=f}}Xr(e,Gr,0,n),Xr(r,Gr,n,o)}function tn(t,e,r){for(;;){var n,o,i,s,a=Qr(t,e);if(256===a)return Cr;if(a<256)t.dest[t.destLen++]=a;else for(n=Zr(t,Vr[a-=257],zr[a]),o=Qr(t,r),s=i=t.destLen-Zr(t,jr[o],Fr[o]);s<i+n;++s)t.dest[t.destLen++]=t.dest[s]}}function en(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 Nr;for(t.sourceIndex+=4,r=e;r;--r)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,Cr}!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}(Mr,Wr),qr(Vr,zr,4,3),qr(jr,Fr,2,1),Vr[28]=0,zr[28]=258;var rn=function(t,e){var r,n,o=new Dr(t,e);do{switch(r=$r(o),Zr(o,2,0)){case 0:n=en(o);break;case 1:n=tn(o,Mr,Wr);break;case 2:Jr(o,o.ltree,o.dtree),n=tn(o,o.ltree,o.dtree);break;default:n=Nr}if(n!==Cr)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 nn=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],on=(t,e,r)=>{let n=t[e];t[e]=t[r],t[r]=n};var sn={swap32LE:t=>{nn&&(t=>{const e=t.length;for(let r=0;r<e;r+=4)on(t,r,r+3),on(t,r+1,r+2)})(t)}};const an=rn,{swap32LE:cn}=sn;var un=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=an(t,new Uint8Array(r)),t=an(t,new Uint8Array(r)),cn(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]}},fn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,fn.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),p="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},d=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?d(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?d(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 p(Buffer.from(t,"base64"))}:function(t){return p(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))},N=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)},O=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},D=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,O(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,O(e))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))},W=function(){D(),M()},V={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:N,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:M,extendBuiltins:W,Base64:{}};return Object.keys(V).forEach((function(t){return V.Base64[t]=V[t]})),V}();const hn={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},pn=Ur,dn=Lr,ln=un,yn=fn.exports.Base64,gn=new ln(yn.toUint8Array(pn)),wn=new ln(yn.toUint8Array(dn));function bn(t,e){return 0!=(t&e)}const mn=0,vn=1,En=2;function xn(t,e){const r=t.length;let n=0,o=mn;for(let i=e;i+1<r;i++){const r=t[i+0],s=t[i+1];switch(bn(r,hn.Regional_Indicator)||(n=0),o){case En:case mn:o=bn(r,hn.Extended_Pictographic)?vn:mn;break;case vn:o=bn(r,hn.Extend)?vn:bn(r,hn.ZWJ)&&bn(s,hn.Extended_Pictographic)?En:mn}if(!bn(r,hn.CR)||!bn(s,hn.LF)){if(bn(r,hn.Control|hn.CR|hn.LF))return i+1-e;if(bn(s,hn.Control|hn.CR|hn.LF))return i+1-e;if(!(bn(r,hn.L)&&bn(s,hn.L|hn.V|hn.LV|hn.LVT)||bn(r,hn.LV|hn.V)&&bn(s,hn.V|hn.T)||bn(r,hn.LVT|hn.T)&&bn(s,hn.T)||bn(s,hn.Extend|hn.ZWJ)||bn(s,hn.SpacingMark)||bn(r,hn.Prepend)||o===En)){if(!bn(r,hn.Regional_Indicator)||!bn(s,hn.Regional_Indicator)||n%2!=0)return i+1-e;n++}}}return r-e}var An=function(t){const e=[],r=[0],n=[];for(let e=0;e<t.length;){const o=t.codePointAt(e);n.push(gn.get(o)|wn.get(o)),e+=o>65535?2:1,r.push(e)}for(let o=0;o<n.length;){const i=xn(n,o),s=r[o],a=r[o+i];e.push(t.slice(s,a)),o+=i}return e},In=r(An);const Sn=t=>{const e=Ue+t,r=Te(n.Buffer.from(e,"utf8"));return n.Buffer.from(r)},Bn=(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,_e);return s};async function Rn(t,e){const r=Sn(e.toBase58()),n=Bn(r,De),{registry:o}=await pe.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Nn(o.data)}async function Pn(t,e){let r=[];for(let t of e){const e=Sn(t.toBase58()),n=Bn(e,De);r.push(n)}return(await pe.retrieveBatch(t,r)).map((t=>{if(void 0!==t&&void 0!==t.data)return Nn(t.data)}))}const kn=(t,e=Le,r)=>{let n=Sn(t);return{pubkey:Bn(n,r,e),hashed:n}},Tn=(t,e)=>{t.endsWith(".sol")&&(t=t.slice(0,-4));const r=e===exports.RecordVersion.V2?Ar:void 0,o=t.split(".");if(2===o.length){const t=n.Buffer.from([e||0]).toString().concat(o[0]),{pubkey:i}=kn(o[1]);return{...kn(t,i,r),isSub:!0,parent:i}}if(3===o.length&&e){const{pubkey:t}=kn(o[2]),{pubkey:n}=kn("\0".concat(o[1]),t),i=e===exports.RecordVersion.V2?"":"";return{...kn(i.concat(o[0]),n,r),isSub:!0,parent:t,isSubRecord:!0}}if(o.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...kn(t,Le),isSub:!1,parent:void 0}};async function _n(t,e){const r=[{memcmp:{offset:32,bytes:e.toBase58()}},{memcmp:{offset:0,bytes:Le.toBase58()}}];return(await t.getProgramAccounts(_e,{filters:r})).map((t=>t.pubkey))}const Un=(t,e)=>{const{pubkey:r,parent:n}=Tn(t),o=Sn(r.toBase58());return Bn(o,De,e?n:void 0)},Ln=(t,e)=>{const r=Sn(t.toBase58());return Bn(r,De,e)},Cn=(t,e)=>{if(!t)throw new kt(e)};function Nn(t){if(!t)return;const e=t.slice(0,4).readUInt32LE(0);return t.slice(4,4+e).toString()}var On=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,p=i-1;(0!==f||h<o)&&-1!==p;p--,h++)f+=s*u[p]>>>0,u[p]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,r++}for(var d=i-o;d!==i&&0===u[d];)d++;for(var l=new Uint8Array(n+(i-d)),y=n;d!==i;)l[y++]=u[d++];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],p=0,d=c-1;(0!==h||p<n)&&-1!==d;d--,p++)h+=256*f[d]>>>0,f[d]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=p,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 Dn,Mn=On("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Wn={exports:{}};Dn=Wn,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 p={};p.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 p.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),p.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")}},p.IPv4.isIPv4=function(t){return null!==this.parser(t)},p.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},p.IPv4.isValidFourPartDecimal=function(t){return!(!p.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.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")}},p.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)},p.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")},p.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},p.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)},p.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 p.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 p.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}(),p.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})`)}},p.IPv6.isIPv6=function(t){return null!==this.parser(t)},p.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}},p.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})`)}},p.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)},p.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")},p.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},p.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)},p.fromByteArray=function(t){const e=t.length;if(4===e)return new p.IPv4(t);if(16===e)return new p.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(t){return p.IPv6.isValid(t)||p.IPv4.isValid(t)},p.parse=function(t){if(p.IPv6.isValid(t))return p.IPv6.parse(t);if(p.IPv4.isValid(t))return p.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(t){try{return p.IPv6.parseCIDR(t)}catch(e){try{return p.IPv4.parseCIDR(t)}catch(t){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},p.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},Dn.exports?Dn.exports=p:t.ipaddr=p}(e);var Vn=Wn.exports;const zn=2147483647,jn=36,Fn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Kn=Math.floor,Hn=String.fromCharCode;function Gn(t){throw new RangeError(Fn[t])}const qn=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},Yn=function(t,e,r){let n=0;for(t=r?Kn(t/700):t>>1,t+=Kn(t/e);t>455;n+=jn)t=Kn(t/35);return Kn(n+36*t/(t+38))},Xn=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&&Gn("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=jn;;o+=jn){c>=r&&Gn("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:jn;s>=jn&&Gn("invalid-input"),s>Kn((zn-n)/e)&&Gn("overflow"),n+=s*e;const u=o<=i?1:o>=i+26?26:o-i;if(s<u)break;const f=jn-u;e>Kn(zn/f)&&Gn("overflow"),e*=f}const u=e.length+1;i=Yn(n-s,u,0==s),Kn(n/u)>zn-o&&Gn("overflow"),o+=Kn(n/u),n%=u,e.splice(n++,0,o)}var a;return String.fromCodePoint(...e)},$n=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(Hn(r));const s=e.length;let a=s;for(s&&e.push("-");a<r;){let r=zn;for(const e of t)e>=n&&e<r&&(r=e);const c=a+1;r-n>Kn((zn-o)/c)&&Gn("overflow"),o+=(r-n)*c,n=r;for(const r of t)if(r<n&&++o>zn&&Gn("overflow"),r===n){let t=o;for(let r=jn;;r+=jn){const n=r<=i?1:r>=i+26?26:r-i;if(t<n)break;const o=t-n,s=jn-n;e.push(Hn(qn(n+o%s,0))),t=Kn(o/s)}e.push(Hn(qn(t,0))),i=Yn(o,c,a===s),o=0,++a}++o,++n}return e.join("")},Zn=BigInt(2**32-1),Qn=BigInt(32);function Jn(t,e=!1){return e?{h:Number(t&Zn),l:Number(t>>Qn&Zn)}:{h:0|Number(t>>Qn&Zn),l:0|Number(t&Zn)}}const to={fromBig:Jn,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}=Jn(t[o],e);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<Qn|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 eo=to;const[ro,no]=(()=>eo.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)))))(),oo=new Uint32Array(80),io=new Uint32Array(80);class so extends Ae{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:p,Gl:d,Hh:l,Hl:y}=this;return[t,e,r,n,o,i,s,a,c,u,f,h,p,d,l,y]}set(t,e,r,n,o,i,s,a,c,u,f,h,p,d,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|p,this.Gl=0|d,this.Hh=0|l,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)oo[r]=t.getUint32(e),io[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|oo[t-15],r=0|io[t-15],n=eo.rotrSH(e,r,1)^eo.rotrSH(e,r,8)^eo.shrSH(e,r,7),o=eo.rotrSL(e,r,1)^eo.rotrSL(e,r,8)^eo.shrSL(e,r,7),i=0|oo[t-2],s=0|io[t-2],a=eo.rotrSH(i,s,19)^eo.rotrBH(i,s,61)^eo.shrSH(i,s,6),c=eo.rotrSL(i,s,19)^eo.rotrBL(i,s,61)^eo.shrSL(i,s,6),u=eo.add4L(o,c,io[t-7],io[t-16]),f=eo.add4H(u,n,a,oo[t-7],oo[t-16]);oo[t]=0|f,io[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:p,Fl:d,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let t=0;t<80;t++){const e=eo.rotrSH(f,h,14)^eo.rotrSH(f,h,18)^eo.rotrBH(f,h,41),b=eo.rotrSL(f,h,14)^eo.rotrSL(f,h,18)^eo.rotrBL(f,h,41),m=f&p^~f&l,v=h&d^~h&y,E=eo.add5L(w,b,v,no[t],io[t]),x=eo.add5H(E,g,e,m,ro[t],oo[t]),A=0|E,I=eo.rotrSH(r,n,28)^eo.rotrBH(r,n,34)^eo.rotrBH(r,n,39),S=eo.rotrSL(r,n,28)^eo.rotrBL(r,n,34)^eo.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|p,y=0|d,p=0|f,d=0|h,({h:f,l:h}=eo.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=eo.add3L(A,S,R);r=eo.add3H(P,x,I,B),n=0|P}({h:r,l:n}=eo.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=eo.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=eo.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=eo.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:h}=eo.add(0|this.Eh,0|this.El,0|f,0|h)),({h:p,l:d}=eo.add(0|this.Fh,0|this.Fl,0|p,0|d)),({h:l,l:y}=eo.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=eo.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,h,p,d,l,y,g,w)}roundClean(){oo.fill(0),io.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 ao=xe((()=>new so));
|
|
12
12
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const co=BigInt(1),uo=BigInt(2);function fo(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const ho=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function po(t){if(!fo(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=ho[t[r]];return e}function lo(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const yo={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function go(t){return t>=yo._0&&t<=yo._9?t-yo._0:t>=yo._A&&t<=yo._F?t-(yo._A-10):t>=yo._a&&t<=yo._f?t-(yo._a-10):void 0}function wo(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=go(t.charCodeAt(o)),i=go(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 bo(t){if(!fo(t))throw new Error("Uint8Array expected");return lo(po(Uint8Array.from(t).reverse()))}function mo(t,e){return wo(t.toString(16).padStart(2*e,"0"))}function vo(t,e){return mo(t,e).reverse()}function Eo(t,e,r){let n;if("string"==typeof e)try{n=wo(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!fo(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 xo(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];if(!fo(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 Ao=t=>(uo<<BigInt(t-1))-co,Io={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||fo(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 So(t,e,r={}){const n=(e,r,n)=>{const o=Io[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
13
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bo=BigInt(0),Ro=BigInt(1),Po=BigInt(2),ko=BigInt(3),To=BigInt(4),_o=BigInt(5),Uo=BigInt(8);function Lo(t,e){const r=t%e;return r>=Bo?r:e+r}function Co(t,e,r){if(r<=Bo||e<Bo)throw new Error("Expected power/modulo > 0");if(r===Ro)return Bo;let n=Ro;for(;e>Bo;)e&Ro&&(n=n*t%r),t=t*t%r,e>>=Ro;return n}function No(t,e,r){let n=t;for(;e-- >Bo;)n*=n,n%=r;return n}function Oo(t,e){if(t===Bo||e<=Bo)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Lo(t,e),n=e,o=Bo,i=Ro;for(;r!==Bo;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==Ro)throw new Error("invert: does not exist");return Lo(o,e)}function Do(t){if(t%To===ko){const e=(t+Ro)/To;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%Uo===_o){const e=(t-_o)/Uo;return function(t,r){const n=t.mul(r,Po),o=t.pow(n,e),i=t.mul(r,o),s=t.mul(t.mul(i,Po),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-Ro)/Po;let r,n,o;for(r=t-Ro,n=0;r%Po===Bo;r/=Po,n++);for(o=Po;o<t&&Co(o,e,t)!==t-Ro;o++);if(1===n){const e=(t+Ro)/To;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+Ro)/Po;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,Ro<<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 Mo=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Wo(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
15
|
const Vo=BigInt(0),zo=BigInt(1);function jo(t){return So(t.Fp,Mo.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),So(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Wo(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
|
|
16
16
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fo=BigInt(0),Ko=BigInt(1),Ho=BigInt(2),Go=BigInt(8),qo={zip215:!0};function Yo(t){const e=function(t){const e=jo(t);return So(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=Ho<<BigInt(8*a)-Ko,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:Fo}}}),p=e.adjustScalarBytes||(t=>t),d=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&&Fo<t,y=(t,e)=>l(t)&&l(e)&&t<e,g=t=>t===Fo||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===Fo?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,Ko,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),p=f(a*t);if(f(u*f(p+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(Ho*f(o*o)),c=f(t*i),u=r+n,h=f(f(u*u)-i-s),p=c+s,d=p-a,l=c-s,y=f(h*d),g=f(p*l),w=f(h*l),b=f(d*p);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:p}=t;if(r===BigInt(-1)){const t=f((i-o)*(u+c)),e=f((i+o)*(u-c)),r=f(e-t);if(r===Fo)return this.double();const n=f(s*Ho*p),d=f(a*Ho*h),l=d+n,y=e+t,g=d-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 d=f(o*c),l=f(i*u),y=f(a*n*p),g=f(s*h),w=f((o+i)*(c+u)-d-l),b=g-y,m=g+y,x=f(l-r*d),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===Fo?A:this.equals(A)||e===Ko?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?Go:r.inv(o));const s=f(e*t),a=f(n*t),c=f(o*t);if(i)return{x:Fo,y:Ko};if(c!==Ko)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:t}=e;return t===Ko?this:this.multiplyUnsafe(t)}static fromHex(t,n=!1){const{d:o,a:i}=e,s=r.BYTES,a=(t=Eo("pointHex",t,s)).slice(),c=t[s-1];a[s-1]=-129&c;const p=bo(a);p===Fo||w(p,n?u:r.ORDER);const d=f(p*p),l=f(d-Ko),y=f(o*d-i);let{isValid:g,value:b}=h(l,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&Ko)===Ko,v=0!=(128&c);if(!n&&b===Fo&&v)throw new Error("Point.fromHex: x=0 and x_0=1");return v!==m&&(b=f(-b)),E.fromAffine({x:b,y:p})}static fromPrivateKey(t){return R(t).point}toRawBytes(){const{x:t,y:e}=this.toAffine(),n=vo(e,r.BYTES);return n[n.length-1]|=t&Ko?128:0,n}toHex(){return po(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Ko,f(e.Gx*e.Gy)),E.ZERO=new E(Fo,Ko,Ko,Fo);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>Vo;)r&zo&&(n=n.add(o)),o=o.double(),r>>=zo;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,p=BigInt(e);for(let t=0;t<s;t++){const e=t*a;let n=Number(i&f);i>>=p,n>a&&(n-=h,i+=zo);const s=e,d=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[d]))}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 Lo(t,n)}function B(t){return S(bo(t))}function R(t){const e=a;t=Eo("private key",t,e);const r=Eo("hashed private key",i(t),2*e),n=p(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=xo(...e);return B(i(d(r,Eo("context",t),!!o)))}const k=qo;x._setWindowSize(8);return{CURVE:e,getPublicKey:function(t){return R(t).pointBytes},sign:function(t,e,n={}){t=Eo("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),Eo("result",xo(f,vo(h,r.BYTES)),2*a)},verify:function(t,e,n,i=k){const{context:s,zip215:a}=i,c=r.BYTES;t=Eo("signature",t,2*c),e=Eo("message",e),o&&(e=o(e));const u=bo(t.slice(c,2*c));let f,h,p;try{f=E.fromHex(n,a),h=E.fromHex(t.slice(0,c),a),p=x.multiplyUnsafe(u)}catch(t){return!1}if(!a&&f.isSmallOrder())return!1;const d=P(s,h.toRawBytes(),f.toRawBytes(),e);return h.add(f.multiplyUnsafe(d)).subtract(p).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
|
|
17
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),$o=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Zo=BigInt(1),Qo=BigInt(2),Jo=BigInt(5),ti=BigInt(10),ei=BigInt(20),ri=BigInt(40),ni=BigInt(80);const oi=function(t,e,r=!1,n={}){if(t<=Bo)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:o,nByteLength:i}=Wo(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Do(t),a=Object.freeze({ORDER:t,BITS:o,BYTES:i,MASK:Ao(o),ZERO:Bo,ONE:Ro,create:e=>Lo(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Bo<=e&&e<t},is0:t=>t===Bo,isOdd:t=>(t&Ro)===Ro,neg:e=>Lo(-e,t),eql:(t,e)=>t===e,sqr:e=>Lo(e*e,t),add:(e,r)=>Lo(e+r,t),sub:(e,r)=>Lo(e-r,t),mul:(e,r)=>Lo(e*r,t),pow:(t,e)=>function(t,e,r){if(r<Bo)throw new Error("Expected power > 0");if(r===Bo)return t.ONE;if(r===Ro)return e;let n=t.ONE,o=e;for(;r>Bo;)r&Ro&&(n=t.mul(n,o)),o=t.sqr(o),r>>=Ro;return n}(a,t,e),div:(e,r)=>Lo(e*Oo(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Oo(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?vo(t,i):mo(t,i),fromBytes:t=>{if(t.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${t.length}`);return r?bo(t):function(t){return lo(po(t))}(t)}});return Object.freeze(a)}(Xo,void 0,!0),ii={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:oi,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ao,randomBytes:function(t=32){if(ye&&"function"==typeof ye.getRandomValues)return ye.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=Xo,n=Lo(e*e*e,r),o=function(t){const e=Xo,r=t*t%e*t%e,n=No(r,Qo,e)*r%e,o=No(n,Zo,e)*t%e,i=No(o,Jo,e)*o%e,s=No(i,ti,e)*i%e,a=No(s,ei,e)*s%e,c=No(a,ri,e)*a%e,u=No(c,ni,e)*c%e,f=No(u,ni,e)*c%e,h=No(f,ti,e)*i%e;return{pow_p_5_8:No(h,Qo,e)*t%e,b2:r}}(t*Lo(n*n*e,r)).pow_p_5_8;let i=Lo(t*n*o,r);const s=Lo(e*i*i,r),a=i,c=Lo(i*$o,r),u=s===t,f=s===Lo(-t,r),h=s===Lo(-t*$o,r);return u&&(i=a),(f||h)&&(i=c),(Lo(i,r)&Ro)===Ro&&(i=Lo(-i,r)),{isValid:u||f,value:i}}},si=Yo(ii);const ai=(oi.ORDER+BigInt(3))/BigInt(8);
|
|
18
18
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
19
|
-
function ci(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function ui(...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 fi(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(ci(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 hi(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 pi(t,e="="){if(ci(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 di(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}oi.pow(Qo,ai),oi.sqrt(oi.neg(oi.ONE)),oi.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)}(oi,oi.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const li=(t,e)=>e?li(e,t%e):t,yi=(t,e)=>t+(e-li(t,e));function gi(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(yi(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${yi(e,r)}`);let o=0,i=0;const s=2**r-1,a=[];for(const n of t){if(ci(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 wi(t,e=!1){if(ci(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(yi(8,t)>32||yi(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 gi(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(gi(r,t,8,e))}}}function bi(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}wi(4),fi("0123456789ABCDEF"),hi(""),wi(5),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),pi(5),hi(""),wi(5),fi("0123456789ABCDEFGHIJKLMNOPQRSTUV"),pi(5),hi(""),wi(5),fi("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),hi(""),di((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),wi(6),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),pi(6),hi(""),wi(6),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),pi(6),hi(""),wi(6),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),hi("");const mi=ui(fi("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),hi("")),vi=[996825010,642813549,513874426,1027748829,705979059];function Ei(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<vi.length;t++)1==(e>>t&1)&&(r^=vi[t]);return r}function xi(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=Ei(o)^r>>5}o=Ei(o);for(let e=0;e<n;e++)o=Ei(o)^31&t.charCodeAt(e);for(let t of e)o=Ei(o)^t;for(let t=0;t<6;t++)o=Ei(o);return o^=r,mi.encode(gi([o%2**30],30,5,!1))}function Ai(t){const e="bech32"===t?1:734539939,r=wi(5),n=r.decode,o=r.encode,i=bi(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=mi.decode(s).slice(0,-6),c=xi(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=xi(i,r,e);return`${i}1${mi.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:bi(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}const Ii=Ai("bech32");wi(4),fi("0123456789abcdef"),hi(""),di((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 Si=(t,e,r)=>si.verify(e,t,r.toBytes()),Bi=(t,e)=>{const{pubkey:r}=Tn(e+"."+t,exports.RecordVersion.V1);return r};async function Ri(t,e,r,n){const o=Bi(e,r);let{registry:i}=await pe.retrieve(t,o);if(!i.data)throw new kt(exports.ErrorType.NoRecordData);if(n)return ki(i,r,o);const s=Tr.get(r);return i.data=i.data.slice(0,s),i}const Pi=async(t,e)=>await Ri(t,e,exports.Record.SOL),ki=(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=Tr.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?$n(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(Si(s,i.slice(32,96),e.owner))return Mn.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=Ii.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)&&Vn.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 Ii.encode("inj",Ii.toWords(i.slice(0,s)));if(r===exports.Record.A||r===exports.Record.AAAA)return Vn.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)},Ti=(e,r)=>{if(!Tr.get(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=Xn(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 Cn("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=Ii.decodeToBytes(e);return Cn("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Cn(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Vn.parse(e).toByteArray();return Cn(4===t.length,exports.ErrorType.InvalidARecord),n.Buffer.from(t)}if(r===exports.Record.AAAA){const t=Vn.parse(e).toByteArray();return Cn(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)},_i=(t,e,r,o)=>{const i=n.Buffer.concat([t.toBuffer(),e.toBuffer()]),s=(new TextEncoder).encode(i.toString("hex")),a=Si(s,o,r);return Cn(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([t.toBuffer(),o])},Ui=new Map([[exports.Record.Url,new t.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[exports.Record.CNAME,new t.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),Li=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC]),Ci=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]),Ni=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),Oi=(e,r)=>{if(Ci.has(r)){const t=e.toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?$n(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 Ii.encode("inj",Ii.toWords(e));if(r===exports.Record.A||r===exports.Record.AAAA)return Vn.fromByteArray([...e]).toString();throw new kt(exports.ErrorType.InvalidARecord)},Di=(e,r)=>{if(Ci.has(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=Xn(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 Cn("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=Ii.decodeToBytes(e);return Cn("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Cn(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Vn.parse(e).toByteArray();return Cn(4===t.length,exports.ErrorType.InvalidARecord),Buffer.from(t)}if(r===exports.Record.AAAA){const t=Vn.parse(e).toByteArray();return Cn(16===t.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(t)}throw new kt(exports.ErrorType.InvalidARecord)},Mi=(t,e)=>{const{pubkey:r}=Tn(t),n=Sn("".concat(e));return Bn(n,Ar,r)};const Wi=new t.PublicKey("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Vi{constructor(e){this.tag=e.tag,this.nameAccount=new t.PublicKey(e.nameAccount)}static deserialize(t){return new Vi(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)}}Vi.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};async function zi(e,r,n,o,i,s,a,c){const u=Sn(r),f=Bn(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let p;if(c){const{registry:t}=await Ze(e,c);p=t.owner}return qt(_e,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,p)}async function ji(t,e,r,n,o){const i=Sn(e),s=Bn(i,n,o);let a;a=n||(await pe.retrieve(t,s)).registry.owner;return Xt(_e,s,r,a)}const Fi=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Ce.toBuffer()],Ce),a=Sn(e.toBase58()),c=Bn(a,s,o);return[[],[new Qt({name:r}).getInstruction(Ce,_e,Le,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},Ki=async(e,r,n,o,i,s)=>{Cn(n!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:a,hashed:c,parent:u}=Tn(`${n}.${r}`,exports.RecordVersion.V1),f=Ti(o,n).length,h=await e.getMinimumBalanceForRentExemption(f+pe.HEADER_LEN);return qt(_e,t.SystemProgram.programId,a,i,s,c,new _t(h),new Tt(f),void 0,u,i)},Hi=async(e,r,n,o,i,s)=>{const{pubkey:a,hashed:c,parent:u}=Tn(`${exports.Record.SOL}.${r}`,exports.RecordVersion.V1),f=_i(n,a,o,i).length,h=await e.getMinimumBalanceForRentExemption(f+pe.HEADER_LEN);return[qt(_e,t.SystemProgram.programId,a,o,s,c,new _t(h),new Tt(f),void 0,u,o)]};class Gi{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 Gi(Gt(Gi.schema,r.data.slice(pe.HEADER_LEN)))}}async function qi(e,r,o,i,s){const a=Sn(i.toString()),c=Bn(a,Me,We);let u=Ht(Gi.schema,new Gi({twitterRegistryKey:o.toBytes(),twitterHandle:r}));return[qt(_e,t.SystemProgram.programId,c,i,s,a,new _t(await e.getMinimumBalanceForRentExemption(u.length+pe.HEADER_LEN)),new Tt(u.length),Me,We,Me),Yt(_e,c,new Tt(0),n.Buffer.from(u),Me)]}var Yi;Gi.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},exports.CustomBg=void 0,(Yi=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",Yi.Rgb0x001="rgb0x00#1";const $i=async(e,r,o)=>{const i=Bi(o,exports.Record.SOL),s=await Pi(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(!Si(u,s.data.slice(32),r))throw new kt(exports.ErrorType.InvalidSignature);return new t.PublicKey(s.data.slice(0,32))},Xi=async(e,r,n)=>{try{const o=Mi(n,exports.Record.SOL),i=await Pr.retrieve(e,o),s=i.getStalenessId(),a=i.getRoAId(),c=i.getContent();if(0===s.compare(r.toBuffer())&&i.header.stalenessValidation===Ir.Solana&&0===a.compare(c)&&i.header.rightOfAssociationValidation===Ir.Solana)return new t.PublicKey(c)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},Zi=new t.PublicKey("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),Qi=new t.PublicKey("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),Ji={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")},ts=(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,Ji.NAME_PROGRAM_ID);return s},es=(t,e=Ji.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Sn(t);return{pubkey:ts(n,r,e),hashed:n}},rs=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}=es(e[1]);return{...es(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...es(t,Ji.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ns=(t,e)=>{const{pubkey:r,parent:n}=rs(t),o=Sn(r.toBase58());return ts(o,Ji.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function os(e,r,n,o,i,s,a,c){const u=await Qe(r),f=await ts(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let p;if(c){const{registry:t}=await Ze(e,c);p=t.owner}return qt(Ji.NAME_PROGRAM_ID,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,p)}const is=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Ji.REGISTER_PROGRAM_ID.toBuffer()],Ji.REGISTER_PROGRAM_ID),a=await Qe(e.toBase58()),c=ts(a,s,o);return[[],[new Qt({name:r}).getInstruction(Ji.REGISTER_PROGRAM_ID,Ji.NAME_PROGRAM_ID,Ji.ROOT_DOMAIN_ACCOUNT,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},ss={utils:{getNameAccountKeySync:ts,reverseLookup:async(t,e)=>{const r=Sn(e.toBase58()),n=ts(r,Ji.REVERSE_LOOKUP_CLASS),{registry:o}=await pe.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Nn(o.data)},_deriveSync:es,getDomainKeySync:rs,getReverseKeySync:ns},constants:Ji,bindings:{createNameRegistry:os,updateNameRegistryData:async function(t,e,r,n,o,i){const s=await Qe(e),a=ts(s,o,i);let c;return c=o||(await pe.retrieve(t,a)).registry.owner,Yt(Ji.NAME_PROGRAM_ID,a,new Tt(r),n,c)},transferNameOwnership:async function(t,e,r,n,o,i){const s=await Qe(e),a=ts(s,n,o);let c;return c=n||(await pe.retrieve(t,a)).registry.owner,$t(Ji.NAME_PROGRAM_ID,a,r,c,n,o,i)},deleteNameRegistry:async function(t,e,r,n,o){const i=await Qe(e),s=ts(i,n,o);let a;return a=n||(await pe.retrieve(t,s)).registry.owner,Xt(Ji.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(e,r,n,o,i,s=Ji.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new kt(exports.ErrorType.InvalidDomain);const[c]=t.PublicKey.findProgramAddressSync([Ji.REGISTER_PROGRAM_ID.toBuffer()],Ji.REGISTER_PROGRAM_ID),u=Sn(r),f=ts(u,void 0,Ji.ROOT_DOMAIN_ACCOUNT),h=Sn(f.toBase58()),p=ts(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Ji.REGISTER_PROGRAM_ID),y=Ji.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,Ji.VAULT_OWNER),m=ss.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(Ji.REGISTER_PROGRAM_ID,Ji.NAME_PROGRAM_ID,Ji.ROOT_DOMAIN_ACCOUNT,f,p,t.SystemProgram.programId,c,o,i,Ji.PYTH_MAPPING_ACC,new t.PublicKey(m.product),new t.PublicKey(m.price),b,d,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},createReverseName:is,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}=rs(e),c=await t.getMinimumBalanceForRentExemption(n+pe.HEADER_LEN),u=await os(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=ns(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await is(a,"\0".concat(i),r,s,r);o.push(...t)}return[[],o]},burnDomain:(e,r,n)=>{const{pubkey:o}=rs(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Ji.REGISTER_PROGRAM_ID),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Ji.REGISTER_PROGRAM_ID);return(new ee).getInstruction(Ji.REGISTER_PROGRAM_ID,Ji.NAME_PROGRAM_ID,t.SystemProgram.programId,o,ns(e),s,i,Ji.REVERSE_LOOKUP_CLASS,r,n)},transferSubdomain:async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=rs(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await pe.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await pe.retrieve(t,a)).registry.owner);return $t(Ji.NAME_PROGRAM_ID,i,r,o,void 0,c,u)}}};exports.BONFIDA_FIDA_BNB=Oe,exports.BONFIDA_USDC_BNB=Ve,exports.CUSTOM_BG_TLD=Ye,exports.ETH_ROA_RECORDS=Li,exports.FavouriteDomain=Vi,exports.GUARDIANS=Ui,exports.HASH_PREFIX=Ue,exports.METAPLEX_ID=Xe,exports.NAME_OFFERS_ID=Wi,exports.NAME_PROGRAM_ID=_e,exports.NameRegistryState=pe,exports.Numberu32=Tt,exports.Numberu64=_t,exports.PYTH_FEEDS=Ke,exports.PYTH_FIDA_PRICE_ACC=Ne,exports.PYTH_MAPPING_ACC=He,exports.RECORD_V1_SIZE=Tr,exports.REFERRERS=je,exports.REGISTER_PROGRAM_ID=Ce,exports.REVERSE_LOOKUP_CLASS=De,exports.ROOT_DOMAIN_ACCOUNT=Le,exports.ReverseTwitterRegistryState=Gi,exports.SELF_SIGNED=Ni,exports.SNSError=kt,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=Fe,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=We,exports.TWITTER_VERIFICATION_AUTHORITY=Me,exports.USDC_MINT=ze,exports.UTF8_ENCODED=Ci,exports.VAULT_OWNER=qe,exports.VAULT_OWNER_DEPRECATED=Ge,exports.WOLVES_COLLECTION_METADATA=$e,exports.burnDomain=(e,r,n)=>{const{pubkey:o}=Tn(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Ce),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Ce);return(new ee).getInstruction(Ce,_e,t.SystemProgram.programId,o,Un(e),s,i,De,r,n)},exports.burnInstruction=ee,exports.changeTwitterRegistryData=async function(t,e,r,n){const o=Sn(t),i=Bn(o,void 0,We);return[Yt(_e,i,new Tt(r),n,e)]},exports.changeVerifiedPubkey=async function(t,e,r,n,o){const i=Sn(e),s=Bn(i,void 0,We);let a=[$t(_e,s,n,r,void 0)];return a.push(await ji(t,r.toString(),o,Me,We)),a=a.concat(await qi(t,e,s,n,o)),a},exports.check=Cn,exports.checkSolRecord=Si,exports.createInstruction=qt,exports.createInstructionV3=Jt,exports.createNameRegistry=zi,exports.createRecordInstruction=Ki,exports.createRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Tn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new gr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Ar))(i,s,a,o,_e,"".concat(r),Di(n,r),xr);return u},exports.createReverseInstruction=Qt,exports.createReverseName=Fi,exports.createReverseTwitterRegistry=qi,exports.createSolRecordInstruction=Hi,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}=Tn(e),c=await t.getMinimumBalanceForRentExemption(n+pe.HEADER_LEN),u=await zi(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=Un(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Fi(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=Sn(r),a=Bn(s,void 0,We),c=await e.getMinimumBalanceForRentExemption(o+pe.HEADER_LEN);let u=[qt(_e,t.SystemProgram.programId,a,n,i,s,new _t(c),new Tt(o),void 0,We,Me)];return u=u.concat(await qi(e,r,a,n,i)),u},exports.createWithNftInstruction=te,exports.deleteInstruction=Xt,exports.deleteNameRegistry=ji,exports.deleteRecordV2=(e,r,n,o)=>{let{pubkey:i,parent:s,isSub:a}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(a&&(s=Tn(e).pubkey),!s)throw new Error("Invalid parent");const c=((e,r,n,o,i,s)=>(new vr).getInstruction(s,t.SystemProgram.programId,i,e,o,r,n,Ar))(o,s,n,i,_e,xr);return c},exports.deleteTwitterRegistry=async function(t,e){const r=Sn(t),n=Bn(r,void 0,We),o=Sn(e.toString()),i=Bn(o,Me,We);return[Xt(_e,n,e,e),Xt(_e,i,e,e)]},exports.deserializeRecord=ki,exports.deserializeRecordV2Content=Oi,exports.deserializeReverse=Nn,exports.devnet=ss,exports.ethValidateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(u&&(c=Tn(e).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c,u)=>new wr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(c)}).getInstruction(u,t.SystemProgram.programId,i,e,r,n,o,Ar))(o,a,c,n,_e,Ir.Ethereum,i,s,xr);return f},exports.findSubdomains=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:De.toBase58()}}],n=await t.getProgramAccounts(_e,{filters:r}),o=[{memcmp:{offset:0,bytes:e.toBase58()}}],i=await t.getProgramAccounts(_e,{filters:o,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Nn(t.account.data.slice(96))]))),a=[];return i.forEach((t=>{const r=Ln(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=_n,exports.getAllRegisteredDomains=async t=>{const e=[{memcmp:{offset:0,bytes:Le.toBase58()}}];return await t.getProgramAccounts(_e,{dataSlice:{offset:32,length:32},filters:e})},exports.getArtistPubkey=t=>{switch(t){case exports.CustomBg.DegenPoet1:return Zi;case exports.CustomBg.Rgb0x001:return Qi;default:throw new kt(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(t,e)=>await Ri(t,e,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(t,e)=>await Ri(t,e,exports.Record.Background,!0),exports.getBackpackRecord=async(t,e)=>await Ri(t,e,exports.Record.Backpack,!0),exports.getBscRecord=async(t,e)=>await Ri(t,e,exports.Record.BSC,!0),exports.getBtcRecord=async(t,e)=>await Ri(t,e,exports.Record.BTC,!0),exports.getCustomBgKeys=(t,e)=>{const r=Sn(e),n=Sn(t),o=Bn(n,void 0,Ye);return{domainKey:o,bgKey:Bn(r,void 0,o)}},exports.getDiscordRecord=async(t,e)=>await Ri(t,e,exports.Record.Discord,!0),exports.getDogeRecord=async(t,e)=>await Ri(t,e,exports.Record.DOGE,!0),exports.getDomainKey=er,exports.getDomainKeySync=Tn,exports.getDomainKeysWithReverses=async function(t,e){const r=await _n(t,e),n=await Pn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))},exports.getDomainMint=ie,exports.getDomainPriceFromName=t=>{switch(In(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 Ri(t,e,exports.Record.Email,!0),exports.getEthRecord=async(t,e)=>await Ri(t,e,exports.Record.ETH,!0),exports.getFavoriteDomain=async(e,r)=>{const[n]=Vi.getKeySync(Wi,new t.PublicKey(r)),o=await Vi.retrieve(e,n),i=await Rn(e,o.nameAccount),{registry:s,nftOwner:a}=await pe.retrieve(e,o.nameAccount),c=a||s.owner;return{domain:o.nameAccount,reverse:i,stale:!r.equals(c)}},exports.getGithubRecord=async(t,e)=>await Ri(t,e,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(e,r){const n=Sn(r.toString()),o=Bn(n,Me,We);let i=await Gi.retrieve(e,o);return[i.twitterHandle,new t.PublicKey(i.twitterRegistryKey)]},exports.getHashedName=Qe,exports.getHashedNameSync=Sn,exports.getInjectiveRecord=async(t,e)=>await Ri(t,e,exports.Record.Injective,!0),exports.getIpfsRecord=async(t,e)=>await Ri(t,e,exports.Record.IPFS,!0),exports.getLtcRecord=async(t,e)=>await Ri(t,e,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(e,r)=>{const n=[],o=r.map((t=>Vi.getKeySync(Wi,t)[0])),i=(await e.getMultipleAccountsInfo(o)).map((e=>(null==e?void 0:e.data)?Vi.deserialize(null==e?void 0:e.data).nameAccount:t.PublicKey.default)),s=i.map((t=>Ln(t))),a=i.map(((t,e)=>Bt(ie(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(Nn(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(Nn(null==i?void 0:i.data.slice(96)))}return n},exports.getMultipleRecordsV2=async function(t,e,r,n={}){const o=r.map((t=>Mi(e,t))),i=await Pr.retrieveBatch(t,o);return n.deserialize?i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:Oi(t.getContent(),r[e])}})):i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))},exports.getNameAccountKey=Je,exports.getNameAccountKeySync=Bn,exports.getNameOwner=Ze,exports.getPicRecord=async(t,e)=>await Ri(t,e,exports.Record.Pic,!0),exports.getPointRecord=async(t,e)=>await Ri(t,e,exports.Record.POINT,!0),exports.getRecord=Ri,exports.getRecordKeySync=Bi,exports.getRecordV2=async function(t,e,r,n={}){const o=Mi(e,r),i=await Pr.retrieve(t,o);return n.deserialize?{retrievedRecord:i,deserializedContent:Oi(i.getContent(),r)}:{retrievedRecord:i}},exports.getRecordV2Key=Mi,exports.getRecords=async function(t,e,r,n){const o=r.map((t=>Bi(e,t))),i=await pe.retrieveBatch(t,o);return n?i.map(((t,n)=>{if(t)return ki(t,r[n],Bi(e,r[n]))})):i},exports.getRedditRecord=async(t,e)=>await Ri(t,e,exports.Record.Reddit,!0),exports.getReverseKey=async(t,e)=>{const{pubkey:r,parent:n}=await er(t),o=await Qe(r.toBase58());return await Je(o,De,e?n:void 0)},exports.getReverseKeyFromDomainKey=Ln,exports.getReverseKeySync=Un,exports.getShdwRecord=async(t,e)=>await Ri(t,e,exports.Record.SHDW,!0),exports.getSolRecord=Pi,exports.getTelegramRecord=async(t,e)=>await Ri(t,e,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(t,e)=>{const r=await he(t,e),n=await Pn(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:We.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Me.toBase58()}}],o=await e.getProgramAccounts(_e,{filters:n});for(const e of o)if(e.account.data.length>pe.HEADER_LEN+32){const r=e.account.data.slice(pe.HEADER_LEN),n=new Gi(Gt(Gi.schema,r));return[n.twitterHandle,new t.PublicKey(n.twitterRegistryKey)]}throw new kt(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(t,e)=>await Ri(t,e,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(t,e){const r=Sn(e),n=Bn(r,void 0,We),{registry:o}=await pe.retrieve(t,n);return o},exports.getTwitterRegistryData=async function(e,r){const o=[{memcmp:{offset:0,bytes:We.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t.PublicKey(n.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(_e,{filters:o});if(i.length>1)throw new kt(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(pe.HEADER_LEN)},exports.getTwitterRegistryKey=async function(t){const e=Sn(t);return Bn(e,void 0,We)},exports.getUrlRecord=async(t,e)=>await Ri(t,e,exports.Record.Url,!0),exports.performReverseLookup=async function(t,e){const r=await Qe(e.toBase58()),n=await Je(r,De),{registry:o}=await pe.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 Qe(t.toBase58()),n=await Je(e,De);r.push(n)}return(await pe.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([Ce.toBuffer()],Ce),u=Sn(r),f=Bn(u,void 0,Le),h=Sn(f.toBase58()),p=Bn(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Ce),y=je.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,qe,!0),m=Ke.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(Ce,_e,Le,f,p,t.SystemProgram.programId,c,o,i,He,new t.PublicKey(m.product),new t.PublicKey(m.price),b,d,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},exports.registerFavorite=(e,r)=>{const[n]=Vi.getKeySync(Wi,r);return[(new re).getInstruction(Wi,e,n,r,t.SystemProgram.programId)]},exports.registerFavoriteInstruction=re,exports.registerWithNft=(e,r,n,o,i,s,a,c,u)=>{const[f]=t.PublicKey.findProgramAddressSync([n.toBuffer()],Ce);return new te({space:r,name:e}).getInstruction(Ce,_e,Le,n,o,t.SystemProgram.programId,De,i,s,a,c,u,$e,d,t.SYSVAR_RENT_PUBKEY,f,Xe)},exports.resolve=async(t,e)=>{const{pubkey:r}=Tn(e),{registry:n,nftOwner:o}=await pe.retrieve(t,r);if(o)return o;try{const r=await Xi(t,n.owner,e);if(void 0!==r)return r;return await $i(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},exports.resolveSolRecordV1=$i,exports.resolveSolRecordV2=Xi,exports.retrieveNftOwner=ce,exports.retrieveNfts=async e=>{const r=await e.getProgramAccounts(ne,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t.PublicKey(e.account.data.slice(66,98))))},exports.retrieveRecords=he,exports.reverseLookup=Rn,exports.reverseLookupBatch=Pn,exports.serializeRecord=Ti,exports.serializeRecordV2Content=Di,exports.serializeSolRecord=_i,exports.transferInstruction=$t,exports.transferNameOwnership=async function(t,e,r,n,o,i){const s=Sn(e),a=Bn(s,n,o);let c;return c=n||(await pe.retrieve(t,a)).registry.owner,$t(_e,a,r,c,n,o,i)},exports.transferSubdomain=async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=Tn(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await pe.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await pe.retrieve(t,a)).registry.owner);return $t(_e,i,r,o,void 0,c,u)},exports.updateInstruction=Yt,exports.updateNameRegistryData=async function(t,e,r,n,o,i){const s=Sn(e),a=Bn(s,o,i);let c;return c=o||(await pe.retrieve(t,a)).registry.owner,Yt(_e,a,new Tt(r),n,c)},exports.updateRecordInstruction=async(t,e,r,n,o,i)=>{Cn(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=Tn(`${r}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);Cn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const c=Ti(n,r);if((null==a?void 0:a.data.slice(96).length)!==c.length)return[Xt(_e,s,i,o),await Ki(t,e,r,n,o,i)];return[Yt(_e,s,new Tt(0),c,o)]},exports.updateRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Tn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new mr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Ar))(i,s,a,o,_e,"".concat(r),Di(n,r),xr);return u},exports.updateSolRecordInstruction=async(t,e,r,n,o,i)=>{const{pubkey:s}=Tn(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);if(Cn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Xt(_e,s,i,n),await Hi(t,e,r,n,o,i)];const c=_i(r,s,n,o);return[Yt(_e,s,new Tt(0),c,n)]},exports.validateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Tn(`${n}.${r}`,exports.RecordVersion.V2);if(u&&(c=Tn(r).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c)=>new br({staleness:a}).getInstruction(c,t.SystemProgram.programId,s,e,r,n,o,Ar,i))(i,a,c,o,s,_e,e,xr);return f},exports.verifyRightOfAssociation=async(t,e,r,n)=>{var o;const i=Mi(r,e),s=await Pr.retrieve(t,i),a=s.getRoAId(),c=Li.has(e)?Ir.Ethereum:Ir.Solana;if(!(n=null!=n?n:null===(o=Ui.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=Mi(n,r),{registry:i,nftOwner:s}=await pe.retrieve(e,Tn(n).pubkey),a=s||i.owner,c=await Pr.retrieve(e,o),u=c.getStalenessId();return(null==a?void 0:a.equals(new t.PublicKey(u)))&&c.header.stalenessValidation===Ir.Solana},exports.writRoaRecordV2=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Tn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a)=>new Er({roaId:Array.from(s.toBuffer())}).getInstruction(a,t.SystemProgram.programId,r,e,n,o,i,Ar))(o,_e,s,a,n,i,xr);return u};
|
|
19
|
+
function ci(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function ui(...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 fi(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(ci(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 hi(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 pi(t,e="="){if(ci(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 di(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}oi.pow(Qo,ai),oi.sqrt(oi.neg(oi.ONE)),oi.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)}(oi,oi.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const li=(t,e)=>e?li(e,t%e):t,yi=(t,e)=>t+(e-li(t,e));function gi(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(yi(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${yi(e,r)}`);let o=0,i=0;const s=2**r-1,a=[];for(const n of t){if(ci(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 wi(t,e=!1){if(ci(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(yi(8,t)>32||yi(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 gi(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(gi(r,t,8,e))}}}function bi(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}wi(4),fi("0123456789ABCDEF"),hi(""),wi(5),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),pi(5),hi(""),wi(5),fi("0123456789ABCDEFGHIJKLMNOPQRSTUV"),pi(5),hi(""),wi(5),fi("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),hi(""),di((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),wi(6),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),pi(6),hi(""),wi(6),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),pi(6),hi(""),wi(6),fi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),hi("");const mi=ui(fi("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),hi("")),vi=[996825010,642813549,513874426,1027748829,705979059];function Ei(t){const e=t>>25;let r=(33554431&t)<<5;for(let t=0;t<vi.length;t++)1==(e>>t&1)&&(r^=vi[t]);return r}function xi(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=Ei(o)^r>>5}o=Ei(o);for(let e=0;e<n;e++)o=Ei(o)^31&t.charCodeAt(e);for(let t of e)o=Ei(o)^t;for(let t=0;t<6;t++)o=Ei(o);return o^=r,mi.encode(gi([o%2**30],30,5,!1))}function Ai(t){const e="bech32"===t?1:734539939,r=wi(5),n=r.decode,o=r.encode,i=bi(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=mi.decode(s).slice(0,-6),c=xi(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=xi(i,r,e);return`${i}1${mi.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:bi(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}const Ii=Ai("bech32");wi(4),fi("0123456789abcdef"),hi(""),di((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 Si=(t,e,r)=>si.verify(e,t,r.toBytes()),Bi=(t,e)=>{const{pubkey:r}=Tn(e+"."+t,exports.RecordVersion.V1);return r};async function Ri(t,e,r,n){const o=Bi(e,r);let{registry:i}=await pe.retrieve(t,o);if(!i.data)throw new kt(exports.ErrorType.NoRecordData);if(n)return ki(i,r,o);const s=Tr.get(r);return i.data=i.data.slice(0,s),i}const Pi=async(t,e)=>await Ri(t,e,exports.Record.SOL),ki=(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=Tr.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?Xn(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(Si(s,i.slice(32,96),e.owner))return Mn.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=Ii.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)&&Vn.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 Ii.encode("inj",Ii.toWords(i.slice(0,s)));if(r===exports.Record.A||r===exports.Record.AAAA)return Vn.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)},Ti=(e,r)=>{if(!Tr.get(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=$n(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 Cn("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=Ii.decodeToBytes(e);return Cn("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Cn(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Vn.parse(e).toByteArray();return Cn(4===t.length,exports.ErrorType.InvalidARecord),n.Buffer.from(t)}if(r===exports.Record.AAAA){const t=Vn.parse(e).toByteArray();return Cn(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)},_i=(t,e,r,o)=>{const i=n.Buffer.concat([t.toBuffer(),e.toBuffer()]),s=(new TextEncoder).encode(i.toString("hex")),a=Si(s,o,r);return Cn(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([t.toBuffer(),o])},Ui=new Map([[exports.Record.Url,new t.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[exports.Record.CNAME,new t.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),Li=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC]),Ci=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]),Ni=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),Oi=(e,r)=>{if(Ci.has(r)){const t=e.toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?Xn(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 Ii.encode("inj",Ii.toWords(e));if(r===exports.Record.A||r===exports.Record.AAAA)return Vn.fromByteArray([...e]).toString();throw new kt(exports.ErrorType.InvalidARecord)},Di=(e,r)=>{if(Ci.has(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(e=$n(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 Cn("0x"===e.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(e.slice(2),"hex");if(r===exports.Record.Injective){const t=Ii.decodeToBytes(e);return Cn("inj"===t.prefix,exports.ErrorType.InvalidInjectiveAddress),Cn(20===t.bytes.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(t.bytes)}if(r===exports.Record.A){const t=Vn.parse(e).toByteArray();return Cn(4===t.length,exports.ErrorType.InvalidARecord),Buffer.from(t)}if(r===exports.Record.AAAA){const t=Vn.parse(e).toByteArray();return Cn(16===t.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(t)}throw new kt(exports.ErrorType.InvalidARecord)},Mi=(t,e)=>{const{pubkey:r}=Tn(t),n=Sn("".concat(e));return Bn(n,Ar,r)};const Wi=new t.PublicKey("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Vi{constructor(e){this.tag=e.tag,this.nameAccount=new t.PublicKey(e.nameAccount)}static deserialize(t){return new Vi(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)}}Vi.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};async function zi(e,r,n,o,i,s,a,c){const u=Sn(r),f=Bn(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let p;if(c){const{registry:t}=await Ze(e,c);p=t.owner}return qt(_e,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,p)}async function ji(t,e,r,n,o){const i=Sn(e),s=Bn(i,n,o);let a;a=n||(await pe.retrieve(t,s)).registry.owner;return $t(_e,s,r,a)}const Fi=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Ce.toBuffer()],Ce),a=Sn(e.toBase58()),c=Bn(a,s,o);return[[],[new Qt({name:r}).getInstruction(Ce,_e,Le,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},Ki=async(e,r,n,o,i,s)=>{Cn(n!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:a,hashed:c,parent:u}=Tn(`${n}.${r}`,exports.RecordVersion.V1),f=Ti(o,n).length,h=await e.getMinimumBalanceForRentExemption(f+pe.HEADER_LEN);return qt(_e,t.SystemProgram.programId,a,i,s,c,new _t(h),new Tt(f),void 0,u,i)},Hi=async(e,r,n,o,i,s)=>{const{pubkey:a,hashed:c,parent:u}=Tn(`${exports.Record.SOL}.${r}`,exports.RecordVersion.V1),f=_i(n,a,o,i).length,h=await e.getMinimumBalanceForRentExemption(f+pe.HEADER_LEN);return[qt(_e,t.SystemProgram.programId,a,o,s,c,new _t(h),new Tt(f),void 0,u,o)]};class Gi{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 Gi(Gt(Gi.schema,r.data.slice(pe.HEADER_LEN)))}}async function qi(e,r,o,i,s){const a=Sn(i.toString()),c=Bn(a,Me,We);let u=Ht(Gi.schema,new Gi({twitterRegistryKey:o.toBytes(),twitterHandle:r}));return[qt(_e,t.SystemProgram.programId,c,i,s,a,new _t(await e.getMinimumBalanceForRentExemption(u.length+pe.HEADER_LEN)),new Tt(u.length),Me,We,Me),Yt(_e,c,new Tt(0),n.Buffer.from(u),Me)]}var Yi;Gi.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},exports.CustomBg=void 0,(Yi=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",Yi.Rgb0x001="rgb0x00#1";const Xi=async(e,r,o)=>{const i=Bi(o,exports.Record.SOL),s=await Pi(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(!Si(u,s.data.slice(32),r))throw new kt(exports.ErrorType.InvalidSignature);return new t.PublicKey(s.data.slice(0,32))},$i=async(e,r,n)=>{try{const o=Mi(n,exports.Record.SOL),i=await Pr.retrieve(e,o),s=i.getStalenessId(),a=i.getRoAId(),c=i.getContent();if(0===s.compare(r.toBuffer())&&i.header.stalenessValidation===Ir.Solana&&0===a.compare(c)&&i.header.rightOfAssociationValidation===Ir.Solana)return new t.PublicKey(c)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}},Zi=new t.PublicKey("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),Qi=new t.PublicKey("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),Ji={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")},ts=(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,Ji.NAME_PROGRAM_ID);return s},es=(t,e=Ji.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Sn(t);return{pubkey:ts(n,r,e),hashed:n}},rs=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}=es(e[1]);return{...es(t,r),isSub:!0,parent:r}}if(e.length>=3)throw new kt(exports.ErrorType.InvalidInput);return{...es(t,Ji.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},ns=(t,e)=>{const{pubkey:r,parent:n}=rs(t),o=Sn(r.toBase58());return ts(o,Ji.REVERSE_LOOKUP_CLASS,e?n:void 0)};async function os(e,r,n,o,i,s,a,c){const u=await Qe(r),f=await ts(u,a,c),h=s||await e.getMinimumBalanceForRentExemption(n);let p;if(c){const{registry:t}=await Ze(e,c);p=t.owner}return qt(Ji.NAME_PROGRAM_ID,t.SystemProgram.programId,f,i,o,u,new _t(h),new Tt(n),a,c,p)}const is=async(e,r,n,o,i)=>{let[s]=await t.PublicKey.findProgramAddress([Ji.REGISTER_PROGRAM_ID.toBuffer()],Ji.REGISTER_PROGRAM_ID),a=await Qe(e.toBase58()),c=ts(a,s,o);return[[],[new Qt({name:r}).getInstruction(Ji.REGISTER_PROGRAM_ID,Ji.NAME_PROGRAM_ID,Ji.ROOT_DOMAIN_ACCOUNT,c,t.SystemProgram.programId,s,n,t.SYSVAR_RENT_PUBKEY,o,i)]]},ss={utils:{getNameAccountKeySync:ts,reverseLookup:async(t,e)=>{const r=Sn(e.toBase58()),n=ts(r,Ji.REVERSE_LOOKUP_CLASS),{registry:o}=await pe.retrieve(t,n);if(!o.data)throw new kt(exports.ErrorType.NoAccountData);return Nn(o.data)},_deriveSync:es,getDomainKeySync:rs,getReverseKeySync:ns},constants:Ji,bindings:{createNameRegistry:os,updateNameRegistryData:async function(t,e,r,n,o,i){const s=await Qe(e),a=ts(s,o,i);let c;return c=o||(await pe.retrieve(t,a)).registry.owner,Yt(Ji.NAME_PROGRAM_ID,a,new Tt(r),n,c)},transferNameOwnership:async function(t,e,r,n,o,i){const s=await Qe(e),a=ts(s,n,o);let c;return c=n||(await pe.retrieve(t,a)).registry.owner,Xt(Ji.NAME_PROGRAM_ID,a,r,c,n,o,i)},deleteNameRegistry:async function(t,e,r,n,o){const i=await Qe(e),s=ts(i,n,o);let a;return a=n||(await pe.retrieve(t,s)).registry.owner,$t(Ji.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(e,r,n,o,i,s=Ji.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new kt(exports.ErrorType.InvalidDomain);const[c]=t.PublicKey.findProgramAddressSync([Ji.REGISTER_PROGRAM_ID.toBuffer()],Ji.REGISTER_PROGRAM_ID),u=Sn(r),f=ts(u,void 0,Ji.ROOT_DOMAIN_ACCOUNT),h=Sn(f.toBase58()),p=ts(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Ji.REGISTER_PROGRAM_ID),y=Ji.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,Ji.VAULT_OWNER),m=ss.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(Ji.REGISTER_PROGRAM_ID,Ji.NAME_PROGRAM_ID,Ji.ROOT_DOMAIN_ACCOUNT,f,p,t.SystemProgram.programId,c,o,i,Ji.PYTH_MAPPING_ACC,new t.PublicKey(m.product),new t.PublicKey(m.price),b,d,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},createReverseName:is,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}=rs(e),c=await t.getMinimumBalanceForRentExemption(n+pe.HEADER_LEN),u=await os(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=ns(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await is(a,"\0".concat(i),r,s,r);o.push(...t)}return[[],o]},burnDomain:(e,r,n)=>{const{pubkey:o}=rs(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Ji.REGISTER_PROGRAM_ID),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Ji.REGISTER_PROGRAM_ID);return(new ee).getInstruction(Ji.REGISTER_PROGRAM_ID,Ji.NAME_PROGRAM_ID,t.SystemProgram.programId,o,ns(e),s,i,Ji.REVERSE_LOOKUP_CLASS,r,n)},transferSubdomain:async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=rs(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await pe.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await pe.retrieve(t,a)).registry.owner);return Xt(Ji.NAME_PROGRAM_ID,i,r,o,void 0,c,u)}}};exports.BONFIDA_FIDA_BNB=Oe,exports.BONFIDA_USDC_BNB=Ve,exports.CUSTOM_BG_TLD=Ye,exports.ETH_ROA_RECORDS=Li,exports.FavouriteDomain=Vi,exports.GUARDIANS=Ui,exports.HASH_PREFIX=Ue,exports.METAPLEX_ID=$e,exports.NAME_OFFERS_ID=Wi,exports.NAME_PROGRAM_ID=_e,exports.NameRegistryState=pe,exports.Numberu32=Tt,exports.Numberu64=_t,exports.PYTH_FEEDS=Ke,exports.PYTH_FIDA_PRICE_ACC=Ne,exports.PYTH_MAPPING_ACC=He,exports.RECORD_V1_SIZE=Tr,exports.REFERRERS=je,exports.REGISTER_PROGRAM_ID=Ce,exports.REVERSE_LOOKUP_CLASS=De,exports.ROOT_DOMAIN_ACCOUNT=Le,exports.ReverseTwitterRegistryState=Gi,exports.SELF_SIGNED=Ni,exports.SNSError=kt,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=Fe,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=We,exports.TWITTER_VERIFICATION_AUTHORITY=Me,exports.USDC_MINT=ze,exports.UTF8_ENCODED=Ci,exports.VAULT_OWNER=qe,exports.VAULT_OWNER_DEPRECATED=Ge,exports.WOLVES_COLLECTION_METADATA=Xe,exports.burnDomain=(e,r,n)=>{const{pubkey:o}=Tn(e),[i]=t.PublicKey.findProgramAddressSync([o.toBuffer()],Ce),[s]=t.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Ce);return(new ee).getInstruction(Ce,_e,t.SystemProgram.programId,o,Un(e),s,i,De,r,n)},exports.burnInstruction=ee,exports.changeTwitterRegistryData=async function(t,e,r,n){const o=Sn(t),i=Bn(o,void 0,We);return[Yt(_e,i,new Tt(r),n,e)]},exports.changeVerifiedPubkey=async function(t,e,r,n,o){const i=Sn(e),s=Bn(i,void 0,We);let a=[Xt(_e,s,n,r,void 0)];return a.push(await ji(t,r.toString(),o,Me,We)),a=a.concat(await qi(t,e,s,n,o)),a},exports.check=Cn,exports.checkSolRecord=Si,exports.createInstruction=qt,exports.createInstructionV3=Jt,exports.createNameRegistry=zi,exports.createRecordInstruction=Ki,exports.createRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Tn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new gr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Ar))(i,s,a,o,_e,"".concat(r),Di(n,r),xr);return u},exports.createReverseInstruction=Qt,exports.createReverseName=Fi,exports.createReverseTwitterRegistry=qi,exports.createSolRecordInstruction=Hi,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}=Tn(e),c=await t.getMinimumBalanceForRentExemption(n+pe.HEADER_LEN),u=await zi(t,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=Un(e,!0),h=await t.getAccountInfo(f);if(!(null==h?void 0:h.data)){const[,t]=await Fi(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=Sn(r),a=Bn(s,void 0,We),c=await e.getMinimumBalanceForRentExemption(o+pe.HEADER_LEN);let u=[qt(_e,t.SystemProgram.programId,a,n,i,s,new _t(c),new Tt(o),void 0,We,Me)];return u=u.concat(await qi(e,r,a,n,i)),u},exports.createWithNftInstruction=te,exports.deleteInstruction=$t,exports.deleteNameRegistry=ji,exports.deleteRecordV2=(e,r,n,o)=>{let{pubkey:i,parent:s,isSub:a}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(a&&(s=Tn(e).pubkey),!s)throw new Error("Invalid parent");const c=((e,r,n,o,i,s)=>(new vr).getInstruction(s,t.SystemProgram.programId,i,e,o,r,n,Ar))(o,s,n,i,_e,xr);return c},exports.deleteTwitterRegistry=async function(t,e){const r=Sn(t),n=Bn(r,void 0,We),o=Sn(e.toString()),i=Bn(o,Me,We);return[$t(_e,n,e,e),$t(_e,i,e,e)]},exports.deserializeRecord=ki,exports.deserializeRecordV2Content=Oi,exports.deserializeReverse=Nn,exports.devnet=ss,exports.ethValidateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(u&&(c=Tn(e).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c,u)=>new wr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(c)}).getInstruction(u,t.SystemProgram.programId,i,e,r,n,o,Ar))(o,a,c,n,_e,Ir.Ethereum,i,s,xr);return f},exports.findSubdomains=async(t,e)=>{const r=[{memcmp:{offset:0,bytes:e.toBase58()}},{memcmp:{offset:64,bytes:De.toBase58()}}],n=await t.getProgramAccounts(_e,{filters:r}),o=[{memcmp:{offset:0,bytes:e.toBase58()}}],i=await t.getProgramAccounts(_e,{filters:o,dataSlice:{offset:0,length:0}}),s=new Map(n.map((t=>[t.pubkey.toBase58(),Nn(t.account.data.slice(96))]))),a=[];return i.forEach((t=>{const r=Ln(t.pubkey,e).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=_n,exports.getAllRegisteredDomains=async t=>{const e=[{memcmp:{offset:0,bytes:Le.toBase58()}}];return await t.getProgramAccounts(_e,{dataSlice:{offset:32,length:32},filters:e})},exports.getArtistPubkey=t=>{switch(t){case exports.CustomBg.DegenPoet1:return Zi;case exports.CustomBg.Rgb0x001:return Qi;default:throw new kt(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(t,e)=>await Ri(t,e,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(t,e)=>await Ri(t,e,exports.Record.Background,!0),exports.getBackpackRecord=async(t,e)=>await Ri(t,e,exports.Record.Backpack,!0),exports.getBscRecord=async(t,e)=>await Ri(t,e,exports.Record.BSC,!0),exports.getBtcRecord=async(t,e)=>await Ri(t,e,exports.Record.BTC,!0),exports.getCustomBgKeys=(t,e)=>{const r=Sn(e),n=Sn(t),o=Bn(n,void 0,Ye);return{domainKey:o,bgKey:Bn(r,void 0,o)}},exports.getDiscordRecord=async(t,e)=>await Ri(t,e,exports.Record.Discord,!0),exports.getDogeRecord=async(t,e)=>await Ri(t,e,exports.Record.DOGE,!0),exports.getDomainKey=er,exports.getDomainKeySync=Tn,exports.getDomainKeysWithReverses=async function(t,e){const r=await _n(t,e),n=await Pn(t,r);return r.map(((t,e)=>({pubKey:t,domain:n[e]})))},exports.getDomainMint=ie,exports.getDomainPriceFromName=t=>{switch(In(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 Ri(t,e,exports.Record.Email,!0),exports.getEthRecord=async(t,e)=>await Ri(t,e,exports.Record.ETH,!0),exports.getFavoriteDomain=async(e,r)=>{const[n]=Vi.getKeySync(Wi,new t.PublicKey(r)),o=await Vi.retrieve(e,n),i=await Rn(e,o.nameAccount),{registry:s,nftOwner:a}=await pe.retrieve(e,o.nameAccount),c=a||s.owner;return{domain:o.nameAccount,reverse:i,stale:!r.equals(c)}},exports.getGithubRecord=async(t,e)=>await Ri(t,e,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(e,r){const n=Sn(r.toString()),o=Bn(n,Me,We);let i=await Gi.retrieve(e,o);return[i.twitterHandle,new t.PublicKey(i.twitterRegistryKey)]},exports.getHashedName=Qe,exports.getHashedNameSync=Sn,exports.getInjectiveRecord=async(t,e)=>await Ri(t,e,exports.Record.Injective,!0),exports.getIpfsRecord=async(t,e)=>await Ri(t,e,exports.Record.IPFS,!0),exports.getLtcRecord=async(t,e)=>await Ri(t,e,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(e,r)=>{const n=[],o=r.map((t=>Vi.getKeySync(Wi,t)[0])),i=(await e.getMultipleAccountsInfo(o)).map((e=>(null==e?void 0:e.data)?Vi.deserialize(null==e?void 0:e.data).nameAccount:t.PublicKey.default)),s=i.map((t=>Ln(t))),a=i.map(((t,e)=>Bt(ie(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(Nn(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(Nn(null==i?void 0:i.data.slice(96)))}return n},exports.getMultipleRecordsV2=async function(t,e,r,n={}){const o=r.map((t=>Mi(e,t))),i=await Pr.retrieveBatch(t,o);return n.deserialize?i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e],deserializedContent:Oi(t.getContent(),r[e])}})):i.map(((t,e)=>{if(t)return{retrievedRecord:t,record:r[e]}}))},exports.getNameAccountKey=Je,exports.getNameAccountKeySync=Bn,exports.getNameOwner=Ze,exports.getPicRecord=async(t,e)=>await Ri(t,e,exports.Record.Pic,!0),exports.getPointRecord=async(t,e)=>await Ri(t,e,exports.Record.POINT,!0),exports.getRecord=Ri,exports.getRecordKeySync=Bi,exports.getRecordV2=async function(t,e,r,n={}){const o=Mi(e,r),i=await Pr.retrieve(t,o);return n.deserialize?{retrievedRecord:i,deserializedContent:Oi(i.getContent(),r)}:{retrievedRecord:i}},exports.getRecordV2Key=Mi,exports.getRecords=async function(t,e,r,n){const o=r.map((t=>Bi(e,t))),i=await pe.retrieveBatch(t,o);return n?i.map(((t,n)=>{if(t)return ki(t,r[n],Bi(e,r[n]))})):i},exports.getRedditRecord=async(t,e)=>await Ri(t,e,exports.Record.Reddit,!0),exports.getReverseKey=async(t,e)=>{const{pubkey:r,parent:n}=await er(t),o=await Qe(r.toBase58());return await Je(o,De,e?n:void 0)},exports.getReverseKeyFromDomainKey=Ln,exports.getReverseKeySync=Un,exports.getShdwRecord=async(t,e)=>await Ri(t,e,exports.Record.SHDW,!0),exports.getSolRecord=Pi,exports.getTelegramRecord=async(t,e)=>await Ri(t,e,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(t,e)=>{const r=await he(t,e),n=await Pn(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:We.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Me.toBase58()}}],o=await e.getProgramAccounts(_e,{filters:n});for(const e of o)if(e.account.data.length>pe.HEADER_LEN+32){const r=e.account.data.slice(pe.HEADER_LEN),n=new Gi(Gt(Gi.schema,r));return[n.twitterHandle,new t.PublicKey(n.twitterRegistryKey)]}throw new kt(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(t,e)=>await Ri(t,e,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(t,e){const r=Sn(e),n=Bn(r,void 0,We),{registry:o}=await pe.retrieve(t,n);return o},exports.getTwitterRegistryData=async function(e,r){const o=[{memcmp:{offset:0,bytes:We.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new t.PublicKey(n.Buffer.alloc(32,0)).toBase58()}}],i=await e.getProgramAccounts(_e,{filters:o});if(i.length>1)throw new kt(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(pe.HEADER_LEN)},exports.getTwitterRegistryKey=async function(t){const e=Sn(t);return Bn(e,void 0,We)},exports.getUrlRecord=async(t,e)=>await Ri(t,e,exports.Record.Url,!0),exports.performReverseLookup=async function(t,e){const r=await Qe(e.toBase58()),n=await Je(r,De),{registry:o}=await pe.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 Qe(t.toBase58()),n=await Je(e,De);r.push(n)}return(await pe.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([Ce.toBuffer()],Ce),u=Sn(r),f=Bn(u,void 0,Le),h=Sn(f.toBase58()),p=Bn(h,c),[l]=t.PublicKey.findProgramAddressSync([f.toBuffer()],Ce),y=je.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,qe,!0),m=Ke.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(Ce,_e,Le,f,p,t.SystemProgram.programId,c,o,i,He,new t.PublicKey(m.product),new t.PublicKey(m.price),b,d,t.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},exports.registerFavorite=(e,r)=>{const[n]=Vi.getKeySync(Wi,r);return[(new re).getInstruction(Wi,e,n,r,t.SystemProgram.programId)]},exports.registerFavoriteInstruction=re,exports.registerWithNft=(e,r,n,o,i,s,a,c,u)=>{const[f]=t.PublicKey.findProgramAddressSync([n.toBuffer()],Ce);return new te({space:r,name:e}).getInstruction(Ce,_e,Le,n,o,t.SystemProgram.programId,De,i,s,a,c,u,Xe,d,t.SYSVAR_RENT_PUBKEY,f,$e)},exports.resolve=async(t,e)=>{const{pubkey:r}=Tn(e),{registry:n,nftOwner:o}=await pe.retrieve(t,r);if(o)return o;try{const r=await $i(t,n.owner,e);if(void 0!==r)return r;return await Xi(t,n.owner,e)}catch(t){if(t instanceof Error&&"FetchError"===t.name)throw t}return n.owner},exports.resolveSolRecordV1=Xi,exports.resolveSolRecordV2=$i,exports.retrieveNftOwner=ce,exports.retrieveNfts=async e=>{const r=await e.getProgramAccounts(ne,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((e=>new t.PublicKey(e.account.data.slice(66,98))))},exports.retrieveRecords=he,exports.reverseLookup=Rn,exports.reverseLookupBatch=Pn,exports.serializeRecord=Ti,exports.serializeRecordV2Content=Di,exports.serializeSolRecord=_i,exports.transferInstruction=Xt,exports.transferNameOwnership=async function(t,e,r,n,o,i){const s=Sn(e),a=Bn(s,n,o);let c;return c=n||(await pe.retrieve(t,a)).registry.owner,Xt(_e,a,r,c,n,o,i)},exports.transferSubdomain=async(t,e,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=Tn(e);if(!a||!s)throw new kt(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:e}=await pe.retrieve(t,i);o=e.owner}let c,u;n&&(c=a,u=(await pe.retrieve(t,a)).registry.owner);return Xt(_e,i,r,o,void 0,c,u)},exports.updateInstruction=Yt,exports.updateNameRegistryData=async function(t,e,r,n,o,i){const s=Sn(e),a=Bn(s,o,i);let c;return c=o||(await pe.retrieve(t,a)).registry.owner,Yt(_e,a,new Tt(r),n,c)},exports.updateRecordInstruction=async(t,e,r,n,o,i)=>{Cn(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=Tn(`${r}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);Cn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const c=Ti(n,r);if((null==a?void 0:a.data.slice(96).length)!==c.length)return[$t(_e,s,i,o),await Ki(t,e,r,n,o,i)];return[Yt(_e,s,new Tt(0),c,o)]},exports.updateRecordV2Instruction=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Tn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a,c)=>new mr({record:s,content:Array.from(a)}).getInstruction(c,t.SystemProgram.programId,i,e,r,n,o,Ar))(i,s,a,o,_e,"".concat(r),Di(n,r),xr);return u},exports.updateSolRecordInstruction=async(t,e,r,n,o,i)=>{const{pubkey:s}=Tn(`${exports.Record.SOL}.${e}`,exports.RecordVersion.V1),a=await t.getAccountInfo(s);if(Cn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[$t(_e,s,i,n),await Hi(t,e,r,n,o,i)];const c=_i(r,s,n,o);return[Yt(_e,s,new Tt(0),c,n)]},exports.validateRecordV2Content=(e,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Tn(`${n}.${r}`,exports.RecordVersion.V2);if(u&&(c=Tn(r).pubkey),!c)throw new Error("Invalid parent");const f=((e,r,n,o,i,s,a,c)=>new br({staleness:a}).getInstruction(c,t.SystemProgram.programId,s,e,r,n,o,Ar,i))(i,a,c,o,s,_e,e,xr);return f},exports.verifyRightOfAssociation=async(t,e,r,n)=>{var o;const i=Mi(r,e),s=await Pr.retrieve(t,i),a=s.getRoAId(),c=Li.has(e)?Ir.Ethereum:Ir.Solana;if(!(n=null!=n?n:null===(o=Ui.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=Mi(n,r),{registry:i,nftOwner:s}=await pe.retrieve(e,Tn(n).pubkey),a=s||i.owner,c=await Pr.retrieve(e,o),u=c.getStalenessId();return(null==a?void 0:a.equals(new t.PublicKey(u)))&&c.header.stalenessValidation===Ir.Solana},exports.writRoaRecordV2=(e,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Tn(`${r}.${e}`,exports.RecordVersion.V2);if(c&&(a=Tn(e).pubkey),!a)throw new Error("Invalid parent");const u=((e,r,n,o,i,s,a)=>new Er({roaId:Array.from(s.toBuffer())}).getInstruction(a,t.SystemProgram.programId,r,e,n,o,i,Ar))(o,_e,s,a,n,i,xr);return u};
|
|
20
20
|
//# sourceMappingURL=index.cjs.map
|