@bonfida/spl-name-service 2.5.2 → 2.5.4
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 +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/types/custom-bg.d.ts +4 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@solana/web3.js"),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}for(var n={},o={byteLength:function(e){var t=f(e),r=t[0],n=t[1];return 3*(r+n)/4-n},toByteArray:function(e){var t,r,n=f(e),o=n[0],i=n[1],c=new a(function(e,t,r){return 3*(t+r)/4-r}(0,o,i)),u=0,p=i>0?o-4:o;for(r=0;r<p;r+=4)t=s[e.charCodeAt(r)]<<18|s[e.charCodeAt(r+1)]<<12|s[e.charCodeAt(r+2)]<<6|s[e.charCodeAt(r+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;2===i&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,c[u++]=255&t);1===i&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t);return c},fromByteArray:function(e){for(var t,r=e.length,n=r%3,o=[],s=16383,a=0,c=r-n;a<c;a+=s)o.push(p(e,a,a+s>c?c:a+s));1===n?(t=e[r-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return o.join("")}},i=[],s=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)i[u]=c[u],s[c.charCodeAt(u)]=u;function f(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function p(e,t,r){for(var n,o,s=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@solana/web3.js"),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}for(var n={},o={byteLength:function(e){var t=f(e),r=t[0],n=t[1];return 3*(r+n)/4-n},toByteArray:function(e){var t,r,n=f(e),o=n[0],i=n[1],c=new a(function(e,t,r){return 3*(t+r)/4-r}(0,o,i)),u=0,p=i>0?o-4:o;for(r=0;r<p;r+=4)t=s[e.charCodeAt(r)]<<18|s[e.charCodeAt(r+1)]<<12|s[e.charCodeAt(r+2)]<<6|s[e.charCodeAt(r+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;2===i&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,c[u++]=255&t);1===i&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t);return c},fromByteArray:function(e){for(var t,r=e.length,n=r%3,o=[],s=16383,a=0,c=r-n;a<c;a+=s)o.push(p(e,a,a+s>c?c:a+s));1===n?(t=e[r-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return o.join("")}},i=[],s=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)i[u]=c[u],s[c.charCodeAt(u)]=u;function f(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function p(e,t,r){for(var n,o,s=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63;var d={
|
|
2
2
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
-
read:function(e,t,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,f=-7,p=r?o-1:0,
|
|
3
|
+
read:function(e,t,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,f=-7,p=r?o-1:0,d=r?-1:1,h=e[t+p];for(p+=d,i=h&(1<<-f)-1,h>>=-f,f+=a;f>0;i=256*i+e[t+p],p+=d,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=256*s+e[t+p],p+=d,f-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),i-=u}return(h?-1:1)*s*Math.pow(2,i-n)},write:function(e,t,r,n,o,i){var s,a,c,u=8*i-o-1,f=(1<<u)-1,p=f>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,l=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(s++,c/=2),s+p>=f?(a=0,s=f):s+p>=1?(a=(t*c-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;e[r+h]=255&a,h+=l,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+h]=255&s,h+=l,s/=256,u-=8);e[r+h-l]|=128*y}};
|
|
4
4
|
/*!
|
|
5
5
|
* The buffer module from node.js, for the browser.
|
|
6
6
|
*
|
|
7
7
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8
8
|
* @license MIT
|
|
9
9
|
*/
|
|
10
|
-
!function(e){const t=o,r=h,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function s(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=s(r);const o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);const o=function(e){if(a.isBuffer(e)){const t=0|l(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return u(e),s(e<0?0:0|l(e))}function p(e){const t=e.length<0?0:0|l(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,a.prototype),n}function l(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function y(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(o)return n?-1:G(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function w(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,o){let i,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-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(e,i+n)!==u(t,n)){r=!1;break}if(r)return i}return-1}function v(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=t.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Z(n))return s;e[r+s]=n}return s}function E(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function x(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function A(e,t,r,n){return Y(q(t),e,r,n)}function S(e,t,r,n){return Y(function(e,t){let r,n,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function I(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function B(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:r=e[o+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(i=c));break;case 3:r=e[o+1],n=e[o+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[o+1],n=e[o+2],a=e[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<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(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=R));return r}(n)}e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),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(e,t,r){return c(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},a.allocUnsafe=function(e){return f(e)},a.allocUnsafeSlow=function(e){return f(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=a.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(X(t,Uint8Array))o+t.length>n.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!a.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)w(this,t,t+1);return this},a.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},a.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},a.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?B(this,0,e):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const c=Math.min(i,s),u=this.slice(n,o),f=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==f[e]){i=u[e],s=f[e];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>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,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return x(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,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(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function k(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function T(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=t;n<r;++n)o+=$[e[n]];return o}function _(e,t,r){const n=e.slice(t,r);let o="";for(let e=0;e<n.length-1;e+=2)o+=String.fromCharCode(n[e]+256*n[e+1]);return o}function U(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,o,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function C(e,t,r,n,o){F(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function N(e,t,r,n,o){F(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function O(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,n,o,i){return t=+t,n>>>=0,i||O(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function W(e,t,n,o,i){return t=+t,n>>>=0,i||O(e,0,n,8),r.write(e,t,n,o,52,8),n+8}a.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),a.prototype.readBigUInt64BE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=t,o=1,i=this[e+--n];for(;n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),a.prototype.readBigInt64BE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||U(e,4,this.length),r.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||U(e,4,this.length),r.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||U(e,8,this.length),r.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||U(e,8,this.length),r.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=Q((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let o=0,i=1,s=0;for(this[t]=255&e;++o<r&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=Q((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);const o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=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===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{const i=a.isBuffer(e)?e:a.from(e,n),s=i.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=i[o%s]}return this};const M={};function V(e,t,r){M[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,o,i){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===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}`:`>= ${t}${n} and <= ${r}${n}`,new M.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){j(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||K(t,e.length-(r+1))}(n,o,i)}function j(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,r){if(Math.floor(e)!==e)throw j(e,r),new M.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" 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 ${t}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const n=e.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const $=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}}(n);const d=new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new e.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const l=new e.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new e.PublicKey("So11111111111111111111111111111111111111112"),new e.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=ee=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=re=y.blob=y.unionLayoutDiscriminator=y.union=y.seq=y.bits=te=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(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function b(e){return w(e),g.Buffer.from(e.buffer,e.byteOffset,e.length)}y.checkUint8Array=w,y.uint8ArrayToBuffer=b;class m{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function v(e,t){return t.property?e+"["+t.property+"]":e}y.Layout=m,y.nameWithProperty=v,y.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof m))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,r)=>t.decode(e,r),writable:!0})};class E extends m{isCount(){throw new Error("ExternalLayout is abstract")}}y.ExternalLayout=E;class x extends E{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){w(e);const r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}}y.GreedyCount=x;class A extends E{constructor(e,t=0,r){if(!(e instanceof m))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof S||this.layout instanceof I}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}y.OffsetLayout=A;class S extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readUIntLE(t,this.span)}encode(e,t,r=0){return b(t).writeUIntLE(e,r,this.span),this.span}}y.UInt=S;class I extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readUIntBE(t,this.span)}encode(e,t,r=0){return b(t).writeUIntBE(e,r,this.span),this.span}}y.UIntBE=I;class B extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readIntLE(t,this.span)}encode(e,t,r=0){return b(t).writeIntLE(e,r,this.span),this.span}}y.Int=B;class R extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readIntBE(t,this.span)}encode(e,t,r=0){return b(t).writeIntBE(e,r,this.span),this.span}}y.IntBE=R;const P=Math.pow(2,32);function k(e){const t=Math.floor(e/P);return{hi32:t,lo32:e-t*P}}function T(e,t){return e*P+t}class _ extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e),n=r.readUInt32LE(t);return T(r.readUInt32LE(t+4),n)}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeUInt32LE(n.lo32,r),o.writeUInt32LE(n.hi32,r+4),8}}y.NearUInt64=_;class U extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e);return T(r.readUInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeUInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearUInt64BE=U;class L extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e),n=r.readUInt32LE(t);return T(r.readInt32LE(t+4),n)}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeUInt32LE(n.lo32,r),o.writeInt32LE(n.hi32,r+4),8}}y.NearInt64=L;class C extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e);return T(r.readInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearInt64BE=C;class N extends m{constructor(e){super(4,e)}decode(e,t=0){return b(e).readFloatLE(t)}encode(e,t,r=0){return b(t).writeFloatLE(e,r),4}}y.Float=N;class O extends m{constructor(e){super(4,e)}decode(e,t=0){return b(e).readFloatBE(t)}encode(e,t,r=0){return b(t).writeFloatBE(e,r),4}}y.FloatBE=O;class D extends m{constructor(e){super(8,e)}decode(e,t=0){return b(e).readDoubleLE(t)}encode(e,t,r=0){return b(t).writeDoubleLE(e,r),8}}y.Double=D;class W extends m{constructor(e){super(8,e)}decode(e,t=0){return b(e).readDoubleBE(t)}encode(e,t,r=0){return b(t).writeDoubleBE(e,r),8}}y.DoubleBE=W;class M extends m{constructor(e,t,r){if(!(e instanceof m))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof E&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(t instanceof E)&&0<e.span&&(n=t*e.span),super(n,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof E&&(n=n.decode(e,t)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let o=0;for(;o<n;)r+=this.elementLayout.getSpan(e,t+r),++o}return r}decode(e,t=0){const r=[];let n=0,o=this.count;for(o instanceof E&&(o=o.decode(e,t));n<o;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),n+=1;return r}encode(e,t,r=0){const n=this.elementLayout,o=e.reduce(((e,o)=>e+n.encode(o,t,r+e)),0);return this.count instanceof E&&this.count.encode(e.length,t,r),o}}y.Sequence=M;class V extends m{constructor(e,t,r){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof m),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===r&&(r=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const o=n.getSpan(e,t);return t+=o,r+o}),0)}catch(e){throw new RangeError("indeterminate span")}return r}decode(e,t=0){w(e);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,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=e[n.property];void 0!==o&&(i=n.encode(o,t,r),0>s&&(s=n.getSpan(t,r)))}o=r,r+=s}return o+i-n}fromArray(e){const t=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}y.Structure=V;class z{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}}y.UnionDiscriminator=z;class F extends z{constructor(e,t){if(!(e instanceof E&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}y.UnionLayoutDiscriminator=F;class j extends m{constructor(e,t,r){let n;if(e instanceof S||e instanceof I)n=new F(new A(e));else if(e instanceof E&&e.isCount())n=new F(e);else{if(!(e instanceof z))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=e}if(void 0===t&&(t=null),!(null===t||t instanceof m))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&(e instanceof S||e instanceof I)&&(o+=n.layout.span)),super(o,r),this.discriminator=n,this.usesPrefixDiscriminator=e instanceof S||e instanceof I,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return i(e)},this.configGetSourceVariant=function(e){i=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;const r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(const t in this.registry){const r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r;const n=this.discriminator,o=n.decode(e,t),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(e,t+s)}else r=i.decode(e,t);return r}encode(e,t,r=0){const n=this.getSourceVariant(e);if(void 0===n){const n=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=n.layout.span),n.encode(e[n.property],t,r),i+o.encode(e[o.property],t,r+i)}return n.encode(e,t,r)}addVariant(e,t,r){const n=new K(this,e,t,r);return this.registry[e]=n,n}getVariant(e,t=0){let r;return r=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[r]}}y.Union=j;class K extends m{constructor(e,t,r,n){if(!(e instanceof j))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)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!==e.defaultLayout&&0<=r.span&&r.span>e.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=e.span;0>e.span&&(o=r?r.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,n),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=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(e,t+r)),r+n}decode(e,t=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))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(e,t+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let o=n;if(this.layout&&(this.layout.encode(e[this.property],t,r+n),o+=this.layout.getSpan(t,r+n),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function H(e){return 0>e&&(e+=4294967296),e}y.VariantLayout=K;class G extends m{constructor(e,t,r){if(!(e instanceof S||e instanceof I))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let n=0;this._packedSetValue=function(e){return n=H(e),this},this._packedGetValue=function(){return n}}decode(e,t=0){const r=this.makeDestinationObject(),n=this.word.decode(e,t);this._packedSetValue(n);for(const t of this.fields)void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){const n=this.word.decode(t,r);this._packedSetValue(n);for(const t of this.fields)if(void 0!==t.property){const r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){const r=new q(this,e,t);return this.fields.push(r),r}addBoolean(e){const t=new Y(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}y.BitStructure=G;class q{constructor(e,t,r){if(!(e instanceof G))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const n=8*e.span,o=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+o>n)throw new Error("bits too long for span remainder ("+(n-o)+" of "+n+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=n-o-t),this.wordMask=H(this.valueMask<<this.start),this.property=r}decode(e,t){return H(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==H(e&this.valueMask))throw new TypeError(v("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),r=H(e<<this.start);this.container._packedSetValue(H(t&~this.wordMask)|r)}}y.BitField=q;class Y extends q{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e=+e),super.encode(e)}}y.Boolean=Y;class X extends m{constructor(e,t){if(!(e instanceof E&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof E||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),b(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof E&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw new TypeError(v("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw new RangeError("encoding overruns Uint8Array");const o=b(e);return b(t).write(o.toString("hex"),r,n,"hex"),this.length instanceof E&&this.length.encode(n,t,r),n}}y.Blob=X;class Z extends m{constructor(e){super(-1,e)}getSpan(e,t=0){w(e);let r=t;for(;r<e.length&&0!==e[r];)r+=1;return 1+r-t}decode(e,t=0){const r=this.getSpan(e,t);return b(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));const n=g.Buffer.from(e,"utf8"),o=n.length;if(r+o>t.length)throw new RangeError("encoding overruns Buffer");const i=b(t);return n.copy(i,r),i[r+o]=0,o+1}}y.CString=Z;class $ extends m{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return w(e),e.length-t}decode(e,t=0){const r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return b(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));const n=g.Buffer.from(e,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(r+o>t.length)throw new RangeError("encoding overruns Buffer");return n.copy(b(t),r),o}}y.UTF8=$;class Q extends m{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}}y.Constant=Q,y.greedy=(e,t)=>new x(e,t),y.offset=(e,t,r)=>new A(e,t,r);var J=y.u8=e=>new S(1,e);y.u16=e=>new S(2,e),y.u24=e=>new S(3,e);var ee=y.u32=e=>new S(4,e);y.u40=e=>new S(5,e),y.u48=e=>new S(6,e),y.nu64=e=>new _(e),y.u16be=e=>new I(2,e),y.u24be=e=>new I(3,e),y.u32be=e=>new I(4,e),y.u40be=e=>new I(5,e),y.u48be=e=>new I(6,e),y.nu64be=e=>new U(e),y.s8=e=>new B(1,e),y.s16=e=>new B(2,e),y.s24=e=>new B(3,e),y.s32=e=>new B(4,e),y.s40=e=>new B(5,e),y.s48=e=>new B(6,e),y.ns64=e=>new L(e),y.s16be=e=>new R(2,e),y.s24be=e=>new R(3,e),y.s32be=e=>new R(4,e),y.s40be=e=>new R(5,e),y.s48be=e=>new R(6,e),y.ns64be=e=>new C(e),y.f32=e=>new N(e),y.f32be=e=>new O(e),y.f64=e=>new D(e),y.f64be=e=>new W(e);var te=y.struct=(e,t,r)=>new V(e,t,r);y.bits=(e,t,r)=>new G(e,t,r),y.seq=(e,t,r)=>new M(e,t,r),y.union=(e,t,r)=>new j(e,t,r),y.unionLayoutDiscriminator=(e,t)=>new F(e,t);var re=y.blob=(e,t)=>new X(e,t);y.cstr=e=>new Z(e),y.utf8=(e,t)=>new $(e,t),y.constant=(e,t)=>new Q(e,t);const ne=e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)});var oe={};Object.defineProperty(oe,"__esModule",{value:!0});var ie=oe.toBigIntLE=function(e){{const t=Buffer.from(e);t.reverse();const r=t.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};oe.toBigIntBE=function(e){{const t=e.toString("hex");return 0===t.length?BigInt(0):BigInt(`0x${t}`)}};var se=oe.toBufferLE=function(e,t){{const r=e.toString(16),n=Buffer.from(r.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};oe.toBufferBE=function(e,t){{const r=e.toString(16);return Buffer.from(r.padStart(2*t,"0").slice(0,2*t),"hex")}};const ae=(ce=8,e=>{const t=re(ce,e),{encode:r,decode:n}=ne(t),o=t;return o.decode=(e,t)=>{const r=n(e,t);return ie(Buffer.from(r))},o.encode=(e,t,n)=>{const o=se(e,ce);return r(o,t,n)},o});var ce;const ue=e=>{const t=J(e),{encode:r,decode:n}=ne(t),o=t;return o.decode=(e,t)=>!!n(e,t),o.encode=(e,t,n)=>{const o=Number(e);return r(o,t,n)},o},fe=t=>{const r=re(32,t),{encode:n,decode:o}=ne(r),i=r;return i.decode=(t,r)=>{const n=o(t,r);return new e.PublicKey(n)},i.encode=(e,t,r)=>{const o=e.toBuffer();return n(o,t,r)},i};class pe extends Error{constructor(e){super(e)}}class he extends pe{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class de extends pe{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class le extends pe{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class ye extends pe{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class ge extends pe{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var we;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Mint=1]="Mint",e[e.Account=2]="Account"}(we||(we={}));const be=1,me=te([J("m"),J("n"),ue("isInitialized"),fe("signer1"),fe("signer2"),fe("signer3"),fe("signer4"),fe("signer5"),fe("signer6"),fe("signer7"),fe("signer8"),fe("signer9"),fe("signer10"),fe("signer11")]).span;var ve;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen"}(ve||(ve={}));const Ee=te([fe("mint"),fe("owner"),ae("amount"),ee("delegateOption"),fe("delegate"),J("state"),ee("isNativeOption"),ae("isNative"),ae("delegatedAmount"),ee("closeAuthorityOption"),fe("closeAuthority")]),xe=Ee.span,Ae=te([ee("mintAuthorityOption"),fe("mintAuthority"),ae("supply"),J("decimals"),ue("isInitialized"),ee("freezeAuthorityOption"),fe("freezeAuthority")]),Se=Ae.span;async function Ie(e,t,r,n=d){return function(e,t,r=d){if(!t)throw new he;if(!t.owner.equals(r))throw new de;if(t.data.length<Se)throw new le;const n=Ae.decode(t.data.slice(0,Se));let o=Buffer.alloc(0);if(t.data.length>Se){if(t.data.length<=xe)throw new le;if(t.data.length===me)throw new le;if(t.data[xe]!=we.Mint)throw new ye;o=t.data.slice(xe+be)}return{address:e,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:o}}(t,await e.getAccountInfo(t,r),n)}function Be(t,r,n=!1,o=d,i=l){if(!n&&!e.PublicKey.isOnCurve(r.toBuffer()))throw new ge;const[s]=e.PublicKey.findProgramAddressSync([r.toBuffer(),o.toBuffer(),t.toBuffer()],i);return s}function Re(t,r,n,o,i=d,s=l){return function(t,r,n,o,i,s=d,a=l){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:e.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:c,programId:a,data:i})}(t,r,n,o,Buffer.from([1]),i,s)}var Pe;exports.ErrorType=void 0,(Pe=exports.ErrorType||(exports.ErrorType={})).SymbolNotFound="SymbolNotFound",Pe.InvalidSubdomain="InvalidSubdomain",Pe.FavouriteDomainNotFound="FavouriteDomainNotFound",Pe.MissingParentOwner="MissingParentOwner",Pe.U32Overflow="U32Overflow",Pe.InvalidBufferLength="InvalidBufferLength",Pe.U64Overflow="U64Overflow",Pe.NoRecordData="NoRecordData",Pe.InvalidRecordData="InvalidRecordData",Pe.UnsupportedRecord="UnsupportedRecord",Pe.InvalidEvmAddress="InvalidEvmAddress",Pe.InvalidInjectiveAddress="InvalidInjectiveAddress",Pe.InvalidARecord="InvalidARecord",Pe.InvalidAAAARecord="InvalidAAAARecord",Pe.InvalidRecordInput="InvalidRecordInput",Pe.InvalidSignature="InvalidSignature",Pe.AccountDoesNotExist="AccountDoesNotExist",Pe.MultipleRegistries="MultipleRegistries",Pe.InvalidReverseTwitter="InvalidReverseTwitter",Pe.NoAccountData="NoAccountData",Pe.InvalidInput="InvalidInput",Pe.InvalidDomain="InvalidDomain",Pe.InvalidCustomBg="InvalidCustomBackground",Pe.UnsupportedSignature="UnsupportedSignature",Pe.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",Pe.RecordIsNotSigned="RecordIsNotSigned",Pe.UnsupportedSignatureType="UnsupportedSignatureType",Pe.InvalidSolRecordV2="InvalidSolRecordV2",Pe.MissingVerifier="MissingVerifier",Pe.PythFeedNotFound="PythFeedNotFound";class ke extends Error{constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,ke)}}class Te{constructor(e){this.value=BigInt(e)}toBuffer(){const e=n.Buffer.alloc(4);return e.writeUInt32LE(Number(this.value)),e}static fromBuffer(e){if(4!==e.length)throw new ke(exports.ErrorType.InvalidBufferLength,`Invalid buffer length: ${e.length}`);const t=BigInt(e.readUInt32LE(0));return new Te(t)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}class _e{constructor(e){this.value=BigInt(e)}toBuffer(){const e=n.Buffer.alloc(8);return e.writeBigUInt64LE(this.value),e}static fromBuffer(e){if(8!==e.length)throw new ke(exports.ErrorType.U64Overflow,`Invalid buffer length: ${e.length}`);const t=e.readBigUInt64LE(0);return new _e(t)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ue,Le=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ce=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var r=t.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===t[0]?"setFloat".concat(r):"i"===t[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,e,!0),this.offset+=n},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),Ne=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),r=parseInt(t)/8;this.assert_enough_buffer(r);var n="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[n](this.offset,!0);return this.offset+=r,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),Oe=(Ue=function(e,t){return Ue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Ue(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Ue(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function De(e,t,r){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(r.join(".")))}function We(e,t,r){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(r.join(".")))}var Me=Le.concat(["bool","string"]),Ve=["option","enum","array","set","map","struct"],ze=function(e){function t(t,r){var n="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(r);return e.call(this,n)||this}return Oe(t,e),t}(Error);function Fe(e){if("string"!=typeof e||!Me.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&Ve.includes(t[0])){var r=t[0];if("option"===r)return Fe(e[r]);if("enum"===r)return function(e){if(!Array.isArray(e))throw new ze(e,"Array");for(var t=0,r=e;t<r.length;t++){var n=r[t];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');Fe({struct:n.struct})}}(e[r]);if("array"===r)return function(e){if("object"!=typeof e)throw new ze(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return Fe(e.type);throw new ze(e,"{ type, len? }")}(e[r]);if("set"===r)return Fe(e[r]);if("map"===r)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new ze(e,"{ key, value }");Fe(e.key),Fe(e.value)}(e[r]);if("struct"===r)return function(e){if("object"!=typeof e)throw new ze(e,"object");for(var t in e)Fe(e[t])}(e[r])}}throw new ze(e,Ve.join(", ")+" or "+Me.join(", "))}}var je=function(){function e(e){this.encoded=new Ce,this.fieldPath=["value"],this.checkTypes=e}return e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(Le.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var r=parseInt(t.substring(1));r<=32||"f64"==t?(this.checkTypes&&De(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),r))},e.prototype.encode_bigint=function(e,t){for(var r=t/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_string=function(e){this.checkTypes&&De(e,"string",this.fieldPath);for(var t=e,r=[],n=0;n<t.length;n++){var o=t.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&t.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))},e.prototype.encode_boolean=function(e){this.checkTypes&&De(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var r=Object.keys(e)[0],n=0;n<t.enum.length;n++){var o=t.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?We(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encode_value(e[r],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?We(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&De(e,"object",this.fieldPath);var r=e instanceof Set?Array.from(e.values()):Object.values(e);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,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&De(e,"object",this.fieldPath);var r=e instanceof Map,n=r?Array.from(e.keys()):Object.keys(e);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,t.map.key),this.encode_value(r?e.get(s):e[s],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&De(e,"object",this.fieldPath);for(var r=0,n=Object.keys(t.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}},e}(),Ke=function(){function e(e){this.buffer=new Ne(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(Le.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var r=e/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&n[r-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){for(var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e)),r=[],n=0;n<e;++n){var o=t[n];if(o<128)r.push(o);else if(o<224)r.push((31&o)<<6|63&t[++n]);else if(o<240)r.push((15&o)<<12|(63&t[++n])<<6|63&t[++n]);else{var i=(7&o)<<18|(63&t[++n])<<12|(63&t[++n])<<6|63&t[++n];r.push(i)}}return String.fromCodePoint.apply(String,r)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,r=this.buffer.consume_value("u8");if(r>e.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=e.enum[r].struct,o=Object.keys(n)[0];return(t={})[o]=this.decode_value(n[o]),t},e.prototype.decode_array=function(e){for(var t=[],r=e.array.len?e.array.len:this.decode_integer("u32"),n=0;n<r;++n)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),r=new Set,n=0;n<t;++n)r.add(this.decode_value(e.set));return r},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),r=new Map,n=0;n<t;++n){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);r.set(o,i)}return r},e.prototype.decode_struct=function(e){var t={};for(var r in e.struct)t[r]=this.decode_value(e.struct[r]);return t},e}();function He(e,t,r){return void 0===r&&(r=!0),r&&Fe(e),new je(r).encode(t,e)}function Ge(e,t,r){return void 0===r&&(r=!0),r&&Fe(e),new Ke(t).decode(e)}function qe(t,r,o,i,s,a,c,u,f,p,h){const d=[n.Buffer.from(Int8Array.from([0])),new Te(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 e.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),p?y.push({pubkey:p,isSigner:!1,isWritable:!1}):y.push({pubkey:new e.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),h&&y.push({pubkey:h,isSigner:!0,isWritable:!1}),new e.TransactionInstruction({keys:y,programId:t,data:l})}function Ye(t,r,o,i,s){const a=[n.Buffer.from(Int8Array.from([1])),o.toBuffer(),new Te(i.length).toBuffer(),i],c=n.Buffer.concat(a),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new e.TransactionInstruction({keys:u,programId:t,data:c})}function Xe(t,r,o,i,s,a,c){const u=[n.Buffer.from(Int8Array.from([2])),o.toBuffer()],f=n.Buffer.concat(u),p=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c||i,isSigner:!0,isWritable:!1}];return s&&p.push({pubkey:s,isSigner:!0,isWritable:!1}),c&&a&&(s||p.push({pubkey:e.PublicKey.default,isSigner:!1,isWritable:!1}),p.push({pubkey:a,isSigner:!1,isWritable:!1})),new e.TransactionInstruction({keys:p,programId:t,data:f})}function Ze(t,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 e.TransactionInstruction({keys:c,programId:t,data:a})}class $e{constructor(e){this.tag=9,this.name=e.name,this.space=e.space}serialize(){return He($e.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,h){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:e.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:p,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!1},{pubkey:h,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:y,programId:t,data:l})}}$e.schema={struct:{tag:"u8",name:"string",space:"u32"}};class Qe{constructor(e){this.tag=12,this.name=e.name}serialize(){return He(Qe.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p){const h=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}),p&&d.push({pubkey:p,isSigner:!0,isWritable:!0}),new e.TransactionInstruction({keys:d,programId:t,data:h})}}Qe.schema={struct:{tag:"u8",name:"string"}};class Je{constructor(e){this.tag=13,this.name=e.name,this.space=e.space,this.referrerIdxOpt=e.referrerIdxOpt}serialize(){return He(Je.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,h,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:p,isSigner:!1,isWritable:!1}),v.push({pubkey:h,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 e.TransactionInstruction({keys:v,programId:t,data:m})}}Je.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class et{constructor(e){this.tag=17,this.name=e.name,this.space=e.space}serialize(){return He(et.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,h,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:p,isSigner:!1,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:l,isSigner:!1,isWritable:!0}),v.push({pubkey: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 e.TransactionInstruction({keys:v,programId:t,data:m})}}et.schema={struct:{tag:"u8",name:"string",space:"u32"}};class tt{constructor(){this.tag=16}serialize(){return He(tt.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p){const h=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:p,isSigner:!1,isWritable:!0}),new e.TransactionInstruction({keys:d,programId:t,data:h})}}tt.schema={struct:{tag:"u8"}};class rt{constructor(){this.tag=6}serialize(){return He(rt.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:c,programId:t,data:a})}}rt.schema={struct:{tag:"u8"}};class nt{constructor(e){this.tag=20,this.name=e.name,this.space=e.space,this.referrerIdxOpt=e.referrerIdxOpt}serialize(){return He(nt.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,h,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:!1}),v.push({pubkey:p,isSigner:!0,isWritable:!0}),v.push({pubkey:h,isSigner:!1,isWritable:!0}),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 e.TransactionInstruction({keys:v,programId:t,data:m})}}nt.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};const ot=new e.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),it=n.Buffer.from("tokenized_name"),st=t=>{const[r]=e.PublicKey.findProgramAddressSync([it,t.toBuffer()],ot);return r};var at;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(at||(at={}));class ct{constructor(t){this.tag=t.tag,this.nonce=t.nonce,this.nameAccount=new e.PublicKey(t.nameAccount),this.owner=new e.PublicKey(t.owner),this.nftMint=new e.PublicKey(t.nftMint)}static deserialize(e){return new ct(Ge(this.schema,e))}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new Error("NFT record not found");return this.deserialize(r.data)}static async findKey(t,r){return await e.PublicKey.findProgramAddress([n.Buffer.from("nft_record"),t.toBuffer()],r)}}ct.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 ut=async(t,r)=>{try{const n=st(r);if("0"===(await Ie(t,n)).supply.toString())return;const o=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],i=await t.getProgramAccounts(d,{filters:o});if(1!=i.length)return;return new e.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ft=e=>[{memcmp:{offset:32,bytes:e}},{memcmp:{offset:64,bytes:"2"}}],pt=async(e,t)=>{const r=await(async(e,t)=>{const r=[{memcmp:{offset:0,bytes:"3"}},{memcmp:{offset:66,bytes:t.toBase58()}}];return await e.getProgramAccounts(ot,{filters:r})})(e,t.mint);if(1===r.length)return ct.deserialize(r[0].account.data)},ht=async(e,t)=>{const r=[...ft(t.toBase58()),{dataSize:165}],n=(await e.getProgramAccounts(d,{filters:r})).map((e=>Ee.decode(e.account.data))).map((t=>pt(e,t)));return(await Promise.all(n)).filter((e=>void 0!==e))};class dt{constructor(t){this.parentName=new e.PublicKey(t.parentName),this.owner=new e.PublicKey(t.owner),this.class=new e.PublicKey(t.class)}static deserialize(e){const t=new dt(Ge(this.schema,e));return t.data=null==e?void 0:e.slice(this.HEADER_LEN),t}static async retrieve(e,t){var r;const n=await e.getAccountInfo(t);if(!n)throw new ke(exports.ErrorType.AccountDoesNotExist);const o=new dt(Ge(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 ut(e,t)}}static async _retrieveBatch(e,t){const r=await e.getMultipleAccountsInfo(t),n=e=>{if(!e)return;const t=new dt(Ge(this.schema,e));return t.data=null==e?void 0:e.slice(this.HEADER_LEN),t};return r.map((e=>n(null==e?void 0:e.data)))}static async retrieveBatch(e,t){let r=[];const n=[...t];for(;n.length>0;)r.push(...await this._retrieveBatch(e,n.splice(0,100)));return r}}function lt(e,...t){if(!function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function yt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}dt.HEADER_LEN=96,dt.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const gt="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
|
|
11
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function wt(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}const bt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),mt=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function vt(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function Et(e){if("string"==typeof e&&(e=vt(e)),!wt(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class xt{clone(){return this._cloneInto()}}function At(e){const t=t=>e().update(Et(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class St extends xt{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=bt(this.buffer)}update(e){yt(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=Et(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=bt(e);for(;n<=o-i;i+=n)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){yt(this),function(e,t){lt(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let e=i;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,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;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=bt(e),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 e=0;e<c;e++)s.setUint32(4*e,u[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}const It=(e,t,r)=>e&t^~e&r,Bt=(e,t,r)=>e&t^e&r^t&r,Rt=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]),Pt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),kt=new Uint32Array(64);class Tt extends St{constructor(){super(64,32,8,!1),this.A=0|Pt[0],this.B=0|Pt[1],this.C=0|Pt[2],this.D=0|Pt[3],this.E=0|Pt[4],this.F=0|Pt[5],this.G=0|Pt[6],this.H=0|Pt[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,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(e,t){for(let r=0;r<16;r++,t+=4)kt[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=kt[e-15],r=kt[e-2],n=mt(t,7)^mt(t,18)^t>>>3,o=mt(r,17)^mt(r,19)^r>>>10;kt[e]=o+kt[e-7]+n+kt[e-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(mt(s,6)^mt(s,11)^mt(s,25))+It(s,a,c)+Rt[e]+kt[e]|0,f=(mt(r,2)^mt(r,13)^mt(r,22))+Bt(r,n,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=n,n=r,r=t+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(){kt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const _t=At((()=>new Tt)),Ut=new e.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),Lt="SPL Name Service",Ct=new e.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Nt=new e.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ot=new e.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Dt=new e.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Wt=new e.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Mt=new e.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Vt=new e.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),zt=new e.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),Ft=new e.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),jt=[new e.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new e.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new e.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new e.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new e.PublicKey("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new e.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new e.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new e.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new e.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new e.PublicKey("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new e.PublicKey("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ"),new e.PublicKey("XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL")],Kt=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ht=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"}]]),Gt=new e.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),qt=new e.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Yt=new e.PublicKey("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),Xt=new e.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),Zt=new e.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),$t=new e.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Qt=new e.PublicKey("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT"),Jt=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]]]);async function er(e,t){if(!await e.getAccountInfo(t))throw new ke(exports.ErrorType.AccountDoesNotExist);return dt.retrieve(e,t)}async function tr(e){const t=Lt+e,r=_t(n.Buffer.from(t,"utf8"));return n.Buffer.from(r)}async function rr(t,r,o){const i=[t];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 e.PublicKey.findProgramAddress(i,Ut);return s}const nr=async(e,t=Ct)=>{let r=await tr(e);return{pubkey:await rr(r,void 0,t),hashed:r}},or=async(e,t=!1)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const r=e.split(".");if(2===r.length){const e=n.Buffer.from([t?1:0]).toString().concat(r[0]),{pubkey:o}=await nr(r[1]);return{...await nr(e,o),isSub:!0,parent:o}}if(3===r.length&&t){const{pubkey:e}=await nr(r[2]),{pubkey:t}=await nr("\0".concat(r[1]),e),o=n.Buffer.from([1]).toString();return{...await nr(o.concat(r[0]),t),isSub:!0,parent:e,isSubRecord:!0}}if(r.length>=3)throw new ke(exports.ErrorType.InvalidInput);return{...await nr(e,Ct),isSub:!1,parent:void 0}};var ir,sr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],ar=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var r=t.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===t[0]?"setFloat".concat(r):"i"===t[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,e,!0),this.offset+=n},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),cr=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),r=parseInt(t)/8;this.assert_enough_buffer(r);var n="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[n](this.offset,!0);return this.offset+=r,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),ur=(ir=function(e,t){return ir=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},ir(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}ir(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function fr(e,t,r){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(r.join(".")))}function pr(e,t,r){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(r.join(".")))}var hr=sr.concat(["bool","string"]),dr=["option","enum","array","set","map","struct"],lr=function(e){function t(t,r){var n="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(r);return e.call(this,n)||this}return ur(t,e),t}(Error);function yr(e){if("string"!=typeof e||!hr.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&dr.includes(t[0])){var r=t[0];if("option"===r)return yr(e[r]);if("enum"===r)return function(e){if(!Array.isArray(e))throw new lr(e,"Array");for(var t=0,r=e;t<r.length;t++){var n=r[t];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');yr({struct:n.struct})}}(e[r]);if("array"===r)return function(e){if("object"!=typeof e)throw new lr(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return yr(e.type);throw new lr(e,"{ type, len? }")}(e[r]);if("set"===r)return yr(e[r]);if("map"===r)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new lr(e,"{ key, value }");yr(e.key),yr(e.value)}(e[r]);if("struct"===r)return function(e){if("object"!=typeof e)throw new lr(e,"object");for(var t in e)yr(e[t])}(e[r])}}throw new lr(e,dr.join(", ")+" or "+hr.join(", "))}}var gr=function(){function e(e){this.encoded=new ar,this.fieldPath=["value"],this.checkTypes=e}return e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(sr.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var r=parseInt(t.substring(1));r<=32||"f64"==t?(this.checkTypes&&fr(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),r))},e.prototype.encode_bigint=function(e,t){for(var r=t/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_string=function(e){this.checkTypes&&fr(e,"string",this.fieldPath);var t=e;this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encoded.store_value(t.charCodeAt(r),"u8")},e.prototype.encode_boolean=function(e){this.checkTypes&&fr(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var r=Object.keys(e)[0],n=0;n<t.enum.length;n++){var o=t.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?pr(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encode_value(e[r],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?pr(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&fr(e,"object",this.fieldPath);var r=e instanceof Set?Array.from(e.values()):Object.values(e);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,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&fr(e,"object",this.fieldPath);var r=e instanceof Map,n=r?Array.from(e.keys()):Object.keys(e);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,t.map.key),this.encode_value(r?e.get(s):e[s],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&fr(e,"object",this.fieldPath);for(var r=0,n=Object.keys(t.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}},e}(),wr=function(){function e(e){this.buffer=new cr(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(sr.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var r=e/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&n[r-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e));return String.fromCharCode.apply(null,t)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,r=this.buffer.consume_value("u8");if(r>e.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=e.enum[r].struct,o=Object.keys(n)[0];return(t={})[o]=this.decode_value(n[o]),t},e.prototype.decode_array=function(e){for(var t=[],r=e.array.len?e.array.len:this.decode_integer("u32"),n=0;n<r;++n)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),r=new Set,n=0;n<t;++n)r.add(this.decode_value(e.set));return r},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),r=new Map,n=0;n<t;++n){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);r.set(o,i)}return r},e.prototype.decode_struct=function(e){var t={};for(var r in e.struct)t[r]=this.decode_value(e.struct[r]);return t},e}();function br(e,t,r){return void 0===r&&(r=!0),r&&yr(e),new gr(r).encode(t,e)}class mr{constructor(e){this.tag=1,this.record=e.record,this.content=e.content}serialize(){return br(mr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}mr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class vr{constructor(e){this.tag=4,this.validation=e.validation,this.signature=e.signature,this.expectedPubkey=e.expectedPubkey}serialize(){return br(vr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}vr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class Er{constructor(e){this.tag=3,this.staleness=e.staleness}serialize(){return br(Er.schema,this)}getInstruction(t,r,n,o,i,s,a,c,u){const f=Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:n,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!0,isWritable:!0}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!0}),p.push({pubkey:a,isSigner:!1,isWritable:!0}),p.push({pubkey:c,isSigner:!1,isWritable:!1}),p.push({pubkey:u,isSigner:!0,isWritable:!0}),new e.TransactionInstruction({keys:p,programId:t,data:f})}}Er.schema={struct:{tag:"u8",staleness:"bool"}};class xr{constructor(e){this.tag=2,this.record=e.record,this.content=e.content}serialize(){return br(xr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}xr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class Ar{constructor(){this.tag=5}serialize(){return br(Ar.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}Ar.schema={struct:{tag:"u8"}};class Sr{constructor(e){this.tag=6,this.roaId=e.roaId}serialize(){return br(Sr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}Sr.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const Ir=new e.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Br]=e.PublicKey.findProgramAddressSync([Ir.toBuffer()],Ir);var Rr,Pr;(Pr=Rr||(Rr={}))[Pr.None=0]="None",Pr[Pr.Solana=1]="Solana",Pr[Pr.Ethereum=2]="Ethereum",Pr[Pr.UnverifiedSolana=3]="UnverifiedSolana";const kr=e=>{switch(e){case Rr.None:return 0;case Rr.Ethereum:return 20;case Rr.Solana:case Rr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Tr{constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new Tr((t=this.schema,r=e,void 0===(n=!0)&&(n=!0),n&&yr(t),new wr(r).decode(t)));var t,r,n}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data.slice(96,96+this.LEN))}}Tr.LEN=8,Tr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class _r{constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=Tr.deserialize(e.slice(96,96+Tr.LEN)),r=e.slice(96+Tr.LEN);return new _r(t,r)}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data)}static async retrieveBatch(e,t){return(await e.getMultipleAccountsInfo(t)).map((e=>{if(null==e?void 0:e.data)return this.deserialize(e.data)}))}getContent(){let e=kr(this.header.stalenessValidation)+kr(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){let e=kr(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){let e=kr(this.header.stalenessValidation),t=e+kr(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}var Ur;exports.Record=void 0,(Ur=exports.Record||(exports.Record={})).IPFS="IPFS",Ur.ARWV="ARWV",Ur.SOL="SOL",Ur.ETH="ETH",Ur.BTC="BTC",Ur.LTC="LTC",Ur.DOGE="DOGE",Ur.Email="email",Ur.Url="url",Ur.Discord="discord",Ur.Github="github",Ur.Reddit="reddit",Ur.Twitter="twitter",Ur.Telegram="telegram",Ur.Pic="pic",Ur.SHDW="SHDW",Ur.POINT="POINT",Ur.BSC="BSC",Ur.Injective="INJ",Ur.Backpack="backpack",Ur.A="A",Ur.AAAA="AAAA",Ur.CNAME="CNAME",Ur.TXT="TXT",Ur.Background="background",Ur.BASE="BASE";const Lr=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 Cr;exports.RecordVersion=void 0,(Cr=exports.RecordVersion||(exports.RecordVersion={}))[Cr.V1=1]="V1",Cr[Cr.V2=2]="V2";var Nr="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=",Or="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Dr=0,Wr=-3;function Mr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Vr(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new Mr,this.dtree=new Mr}var zr=new Mr,Fr=new Mr,jr=new Uint8Array(30),Kr=new Uint16Array(30),Hr=new Uint8Array(30),Gr=new Uint16Array(30),qr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yr=new Mr,Xr=new Uint8Array(320);function Zr(e,t,r,n){var o,i;for(o=0;o<r;++o)e[o]=0;for(o=0;o<30-r;++o)e[o+r]=o/r|0;for(i=n,o=0;o<30;++o)t[o]=i,i+=1<<e[o]}var $r=new Uint16Array(16);function Qr(e,t,r,n){var o,i;for(o=0;o<16;++o)e.table[o]=0;for(o=0;o<n;++o)e.table[t[r+o]]++;for(e.table[0]=0,i=0,o=0;o<16;++o)$r[o]=i,i+=e.table[o];for(o=0;o<n;++o)t[r+o]&&(e.trans[$r[t[r+o]]++]=o)}function Jr(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function en(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,n+r}function tn(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=0,n=0,o=0,i=e.tag;do{n=2*n+(1&i),i>>>=1,++o,r+=t.table[o],n-=t.table[o]}while(n>=0);return e.tag=i,e.bitcount-=o,t.trans[r+n]}function rn(e,t,r){var n,o,i,s,a,c;for(n=en(e,5,257),o=en(e,5,1),i=en(e,4,4),s=0;s<19;++s)Xr[s]=0;for(s=0;s<i;++s){var u=en(e,3,0);Xr[qr[s]]=u}for(Qr(Yr,Xr,0,19),a=0;a<n+o;){var f=tn(e,Yr);switch(f){case 16:var p=Xr[a-1];for(c=en(e,2,3);c;--c)Xr[a++]=p;break;case 17:for(c=en(e,3,3);c;--c)Xr[a++]=0;break;case 18:for(c=en(e,7,11);c;--c)Xr[a++]=0;break;default:Xr[a++]=f}}Qr(t,Xr,0,n),Qr(r,Xr,n,o)}function nn(e,t,r){for(;;){var n,o,i,s,a=tn(e,t);if(256===a)return Dr;if(a<256)e.dest[e.destLen++]=a;else for(n=en(e,jr[a-=257],Kr[a]),o=tn(e,r),s=i=e.destLen-en(e,Hr[o],Gr[o]);s<i+n;++s)e.dest[e.destLen++]=e.dest[s]}}function on(e){for(var t,r;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return Wr;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,Dr}!function(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}(zr,Fr),Zr(jr,Kr,4,3),Zr(Hr,Gr,2,1),jr[28]=0,Kr[28]=258;var sn=function(e,t){var r,n,o=new Vr(e,t);do{switch(r=Jr(o),en(o,2,0)){case 0:n=on(o);break;case 1:n=nn(o,zr,Fr);break;case 2:rn(o,o.ltree,o.dtree),n=nn(o,o.ltree,o.dtree);break;default:n=Wr}if(n!==Dr)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 an=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],cn=(e,t,r)=>{let n=e[t];e[t]=e[r],e[r]=n};var un={swap32LE:e=>{an&&(e=>{const t=e.length;for(let r=0;r<t;r+=4)cn(e,r,r+3),cn(e,r+1,r+2)})(e)}};const fn=sn,{swap32LE:pn}=un;var hn=class{constructor(e){const t="function"==typeof e.readUInt32BE&&"function"==typeof e.slice;if(t||e instanceof Uint8Array){let r;if(t)this.highStart=e.readUInt32LE(0),this.errorValue=e.readUInt32LE(4),r=e.readUInt32LE(8),e=e.slice(12);else{const t=new DataView(e.buffer);this.highStart=t.getUint32(0,!0),this.errorValue=t.getUint32(4,!0),r=t.getUint32(8,!0),e=e.subarray(12)}e=fn(e,new Uint8Array(r)),e=fn(e,new Uint8Array(r)),pn(e),this.data=new Uint32Array(e.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=e)}get(e){let t;return e<0||e>1114111?this.errorValue:e<55296||e>56319&&e<=65535?(t=(this.data[e>>5]<<2)+(31&e),this.data[t]):e<=65535?(t=(this.data[2048+(e-55296>>5)]<<2)+(31&e),this.data[t]):e<this.highStart?(t=this.data[2080+(e>>11)],t=this.data[t+(e>>5&63)],t=(t<<2)+(31&e),this.data[t]):this.data[this.data.length-4]}},dn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,dn.exports=function(){var e="3.7.5",t=e,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(e){var t={};return e.forEach((function(e,r){return t[e]=r})),t}(c),f=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,p=String.fromCharCode.bind(String),h="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(e){return new Uint8Array(Array.prototype.slice.call(e,0))},d=function(e){return e.replace(/=/g,"").replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"}))},l=function(e){return e.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(e){for(var t,r,n,o,i="",s=e.length%3,a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");i+=c[(t=r<<16|n<<8|o)>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}return s?i.slice(0,s-3)+"===".substring(s):i},g=n?function(e){return btoa(e)}:o?function(e){return Buffer.from(e,"binary").toString("base64")}:y,w=o?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=4096,r=[],n=0,o=e.length;n<o;n+=t)r.push(p.apply(null,e.subarray(n,n+t)));return g(r.join(""))},b=function(e,t){return void 0===t&&(t=!1),t?d(w(e)):w(e)},m=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?p(192|t>>>6)+p(128|63&t):p(224|t>>>12&15)+p(128|t>>>6&63)+p(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return p(240|t>>>18&7)+p(128|t>>>12&63)+p(128|t>>>6&63)+p(128|63&t)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,E=function(e){return e.replace(v,m)},x=o?function(e){return Buffer.from(e,"utf8").toString("base64")}:s?function(e){return w(s.encode(e))}:function(e){return g(E(e))},A=function(e,t){return void 0===t&&(t=!1),t?d(x(e)):x(e)},S=function(e){return A(e,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return p(55296+(t>>>10))+p(56320+(1023&t));case 3:return p((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return p((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},R=function(e){return e.replace(I,B)},P=function(e){if(e=e.replace(/\s+/g,""),!f.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));for(var t,r,n,o="",i=0;i<e.length;)t=u[e.charAt(i++)]<<18|u[e.charAt(i++)]<<12|(r=u[e.charAt(i++)])<<6|(n=u[e.charAt(i++)]),o+=64===r?p(t>>16&255):64===n?p(t>>16&255,t>>8&255):p(t>>16&255,t>>8&255,255&t);return o},k=r?function(e){return atob(l(e))}:o?function(e){return Buffer.from(e,"base64").toString("binary")}:P,T=o?function(e){return h(Buffer.from(e,"base64"))}:function(e){return h(k(e).split("").map((function(e){return e.charCodeAt(0)})))},_=function(e){return T(L(e))},U=o?function(e){return Buffer.from(e,"base64").toString("utf8")}:i?function(e){return i.decode(T(e))}:function(e){return R(k(e))},L=function(e){return l(e.replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})))},C=function(e){return U(L(e))},N=function(e){if("string"!=typeof e)return!1;var t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},O=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}},D=function(){var e=function(e,t){return Object.defineProperty(String.prototype,e,O(t))};e("fromBase64",(function(){return C(this)})),e("toBase64",(function(e){return A(this,e)})),e("toBase64URI",(function(){return A(this,!0)})),e("toBase64URL",(function(){return A(this,!0)})),e("toUint8Array",(function(){return _(this)}))},W=function(){var e=function(e,t){return Object.defineProperty(Uint8Array.prototype,e,O(t))};e("toBase64",(function(e){return b(this,e)})),e("toBase64URI",(function(){return b(this,!0)})),e("toBase64URL",(function(){return b(this,!0)}))},M=function(){D(),W()},V={version:e,VERSION:t,atob:k,atobPolyfill:P,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:A,encode:A,encodeURI:S,encodeURL:S,utob:E,btou:R,decode:C,isValid:N,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:W,extendBuiltins:M,Base64:{}};return Object.keys(V).forEach((function(e){return V.Base64[e]=V[e]})),V}();const ln={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},yn=Nr,gn=Or,wn=hn,bn=dn.exports.Base64,mn=new wn(bn.toUint8Array(yn)),vn=new wn(bn.toUint8Array(gn));function En(e,t){return 0!=(e&t)}const xn=0,An=1,Sn=2;function In(e,t){const r=e.length;let n=0,o=xn;for(let i=t;i+1<r;i++){const r=e[i+0],s=e[i+1];switch(En(r,ln.Regional_Indicator)||(n=0),o){case Sn:case xn:o=En(r,ln.Extended_Pictographic)?An:xn;break;case An:o=En(r,ln.Extend)?An:En(r,ln.ZWJ)&&En(s,ln.Extended_Pictographic)?Sn:xn}if(!En(r,ln.CR)||!En(s,ln.LF)){if(En(r,ln.Control|ln.CR|ln.LF))return i+1-t;if(En(s,ln.Control|ln.CR|ln.LF))return i+1-t;if(!(En(r,ln.L)&&En(s,ln.L|ln.V|ln.LV|ln.LVT)||En(r,ln.LV|ln.V)&&En(s,ln.V|ln.T)||En(r,ln.LVT|ln.T)&&En(s,ln.T)||En(s,ln.Extend|ln.ZWJ)||En(s,ln.SpacingMark)||En(r,ln.Prepend)||o===Sn)){if(!En(r,ln.Regional_Indicator)||!En(s,ln.Regional_Indicator)||n%2!=0)return i+1-t;n++}}}return r-t}var Bn=function(e){const t=[],r=[0],n=[];for(let t=0;t<e.length;){const o=e.codePointAt(t);n.push(mn.get(o)|vn.get(o)),t+=o>65535?2:1,r.push(t)}for(let o=0;o<n.length;){const i=In(n,o),s=r[o],a=r[o+i];t.push(e.slice(s,a)),o+=i}return t},Rn=r(Bn);const Pn=e=>{const t=Lt+e,r=_t(n.Buffer.from(t,"utf8"));return n.Buffer.from(r)},kn=(t,r,o)=>{const i=[t];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=e.PublicKey.findProgramAddressSync(i,Ut);return s};async function Tn(e,t){const r=Pn(t.toBase58()),n=kn(r,Wt),{registry:o}=await dt.retrieve(e,n);if(!o.data)throw new ke(exports.ErrorType.NoAccountData);return Wn(o.data)}async function _n(e,t){let r=[];for(let e of t){const t=Pn(e.toBase58()),n=kn(t,Wt);r.push(n)}return(await dt.retrieveBatch(e,r)).map((e=>{if(void 0!==e&&void 0!==e.data)return Wn(e.data)}))}const Un=(e,t=Ct,r)=>{let n=Pn(e);return{pubkey:kn(n,r,t),hashed:n}},Ln=(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const r=t===exports.RecordVersion.V2?Br:void 0,o=e.split(".");if(2===o.length){const e=n.Buffer.from([t||0]).toString().concat(o[0]),{pubkey:i}=Un(o[1]);return{...Un(e,i,r),isSub:!0,parent:i}}if(3===o.length&&t){const{pubkey:e}=Un(o[2]),{pubkey:n}=Un("\0".concat(o[1]),e),i=t===exports.RecordVersion.V2?"":"";return{...Un(i.concat(o[0]),n,r),isSub:!0,parent:e,isSubRecord:!0}}if(o.length>=3)throw new ke(exports.ErrorType.InvalidInput);return{...Un(e,Ct),isSub:!1,parent:void 0}};async function Cn(e,t){const r=[{memcmp:{offset:32,bytes:t.toBase58()}},{memcmp:{offset:0,bytes:Ct.toBase58()}}];return(await e.getProgramAccounts(Ut,{filters:r})).map((e=>e.pubkey))}const Nn=(e,t)=>{const{pubkey:r,parent:n}=Ln(e),o=Pn(r.toBase58());return kn(o,Wt,t?n:void 0)},On=(e,t)=>{const r=Pn(e.toBase58());return kn(r,Wt,t)},Dn=(e,t)=>{if(!e)throw new ke(t)};function Wn(e){if(!e)return;const t=e.slice(0,4).readUInt32LE(0);return e.slice(4,4+t).toString()}const Mn=(t,r)=>{const o=n.Buffer.alloc(2);return o.writeUint16LE(t),e.PublicKey.findProgramAddressSync([o,n.Buffer.from(r)],Qt)};var Vn=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),i=o.charCodeAt(0);if(255!==t[i])throw new TypeError(o+" is ambiguous");t[i]=n}var s=e.length,a=e.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,o=0;e[r]===a;)n++,r++;for(var i=(e.length-r)*c+1>>>0,u=new Uint8Array(i);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var p=0,h=i-1;(0!==f||p<o)&&-1!==h;h--,p++)f+=s*u[h]>>>0,u[h]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=p,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(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var c=(i-o)*u+1>>>0,f=new Uint8Array(c);o!==i;){for(var p=t[o],h=0,d=c-1;(0!==p||h<n)&&-1!==d;d--,h++)p+=256*f[d]>>>0,f[d]=p%s>>>0,p=p/s>>>0;if(0!==p)throw new Error("Non-zero carry");n=h,o++}for(var l=c-n;l!==c&&0===f[l];)l++;for(var y=a.repeat(r);l<c;++l)y+=e.charAt(f[l]);return y},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+s+" character")}}};var zn,Fn=Vn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),jn={exports:{}};zn=jn,function(e){const t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"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(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${t}\\.${t}\\.${t}\\.${t}(${i})?$`,"i")};function c(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,o=0,i=-1,s=(e.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)o++;if("::"===e.substr(0,2)&&o--,"::"===e.substr(-2,2)&&o--,o>t)return null;for(n=t-o,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),{parts:t,zoneId:s}}function u(e,t,r,n){if(e.length!==t.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),e[i]>>o!=t[i]>>o)return!1;n-=r,i+=1}return!0}function f(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(n.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function p(e,t){for(;e.length<t;)e=`0${e}`;return e}const h={};h.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!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],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),h.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[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(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(e){return null!==this.parser(e)},h.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},h.IPv4.isValidFourPartDecimal=function(e){return!(!h.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(e){let t,r,n,o,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},h.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(e){let t,n,o;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(f(n));return r}();if(t=e.match(r.longValue)){if(o=f(t[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(o>>t&255);return e}().reverse()}return(t=e.match(r.twoOctet))?function(){const e=t.slice(1,4),r=[];if(o=f(e[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(e[0])),r.push(o>>16&255),r.push(o>>8&255),r.push(255&o),r}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),r=[];if(o=f(e[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(e[0])),r.push(f(e[1])),r.push(o>>8&255),r.push(255&o),r}():null},h.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.IPv6=function(){function e(e,t){let r,n;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}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");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[new e([8193,4,274,0,0,0,0,0]),48],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!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],t&&0!==o)return null;16!==o&&(t=!0),e+=o}return 128-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n<r.length;n++)e=r[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(p(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new h.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,n=0,o=-1;for(;r=e.exec(t);)r[0].length>o&&(n=r.index,o=r[0].length);return o<0?t:`${t.substring(0,n)}::${t.substring(n+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),h.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[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(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.isIPv6=function(e){return null!==this.parser(e)},h.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},h.IPv6.networkAddressFromCIDR=function(e){let t,r,n,o,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},h.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(e){let t,r,n,o,i,s;if(n=e.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(e))return c(e,8);if((n=e.match(a.transitional))&&(s=n[6]||"",t=c(n[1].slice(0,-1)+s,6),t.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 t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.fromByteArray=function(e){const t=e.length;if(4===t)return new h.IPv4(e);if(16===t)return new h.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(e){return h.IPv6.isValid(e)||h.IPv4.isValid(e)},h.parse=function(e){if(h.IPv6.isValid(e))return h.IPv6.parse(e);if(h.IPv4.isValid(e))return h.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(e){try{return h.IPv6.parseCIDR(e)}catch(t){try{return h.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},h.subnetMatch=function(e,t,r){let n,o,i,s;for(o in null==r&&(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,o))for(i=t[o],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(s=i[n],e.kind()===s[0].kind()&&e.match.apply(e,s))return o;return r},zn.exports?zn.exports=h:e.ipaddr=h}(t);var Kn=jn.exports;const Hn=2147483647,Gn=36,qn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Yn=Math.floor,Xn=String.fromCharCode;function Zn(e){throw new RangeError(qn[e])}const $n=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},Qn=function(e,t,r){let n=0;for(e=r?Yn(e/700):e>>1,e+=Yn(e/t);e>455;n+=Gn)e=Yn(e/35);return Yn(n+36*e/(e+38))},Jn=function(e){const t=[],r=e.length;let n=0,o=128,i=72,s=e.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)e.charCodeAt(r)>=128&&Zn("not-basic"),t.push(e.charCodeAt(r));for(let c=s>0?s+1:0;c<r;){const s=n;for(let t=1,o=Gn;;o+=Gn){c>=r&&Zn("invalid-input");const s=(a=e.charCodeAt(c++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:Gn;s>=Gn&&Zn("invalid-input"),s>Yn((Hn-n)/t)&&Zn("overflow"),n+=s*t;const u=o<=i?1:o>=i+26?26:o-i;if(s<u)break;const f=Gn-u;t>Yn(Hn/f)&&Zn("overflow"),t*=f}const u=t.length+1;i=Qn(n-s,u,0==s),Yn(n/u)>Hn-o&&Zn("overflow"),o+=Yn(n/u),n%=u,t.splice(n++,0,o)}var a;return String.fromCodePoint(...t)},eo=function(e){const t=[];e=function(e){const t=[];let r=0;const n=e.length;for(;r<n;){const o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){const n=e.charCodeAt(r++);56320==(64512&n)?t.push(((1023&o)<<10)+(1023&n)+65536):(t.push(o),r--)}else t.push(o)}return t}(e);const r=e.length;let n=128,o=0,i=72;for(const r of e)r<128&&t.push(Xn(r));const s=t.length;let a=s;for(s&&t.push("-");a<r;){let r=Hn;for(const t of e)t>=n&&t<r&&(r=t);const c=a+1;r-n>Yn((Hn-o)/c)&&Zn("overflow"),o+=(r-n)*c,n=r;for(const r of e)if(r<n&&++o>Hn&&Zn("overflow"),r===n){let e=o;for(let r=Gn;;r+=Gn){const n=r<=i?1:r>=i+26?26:r-i;if(e<n)break;const o=e-n,s=Gn-n;t.push(Xn($n(n+o%s,0))),e=Yn(o/s)}t.push(Xn($n(e,0))),i=Qn(o,c,a===s),o=0,++a}++o,++n}return t.join("")},to=BigInt(2**32-1),ro=BigInt(32);function no(e,t=!1){return t?{h:Number(e&to),l:Number(e>>ro&to)}:{h:0|Number(e>>ro&to),l:0|Number(e&to)}}const oo={fromBig:no,split:function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=no(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(e,t)=>BigInt(e>>>0)<<ro|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:function(e,t,r,n){const o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:0|o}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,add5H:(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0,add5L:(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0)};var io=oo;const[so,ao]=(()=>io.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((e=>BigInt(e)))))(),co=new Uint32Array(80),uo=new Uint32Array(80);class fo extends St{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:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:f,Fl:p,Gh:h,Gl:d,Hh:l,Hl:y}=this;return[e,t,r,n,o,i,s,a,c,u,f,p,h,d,l,y]}set(e,t,r,n,o,i,s,a,c,u,f,p,h,d,l,y){this.Ah=0|e,this.Al=0|t,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|p,this.Gh=0|h,this.Gl=0|d,this.Hh=0|l,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)co[r]=e.getUint32(t),uo[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|co[e-15],r=0|uo[e-15],n=io.rotrSH(t,r,1)^io.rotrSH(t,r,8)^io.shrSH(t,r,7),o=io.rotrSL(t,r,1)^io.rotrSL(t,r,8)^io.shrSL(t,r,7),i=0|co[e-2],s=0|uo[e-2],a=io.rotrSH(i,s,19)^io.rotrBH(i,s,61)^io.shrSH(i,s,6),c=io.rotrSL(i,s,19)^io.rotrBL(i,s,61)^io.shrSL(i,s,6),u=io.add4L(o,c,uo[e-7],uo[e-16]),f=io.add4H(u,n,a,co[e-7],co[e-16]);co[e]=0|f,uo[e]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:p,Fh:h,Fl:d,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let e=0;e<80;e++){const t=io.rotrSH(f,p,14)^io.rotrSH(f,p,18)^io.rotrBH(f,p,41),b=io.rotrSL(f,p,14)^io.rotrSL(f,p,18)^io.rotrBL(f,p,41),m=f&h^~f&l,v=p&d^~p&y,E=io.add5L(w,b,v,ao[e],uo[e]),x=io.add5H(E,g,t,m,so[e],co[e]),A=0|E,S=io.rotrSH(r,n,28)^io.rotrBH(r,n,34)^io.rotrBH(r,n,39),I=io.rotrSL(r,n,28)^io.rotrBL(r,n,34)^io.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|h,y=0|d,h=0|f,d=0|p,({h:f,l:p}=io.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=io.add3L(A,I,R);r=io.add3H(P,x,S,B),n=0|P}({h:r,l:n}=io.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=io.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=io.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=io.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:p}=io.add(0|this.Eh,0|this.El,0|f,0|p)),({h:h,l:d}=io.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:l,l:y}=io.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=io.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,p,h,d,l,y,g,w)}roundClean(){co.fill(0),uo.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 po=At((()=>new fo));
|
|
10
|
+
!function(e){const t=o,r=d,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function s(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=s(r);const o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);const o=function(e){if(a.isBuffer(e)){const t=0|l(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return u(e),s(e<0?0:0|l(e))}function p(e){const t=e.length<0?0:0|l(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,a.prototype),n}function l(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function y(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(o)return n?-1:G(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function w(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,o){let i,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let n=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-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(e,i+n)!==u(t,n)){r=!1;break}if(r)return i}return-1}function v(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=t.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Z(n))return s;e[r+s]=n}return s}function E(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function x(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function A(e,t,r,n){return Y(q(t),e,r,n)}function S(e,t,r,n){return Y(function(e,t){let r,n,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function I(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function B(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:r=e[o+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(i=c));break;case 3:r=e[o+1],n=e[o+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[o+1],n=e[o+2],a=e[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<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(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=R));return r}(n)}e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),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(e,t,r){return c(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},a.allocUnsafe=function(e){return f(e)},a.allocUnsafeSlow=function(e){return f(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=a.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(X(t,Uint8Array))o+t.length>n.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!a.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)w(this,t,t+1);return this},a.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},a.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},a.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?B(this,0,e):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const c=Math.min(i,s),u=this.slice(n,o),f=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==f[e]){i=u[e],s=f[e];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>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,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return x(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,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(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function k(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function T(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=t;n<r;++n)o+=$[e[n]];return o}function _(e,t,r){const n=e.slice(t,r);let o="";for(let e=0;e<n.length-1;e+=2)o+=String.fromCharCode(n[e]+256*n[e+1]);return o}function U(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,o,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function C(e,t,r,n,o){F(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function N(e,t,r,n,o){F(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function O(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,n,o,i){return t=+t,n>>>=0,i||O(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function W(e,t,n,o,i){return t=+t,n>>>=0,i||O(e,0,n,8),r.write(e,t,n,o,52,8),n+8}a.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),a.prototype.readBigUInt64BE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=t,o=1,i=this[e+--n];for(;n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),a.prototype.readBigInt64BE=Q((function(e){j(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||K(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||U(e,4,this.length),r.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||U(e,4,this.length),r.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||U(e,8,this.length),r.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||U(e,8,this.length),r.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=Q((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let o=0,i=1,s=0;for(this[t]=255&e;++o<r&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=Q((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);const o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=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===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{const i=a.isBuffer(e)?e:a.from(e,n),s=i.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=i[o%s]}return this};const M={};function V(e,t,r){M[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,o,i){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===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}`:`>= ${t}${n} and <= ${r}${n}`,new M.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){j(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||K(t,e.length-(r+1))}(n,o,i)}function j(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,r){if(Math.floor(e)!==e)throw j(e,r),new M.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" 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 ${t}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const n=e.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const $=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}}(n);const h=new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new e.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const l=new e.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new e.PublicKey("So11111111111111111111111111111111111111112"),new e.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=ee=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=re=y.blob=y.unionLayoutDiscriminator=y.union=y.seq=y.bits=te=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(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function b(e){return w(e),g.Buffer.from(e.buffer,e.byteOffset,e.length)}y.checkUint8Array=w,y.uint8ArrayToBuffer=b;class m{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function v(e,t){return t.property?e+"["+t.property+"]":e}y.Layout=m,y.nameWithProperty=v,y.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof m))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,r)=>t.decode(e,r),writable:!0})};class E extends m{isCount(){throw new Error("ExternalLayout is abstract")}}y.ExternalLayout=E;class x extends E{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){w(e);const r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}}y.GreedyCount=x;class A extends E{constructor(e,t=0,r){if(!(e instanceof m))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof S||this.layout instanceof I}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}y.OffsetLayout=A;class S extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readUIntLE(t,this.span)}encode(e,t,r=0){return b(t).writeUIntLE(e,r,this.span),this.span}}y.UInt=S;class I extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readUIntBE(t,this.span)}encode(e,t,r=0){return b(t).writeUIntBE(e,r,this.span),this.span}}y.UIntBE=I;class B extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readIntLE(t,this.span)}encode(e,t,r=0){return b(t).writeIntLE(e,r,this.span),this.span}}y.Int=B;class R extends m{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return b(e).readIntBE(t,this.span)}encode(e,t,r=0){return b(t).writeIntBE(e,r,this.span),this.span}}y.IntBE=R;const P=Math.pow(2,32);function k(e){const t=Math.floor(e/P);return{hi32:t,lo32:e-t*P}}function T(e,t){return e*P+t}class _ extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e),n=r.readUInt32LE(t);return T(r.readUInt32LE(t+4),n)}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeUInt32LE(n.lo32,r),o.writeUInt32LE(n.hi32,r+4),8}}y.NearUInt64=_;class U extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e);return T(r.readUInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeUInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearUInt64BE=U;class L extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e),n=r.readUInt32LE(t);return T(r.readInt32LE(t+4),n)}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeUInt32LE(n.lo32,r),o.writeInt32LE(n.hi32,r+4),8}}y.NearInt64=L;class C extends m{constructor(e){super(8,e)}decode(e,t=0){const r=b(e);return T(r.readInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){const n=k(e),o=b(t);return o.writeInt32BE(n.hi32,r),o.writeUInt32BE(n.lo32,r+4),8}}y.NearInt64BE=C;class N extends m{constructor(e){super(4,e)}decode(e,t=0){return b(e).readFloatLE(t)}encode(e,t,r=0){return b(t).writeFloatLE(e,r),4}}y.Float=N;class O extends m{constructor(e){super(4,e)}decode(e,t=0){return b(e).readFloatBE(t)}encode(e,t,r=0){return b(t).writeFloatBE(e,r),4}}y.FloatBE=O;class D extends m{constructor(e){super(8,e)}decode(e,t=0){return b(e).readDoubleLE(t)}encode(e,t,r=0){return b(t).writeDoubleLE(e,r),8}}y.Double=D;class W extends m{constructor(e){super(8,e)}decode(e,t=0){return b(e).readDoubleBE(t)}encode(e,t,r=0){return b(t).writeDoubleBE(e,r),8}}y.DoubleBE=W;class M extends m{constructor(e,t,r){if(!(e instanceof m))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof E&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(t instanceof E)&&0<e.span&&(n=t*e.span),super(n,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof E&&(n=n.decode(e,t)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let o=0;for(;o<n;)r+=this.elementLayout.getSpan(e,t+r),++o}return r}decode(e,t=0){const r=[];let n=0,o=this.count;for(o instanceof E&&(o=o.decode(e,t));n<o;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),n+=1;return r}encode(e,t,r=0){const n=this.elementLayout,o=e.reduce(((e,o)=>e+n.encode(o,t,r+e)),0);return this.count instanceof E&&this.count.encode(e.length,t,r),o}}y.Sequence=M;class V extends m{constructor(e,t,r){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof m),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===r&&(r=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const o=n.getSpan(e,t);return t+=o,r+o}),0)}catch(e){throw new RangeError("indeterminate span")}return r}decode(e,t=0){w(e);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,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=e[n.property];void 0!==o&&(i=n.encode(o,t,r),0>s&&(s=n.getSpan(t,r)))}o=r,r+=s}return o+i-n}fromArray(e){const t=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}y.Structure=V;class z{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}}y.UnionDiscriminator=z;class F extends z{constructor(e,t){if(!(e instanceof E&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}y.UnionLayoutDiscriminator=F;class j extends m{constructor(e,t,r){let n;if(e instanceof S||e instanceof I)n=new F(new A(e));else if(e instanceof E&&e.isCount())n=new F(e);else{if(!(e instanceof z))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=e}if(void 0===t&&(t=null),!(null===t||t instanceof m))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&(e instanceof S||e instanceof I)&&(o+=n.layout.span)),super(o,r),this.discriminator=n,this.usesPrefixDiscriminator=e instanceof S||e instanceof I,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return i(e)},this.configGetSourceVariant=function(e){i=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;const r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(const t in this.registry){const r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r;const n=this.discriminator,o=n.decode(e,t),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(e,t+s)}else r=i.decode(e,t);return r}encode(e,t,r=0){const n=this.getSourceVariant(e);if(void 0===n){const n=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=n.layout.span),n.encode(e[n.property],t,r),i+o.encode(e[o.property],t,r+i)}return n.encode(e,t,r)}addVariant(e,t,r){const n=new K(this,e,t,r);return this.registry[e]=n,n}getVariant(e,t=0){let r;return r=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[r]}}y.Union=j;class K extends m{constructor(e,t,r,n){if(!(e instanceof j))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)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!==e.defaultLayout&&0<=r.span&&r.span>e.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=e.span;0>e.span&&(o=r?r.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,n),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=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(e,t+r)),r+n}decode(e,t=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))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(e,t+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let o=n;if(this.layout&&(this.layout.encode(e[this.property],t,r+n),o+=this.layout.getSpan(t,r+n),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function H(e){return 0>e&&(e+=4294967296),e}y.VariantLayout=K;class G extends m{constructor(e,t,r){if(!(e instanceof S||e instanceof I))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let n=0;this._packedSetValue=function(e){return n=H(e),this},this._packedGetValue=function(){return n}}decode(e,t=0){const r=this.makeDestinationObject(),n=this.word.decode(e,t);this._packedSetValue(n);for(const t of this.fields)void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){const n=this.word.decode(t,r);this._packedSetValue(n);for(const t of this.fields)if(void 0!==t.property){const r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){const r=new q(this,e,t);return this.fields.push(r),r}addBoolean(e){const t=new Y(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}y.BitStructure=G;class q{constructor(e,t,r){if(!(e instanceof G))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const n=8*e.span,o=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+o>n)throw new Error("bits too long for span remainder ("+(n-o)+" of "+n+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=n-o-t),this.wordMask=H(this.valueMask<<this.start),this.property=r}decode(e,t){return H(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==H(e&this.valueMask))throw new TypeError(v("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),r=H(e<<this.start);this.container._packedSetValue(H(t&~this.wordMask)|r)}}y.BitField=q;class Y extends q{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e=+e),super.encode(e)}}y.Boolean=Y;class X extends m{constructor(e,t){if(!(e instanceof E&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof E||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),b(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof E&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw new TypeError(v("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw new RangeError("encoding overruns Uint8Array");const o=b(e);return b(t).write(o.toString("hex"),r,n,"hex"),this.length instanceof E&&this.length.encode(n,t,r),n}}y.Blob=X;class Z extends m{constructor(e){super(-1,e)}getSpan(e,t=0){w(e);let r=t;for(;r<e.length&&0!==e[r];)r+=1;return 1+r-t}decode(e,t=0){const r=this.getSpan(e,t);return b(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));const n=g.Buffer.from(e,"utf8"),o=n.length;if(r+o>t.length)throw new RangeError("encoding overruns Buffer");const i=b(t);return n.copy(i,r),i[r+o]=0,o+1}}y.CString=Z;class $ extends m{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return w(e),e.length-t}decode(e,t=0){const r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return b(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));const n=g.Buffer.from(e,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(r+o>t.length)throw new RangeError("encoding overruns Buffer");return n.copy(b(t),r),o}}y.UTF8=$;class Q extends m{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}}y.Constant=Q,y.greedy=(e,t)=>new x(e,t),y.offset=(e,t,r)=>new A(e,t,r);var J=y.u8=e=>new S(1,e);y.u16=e=>new S(2,e),y.u24=e=>new S(3,e);var ee=y.u32=e=>new S(4,e);y.u40=e=>new S(5,e),y.u48=e=>new S(6,e),y.nu64=e=>new _(e),y.u16be=e=>new I(2,e),y.u24be=e=>new I(3,e),y.u32be=e=>new I(4,e),y.u40be=e=>new I(5,e),y.u48be=e=>new I(6,e),y.nu64be=e=>new U(e),y.s8=e=>new B(1,e),y.s16=e=>new B(2,e),y.s24=e=>new B(3,e),y.s32=e=>new B(4,e),y.s40=e=>new B(5,e),y.s48=e=>new B(6,e),y.ns64=e=>new L(e),y.s16be=e=>new R(2,e),y.s24be=e=>new R(3,e),y.s32be=e=>new R(4,e),y.s40be=e=>new R(5,e),y.s48be=e=>new R(6,e),y.ns64be=e=>new C(e),y.f32=e=>new N(e),y.f32be=e=>new O(e),y.f64=e=>new D(e),y.f64be=e=>new W(e);var te=y.struct=(e,t,r)=>new V(e,t,r);y.bits=(e,t,r)=>new G(e,t,r),y.seq=(e,t,r)=>new M(e,t,r),y.union=(e,t,r)=>new j(e,t,r),y.unionLayoutDiscriminator=(e,t)=>new F(e,t);var re=y.blob=(e,t)=>new X(e,t);y.cstr=e=>new Z(e),y.utf8=(e,t)=>new $(e,t),y.constant=(e,t)=>new Q(e,t);const ne=e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)});var oe={};Object.defineProperty(oe,"__esModule",{value:!0});var ie=oe.toBigIntLE=function(e){{const t=Buffer.from(e);t.reverse();const r=t.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};oe.toBigIntBE=function(e){{const t=e.toString("hex");return 0===t.length?BigInt(0):BigInt(`0x${t}`)}};var se=oe.toBufferLE=function(e,t){{const r=e.toString(16),n=Buffer.from(r.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};oe.toBufferBE=function(e,t){{const r=e.toString(16);return Buffer.from(r.padStart(2*t,"0").slice(0,2*t),"hex")}};const ae=(ce=8,e=>{const t=re(ce,e),{encode:r,decode:n}=ne(t),o=t;return o.decode=(e,t)=>{const r=n(e,t);return ie(Buffer.from(r))},o.encode=(e,t,n)=>{const o=se(e,ce);return r(o,t,n)},o});var ce;const ue=e=>{const t=J(e),{encode:r,decode:n}=ne(t),o=t;return o.decode=(e,t)=>!!n(e,t),o.encode=(e,t,n)=>{const o=Number(e);return r(o,t,n)},o},fe=t=>{const r=re(32,t),{encode:n,decode:o}=ne(r),i=r;return i.decode=(t,r)=>{const n=o(t,r);return new e.PublicKey(n)},i.encode=(e,t,r)=>{const o=e.toBuffer();return n(o,t,r)},i};class pe extends Error{constructor(e){super(e)}}class de extends pe{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class he extends pe{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class le extends pe{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class ye extends pe{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class ge extends pe{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var we;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Mint=1]="Mint",e[e.Account=2]="Account"}(we||(we={}));const be=1,me=te([J("m"),J("n"),ue("isInitialized"),fe("signer1"),fe("signer2"),fe("signer3"),fe("signer4"),fe("signer5"),fe("signer6"),fe("signer7"),fe("signer8"),fe("signer9"),fe("signer10"),fe("signer11")]).span;var ve;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen"}(ve||(ve={}));const Ee=te([fe("mint"),fe("owner"),ae("amount"),ee("delegateOption"),fe("delegate"),J("state"),ee("isNativeOption"),ae("isNative"),ae("delegatedAmount"),ee("closeAuthorityOption"),fe("closeAuthority")]),xe=Ee.span,Ae=te([ee("mintAuthorityOption"),fe("mintAuthority"),ae("supply"),J("decimals"),ue("isInitialized"),ee("freezeAuthorityOption"),fe("freezeAuthority")]),Se=Ae.span;async function Ie(e,t,r,n=h){return function(e,t,r=h){if(!t)throw new de;if(!t.owner.equals(r))throw new he;if(t.data.length<Se)throw new le;const n=Ae.decode(t.data.slice(0,Se));let o=Buffer.alloc(0);if(t.data.length>Se){if(t.data.length<=xe)throw new le;if(t.data.length===me)throw new le;if(t.data[xe]!=we.Mint)throw new ye;o=t.data.slice(xe+be)}return{address:e,mintAuthority:n.mintAuthorityOption?n.mintAuthority:null,supply:n.supply,decimals:n.decimals,isInitialized:n.isInitialized,freezeAuthority:n.freezeAuthorityOption?n.freezeAuthority:null,tlvData:o}}(t,await e.getAccountInfo(t,r),n)}function Be(t,r,n=!1,o=h,i=l){if(!n&&!e.PublicKey.isOnCurve(r.toBuffer()))throw new ge;const[s]=e.PublicKey.findProgramAddressSync([r.toBuffer(),o.toBuffer(),t.toBuffer()],i);return s}function Re(t,r,n,o,i=h,s=l){return function(t,r,n,o,i,s=h,a=l){const c=[{pubkey:t,isSigner:!0,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:e.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:c,programId:a,data:i})}(t,r,n,o,Buffer.from([1]),i,s)}var Pe;exports.ErrorType=void 0,(Pe=exports.ErrorType||(exports.ErrorType={})).SymbolNotFound="SymbolNotFound",Pe.InvalidSubdomain="InvalidSubdomain",Pe.FavouriteDomainNotFound="FavouriteDomainNotFound",Pe.MissingParentOwner="MissingParentOwner",Pe.U32Overflow="U32Overflow",Pe.InvalidBufferLength="InvalidBufferLength",Pe.U64Overflow="U64Overflow",Pe.NoRecordData="NoRecordData",Pe.InvalidRecordData="InvalidRecordData",Pe.UnsupportedRecord="UnsupportedRecord",Pe.InvalidEvmAddress="InvalidEvmAddress",Pe.InvalidInjectiveAddress="InvalidInjectiveAddress",Pe.InvalidARecord="InvalidARecord",Pe.InvalidAAAARecord="InvalidAAAARecord",Pe.InvalidRecordInput="InvalidRecordInput",Pe.InvalidSignature="InvalidSignature",Pe.AccountDoesNotExist="AccountDoesNotExist",Pe.MultipleRegistries="MultipleRegistries",Pe.InvalidReverseTwitter="InvalidReverseTwitter",Pe.NoAccountData="NoAccountData",Pe.InvalidInput="InvalidInput",Pe.InvalidDomain="InvalidDomain",Pe.InvalidCustomBg="InvalidCustomBackground",Pe.UnsupportedSignature="UnsupportedSignature",Pe.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",Pe.RecordIsNotSigned="RecordIsNotSigned",Pe.UnsupportedSignatureType="UnsupportedSignatureType",Pe.InvalidSolRecordV2="InvalidSolRecordV2",Pe.MissingVerifier="MissingVerifier",Pe.PythFeedNotFound="PythFeedNotFound";class ke extends Error{constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,ke)}}class Te{constructor(e){this.value=BigInt(e)}toBuffer(){const e=n.Buffer.alloc(4);return e.writeUInt32LE(Number(this.value)),e}static fromBuffer(e){if(4!==e.length)throw new ke(exports.ErrorType.InvalidBufferLength,`Invalid buffer length: ${e.length}`);const t=BigInt(e.readUInt32LE(0));return new Te(t)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}class _e{constructor(e){this.value=BigInt(e)}toBuffer(){const e=n.Buffer.alloc(8);return e.writeBigUInt64LE(this.value),e}static fromBuffer(e){if(8!==e.length)throw new ke(exports.ErrorType.U64Overflow,`Invalid buffer length: ${e.length}`);const t=e.readBigUInt64LE(0);return new _e(t)}toNumber(){return Number(this.value)}toString(){return String(this.value)}}var Ue,Le=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],Ce=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var r=t.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===t[0]?"setFloat".concat(r):"i"===t[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,e,!0),this.offset+=n},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),Ne=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),r=parseInt(t)/8;this.assert_enough_buffer(r);var n="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[n](this.offset,!0);return this.offset+=r,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),Oe=(Ue=function(e,t){return Ue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Ue(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Ue(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function De(e,t,r){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(r.join(".")))}function We(e,t,r){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(r.join(".")))}var Me=Le.concat(["bool","string"]),Ve=["option","enum","array","set","map","struct"],ze=function(e){function t(t,r){var n="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(r);return e.call(this,n)||this}return Oe(t,e),t}(Error);function Fe(e){if("string"!=typeof e||!Me.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&Ve.includes(t[0])){var r=t[0];if("option"===r)return Fe(e[r]);if("enum"===r)return function(e){if(!Array.isArray(e))throw new ze(e,"Array");for(var t=0,r=e;t<r.length;t++){var n=r[t];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');Fe({struct:n.struct})}}(e[r]);if("array"===r)return function(e){if("object"!=typeof e)throw new ze(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return Fe(e.type);throw new ze(e,"{ type, len? }")}(e[r]);if("set"===r)return Fe(e[r]);if("map"===r)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new ze(e,"{ key, value }");Fe(e.key),Fe(e.value)}(e[r]);if("struct"===r)return function(e){if("object"!=typeof e)throw new ze(e,"object");for(var t in e)Fe(e[t])}(e[r])}}throw new ze(e,Ve.join(", ")+" or "+Me.join(", "))}}var je=function(){function e(e){this.encoded=new Ce,this.fieldPath=["value"],this.checkTypes=e}return e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(Le.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var r=parseInt(t.substring(1));r<=32||"f64"==t?(this.checkTypes&&De(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),r))},e.prototype.encode_bigint=function(e,t){for(var r=t/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_string=function(e){this.checkTypes&&De(e,"string",this.fieldPath);for(var t=e,r=[],n=0;n<t.length;n++){var o=t.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&t.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))},e.prototype.encode_boolean=function(e){this.checkTypes&&De(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var r=Object.keys(e)[0],n=0;n<t.enum.length;n++){var o=t.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?We(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encode_value(e[r],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?We(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&De(e,"object",this.fieldPath);var r=e instanceof Set?Array.from(e.values()):Object.values(e);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,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&De(e,"object",this.fieldPath);var r=e instanceof Map,n=r?Array.from(e.keys()):Object.keys(e);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,t.map.key),this.encode_value(r?e.get(s):e[s],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&De(e,"object",this.fieldPath);for(var r=0,n=Object.keys(t.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}},e}(),Ke=function(){function e(e){this.buffer=new Ne(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(Le.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var r=e/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&n[r-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){for(var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e)),r=[],n=0;n<e;++n){var o=t[n];if(o<128)r.push(o);else if(o<224)r.push((31&o)<<6|63&t[++n]);else if(o<240)r.push((15&o)<<12|(63&t[++n])<<6|63&t[++n]);else{var i=(7&o)<<18|(63&t[++n])<<12|(63&t[++n])<<6|63&t[++n];r.push(i)}}return String.fromCodePoint.apply(String,r)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,r=this.buffer.consume_value("u8");if(r>e.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=e.enum[r].struct,o=Object.keys(n)[0];return(t={})[o]=this.decode_value(n[o]),t},e.prototype.decode_array=function(e){for(var t=[],r=e.array.len?e.array.len:this.decode_integer("u32"),n=0;n<r;++n)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),r=new Set,n=0;n<t;++n)r.add(this.decode_value(e.set));return r},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),r=new Map,n=0;n<t;++n){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);r.set(o,i)}return r},e.prototype.decode_struct=function(e){var t={};for(var r in e.struct)t[r]=this.decode_value(e.struct[r]);return t},e}();function He(e,t,r){return void 0===r&&(r=!0),r&&Fe(e),new je(r).encode(t,e)}function Ge(e,t,r){return void 0===r&&(r=!0),r&&Fe(e),new Ke(t).decode(e)}function qe(t,r,o,i,s,a,c,u,f,p,d){const h=[n.Buffer.from(Int8Array.from([0])),new Te(a.length).toBuffer(),a,c.toBuffer(),u.toBuffer()],l=n.Buffer.concat(h),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 e.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),p?y.push({pubkey:p,isSigner:!1,isWritable:!1}):y.push({pubkey:new e.PublicKey(n.Buffer.alloc(32)),isSigner:!1,isWritable:!1}),d&&y.push({pubkey:d,isSigner:!0,isWritable:!1}),new e.TransactionInstruction({keys:y,programId:t,data:l})}function Ye(t,r,o,i,s){const a=[n.Buffer.from(Int8Array.from([1])),o.toBuffer(),new Te(i.length).toBuffer(),i],c=n.Buffer.concat(a),u=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!0,isWritable:!1}];return new e.TransactionInstruction({keys:u,programId:t,data:c})}function Xe(t,r,o,i,s,a,c){const u=[n.Buffer.from(Int8Array.from([2])),o.toBuffer()],f=n.Buffer.concat(u),p=[{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:c||i,isSigner:!0,isWritable:!1}];return s&&p.push({pubkey:s,isSigner:!0,isWritable:!1}),c&&a&&(s||p.push({pubkey:e.PublicKey.default,isSigner:!1,isWritable:!1}),p.push({pubkey:a,isSigner:!1,isWritable:!1})),new e.TransactionInstruction({keys:p,programId:t,data:f})}function Ze(t,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 e.TransactionInstruction({keys:c,programId:t,data:a})}class $e{constructor(e){this.tag=9,this.name=e.name,this.space=e.space}serialize(){return He($e.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,d){const l=n.Buffer.from(this.serialize()),y=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:e.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:p,isSigner:!1,isWritable:!0},{pubkey:h,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:y,programId:t,data:l})}}$e.schema={struct:{tag:"u8",name:"string",space:"u32"}};class Qe{constructor(e){this.tag=12,this.name=e.name}serialize(){return He(Qe.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p){const d=n.Buffer.from(this.serialize());let h=[];return h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:o,isSigner:!1,isWritable:!1}),h.push({pubkey:i,isSigner:!1,isWritable:!0}),h.push({pubkey:s,isSigner:!1,isWritable:!1}),h.push({pubkey:a,isSigner:!1,isWritable:!1}),h.push({pubkey:c,isSigner:!0,isWritable:!0}),h.push({pubkey:u,isSigner:!1,isWritable:!1}),f&&h.push({pubkey:f,isSigner:!1,isWritable:!0}),p&&h.push({pubkey:p,isSigner:!0,isWritable:!0}),new e.TransactionInstruction({keys:h,programId:t,data:d})}}Qe.schema={struct:{tag:"u8",name:"string"}};class Je{constructor(e){this.tag=13,this.name=e.name,this.space=e.space,this.referrerIdxOpt=e.referrerIdxOpt}serialize(){return He(Je.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,d,h,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:p,isSigner:!1,isWritable:!1}),v.push({pubkey:d,isSigner:!1,isWritable:!1}),v.push({pubkey:h,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 e.TransactionInstruction({keys:v,programId:t,data:m})}}Je.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};class et{constructor(e){this.tag=17,this.name=e.name,this.space=e.space}serialize(){return He(et.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,d,h,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:p,isSigner:!1,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:h,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 e.TransactionInstruction({keys:v,programId:t,data:m})}}et.schema={struct:{tag:"u8",name:"string",space:"u32"}};class tt{constructor(){this.tag=16}serialize(){return He(tt.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p){const d=n.Buffer.from(this.serialize());let h=[];return h.push({pubkey:r,isSigner:!1,isWritable:!1}),h.push({pubkey:o,isSigner:!1,isWritable:!1}),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:!0}),h.push({pubkey:u,isSigner:!1,isWritable:!1}),h.push({pubkey:f,isSigner:!0,isWritable:!1}),h.push({pubkey:p,isSigner:!1,isWritable:!0}),new e.TransactionInstruction({keys:h,programId:t,data:d})}}tt.schema={struct:{tag:"u8"}};class rt{constructor(){this.tag=6}serialize(){return He(rt.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:c,programId:t,data:a})}}rt.schema={struct:{tag:"u8"}};class nt{constructor(e){this.tag=20,this.name=e.name,this.space=e.space,this.referrerIdxOpt=e.referrerIdxOpt}serialize(){return He(nt.schema,this)}getInstruction(t,r,o,i,s,a,c,u,f,p,d,h,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:!1}),v.push({pubkey:p,isSigner:!0,isWritable:!0}),v.push({pubkey:d,isSigner:!1,isWritable:!0}),v.push({pubkey:h,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 e.TransactionInstruction({keys:v,programId:t,data:m})}}nt.schema={struct:{tag:"u8",name:"string",space:"u32",referrerIdxOpt:{option:"u16"}}};const ot=new e.PublicKey("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk"),it=n.Buffer.from("tokenized_name"),st=t=>{const[r]=e.PublicKey.findProgramAddressSync([it,t.toBuffer()],ot);return r};var at;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(at||(at={}));class ct{constructor(t){this.tag=t.tag,this.nonce=t.nonce,this.nameAccount=new e.PublicKey(t.nameAccount),this.owner=new e.PublicKey(t.owner),this.nftMint=new e.PublicKey(t.nftMint)}static deserialize(e){return new ct(Ge(this.schema,e))}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new Error("NFT record not found");return this.deserialize(r.data)}static async findKey(t,r){return await e.PublicKey.findProgramAddress([n.Buffer.from("nft_record"),t.toBuffer()],r)}}ct.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 ut=async(t,r)=>{try{const n=st(r);if("0"===(await Ie(t,n)).supply.toString())return;const o=[{memcmp:{offset:0,bytes:n.toBase58()}},{memcmp:{offset:64,bytes:"2"}},{dataSize:165}],i=await t.getProgramAccounts(h,{filters:o});if(1!=i.length)return;return new e.PublicKey(i[0].account.data.slice(32,64))}catch{return}},ft=e=>[{memcmp:{offset:32,bytes:e}},{memcmp:{offset:64,bytes:"2"}}],pt=async(e,t)=>{const r=await(async(e,t)=>{const r=[{memcmp:{offset:0,bytes:"3"}},{memcmp:{offset:66,bytes:t.toBase58()}}];return await e.getProgramAccounts(ot,{filters:r})})(e,t.mint);if(1===r.length)return ct.deserialize(r[0].account.data)},dt=async(e,t)=>{const r=[...ft(t.toBase58()),{dataSize:165}],n=(await e.getProgramAccounts(h,{filters:r})).map((e=>Ee.decode(e.account.data))).map((t=>pt(e,t)));return(await Promise.all(n)).filter((e=>void 0!==e))};class ht{constructor(t){this.parentName=new e.PublicKey(t.parentName),this.owner=new e.PublicKey(t.owner),this.class=new e.PublicKey(t.class)}static deserialize(e){const t=new ht(Ge(this.schema,e));return t.data=null==e?void 0:e.slice(this.HEADER_LEN),t}static async retrieve(e,t){var r;const n=await e.getAccountInfo(t);if(!n)throw new ke(exports.ErrorType.AccountDoesNotExist);const o=new ht(Ge(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 ut(e,t)}}static async _retrieveBatch(e,t){const r=await e.getMultipleAccountsInfo(t),n=e=>{if(!e)return;const t=new ht(Ge(this.schema,e));return t.data=null==e?void 0:e.slice(this.HEADER_LEN),t};return r.map((e=>n(null==e?void 0:e.data)))}static async retrieveBatch(e,t){let r=[];const n=[...t];for(;n.length>0;)r.push(...await this._retrieveBatch(e,n.splice(0,100)));return r}}function lt(e,...t){if(!function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function yt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}ht.HEADER_LEN=96,ht.schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};const gt="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
|
|
11
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function wt(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}const bt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),mt=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function vt(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function Et(e){if("string"==typeof e&&(e=vt(e)),!wt(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class xt{clone(){return this._cloneInto()}}function At(e){const t=t=>e().update(Et(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class St extends xt{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=bt(this.buffer)}update(e){yt(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=Et(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=bt(e);for(;n<=o-i;i+=n)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){yt(this),function(e,t){lt(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let e=i;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,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;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=bt(e),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 e=0;e<c;e++)s.setUint32(4*e,u[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}const It=(e,t,r)=>e&t^~e&r,Bt=(e,t,r)=>e&t^e&r^t&r,Rt=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]),Pt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),kt=new Uint32Array(64);class Tt extends St{constructor(){super(64,32,8,!1),this.A=0|Pt[0],this.B=0|Pt[1],this.C=0|Pt[2],this.D=0|Pt[3],this.E=0|Pt[4],this.F=0|Pt[5],this.G=0|Pt[6],this.H=0|Pt[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,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(e,t){for(let r=0;r<16;r++,t+=4)kt[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=kt[e-15],r=kt[e-2],n=mt(t,7)^mt(t,18)^t>>>3,o=mt(r,17)^mt(r,19)^r>>>10;kt[e]=o+kt[e-7]+n+kt[e-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(mt(s,6)^mt(s,11)^mt(s,25))+It(s,a,c)+Rt[e]+kt[e]|0,f=(mt(r,2)^mt(r,13)^mt(r,22))+Bt(r,n,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=n,n=r,r=t+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(){kt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const _t=At((()=>new Tt)),Ut=new e.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),Lt="SPL Name Service",Ct=new e.PublicKey("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),Nt=new e.PublicKey("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR"),Ot=new e.PublicKey("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),Dt=new e.PublicKey("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc"),Wt=new e.PublicKey("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),Mt=new e.PublicKey("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi"),Vt=new e.PublicKey("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv"),zt=new e.PublicKey("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7"),Ft=new e.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),jt=[new e.PublicKey("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new e.PublicKey("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new e.PublicKey("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new e.PublicKey("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new e.PublicKey("5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR"),new e.PublicKey("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new e.PublicKey("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u"),new e.PublicKey("7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW"),new e.PublicKey("DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM"),new e.PublicKey("7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn"),new e.PublicKey("5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ"),new e.PublicKey("XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL")],Kt=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1","BSOL"],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB","INJ"]]),Ht=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"}]]),Gt=new e.PublicKey("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),qt=new e.PublicKey("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi"),Yt=new e.PublicKey("5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR"),Xt=new e.PublicKey("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz"),Zt=new e.PublicKey("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT"),$t=new e.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Qt=new e.PublicKey("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT"),Jt=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]]]);async function er(e,t){if(!await e.getAccountInfo(t))throw new ke(exports.ErrorType.AccountDoesNotExist);return ht.retrieve(e,t)}async function tr(e){const t=Lt+e,r=_t(n.Buffer.from(t,"utf8"));return n.Buffer.from(r)}async function rr(t,r,o){const i=[t];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 e.PublicKey.findProgramAddress(i,Ut);return s}const nr=async(e,t=Ct)=>{let r=await tr(e);return{pubkey:await rr(r,void 0,t),hashed:r}},or=async(e,t=!1)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const r=e.split(".");if(2===r.length){const e=n.Buffer.from([t?1:0]).toString().concat(r[0]),{pubkey:o}=await nr(r[1]);return{...await nr(e,o),isSub:!0,parent:o}}if(3===r.length&&t){const{pubkey:e}=await nr(r[2]),{pubkey:t}=await nr("\0".concat(r[1]),e),o=n.Buffer.from([1]).toString();return{...await nr(o.concat(r[0]),t),isSub:!0,parent:e,isSubRecord:!0}}if(r.length>=3)throw new ke(exports.ErrorType.InvalidInput);return{...await nr(e,Ct),isSub:!1,parent:void 0}};var ir,sr=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],ar=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var r=t.substring(1),n=parseInt(r)/8;this.resize_if_necessary(n);var o="f"===t[0]?"setFloat".concat(r):"i"===t[0]?"setInt".concat(r):"setUint".concat(r);this.view[o](this.offset,e,!0),this.offset+=n},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),cr=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),r=parseInt(t)/8;this.assert_enough_buffer(r);var n="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[n](this.offset,!0);return this.offset+=r,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),ur=(ir=function(e,t){return ir=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},ir(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}ir(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function fr(e,t,r){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(r.join(".")))}function pr(e,t,r){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(r.join(".")))}var dr=sr.concat(["bool","string"]),hr=["option","enum","array","set","map","struct"],lr=function(e){function t(t,r){var n="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(r);return e.call(this,n)||this}return ur(t,e),t}(Error);function yr(e){if("string"!=typeof e||!dr.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&hr.includes(t[0])){var r=t[0];if("option"===r)return yr(e[r]);if("enum"===r)return function(e){if(!Array.isArray(e))throw new lr(e,"Array");for(var t=0,r=e;t<r.length;t++){var n=r[t];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');yr({struct:n.struct})}}(e[r]);if("array"===r)return function(e){if("object"!=typeof e)throw new lr(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return yr(e.type);throw new lr(e,"{ type, len? }")}(e[r]);if("set"===r)return yr(e[r]);if("map"===r)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new lr(e,"{ key, value }");yr(e.key),yr(e.value)}(e[r]);if("struct"===r)return function(e){if("object"!=typeof e)throw new lr(e,"object");for(var t in e)yr(e[t])}(e[r])}}throw new lr(e,hr.join(", ")+" or "+dr.join(", "))}}var gr=function(){function e(e){this.encoded=new ar,this.fieldPath=["value"],this.checkTypes=e}return e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(sr.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var r=parseInt(t.substring(1));r<=32||"f64"==t?(this.checkTypes&&fr(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),r))},e.prototype.encode_bigint=function(e,t){for(var r=t/8,n=new Uint8Array(r),o=0;o<r;o++)n[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_string=function(e){this.checkTypes&&fr(e,"string",this.fieldPath);var t=e;this.encoded.store_value(t.length,"u32");for(var r=0;r<t.length;r++)this.encoded.store_value(t.charCodeAt(r),"u8")},e.prototype.encode_boolean=function(e){this.checkTypes&&fr(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var r=Object.keys(e)[0],n=0;n<t.enum.length;n++){var o=t.enum[n];if(r===Object.keys(o.struct)[0])return this.encoded.store_value(n,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(r,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?pr(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var r=0;r<e.length;r++)this.encode_value(e[r],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?pr(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&fr(e,"object",this.fieldPath);var r=e instanceof Set?Array.from(e.values()):Object.values(e);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,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&fr(e,"object",this.fieldPath);var r=e instanceof Map,n=r?Array.from(e.keys()):Object.keys(e);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,t.map.key),this.encode_value(r?e.get(s):e[s],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&fr(e,"object",this.fieldPath);for(var r=0,n=Object.keys(t.struct);r<n.length;r++){var o=n[r];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}},e}(),wr=function(){function e(e){this.buffer=new cr(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(sr.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var r=e/8,n=new Uint8Array(this.buffer.consume_bytes(r)),o=n.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&n[r-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e));return String.fromCharCode.apply(null,t)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,r=this.buffer.consume_value("u8");if(r>e.enum.length)throw new Error("Enum option ".concat(r," is not available"));var n=e.enum[r].struct,o=Object.keys(n)[0];return(t={})[o]=this.decode_value(n[o]),t},e.prototype.decode_array=function(e){for(var t=[],r=e.array.len?e.array.len:this.decode_integer("u32"),n=0;n<r;++n)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),r=new Set,n=0;n<t;++n)r.add(this.decode_value(e.set));return r},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),r=new Map,n=0;n<t;++n){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);r.set(o,i)}return r},e.prototype.decode_struct=function(e){var t={};for(var r in e.struct)t[r]=this.decode_value(e.struct[r]);return t},e}();function br(e,t,r){return void 0===r&&(r=!0),r&&yr(e),new gr(r).encode(t,e)}class mr{constructor(e){this.tag=1,this.record=e.record,this.content=e.content}serialize(){return br(mr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}mr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class vr{constructor(e){this.tag=4,this.validation=e.validation,this.signature=e.signature,this.expectedPubkey=e.expectedPubkey}serialize(){return br(vr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}vr.schema={struct:{tag:"u8",validation:"u8",signature:{array:{type:"u8"}},expectedPubkey:{array:{type:"u8"}}}};class Er{constructor(e){this.tag=3,this.staleness=e.staleness}serialize(){return br(Er.schema,this)}getInstruction(t,r,n,o,i,s,a,c,u){const f=Buffer.from(this.serialize());let p=[];return p.push({pubkey:r,isSigner:!1,isWritable:!1}),p.push({pubkey:n,isSigner:!1,isWritable:!1}),p.push({pubkey:o,isSigner:!0,isWritable:!0}),p.push({pubkey:i,isSigner:!1,isWritable:!0}),p.push({pubkey:s,isSigner:!1,isWritable:!0}),p.push({pubkey:a,isSigner:!1,isWritable:!0}),p.push({pubkey:c,isSigner:!1,isWritable:!1}),p.push({pubkey:u,isSigner:!0,isWritable:!0}),new e.TransactionInstruction({keys:p,programId:t,data:f})}}Er.schema={struct:{tag:"u8",staleness:"bool"}};class xr{constructor(e){this.tag=2,this.record=e.record,this.content=e.content}serialize(){return br(xr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}xr.schema={struct:{tag:"u8",record:"string",content:{array:{type:"u8"}}}};class Ar{constructor(){this.tag=5}serialize(){return br(Ar.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}Ar.schema={struct:{tag:"u8"}};class Sr{constructor(e){this.tag=6,this.roaId=e.roaId}serialize(){return br(Sr.schema,this)}getInstruction(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})}}Sr.schema={struct:{tag:"u8",roaId:{array:{type:"u8"}}}};const Ir=new e.PublicKey("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[Br]=e.PublicKey.findProgramAddressSync([Ir.toBuffer()],Ir);var Rr,Pr;(Pr=Rr||(Rr={}))[Pr.None=0]="None",Pr[Pr.Solana=1]="Solana",Pr[Pr.Ethereum=2]="Ethereum",Pr[Pr.UnverifiedSolana=3]="UnverifiedSolana";const kr=e=>{switch(e){case Rr.None:return 0;case Rr.Ethereum:return 20;case Rr.Solana:case Rr.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Tr{constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new Tr((t=this.schema,r=e,void 0===(n=!0)&&(n=!0),n&&yr(t),new wr(r).decode(t)));var t,r,n}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data.slice(96,96+this.LEN))}}Tr.LEN=8,Tr.schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};class _r{constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=Tr.deserialize(e.slice(96,96+Tr.LEN)),r=e.slice(96+Tr.LEN);return new _r(t,r)}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new Error("Record header account not found");return this.deserialize(r.data)}static async retrieveBatch(e,t){return(await e.getMultipleAccountsInfo(t)).map((e=>{if(null==e?void 0:e.data)return this.deserialize(e.data)}))}getContent(){let e=kr(this.header.stalenessValidation)+kr(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){let e=kr(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){let e=kr(this.header.stalenessValidation),t=e+kr(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}var Ur;exports.Record=void 0,(Ur=exports.Record||(exports.Record={})).IPFS="IPFS",Ur.ARWV="ARWV",Ur.SOL="SOL",Ur.ETH="ETH",Ur.BTC="BTC",Ur.LTC="LTC",Ur.DOGE="DOGE",Ur.Email="email",Ur.Url="url",Ur.Discord="discord",Ur.Github="github",Ur.Reddit="reddit",Ur.Twitter="twitter",Ur.Telegram="telegram",Ur.Pic="pic",Ur.SHDW="SHDW",Ur.POINT="POINT",Ur.BSC="BSC",Ur.Injective="INJ",Ur.Backpack="backpack",Ur.A="A",Ur.AAAA="AAAA",Ur.CNAME="CNAME",Ur.TXT="TXT",Ur.Background="background",Ur.BASE="BASE";const Lr=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 Cr;exports.RecordVersion=void 0,(Cr=exports.RecordVersion||(exports.RecordVersion={}))[Cr.V1=1]="V1",Cr[Cr.V2=2]="V2";var Nr="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=",Or="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",Dr=0,Wr=-3;function Mr(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Vr(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new Mr,this.dtree=new Mr}var zr=new Mr,Fr=new Mr,jr=new Uint8Array(30),Kr=new Uint16Array(30),Hr=new Uint8Array(30),Gr=new Uint16Array(30),qr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yr=new Mr,Xr=new Uint8Array(320);function Zr(e,t,r,n){var o,i;for(o=0;o<r;++o)e[o]=0;for(o=0;o<30-r;++o)e[o+r]=o/r|0;for(i=n,o=0;o<30;++o)t[o]=i,i+=1<<e[o]}var $r=new Uint16Array(16);function Qr(e,t,r,n){var o,i;for(o=0;o<16;++o)e.table[o]=0;for(o=0;o<n;++o)e.table[t[r+o]]++;for(e.table[0]=0,i=0,o=0;o<16;++o)$r[o]=i,i+=e.table[o];for(o=0;o<n;++o)t[r+o]&&(e.trans[$r[t[r+o]]++]=o)}function Jr(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function en(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,n+r}function tn(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=0,n=0,o=0,i=e.tag;do{n=2*n+(1&i),i>>>=1,++o,r+=t.table[o],n-=t.table[o]}while(n>=0);return e.tag=i,e.bitcount-=o,t.trans[r+n]}function rn(e,t,r){var n,o,i,s,a,c;for(n=en(e,5,257),o=en(e,5,1),i=en(e,4,4),s=0;s<19;++s)Xr[s]=0;for(s=0;s<i;++s){var u=en(e,3,0);Xr[qr[s]]=u}for(Qr(Yr,Xr,0,19),a=0;a<n+o;){var f=tn(e,Yr);switch(f){case 16:var p=Xr[a-1];for(c=en(e,2,3);c;--c)Xr[a++]=p;break;case 17:for(c=en(e,3,3);c;--c)Xr[a++]=0;break;case 18:for(c=en(e,7,11);c;--c)Xr[a++]=0;break;default:Xr[a++]=f}}Qr(t,Xr,0,n),Qr(r,Xr,n,o)}function nn(e,t,r){for(;;){var n,o,i,s,a=tn(e,t);if(256===a)return Dr;if(a<256)e.dest[e.destLen++]=a;else for(n=en(e,jr[a-=257],Kr[a]),o=tn(e,r),s=i=e.destLen-en(e,Hr[o],Gr[o]);s<i+n;++s)e.dest[e.destLen++]=e.dest[s]}}function on(e){for(var t,r;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return Wr;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,Dr}!function(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}(zr,Fr),Zr(jr,Kr,4,3),Zr(Hr,Gr,2,1),jr[28]=0,Kr[28]=258;var sn=function(e,t){var r,n,o=new Vr(e,t);do{switch(r=Jr(o),en(o,2,0)){case 0:n=on(o);break;case 1:n=nn(o,zr,Fr);break;case 2:rn(o,o.ltree,o.dtree),n=nn(o,o.ltree,o.dtree);break;default:n=Wr}if(n!==Dr)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 an=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],cn=(e,t,r)=>{let n=e[t];e[t]=e[r],e[r]=n};var un={swap32LE:e=>{an&&(e=>{const t=e.length;for(let r=0;r<t;r+=4)cn(e,r,r+3),cn(e,r+1,r+2)})(e)}};const fn=sn,{swap32LE:pn}=un;var dn=class{constructor(e){const t="function"==typeof e.readUInt32BE&&"function"==typeof e.slice;if(t||e instanceof Uint8Array){let r;if(t)this.highStart=e.readUInt32LE(0),this.errorValue=e.readUInt32LE(4),r=e.readUInt32LE(8),e=e.slice(12);else{const t=new DataView(e.buffer);this.highStart=t.getUint32(0,!0),this.errorValue=t.getUint32(4,!0),r=t.getUint32(8,!0),e=e.subarray(12)}e=fn(e,new Uint8Array(r)),e=fn(e,new Uint8Array(r)),pn(e),this.data=new Uint32Array(e.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=e)}get(e){let t;return e<0||e>1114111?this.errorValue:e<55296||e>56319&&e<=65535?(t=(this.data[e>>5]<<2)+(31&e),this.data[t]):e<=65535?(t=(this.data[2048+(e-55296>>5)]<<2)+(31&e),this.data[t]):e<this.highStart?(t=this.data[2080+(e>>11)],t=this.data[t+(e>>5&63)],t=(t<<2)+(31&e),this.data[t]):this.data[this.data.length-4]}},hn={exports:{}};"undefined"!=typeof self?self:"undefined"!=typeof window&&window,hn.exports=function(){var e="3.7.5",t=e,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(e){var t={};return e.forEach((function(e,r){return t[e]=r})),t}(c),f=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,p=String.fromCharCode.bind(String),d="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(e){return new Uint8Array(Array.prototype.slice.call(e,0))},h=function(e){return e.replace(/=/g,"").replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"}))},l=function(e){return e.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(e){for(var t,r,n,o,i="",s=e.length%3,a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");i+=c[(t=r<<16|n<<8|o)>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}return s?i.slice(0,s-3)+"===".substring(s):i},g=n?function(e){return btoa(e)}:o?function(e){return Buffer.from(e,"binary").toString("base64")}:y,w=o?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=4096,r=[],n=0,o=e.length;n<o;n+=t)r.push(p.apply(null,e.subarray(n,n+t)));return g(r.join(""))},b=function(e,t){return void 0===t&&(t=!1),t?h(w(e)):w(e)},m=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?p(192|t>>>6)+p(128|63&t):p(224|t>>>12&15)+p(128|t>>>6&63)+p(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return p(240|t>>>18&7)+p(128|t>>>12&63)+p(128|t>>>6&63)+p(128|63&t)},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,E=function(e){return e.replace(v,m)},x=o?function(e){return Buffer.from(e,"utf8").toString("base64")}:s?function(e){return w(s.encode(e))}:function(e){return g(E(e))},A=function(e,t){return void 0===t&&(t=!1),t?h(x(e)):x(e)},S=function(e){return A(e,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return p(55296+(t>>>10))+p(56320+(1023&t));case 3:return p((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return p((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},R=function(e){return e.replace(I,B)},P=function(e){if(e=e.replace(/\s+/g,""),!f.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));for(var t,r,n,o="",i=0;i<e.length;)t=u[e.charAt(i++)]<<18|u[e.charAt(i++)]<<12|(r=u[e.charAt(i++)])<<6|(n=u[e.charAt(i++)]),o+=64===r?p(t>>16&255):64===n?p(t>>16&255,t>>8&255):p(t>>16&255,t>>8&255,255&t);return o},k=r?function(e){return atob(l(e))}:o?function(e){return Buffer.from(e,"base64").toString("binary")}:P,T=o?function(e){return d(Buffer.from(e,"base64"))}:function(e){return d(k(e).split("").map((function(e){return e.charCodeAt(0)})))},_=function(e){return T(L(e))},U=o?function(e){return Buffer.from(e,"base64").toString("utf8")}:i?function(e){return i.decode(T(e))}:function(e){return R(k(e))},L=function(e){return l(e.replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})))},C=function(e){return U(L(e))},N=function(e){if("string"!=typeof e)return!1;var t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},O=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}},D=function(){var e=function(e,t){return Object.defineProperty(String.prototype,e,O(t))};e("fromBase64",(function(){return C(this)})),e("toBase64",(function(e){return A(this,e)})),e("toBase64URI",(function(){return A(this,!0)})),e("toBase64URL",(function(){return A(this,!0)})),e("toUint8Array",(function(){return _(this)}))},W=function(){var e=function(e,t){return Object.defineProperty(Uint8Array.prototype,e,O(t))};e("toBase64",(function(e){return b(this,e)})),e("toBase64URI",(function(){return b(this,!0)})),e("toBase64URL",(function(){return b(this,!0)}))},M=function(){D(),W()},V={version:e,VERSION:t,atob:k,atobPolyfill:P,btoa:g,btoaPolyfill:y,fromBase64:C,toBase64:A,encode:A,encodeURI:S,encodeURL:S,utob:E,btou:R,decode:C,isValid:N,fromUint8Array:b,toUint8Array:_,extendString:D,extendUint8Array:W,extendBuiltins:M,Base64:{}};return Object.keys(V).forEach((function(e){return V.Base64[e]=V[e]})),V}();const ln={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},yn=Nr,gn=Or,wn=dn,bn=hn.exports.Base64,mn=new wn(bn.toUint8Array(yn)),vn=new wn(bn.toUint8Array(gn));function En(e,t){return 0!=(e&t)}const xn=0,An=1,Sn=2;function In(e,t){const r=e.length;let n=0,o=xn;for(let i=t;i+1<r;i++){const r=e[i+0],s=e[i+1];switch(En(r,ln.Regional_Indicator)||(n=0),o){case Sn:case xn:o=En(r,ln.Extended_Pictographic)?An:xn;break;case An:o=En(r,ln.Extend)?An:En(r,ln.ZWJ)&&En(s,ln.Extended_Pictographic)?Sn:xn}if(!En(r,ln.CR)||!En(s,ln.LF)){if(En(r,ln.Control|ln.CR|ln.LF))return i+1-t;if(En(s,ln.Control|ln.CR|ln.LF))return i+1-t;if(!(En(r,ln.L)&&En(s,ln.L|ln.V|ln.LV|ln.LVT)||En(r,ln.LV|ln.V)&&En(s,ln.V|ln.T)||En(r,ln.LVT|ln.T)&&En(s,ln.T)||En(s,ln.Extend|ln.ZWJ)||En(s,ln.SpacingMark)||En(r,ln.Prepend)||o===Sn)){if(!En(r,ln.Regional_Indicator)||!En(s,ln.Regional_Indicator)||n%2!=0)return i+1-t;n++}}}return r-t}var Bn=function(e){const t=[],r=[0],n=[];for(let t=0;t<e.length;){const o=e.codePointAt(t);n.push(mn.get(o)|vn.get(o)),t+=o>65535?2:1,r.push(t)}for(let o=0;o<n.length;){const i=In(n,o),s=r[o],a=r[o+i];t.push(e.slice(s,a)),o+=i}return t},Rn=r(Bn);const Pn=e=>{const t=Lt+e,r=_t(n.Buffer.from(t,"utf8"));return n.Buffer.from(r)},kn=(t,r,o)=>{const i=[t];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=e.PublicKey.findProgramAddressSync(i,Ut);return s};async function Tn(e,t){const r=Pn(t.toBase58()),n=kn(r,Wt),{registry:o}=await ht.retrieve(e,n);if(!o.data)throw new ke(exports.ErrorType.NoAccountData);return Wn(o.data)}async function _n(e,t){let r=[];for(let e of t){const t=Pn(e.toBase58()),n=kn(t,Wt);r.push(n)}return(await ht.retrieveBatch(e,r)).map((e=>{if(void 0!==e&&void 0!==e.data)return Wn(e.data)}))}const Un=(e,t=Ct,r)=>{let n=Pn(e);return{pubkey:kn(n,r,t),hashed:n}},Ln=(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const r=t===exports.RecordVersion.V2?Br:void 0,o=e.split(".");if(2===o.length){const e=n.Buffer.from([t||0]).toString().concat(o[0]),{pubkey:i}=Un(o[1]);return{...Un(e,i,r),isSub:!0,parent:i}}if(3===o.length&&t){const{pubkey:e}=Un(o[2]),{pubkey:n}=Un("\0".concat(o[1]),e),i=t===exports.RecordVersion.V2?"":"";return{...Un(i.concat(o[0]),n,r),isSub:!0,parent:e,isSubRecord:!0}}if(o.length>=3)throw new ke(exports.ErrorType.InvalidInput);return{...Un(e,Ct),isSub:!1,parent:void 0}};async function Cn(e,t){const r=[{memcmp:{offset:32,bytes:t.toBase58()}},{memcmp:{offset:0,bytes:Ct.toBase58()}}];return(await e.getProgramAccounts(Ut,{filters:r})).map((e=>e.pubkey))}const Nn=(e,t)=>{const{pubkey:r,parent:n}=Ln(e),o=Pn(r.toBase58());return kn(o,Wt,t?n:void 0)},On=(e,t)=>{const r=Pn(e.toBase58());return kn(r,Wt,t)},Dn=(e,t)=>{if(!e)throw new ke(t)};function Wn(e){if(!e)return;const t=e.slice(0,4).readUInt32LE(0);return e.slice(4,4+t).toString()}const Mn=(t,r)=>{const o=n.Buffer.alloc(2);return o.writeUint16LE(t),e.PublicKey.findProgramAddressSync([o,n.Buffer.from(r)],Qt)};var Vn=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),i=o.charCodeAt(0);if(255!==t[i])throw new TypeError(o+" is ambiguous");t[i]=n}var s=e.length,a=e.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,o=0;e[r]===a;)n++,r++;for(var i=(e.length-r)*c+1>>>0,u=new Uint8Array(i);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var p=0,d=i-1;(0!==f||p<o)&&-1!==d;d--,p++)f+=s*u[d]>>>0,u[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=p,r++}for(var h=i-o;h!==i&&0===u[h];)h++;for(var l=new Uint8Array(n+(i-h)),y=n;h!==i;)l[y++]=u[h++];return l}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var c=(i-o)*u+1>>>0,f=new Uint8Array(c);o!==i;){for(var p=t[o],d=0,h=c-1;(0!==p||d<n)&&-1!==h;h--,d++)p+=256*f[h]>>>0,f[h]=p%s>>>0,p=p/s>>>0;if(0!==p)throw new Error("Non-zero carry");n=d,o++}for(var l=c-n;l!==c&&0===f[l];)l++;for(var y=a.repeat(r);l<c;++l)y+=e.charAt(f[l]);return y},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+s+" character")}}};var zn,Fn=Vn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),jn={exports:{}};zn=jn,function(e){const t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"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(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${t}\\.${t}\\.${t}\\.${t}(${i})?$`,"i")};function c(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,o=0,i=-1,s=(e.match(a.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)o++;if("::"===e.substr(0,2)&&o--,"::"===e.substr(-2,2)&&o--,o>t)return null;for(n=t-o,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),{parts:t,zoneId:s}}function u(e,t,r,n){if(e.length!==t.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),e[i]>>o!=t[i]>>o)return!1;n-=r,i+=1}return!0}function f(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(n.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function p(e,t){for(;e.length<t;)e=`0${e}`;return e}const d={};d.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!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],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),d.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[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(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(e){return null!==this.parser(e)},d.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},d.IPv4.isValidFourPartDecimal=function(e){return!(!d.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(e){let t,r,n,o,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},d.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(e){let t,n,o;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(f(n));return r}();if(t=e.match(r.longValue)){if(o=f(t[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(o>>t&255);return e}().reverse()}return(t=e.match(r.twoOctet))?function(){const e=t.slice(1,4),r=[];if(o=f(e[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(e[0])),r.push(o>>16&255),r.push(o>>8&255),r.push(255&o),r}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),r=[];if(o=f(e[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return r.push(f(e[0])),r.push(f(e[1])),r.push(o>>8&255),r.push(255&o),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},d.IPv6=function(){function e(e,t){let r,n;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}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");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[new e([8193,4,274,0,0,0,0,0]),48],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!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],t&&0!==o)return null;16!==o&&(t=!0),e+=o}return 128-e},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n<r.length;n++)e=r[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(p(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new d.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,n=0,o=-1;for(;r=e.exec(t);)r[0].length>o&&(n=r.index,o=r[0].length);return o<0?t:`${t.substring(0,n)}::${t.substring(n+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),d.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[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(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},d.IPv6.isIPv6=function(e){return null!==this.parser(e)},d.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},d.IPv6.networkAddressFromCIDR=function(e){let t,r,n,o,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(i[r],10)),r++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},d.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},d.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(e){let t,r,n,o,i,s;if(n=e.match(a.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(a.native.test(e))return c(e,8);if((n=e.match(a.transitional))&&(s=n[6]||"",t=c(n[1].slice(0,-1)+s,6),t.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 t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},d.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},d.fromByteArray=function(e){const t=e.length;if(4===t)return new d.IPv4(e);if(16===t)return new d.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},d.isValid=function(e){return d.IPv6.isValid(e)||d.IPv4.isValid(e)},d.parse=function(e){if(d.IPv6.isValid(e))return d.IPv6.parse(e);if(d.IPv4.isValid(e))return d.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},d.parseCIDR=function(e){try{return d.IPv6.parseCIDR(e)}catch(t){try{return d.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},d.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},d.subnetMatch=function(e,t,r){let n,o,i,s;for(o in null==r&&(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,o))for(i=t[o],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(s=i[n],e.kind()===s[0].kind()&&e.match.apply(e,s))return o;return r},zn.exports?zn.exports=d:e.ipaddr=d}(t);var Kn=jn.exports;const Hn=2147483647,Gn=36,qn={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Yn=Math.floor,Xn=String.fromCharCode;function Zn(e){throw new RangeError(qn[e])}const $n=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},Qn=function(e,t,r){let n=0;for(e=r?Yn(e/700):e>>1,e+=Yn(e/t);e>455;n+=Gn)e=Yn(e/35);return Yn(n+36*e/(e+38))},Jn=function(e){const t=[],r=e.length;let n=0,o=128,i=72,s=e.lastIndexOf("-");s<0&&(s=0);for(let r=0;r<s;++r)e.charCodeAt(r)>=128&&Zn("not-basic"),t.push(e.charCodeAt(r));for(let c=s>0?s+1:0;c<r;){const s=n;for(let t=1,o=Gn;;o+=Gn){c>=r&&Zn("invalid-input");const s=(a=e.charCodeAt(c++))>=48&&a<58?a-48+26:a>=65&&a<91?a-65:a>=97&&a<123?a-97:Gn;s>=Gn&&Zn("invalid-input"),s>Yn((Hn-n)/t)&&Zn("overflow"),n+=s*t;const u=o<=i?1:o>=i+26?26:o-i;if(s<u)break;const f=Gn-u;t>Yn(Hn/f)&&Zn("overflow"),t*=f}const u=t.length+1;i=Qn(n-s,u,0==s),Yn(n/u)>Hn-o&&Zn("overflow"),o+=Yn(n/u),n%=u,t.splice(n++,0,o)}var a;return String.fromCodePoint(...t)},eo=function(e){const t=[];e=function(e){const t=[];let r=0;const n=e.length;for(;r<n;){const o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){const n=e.charCodeAt(r++);56320==(64512&n)?t.push(((1023&o)<<10)+(1023&n)+65536):(t.push(o),r--)}else t.push(o)}return t}(e);const r=e.length;let n=128,o=0,i=72;for(const r of e)r<128&&t.push(Xn(r));const s=t.length;let a=s;for(s&&t.push("-");a<r;){let r=Hn;for(const t of e)t>=n&&t<r&&(r=t);const c=a+1;r-n>Yn((Hn-o)/c)&&Zn("overflow"),o+=(r-n)*c,n=r;for(const r of e)if(r<n&&++o>Hn&&Zn("overflow"),r===n){let e=o;for(let r=Gn;;r+=Gn){const n=r<=i?1:r>=i+26?26:r-i;if(e<n)break;const o=e-n,s=Gn-n;t.push(Xn($n(n+o%s,0))),e=Yn(o/s)}t.push(Xn($n(e,0))),i=Qn(o,c,a===s),o=0,++a}++o,++n}return t.join("")},to=BigInt(2**32-1),ro=BigInt(32);function no(e,t=!1){return t?{h:Number(e&to),l:Number(e>>ro&to)}:{h:0|Number(e>>ro&to),l:0|Number(e&to)}}const oo={fromBig:no,split:function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=no(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]},toBig:(e,t)=>BigInt(e>>>0)<<ro|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:function(e,t,r,n){const o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:0|o}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,add5H:(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0,add5L:(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0)};var io=oo;const[so,ao]=(()=>io.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((e=>BigInt(e)))))(),co=new Uint32Array(80),uo=new Uint32Array(80);class fo extends St{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:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:f,Fl:p,Gh:d,Gl:h,Hh:l,Hl:y}=this;return[e,t,r,n,o,i,s,a,c,u,f,p,d,h,l,y]}set(e,t,r,n,o,i,s,a,c,u,f,p,d,h,l,y){this.Ah=0|e,this.Al=0|t,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|p,this.Gh=0|d,this.Gl=0|h,this.Hh=0|l,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)co[r]=e.getUint32(t),uo[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|co[e-15],r=0|uo[e-15],n=io.rotrSH(t,r,1)^io.rotrSH(t,r,8)^io.shrSH(t,r,7),o=io.rotrSL(t,r,1)^io.rotrSL(t,r,8)^io.shrSL(t,r,7),i=0|co[e-2],s=0|uo[e-2],a=io.rotrSH(i,s,19)^io.rotrBH(i,s,61)^io.shrSH(i,s,6),c=io.rotrSL(i,s,19)^io.rotrBL(i,s,61)^io.shrSL(i,s,6),u=io.add4L(o,c,uo[e-7],uo[e-16]),f=io.add4H(u,n,a,co[e-7],co[e-16]);co[e]=0|f,uo[e]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:p,Fh:d,Fl:h,Gh:l,Gl:y,Hh:g,Hl:w}=this;for(let e=0;e<80;e++){const t=io.rotrSH(f,p,14)^io.rotrSH(f,p,18)^io.rotrBH(f,p,41),b=io.rotrSL(f,p,14)^io.rotrSL(f,p,18)^io.rotrBL(f,p,41),m=f&d^~f&l,v=p&h^~p&y,E=io.add5L(w,b,v,ao[e],uo[e]),x=io.add5H(E,g,t,m,so[e],co[e]),A=0|E,S=io.rotrSH(r,n,28)^io.rotrBH(r,n,34)^io.rotrBH(r,n,39),I=io.rotrSL(r,n,28)^io.rotrBL(r,n,34)^io.rotrBL(r,n,39),B=r&o^r&s^o&s,R=n&i^n&a^i&a;g=0|l,w=0|y,l=0|d,y=0|h,d=0|f,h=0|p,({h:f,l:p}=io.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=io.add3L(A,I,R);r=io.add3H(P,x,S,B),n=0|P}({h:r,l:n}=io.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=io.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=io.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=io.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l:p}=io.add(0|this.Eh,0|this.El,0|f,0|p)),({h:d,l:h}=io.add(0|this.Fh,0|this.Fl,0|d,0|h)),({h:l,l:y}=io.add(0|this.Gh,0|this.Gl,0|l,0|y)),({h:g,l:w}=io.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,a,c,u,f,p,d,h,l,y,g,w)}roundClean(){co.fill(0),uo.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 po=At((()=>new fo));
|
|
12
12
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const ho=BigInt(1),lo=BigInt(2);function yo(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}const go=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function wo(e){if(!yo(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=go[e[r]];return t}function bo(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}const mo={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function vo(e){return e>=mo._0&&e<=mo._9?e-mo._0:e>=mo._A&&e<=mo._F?e-(mo._A-10):e>=mo._a&&e<=mo._f?e-(mo._a-10):void 0}function Eo(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,o=0;t<r;t++,o+=2){const r=vo(e.charCodeAt(o)),i=vo(e.charCodeAt(o+1));if(void 0===r||void 0===i){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}n[t]=16*r+i}return n}function xo(e){if(!yo(e))throw new Error("Uint8Array expected");return bo(wo(Uint8Array.from(e).reverse()))}function Ao(e,t){return Eo(e.toString(16).padStart(2*t,"0"))}function So(e,t){return Ao(e,t).reverse()}function Io(e,t,r){let n;if("string"==typeof t)try{n=Eo(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!yo(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(`${e} expected ${r} bytes, got ${o}`);return n}function Bo(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];if(!yo(n))throw new Error("Uint8Array expected");t+=n.length}let r=new Uint8Array(t),n=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,n),n+=o.length}return r}const Ro=e=>(lo<<BigInt(e-1))-ho,Po={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||yo(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function ko(e,t,r={}){const n=(t,r,n)=>{const o=Po[r];if("function"!=typeof o)throw new Error(`Invalid validator "${r}", expected function`);const i=e[t];if(!(n&&void 0===i||o(i,e)))throw new Error(`Invalid param ${String(t)}=${i} (${typeof i}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}
|
|
13
13
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const To=BigInt(0),_o=BigInt(1),Uo=BigInt(2),Lo=BigInt(3),Co=BigInt(4),No=BigInt(5),Oo=BigInt(8);function Do(e,t){const r=e%t;return r>=To?r:t+r}function Wo(e,t,r){if(r<=To||t<To)throw new Error("Expected power/modulo > 0");if(r===_o)return To;let n=_o;for(;t>To;)t&_o&&(n=n*e%r),e=e*e%r,t>>=_o;return n}function Mo(e,t,r){let n=e;for(;t-- >To;)n*=n,n%=r;return n}function Vo(e,t){if(e===To||t<=To)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Do(e,t),n=t,o=To,i=_o;for(;r!==To;){const e=n%r,t=o-i*(n/r);n=r,r=e,o=i,i=t}if(n!==_o)throw new Error("invert: does not exist");return Do(o,t)}function zo(e){if(e%Co===Lo){const t=(e+_o)/Co;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%Oo===No){const t=(e-No)/Oo;return function(e,r){const n=e.mul(r,Uo),o=e.pow(n,t),i=e.mul(r,o),s=e.mul(e.mul(i,Uo),o),a=e.mul(i,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-_o)/Uo;let r,n,o;for(r=e-_o,n=0;r%Uo===To;r/=Uo,n++);for(o=Uo;o<e&&Wo(o,t,e)!==e-_o;o++);if(1===n){const t=(e+_o)/Co;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const i=(r+_o)/Uo;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=n,c=e.pow(e.mul(e.ONE,o),r),u=e.pow(s,i),f=e.pow(s,r);for(;!e.eql(f,e.ONE);){if(e.eql(f,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(f);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const r=e.pow(c,_o<<BigInt(a-t-1));c=e.sqr(r),u=e.mul(u,r),f=e.mul(f,c),a=t}return u}}(e)}BigInt(9),BigInt(16);const Fo=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function jo(e,t){const r=void 0!==t?t:e.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 Ko=BigInt(0),Ho=BigInt(1);function Go(e){return ko(e.Fp,Fo.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),ko(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...jo(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}
|
|
16
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qo=BigInt(0),Yo=BigInt(1),Xo=BigInt(2),Zo=BigInt(8),$o={zip215:!0};function Qo(e){const t=function(e){const t=Go(e);return ko(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n:n,prehash:o,hash:i,randomBytes:s,nByteLength:a,h:c}=t,u=Xo<<BigInt(8*a)-Yo,f=r.create,p=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:qo}}}),
|
|
16
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qo=BigInt(0),Yo=BigInt(1),Xo=BigInt(2),Zo=BigInt(8),$o={zip215:!0};function Qo(e){const t=function(e){const t=Go(e);return ko(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n:n,prehash:o,hash:i,randomBytes:s,nByteLength:a,h:c}=t,u=Xo<<BigInt(8*a)-Yo,f=r.create,p=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:qo}}}),d=t.adjustScalarBytes||(e=>e),h=t.domain||((e,t,r)=>{if(t.length||r)throw new Error("Contexts/pre-hash are not supported");return e}),l=e=>"bigint"==typeof e&&qo<e,y=(e,t)=>l(e)&&l(t)&&e<t,g=e=>e===qo||y(e,u);function w(e,t){if(y(e,t))return e;throw new Error(`Expected valid scalar < ${t}, got ${typeof e} ${e}`)}function b(e){return e===qo?e:w(e,n)}const m=new Map;function v(e){if(!(e instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(e,t,r,n){if(this.ex=e,this.ey=t,this.ez=r,this.et=n,!g(e))throw new Error("x required");if(!g(t))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(e){if(e instanceof E)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};if(!g(t)||!g(r))throw new Error("invalid affine point");return new E(t,r,Yo,f(t*r))}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.ez)));return e.map(((e,r)=>e.toAffine(t[r]))).map(E.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,m.delete(this)}assertValidity(){const{a:e,d:r}=t;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),p=f(u*u),d=f(a*e);if(f(u*f(d+c))!==f(p+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(e){v(e);const{ex:t,ey:r,ez:n}=this,{ex:o,ey:i,ez:s}=e,a=f(t*s),c=f(o*n),u=f(r*s),p=f(i*n);return a===c&&u===p}is0(){return this.equals(E.ZERO)}negate(){return new E(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){const{a:e}=t,{ex:r,ey:n,ez:o}=this,i=f(r*r),s=f(n*n),a=f(Xo*f(o*o)),c=f(e*i),u=r+n,p=f(f(u*u)-i-s),d=c+s,h=d-a,l=c-s,y=f(p*h),g=f(d*l),w=f(p*l),b=f(h*d);return new E(y,g,b,w)}add(e){v(e);const{a:r,d:n}=t,{ex:o,ey:i,ez:s,et:a}=this,{ex:c,ey:u,ez:p,et:d}=e;if(r===BigInt(-1)){const e=f((i-o)*(u+c)),t=f((i+o)*(u-c)),r=f(t-e);if(r===qo)return this.double();const n=f(s*Xo*d),h=f(a*Xo*p),l=h+n,y=t+e,g=h-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 h=f(o*c),l=f(i*u),y=f(a*n*d),g=f(s*p),w=f((o+i)*(c+u)-h-l),b=g-y,m=g+y,x=f(l-r*h),A=f(w*b),S=f(m*x),I=f(w*x),B=f(b*m);return new E(A,S,B,I)}subtract(e){return this.add(e.negate())}wNAF(e){return S.wNAFCached(this,m,e,E.normalizeZ)}multiply(e){const{p:t,f:r}=this.wNAF(w(e,n));return E.normalizeZ([t,r])[0]}multiplyUnsafe(e){let t=b(e);return t===qo?A:this.equals(A)||t===Yo?this:this.equals(x)?this.wNAF(t).p:S.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return S.unsafeLadder(this,n).is0()}toAffine(e){const{ex:t,ey:n,ez:o}=this,i=this.is0();null==e&&(e=i?Zo:r.inv(o));const s=f(t*e),a=f(n*e),c=f(o*e);if(i)return{x:qo,y:Yo};if(c!==Yo)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:e}=t;return e===Yo?this:this.multiplyUnsafe(e)}static fromHex(e,n=!1){const{d:o,a:i}=t,s=r.BYTES,a=(e=Io("pointHex",e,s)).slice(),c=e[s-1];a[s-1]=-129&c;const d=xo(a);d===qo||w(d,n?u:r.ORDER);const h=f(d*d),l=f(h-Yo),y=f(o*h-i);let{isValid:g,value:b}=p(l,y);if(!g)throw new Error("Point.fromHex: invalid y coordinate");const m=(b&Yo)===Yo,v=0!=(128&c);if(!n&&b===qo&&v)throw new Error("Point.fromHex: x=0 and x_0=1");return v!==m&&(b=f(-b)),E.fromAffine({x:b,y:d})}static fromPrivateKey(e){return R(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=So(t,r.BYTES);return n[n.length-1]|=e&Yo?128:0,n}toHex(){return wo(this.toRawBytes())}}E.BASE=new E(t.Gx,t.Gy,Yo,f(t.Gx*t.Gy)),E.ZERO=new E(qo,Yo,Yo,qo);const{BASE:x,ZERO:A}=E,S=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,o=t;for(;r>Ko;)r&Ho&&(n=n.add(o)),o=o.double(),r>>=Ho;return n},precomputeWindow(e,t){const{windows:r,windowSize:o}=n(t),i=[];let s=e,a=s;for(let e=0;e<r;e++){a=s,i.push(a);for(let e=1;e<o;e++)a=a.add(s),i.push(a);s=a.double()}return i},wNAF(t,o,i){const{windows:s,windowSize:a}=n(t);let c=e.ZERO,u=e.BASE;const f=BigInt(2**t-1),p=2**t,d=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let n=Number(i&f);i>>=d,n>a&&(n-=p,i+=Ho);const s=t,h=t+Math.abs(n)-1,l=e%2!=0,y=n<0;0===n?u=u.add(r(l,o[s])):c=c.add(r(y,o[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const o=e._WINDOW_SIZE||1;let i=t.get(e);return i||(i=this.precomputeWindow(e,o),1!==o&&t.set(e,n(i))),this.wNAF(o,i,r)}}}(E,8*a);function I(e){return Do(e,n)}function B(e){return I(xo(e))}function R(e){const t=a;e=Io("private key",e,t);const r=Io("hashed private key",i(e),2*t),n=d(r.slice(0,t)),o=r.slice(t,2*t),s=B(n),c=x.multiply(s),u=c.toRawBytes();return{head:n,prefix:o,scalar:s,point:c,pointBytes:u}}function P(e=new Uint8Array,...t){const r=Bo(...t);return B(i(h(r,Io("context",e),!!o)))}const k=$o;x._setWindowSize(8);return{CURVE:t,getPublicKey:function(e){return R(e).pointBytes},sign:function(e,t,n={}){e=Io("message",e),o&&(e=o(e));const{prefix:i,scalar:s,pointBytes:c}=R(t),u=P(n.context,i,e),f=x.multiply(u).toRawBytes(),p=I(u+P(n.context,f,c,e)*s);return b(p),Io("result",Bo(f,So(p,r.BYTES)),2*a)},verify:function(e,t,n,i=k){const{context:s,zip215:a}=i,c=r.BYTES;e=Io("signature",e,2*c),t=Io("message",t),o&&(t=o(t));const u=xo(e.slice(c,2*c));let f,p,d;try{f=E.fromHex(n,a),p=E.fromHex(e.slice(0,c),a),d=x.multiplyUnsafe(u)}catch(e){return!1}if(!a&&f.isSmallOrder())return!1;const h=P(s,p.toRawBytes(),f.toRawBytes(),t);return p.add(f.multiplyUnsafe(h)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:{getExtendedPublicKey:R,randomPrivateKey:()=>s(r.BYTES),precompute:(e=8,t=E.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}
|
|
17
17
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Jo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ei=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const ti=BigInt(1),ri=BigInt(2),ni=BigInt(5),oi=BigInt(10),ii=BigInt(20),si=BigInt(40),ai=BigInt(80);const ci=function(e,t,r=!1,n={}){if(e<=To)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=jo(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=zo(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Ro(o),ZERO:To,ONE:_o,create:t=>Do(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return To<=t&&t<e},is0:e=>e===To,isOdd:e=>(e&_o)===_o,neg:t=>Do(-t,e),eql:(e,t)=>e===t,sqr:t=>Do(t*t,e),add:(t,r)=>Do(t+r,e),sub:(t,r)=>Do(t-r,e),mul:(t,r)=>Do(t*r,e),pow:(e,t)=>function(e,t,r){if(r<To)throw new Error("Expected power > 0");if(r===To)return e.ONE;if(r===_o)return t;let n=e.ONE,o=t;for(;r>To;)r&_o&&(n=e.mul(n,o)),o=e.sqr(o),r>>=_o;return n}(a,e,t),div:(t,r)=>Do(t*Vo(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Vo(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n))),e.ONE),o=e.inv(n);return t.reduceRight(((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n))),o),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?So(e,i):Ao(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return r?xo(e):function(e){return bo(wo(e))}(e)}});return Object.freeze(a)}(Jo,void 0,!0),ui={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ci,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:po,randomBytes:function(e=32){if(gt&&"function"==typeof gt.getRandomValues)return gt.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){const r=Jo,n=Do(t*t*t,r),o=function(e){const t=Jo,r=e*e%t*e%t,n=Mo(r,ri,t)*r%t,o=Mo(n,ti,t)*e%t,i=Mo(o,ni,t)*o%t,s=Mo(i,oi,t)*i%t,a=Mo(s,ii,t)*s%t,c=Mo(a,si,t)*a%t,u=Mo(c,ai,t)*c%t,f=Mo(u,ai,t)*c%t,p=Mo(f,oi,t)*i%t;return{pow_p_5_8:Mo(p,ri,t)*e%t,b2:r}}(e*Do(n*n*t,r)).pow_p_5_8;let i=Do(e*n*o,r);const s=Do(t*i*i,r),a=i,c=Do(i*ei,r),u=s===e,f=s===Do(-e,r),p=s===Do(-e*ei,r);return u&&(i=a),(f||p)&&(i=c),(Do(i,r)&_o)===_o&&(i=Do(-i,r)),{isValid:u||f,value:i}}},fi=Qo(ui);const pi=(ci.ORDER+BigInt(3))/BigInt(8);
|
|
18
18
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
19
|
-
function hi(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function di(...e){const t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map((e=>e.encode)).reduceRight(r,t),decode:e.map((e=>e.decode)).reduce(r,t)}}function li(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(hi(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function yi(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function gi(e,t="="){if(hi(e),"string"!=typeof t)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 e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);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 e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function wi(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}ci.pow(ri,pi),ci.sqrt(ci.neg(ci.ONE)),ci.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);e.isOdd(r)&&e.neg(r)}(ci,ci.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const bi=(e,t)=>t?bi(t,e%t):e,mi=(e,t)=>e+(t-bi(e,t));function vi(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(mi(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${mi(t,r)}`);let o=0,i=0;const s=2**r-1,a=[];for(const n of e){if(hi(n),n>=2**t)throw new Error(`convertRadix2: invalid data word=${n} from=${t}`);if(o=o<<t|n,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)a.push((o>>i-r&s)>>>0);o&=2**i-1}if(o=o<<r-i&s,!n&&i>=t)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 Ei(e,t=!1){if(hi(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(mi(8,e)>32||mi(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}(r))throw new Error("radix2.encode input should be Uint8Array");return vi(Array.from(r),8,e,!t)},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(vi(r,e,8,t))}}}function xi(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}Ei(4),li("0123456789ABCDEF"),yi(""),Ei(5),li("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),gi(5),yi(""),Ei(5),li("0123456789ABCDEFGHIJKLMNOPQRSTUV"),gi(5),yi(""),Ei(5),li("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),yi(""),wi((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),Ei(6),li("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),gi(6),yi(""),Ei(6),li("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),gi(6),yi(""),Ei(6),li("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),yi("");const Ai=di(li("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),yi("")),Si=[996825010,642813549,513874426,1027748829,705979059];function Ii(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e<Si.length;e++)1==(t>>e&1)&&(r^=Si[e]);return r}function Bi(e,t,r=1){const n=e.length;let o=1;for(let t=0;t<n;t++){const r=e.charCodeAt(t);if(r<33||r>126)throw new Error(`Invalid prefix (${e})`);o=Ii(o)^r>>5}o=Ii(o);for(let t=0;t<n;t++)o=Ii(o)^31&e.charCodeAt(t);for(let e of t)o=Ii(o)^e;for(let e=0;e<6;e++)o=Ii(o);return o^=r,Ai.encode(vi([o%2**30],30,5,!1))}function Ri(e){const t="bech32"===e?1:734539939,r=Ei(5),n=r.decode,o=r.encode,i=xi(n);function s(e,r=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==r&&e.length>r)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=n).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=Ai.decode(s).slice(0,-6),c=Bi(i,a,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:a}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);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=e.length+7+r.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),s=Bi(i,r,t);return`${i}1${Ai.encode(r)}${s}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:r}=s(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:xi(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}const Pi=Ri("bech32");Ei(4),li("0123456789abcdef"),yi(""),wi((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));const ki=(e,t,r)=>fi.verify(t,e,r.toBytes()),Ti=(e,t)=>{const{pubkey:r}=Ln(t+"."+e,exports.RecordVersion.V1);return r};async function _i(e,t,r,n){const o=Ti(t,r);let{registry:i}=await dt.retrieve(e,o);if(!i.data)throw new ke(exports.ErrorType.NoRecordData);if(n)return Li(i,r,o);const s=Lr.get(r);return i.data=i.data.slice(0,s),i}const Ui=async(e,t)=>await _i(e,t,exports.Record.SOL),Li=(t,r,o)=>{const i=null==t?void 0:t.data;if(!i)return;if(0===i.compare(n.Buffer.alloc(i.length)))return;const s=Lr.get(r),a=(e=>{const t=Array.from(e);return t.length-1-t.reverse().findIndex((e=>0!==e))+1})(i);if(!s){const e=i.slice(0,a).toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?Jn(e):e}if(r===exports.Record.SOL){const e=new TextEncoder,r=n.Buffer.concat([i.slice(0,32),o.toBuffer()]),s=e.encode(r.toString("hex"));if(ki(s,i.slice(32,96),t.owner))return Fn.encode(i.slice(0,32))}if(s&&a!==s){const e=i.slice(0,a).toString("utf-8");if(r===exports.Record.Injective){const t=Pi.decodeToBytes(e);if("inj"===t.prefix&&20===t.bytes.length)return e}else if(r===exports.Record.BSC||r===exports.Record.ETH){const t=e.slice(0,2),r=e.slice(2);if("0x"===t&&20===n.Buffer.from(r,"hex").length)return e}else if((r===exports.Record.A||r===exports.Record.AAAA)&&Kn.isValid(e))return e;throw new ke(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 Pi.encode("inj",Pi.toWords(i.slice(0,s)));if(r===exports.Record.A||r===exports.Record.AAAA)return Kn.fromByteArray([...i.slice(0,s)]).toString();if(r===exports.Record.Background)return new e.PublicKey(i.slice(0,s)).toString();throw new ke(exports.ErrorType.InvalidRecordData)},Ci=(t,r)=>{if(!Lr.get(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(t=eo(t)),n.Buffer.from(t,"utf-8");if(r===exports.Record.SOL)throw new ke(exports.ErrorType.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===exports.Record.ETH||r===exports.Record.BSC)return Dn("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(t.slice(2),"hex");if(r===exports.Record.Injective){const e=Pi.decodeToBytes(t);return Dn("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),Dn(20===e.bytes.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(e.bytes)}if(r===exports.Record.A){const e=Kn.parse(t).toByteArray();return Dn(4===e.length,exports.ErrorType.InvalidARecord),n.Buffer.from(e)}if(r===exports.Record.AAAA){const e=Kn.parse(t).toByteArray();return Dn(16===e.length,exports.ErrorType.InvalidAAAARecord),n.Buffer.from(e)}if(r===exports.Record.Background)return new e.PublicKey(t).toBuffer();throw new ke(exports.ErrorType.InvalidRecordInput)},Ni=(e,t,r,o)=>{const i=n.Buffer.concat([e.toBuffer(),t.toBuffer()]),s=(new TextEncoder).encode(i.toString("hex")),a=ki(s,o,r);return Dn(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([e.toBuffer(),o])},Oi=new Map([[exports.Record.Url,new e.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[exports.Record.CNAME,new e.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),Di=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC,exports.Record.BASE]),Wi=new Set([exports.Record.ETH,exports.Record.BSC,exports.Record.BASE]),Mi=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]),Vi=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),zi=(t,r)=>{if(Mi.has(r)){const e=t.toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?Jn(e):e}if(r===exports.Record.SOL)return new e.PublicKey(t).toBase58();if(Wi.has(r))return"0x"+t.toString("hex");if(r===exports.Record.Injective)return Pi.encode("inj",Pi.toWords(t));if(r===exports.Record.A||r===exports.Record.AAAA)return Kn.fromByteArray([...t]).toString();throw new ke(exports.ErrorType.InvalidARecord)},Fi=(t,r)=>{if(Mi.has(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(t=eo(t)),Buffer.from(t,"utf-8");if(r===exports.Record.SOL)return new e.PublicKey(t).toBuffer();if(Wi.has(r))return Dn("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(t.slice(2),"hex");if(r===exports.Record.Injective){const e=Pi.decodeToBytes(t);return Dn("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),Dn(20===e.bytes.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(e.bytes)}if(r===exports.Record.A){const e=Kn.parse(t).toByteArray();return Dn(4===e.length,exports.ErrorType.InvalidARecord),Buffer.from(e)}if(r===exports.Record.AAAA){const e=Kn.parse(t).toByteArray();return Dn(16===e.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(e)}throw new ke(exports.ErrorType.InvalidARecord)},ji=(e,t)=>{const{pubkey:r}=Ln(e),n=Pn("".concat(t));return kn(n,Br,r)};const Ki=new e.PublicKey("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Hi{constructor(t){this.tag=t.tag,this.nameAccount=new e.PublicKey(t.nameAccount)}static deserialize(e){return new Hi(Ge(this.schema,e))}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new ke(exports.ErrorType.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(t,r){return await e.PublicKey.findProgramAddress([n.Buffer.from("favourite_domain"),r.toBuffer()],t)}static getKeySync(t,r){return e.PublicKey.findProgramAddressSync([n.Buffer.from("favourite_domain"),r.toBuffer()],t)}}Hi.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};async function Gi(t,r,n,o,i,s,a,c){const u=Pn(r),f=kn(u,a,c),p=s||await t.getMinimumBalanceForRentExemption(n);let h;if(c){const{registry:e}=await er(t,c);h=e.owner}return qe(Ut,e.SystemProgram.programId,f,i,o,u,new _e(p),new Te(n),a,c,h)}async function qi(e,t,r,n,o){const i=Pn(t),s=kn(i,n,o);let a;a=n||(await dt.retrieve(e,s)).registry.owner;return Ze(Ut,s,r,a)}const Yi=async(t,r,n,o,i)=>{let[s]=await e.PublicKey.findProgramAddress([Nt.toBuffer()],Nt),a=Pn(t.toBase58()),c=kn(a,s,o);return[[],[new Qe({name:r}).getInstruction(Nt,Ut,Ct,c,e.SystemProgram.programId,s,n,e.SYSVAR_RENT_PUBKEY,o,i)]]},Xi=async(t,r,n,o,i,s)=>{Dn(n!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:a,hashed:c,parent:u}=Ln(`${n}.${r}`,exports.RecordVersion.V1),f=Ci(o,n).length,p=await t.getMinimumBalanceForRentExemption(f+dt.HEADER_LEN);return qe(Ut,e.SystemProgram.programId,a,i,s,c,new _e(p),new Te(f),void 0,u,i)},Zi=async(t,r,n,o,i,s)=>{const{pubkey:a,hashed:c,parent:u}=Ln(`${exports.Record.SOL}.${r}`,exports.RecordVersion.V1),f=Ni(n,a,o,i).length,p=await t.getMinimumBalanceForRentExemption(f+dt.HEADER_LEN);return[qe(Ut,e.SystemProgram.programId,a,o,s,c,new _e(p),new Te(f),void 0,u,o)]};class $i{constructor(e){this.twitterRegistryKey=e.twitterRegistryKey,this.twitterHandle=e.twitterHandle}static async retrieve(e,t){let r=await e.getAccountInfo(t,"processed");if(!r)throw new ke(exports.ErrorType.InvalidReverseTwitter);return new $i(Ge($i.schema,r.data.slice(dt.HEADER_LEN)))}}async function Qi(t,r,o,i,s){const a=Pn(i.toString()),c=kn(a,Mt,Vt);let u=He($i.schema,new $i({twitterRegistryKey:o.toBytes(),twitterHandle:r}));return[qe(Ut,e.SystemProgram.programId,c,i,s,a,new _e(await t.getMinimumBalanceForRentExemption(u.length+dt.HEADER_LEN)),new Te(u.length),Mt,Vt,Mt),Ye(Ut,c,new Te(0),n.Buffer.from(u),Mt)]}var Ji;$i.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},exports.CustomBg=void 0,(Ji=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",Ji.Rgb0x001="rgb0x00#1";const es=async(t,r,o)=>{const i=Ti(o,exports.Record.SOL),s=await Ui(t,o);if(!(null==s?void 0:s.data))throw new ke(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(!ki(u,s.data.slice(32),r))throw new ke(exports.ErrorType.InvalidSignature);return new e.PublicKey(s.data.slice(0,32))},ts=async(t,r,n)=>{try{const o=ji(n,exports.Record.SOL),i=await _r.retrieve(t,o),s=i.getStalenessId(),a=i.getRoAId(),c=i.getContent();if(0===s.compare(r.toBuffer())&&i.header.stalenessValidation===Rr.Solana&&0===a.compare(c)&&i.header.rightOfAssociationValidation===Rr.Solana)return new e.PublicKey(c)}catch(e){if(e instanceof Error&&"FetchError"===e.name)throw e}},rs=new e.PublicKey("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),ns=new e.PublicKey("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),os={NAME_PROGRAM_ID:new e.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new e.PublicKey("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new e.PublicKey("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new e.PublicKey("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new e.PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new e.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 e.PublicKey("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new e.PublicKey("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},is=(t,r,o)=>{const i=[t];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=e.PublicKey.findProgramAddressSync(i,os.NAME_PROGRAM_ID);return s},ss=(e,t=os.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Pn(e);return{pubkey:is(n,r,t),hashed:n}},as=e=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const t=e.split(".");if(2===t.length){const e="\0".concat(t[0]),{pubkey:r}=ss(t[1]);return{...ss(e,r),isSub:!0,parent:r}}if(t.length>=3)throw new ke(exports.ErrorType.InvalidInput);return{...ss(e,os.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},cs=(e,t)=>{const{pubkey:r,parent:n}=as(e),o=Pn(r.toBase58());return is(o,os.REVERSE_LOOKUP_CLASS,t?n:void 0)};async function us(t,r,n,o,i,s,a,c){const u=await tr(r),f=await is(u,a,c),p=s||await t.getMinimumBalanceForRentExemption(n);let h;if(c){const{registry:e}=await er(t,c);h=e.owner}return qe(os.NAME_PROGRAM_ID,e.SystemProgram.programId,f,i,o,u,new _e(p),new Te(n),a,c,h)}const fs=async(t,r,n,o,i)=>{let[s]=await e.PublicKey.findProgramAddress([os.REGISTER_PROGRAM_ID.toBuffer()],os.REGISTER_PROGRAM_ID),a=await tr(t.toBase58()),c=is(a,s,o);return[[],[new Qe({name:r}).getInstruction(os.REGISTER_PROGRAM_ID,os.NAME_PROGRAM_ID,os.ROOT_DOMAIN_ACCOUNT,c,e.SystemProgram.programId,s,n,e.SYSVAR_RENT_PUBKEY,o,i)]]},ps={utils:{getNameAccountKeySync:is,reverseLookup:async(e,t)=>{const r=Pn(t.toBase58()),n=is(r,os.REVERSE_LOOKUP_CLASS),{registry:o}=await dt.retrieve(e,n);if(!o.data)throw new ke(exports.ErrorType.NoAccountData);return Wn(o.data)},_deriveSync:ss,getDomainKeySync:as,getReverseKeySync:cs},constants:os,bindings:{createNameRegistry:us,updateNameRegistryData:async function(e,t,r,n,o,i){const s=await tr(t),a=is(s,o,i);let c;return c=o||(await dt.retrieve(e,a)).registry.owner,Ye(os.NAME_PROGRAM_ID,a,new Te(r),n,c)},transferNameOwnership:async function(e,t,r,n,o,i){const s=await tr(t),a=is(s,n,o);let c;return c=n||(await dt.retrieve(e,a)).registry.owner,Xe(os.NAME_PROGRAM_ID,a,r,c,n,o,i)},deleteNameRegistry:async function(e,t,r,n,o){const i=await tr(t),s=is(i,n,o);let a;return a=n||(await dt.retrieve(e,s)).registry.owner,Ze(os.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(t,r,n,o,i,s=os.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([os.REGISTER_PROGRAM_ID.toBuffer()],os.REGISTER_PROGRAM_ID),u=Pn(r),f=is(u,void 0,os.ROOT_DOMAIN_ACCOUNT),p=Pn(f.toBase58()),h=is(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],os.REGISTER_PROGRAM_ID),y=os.REFERRERS.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,os.VAULT_OWNER),m=ps.constants.PYTH_FEEDS.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const v=new Je({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(os.REGISTER_PROGRAM_ID,os.NAME_PROGRAM_ID,os.ROOT_DOMAIN_ACCOUNT,f,h,e.SystemProgram.programId,c,o,i,os.PYTH_MAPPING_ACC,new e.PublicKey(m.product),new e.PublicKey(m.price),b,d,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},createReverseName:fs,createSubdomain:async(e,t,r,n=2e3)=>{const o=[],i=t.split(".")[0];if(!i)throw new ke(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=as(t),c=await e.getMinimumBalanceForRentExemption(n+dt.HEADER_LEN),u=await us(e,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=cs(t,!0),p=await e.getAccountInfo(f);if(!(null==p?void 0:p.data)){const[,e]=await fs(a,"\0".concat(i),r,s,r);o.push(...e)}return[[],o]},burnDomain:(t,r,n)=>{const{pubkey:o}=as(t),[i]=e.PublicKey.findProgramAddressSync([o.toBuffer()],os.REGISTER_PROGRAM_ID),[s]=e.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],os.REGISTER_PROGRAM_ID);return(new tt).getInstruction(os.REGISTER_PROGRAM_ID,os.NAME_PROGRAM_ID,e.SystemProgram.programId,o,cs(t),s,i,os.REVERSE_LOOKUP_CLASS,r,n)},transferSubdomain:async(e,t,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=as(t);if(!a||!s)throw new ke(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:t}=await dt.retrieve(e,i);o=t.owner}let c,u;n&&(c=a,u=(await dt.retrieve(e,a)).registry.owner);return Xe(os.NAME_PROGRAM_ID,i,r,o,void 0,c,u)},registerDomainNameV2:async(t,r,n,o,i,s=os.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([os.REGISTER_PROGRAM_ID.toBuffer()],os.REGISTER_PROGRAM_ID),u=Pn(r),f=is(u,void 0,os.ROOT_DOMAIN_ACCOUNT),p=Pn(f.toBase58()),h=is(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],os.REGISTER_PROGRAM_ID),y=os.REFERRERS.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,os.VAULT_OWNER,!0),m=Jt.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const[v]=Mn(0,m),E=new nt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(os.REGISTER_PROGRAM_ID,os.NAME_PROGRAM_ID,os.ROOT_DOMAIN_ACCOUNT,f,h,e.SystemProgram.programId,c,o,o,o,i,v,b,d,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(E),w}}};exports.BONFIDA_FIDA_BNB=Dt,exports.BONFIDA_USDC_BNB=zt,exports.CUSTOM_BG_TLD=Xt,exports.DEFAULT_PYTH_PUSH_PROGRAM=Qt,exports.ETH_ROA_RECORDS=Di,exports.EVM_RECORDS=Wi,exports.FavouriteDomain=Hi,exports.GUARDIANS=Oi,exports.HASH_PREFIX=Lt,exports.METAPLEX_ID=$t,exports.NAME_OFFERS_ID=Ki,exports.NAME_PROGRAM_ID=Ut,exports.NameRegistryState=dt,exports.Numberu32=Te,exports.Numberu64=_e,exports.PYTH_FEEDS=Ht,exports.PYTH_FIDA_PRICE_ACC=Ot,exports.PYTH_MAPPING_ACC=Gt,exports.PYTH_PULL_FEEDS=Jt,exports.RECORD_V1_SIZE=Lr,exports.REFERRERS=jt,exports.REGISTER_PROGRAM_ID=Nt,exports.REVERSE_LOOKUP_CLASS=Wt,exports.ROOT_DOMAIN_ACCOUNT=Ct,exports.ReverseTwitterRegistryState=$i,exports.SELF_SIGNED=Vi,exports.SNSError=ke,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=Kt,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=Vt,exports.TWITTER_VERIFICATION_AUTHORITY=Mt,exports.USDC_MINT=Ft,exports.UTF8_ENCODED=Mi,exports.VAULT_OWNER=Yt,exports.VAULT_OWNER_DEPRECATED=qt,exports.WOLVES_COLLECTION_METADATA=Zt,exports.burnDomain=(t,r,n)=>{const{pubkey:o}=Ln(t),[i]=e.PublicKey.findProgramAddressSync([o.toBuffer()],Nt),[s]=e.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Nt);return(new tt).getInstruction(Nt,Ut,e.SystemProgram.programId,o,Nn(t),s,i,Wt,r,n)},exports.burnInstruction=tt,exports.changeTwitterRegistryData=async function(e,t,r,n){const o=Pn(e),i=kn(o,void 0,Vt);return[Ye(Ut,i,new Te(r),n,t)]},exports.changeVerifiedPubkey=async function(e,t,r,n,o){const i=Pn(t),s=kn(i,void 0,Vt);let a=[Xe(Ut,s,n,r,void 0)];return a.push(await qi(e,r.toString(),o,Mt,Vt)),a=a.concat(await Qi(e,t,s,n,o)),a},exports.check=Dn,exports.checkSolRecord=ki,exports.createInstruction=qe,exports.createInstructionV3=Je,exports.createNameRegistry=Gi,exports.createRecordInstruction=Xi,exports.createRecordV2Instruction=(t,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(c&&(a=Ln(t).pubkey),!a)throw new Error("Invalid parent");const u=((t,r,n,o,i,s,a,c)=>new mr({record:s,content:Array.from(a)}).getInstruction(c,e.SystemProgram.programId,i,t,r,n,o,Br))(i,s,a,o,Ut,"".concat(r),Fi(n,r),Ir);return u},exports.createReverseInstruction=Qe,exports.createReverseName=Yi,exports.createReverseTwitterRegistry=Qi,exports.createSolRecordInstruction=Zi,exports.createSplitV2Instruction=nt,exports.createSubdomain=async(e,t,r,n=2e3,o)=>{const i=[],s=t.split(".")[0];if(!s)throw new ke(exports.ErrorType.InvalidSubdomain);const{parent:a,pubkey:c}=Ln(t),u=await e.getMinimumBalanceForRentExemption(n+dt.HEADER_LEN),f=await Gi(e,"\0".concat(s),n,o||r,r,u,void 0,a);i.push(f);const p=Nn(t,!0),h=await e.getAccountInfo(p);if(!(null==h?void 0:h.data)){const[,e]=await Yi(c,"\0".concat(s),o||r,a,r);i.push(...e)}return[[],i]},exports.createV2Instruction=$e,exports.createVerifiedTwitterRegistry=async function(t,r,n,o,i){const s=Pn(r),a=kn(s,void 0,Vt),c=await t.getMinimumBalanceForRentExemption(o+dt.HEADER_LEN);let u=[qe(Ut,e.SystemProgram.programId,a,n,i,s,new _e(c),new Te(o),void 0,Vt,Mt)];return u=u.concat(await Qi(t,r,a,n,i)),u},exports.createWithNftInstruction=et,exports.deleteInstruction=Ze,exports.deleteNameRegistry=qi,exports.deleteRecordV2=(t,r,n,o)=>{let{pubkey:i,parent:s,isSub:a}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(a&&(s=Ln(t).pubkey),!s)throw new Error("Invalid parent");const c=((t,r,n,o,i,s)=>(new Ar).getInstruction(s,e.SystemProgram.programId,i,t,o,r,n,Br))(o,s,n,i,Ut,Ir);return c},exports.deleteTwitterRegistry=async function(e,t){const r=Pn(e),n=kn(r,void 0,Vt),o=Pn(t.toString()),i=kn(o,Mt,Vt);return[Ze(Ut,n,t,t),Ze(Ut,i,t,t)]},exports.deserializeRecord=Li,exports.deserializeRecordV2Content=zi,exports.deserializeReverse=Wn,exports.devnet=ps,exports.ethValidateRecordV2Content=(t,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(u&&(c=Ln(t).pubkey),!c)throw new Error("Invalid parent");const f=((t,r,n,o,i,s,a,c,u)=>new vr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(c)}).getInstruction(u,e.SystemProgram.programId,i,t,r,n,o,Br))(o,a,c,n,Ut,Rr.Ethereum,i,s,Ir);return f},exports.findSubdomains=async(e,t)=>{const r=[{memcmp:{offset:0,bytes:t.toBase58()}},{memcmp:{offset:64,bytes:Wt.toBase58()}}],n=await e.getProgramAccounts(Ut,{filters:r}),o=[{memcmp:{offset:0,bytes:t.toBase58()}}],i=await e.getProgramAccounts(Ut,{filters:o,dataSlice:{offset:0,length:0}}),s=new Map(n.map((e=>[e.pubkey.toBase58(),Wn(e.account.data.slice(96))]))),a=[];return i.forEach((e=>{const r=On(e.pubkey,t).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=Cn,exports.getAllRegisteredDomains=async e=>{const t=[{memcmp:{offset:0,bytes:Ct.toBase58()}}];return await e.getProgramAccounts(Ut,{dataSlice:{offset:32,length:32},filters:t})},exports.getArtistPubkey=e=>{switch(e){case exports.CustomBg.DegenPoet1:return rs;case exports.CustomBg.Rgb0x001:return ns;default:throw new ke(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(e,t)=>await _i(e,t,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(e,t)=>await _i(e,t,exports.Record.Background,!0),exports.getBackpackRecord=async(e,t)=>await _i(e,t,exports.Record.Backpack,!0),exports.getBscRecord=async(e,t)=>await _i(e,t,exports.Record.BSC,!0),exports.getBtcRecord=async(e,t)=>await _i(e,t,exports.Record.BTC,!0),exports.getCustomBgKeys=(e,t)=>{const r=Pn(t),n=Pn(e),o=kn(n,void 0,Xt);return{domainKey:o,bgKey:kn(r,void 0,o)}},exports.getDiscordRecord=async(e,t)=>await _i(e,t,exports.Record.Discord,!0),exports.getDogeRecord=async(e,t)=>await _i(e,t,exports.Record.DOGE,!0),exports.getDomainKey=or,exports.getDomainKeySync=Ln,exports.getDomainKeysWithReverses=async function(e,t){const r=await Cn(e,t),n=await _n(e,r);return r.map(((e,t)=>({pubKey:e,domain:n[t]})))},exports.getDomainMint=st,exports.getDomainPriceFromName=e=>{switch(Rn(e).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}},exports.getEmailRecord=async(e,t)=>await _i(e,t,exports.Record.Email,!0),exports.getEthRecord=async(e,t)=>await _i(e,t,exports.Record.ETH,!0),exports.getFavoriteDomain=async(t,r)=>{const[n]=Hi.getKeySync(Ki,new e.PublicKey(r)),o=await Hi.retrieve(t,n),i=await Tn(t,o.nameAccount),{registry:s,nftOwner:a}=await dt.retrieve(t,o.nameAccount),c=a||s.owner;return{domain:o.nameAccount,reverse:i,stale:!r.equals(c)}},exports.getGithubRecord=async(e,t)=>await _i(e,t,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(t,r){const n=Pn(r.toString()),o=kn(n,Mt,Vt);let i=await $i.retrieve(t,o);return[i.twitterHandle,new e.PublicKey(i.twitterRegistryKey)]},exports.getHashedName=tr,exports.getHashedNameSync=Pn,exports.getInjectiveRecord=async(e,t)=>await _i(e,t,exports.Record.Injective,!0),exports.getIpfsRecord=async(e,t)=>await _i(e,t,exports.Record.IPFS,!0),exports.getLtcRecord=async(e,t)=>await _i(e,t,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(t,r)=>{const n=[],o=r.map((e=>Hi.getKeySync(Ki,e)[0])),i=(await t.getMultipleAccountsInfo(o)).map((t=>(null==t?void 0:t.data)?Hi.deserialize(null==t?void 0:t.data).nameAccount:e.PublicKey.default)),s=i.map((e=>On(e))),a=i.map(((e,t)=>Be(st(e),r[t],!0))),[c,u,f]=await Promise.all([t.getMultipleAccountsInfo(i),t.getMultipleAccountsInfo(s),t.getMultipleAccountsInfo(a)]);for(let t=0;t<r.length;t++){const o=c[t],i=u[t],s=f[t];if(!o||!i){n.push(void 0);continue}if(new e.PublicKey(null==o?void 0:o.data.slice(32,64)).equals(r[t])){n.push(Wn(null==i?void 0:i.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=Ee.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Wn(null==i?void 0:i.data.slice(96)))}return n},exports.getMultipleRecordsV2=async function(e,t,r,n={}){const o=r.map((e=>ji(t,e))),i=await _r.retrieveBatch(e,o);return n.deserialize?i.map(((e,t)=>{if(e)return{retrievedRecord:e,record:r[t],deserializedContent:zi(e.getContent(),r[t])}})):i.map(((e,t)=>{if(e)return{retrievedRecord:e,record:r[t]}}))},exports.getNameAccountKey=rr,exports.getNameAccountKeySync=kn,exports.getNameOwner=er,exports.getPicRecord=async(e,t)=>await _i(e,t,exports.Record.Pic,!0),exports.getPointRecord=async(e,t)=>await _i(e,t,exports.Record.POINT,!0),exports.getPythFeedAccountKey=Mn,exports.getRecord=_i,exports.getRecordKeySync=Ti,exports.getRecordV2=async function(e,t,r,n={}){const o=ji(t,r),i=await _r.retrieve(e,o);return n.deserialize?{retrievedRecord:i,deserializedContent:zi(i.getContent(),r)}:{retrievedRecord:i}},exports.getRecordV2Key=ji,exports.getRecords=async function(e,t,r,n){const o=r.map((e=>Ti(t,e))),i=await dt.retrieveBatch(e,o);return n?i.map(((e,n)=>{if(e)return Li(e,r[n],Ti(t,r[n]))})):i},exports.getRedditRecord=async(e,t)=>await _i(e,t,exports.Record.Reddit,!0),exports.getReverseKey=async(e,t)=>{const{pubkey:r,parent:n}=await or(e),o=await tr(r.toBase58());return await rr(o,Wt,t?n:void 0)},exports.getReverseKeyFromDomainKey=On,exports.getReverseKeySync=Nn,exports.getShdwRecord=async(e,t)=>await _i(e,t,exports.Record.SHDW,!0),exports.getSolRecord=Ui,exports.getTelegramRecord=async(e,t)=>await _i(e,t,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(e,t)=>{const r=await ht(e,t),n=await _n(e,r.map((e=>e.nameAccount)));return n.map(((e,t)=>({key:r[t].nameAccount,mint:r[t].nftMint,reverse:e}))).filter((e=>!!e.reverse))},exports.getTwitterHandleandRegistryKeyViaFilters=async function(t,r){const n=[{memcmp:{offset:0,bytes:Vt.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Mt.toBase58()}}],o=await t.getProgramAccounts(Ut,{filters:n});for(const t of o)if(t.account.data.length>dt.HEADER_LEN+32){const r=t.account.data.slice(dt.HEADER_LEN),n=new $i(Ge($i.schema,r));return[n.twitterHandle,new e.PublicKey(n.twitterRegistryKey)]}throw new ke(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(e,t)=>await _i(e,t,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(e,t){const r=Pn(t),n=kn(r,void 0,Vt),{registry:o}=await dt.retrieve(e,n);return o},exports.getTwitterRegistryData=async function(t,r){const o=[{memcmp:{offset:0,bytes:Vt.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new e.PublicKey(n.Buffer.alloc(32,0)).toBase58()}}],i=await t.getProgramAccounts(Ut,{filters:o});if(i.length>1)throw new ke(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(dt.HEADER_LEN)},exports.getTwitterRegistryKey=async function(e){const t=Pn(e);return kn(t,void 0,Vt)},exports.getUrlRecord=async(e,t)=>await _i(e,t,exports.Record.Url,!0),exports.performReverseLookup=async function(e,t){const r=await tr(t.toBase58()),n=await rr(r,Wt),{registry:o}=await dt.retrieve(e,n);if(!o.data)throw new ke(exports.ErrorType.NoAccountData);const i=o.data.slice(0,4).readUInt32LE(0);return o.data.slice(4,4+i).toString()},exports.performReverseLookupBatch=async function(e,t){let r=[];for(let e of t){const t=await tr(e.toBase58()),n=await rr(t,Wt);r.push(n)}return(await dt.retrieveBatch(e,r)).map((e=>{if(void 0===e||void 0===e.data)return;const t=e.data.slice(0,4).readUInt32LE(0);return e.data.slice(4,4+t).toString()}))},exports.reallocInstruction=function(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})},exports.registerDomainName=async(t,r,n,o,i,s=Ft,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([Nt.toBuffer()],Nt),u=Pn(r),f=kn(u,void 0,Ct),p=Pn(f.toBase58()),h=kn(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],Nt),y=jt.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,Yt,!0),m=Ht.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const v=new Je({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Nt,Ut,Ct,f,h,e.SystemProgram.programId,c,o,i,Gt,new e.PublicKey(m.product),new e.PublicKey(m.price),b,d,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},exports.registerDomainNameV2=async(t,r,n,o,i,s=Ft,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([Nt.toBuffer()],Nt),u=Pn(r),f=kn(u,void 0,Ct),p=Pn(f.toBase58()),h=kn(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],Nt),y=jt.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,Yt,!0),m=Jt.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const[v]=Mn(0,m),E=new nt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Nt,Ut,Ct,f,h,e.SystemProgram.programId,c,o,o,o,i,v,b,d,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(E),w},exports.registerFavorite=(t,r)=>{const[n]=Hi.getKeySync(Ki,r);return[(new rt).getInstruction(Ki,t,n,r,e.SystemProgram.programId)]},exports.registerFavoriteInstruction=rt,exports.registerWithNft=(t,r,n,o,i,s,a,c,u)=>{const[f]=e.PublicKey.findProgramAddressSync([n.toBuffer()],Nt);return new et({space:r,name:t}).getInstruction(Nt,Ut,Ct,n,o,e.SystemProgram.programId,Wt,i,s,a,c,u,Zt,d,e.SYSVAR_RENT_PUBKEY,f,$t)},exports.resolve=async(e,t)=>{const{pubkey:r}=Ln(t),{registry:n,nftOwner:o}=await dt.retrieve(e,r);if(o)return o;try{const r=await ts(e,n.owner,t);if(void 0!==r)return r;return await es(e,n.owner,t)}catch(e){if(e instanceof Error&&"FetchError"===e.name)throw e}return n.owner},exports.resolveSolRecordV1=es,exports.resolveSolRecordV2=ts,exports.retrieveNftOwner=ut,exports.retrieveNfts=async t=>{const r=await t.getProgramAccounts(ot,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((t=>new e.PublicKey(t.account.data.slice(66,98))))},exports.retrieveRecords=ht,exports.reverseLookup=Tn,exports.reverseLookupBatch=_n,exports.serializeRecord=Ci,exports.serializeRecordV2Content=Fi,exports.serializeSolRecord=Ni,exports.transferInstruction=Xe,exports.transferNameOwnership=async function(e,t,r,n,o,i){const s=Pn(t),a=kn(s,n,o);let c;return c=n||(await dt.retrieve(e,a)).registry.owner,Xe(Ut,a,r,c,n,o,i)},exports.transferSubdomain=async(e,t,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=Ln(t);if(!a||!s)throw new ke(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:t}=await dt.retrieve(e,i);o=t.owner}let c,u;n&&(c=a,u=(await dt.retrieve(e,a)).registry.owner);return Xe(Ut,i,r,o,void 0,c,u)},exports.updateInstruction=Ye,exports.updateNameRegistryData=async function(e,t,r,n,o,i){const s=Pn(t),a=kn(s,o,i);let c;return c=o||(await dt.retrieve(e,a)).registry.owner,Ye(Ut,a,new Te(r),n,c)},exports.updateRecordInstruction=async(e,t,r,n,o,i)=>{Dn(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=Ln(`${r}.${t}`,exports.RecordVersion.V1),a=await e.getAccountInfo(s);Dn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const c=Ci(n,r);if((null==a?void 0:a.data.slice(96).length)!==c.length)return[Ze(Ut,s,i,o),await Xi(e,t,r,n,o,i)];return[Ye(Ut,s,new Te(0),c,o)]},exports.updateRecordV2Instruction=(t,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(c&&(a=Ln(t).pubkey),!a)throw new Error("Invalid parent");const u=((t,r,n,o,i,s,a,c)=>new xr({record:s,content:Array.from(a)}).getInstruction(c,e.SystemProgram.programId,i,t,r,n,o,Br))(i,s,a,o,Ut,"".concat(r),Fi(n,r),Ir);return u},exports.updateSolRecordInstruction=async(e,t,r,n,o,i)=>{const{pubkey:s}=Ln(`${exports.Record.SOL}.${t}`,exports.RecordVersion.V1),a=await e.getAccountInfo(s);if(Dn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Ze(Ut,s,i,n),await Zi(e,t,r,n,o,i)];const c=Ni(r,s,n,o);return[Ye(Ut,s,new Te(0),c,n)]},exports.validateRecordV2Content=(t,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Ln(`${n}.${r}`,exports.RecordVersion.V2);if(u&&(c=Ln(r).pubkey),!c)throw new Error("Invalid parent");const f=((t,r,n,o,i,s,a,c)=>new Er({staleness:a}).getInstruction(c,e.SystemProgram.programId,s,t,r,n,o,Br,i))(i,a,c,o,s,Ut,t,Ir);return f},exports.verifyRightOfAssociation=async(e,t,r,n)=>{var o;const i=ji(r,t),s=await _r.retrieve(e,i),a=s.getRoAId(),c=Di.has(t)?Rr.Ethereum:Rr.Solana;if(!(n=null!=n?n:null===(o=Oi.get(t))||void 0===o?void 0:o.toBuffer()))throw new ke(exports.ErrorType.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===c},exports.verifyStaleness=async(t,r,n)=>{const o=ji(n,r),{registry:i,nftOwner:s}=await dt.retrieve(t,Ln(n).pubkey),a=s||i.owner,c=await _r.retrieve(t,o),u=c.getStalenessId();return(null==a?void 0:a.equals(new e.PublicKey(u)))&&c.header.stalenessValidation===Rr.Solana},exports.writRoaRecordV2=(t,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(c&&(a=Ln(t).pubkey),!a)throw new Error("Invalid parent");const u=((t,r,n,o,i,s,a)=>new Sr({roaId:Array.from(s.toBuffer())}).getInstruction(a,e.SystemProgram.programId,r,t,n,o,i,Br))(o,Ut,s,a,n,i,Ir);return u};
|
|
19
|
+
function di(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function hi(...e){const t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map((e=>e.encode)).reduceRight(r,t),decode:e.map((e=>e.decode)).reduce(r,t)}}function li(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(di(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function yi(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function gi(e,t="="){if(di(e),"string"!=typeof t)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 e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);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 e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function wi(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}ci.pow(ri,pi),ci.sqrt(ci.neg(ci.ONE)),ci.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);e.isOdd(r)&&e.neg(r)}(ci,ci.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const bi=(e,t)=>t?bi(t,e%t):e,mi=(e,t)=>e+(t-bi(e,t));function vi(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(mi(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${mi(t,r)}`);let o=0,i=0;const s=2**r-1,a=[];for(const n of e){if(di(n),n>=2**t)throw new Error(`convertRadix2: invalid data word=${n} from=${t}`);if(o=o<<t|n,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)a.push((o>>i-r&s)>>>0);o&=2**i-1}if(o=o<<r-i&s,!n&&i>=t)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 Ei(e,t=!1){if(di(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(mi(8,e)>32||mi(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}(r))throw new Error("radix2.encode input should be Uint8Array");return vi(Array.from(r),8,e,!t)},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(vi(r,e,8,t))}}}function xi(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}Ei(4),li("0123456789ABCDEF"),yi(""),Ei(5),li("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),gi(5),yi(""),Ei(5),li("0123456789ABCDEFGHIJKLMNOPQRSTUV"),gi(5),yi(""),Ei(5),li("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),yi(""),wi((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),Ei(6),li("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),gi(6),yi(""),Ei(6),li("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),gi(6),yi(""),Ei(6),li("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),yi("");const Ai=hi(li("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),yi("")),Si=[996825010,642813549,513874426,1027748829,705979059];function Ii(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e<Si.length;e++)1==(t>>e&1)&&(r^=Si[e]);return r}function Bi(e,t,r=1){const n=e.length;let o=1;for(let t=0;t<n;t++){const r=e.charCodeAt(t);if(r<33||r>126)throw new Error(`Invalid prefix (${e})`);o=Ii(o)^r>>5}o=Ii(o);for(let t=0;t<n;t++)o=Ii(o)^31&e.charCodeAt(t);for(let e of t)o=Ii(o)^e;for(let e=0;e<6;e++)o=Ii(o);return o^=r,Ai.encode(vi([o%2**30],30,5,!1))}function Ri(e){const t="bech32"===e?1:734539939,r=Ei(5),n=r.decode,o=r.encode,i=xi(n);function s(e,r=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==r&&e.length>r)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=n).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=Ai.decode(s).slice(0,-6),c=Bi(i,a,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:a}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);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=e.length+7+r.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),s=Bi(i,r,t);return`${i}1${Ai.encode(r)}${s}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:r}=s(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:xi(s),fromWords:n,fromWordsUnsafe:i,toWords:o}}const Pi=Ri("bech32");Ei(4),li("0123456789abcdef"),yi(""),wi((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));const ki=(e,t,r)=>fi.verify(t,e,r.toBytes()),Ti=(e,t)=>{const{pubkey:r}=Ln(t+"."+e,exports.RecordVersion.V1);return r};async function _i(e,t,r,n){const o=Ti(t,r);let{registry:i}=await ht.retrieve(e,o);if(!i.data)throw new ke(exports.ErrorType.NoRecordData);if(n)return Li(i,r,o);const s=Lr.get(r);return i.data=i.data.slice(0,s),i}const Ui=async(e,t)=>await _i(e,t,exports.Record.SOL),Li=(t,r,o)=>{const i=null==t?void 0:t.data;if(!i)return;if(0===i.compare(n.Buffer.alloc(i.length)))return;const s=Lr.get(r),a=(e=>{const t=Array.from(e);return t.length-1-t.reverse().findIndex((e=>0!==e))+1})(i);if(!s){const e=i.slice(0,a).toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?Jn(e):e}if(r===exports.Record.SOL){const e=new TextEncoder,r=n.Buffer.concat([i.slice(0,32),o.toBuffer()]),s=e.encode(r.toString("hex"));if(ki(s,i.slice(32,96),t.owner))return Fn.encode(i.slice(0,32))}if(s&&a!==s){const e=i.slice(0,a).toString("utf-8");if(r===exports.Record.Injective){const t=Pi.decodeToBytes(e);if("inj"===t.prefix&&20===t.bytes.length)return e}else if(r===exports.Record.BSC||r===exports.Record.ETH){const t=e.slice(0,2),r=e.slice(2);if("0x"===t&&20===n.Buffer.from(r,"hex").length)return e}else if((r===exports.Record.A||r===exports.Record.AAAA)&&Kn.isValid(e))return e;throw new ke(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 Pi.encode("inj",Pi.toWords(i.slice(0,s)));if(r===exports.Record.A||r===exports.Record.AAAA)return Kn.fromByteArray([...i.slice(0,s)]).toString();if(r===exports.Record.Background)return new e.PublicKey(i.slice(0,s)).toString();throw new ke(exports.ErrorType.InvalidRecordData)},Ci=(t,r)=>{if(!Lr.get(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(t=eo(t)),n.Buffer.from(t,"utf-8");if(r===exports.Record.SOL)throw new ke(exports.ErrorType.UnsupportedRecord,"Use `serializeSolRecord` for SOL record");if(r===exports.Record.ETH||r===exports.Record.BSC)return Dn("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),n.Buffer.from(t.slice(2),"hex");if(r===exports.Record.Injective){const e=Pi.decodeToBytes(t);return Dn("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),Dn(20===e.bytes.length,exports.ErrorType.InvalidInjectiveAddress),n.Buffer.from(e.bytes)}if(r===exports.Record.A){const e=Kn.parse(t).toByteArray();return Dn(4===e.length,exports.ErrorType.InvalidARecord),n.Buffer.from(e)}if(r===exports.Record.AAAA){const e=Kn.parse(t).toByteArray();return Dn(16===e.length,exports.ErrorType.InvalidAAAARecord),n.Buffer.from(e)}if(r===exports.Record.Background)return new e.PublicKey(t).toBuffer();throw new ke(exports.ErrorType.InvalidRecordInput)},Ni=(e,t,r,o)=>{const i=n.Buffer.concat([e.toBuffer(),t.toBuffer()]),s=(new TextEncoder).encode(i.toString("hex")),a=ki(s,o,r);return Dn(a,exports.ErrorType.InvalidSignature),n.Buffer.concat([e.toBuffer(),o])},Oi=new Map([[exports.Record.Url,new e.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")],[exports.Record.CNAME,new e.PublicKey("ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3")]]),Di=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.BSC,exports.Record.BASE]),Wi=new Set([exports.Record.ETH,exports.Record.BSC,exports.Record.BASE]),Mi=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]),Vi=new Set([exports.Record.ETH,exports.Record.Injective,exports.Record.SOL]),zi=(t,r)=>{if(Mi.has(r)){const e=t.toString("utf-8");return r===exports.Record.CNAME||r===exports.Record.TXT?Jn(e):e}if(r===exports.Record.SOL)return new e.PublicKey(t).toBase58();if(Wi.has(r))return"0x"+t.toString("hex");if(r===exports.Record.Injective)return Pi.encode("inj",Pi.toWords(t));if(r===exports.Record.A||r===exports.Record.AAAA)return Kn.fromByteArray([...t]).toString();throw new ke(exports.ErrorType.InvalidARecord)},Fi=(t,r)=>{if(Mi.has(r))return r!==exports.Record.CNAME&&r!==exports.Record.TXT||(t=eo(t)),Buffer.from(t,"utf-8");if(r===exports.Record.SOL)return new e.PublicKey(t).toBuffer();if(Wi.has(r))return Dn("0x"===t.slice(0,2),exports.ErrorType.InvalidEvmAddress),Buffer.from(t.slice(2),"hex");if(r===exports.Record.Injective){const e=Pi.decodeToBytes(t);return Dn("inj"===e.prefix,exports.ErrorType.InvalidInjectiveAddress),Dn(20===e.bytes.length,exports.ErrorType.InvalidInjectiveAddress),Buffer.from(e.bytes)}if(r===exports.Record.A){const e=Kn.parse(t).toByteArray();return Dn(4===e.length,exports.ErrorType.InvalidARecord),Buffer.from(e)}if(r===exports.Record.AAAA){const e=Kn.parse(t).toByteArray();return Dn(16===e.length,exports.ErrorType.InvalidAAAARecord),Buffer.from(e)}throw new ke(exports.ErrorType.InvalidARecord)},ji=(e,t)=>{const{pubkey:r}=Ln(e),n=Pn("".concat(t));return kn(n,Br,r)};const Ki=new e.PublicKey("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");class Hi{constructor(t){this.tag=t.tag,this.nameAccount=new e.PublicKey(t.nameAccount)}static deserialize(e){return new Hi(Ge(this.schema,e))}static async retrieve(e,t){const r=await e.getAccountInfo(t);if(!r||!r.data)throw new ke(exports.ErrorType.FavouriteDomainNotFound);return this.deserialize(r.data)}static async getKey(t,r){return await e.PublicKey.findProgramAddress([n.Buffer.from("favourite_domain"),r.toBuffer()],t)}static getKeySync(t,r){return e.PublicKey.findProgramAddressSync([n.Buffer.from("favourite_domain"),r.toBuffer()],t)}}Hi.schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};async function Gi(t,r,n,o,i,s,a,c){const u=Pn(r),f=kn(u,a,c),p=s||await t.getMinimumBalanceForRentExemption(n);let d;if(c){const{registry:e}=await er(t,c);d=e.owner}return qe(Ut,e.SystemProgram.programId,f,i,o,u,new _e(p),new Te(n),a,c,d)}async function qi(e,t,r,n,o){const i=Pn(t),s=kn(i,n,o);let a;a=n||(await ht.retrieve(e,s)).registry.owner;return Ze(Ut,s,r,a)}const Yi=async(t,r,n,o,i)=>{let[s]=await e.PublicKey.findProgramAddress([Nt.toBuffer()],Nt),a=Pn(t.toBase58()),c=kn(a,s,o);return[[],[new Qe({name:r}).getInstruction(Nt,Ut,Ct,c,e.SystemProgram.programId,s,n,e.SYSVAR_RENT_PUBKEY,o,i)]]},Xi=async(t,r,n,o,i,s)=>{Dn(n!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:a,hashed:c,parent:u}=Ln(`${n}.${r}`,exports.RecordVersion.V1),f=Ci(o,n).length,p=await t.getMinimumBalanceForRentExemption(f+ht.HEADER_LEN);return qe(Ut,e.SystemProgram.programId,a,i,s,c,new _e(p),new Te(f),void 0,u,i)},Zi=async(t,r,n,o,i,s)=>{const{pubkey:a,hashed:c,parent:u}=Ln(`${exports.Record.SOL}.${r}`,exports.RecordVersion.V1),f=Ni(n,a,o,i).length,p=await t.getMinimumBalanceForRentExemption(f+ht.HEADER_LEN);return[qe(Ut,e.SystemProgram.programId,a,o,s,c,new _e(p),new Te(f),void 0,u,o)]};class $i{constructor(e){this.twitterRegistryKey=e.twitterRegistryKey,this.twitterHandle=e.twitterHandle}static async retrieve(e,t){let r=await e.getAccountInfo(t,"processed");if(!r)throw new ke(exports.ErrorType.InvalidReverseTwitter);return new $i(Ge($i.schema,r.data.slice(ht.HEADER_LEN)))}}async function Qi(t,r,o,i,s){const a=Pn(i.toString()),c=kn(a,Mt,Vt);let u=He($i.schema,new $i({twitterRegistryKey:o.toBytes(),twitterHandle:r}));return[qe(Ut,e.SystemProgram.programId,c,i,s,a,new _e(await t.getMinimumBalanceForRentExemption(u.length+ht.HEADER_LEN)),new Te(u.length),Mt,Vt,Mt),Ye(Ut,c,new Te(0),n.Buffer.from(u),Mt)]}var Ji;$i.schema={struct:{twitterRegistryKey:{array:{type:"u8",len:32}},twitterHandle:"string"}},exports.CustomBg=void 0,(Ji=exports.CustomBg||(exports.CustomBg={})).DegenPoet1="DegenPoet#1",Ji.Rgb0x001="rgb0x00#1",Ji.Retardio1="Retardio#1",Ji.Retardio2="Retardio#2",Ji.Retardio3="Retardio#3";const es=async(t,r,o)=>{const i=Ti(o,exports.Record.SOL),s=await Ui(t,o);if(!(null==s?void 0:s.data))throw new ke(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(!ki(u,s.data.slice(32),r))throw new ke(exports.ErrorType.InvalidSignature);return new e.PublicKey(s.data.slice(0,32))},ts=async(t,r,n)=>{try{const o=ji(n,exports.Record.SOL),i=await _r.retrieve(t,o),s=i.getStalenessId(),a=i.getRoAId(),c=i.getContent();if(0===s.compare(r.toBuffer())&&i.header.stalenessValidation===Rr.Solana&&0===a.compare(c)&&i.header.rightOfAssociationValidation===Rr.Solana)return new e.PublicKey(c)}catch(e){if(e instanceof Error&&"FetchError"===e.name)throw e}},rs=new e.PublicKey("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD"),ns=new e.PublicKey("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g"),os=new e.PublicKey("J2Q2j6kpSg7tq8JzueCHNTQNcyNnQkvr85RhsFnYZWeG"),is={NAME_PROGRAM_ID:new e.PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new e.PublicKey("5eoDkP6vCQBXqDV9YN2NdUs3nmML3dMRNmEYpiyVNBm2"),REGISTER_PROGRAM_ID:new e.PublicKey("snshBoEQ9jx4QoHBpZDQPYdNCtw7RMxJvYrKFEhwaPJ"),REVERSE_LOOKUP_CLASS:new e.PublicKey("7NbD1vprif6apthEZAqhRfYuhrqnuderB8qpnfXGCc8H"),USDC_MINT:new e.PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"),REFERRERS:[new e.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 e.PublicKey("BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"),VAULT_OWNER:new e.PublicKey("SNSaTJbEv2iT3CUrCQYa9zpGjbBVWhFCPaSJHkaJX34")},ss=(t,r,o)=>{const i=[t];r?i.push(r.toBuffer()):i.push(n.Buffer.alloc(32)),o?i.push(o.toBuffer()):i.push(n.Buffer.alloc(32));const[s]=e.PublicKey.findProgramAddressSync(i,is.NAME_PROGRAM_ID);return s},as=(e,t=is.ROOT_DOMAIN_ACCOUNT,r)=>{let n=Pn(e);return{pubkey:ss(n,r,t),hashed:n}},cs=e=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const t=e.split(".");if(2===t.length){const e="\0".concat(t[0]),{pubkey:r}=as(t[1]);return{...as(e,r),isSub:!0,parent:r}}if(t.length>=3)throw new ke(exports.ErrorType.InvalidInput);return{...as(e,is.ROOT_DOMAIN_ACCOUNT),isSub:!1,parent:void 0}},us=(e,t)=>{const{pubkey:r,parent:n}=cs(e),o=Pn(r.toBase58());return ss(o,is.REVERSE_LOOKUP_CLASS,t?n:void 0)};async function fs(t,r,n,o,i,s,a,c){const u=await tr(r),f=await ss(u,a,c),p=s||await t.getMinimumBalanceForRentExemption(n);let d;if(c){const{registry:e}=await er(t,c);d=e.owner}return qe(is.NAME_PROGRAM_ID,e.SystemProgram.programId,f,i,o,u,new _e(p),new Te(n),a,c,d)}const ps=async(t,r,n,o,i)=>{let[s]=await e.PublicKey.findProgramAddress([is.REGISTER_PROGRAM_ID.toBuffer()],is.REGISTER_PROGRAM_ID),a=await tr(t.toBase58()),c=ss(a,s,o);return[[],[new Qe({name:r}).getInstruction(is.REGISTER_PROGRAM_ID,is.NAME_PROGRAM_ID,is.ROOT_DOMAIN_ACCOUNT,c,e.SystemProgram.programId,s,n,e.SYSVAR_RENT_PUBKEY,o,i)]]},ds={utils:{getNameAccountKeySync:ss,reverseLookup:async(e,t)=>{const r=Pn(t.toBase58()),n=ss(r,is.REVERSE_LOOKUP_CLASS),{registry:o}=await ht.retrieve(e,n);if(!o.data)throw new ke(exports.ErrorType.NoAccountData);return Wn(o.data)},_deriveSync:as,getDomainKeySync:cs,getReverseKeySync:us},constants:is,bindings:{createNameRegistry:fs,updateNameRegistryData:async function(e,t,r,n,o,i){const s=await tr(t),a=ss(s,o,i);let c;return c=o||(await ht.retrieve(e,a)).registry.owner,Ye(is.NAME_PROGRAM_ID,a,new Te(r),n,c)},transferNameOwnership:async function(e,t,r,n,o,i){const s=await tr(t),a=ss(s,n,o);let c;return c=n||(await ht.retrieve(e,a)).registry.owner,Xe(is.NAME_PROGRAM_ID,a,r,c,n,o,i)},deleteNameRegistry:async function(e,t,r,n,o){const i=await tr(t),s=ss(i,n,o);let a;return a=n||(await ht.retrieve(e,s)).registry.owner,Ze(is.NAME_PROGRAM_ID,s,r,a)},registerDomainName:async(t,r,n,o,i,s=is.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([is.REGISTER_PROGRAM_ID.toBuffer()],is.REGISTER_PROGRAM_ID),u=Pn(r),f=ss(u,void 0,is.ROOT_DOMAIN_ACCOUNT),p=Pn(f.toBase58()),d=ss(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],is.REGISTER_PROGRAM_ID),y=is.REFERRERS.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,is.VAULT_OWNER),m=ds.constants.PYTH_FEEDS.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const v=new Je({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(is.REGISTER_PROGRAM_ID,is.NAME_PROGRAM_ID,is.ROOT_DOMAIN_ACCOUNT,f,d,e.SystemProgram.programId,c,o,i,is.PYTH_MAPPING_ACC,new e.PublicKey(m.product),new e.PublicKey(m.price),b,h,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},createReverseName:ps,createSubdomain:async(e,t,r,n=2e3)=>{const o=[],i=t.split(".")[0];if(!i)throw new ke(exports.ErrorType.InvalidSubdomain);const{parent:s,pubkey:a}=cs(t),c=await e.getMinimumBalanceForRentExemption(n+ht.HEADER_LEN),u=await fs(e,"\0".concat(i),n,r,r,c,void 0,s);o.push(u);const f=us(t,!0),p=await e.getAccountInfo(f);if(!(null==p?void 0:p.data)){const[,e]=await ps(a,"\0".concat(i),r,s,r);o.push(...e)}return[[],o]},burnDomain:(t,r,n)=>{const{pubkey:o}=cs(t),[i]=e.PublicKey.findProgramAddressSync([o.toBuffer()],is.REGISTER_PROGRAM_ID),[s]=e.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],is.REGISTER_PROGRAM_ID);return(new tt).getInstruction(is.REGISTER_PROGRAM_ID,is.NAME_PROGRAM_ID,e.SystemProgram.programId,o,us(t),s,i,is.REVERSE_LOOKUP_CLASS,r,n)},transferSubdomain:async(e,t,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=cs(t);if(!a||!s)throw new ke(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:t}=await ht.retrieve(e,i);o=t.owner}let c,u;n&&(c=a,u=(await ht.retrieve(e,a)).registry.owner);return Xe(is.NAME_PROGRAM_ID,i,r,o,void 0,c,u)},registerDomainNameV2:async(t,r,n,o,i,s=is.USDC_MINT,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([is.REGISTER_PROGRAM_ID.toBuffer()],is.REGISTER_PROGRAM_ID),u=Pn(r),f=ss(u,void 0,is.ROOT_DOMAIN_ACCOUNT),p=Pn(f.toBase58()),d=ss(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],is.REGISTER_PROGRAM_ID),y=is.REFERRERS.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,is.VAULT_OWNER,!0),m=Jt.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const[v]=Mn(0,m),E=new nt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(is.REGISTER_PROGRAM_ID,is.NAME_PROGRAM_ID,is.ROOT_DOMAIN_ACCOUNT,f,d,e.SystemProgram.programId,c,o,o,o,i,v,b,h,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(E),w}}};exports.BONFIDA_FIDA_BNB=Dt,exports.BONFIDA_USDC_BNB=zt,exports.CUSTOM_BG_TLD=Xt,exports.DEFAULT_PYTH_PUSH_PROGRAM=Qt,exports.ETH_ROA_RECORDS=Di,exports.EVM_RECORDS=Wi,exports.FavouriteDomain=Hi,exports.GUARDIANS=Oi,exports.HASH_PREFIX=Lt,exports.METAPLEX_ID=$t,exports.NAME_OFFERS_ID=Ki,exports.NAME_PROGRAM_ID=Ut,exports.NameRegistryState=ht,exports.Numberu32=Te,exports.Numberu64=_e,exports.PYTH_FEEDS=Ht,exports.PYTH_FIDA_PRICE_ACC=Ot,exports.PYTH_MAPPING_ACC=Gt,exports.PYTH_PULL_FEEDS=Jt,exports.RECORD_V1_SIZE=Lr,exports.REFERRERS=jt,exports.REGISTER_PROGRAM_ID=Nt,exports.REVERSE_LOOKUP_CLASS=Wt,exports.ROOT_DOMAIN_ACCOUNT=Ct,exports.ReverseTwitterRegistryState=$i,exports.SELF_SIGNED=Vi,exports.SNSError=ke,exports.SOL_RECORD_SIG_LEN=96,exports.TOKENS_SYM_MINT=Kt,exports.TWITTER_ROOT_PARENT_REGISTRY_KEY=Vt,exports.TWITTER_VERIFICATION_AUTHORITY=Mt,exports.USDC_MINT=Ft,exports.UTF8_ENCODED=Mi,exports.VAULT_OWNER=Yt,exports.VAULT_OWNER_DEPRECATED=qt,exports.WOLVES_COLLECTION_METADATA=Zt,exports.burnDomain=(t,r,n)=>{const{pubkey:o}=Ln(t),[i]=e.PublicKey.findProgramAddressSync([o.toBuffer()],Nt),[s]=e.PublicKey.findProgramAddressSync([o.toBuffer(),Uint8Array.from([1,1])],Nt);return(new tt).getInstruction(Nt,Ut,e.SystemProgram.programId,o,Nn(t),s,i,Wt,r,n)},exports.burnInstruction=tt,exports.changeTwitterRegistryData=async function(e,t,r,n){const o=Pn(e),i=kn(o,void 0,Vt);return[Ye(Ut,i,new Te(r),n,t)]},exports.changeVerifiedPubkey=async function(e,t,r,n,o){const i=Pn(t),s=kn(i,void 0,Vt);let a=[Xe(Ut,s,n,r,void 0)];return a.push(await qi(e,r.toString(),o,Mt,Vt)),a=a.concat(await Qi(e,t,s,n,o)),a},exports.check=Dn,exports.checkSolRecord=ki,exports.createInstruction=qe,exports.createInstructionV3=Je,exports.createNameRegistry=Gi,exports.createRecordInstruction=Xi,exports.createRecordV2Instruction=(t,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(c&&(a=Ln(t).pubkey),!a)throw new Error("Invalid parent");const u=((t,r,n,o,i,s,a,c)=>new mr({record:s,content:Array.from(a)}).getInstruction(c,e.SystemProgram.programId,i,t,r,n,o,Br))(i,s,a,o,Ut,"".concat(r),Fi(n,r),Ir);return u},exports.createReverseInstruction=Qe,exports.createReverseName=Yi,exports.createReverseTwitterRegistry=Qi,exports.createSolRecordInstruction=Zi,exports.createSplitV2Instruction=nt,exports.createSubdomain=async(e,t,r,n=2e3,o)=>{const i=[],s=t.split(".")[0];if(!s)throw new ke(exports.ErrorType.InvalidSubdomain);const{parent:a,pubkey:c}=Ln(t),u=await e.getMinimumBalanceForRentExemption(n+ht.HEADER_LEN),f=await Gi(e,"\0".concat(s),n,o||r,r,u,void 0,a);i.push(f);const p=Nn(t,!0),d=await e.getAccountInfo(p);if(!(null==d?void 0:d.data)){const[,e]=await Yi(c,"\0".concat(s),o||r,a,r);i.push(...e)}return[[],i]},exports.createV2Instruction=$e,exports.createVerifiedTwitterRegistry=async function(t,r,n,o,i){const s=Pn(r),a=kn(s,void 0,Vt),c=await t.getMinimumBalanceForRentExemption(o+ht.HEADER_LEN);let u=[qe(Ut,e.SystemProgram.programId,a,n,i,s,new _e(c),new Te(o),void 0,Vt,Mt)];return u=u.concat(await Qi(t,r,a,n,i)),u},exports.createWithNftInstruction=et,exports.deleteInstruction=Ze,exports.deleteNameRegistry=qi,exports.deleteRecordV2=(t,r,n,o)=>{let{pubkey:i,parent:s,isSub:a}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(a&&(s=Ln(t).pubkey),!s)throw new Error("Invalid parent");const c=((t,r,n,o,i,s)=>(new Ar).getInstruction(s,e.SystemProgram.programId,i,t,o,r,n,Br))(o,s,n,i,Ut,Ir);return c},exports.deleteTwitterRegistry=async function(e,t){const r=Pn(e),n=kn(r,void 0,Vt),o=Pn(t.toString()),i=kn(o,Mt,Vt);return[Ze(Ut,n,t,t),Ze(Ut,i,t,t)]},exports.deserializeRecord=Li,exports.deserializeRecordV2Content=zi,exports.deserializeReverse=Wn,exports.devnet=ds,exports.ethValidateRecordV2Content=(t,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(u&&(c=Ln(t).pubkey),!c)throw new Error("Invalid parent");const f=((t,r,n,o,i,s,a,c,u)=>new vr({validation:s,signature:Array.from(a),expectedPubkey:Array.from(c)}).getInstruction(u,e.SystemProgram.programId,i,t,r,n,o,Br))(o,a,c,n,Ut,Rr.Ethereum,i,s,Ir);return f},exports.findSubdomains=async(e,t)=>{const r=[{memcmp:{offset:0,bytes:t.toBase58()}},{memcmp:{offset:64,bytes:Wt.toBase58()}}],n=await e.getProgramAccounts(Ut,{filters:r}),o=[{memcmp:{offset:0,bytes:t.toBase58()}}],i=await e.getProgramAccounts(Ut,{filters:o,dataSlice:{offset:0,length:0}}),s=new Map(n.map((e=>[e.pubkey.toBase58(),Wn(e.account.data.slice(96))]))),a=[];return i.forEach((e=>{const r=On(e.pubkey,t).toBase58(),n=s.get(r);n&&a.push(n.replace("\0",""))})),a},exports.getAllDomains=Cn,exports.getAllRegisteredDomains=async e=>{const t=[{memcmp:{offset:0,bytes:Ct.toBase58()}}];return await e.getProgramAccounts(Ut,{dataSlice:{offset:32,length:32},filters:t})},exports.getArtistPubkey=e=>{switch(e){case exports.CustomBg.DegenPoet1:return rs;case exports.CustomBg.Rgb0x001:return ns;case exports.CustomBg.Retardio1:case exports.CustomBg.Retardio2:case exports.CustomBg.Retardio3:return os;default:throw new ke(exports.ErrorType.InvalidCustomBg)}},exports.getArweaveRecord=async(e,t)=>await _i(e,t,exports.Record.ARWV,!0),exports.getBackgroundRecord=async(e,t)=>await _i(e,t,exports.Record.Background,!0),exports.getBackpackRecord=async(e,t)=>await _i(e,t,exports.Record.Backpack,!0),exports.getBscRecord=async(e,t)=>await _i(e,t,exports.Record.BSC,!0),exports.getBtcRecord=async(e,t)=>await _i(e,t,exports.Record.BTC,!0),exports.getCustomBgKeys=(e,t)=>{const r=Pn(t),n=Pn(e),o=kn(n,void 0,Xt);return{domainKey:o,bgKey:kn(r,void 0,o)}},exports.getDiscordRecord=async(e,t)=>await _i(e,t,exports.Record.Discord,!0),exports.getDogeRecord=async(e,t)=>await _i(e,t,exports.Record.DOGE,!0),exports.getDomainKey=or,exports.getDomainKeySync=Ln,exports.getDomainKeysWithReverses=async function(e,t){const r=await Cn(e,t),n=await _n(e,r);return r.map(((e,t)=>({pubKey:e,domain:n[t]})))},exports.getDomainMint=st,exports.getDomainPriceFromName=e=>{switch(Rn(e).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}},exports.getEmailRecord=async(e,t)=>await _i(e,t,exports.Record.Email,!0),exports.getEthRecord=async(e,t)=>await _i(e,t,exports.Record.ETH,!0),exports.getFavoriteDomain=async(t,r)=>{const[n]=Hi.getKeySync(Ki,new e.PublicKey(r)),o=await Hi.retrieve(t,n),i=await Tn(t,o.nameAccount),{registry:s,nftOwner:a}=await ht.retrieve(t,o.nameAccount),c=a||s.owner;return{domain:o.nameAccount,reverse:i,stale:!r.equals(c)}},exports.getGithubRecord=async(e,t)=>await _i(e,t,exports.Record.Github,!0),exports.getHandleAndRegistryKey=async function(t,r){const n=Pn(r.toString()),o=kn(n,Mt,Vt);let i=await $i.retrieve(t,o);return[i.twitterHandle,new e.PublicKey(i.twitterRegistryKey)]},exports.getHashedName=tr,exports.getHashedNameSync=Pn,exports.getInjectiveRecord=async(e,t)=>await _i(e,t,exports.Record.Injective,!0),exports.getIpfsRecord=async(e,t)=>await _i(e,t,exports.Record.IPFS,!0),exports.getLtcRecord=async(e,t)=>await _i(e,t,exports.Record.LTC,!0),exports.getMultipleFavoriteDomains=async(t,r)=>{const n=[],o=r.map((e=>Hi.getKeySync(Ki,e)[0])),i=(await t.getMultipleAccountsInfo(o)).map((t=>(null==t?void 0:t.data)?Hi.deserialize(null==t?void 0:t.data).nameAccount:e.PublicKey.default)),s=i.map((e=>On(e))),a=i.map(((e,t)=>Be(st(e),r[t],!0))),[c,u,f]=await Promise.all([t.getMultipleAccountsInfo(i),t.getMultipleAccountsInfo(s),t.getMultipleAccountsInfo(a)]);for(let t=0;t<r.length;t++){const o=c[t],i=u[t],s=f[t];if(!o||!i){n.push(void 0);continue}if(new e.PublicKey(null==o?void 0:o.data.slice(32,64)).equals(r[t])){n.push(Wn(null==i?void 0:i.data.slice(96)));continue}if(!s){n.push(void 0);continue}const a=Ee.decode(s.data);1!==Number(a.amount)?n.push(void 0):n.push(Wn(null==i?void 0:i.data.slice(96)))}return n},exports.getMultipleRecordsV2=async function(e,t,r,n={}){const o=r.map((e=>ji(t,e))),i=await _r.retrieveBatch(e,o);return n.deserialize?i.map(((e,t)=>{if(e)return{retrievedRecord:e,record:r[t],deserializedContent:zi(e.getContent(),r[t])}})):i.map(((e,t)=>{if(e)return{retrievedRecord:e,record:r[t]}}))},exports.getNameAccountKey=rr,exports.getNameAccountKeySync=kn,exports.getNameOwner=er,exports.getPicRecord=async(e,t)=>await _i(e,t,exports.Record.Pic,!0),exports.getPointRecord=async(e,t)=>await _i(e,t,exports.Record.POINT,!0),exports.getPythFeedAccountKey=Mn,exports.getRecord=_i,exports.getRecordKeySync=Ti,exports.getRecordV2=async function(e,t,r,n={}){const o=ji(t,r),i=await _r.retrieve(e,o);return n.deserialize?{retrievedRecord:i,deserializedContent:zi(i.getContent(),r)}:{retrievedRecord:i}},exports.getRecordV2Key=ji,exports.getRecords=async function(e,t,r,n){const o=r.map((e=>Ti(t,e))),i=await ht.retrieveBatch(e,o);return n?i.map(((e,n)=>{if(e)return Li(e,r[n],Ti(t,r[n]))})):i},exports.getRedditRecord=async(e,t)=>await _i(e,t,exports.Record.Reddit,!0),exports.getReverseKey=async(e,t)=>{const{pubkey:r,parent:n}=await or(e),o=await tr(r.toBase58());return await rr(o,Wt,t?n:void 0)},exports.getReverseKeyFromDomainKey=On,exports.getReverseKeySync=Nn,exports.getShdwRecord=async(e,t)=>await _i(e,t,exports.Record.SHDW,!0),exports.getSolRecord=Ui,exports.getTelegramRecord=async(e,t)=>await _i(e,t,exports.Record.Telegram,!0),exports.getTokenizedDomains=async(e,t)=>{const r=await dt(e,t),n=await _n(e,r.map((e=>e.nameAccount)));return n.map(((e,t)=>({key:r[t].nameAccount,mint:r[t].nftMint,reverse:e}))).filter((e=>!!e.reverse))},exports.getTwitterHandleandRegistryKeyViaFilters=async function(t,r){const n=[{memcmp:{offset:0,bytes:Vt.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:Mt.toBase58()}}],o=await t.getProgramAccounts(Ut,{filters:n});for(const t of o)if(t.account.data.length>ht.HEADER_LEN+32){const r=t.account.data.slice(ht.HEADER_LEN),n=new $i(Ge($i.schema,r));return[n.twitterHandle,new e.PublicKey(n.twitterRegistryKey)]}throw new ke(exports.ErrorType.AccountDoesNotExist)},exports.getTwitterRecord=async(e,t)=>await _i(e,t,exports.Record.Twitter,!0),exports.getTwitterRegistry=async function(e,t){const r=Pn(t),n=kn(r,void 0,Vt),{registry:o}=await ht.retrieve(e,n);return o},exports.getTwitterRegistryData=async function(t,r){const o=[{memcmp:{offset:0,bytes:Vt.toBase58()}},{memcmp:{offset:32,bytes:r.toBase58()}},{memcmp:{offset:64,bytes:new e.PublicKey(n.Buffer.alloc(32,0)).toBase58()}}],i=await t.getProgramAccounts(Ut,{filters:o});if(i.length>1)throw new ke(exports.ErrorType.MultipleRegistries);return i[0].account.data.slice(ht.HEADER_LEN)},exports.getTwitterRegistryKey=async function(e){const t=Pn(e);return kn(t,void 0,Vt)},exports.getUrlRecord=async(e,t)=>await _i(e,t,exports.Record.Url,!0),exports.performReverseLookup=async function(e,t){const r=await tr(t.toBase58()),n=await rr(r,Wt),{registry:o}=await ht.retrieve(e,n);if(!o.data)throw new ke(exports.ErrorType.NoAccountData);const i=o.data.slice(0,4).readUInt32LE(0);return o.data.slice(4,4+i).toString()},exports.performReverseLookupBatch=async function(e,t){let r=[];for(let e of t){const t=await tr(e.toBase58()),n=await rr(t,Wt);r.push(n)}return(await ht.retrieveBatch(e,r)).map((e=>{if(void 0===e||void 0===e.data)return;const t=e.data.slice(0,4).readUInt32LE(0);return e.data.slice(4,4+t).toString()}))},exports.reallocInstruction=function(t,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 e.TransactionInstruction({keys:f,programId:t,data:u})},exports.registerDomainName=async(t,r,n,o,i,s=Ft,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([Nt.toBuffer()],Nt),u=Pn(r),f=kn(u,void 0,Ct),p=Pn(f.toBase58()),d=kn(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],Nt),y=jt.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,Yt,!0),m=Ht.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const v=new Je({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Nt,Ut,Ct,f,d,e.SystemProgram.programId,c,o,i,Gt,new e.PublicKey(m.product),new e.PublicKey(m.price),b,h,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(v),[[],w]},exports.registerDomainNameV2=async(t,r,n,o,i,s=Ft,a)=>{if(r.includes(".")||r.trim().toLowerCase()!==r)throw new ke(exports.ErrorType.InvalidDomain);const[c]=e.PublicKey.findProgramAddressSync([Nt.toBuffer()],Nt),u=Pn(r),f=kn(u,void 0,Ct),p=Pn(f.toBase58()),d=kn(p,c),[l]=e.PublicKey.findProgramAddressSync([f.toBuffer()],Nt),y=jt.findIndex((e=>null==a?void 0:a.equals(e)));let g;const w=[];if(-1!==y&&a){g=Be(s,a,!0);const e=await t.getAccountInfo(g);if(!(null==e?void 0:e.data)){const e=Re(o,g,a,s);w.push(e)}}const b=Be(s,Yt,!0),m=Jt.get(s.toBase58());if(!m)throw new ke(exports.ErrorType.PythFeedNotFound);const[v]=Mn(0,m),E=new nt({name:r,space:n,referrerIdxOpt:-1!=y?y:null}).getInstruction(Nt,Ut,Ct,f,d,e.SystemProgram.programId,c,o,o,o,i,v,b,h,e.SYSVAR_RENT_PUBKEY,l,g);return w.push(E),w},exports.registerFavorite=(t,r)=>{const[n]=Hi.getKeySync(Ki,r);return[(new rt).getInstruction(Ki,t,n,r,e.SystemProgram.programId)]},exports.registerFavoriteInstruction=rt,exports.registerWithNft=(t,r,n,o,i,s,a,c,u)=>{const[f]=e.PublicKey.findProgramAddressSync([n.toBuffer()],Nt);return new et({space:r,name:t}).getInstruction(Nt,Ut,Ct,n,o,e.SystemProgram.programId,Wt,i,s,a,c,u,Zt,h,e.SYSVAR_RENT_PUBKEY,f,$t)},exports.resolve=async(e,t)=>{const{pubkey:r}=Ln(t),{registry:n,nftOwner:o}=await ht.retrieve(e,r);if(o)return o;try{const r=await ts(e,n.owner,t);if(void 0!==r)return r;return await es(e,n.owner,t)}catch(e){if(e instanceof Error&&"FetchError"===e.name)throw e}return n.owner},exports.resolveSolRecordV1=es,exports.resolveSolRecordV2=ts,exports.retrieveNftOwner=ut,exports.retrieveNfts=async t=>{const r=await t.getProgramAccounts(ot,{filters:[{memcmp:{offset:0,bytes:"3"}}]});return r.map((t=>new e.PublicKey(t.account.data.slice(66,98))))},exports.retrieveRecords=dt,exports.reverseLookup=Tn,exports.reverseLookupBatch=_n,exports.serializeRecord=Ci,exports.serializeRecordV2Content=Fi,exports.serializeSolRecord=Ni,exports.transferInstruction=Xe,exports.transferNameOwnership=async function(e,t,r,n,o,i){const s=Pn(t),a=kn(s,n,o);let c;return c=n||(await ht.retrieve(e,a)).registry.owner,Xe(Ut,a,r,c,n,o,i)},exports.transferSubdomain=async(e,t,r,n,o)=>{const{pubkey:i,isSub:s,parent:a}=Ln(t);if(!a||!s)throw new ke(exports.ErrorType.InvalidSubdomain);if(!o){const{registry:t}=await ht.retrieve(e,i);o=t.owner}let c,u;n&&(c=a,u=(await ht.retrieve(e,a)).registry.owner);return Xe(Ut,i,r,o,void 0,c,u)},exports.updateInstruction=Ye,exports.updateNameRegistryData=async function(e,t,r,n,o,i){const s=Pn(t),a=kn(s,o,i);let c;return c=o||(await ht.retrieve(e,a)).registry.owner,Ye(Ut,a,new Te(r),n,c)},exports.updateRecordInstruction=async(e,t,r,n,o,i)=>{Dn(r!==exports.Record.SOL,exports.ErrorType.UnsupportedRecord);const{pubkey:s}=Ln(`${r}.${t}`,exports.RecordVersion.V1),a=await e.getAccountInfo(s);Dn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist);const c=Ci(n,r);if((null==a?void 0:a.data.slice(96).length)!==c.length)return[Ze(Ut,s,i,o),await Xi(e,t,r,n,o,i)];return[Ye(Ut,s,new Te(0),c,o)]},exports.updateRecordV2Instruction=(t,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(c&&(a=Ln(t).pubkey),!a)throw new Error("Invalid parent");const u=((t,r,n,o,i,s,a,c)=>new xr({record:s,content:Array.from(a)}).getInstruction(c,e.SystemProgram.programId,i,t,r,n,o,Br))(i,s,a,o,Ut,"".concat(r),Fi(n,r),Ir);return u},exports.updateSolRecordInstruction=async(e,t,r,n,o,i)=>{const{pubkey:s}=Ln(`${exports.Record.SOL}.${t}`,exports.RecordVersion.V1),a=await e.getAccountInfo(s);if(Dn(!!(null==a?void 0:a.data),exports.ErrorType.AccountDoesNotExist),96!==(null==a?void 0:a.data.length))return[Ze(Ut,s,i,n),await Zi(e,t,r,n,o,i)];const c=Ni(r,s,n,o);return[Ye(Ut,s,new Te(0),c,n)]},exports.validateRecordV2Content=(t,r,n,o,i,s)=>{let{pubkey:a,parent:c,isSub:u}=Ln(`${n}.${r}`,exports.RecordVersion.V2);if(u&&(c=Ln(r).pubkey),!c)throw new Error("Invalid parent");const f=((t,r,n,o,i,s,a,c)=>new Er({staleness:a}).getInstruction(c,e.SystemProgram.programId,s,t,r,n,o,Br,i))(i,a,c,o,s,Ut,t,Ir);return f},exports.verifyRightOfAssociation=async(e,t,r,n)=>{var o;const i=ji(r,t),s=await _r.retrieve(e,i),a=s.getRoAId(),c=Di.has(t)?Rr.Ethereum:Rr.Solana;if(!(n=null!=n?n:null===(o=Oi.get(t))||void 0===o?void 0:o.toBuffer()))throw new ke(exports.ErrorType.MissingVerifier);return 0===n.compare(a)&&s.header.rightOfAssociationValidation===c},exports.verifyStaleness=async(t,r,n)=>{const o=ji(n,r),{registry:i,nftOwner:s}=await ht.retrieve(t,Ln(n).pubkey),a=s||i.owner,c=await _r.retrieve(t,o),u=c.getStalenessId();return(null==a?void 0:a.equals(new e.PublicKey(u)))&&c.header.stalenessValidation===Rr.Solana},exports.writRoaRecordV2=(t,r,n,o,i)=>{let{pubkey:s,parent:a,isSub:c}=Ln(`${r}.${t}`,exports.RecordVersion.V2);if(c&&(a=Ln(t).pubkey),!a)throw new Error("Invalid parent");const u=((t,r,n,o,i,s,a)=>new Sr({roaId:Array.from(s.toBuffer())}).getInstruction(a,e.SystemProgram.programId,r,t,n,o,i,Br))(o,Ut,s,a,n,i,Ir);return u};
|
|
20
20
|
//# sourceMappingURL=index.cjs.map
|