@renec-foundation/metaplex-js
Version:
Metaplex JavaScript API
25 lines (23 loc) • 275 kB
JavaScript
var metaplex=function(t,e,i){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function n(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}}))})),Object.freeze(t)}var a,o=r(e),s=r(i);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function u(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))}t.Currency=void 0,(a=t.Currency||(t.Currency={})).USD="usd",a.EUR="eur",a.AR="ar",a.SOL="sol";var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})})),e}var f={exports:{}},h=function(t,e){return function(){for(var i=new Array(arguments.length),r=0;r<i.length;r++)i[r]=arguments[r];return t.apply(e,i)}},p=h,y=Object.prototype.toString;function g(t){return Array.isArray(t)}function m(t){return void 0===t}function b(t){return"[object ArrayBuffer]"===y.call(t)}function A(t){return null!==t&&"object"==typeof t}function v(t){if("[object Object]"!==y.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function M(t){return"[object Function]"===y.call(t)}function w(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),g(t))for(var i=0,r=t.length;i<r;i++)e.call(null,t[i],i,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var P={isArray:g,isArrayBuffer:b,isBuffer:function(t){return null!==t&&!m(t)&&null!==t.constructor&&!m(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"[object FormData]"===y.call(t)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&b(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:A,isPlainObject:v,isUndefined:m,isDate:function(t){return"[object Date]"===y.call(t)},isFile:function(t){return"[object File]"===y.call(t)},isBlob:function(t){return"[object Blob]"===y.call(t)},isFunction:M,isStream:function(t){return A(t)&&M(t.pipe)},isURLSearchParams:function(t){return"[object URLSearchParams]"===y.call(t)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:w,merge:function t(){var e={};function i(i,r){v(e[r])&&v(i)?e[r]=t(e[r],i):v(i)?e[r]=t({},i):g(i)?e[r]=i.slice():e[r]=i}for(var r=0,n=arguments.length;r<n;r++)w(arguments[r],i);return e},extend:function(t,e,i){return w(e,(function(e,r){t[r]=i&&"function"==typeof e?p(e,i):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},_=P;function S(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var E=function(t,e,i){if(!e)return t;var r;if(i)r=i(e);else if(_.isURLSearchParams(e))r=e.toString();else{var n=[];_.forEach(e,(function(t,e){null!=t&&(_.isArray(t)?e+="[]":t=[t],_.forEach(t,(function(t){_.isDate(t)?t=t.toISOString():_.isObject(t)&&(t=JSON.stringify(t)),n.push(S(e)+"="+S(t))})))})),r=n.join("&")}if(r){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t},k=P;function T(){this.handlers=[]}T.prototype.use=function(t,e,i){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1},T.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},T.prototype.forEach=function(t){k.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var B=T,R=P,O=function(t,e,i,r,n){return t.config=e,i&&(t.code=i),t.request=r,t.response=n,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},x=O,I=function(t,e,i,r,n){var a=new Error(t);return x(a,e,i,r,n)},D=I,C=P,U=C.isStandardBrowserEnv()?{write:function(t,e,i,r,n,a){var o=[];o.push(t+"="+encodeURIComponent(e)),C.isNumber(i)&&o.push("expires="+new Date(i).toGMTString()),C.isString(r)&&o.push("path="+r),C.isString(n)&&o.push("domain="+n),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},W=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)},K=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},N=P,V=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],j=P,z=j.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");function r(t){var r=t;return e&&(i.setAttribute("href",r),r=i.href),i.setAttribute("href",r),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}return t=r(window.location.href),function(e){var i=j.isString(e)?r(e):e;return i.protocol===t.protocol&&i.host===t.host}}():function(){return!0};function L(t){this.message=t}L.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},L.prototype.__CANCEL__=!0;var F=L,Y=P,H=function(t,e,i){var r=i.config.validateStatus;i.status&&r&&!r(i.status)?e(D("Request failed with status code "+i.status,i.config,null,i.request,i)):t(i)},X=U,G=E,$=function(t,e){return t&&!W(e)?K(t,e):e},q=function(t){var e,i,r,n={};return t?(N.forEach(t.split("\n"),(function(t){if(r=t.indexOf(":"),e=N.trim(t.substr(0,r)).toLowerCase(),i=N.trim(t.substr(r+1)),e){if(n[e]&&V.indexOf(e)>=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([i]):n[e]?n[e]+", "+i:i}})),n):n},Z=z,J=I,Q=ct,tt=F,et=function(t){return new Promise((function(e,i){var r,n=t.data,a=t.headers,o=t.responseType;function s(){t.cancelToken&&t.cancelToken.unsubscribe(r),t.signal&&t.signal.removeEventListener("abort",r)}Y.isFormData(n)&&delete a["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var c=t.auth.username||"",l=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.Authorization="Basic "+btoa(c+":"+l)}var d=$(t.baseURL,t.url);function f(){if(u){var r="getAllResponseHeaders"in u?q(u.getAllResponseHeaders()):null,n={data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:t,request:u};H((function(t){e(t),s()}),(function(t){i(t),s()}),n),u=null}}if(u.open(t.method.toUpperCase(),G(d,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(f)},u.onabort=function(){u&&(i(J("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(J("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||Q.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),i(J(e,t,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},Y.isStandardBrowserEnv()){var h=(t.withCredentials||Z(d))&&t.xsrfCookieName?X.read(t.xsrfCookieName):void 0;h&&(a[t.xsrfHeaderName]=h)}"setRequestHeader"in u&&Y.forEach(a,(function(t,e){void 0===n&&"content-type"===e.toLowerCase()?delete a[e]:u.setRequestHeader(e,t)})),Y.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),o&&"json"!==o&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(r=function(t){u&&(i(!t||t&&t.type?new tt("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(r),t.signal&&(t.signal.aborted?r():t.signal.addEventListener("abort",r))),n||(n=null),u.send(n)}))},it=P,rt=function(t,e){R.forEach(t,(function(i,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=i,delete t[r])}))},nt=O,at={"Content-Type":"application/x-www-form-urlencoded"};function ot(t,e){!it.isUndefined(t)&&it.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var st,ut={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(st=et),st),transformRequest:[function(t,e){return rt(e,"Accept"),rt(e,"Content-Type"),it.isFormData(t)||it.isArrayBuffer(t)||it.isBuffer(t)||it.isStream(t)||it.isFile(t)||it.isBlob(t)?t:it.isArrayBufferView(t)?t.buffer:it.isURLSearchParams(t)?(ot(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):it.isObject(t)||e&&"application/json"===e["Content-Type"]?(ot(e,"application/json"),function(t,e,i){if(it.isString(t))try{return(e||JSON.parse)(t),it.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(i||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||ut.transitional,i=e&&e.silentJSONParsing,r=e&&e.forcedJSONParsing,n=!i&&"json"===this.responseType;if(n||r&&it.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw nt(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};it.forEach(["delete","get","head"],(function(t){ut.headers[t]={}})),it.forEach(["post","put","patch"],(function(t){ut.headers[t]=it.merge(at)}));var ct=ut,lt=P,dt=ct,ft=function(t){return!(!t||!t.__CANCEL__)},ht=P,pt=function(t,e,i){var r=this||dt;return lt.forEach(i,(function(i){t=i.call(r,t,e)})),t},yt=ft,gt=ct,mt=F;function bt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new mt("canceled")}var At=P,vt=function(t,e){e=e||{};var i={};function r(t,e){return At.isPlainObject(t)&&At.isPlainObject(e)?At.merge(t,e):At.isPlainObject(e)?At.merge({},e):At.isArray(e)?e.slice():e}function n(i){return At.isUndefined(e[i])?At.isUndefined(t[i])?void 0:r(void 0,t[i]):r(t[i],e[i])}function a(t){if(!At.isUndefined(e[t]))return r(void 0,e[t])}function o(i){return At.isUndefined(e[i])?At.isUndefined(t[i])?void 0:r(void 0,t[i]):r(void 0,e[i])}function s(i){return i in e?r(t[i],e[i]):i in t?r(void 0,t[i]):void 0}var u={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s};return At.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||n,r=e(t);At.isUndefined(r)&&e!==s||(i[t]=r)})),i},Mt="0.25.0",wt=Mt,Pt={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Pt[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}}));var _t={};Pt.transitional=function(t,e,i){function r(t,e){return"[Axios v"+wt+"] Transitional option '"+t+"'"+e+(i?". "+i:"")}return function(i,n,a){if(!1===t)throw new Error(r(n," has been removed"+(e?" in "+e:"")));return e&&!_t[n]&&(_t[n]=!0,console.warn(r(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(i,n,a)}};var St={assertOptions:function(t,e,i){if("object"!=typeof t)throw new TypeError("options must be an object");for(var r=Object.keys(t),n=r.length;n-- >0;){var a=r[n],o=e[a];if(o){var s=t[a],u=void 0===s||o(s,a,t);if(!0!==u)throw new TypeError("option "+a+" must be "+u)}else if(!0!==i)throw Error("Unknown option "+a)}},validators:Pt},Et=P,kt=E,Tt=B,Bt=function(t){return bt(t),t.headers=t.headers||{},t.data=pt.call(t,t.data,t.headers,t.transformRequest),t.headers=ht.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),ht.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||gt.adapter)(t).then((function(e){return bt(t),e.data=pt.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return yt(e)||(bt(t),e&&e.response&&(e.response.data=pt.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Rt=vt,Ot=St,xt=Ot.validators;function It(t){this.defaults=t,this.interceptors={request:new Tt,response:new Tt}}It.prototype.request=function(t,e){if("string"==typeof t?(e=e||{}).url=t:e=t||{},!e.url)throw new Error("Provided config url is not valid");(e=Rt(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var i=e.transitional;void 0!==i&&Ot.assertOptions(i,{silentJSONParsing:xt.transitional(xt.boolean),forcedJSONParsing:xt.transitional(xt.boolean),clarifyTimeoutError:xt.transitional(xt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var a,o=[];if(this.interceptors.response.forEach((function(t){o.push(t.fulfilled,t.rejected)})),!n){var s=[Bt,void 0];for(Array.prototype.unshift.apply(s,r),s=s.concat(o),a=Promise.resolve(e);s.length;)a=a.then(s.shift(),s.shift());return a}for(var u=e;r.length;){var c=r.shift(),l=r.shift();try{u=c(u)}catch(t){l(t);break}}try{a=Bt(u)}catch(t){return Promise.reject(t)}for(;o.length;)a=a.then(o.shift(),o.shift());return a},It.prototype.getUri=function(t){if(!t.url)throw new Error("Provided config url is not valid");return t=Rt(this.defaults,t),kt(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Et.forEach(["delete","get","head","options"],(function(t){It.prototype[t]=function(e,i){return this.request(Rt(i||{},{method:t,url:e,data:(i||{}).data}))}})),Et.forEach(["post","put","patch"],(function(t){It.prototype[t]=function(e,i,r){return this.request(Rt(r||{},{method:t,url:e,data:i}))}}));var Dt=It,Ct=F;function Ut(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var i=this;this.promise.then((function(t){if(i._listeners){var e,r=i._listeners.length;for(e=0;e<r;e++)i._listeners[e](t);i._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){i.subscribe(t),e=t})).then(t);return r.cancel=function(){i.unsubscribe(e)},r},t((function(t){i.reason||(i.reason=new Ct(t),e(i.reason))}))}Ut.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Ut.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Ut.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Ut.source=function(){var t;return{token:new Ut((function(e){t=e})),cancel:t}};var Wt=Ut,Kt=P,Nt=P,Vt=h,jt=Dt,zt=vt;var Lt=function t(e){var i=new jt(e),r=Vt(jt.prototype.request,i);return Nt.extend(r,jt.prototype,i),Nt.extend(r,i),r.create=function(i){return t(zt(e,i))},r}(ct);Lt.Axios=jt,Lt.Cancel=F,Lt.CancelToken=Wt,Lt.isCancel=ft,Lt.VERSION=Mt,Lt.all=function(t){return Promise.all(t)},Lt.spread=function(t){return function(e){return t.apply(null,e)}},Lt.isAxiosError=function(t){return Kt.isObject(t)&&!0===t.isAxiosError},f.exports=Lt,f.exports.default=Lt;var Ft=f.exports;class Yt{static translateCurrency(e){switch(e){case t.Currency.AR:return"arweave";case t.Currency.SOL:return"solana";case t.Currency.USD:return"usd";case t.Currency.EUR:return"eur";default:throw new Error("Invalid currency supplied to Coingecko conversion rate provider")}}getRate(t,e){return u(this,void 0,void 0,(function*(){const i="string"==typeof t?[t]:t,r="string"==typeof e?[e]:e,n=`https://api.coingecko.com/api/v3/simple/price?ids=${i.map((t=>Yt.translateCurrency(t))).join(",")}&vs_currencies=${r.map((t=>Yt.translateCurrency(t))).join(",")}`,a=yield Ft(n),o=yield a.data;return i.reduce(((t,e)=>[...t,...r.map((t=>({from:e,to:t,rate:o[Yt.translateCurrency(e)][Yt.translateCurrency(t)]})))]),[])}))}}var Ht="object"==typeof self?self.FormData:window.FormData;const Xt="https://arweave.net",Gt=Math.pow(10,9),$t=Math.pow(10,12);var qt,Zt=Object.freeze({__proto__:null,Storage:class{}});t.ChainId=void 0,(qt=t.ChainId||(t.ChainId={}))[qt.MainnetBeta=101]="MainnetBeta",qt[qt.Testnet=102]="Testnet",qt[qt.Devnet=103]="Devnet";const Jt={devnet:{endpoint:e.clusterApiUrl("devnet"),ChainId:t.ChainId.Devnet},"mainnet-beta":{endpoint:"https://api.metaplex.solana.com/",ChainId:t.ChainId.MainnetBeta},"mainnet-beta (Solana)":{endpoint:"https://api.mainnet-beta.solana.com",ChainId:t.ChainId.MainnetBeta},"mainnet-beta (Serum)":{endpoint:"https://solana-api.projectserum.com/",ChainId:t.ChainId.MainnetBeta},testnet:{endpoint:e.clusterApiUrl("testnet"),ChainId:t.ChainId.Testnet}};class Qt extends e.Connection{constructor(t="mainnet-beta",e){t in Jt&&(t=Jt[t].endpoint),super(t,e)}}const te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==c?c:void 0;for(var ee,ie=(ee="SHA-256",async(t,e)=>{"string"==typeof t&&(t=(new te.TextEncoder).encode(t)),e={outputFormat:"hex",...e};const i=await te.crypto.subtle.digest(ee,t);return"hex"===e.outputFormat?(t=>{const e=new DataView(t);let i="";for(let t=0;t<e.byteLength;t+=4)i+=e.getUint32(t).toString(16).padStart(8,"0");return i})(i):i}),re={},ne={byteLength:function(t){var e=le(t),i=e[0],r=e[1];return 3*(i+r)/4-r},toByteArray:function(t){var e,i,r=le(t),n=r[0],a=r[1],o=new se(function(t,e,i){return 3*(e+i)/4-i}(0,n,a)),s=0,u=a>0?n-4:n;for(i=0;i<u;i+=4)e=oe[t.charCodeAt(i)]<<18|oe[t.charCodeAt(i+1)]<<12|oe[t.charCodeAt(i+2)]<<6|oe[t.charCodeAt(i+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=255&e;2===a&&(e=oe[t.charCodeAt(i)]<<2|oe[t.charCodeAt(i+1)]>>4,o[s++]=255&e);1===a&&(e=oe[t.charCodeAt(i)]<<10|oe[t.charCodeAt(i+1)]<<4|oe[t.charCodeAt(i+2)]>>2,o[s++]=e>>8&255,o[s++]=255&e);return o},fromByteArray:function(t){for(var e,i=t.length,r=i%3,n=[],a=16383,o=0,s=i-r;o<s;o+=a)n.push(de(t,o,o+a>s?s:o+a));1===r?(e=t[i-1],n.push(ae[e>>2]+ae[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],n.push(ae[e>>10]+ae[e>>4&63]+ae[e<<2&63]+"="));return n.join("")}},ae=[],oe=[],se="undefined"!=typeof Uint8Array?Uint8Array:Array,ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ce=0;ce<64;++ce)ae[ce]=ue[ce],oe[ue.charCodeAt(ce)]=ce;function le(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function de(t,e,i){for(var r,n,a=[],o=e;o<i;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(ae[(n=r)>>18&63]+ae[n>>12&63]+ae[n>>6&63]+ae[63&n]);return a.join("")}oe["-".charCodeAt(0)]=62,oe["_".charCodeAt(0)]=63;var fe={
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
read:function(t,e,i,r,n){var a,o,s=8*n-r-1,u=(1<<s)-1,c=u>>1,l=-7,d=i?n-1:0,f=i?-1:1,h=t[e+d];for(d+=f,a=h&(1<<-l)-1,h>>=-l,l+=s;l>0;a=256*a+t[e+d],d+=f,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=r;l>0;o=256*o+t[e+d],d+=f,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),a-=c}return(h?-1:1)*o*Math.pow(2,a-r)},write:function(t,e,i,r,n,a){var o,s,u,c=8*a-n-1,l=(1<<c)-1,d=l>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(o++,u/=2),o+d>=l?(s=0,o=l):o+d>=1?(s=(e*u-1)*Math.pow(2,n),o+=d):(s=e*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;t[i+h]=255&s,h+=p,s/=256,n-=8);for(o=o<<n|s,c+=n;c>0;t[i+h]=255&o,h+=p,o/=256,c-=8);t[i+h-p]|=128*y}};
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
!function(t){const e=ne,i=fe,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},t.INSPECT_MAX_BYTES=50;const n=2147483647;function a(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,i){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return s(t,e,i)}function s(t,e,i){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const i=0|h(t,e);let r=a(i);const n=r.write(t,e);n!==i&&(r=r.slice(0,n));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,i);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(t,e,i);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,i);const n=function(t){if(o.isBuffer(t)){const e=0|f(t.length),i=a(e);return 0===i.length||t.copy(i,0,0,e),i}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?a(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return u(t),a(t<0?0:0|f(t))}function l(t){const e=t.length<0?0:0|f(t.length),i=a(e);for(let r=0;r<e;r+=1)i[r]=255&t[r];return i}function d(t,e,i){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(i||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,e):new Uint8Array(t,e,i),Object.setPrototypeOf(r,o.prototype),r}function f(t){if(t>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|t}function h(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const i=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===i)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return Y(t).length;default:if(n)return r?-1:F(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,i){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,i);case"utf8":case"utf-8":return _(this,e,i);case"ascii":return E(this,e,i);case"latin1":case"binary":return k(this,e,i);case"base64":return P(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function g(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),G(i=+i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,i,r,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):m(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function m(t,e,i,r,n){let a,o=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,i/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let r=-1;for(a=i;a<s;a++)if(c(t,a)===c(e,-1===r?0:a-r)){if(-1===r&&(r=a),a-r+1===u)return r*o}else-1!==r&&(a-=a-r),r=-1}else for(i+u>s&&(i=s-u),a=i;a>=0;a--){let i=!0;for(let r=0;r<u;r++)if(c(t,a+r)!==c(e,r)){i=!1;break}if(i)return a}return-1}function b(t,e,i,r){i=Number(i)||0;const n=t.length-i;r?(r=Number(r))>n&&(r=n):r=n;const a=e.length;let o;for(r>a/2&&(r=a/2),o=0;o<r;++o){const r=parseInt(e.substr(2*o,2),16);if(G(r))return o;t[i+o]=r}return o}function A(t,e,i,r){return H(F(e,t.length-i),t,i,r)}function v(t,e,i,r){return H(function(t){const e=[];for(let i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function M(t,e,i,r){return H(Y(e),t,i,r)}function w(t,e,i,r){return H(function(t,e){let i,r,n;const a=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)i=t.charCodeAt(o),r=i>>8,n=i%256,a.push(n),a.push(r);return a}(e,t.length-i),t,i,r)}function P(t,i,r){return 0===i&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(i,r))}function _(t,e,i){i=Math.min(t.length,i);const r=[];let n=e;for(;n<i;){const e=t[n];let a=null,o=e>239?4:e>223?3:e>191?2:1;if(n+o<=i){let i,r,s,u;switch(o){case 1:e<128&&(a=e);break;case 2:i=t[n+1],128==(192&i)&&(u=(31&e)<<6|63&i,u>127&&(a=u));break;case 3:i=t[n+1],r=t[n+2],128==(192&i)&&128==(192&r)&&(u=(15&e)<<12|(63&i)<<6|63&r,u>2047&&(u<55296||u>57343)&&(a=u));break;case 4:i=t[n+1],r=t[n+2],s=t[n+3],128==(192&i)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&i)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(a=u))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),n+=o}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=S));return i}(r)}t.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,i){return s(t,e,i)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,i){return function(t,e,i){return u(t),t<=0?a(t):void 0!==e?"string"==typeof i?a(t).fill(e,i):a(t).fill(e):a(t)}(t,e,i)},o.allocUnsafe=function(t){return c(t)},o.allocUnsafeSlow=function(t){return c(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(X(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let i=t.length,r=e.length;for(let n=0,a=Math.min(i,r);n<a;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:r<i?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);let i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;const r=o.allocUnsafe(e);let n=0;for(i=0;i<t.length;++i){let e=t[i];if(X(e,Uint8Array))n+e.length>r.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,n)):Uint8Array.prototype.set.call(r,e,n);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,n)}n+=e.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},o.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},o.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},o.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){let e="";const i=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(t,e,i,r,n){if(X(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(this===t)return 0;let a=(n>>>=0)-(r>>>=0),s=(i>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,n),l=t.slice(e,i);for(let t=0;t<u;++t)if(c[t]!==l[t]){a=c[t],s=l[t];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},o.prototype.indexOf=function(t,e,i){return g(this,t,e,i,!0)},o.prototype.lastIndexOf=function(t,e,i){return g(this,t,e,i,!1)},o.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(i)?(i>>>=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}const n=this.length-e;if((void 0===i||i>n)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let a=!1;for(;;)switch(r){case"hex":return b(this,t,e,i);case"utf8":case"utf-8":return A(this,t,e,i);case"ascii":case"latin1":case"binary":return v(this,t,e,i);case"base64":return M(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,i);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function E(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(127&t[n]);return r}function k(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}function T(t,e,i){const r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);let n="";for(let r=e;r<i;++r)n+=$[t[r]];return n}function B(t,e,i){const r=t.slice(e,i);let n="";for(let t=0;t<r.length-1;t+=2)n+=String.fromCharCode(r[t]+256*r[t+1]);return n}function R(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,i,r,n,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<a)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function x(t,e,i,r,n){V(e,r,n,t,i,7);let a=Number(e&BigInt(4294967295));t[i++]=a,a>>=8,t[i++]=a,a>>=8,t[i++]=a,a>>=8,t[i++]=a;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[i++]=o,o>>=8,t[i++]=o,o>>=8,t[i++]=o,o>>=8,t[i++]=o,i}function I(t,e,i,r,n){V(e,r,n,t,i,7);let a=Number(e&BigInt(4294967295));t[i+7]=a,a>>=8,t[i+6]=a,a>>=8,t[i+5]=a,a>>=8,t[i+4]=a;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[i+3]=o,o>>=8,t[i+2]=o,o>>=8,t[i+1]=o,o>>=8,t[i]=o,i+8}function D(t,e,i,r,n,a){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function C(t,e,r,n,a){return e=+e,r>>>=0,a||D(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,a){return e=+e,r>>>=0,a||D(t,0,r,8),i.write(t,e,r,n,52,8),r+8}o.prototype.slice=function(t,e){const i=this.length;(t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,i){t>>>=0,e>>>=0,i||R(t,e,this.length);let r=this[t],n=1,a=0;for(;++a<e&&(n*=256);)r+=this[t+a]*n;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,i){t>>>=0,e>>>=0,i||R(t,e,this.length);let r=this[t+--e],n=1;for(;e>0&&(n*=256);)r+=this[t+--e]*n;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=q((function(t){j(t>>>=0,"offset");const e=this[t],i=this[t+7];void 0!==e&&void 0!==i||z(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+i*2**24;return BigInt(r)+(BigInt(n)<<BigInt(32))})),o.prototype.readBigUInt64BE=q((function(t){j(t>>>=0,"offset");const e=this[t],i=this[t+7];void 0!==e&&void 0!==i||z(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+i;return(BigInt(r)<<BigInt(32))+BigInt(n)})),o.prototype.readIntLE=function(t,e,i){t>>>=0,e>>>=0,i||R(t,e,this.length);let r=this[t],n=1,a=0;for(;++a<e&&(n*=256);)r+=this[t+a]*n;return n*=128,r>=n&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,i){t>>>=0,e>>>=0,i||R(t,e,this.length);let r=e,n=1,a=this[t+--r];for(;r>0&&(n*=256);)a+=this[t+--r]*n;return n*=128,a>=n&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);const i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);const i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=q((function(t){j(t>>>=0,"offset");const e=this[t],i=this[t+7];void 0!==e&&void 0!==i||z(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(i<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),o.prototype.readBigInt64BE=q((function(t){j(t>>>=0,"offset");const e=this[t],i=this[t+7];void 0!==e&&void 0!==i||z(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+i)})),o.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,i,r){if(t=+t,e>>>=0,i>>>=0,!r){O(this,t,e,i,Math.pow(2,8*i)-1,0)}let n=1,a=0;for(this[e]=255&t;++a<i&&(n*=256);)this[e+a]=t/n&255;return e+i},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,i,r){if(t=+t,e>>>=0,i>>>=0,!r){O(this,t,e,i,Math.pow(2,8*i)-1,0)}let n=i-1,a=1;for(this[e+n]=255&t;--n>=0&&(a*=256);)this[e+n]=t/a&255;return e+i},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=q((function(t,e=0){return x(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=q((function(t,e=0){return I(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*i-1);O(this,t,e,i,r-1,-r)}let n=0,a=1,o=0;for(this[e]=255&t;++n<i&&(a*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/a>>0)-o&255;return e+i},o.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*i-1);O(this,t,e,i,r-1,-r)}let n=i-1,a=1,o=0;for(this[e+n]=255&t;--n>=0&&(a*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/a>>0)-o&255;return e+i},o.prototype.writeInt8=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,i){return t=+t,e>>>=0,i||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=q((function(t,e=0){return x(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=q((function(t,e=0){return I(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,i){return C(this,t,e,!0,i)},o.prototype.writeFloatBE=function(t,e,i){return C(this,t,e,!1,i)},o.prototype.writeDoubleLE=function(t,e,i){return U(this,t,e,!0,i)},o.prototype.writeDoubleBE=function(t,e,i){return U(this,t,e,!1,i)},o.prototype.copy=function(t,e,i,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);const n=r-i;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,i,r):Uint8Array.prototype.set.call(t,this.subarray(i,r),e),n},o.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;let n;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(n=e;n<i;++n)this[n]=t;else{const a=o.isBuffer(t)?t:o.from(t,r),s=a.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<i-e;++n)this[n+e]=a[n%s]}return this};const W={};function K(t,e,i){W[t]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function N(t){let e="",i=t.length;const r="-"===t[0]?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}function V(t,e,i,r,n,a){if(t>i||t<e){const r="bigint"==typeof e?"n":"";let n;throw n=a>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(a+1)}${r}`:`>= -(2${r} ** ${8*(a+1)-1}${r}) and < 2 ** ${8*(a+1)-1}${r}`:`>= ${e}${r} and <= ${i}${r}`,new W.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,i){j(e,"offset"),void 0!==t[e]&&void 0!==t[e+i]||z(e,t.length-(i+1))}(r,n,a)}function j(t,e){if("number"!=typeof t)throw new W.ERR_INVALID_ARG_TYPE(e,"number",t)}function z(t,e,i){if(Math.floor(t)!==t)throw j(t,i),new W.ERR_OUT_OF_RANGE(i||"offset","an integer",t);if(e<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${e}`,t)}K("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),K("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),K("ERR_OUT_OF_RANGE",(function(t,e,i){let r=`The value of "${t}" is out of range.`,n=i;return Number.isInteger(i)&&Math.abs(i)>2**32?n=N(String(i)):"bigint"==typeof i&&(n=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(n=N(n)),n+="n"),r+=` It must be ${e}. Received ${n}`,r}),RangeError);const L=/[^+/0-9A-Za-z-_]/g;function F(t,e){let i;e=e||1/0;const r=t.length;let n=null;const a=[];for(let o=0;o<r;++o){if(i=t.charCodeAt(o),i>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&a.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&a.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;a.push(i)}else if(i<2048){if((e-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function Y(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,i,r){let n;for(n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const $=function(){const t="0123456789abcdef",e=new Array(256);for(let i=0;i<16;++i){const r=16*i;for(let n=0;n<16;++n)e[r+n]=t[i]+t[n]}return e}();function q(t){return"undefined"==typeof BigInt?Z:t}function Z(){throw new Error("BigInt not supported")}}(re);var he=Object.freeze({__proto__:null,getFileHash:t=>u(void 0,void 0,void 0,(function*(){return re.Buffer.from(yield ie(t.toString()))}))});const pe=t=>u(void 0,void 0,void 0,(function*(){try{const{data:e}=yield Ft.get(t);return e}catch(e){throw new Error(`unable to get metadata json from url ${t}`)}}));var ye=Object.freeze({__proto__:null,lookup:pe}),ge=Object.freeze({__proto__:null,Crypto:he,metadata:ye}),me={},be={},Ae={},ve={},Me={},we={},Pe={};!function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR_ACCOUNT_NOT_FOUND=t.ERROR_DEPRECATED_ACCOUNT_DATA=t.ERROR_INVALID_ACCOUNT_DATA=t.ERROR_INVALID_OWNER=t.MetaplexError=t.ErrorCode=void 0,function(t){t[t.ERROR_INVALID_OWNER=0]="ERROR_INVALID_OWNER",t[t.ERROR_INVALID_ACCOUNT_DATA=1]="ERROR_INVALID_ACCOUNT_DATA",t[t.ERROR_DEPRECATED_ACCOUNT_DATA=2]="ERROR_DEPRECATED_ACCOUNT_DATA",t[t.ERROR_ACCOUNT_NOT_FOUND=3]="ERROR_ACCOUNT_NOT_FOUND"}(e=t.ErrorCode||(t.ErrorCode={}));class i extends Error{constructor(t,e){super(e),this.errorCode=t}}t.MetaplexError=i;t.ERROR_INVALID_OWNER=()=>new i(e.ERROR_INVALID_OWNER,"Invalid owner");t.ERROR_INVALID_ACCOUNT_DATA=()=>new i(e.ERROR_INVALID_ACCOUNT_DATA,"Invalid data");t.ERROR_DEPRECATED_ACCOUNT_DATA=()=>new i(e.ERROR_DEPRECATED_ACCOUNT_DATA,"Account data is deprecated");t.ERROR_ACCOUNT_NOT_FOUND=t=>new i(e.ERROR_ACCOUNT_NOT_FOUND,`Unable to find account: ${t}`)}(Pe);var _e=c&&c.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))};Object.defineProperty(we,"__esModule",{value:!0}),we.Account=void 0;const Se=o.default,Ee=re,ke=Pe;class Te{constructor(t,e){this.pubkey=new Se.PublicKey(t),this.info=e}static from(t){return new this(t.pubkey,t.info)}static load(t,e){return _e(this,void 0,void 0,(function*(){const i=yield Te.getInfo(t,e);return new this(e,i)}))}static isCompatible(t){throw new Error("method 'isCompatible' is not implemented")}static getInfo(t,e){return _e(this,void 0,void 0,(function*(){const i=yield t.getAccountInfo(new Se.PublicKey(e));if(!i)throw(0,ke.ERROR_ACCOUNT_NOT_FOUND)(e);return Object.assign(Object.assign({},i),{data:Ee.Buffer.from(null==i?void 0:i.data)})}))}static getInfos(t,e,i="recent"){return _e(this,void 0,void 0,(function*(){const r=[];for(let n=0;n<e.length;n+=99)r.push(Te.getMultipleAccounts(t,e.slice(n,Math.min(e.length,n+99)),i));const n=new Map;return(yield Promise.all(r)).forEach((t=>{var e;return[...null!==(e=null==t?void 0:t.entries())&&void 0!==e?e:[