@massalabs/wallet-provider 1.2.1-dev.20230818073036 → 1.3.1-dev.20230822115102

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/bundle.js CHANGED
@@ -5635,7 +5635,7 @@ class BearbyProvider {
5635
5635
  }
5636
5636
  async accounts() {
5637
5637
  // check if bearby is unlocked
5638
- if (!bearby_js_1.web3.wallet.enabled) {
5638
+ if (!bearby_js_1.web3.wallet.connected) {
5639
5639
  await bearby_js_1.web3.wallet.connect();
5640
5640
  }
5641
5641
  const account = {
package/bundle.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see bundle.min.js.LICENSE.txt */
2
- (()=>{var e={"./node_modules/axios/index.js":(e,t,r)=>{e.exports=r("./node_modules/axios/lib/axios.js")},"./node_modules/axios/lib/adapters/xhr.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/core/settle.js"),s=r("./node_modules/axios/lib/helpers/cookies.js"),i=r("./node_modules/axios/lib/helpers/buildURL.js"),a=r("./node_modules/axios/lib/core/buildFullPath.js"),c=r("./node_modules/axios/lib/helpers/parseHeaders.js"),u=r("./node_modules/axios/lib/helpers/isURLSameOrigin.js"),l=r("./node_modules/axios/lib/core/createError.js"),d=r("./node_modules/axios/lib/defaults/transitional.js"),f=r("./node_modules/axios/lib/cancel/Cancel.js");e.exports=function(e){return new Promise((function(t,r){var h,p=e.data,m=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}n.isFormData(p)&&delete m["Content-Type"];var _=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(E+":"+b)}var w=a(e.baseURL,e.url);function S(){if(_){var n="getAllResponseHeaders"in _?c(_.getAllResponseHeaders()):null,s={data:y&&"text"!==y&&"json"!==y?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:n,config:e,request:_};o((function(e){t(e),g()}),(function(e){r(e),g()}),s),_=null}}if(_.open(e.method.toUpperCase(),i(w,e.params,e.paramsSerializer),!0),_.timeout=e.timeout,"onloadend"in _?_.onloadend=S:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(S)},_.onabort=function(){_&&(r(l("Request aborted",e,"ECONNABORTED",_)),_=null)},_.onerror=function(){r(l("Network Error",e,null,_)),_=null},_.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||d;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",_)),_=null},n.isStandardBrowserEnv()){var A=(e.withCredentials||u(w))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;A&&(m[e.xsrfHeaderName]=A)}"setRequestHeader"in _&&n.forEach(m,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete m[t]:_.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(_.withCredentials=!!e.withCredentials),y&&"json"!==y&&(_.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&_.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){_&&(r(!e||e&&e.type?new f("canceled"):e),_.abort(),_=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),_.send(p)}))}},"./node_modules/axios/lib/axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/helpers/bind.js"),s=r("./node_modules/axios/lib/core/Axios.js"),i=r("./node_modules/axios/lib/core/mergeConfig.js"),a=function e(t){var r=new s(t),a=o(s.prototype.request,r);return n.extend(a,s.prototype,r),n.extend(a,r),a.create=function(r){return e(i(t,r))},a}(r("./node_modules/axios/lib/defaults/index.js"));a.Axios=s,a.Cancel=r("./node_modules/axios/lib/cancel/Cancel.js"),a.CancelToken=r("./node_modules/axios/lib/cancel/CancelToken.js"),a.isCancel=r("./node_modules/axios/lib/cancel/isCancel.js"),a.VERSION=r("./node_modules/axios/lib/env/data.js").version,a.all=function(e){return Promise.all(e)},a.spread=r("./node_modules/axios/lib/helpers/spread.js"),a.isAxiosError=r("./node_modules/axios/lib/helpers/isAxiosError.js"),e.exports=a,e.exports.default=a},"./node_modules/axios/lib/cancel/Cancel.js":e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},"./node_modules/axios/lib/cancel/CancelToken.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/cancel/Cancel.js");function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},o.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},"./node_modules/axios/lib/cancel/isCancel.js":e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},"./node_modules/axios/lib/core/Axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/helpers/buildURL.js"),s=r("./node_modules/axios/lib/core/InterceptorManager.js"),i=r("./node_modules/axios/lib/core/dispatchRequest.js"),a=r("./node_modules/axios/lib/core/mergeConfig.js"),c=r("./node_modules/axios/lib/helpers/validator.js"),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new s,response:new s}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var s,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!o){var d=[i,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(l),s=Promise.resolve(t);d.length;)s=s.then(d.shift(),d.shift());return s}for(var f=t;n.length;){var h=n.shift(),p=n.shift();try{f=h(f)}catch(e){p(e);break}}try{s=i(f)}catch(e){return Promise.reject(e)}for(;l.length;)s=s.then(l.shift(),l.shift());return s},l.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},"./node_modules/axios/lib/core/InterceptorManager.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},"./node_modules/axios/lib/core/buildFullPath.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/isAbsoluteURL.js"),o=r("./node_modules/axios/lib/helpers/combineURLs.js");e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},"./node_modules/axios/lib/core/createError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/enhanceError.js");e.exports=function(e,t,r,o,s){var i=new Error(e);return n(i,t,r,o,s)}},"./node_modules/axios/lib/core/dispatchRequest.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/core/transformData.js"),s=r("./node_modules/axios/lib/cancel/isCancel.js"),i=r("./node_modules/axios/lib/defaults/index.js"),a=r("./node_modules/axios/lib/cancel/Cancel.js");function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(c(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},"./node_modules/axios/lib/core/enhanceError.js":e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.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}},e}},"./node_modules/axios/lib/core/mergeConfig.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){t=t||{};var r={};function o(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function s(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:o(void 0,e[r]):o(e[r],t[r])}function i(e){if(!n.isUndefined(t[e]))return o(void 0,t[e])}function a(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:o(void 0,e[r]):o(void 0,t[r])}function c(r){return r in t?o(e[r],t[r]):r in e?o(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||s,o=t(e);n.isUndefined(o)&&t!==c||(r[e]=o)})),r}},"./node_modules/axios/lib/core/settle.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/createError.js");e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},"./node_modules/axios/lib/core/transformData.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/defaults/index.js");e.exports=function(e,t,r){var s=this||o;return n.forEach(r,(function(r){e=r.call(s,e,t)})),e}},"./node_modules/axios/lib/defaults/index.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/helpers/normalizeHeaderName.js"),s=r("./node_modules/axios/lib/core/enhanceError.js"),i=r("./node_modules/axios/lib/defaults/transitional.js"),a={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,l={transitional:i,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r("./node_modules/axios/lib/adapters/xhr.js")),u),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(c(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||l.transitional,r=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||o&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw s(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){l.headers[e]=n.merge(a)})),e.exports=l},"./node_modules/axios/lib/defaults/transitional.js":e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},"./node_modules/axios/lib/env/data.js":e=>{e.exports={version:"0.26.1"}},"./node_modules/axios/lib/helpers/bind.js":e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},"./node_modules/axios/lib/helpers/buildURL.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(n.isURLSearchParams(t))s=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(o(t)+"="+o(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},"./node_modules/axios/lib/helpers/combineURLs.js":e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},"./node_modules/axios/lib/helpers/cookies.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},"./node_modules/axios/lib/helpers/isAbsoluteURL.js":e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},"./node_modules/axios/lib/helpers/isAxiosError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},"./node_modules/axios/lib/helpers/isURLSameOrigin.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},"./node_modules/axios/lib/helpers/normalizeHeaderName.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},"./node_modules/axios/lib/helpers/parseHeaders.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=["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"];e.exports=function(e){var t,r,s,i={};return e?(n.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=n.trim(e.substr(0,s)).toLowerCase(),r=n.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},"./node_modules/axios/lib/helpers/spread.js":e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},"./node_modules/axios/lib/helpers/validator.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/env/data.js").version,o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var s={};o.transitional=function(e,t,r){function o(e,t){return"[Axios v"+n+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,i){if(!1===e)throw new Error(o(n," has been removed"+(t?" in "+t:"")));return t&&!s[n]&&(s[n]=!0,console.warn(o(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var s=n[o],i=t[s];if(i){var a=e[s],c=void 0===a||i(a,s,e);if(!0!==c)throw new TypeError("option "+s+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:o}},"./node_modules/axios/lib/utils.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/bind.js"),o=Object.prototype.toString;function s(e){return Array.isArray(e)}function i(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===o.call(e)}function c(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:s,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===o.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:l,isStream:function(e){return c(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===o.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:d,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):s(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)d(arguments[n],r);return t},extend:function(e,t,r){return d(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},"./node_modules/base64-js/index.js":(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,s=a(e),i=s[0],c=s[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,i,c)),l=0,d=c>0?i-4:i;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,s=[],i=16383,a=0,u=n-o;a<u;a+=i)s.push(c(e,a,a+i>u?u:a+i));return 1===o?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=s[i],n[s.charCodeAt(i)]=i;function a(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 c(e,t,n){for(var o,s,i=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[(s=o)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},"./node_modules/buffer/index.js":(e,t,r)=>{"use strict";const n=r("./node_modules/base64-js/index.js"),o=r("./node_modules/ieee754/index.js"),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(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 d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|m(e,t);let n=a(r);const o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(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(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(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 c.from(n,t,r);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||z(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.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 l(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 d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),r=a(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,c.prototype),n}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(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 K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(o)return n?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function y(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 x(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function _(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=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(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):E(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,o){let s,i=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;i=2,a/=2,c/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){let n=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===c)return n*i}else-1!==n&&(s-=s-n),n=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;n<c;n++)if(u(e,s+n)!==u(t,n)){r=!1;break}if(r)return s}return-1}function b(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const s=t.length;let i;for(n>s/2&&(n=s/2),i=0;i<n;++i){const n=parseInt(t.substr(2*i,2),16);if(z(n))return i;e[r+i]=n}return i}function w(e,t,r,n){return V(K(t,e.length-r),e,r,n)}function S(e,t,r,n){return V(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 V(J(t),e,r,n)}function v(e,t,r,n){return V(function(e,t){let r,n,o;const s=[];for(let i=0;i<e.length&&!((t-=2)<0);++i)r=e.charCodeAt(i),n=r>>8,o=r%256,s.push(o),s.push(n);return s}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let s=null,i=t>239?4:t>223?3:t>191?2:1;if(o+i<=r){let r,n,a,c;switch(i){case 1:t<128&&(s=t);break;case 2:r=e[o+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(s=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)&&(s=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&&(s=c))}}null===s?(s=65533,i=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=i}return function(e){const t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=C));return r}(n)}t.kMaxLength=i,c.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}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.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,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))o+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},c.byteLength=m,c.prototype._isBuffer=!0,c.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)g(this,t,t+1);return this},c.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)g(this,t,t+3),g(this,t+1,t+2);return this},c.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)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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 s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0);const a=Math.min(s,i),u=this.slice(n,o),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){s=u[e],i=l[e];break}return s<i?-1:i<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},c.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 s=!1;for(;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return S(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function N(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 R(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 x(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+=X[e[n]];return o}function I(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 B(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 P(e,t,r,n,o,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function j(e,t,r,n,o){q(t,n,o,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,r}function U(e,t,r,n,o){q(t,n,o,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=i,i>>=8,e[r+2]=i,i>>=8,e[r+1]=i,i>>=8,e[r]=i,r+8}function M(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,s){return t=+t,r>>>=0,s||M(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,s){return t=+t,r>>>=0,s||M(e,0,r,8),o.write(e,t,r,n,52,8),r+8}c.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,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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))})),c.prototype.readBigUInt64BE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=t,o=1,s=this[e+--n];for(;n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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)})),c.prototype.readBigInt64BE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);let o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);let o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}let o=0,s=1,i=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/s>>0)-i&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}let o=r-1,s=1,i=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s>>0)-i&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeBigInt64LE=Q((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.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},c.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&&!c.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 s=c.isBuffer(e)?e:c.from(e,n),i=s.length;if(0===i)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%i]}return this};const k={};function $(e,t,r){k[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 G(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 q(e,t,r,n,o,s){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=s>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new k.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||F(t,e.length-(r+1))}(n,o,s)}function W(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,r){if(Math.floor(e)!==e)throw W(e,r),new k.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),$("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=G(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=G(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function K(e,t){let r;t=t||1/0;const n=e.length;let o=null;const s=[];for(let i=0;i<n;++i){if(r=e.charCodeAt(i),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&s.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function J(e){return n.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 V(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 Y(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 X=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?Z:e}function Z(){throw new Error("BigInt not supported")}},"./node_modules/events/events.js":e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,s),n(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}m(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var o,s,i,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),i=s[t]),void 0===i)i=s[t]=r,++e._eventsCount;else if("function"==typeof i?i=s[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):p(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(s){n.once&&e.removeEventListener(t,o),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,s=this._events;if(void 0!==s)o=o&&void 0===s.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,o,s,i;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(o=s[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/ieee754/index.js":(e,t)=>{t.read=function(e,t,r,n,o){var s,i,a=8*o-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?o-1:0,f=r?-1:1,h=e[t+d];for(d+=f,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=f,l-=8);for(i=s&(1<<-l)-1,s>>=-l,l+=n;l>0;i=256*i+e[t+d],d+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return i?NaN:1/0*(h?-1:1);i+=Math.pow(2,n),s-=u}return(h?-1:1)*i*Math.pow(2,s-n)},t.write=function(e,t,r,n,o,s){var i,a,c,u=8*s-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),(t+=i+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(i++,c/=2),i+d>=l?(a=0,i=l):i+d>=1?(a=(t*c-1)*Math.pow(2,o),i+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),i=0));o>=8;e[r+h]=255&a,h+=p,a/=256,o-=8);for(i=i<<o|a,u+=o;u>0;e[r+h]=255&i,h+=p,i/=256,u-=8);e[r+h-p]|=128*m}},"./src/account/Account.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const n=r("./src/connector/Connector.ts"),o=r("./src/index.ts");t.Account=class{constructor({address:e,name:t},r){this._address=e,this._name=t??"",this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountBalance,{address:this._address},((r,n)=>n?t(n):e(r)))}))}async sign(e){return new Promise(((t,r)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountSign,{address:this._address,data:e},((e,n)=>n?r(n):t(e)))}))}async buyRolls(e,t){return new Promise(((r,s)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountBuyRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?s(t):r(e)))}))}async sellRolls(e,t){return new Promise(((r,s)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountSellRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?s(t):r(e)))}))}async sendTransaction(e,t,r){return new Promise(((s,i)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountSendTransaction,{amount:e.toString(),recipientAddress:t,fee:r.toString()},((e,t)=>t?i(t):s(e)))}))}async callSC(e,t,r,s,i,a,c=!1){return new Promise(((u,l)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountCallSC,{nickname:this._name,name:t,at:e,args:r,coins:s,fee:i,maxGas:a,nonPersistentExecution:c},((e,t)=>t?l(t):u(e)))}))}}},"./src/account/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;var n=r("./src/account/Account.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return n.Account}})},"./src/bearbyWallet/BearbyAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BearbyAccount=t.OperationTypeId=t.OperationsType=t.PUBLIC_NODE_RPC=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),o=r("./src/massaStation/RequestHandler.ts"),s=r("./src/bearbyWallet/jsonRpcMethods.ts"),i=r("./node_modules/axios/index.js"),a=BigInt(4294967295);var c,u;t.PUBLIC_NODE_RPC="https://buildnet.massa.net/api/v2",function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(c=t.OperationsType||(t.OperationsType={})),(u=t.OperationTypeId||(t.OperationTypeId={}))[u.Transaction=0]="Transaction",u[u.RollBuy=1]="RollBuy",u[u.RollSell=2]="RollSell",u[u.ExecuteSC=3]="ExecuteSC",u[u.CallSC=4]="CallSC";const l={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Content-Type":"application/json"};t.BearbyAccount=class{constructor({address:e,name:r},n){this._nodeUrl=t.PUBLIC_NODE_RPC,this._address=e,this._name=r??"Bearby_account",this._providerName=n}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async connect(){try{await n.web3.wallet.connect()}catch(e){console.log("Bearby connection error: ",e)}}async balance(){await this.connect();const e={jsonrpc:"2.0",method:"get_addresses",params:[[this._address]],id:0},r=await(0,o.postRequest)(t.PUBLIC_NODE_RPC,e);if(r.isError||r.error)throw r.error.message;return{finalBalance:r.result.result[0].final_balance,candidateBalance:r.result.result[0].candidate_balance}}async sign(e){await this.connect();const t=new TextEncoder;let r;e instanceof Uint8Array&&(r=(new TextDecoder).decode(e)),e instanceof Buffer&&(r=e.toString());const o=await n.web3.wallet.signMessage(r);return{publicKey:o.publicKey,signature:t.encode(o.signature)}}async buyRolls(e,t){return await this.connect(),{operationId:await n.web3.wallet.signTransaction({type:c.RollBuy,amount:e.toString(),fee:t.toString(),payload:""})}}async sellRolls(e,t){return await this.connect(),{operationId:await n.web3.wallet.signTransaction({type:c.RollSell,amount:e.toString(),fee:t.toString(),payload:""})}}async sendTransaction(e,t,r){return await this.connect(),{operationId:await n.web3.wallet.signTransaction({type:c.Payment,amount:e.toString(),recipient:t,fee:r.toString(),payload:""})}}async callSC(e,t,r,o,s,i,a=!1){if(await this.connect(),a)return this.nonPersistentCallSC(e,t,r,o,s,i);if(r instanceof Uint8Array)throw new Error("Bearby wallet does not support Uint8Array as parameter. Please use Args instead");let c=[];try{c=r.getArgsList().map((e=>({type:e.type,value:e.value})))}catch(e){throw new Error("\n Bearby wallet does not support Uint8Array, serializable, and serializableObjectArray. \n To use them switch to MassaStation")}return{operationId:await n.web3.contract.call({maxGas:Number(i),coins:Number(o),fee:Number(s),targetAddress:e,functionName:t,parameters:c})}}async getNodeStatus(){const e=s.JSON_RPC_REQUEST_METHOD.GET_STATUS;return await this.sendJsonRPCRequest(e,[])}async sendJsonRPCRequest(e,t){let r=null;if(r=await this.promisifyJsonRpcCall(e,t),r.isError||r.error)throw r.error;return r.result}async promisifyJsonRpcCall(e,t){let r=null;const n={jsonrpc:"2.0",method:e,params:t,id:0};try{r=await i.default.post(this._nodeUrl,n,{headers:l})}catch(e){return{isError:!0,result:null,error:new Error("JSON.parse error: "+String(e))}}const o=r.data;return o.error?{isError:!0,result:null,error:new Error(o.error.message)}:{isError:!1,result:o.result,error:null}}async nonPersistentCallSC(e,r,n,s,i,c){const u=t.PUBLIC_NODE_RPC;if(c>a)throw new Error(`\n The gas submitted ${c.toString()} exceeds the max. allowed block gas of \n ${a.toString()}\n `);let l=[];l=n instanceof Uint8Array?Array.from(n):Array.from(n.serialize());const d=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(c),target_address:e,target_function:r,parameter:l,caller_address:this._address,coins:Number(s),fee:Number(i)}]],id:0}];let f=[];try{let e=await(0,o.postRequest)(u,d);if(e.isError||e.error)throw e.error.message;f=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(f.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(f[0].result.Error)throw new Error(f[0].result.Error);return{returnValue:new Uint8Array(f[0].result[0].result.Ok),info:f[0]}}}},"./src/bearbyWallet/BearbyConnect.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectBearby=t.connectBearby=t.detectBearby=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js");t.detectBearby=async function(){return!(!globalThis.window||!globalThis.window.bearby)},t.connectBearby=async function(){try{await n.web3.wallet.connect()}catch(e){console.log(e)}},t.disconnectBearby=async function(){await n.web3.wallet.diconnect(),console.log("Bearby disconnected")}},"./src/bearbyWallet/BearbyProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BearbyProvider=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),o=r("./src/bearbyWallet/BearbyAccount.ts");t.BearbyProvider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){n.web3.wallet.enabled||await n.web3.wallet.connect();const e={address:await n.web3.wallet.account.base58,name:"BEARBY"};return[new o.BearbyAccount(e,this.providerName)]}async importAccount(e,t){throw new Error("Method not implemented.")}async deleteAccount(e){throw new Error("Method not implemented.")}async getNodesUrls(){return["https://buildnet.massa.net/api/v2"]}async generateNewAccount(e){throw new Error("Method not implemented.")}}},"./src/bearbyWallet/jsonRpcMethods.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.JSON_RPC_REQUEST_METHOD=void 0,(r=t.JSON_RPC_REQUEST_METHOD||(t.JSON_RPC_REQUEST_METHOD={})).GET_STATUS="get_status",r.GET_ADDRESSES="get_addresses",r.SEND_OPERATIONS="send_operations",r.GET_BLOCKS="get_blocks",r.GET_ENDORSEMENTS="get_endorsements",r.GET_OPERATIONS="get_operations",r.GET_CLIQUES="get_cliques",r.GET_STAKERS="get_stakers",r.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",r.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",r.EXECUTE_READ_ONLY_CALL="execute_read_only_call",r.GET_DATASTORE_ENTRIES="get_datastore_entries",r.GET_BLOCKCLIQUE_BLOCK_BY_SLOT="get_blockclique_block_by_slot",r.GET_GRAPH_INTERVAL="get_graph_interval",r.STOP_NODE="stop_node",r.NODE_BAN_BY_IP="node_ban_by_ip",r.NODE_BAN_BY_ID="node_ban_by_id",r.NODE_UNBAN_BY_IP="node_unban_by_ip",r.NODE_UNBAN_BY_ID="node_unban_by_id",r.GET_STAKING_ADDRESSES="get_staking_addresses",r.REMOVE_STAKING_ADDRESSES="remove_staking_addresses",r.ADD_STAKING_PRIVATE_KEYS="add_staking_private_keys",r.NODE_SIGN_MESSAGE="node_sign_message",r.NODE_REMOVE_FROM_WHITELIST="node_remove_from_whitelist",r.NODE_ADD_TO_PEERS_WHITELIST="node_add_to_peers_whitelist"},"./src/connector/Connector.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connector=t.MASSA_WINDOW_OBJECT=void 0;const n=r("./node_modules/uid/dist/index.js"),o=r("./src/index.ts"),s=r("./src/massaStation/MassaStationDiscovery.ts"),i=r("./src/massaStation/MassaStationProvider.ts");t.MASSA_WINDOW_OBJECT="massaWalletProvider",t.connector=new class{constructor(){this.registeredProviders={},"undefined"!=typeof document&&(this.pendingRequests=new Map,this.massaStationListener=new s.MassaStationDiscovery,this.initMassaStationListener(),this.register(),document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("message",this.handleResponseFromContentScript.bind(this)))}register(){if("undefined"!=typeof document){if(!document.getElementById(t.MASSA_WINDOW_OBJECT)){const e=document.createElement("p");e.id=t.MASSA_WINDOW_OBJECT,e.setAttribute("style","display:none"),document.body.appendChild(e)}document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("register",(e=>{const r=e.detail,n=`${t.MASSA_WINDOW_OBJECT}_${r.providerName}`;this.registeredProviders[r.providerName]=n}))}}initMassaStationListener(){this.massaStationListener.on(s.ON_MASSA_STATION_DISCOVERED,(()=>{this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]=`${t.MASSA_WINDOW_OBJECT}_${i.MASSA_STATION_PROVIDER_NAME}`})),this.massaStationListener.on(s.ON_MASSA_STATION_DISCONNECTED,(()=>{delete this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]}))}async startMassaStationDiscovery(){try{await this.massaStationListener.startListening()}catch(e){console.log("MassaStation is not detected")}}sendMessageToContentScript(e,t,r,s){if(!Object.values(o.AvailableCommands).includes(t))throw new Error(`Unknown command ${t}`);const i=(0,n.uid)(),a={params:r,requestId:i};this.pendingRequests.set(i,s);const c=document?.getElementById(`${this.registeredProviders[e]}`);if(!c)throw new Error(`Registered provider with name ${e} does not exist`);if(!c.dispatchEvent(new CustomEvent(t,{detail:a})))throw new Error(`Could not dispatch a message to ${this.registeredProviders[e]}`)}getWalletProviders(){return this.registeredProviders}handleResponseFromContentScript(e){const{result:t,error:r,requestId:n}=e.detail,o=this.pendingRequests.get(n);o?(r?o(null,new Error(r.message)):o(t,null),this.pendingRequests.delete(n)||console.error(`Error deleting a pending request with id ${n}`)):console.error(`Request Id ${n} not found in response callback map`)}}},"./src/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectBearby=t.connectBearby=t.MassaStationAccount=t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=t.Account=t.registerProvider=t.providers=t.AvailableCommands=void 0;const n=r("./node_modules/buffer/index.js");"undefined"!=typeof window&&(window.Buffer=n.Buffer);const o=r("./src/connector/Connector.ts"),s=r("./src/provider/Provider.ts"),i=r("./src/massaStation/MassaStationProvider.ts"),a=r("./src/bearbyWallet/BearbyConnect.ts"),c=r("./src/bearbyWallet/BearbyProvider.ts"),u=r("./src/utils/time.ts");var l;(l=t.AvailableCommands||(t.AvailableCommands={})).ProviderListAccounts="LIST_ACCOUNTS",l.ProviderDeleteAccount="DELETE_ACCOUNT",l.ProviderImportAccount="IMPORT_ACCOUNT",l.ProviderGetNodesUrls="GET_NODES_URLS",l.AccountBalance="ACCOUNT_BALANCE",l.AccountSign="ACCOUNT_SIGN",l.ProviderGenerateNewAccount="GENERATE_NEW_ACCOUNT",l.AccountSellRolls="ACCOUNT_SELL_ROLLS",l.AccountBuyRolls="ACCOUNT_BUY_ROLLS",l.AccountSendTransaction="ACCOUNT_SEND_TRANSACTION",l.AccountCallSC="ACCOUNT_CALL_SC",t.providers=async function(e=!0,t=3e3,r=500){const n=Date.now();let l;for(await o.connector.startMassaStationDiscovery(),await(0,a.detectBearby)()&&(l=new c.BearbyProvider("BEARBY"));Date.now()-n<t;){const t=Object.keys(o.connector.getWalletProviders()).map((e=>e===i.MASSA_STATION_PROVIDER_NAME?new i.MassaStationProvider:new s.Provider(e)));if(l&&t.push(l),!e||t.length>0)return t;await(0,u.wait)(r)}return[]},t.registerProvider=function(e,t=o.MASSA_WINDOW_OBJECT){if("undefined"!=typeof document){const r=new CustomEvent("register",{detail:{providerName:e}}),n=document?.getElementById(t);n&&n.dispatchEvent(r)}};var d=r("./src/account/index.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return d.Account}});var f=r("./src/provider/index.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return f.EAccountDeletionResponse}}),Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return f.EAccountImportResponse}}),Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return f.Provider}});var h=r("./src/massaStation/MassaStationAccount.ts");Object.defineProperty(t,"MassaStationAccount",{enumerable:!0,get:function(){return h.MassaStationAccount}});var p=r("./src/bearbyWallet/BearbyConnect.ts");Object.defineProperty(t,"connectBearby",{enumerable:!0,get:function(){return p.connectBearby}}),Object.defineProperty(t,"disconnectBearby",{enumerable:!0,get:function(){return p.disconnectBearby}})},"./src/massaStation/MassaStationAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationAccount=void 0;const n=r("./src/massaStation/RequestHandler.ts"),o=r("./src/massaStation/MassaStationProvider.ts"),s=r("./src/utils/argsToBase64.ts"),i=BigInt(4294967295);t.MassaStationAccount=class{constructor({address:e,name:t},r){this._address=e,this._name=t,this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){let e=null;try{e=await(0,n.getRequest)(`${o.MASSA_STATION_URL}massa/addresses?attributes=balance&addresses=${this._address}`)}catch(e){throw console.error("MassaStation account balance error"),e}if(e.isError||e.error)throw e.error;const t=e.result.addressesAttributes[this._address].balance;return{finalBalance:t.final,candidateBalance:t.pending}}async sign(e){let t=null;try{t=await(0,n.postRequest)(`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/sign`,{operation:Buffer.from(e).toString("base64"),batch:!1})}catch(e){throw console.error("MassaStation account signing error"),e}if(t.isError||t.error)throw t.error;const r=new Uint8Array(Buffer.from(t.result.signature));return{publicKey:t.result.publicKey,signature:r}}async buyRolls(e,t){let r=null;const s=`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"buy"};try{r=await(0,n.postRequest)(s,i)}catch(e){throw console.error(`MassaStation account: error while buying rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sellRolls(e,t){let r=null;const s=`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"sell"};try{r=await(0,n.postRequest)(s,i)}catch(e){throw console.error(`MassaStation account: error while selling rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sendTransaction(e,t,r){let s=null;const i=`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/transfer`,a={fee:r.toString(),amount:e.toString(),recipientAddress:t};try{s=await(0,n.postRequest)(i,a)}catch(e){throw console.error(`MassaStation account: error while sending transaction: ${e}`),e}if(s.isError||s.error)throw s.error;return s.result}async callSC(e,t,r,i,a,c,u=!1){if(u)return this.nonPersistentCallSC(e,t,r,i,a,c);let l="";l=r instanceof Uint8Array?(0,s.uint8ArrayToBase64)(r):(0,s.argsToBase64)(r);let d=null;const f=`${o.MASSA_STATION_URL}cmd/executeFunction`,h={nickname:this._name,name:t,at:e,args:l,coins:Number(i)};try{d=await(0,n.postRequest)(f,h)}catch(e){throw console.log(`MassaStation account: error while interacting with smart contract: ${e}`),e}if(d.isError||d.error)throw d.error;return d.result}async getNodeUrlFromMassaStation(){let e=null,t="";try{if(e=await(0,n.getRequest)(`${o.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;t=e.result.url}catch(e){throw new Error(`MassaStation nodes retrieval error: ${e}`)}return t}async nonPersistentCallSC(e,t,r,o,s,a){const c=await this.getNodeUrlFromMassaStation();if(a>i)throw new Error(`\n The gas submitted ${a.toString()} exceeds the max. allowed block gas of \n ${i.toString()}\n `);let u=[];u=r instanceof Uint8Array?Array.from(r):Array.from(r.serialize());const l=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(a),target_address:e,target_function:t,parameter:u,caller_address:this._address}]],id:0}];let d=[];try{let e=await(0,n.postRequest)(c,l);if(e.isError||e.error)throw e.error.message;d=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(d.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(d[0].result.Error)throw new Error(d[0].result.Error);return{returnValue:new Uint8Array(d[0].result[0].result.Ok),info:d[0]}}}},"./src/massaStation/MassaStationDiscovery.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationDiscovery=t.ON_MASSA_STATION_DISCONNECTED=t.ON_MASSA_STATION_DISCOVERED=t.MASSA_STATION_DISCOVERY_URL=void 0;const n=r("./node_modules/events/events.js"),o=r("./src/massaStation/RequestHandler.ts");t.MASSA_STATION_DISCOVERY_URL="https://station.massa/web/index",t.ON_MASSA_STATION_DISCOVERED="ON_MASSA_STATION_DISCOVERED",t.ON_MASSA_STATION_DISCONNECTED="ON_MASSA_STATION_DISCONNECTED";class s extends n.EventEmitter{constructor(){super(),this.isDiscovered=!1,this.startListening=this.startListening.bind(this)}async startListening(){let e=null;try{e=await(0,o.getRequest)(t.MASSA_STATION_DISCOVERY_URL,2e3)}catch(e){console.error(`Error calling ${t.MASSA_STATION_DISCOVERY_URL}`)}e.isError||e.error||(this.isDiscovered=!0,this.emit(t.ON_MASSA_STATION_DISCOVERED)),(e.isError||e.error)&&this.isDiscovered&&(this.isDiscovered=!1,this.emit(t.ON_MASSA_STATION_DISCONNECTED))}}t.MassaStationDiscovery=s},"./src/massaStation/MassaStationProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationProvider=t.MASSA_STATION_PROVIDER_NAME=t.MASSA_STATION_IMPORT_ACCOUNTS_URL=t.MASSA_STATION_ACCOUNTS_URL=t.MASSA_STATION_URL=void 0;const n=r("./src/provider/AccountDeletion.ts"),o=r("./src/provider/AccountImport.ts"),s=r("./src/massaStation/RequestHandler.ts"),i=r("./src/massaStation/MassaStationAccount.ts");t.MASSA_STATION_URL="https://station.massa/",t.MASSA_STATION_ACCOUNTS_URL=`${t.MASSA_STATION_URL}plugin/massa-labs/massa-wallet/api/accounts`,t.MASSA_STATION_IMPORT_ACCOUNTS_URL=`${t.MASSA_STATION_ACCOUNTS_URL}/import/`,t.MASSA_STATION_PROVIDER_NAME="MASSASTATION",t.MassaStationProvider=class{constructor(){this.providerName=t.MASSA_STATION_PROVIDER_NAME}name(){return this.providerName}async accounts(){let e=null;try{e=await(0,s.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.error("MassaStation accounts retrieval error"),e}if(e.isError||e.error)throw e.error.message;return e.result.map((e=>new i.MassaStationAccount({address:e.address,name:e.nickname},this.providerName)))}async importAccount(e,r){const n={publicKey:e,privateKey:r};let i=null;try{i=await(0,s.putRequest)(t.MASSA_STATION_ACCOUNTS_URL,n)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(i.isError||i.error)throw i.error.message;return{response:o.EAccountImportResponse.OK,message:"Account imported successfully"}}async deleteAccount(e){let r=null;try{r=await(0,s.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(r.isError||r.error)throw r.error.message;const o=r.result.find((t=>t.address.toLowerCase()===e.toLowerCase()));let i=null;try{i=await(0,s.deleteRequest)(`${t.MASSA_STATION_ACCOUNTS_URL}/${o.nickname}`)}catch(e){return console.log("MassaStation accounts deletion error",e),{response:n.EAccountDeletionResponse.ERROR}}return i.isError||i.error?(console.log("MassaStation accounts deletion error",i.error.message),{response:n.EAccountDeletionResponse.ERROR}):{response:n.EAccountDeletionResponse.OK}}async getNodesUrls(){let e=null;try{if(e=await(0,s.getRequest)(`${t.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;const r=e.result;return Array(r.url)}catch(e){throw console.error("MassaStation nodes retrieval error",e),e}}async generateNewAccount(e){let r=null;console.log(t.MASSA_STATION_ACCOUNTS_URL+"/"+e);try{if(r=await(0,s.postRequest)(t.MASSA_STATION_ACCOUNTS_URL+"/"+e,{}),r.isError||r.error)throw r.error.message;return{address:r.result.address,name:r.result.nickname}}catch(e){throw console.error(`Error while generating account: ${e}`),e}}}},"./src/massaStation/RequestHandler.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.putRequest=t.deleteRequest=t.postRequest=t.getRequest=void 0;const n=r("./node_modules/axios/index.js"),o={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Content-Type":"application/json"};t.getRequest=async function(e,t=null){let r=null;try{r=await n.default.get(e,{headers:o,timeout:t})}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:r.data,error:null}},t.postRequest=async function(e,t){try{return{isError:!1,result:(await n.default.post(e,t,{headers:o})).data,error:null}}catch(e){return{isError:!0,result:null,error:e.response?.data?.message?new Error(String(e.response.data.message)):new Error("Axios error: "+String(e))}}},t.deleteRequest=async function(e){let t=null;try{t=await n.default.delete(e,{headers:o})}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:t.data,error:null}},t.putRequest=async function(e,t){let r=null;try{r=await n.default.put(e,t,{headers:o})}catch(e){return{isError:!0,result:null,error:new Error("Axios error: "+String(e))}}return{isError:!1,result:r.data,error:null}}},"./src/provider/AccountDeletion.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountDeletionResponse=void 0,(r=t.EAccountDeletionResponse||(t.EAccountDeletionResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/AccountImport.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountImportResponse=void 0,(r=t.EAccountImportResponse||(t.EAccountImportResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/Provider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=void 0;const n=r("./src/connector/Connector.ts"),o=r("./src/account/Account.ts"),s=r("./src/index.ts");t.Provider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){const e=new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderListAccounts,{},((r,n)=>n?t(n):e(r)))})),t=await e;let r=[];for(const e of t){const t=new o.Account(e,this.providerName);r.push(t)}return r}async importAccount(e,t){const r={publicKey:e,privateKey:t};return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderImportAccount,r,((r,n)=>n?t(n):e(r)))}))}async deleteAccount(e){const t={address:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderDeleteAccount,t,((t,n)=>n?r(n):e(t)))}))}async getNodesUrls(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderGetNodesUrls,{},((r,n)=>n?t(n):e(r)))}))}async generateNewAccount(e){const t={name:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderGenerateNewAccount,t,((t,n)=>n?r(n):e(t)))}))}}},"./src/provider/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=void 0;var n=r("./src/provider/AccountDeletion.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return n.EAccountDeletionResponse}});var o=r("./src/provider/AccountImport.ts");Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return o.EAccountImportResponse}});var s=r("./src/provider/Provider.ts");Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return s.Provider}})},"./src/utils/argsToBase64.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint8ArrayToBase64=t.argsToBase64=void 0,t.argsToBase64=function(e){const t=e.serialize();return Buffer.from(t).toString("base64")},t.uint8ArrayToBase64=function(e){return Buffer.from(e).toString("base64")}},"./src/utils/time.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withTimeoutRejection=t.wait=t.Interval=t.Timeout=void 0;class r{constructor(e,t){this.clear=this.clear.bind(this);const r=this;this.isCleared=!1,this.isCalled=!1,this.timeoutHook=setTimeout((()=>{r.isCleared||(this.isCalled=!0,t())}),e)}clear(){this.isCleared||(clearTimeout(this.timeoutHook),this.isCleared=!0)}}t.Timeout=r,t.Interval=class{constructor(e,t){this.clear=this.clear.bind(this);const r=this;this.isCleared=!1,this.isCalled=!1,this.intervalHook=setInterval((()=>{r.isCleared||(this.isCalled=!0,t())}),e)}clear(){this.isCleared||(clearInterval(this.intervalHook),this.isCleared=!0)}},t.wait=async e=>new Promise(((t,n)=>{const o=new r(e,(()=>(o.clear(),t())))})),t.withTimeoutRejection=async function(e,t){const r=new Promise(((e,r)=>setTimeout((()=>r(new Error(`Timeout of ${t} has passed and promise did not resolve`))),t)));return Promise.race([e,r])}},"./node_modules/uid/dist/index.js":(e,t)=>{for(var r,n=256,o=[];n--;)o[n]=(n+256).toString(16).substring(1);t.uid=function(e){var t=0,s=e||11;if(!r||n+s>512)for(r="",n=0;t<256;t++)r+=o[256*Math.random()|0];return r.substring(n,n+++s)}},"./node_modules/@hicaru/bearby.js/dist/index.js":(e,t,r)=>{"use strict";function n(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function o(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}r.r(t),r.d(t,{ArgTypes:()=>u,ContentProvider:()=>V,Contract:()=>h,Massa:()=>Y,Wallet:()=>te,Web3:()=>re,web3:()=>ne});const s="Wallet is not connected";class i{get payload(){return JSON.parse(JSON.stringify({type:this.type,amount:this.amount,fee:this.fee,gasPrice:this.gasPrice,gasLimit:this.gasLimit,coins:this.coins,maxCoins:this.maxCoins,code:this.contract,func:this.functionName,params:this.parameters,toAddr:this.recipient||this.contract,deployer:this.deployer}))}constructor(e,t,r,n,o,s){this.type=e,this.amount=String(t),this.recipient=r,this.parameters=n||[],this.contract=o,this.functionName=s}}var a,c,u,l,d;function f(e){let t=new Uint8Array(e.length);return Array.prototype.forEach.call(t,((t,r,n)=>{n[r]=e.charCodeAt(r)})),t}!function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(a||(a={})),function(e){e.GET_STATUS="get_status",e.GET_ADDRESSES="get_addresses",e.GET_GRAPH_INTERVAL="get_graph_interval",e.GET_BLOCKS="get_blocks",e.GET_ENDORSEMENTS="get_endorsements",e.GET_OPERATIONS="get_operations",e.GET_CLIQUES="get_cliques",e.GET_STAKERS="get_stakers",e.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",e.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",e.EXECUTE_READ_ONLY_CALL="execute_read_only_call",e.GET_DATASTORE_ENTRIES="get_datastore_entries"}(c||(c={})),function(e){e[e.STRING=0]="STRING",e[e.BOOL=1]="BOOL",e[e.U8=2]="U8",e[e.U32=3]="U32",e[e.U64=4]="U64",e[e.U128=5]="U128",e[e.U256=6]="U256",e[e.I32=7]="I32",e[e.I64=8]="I64",e[e.F32=9]="F32",e[e.F64=10]="F64"}(u||(u={}));class h{constructor(e,t){l.set(this,void 0),d.set(this,void 0),this.types=u,o(this,l,e,"f"),o(this,d,t,"f")}async deploy(e){const t=new i(a.ExecuteSC,"0",void 0,e.parameters,e.contractDataBase64,void 0);return t.deployer=e.deployerBase64,t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.gasPrice=String(e.gasPrice),t.maxCoins=String(e.maxCoins),t.coins=String(e.coins),n(this,d,"f").signTransaction(t)}async call(e){const t=new i(a.CallSC,"0",void 0,e.parameters,e.targetAddress,e.functionName);return t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.coins=String(e.coins||0),n(this,d,"f").signTransaction(t)}async getFilteredSCOutputEvent(...e){const t=c.GET_FILTERED_SC_OUTPUT_EVENT,r=await n(this,l,"f").send(e.map((e=>({method:t,params:[e]}))));return 1===e.length?r[0]:r}async getDatastoreEntries(...e){const t=c.GET_DATASTORE_ENTRIES,r=[];for(const{key:t,address:n}of e)r.push({address:n,key:Array.from(f(t))});return await n(this,l,"f").send([{method:t,params:[r]}])}async executeReadOlyBytecode(e){const t=c.EXECUTE_READ_ONLY_BYTECODE;return n(this,l,"f").send([{method:t,params:[e]}])}async readSmartContract(...e){const t=c.EXECUTE_READ_ONLY_CALL,r=await n(this,l,"f").send([{method:t,params:[e.map((e=>({max_gas:e.maxGas,simulated_gas_price:String(e.simulatedGasPrice),target_address:e.targetAddress,target_function:e.targetFunction,parameters:e.parameters,caller_address:e.callerAddress||n(this,d,"f").account.base58})))]}]);return 1===e.length?r[0]:r}}l=new WeakMap,d=new WeakMap;const p="BearBy",m={CONTENT:`@/${p}/content-script`,INJECTED:`@/${p}/injected-script`},y={GET_DATA:`@/${p}/get-wallet-data`,NEW_SLOT:`@/${p}/new-slot-emited`,ACCOUNT_CHANGED:`@/${p}/accounts-just-changed`,CONTENT_PROXY_MEHTOD:`@/${p}/proxy-method`,CONTENT_PROXY_RESULT:`@/${p}/response-from-content`,CONNECT_APP:`@/${p}/connect-app`,RESPONSE_CONNECT_APP:`@/${p}/respoonse-connect-app`,NETWORK_CHANGED:`@/${p}/network-just-changed`,DISCONNECT_APP:`@/${p}/disconnect_app`,DISCONNECT_APP_RESULT:`@/${p}/disconnect_app_result`,LOCKED:`@/${p}/guard-just-lock`,TX_TO_SEND:`@/${p}/add-tx-to-send`,TX_TO_SEND_RESULT:`@/${p}/response-tx-result`,CHECK_MASSA_ADDRESS:`@/${p}/check-massa-address`,CHECK_MASSA_ADDRESS_RES:`@/${p}/check-massa-address-response`,SIGN_MESSAGE:`@/${p}/sign-message-call`,SING_MESSAGE_RESULT:`@/${p}/sign-message-response`};var g,_,E,b,w;const{document:S}=globalThis;class A{constructor(e){g.add(this),_.set(this,void 0),o(this,_,e,"f")}listen(e){S.addEventListener(n(this,_,"f"),(t=>{t&&t.detail&&e(JSON.parse(t.detail))}))}send(e,t){e.from=n(this,_,"f"),Object.values(m).includes(t)&&n(this,g,"m",E).call(this,JSON.stringify(e),t)}}var v,T,O,C,N,R,x,I,B,P,j,U,M,L,D,k,$,G,q,W;_=new WeakMap,g=new WeakSet,E=function(e,t){S.dispatchEvent(n(this,g,"m",w).call(this,e,t))},b=function(e){return{detail:e}},w=function(e,t){return new CustomEvent(t,n(this,g,"m",b).call(this,e))};class F{constructor(){v.set(this,[])}on(e){return n(this,v,"f").push(e),()=>this.removeListener(e)}removeListener(e){const t=n(this,v,"f").indexOf(e);t>-1&&n(this,v,"f").splice(t,1)}removeAllListeners(){n(this,v,"f").splice(0,n(this,v,"f").length)}emit(...e){n(this,v,"f").forEach((t=>t.apply(this,e)))}once(e){const t=this.on(((...r)=>{t(),e.apply(this,r)}))}}v=new WeakMap;class H{get type(){return n(this,T,"f").type}get payload(){return n(this,T,"f").payload}constructor(e){T.set(this,void 0),o(this,T,e,"f")}send(e,t){const r=JSON.stringify(n(this,T,"f")),o=JSON.parse(r);e.send(o,t)}}T=new WeakMap;class K{constructor(){this.stream=new A(m.INJECTED),this.subject=new F,globalThis.document&&this.stream.listen((e=>{this.subject.emit(e)}))}initialized(){const e=m.CONTENT;new H({type:y.GET_DATA,payload:{}}).send(this.stream,e)}}function J(){return[...Array(20)].map((()=>Math.floor(16*Math.random()).toString(16))).join("")}class V{constructor(e,t){O.set(this,void 0),C.set(this,void 0),o(this,O,e,"f"),o(this,C,t,"f")}async send(e){const t=y.CONTENT_PROXY_MEHTOD,r=m.CONTENT,o=J();let s;new H({type:t,payload:{body:e,uuid:o}}).send(n(this,O,"f"),r);const i=new Promise(((e,t)=>{s=n(this,C,"f").on((r=>{if(r.type===y.CONTENT_PROXY_RESULT&&r.payload&&r.payload.uuid&&r.payload.uuid===o)return r.payload&&r.payload.reject?(s(),t(new Error(r.payload.reject))):(delete r.payload.uuid,s(),e(r.payload.resolve))}))})),a=new Promise(((e,t)=>{setTimeout((()=>{s&&s(),t(new Error("Request failed by timeout"))}),5e3)}));return Promise.race([i,a])}}O=new WeakMap,C=new WeakMap;class Y{constructor(e,t){N.set(this,void 0),R.set(this,void 0),o(this,N,e,"f"),o(this,R,t,"f")}async getNodesStatus(){const e=c.GET_STATUS,[t]=await n(this,N,"f").send([{method:e,params:[]}]);return t}async getAddresses(...e){const t=c.GET_ADDRESSES,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getBlocks(...e){const t=c.GET_BLOCKS,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getGraphInterval(e,t){const r=c.GET_GRAPH_INTERVAL,[o]=await n(this,N,"f").send([{method:r,params:[{start:e,end:t}]}]);return o}async getOperations(...e){const t=c.GET_OPERATIONS,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getStakers(){const e=c.GET_STAKERS,[t]=await n(this,N,"f").send([{method:e,params:[]}]);return t}async getEndorsements(...e){const t=c.GET_ENDORSEMENTS,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getCliques(){const e=c.GET_CLIQUES,[t]=await n(this,N,"f").send([{method:e,params:[]}]);return t}async payment(e,t){const r=new i(a.Payment,e,t);return n(this,R,"f").signTransaction(r)}async buyRolls(e="1"){const t=new i(a.RollBuy,e);return n(this,R,"f").signTransaction(t)}async sellRolls(e="1"){const t=new i(a.RollSell,e);return n(this,R,"f").signTransaction(t)}}function z(e,t){if(!e)throw new Error(t)}function X(){let e=globalThis.document.querySelector("link[rel*='icon']");if(!e)throw new Error("website favicon is required");return e.href}N=new WeakMap,R=new WeakMap;class Q{constructor(e){x.set(this,void 0),o(this,x,e,"f")}subscribe(e){if(!e)throw new Error("Missing callback arg. use subscribe(cb => /do something/)");this.base58&&e(this.base58);const t=n(this,x,"f").on((t=>{switch(t.type){case y.DISCONNECT_APP_RESULT:this.base58=void 0;break;case y.ACCOUNT_CHANGED:case y.RESPONSE_CONNECT_APP:case y.GET_DATA:this.base58=t.payload.base58;break;default:return}e(this.base58)}));return{unsubscribe:()=>t()}}}x=new WeakMap;class Z{constructor(e){I.set(this,void 0),o(this,I,e,"f")}subscribe(e){e(this.net);const t=n(this,I,"f").on((t=>{switch(t.type){case y.RESPONSE_CONNECT_APP:case y.GET_DATA:case y.NETWORK_CHANGED:this.net=t.payload.net;break;default:return}e(this.net)}));return{unsubscribe:()=>t()}}}I=new WeakMap;class ee{constructor(e){B.set(this,void 0),this.period=-1,o(this,B,e,"f")}subscribe(e){const t=n(this,B,"f").on((t=>{switch(t.type){case y.NEW_SLOT:this.period=t.payload,e(this.period);break;case y.GET_DATA:case y.NETWORK_CHANGED:this.period=t.payload.period,e(this.period)}}));return{unsubscribe:()=>t()}}}B=new WeakMap;class te{get account(){return n(this,j,"f")}get network(){return n(this,U,"f")}get blockchain(){return n(this,M,"f")}get connected(){return n(this,k,"f")}get enabled(){return n(this,$,"f")}constructor(e,t){P.add(this),j.set(this,void 0),U.set(this,void 0),M.set(this,void 0),L.set(this,void 0),D.set(this,void 0),k.set(this,!1),$.set(this,!1),o(this,L,e,"f"),o(this,D,t,"f"),o(this,j,new Q(t),"f"),o(this,U,new Z(t),"f"),o(this,M,new ee(t),"f"),n(this,P,"m",G).call(this)}async diconnect(){const e=y.DISCONNECT_APP,t=m.CONTENT,r=window.document.title,s=X(),i=J();return new H({type:e,payload:{title:r,icon:s,uuid:i}}).send(n(this,L,"f"),t),new Promise(((e,t)=>{const r=n(this,D,"f").on((s=>{if(s.type===y.DISCONNECT_APP_RESULT&&s.payload.uuid===i)return s.payload.reject?(r(),t(new Error(s.payload.reject))):(o(this,k,!1,"f"),n(this,j,"f").base58=void 0,n(this,U,"f").net=s.payload.net,r(),e(this.connected))}))}))}async isMassaAddress(e){const t=y.CHECK_MASSA_ADDRESS,r=m.CONTENT,o=J();return new H({type:t,payload:{uuid:o,addr:e}}).send(n(this,L,"f"),r),new Promise((e=>{const t=n(this,D,"f").on((r=>{if(r.type===y.CHECK_MASSA_ADDRESS_RES&&r.payload.uuid===o)return t(),e(r.payload.resolve)}))}))}async connect(){const e=y.CONNECT_APP,t=m.CONTENT,r=J(),s=window.document.title,i=X();return new H({type:e,payload:{title:s,icon:i,uuid:r}}).send(n(this,L,"f"),t),new Promise(((e,t)=>{const s=n(this,D,"f").on((i=>{if(i.type===y.RESPONSE_CONNECT_APP&&i.payload.uuid===r)return i.payload.reject?(s(),t(new Error(i.payload.reject))):(o(this,k,Boolean(i.payload.resolve),"f"),n(this,j,"f").base58=i.payload.base58,n(this,U,"f").net=i.payload.net,s(),e(this.connected))}))}))}async signMessage(e){z(this.connected,s);const t=y.SIGN_MESSAGE,r=m.CONTENT,o=J(),i=window.document.title,a=X();return new H({type:t,payload:{message:e,uuid:o,title:i,icon:a}}).send(n(this,L,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===y.SING_MESSAGE_RESULT&&n.payload.uuid===o)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}async signTransaction(e){z(this.connected,s),z(e instanceof i,"Invalid sign params");const t=y.TX_TO_SEND,r=m.CONTENT,o=J(),a={...e.payload,uuid:o,title:window.document.title,icon:X()};return new H({type:t,payload:a}).send(n(this,L,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===y.TX_TO_SEND_RESULT&&n.payload.uuid===o)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}}j=new WeakMap,U=new WeakMap,M=new WeakMap,L=new WeakMap,D=new WeakMap,k=new WeakMap,$=new WeakMap,P=new WeakSet,G=function(){globalThis.window&&n(this,D,"f").on((e=>{switch(e.type){case y.NEW_SLOT:n(this,M,"f").period=e.payload;break;case y.LOCKED:o(this,$,e.payload.enabled,"f");break;case y.ACCOUNT_CHANGED:n(this,j,"f").base58=e.payload.base58;break;case y.GET_DATA:n(this,M,"f").period=e.payload.period,n(this,j,"f").base58=e.payload.base58,o(this,$,e.payload.enabled,"f"),o(this,k,e.payload.connected,"f"),n(this,U,"f").net=e.payload.net;break;case y.NETWORK_CHANGED:n(this,U,"f").net=e.payload.net,n(this,M,"f").period=e.payload.period}}))};class re{constructor(){if(q.set(this,new K),W.set(this,new V(n(this,q,"f").stream,n(this,q,"f").subject)),this.wallet=new te(n(this,q,"f").stream,n(this,q,"f").subject),this.contract=new h(n(this,W,"f"),this.wallet),this.massa=new Y(n(this,W,"f"),this.wallet),globalThis.window){if(globalThis.window.bearby)throw new Error("bearby Web3 instance already created!");try{n(this,q,"f").initialized(),globalThis.window.bearby=Object.freeze(this)}catch{console.debug("bearby-web3 available only browser")}}}}q=new WeakMap,W=new WeakMap;const ne=globalThis.window&&globalThis.window.bearby?globalThis.window.bearby:new re}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r("./src/index.ts");window.massaWallet=n})();
2
+ (()=>{var e={"./node_modules/axios/index.js":(e,t,r)=>{e.exports=r("./node_modules/axios/lib/axios.js")},"./node_modules/axios/lib/adapters/xhr.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/core/settle.js"),s=r("./node_modules/axios/lib/helpers/cookies.js"),i=r("./node_modules/axios/lib/helpers/buildURL.js"),a=r("./node_modules/axios/lib/core/buildFullPath.js"),c=r("./node_modules/axios/lib/helpers/parseHeaders.js"),u=r("./node_modules/axios/lib/helpers/isURLSameOrigin.js"),l=r("./node_modules/axios/lib/core/createError.js"),d=r("./node_modules/axios/lib/defaults/transitional.js"),f=r("./node_modules/axios/lib/cancel/Cancel.js");e.exports=function(e){return new Promise((function(t,r){var h,p=e.data,m=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}n.isFormData(p)&&delete m["Content-Type"];var _=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(E+":"+b)}var w=a(e.baseURL,e.url);function S(){if(_){var n="getAllResponseHeaders"in _?c(_.getAllResponseHeaders()):null,s={data:y&&"text"!==y&&"json"!==y?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:n,config:e,request:_};o((function(e){t(e),g()}),(function(e){r(e),g()}),s),_=null}}if(_.open(e.method.toUpperCase(),i(w,e.params,e.paramsSerializer),!0),_.timeout=e.timeout,"onloadend"in _?_.onloadend=S:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(S)},_.onabort=function(){_&&(r(l("Request aborted",e,"ECONNABORTED",_)),_=null)},_.onerror=function(){r(l("Network Error",e,null,_)),_=null},_.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||d;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",_)),_=null},n.isStandardBrowserEnv()){var A=(e.withCredentials||u(w))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;A&&(m[e.xsrfHeaderName]=A)}"setRequestHeader"in _&&n.forEach(m,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete m[t]:_.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(_.withCredentials=!!e.withCredentials),y&&"json"!==y&&(_.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&_.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){_&&(r(!e||e&&e.type?new f("canceled"):e),_.abort(),_=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),_.send(p)}))}},"./node_modules/axios/lib/axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/helpers/bind.js"),s=r("./node_modules/axios/lib/core/Axios.js"),i=r("./node_modules/axios/lib/core/mergeConfig.js"),a=function e(t){var r=new s(t),a=o(s.prototype.request,r);return n.extend(a,s.prototype,r),n.extend(a,r),a.create=function(r){return e(i(t,r))},a}(r("./node_modules/axios/lib/defaults/index.js"));a.Axios=s,a.Cancel=r("./node_modules/axios/lib/cancel/Cancel.js"),a.CancelToken=r("./node_modules/axios/lib/cancel/CancelToken.js"),a.isCancel=r("./node_modules/axios/lib/cancel/isCancel.js"),a.VERSION=r("./node_modules/axios/lib/env/data.js").version,a.all=function(e){return Promise.all(e)},a.spread=r("./node_modules/axios/lib/helpers/spread.js"),a.isAxiosError=r("./node_modules/axios/lib/helpers/isAxiosError.js"),e.exports=a,e.exports.default=a},"./node_modules/axios/lib/cancel/Cancel.js":e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},"./node_modules/axios/lib/cancel/CancelToken.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/cancel/Cancel.js");function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},o.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},"./node_modules/axios/lib/cancel/isCancel.js":e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},"./node_modules/axios/lib/core/Axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/helpers/buildURL.js"),s=r("./node_modules/axios/lib/core/InterceptorManager.js"),i=r("./node_modules/axios/lib/core/dispatchRequest.js"),a=r("./node_modules/axios/lib/core/mergeConfig.js"),c=r("./node_modules/axios/lib/helpers/validator.js"),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new s,response:new s}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var s,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!o){var d=[i,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(l),s=Promise.resolve(t);d.length;)s=s.then(d.shift(),d.shift());return s}for(var f=t;n.length;){var h=n.shift(),p=n.shift();try{f=h(f)}catch(e){p(e);break}}try{s=i(f)}catch(e){return Promise.reject(e)}for(;l.length;)s=s.then(l.shift(),l.shift());return s},l.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},"./node_modules/axios/lib/core/InterceptorManager.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},"./node_modules/axios/lib/core/buildFullPath.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/isAbsoluteURL.js"),o=r("./node_modules/axios/lib/helpers/combineURLs.js");e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},"./node_modules/axios/lib/core/createError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/enhanceError.js");e.exports=function(e,t,r,o,s){var i=new Error(e);return n(i,t,r,o,s)}},"./node_modules/axios/lib/core/dispatchRequest.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/core/transformData.js"),s=r("./node_modules/axios/lib/cancel/isCancel.js"),i=r("./node_modules/axios/lib/defaults/index.js"),a=r("./node_modules/axios/lib/cancel/Cancel.js");function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(c(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},"./node_modules/axios/lib/core/enhanceError.js":e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.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}},e}},"./node_modules/axios/lib/core/mergeConfig.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){t=t||{};var r={};function o(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function s(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:o(void 0,e[r]):o(e[r],t[r])}function i(e){if(!n.isUndefined(t[e]))return o(void 0,t[e])}function a(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:o(void 0,e[r]):o(void 0,t[r])}function c(r){return r in t?o(e[r],t[r]):r in e?o(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||s,o=t(e);n.isUndefined(o)&&t!==c||(r[e]=o)})),r}},"./node_modules/axios/lib/core/settle.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/createError.js");e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},"./node_modules/axios/lib/core/transformData.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/defaults/index.js");e.exports=function(e,t,r){var s=this||o;return n.forEach(r,(function(r){e=r.call(s,e,t)})),e}},"./node_modules/axios/lib/defaults/index.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=r("./node_modules/axios/lib/helpers/normalizeHeaderName.js"),s=r("./node_modules/axios/lib/core/enhanceError.js"),i=r("./node_modules/axios/lib/defaults/transitional.js"),a={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,l={transitional:i,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r("./node_modules/axios/lib/adapters/xhr.js")),u),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(c(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||l.transitional,r=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||o&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw s(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){l.headers[e]=n.merge(a)})),e.exports=l},"./node_modules/axios/lib/defaults/transitional.js":e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},"./node_modules/axios/lib/env/data.js":e=>{e.exports={version:"0.26.1"}},"./node_modules/axios/lib/helpers/bind.js":e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},"./node_modules/axios/lib/helpers/buildURL.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(n.isURLSearchParams(t))s=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(o(t)+"="+o(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},"./node_modules/axios/lib/helpers/combineURLs.js":e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},"./node_modules/axios/lib/helpers/cookies.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},"./node_modules/axios/lib/helpers/isAbsoluteURL.js":e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},"./node_modules/axios/lib/helpers/isAxiosError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},"./node_modules/axios/lib/helpers/isURLSameOrigin.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},"./node_modules/axios/lib/helpers/normalizeHeaderName.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},"./node_modules/axios/lib/helpers/parseHeaders.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),o=["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"];e.exports=function(e){var t,r,s,i={};return e?(n.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=n.trim(e.substr(0,s)).toLowerCase(),r=n.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},"./node_modules/axios/lib/helpers/spread.js":e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},"./node_modules/axios/lib/helpers/validator.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/env/data.js").version,o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var s={};o.transitional=function(e,t,r){function o(e,t){return"[Axios v"+n+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,i){if(!1===e)throw new Error(o(n," has been removed"+(t?" in "+t:"")));return t&&!s[n]&&(s[n]=!0,console.warn(o(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var s=n[o],i=t[s];if(i){var a=e[s],c=void 0===a||i(a,s,e);if(!0!==c)throw new TypeError("option "+s+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:o}},"./node_modules/axios/lib/utils.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/bind.js"),o=Object.prototype.toString;function s(e){return Array.isArray(e)}function i(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===o.call(e)}function c(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:s,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===o.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:l,isStream:function(e){return c(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===o.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:d,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):s(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)d(arguments[n],r);return t},extend:function(e,t,r){return d(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},"./node_modules/base64-js/index.js":(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,s=a(e),i=s[0],c=s[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,i,c)),l=0,d=c>0?i-4:i;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,s=[],i=16383,a=0,u=n-o;a<u;a+=i)s.push(c(e,a,a+i>u?u:a+i));return 1===o?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=s[i],n[s.charCodeAt(i)]=i;function a(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 c(e,t,n){for(var o,s,i=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[(s=o)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},"./node_modules/buffer/index.js":(e,t,r)=>{"use strict";const n=r("./node_modules/base64-js/index.js"),o=r("./node_modules/ieee754/index.js"),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(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 d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|m(e,t);let n=a(r);const o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(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(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(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 c.from(n,t,r);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||z(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.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 l(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 d(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),r=a(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,c.prototype),n}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(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 K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(o)return n?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function y(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 x(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function _(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=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(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):E(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,o){let s,i=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;i=2,a/=2,c/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){let n=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===c)return n*i}else-1!==n&&(s-=s-n),n=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;n<c;n++)if(u(e,s+n)!==u(t,n)){r=!1;break}if(r)return s}return-1}function b(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const s=t.length;let i;for(n>s/2&&(n=s/2),i=0;i<n;++i){const n=parseInt(t.substr(2*i,2),16);if(z(n))return i;e[r+i]=n}return i}function w(e,t,r,n){return V(K(t,e.length-r),e,r,n)}function S(e,t,r,n){return V(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 V(J(t),e,r,n)}function v(e,t,r,n){return V(function(e,t){let r,n,o;const s=[];for(let i=0;i<e.length&&!((t-=2)<0);++i)r=e.charCodeAt(i),n=r>>8,o=r%256,s.push(o),s.push(n);return s}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let s=null,i=t>239?4:t>223?3:t>191?2:1;if(o+i<=r){let r,n,a,c;switch(i){case 1:t<128&&(s=t);break;case 2:r=e[o+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(s=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)&&(s=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&&(s=c))}}null===s?(s=65533,i=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=i}return function(e){const t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=C));return r}(n)}t.kMaxLength=i,c.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}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.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,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))o+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},c.byteLength=m,c.prototype._isBuffer=!0,c.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)g(this,t,t+1);return this},c.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)g(this,t,t+3),g(this,t+1,t+2);return this},c.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)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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 s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0);const a=Math.min(s,i),u=this.slice(n,o),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){s=u[e],i=l[e];break}return s<i?-1:i<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},c.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 s=!1;for(;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return S(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function N(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 R(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 x(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+=X[e[n]];return o}function I(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 B(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 P(e,t,r,n,o,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function j(e,t,r,n,o){q(t,n,o,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,r}function U(e,t,r,n,o){q(t,n,o,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=i,i>>=8,e[r+2]=i,i>>=8,e[r+1]=i,i>>=8,e[r]=i,r+8}function M(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,s){return t=+t,r>>>=0,s||M(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,s){return t=+t,r>>>=0,s||M(e,0,r,8),o.write(e,t,r,n,52,8),r+8}c.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,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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))})),c.prototype.readBigUInt64BE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=t,o=1,s=this[e+--n];for(;n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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)})),c.prototype.readBigInt64BE=Q((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||F(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)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);let o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);let o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}let o=0,s=1,i=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/s>>0)-i&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}let o=r-1,s=1,i=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s>>0)-i&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(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},c.prototype.writeBigInt64LE=Q((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.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},c.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&&!c.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 s=c.isBuffer(e)?e:c.from(e,n),i=s.length;if(0===i)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%i]}return this};const k={};function $(e,t,r){k[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 G(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 q(e,t,r,n,o,s){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=s>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new k.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||F(t,e.length-(r+1))}(n,o,s)}function W(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,r){if(Math.floor(e)!==e)throw W(e,r),new k.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),$("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=G(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=G(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function K(e,t){let r;t=t||1/0;const n=e.length;let o=null;const s=[];for(let i=0;i<n;++i){if(r=e.charCodeAt(i),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&s.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function J(e){return n.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 V(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 Y(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 X=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?Z:e}function Z(){throw new Error("BigInt not supported")}},"./node_modules/events/events.js":e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,s),n(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}m(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var o,s,i,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),i=s[t]),void 0===i)i=s[t]=r,++e._eventsCount;else if("function"==typeof i?i=s[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):p(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(s){n.once&&e.removeEventListener(t,o),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,s=this._events;if(void 0!==s)o=o&&void 0===s.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,o,s,i;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(o=s[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/ieee754/index.js":(e,t)=>{t.read=function(e,t,r,n,o){var s,i,a=8*o-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?o-1:0,f=r?-1:1,h=e[t+d];for(d+=f,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=f,l-=8);for(i=s&(1<<-l)-1,s>>=-l,l+=n;l>0;i=256*i+e[t+d],d+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return i?NaN:1/0*(h?-1:1);i+=Math.pow(2,n),s-=u}return(h?-1:1)*i*Math.pow(2,s-n)},t.write=function(e,t,r,n,o,s){var i,a,c,u=8*s-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),(t+=i+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(i++,c/=2),i+d>=l?(a=0,i=l):i+d>=1?(a=(t*c-1)*Math.pow(2,o),i+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),i=0));o>=8;e[r+h]=255&a,h+=p,a/=256,o-=8);for(i=i<<o|a,u+=o;u>0;e[r+h]=255&i,h+=p,i/=256,u-=8);e[r+h-p]|=128*m}},"./src/account/Account.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const n=r("./src/connector/Connector.ts"),o=r("./src/index.ts");t.Account=class{constructor({address:e,name:t},r){this._address=e,this._name=t??"",this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountBalance,{address:this._address},((r,n)=>n?t(n):e(r)))}))}async sign(e){return new Promise(((t,r)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountSign,{address:this._address,data:e},((e,n)=>n?r(n):t(e)))}))}async buyRolls(e,t){return new Promise(((r,s)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountBuyRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?s(t):r(e)))}))}async sellRolls(e,t){return new Promise(((r,s)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountSellRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?s(t):r(e)))}))}async sendTransaction(e,t,r){return new Promise(((s,i)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountSendTransaction,{amount:e.toString(),recipientAddress:t,fee:r.toString()},((e,t)=>t?i(t):s(e)))}))}async callSC(e,t,r,s,i,a,c=!1){return new Promise(((u,l)=>{n.connector.sendMessageToContentScript(this._providerName,o.AvailableCommands.AccountCallSC,{nickname:this._name,name:t,at:e,args:r,coins:s,fee:i,maxGas:a,nonPersistentExecution:c},((e,t)=>t?l(t):u(e)))}))}}},"./src/account/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;var n=r("./src/account/Account.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return n.Account}})},"./src/bearbyWallet/BearbyAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BearbyAccount=t.OperationTypeId=t.OperationsType=t.PUBLIC_NODE_RPC=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),o=r("./src/massaStation/RequestHandler.ts"),s=r("./src/bearbyWallet/jsonRpcMethods.ts"),i=r("./node_modules/axios/index.js"),a=BigInt(4294967295);var c,u;t.PUBLIC_NODE_RPC="https://buildnet.massa.net/api/v2",function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(c=t.OperationsType||(t.OperationsType={})),(u=t.OperationTypeId||(t.OperationTypeId={}))[u.Transaction=0]="Transaction",u[u.RollBuy=1]="RollBuy",u[u.RollSell=2]="RollSell",u[u.ExecuteSC=3]="ExecuteSC",u[u.CallSC=4]="CallSC";const l={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Content-Type":"application/json"};t.BearbyAccount=class{constructor({address:e,name:r},n){this._nodeUrl=t.PUBLIC_NODE_RPC,this._address=e,this._name=r??"Bearby_account",this._providerName=n}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async connect(){try{await n.web3.wallet.connect()}catch(e){console.log("Bearby connection error: ",e)}}async balance(){await this.connect();const e={jsonrpc:"2.0",method:"get_addresses",params:[[this._address]],id:0},r=await(0,o.postRequest)(t.PUBLIC_NODE_RPC,e);if(r.isError||r.error)throw r.error.message;return{finalBalance:r.result.result[0].final_balance,candidateBalance:r.result.result[0].candidate_balance}}async sign(e){await this.connect();const t=new TextEncoder;let r;e instanceof Uint8Array&&(r=(new TextDecoder).decode(e)),e instanceof Buffer&&(r=e.toString());const o=await n.web3.wallet.signMessage(r);return{publicKey:o.publicKey,signature:t.encode(o.signature)}}async buyRolls(e,t){return await this.connect(),{operationId:await n.web3.wallet.signTransaction({type:c.RollBuy,amount:e.toString(),fee:t.toString(),payload:""})}}async sellRolls(e,t){return await this.connect(),{operationId:await n.web3.wallet.signTransaction({type:c.RollSell,amount:e.toString(),fee:t.toString(),payload:""})}}async sendTransaction(e,t,r){return await this.connect(),{operationId:await n.web3.wallet.signTransaction({type:c.Payment,amount:e.toString(),recipient:t,fee:r.toString(),payload:""})}}async callSC(e,t,r,o,s,i,a=!1){if(await this.connect(),a)return this.nonPersistentCallSC(e,t,r,o,s,i);if(r instanceof Uint8Array)throw new Error("Bearby wallet does not support Uint8Array as parameter. Please use Args instead");let c=[];try{c=r.getArgsList().map((e=>({type:e.type,value:e.value})))}catch(e){throw new Error("\n Bearby wallet does not support Uint8Array, serializable, and serializableObjectArray. \n To use them switch to MassaStation")}return{operationId:await n.web3.contract.call({maxGas:Number(i),coins:Number(o),fee:Number(s),targetAddress:e,functionName:t,parameters:c})}}async getNodeStatus(){const e=s.JSON_RPC_REQUEST_METHOD.GET_STATUS;return await this.sendJsonRPCRequest(e,[])}async sendJsonRPCRequest(e,t){let r=null;if(r=await this.promisifyJsonRpcCall(e,t),r.isError||r.error)throw r.error;return r.result}async promisifyJsonRpcCall(e,t){let r=null;const n={jsonrpc:"2.0",method:e,params:t,id:0};try{r=await i.default.post(this._nodeUrl,n,{headers:l})}catch(e){return{isError:!0,result:null,error:new Error("JSON.parse error: "+String(e))}}const o=r.data;return o.error?{isError:!0,result:null,error:new Error(o.error.message)}:{isError:!1,result:o.result,error:null}}async nonPersistentCallSC(e,r,n,s,i,c){const u=t.PUBLIC_NODE_RPC;if(c>a)throw new Error(`\n The gas submitted ${c.toString()} exceeds the max. allowed block gas of \n ${a.toString()}\n `);let l=[];l=n instanceof Uint8Array?Array.from(n):Array.from(n.serialize());const d=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(c),target_address:e,target_function:r,parameter:l,caller_address:this._address,coins:Number(s),fee:Number(i)}]],id:0}];let f=[];try{let e=await(0,o.postRequest)(u,d);if(e.isError||e.error)throw e.error.message;f=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(f.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(f[0].result.Error)throw new Error(f[0].result.Error);return{returnValue:new Uint8Array(f[0].result[0].result.Ok),info:f[0]}}}},"./src/bearbyWallet/BearbyConnect.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectBearby=t.connectBearby=t.detectBearby=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js");t.detectBearby=async function(){return!(!globalThis.window||!globalThis.window.bearby)},t.connectBearby=async function(){try{await n.web3.wallet.connect()}catch(e){console.log(e)}},t.disconnectBearby=async function(){await n.web3.wallet.diconnect(),console.log("Bearby disconnected")}},"./src/bearbyWallet/BearbyProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BearbyProvider=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),o=r("./src/bearbyWallet/BearbyAccount.ts");t.BearbyProvider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){n.web3.wallet.connected||await n.web3.wallet.connect();const e={address:await n.web3.wallet.account.base58,name:"BEARBY"};return[new o.BearbyAccount(e,this.providerName)]}async importAccount(e,t){throw new Error("Method not implemented.")}async deleteAccount(e){throw new Error("Method not implemented.")}async getNodesUrls(){return["https://buildnet.massa.net/api/v2"]}async generateNewAccount(e){throw new Error("Method not implemented.")}}},"./src/bearbyWallet/jsonRpcMethods.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.JSON_RPC_REQUEST_METHOD=void 0,(r=t.JSON_RPC_REQUEST_METHOD||(t.JSON_RPC_REQUEST_METHOD={})).GET_STATUS="get_status",r.GET_ADDRESSES="get_addresses",r.SEND_OPERATIONS="send_operations",r.GET_BLOCKS="get_blocks",r.GET_ENDORSEMENTS="get_endorsements",r.GET_OPERATIONS="get_operations",r.GET_CLIQUES="get_cliques",r.GET_STAKERS="get_stakers",r.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",r.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",r.EXECUTE_READ_ONLY_CALL="execute_read_only_call",r.GET_DATASTORE_ENTRIES="get_datastore_entries",r.GET_BLOCKCLIQUE_BLOCK_BY_SLOT="get_blockclique_block_by_slot",r.GET_GRAPH_INTERVAL="get_graph_interval",r.STOP_NODE="stop_node",r.NODE_BAN_BY_IP="node_ban_by_ip",r.NODE_BAN_BY_ID="node_ban_by_id",r.NODE_UNBAN_BY_IP="node_unban_by_ip",r.NODE_UNBAN_BY_ID="node_unban_by_id",r.GET_STAKING_ADDRESSES="get_staking_addresses",r.REMOVE_STAKING_ADDRESSES="remove_staking_addresses",r.ADD_STAKING_PRIVATE_KEYS="add_staking_private_keys",r.NODE_SIGN_MESSAGE="node_sign_message",r.NODE_REMOVE_FROM_WHITELIST="node_remove_from_whitelist",r.NODE_ADD_TO_PEERS_WHITELIST="node_add_to_peers_whitelist"},"./src/connector/Connector.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connector=t.MASSA_WINDOW_OBJECT=void 0;const n=r("./node_modules/uid/dist/index.js"),o=r("./src/index.ts"),s=r("./src/massaStation/MassaStationDiscovery.ts"),i=r("./src/massaStation/MassaStationProvider.ts");t.MASSA_WINDOW_OBJECT="massaWalletProvider",t.connector=new class{constructor(){this.registeredProviders={},"undefined"!=typeof document&&(this.pendingRequests=new Map,this.massaStationListener=new s.MassaStationDiscovery,this.initMassaStationListener(),this.register(),document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("message",this.handleResponseFromContentScript.bind(this)))}register(){if("undefined"!=typeof document){if(!document.getElementById(t.MASSA_WINDOW_OBJECT)){const e=document.createElement("p");e.id=t.MASSA_WINDOW_OBJECT,e.setAttribute("style","display:none"),document.body.appendChild(e)}document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("register",(e=>{const r=e.detail,n=`${t.MASSA_WINDOW_OBJECT}_${r.providerName}`;this.registeredProviders[r.providerName]=n}))}}initMassaStationListener(){this.massaStationListener.on(s.ON_MASSA_STATION_DISCOVERED,(()=>{this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]=`${t.MASSA_WINDOW_OBJECT}_${i.MASSA_STATION_PROVIDER_NAME}`})),this.massaStationListener.on(s.ON_MASSA_STATION_DISCONNECTED,(()=>{delete this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]}))}async startMassaStationDiscovery(){try{await this.massaStationListener.startListening()}catch(e){console.log("MassaStation is not detected")}}sendMessageToContentScript(e,t,r,s){if(!Object.values(o.AvailableCommands).includes(t))throw new Error(`Unknown command ${t}`);const i=(0,n.uid)(),a={params:r,requestId:i};this.pendingRequests.set(i,s);const c=document?.getElementById(`${this.registeredProviders[e]}`);if(!c)throw new Error(`Registered provider with name ${e} does not exist`);if(!c.dispatchEvent(new CustomEvent(t,{detail:a})))throw new Error(`Could not dispatch a message to ${this.registeredProviders[e]}`)}getWalletProviders(){return this.registeredProviders}handleResponseFromContentScript(e){const{result:t,error:r,requestId:n}=e.detail,o=this.pendingRequests.get(n);o?(r?o(null,new Error(r.message)):o(t,null),this.pendingRequests.delete(n)||console.error(`Error deleting a pending request with id ${n}`)):console.error(`Request Id ${n} not found in response callback map`)}}},"./src/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectBearby=t.connectBearby=t.MassaStationAccount=t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=t.Account=t.registerProvider=t.providers=t.AvailableCommands=void 0;const n=r("./node_modules/buffer/index.js");"undefined"!=typeof window&&(window.Buffer=n.Buffer);const o=r("./src/connector/Connector.ts"),s=r("./src/provider/Provider.ts"),i=r("./src/massaStation/MassaStationProvider.ts"),a=r("./src/bearbyWallet/BearbyConnect.ts"),c=r("./src/bearbyWallet/BearbyProvider.ts"),u=r("./src/utils/time.ts");var l;(l=t.AvailableCommands||(t.AvailableCommands={})).ProviderListAccounts="LIST_ACCOUNTS",l.ProviderDeleteAccount="DELETE_ACCOUNT",l.ProviderImportAccount="IMPORT_ACCOUNT",l.ProviderGetNodesUrls="GET_NODES_URLS",l.AccountBalance="ACCOUNT_BALANCE",l.AccountSign="ACCOUNT_SIGN",l.ProviderGenerateNewAccount="GENERATE_NEW_ACCOUNT",l.AccountSellRolls="ACCOUNT_SELL_ROLLS",l.AccountBuyRolls="ACCOUNT_BUY_ROLLS",l.AccountSendTransaction="ACCOUNT_SEND_TRANSACTION",l.AccountCallSC="ACCOUNT_CALL_SC",t.providers=async function(e=!0,t=3e3,r=500){const n=Date.now();let l;for(await o.connector.startMassaStationDiscovery(),await(0,a.detectBearby)()&&(l=new c.BearbyProvider("BEARBY"));Date.now()-n<t;){const t=Object.keys(o.connector.getWalletProviders()).map((e=>e===i.MASSA_STATION_PROVIDER_NAME?new i.MassaStationProvider:new s.Provider(e)));if(l&&t.push(l),!e||t.length>0)return t;await(0,u.wait)(r)}return[]},t.registerProvider=function(e,t=o.MASSA_WINDOW_OBJECT){if("undefined"!=typeof document){const r=new CustomEvent("register",{detail:{providerName:e}}),n=document?.getElementById(t);n&&n.dispatchEvent(r)}};var d=r("./src/account/index.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return d.Account}});var f=r("./src/provider/index.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return f.EAccountDeletionResponse}}),Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return f.EAccountImportResponse}}),Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return f.Provider}});var h=r("./src/massaStation/MassaStationAccount.ts");Object.defineProperty(t,"MassaStationAccount",{enumerable:!0,get:function(){return h.MassaStationAccount}});var p=r("./src/bearbyWallet/BearbyConnect.ts");Object.defineProperty(t,"connectBearby",{enumerable:!0,get:function(){return p.connectBearby}}),Object.defineProperty(t,"disconnectBearby",{enumerable:!0,get:function(){return p.disconnectBearby}})},"./src/massaStation/MassaStationAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationAccount=void 0;const n=r("./src/massaStation/RequestHandler.ts"),o=r("./src/massaStation/MassaStationProvider.ts"),s=r("./src/utils/argsToBase64.ts"),i=BigInt(4294967295);t.MassaStationAccount=class{constructor({address:e,name:t},r){this._address=e,this._name=t,this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){let e=null;try{e=await(0,n.getRequest)(`${o.MASSA_STATION_URL}massa/addresses?attributes=balance&addresses=${this._address}`)}catch(e){throw console.error("MassaStation account balance error"),e}if(e.isError||e.error)throw e.error;const t=e.result.addressesAttributes[this._address].balance;return{finalBalance:t.final,candidateBalance:t.pending}}async sign(e){let t=null;try{t=await(0,n.postRequest)(`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/sign`,{operation:Buffer.from(e).toString("base64"),batch:!1})}catch(e){throw console.error("MassaStation account signing error"),e}if(t.isError||t.error)throw t.error;const r=new Uint8Array(Buffer.from(t.result.signature));return{publicKey:t.result.publicKey,signature:r}}async buyRolls(e,t){let r=null;const s=`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"buy"};try{r=await(0,n.postRequest)(s,i)}catch(e){throw console.error(`MassaStation account: error while buying rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sellRolls(e,t){let r=null;const s=`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"sell"};try{r=await(0,n.postRequest)(s,i)}catch(e){throw console.error(`MassaStation account: error while selling rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sendTransaction(e,t,r){let s=null;const i=`${o.MASSA_STATION_ACCOUNTS_URL}/${this._name}/transfer`,a={fee:r.toString(),amount:e.toString(),recipientAddress:t};try{s=await(0,n.postRequest)(i,a)}catch(e){throw console.error(`MassaStation account: error while sending transaction: ${e}`),e}if(s.isError||s.error)throw s.error;return s.result}async callSC(e,t,r,i,a,c,u=!1){if(u)return this.nonPersistentCallSC(e,t,r,i,a,c);let l="";l=r instanceof Uint8Array?(0,s.uint8ArrayToBase64)(r):(0,s.argsToBase64)(r);let d=null;const f=`${o.MASSA_STATION_URL}cmd/executeFunction`,h={nickname:this._name,name:t,at:e,args:l,coins:Number(i)};try{d=await(0,n.postRequest)(f,h)}catch(e){throw console.log(`MassaStation account: error while interacting with smart contract: ${e}`),e}if(d.isError||d.error)throw d.error;return d.result}async getNodeUrlFromMassaStation(){let e=null,t="";try{if(e=await(0,n.getRequest)(`${o.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;t=e.result.url}catch(e){throw new Error(`MassaStation nodes retrieval error: ${e}`)}return t}async nonPersistentCallSC(e,t,r,o,s,a){const c=await this.getNodeUrlFromMassaStation();if(a>i)throw new Error(`\n The gas submitted ${a.toString()} exceeds the max. allowed block gas of \n ${i.toString()}\n `);let u=[];u=r instanceof Uint8Array?Array.from(r):Array.from(r.serialize());const l=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(a),target_address:e,target_function:t,parameter:u,caller_address:this._address}]],id:0}];let d=[];try{let e=await(0,n.postRequest)(c,l);if(e.isError||e.error)throw e.error.message;d=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(d.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(d[0].result.Error)throw new Error(d[0].result.Error);return{returnValue:new Uint8Array(d[0].result[0].result.Ok),info:d[0]}}}},"./src/massaStation/MassaStationDiscovery.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationDiscovery=t.ON_MASSA_STATION_DISCONNECTED=t.ON_MASSA_STATION_DISCOVERED=t.MASSA_STATION_DISCOVERY_URL=void 0;const n=r("./node_modules/events/events.js"),o=r("./src/massaStation/RequestHandler.ts");t.MASSA_STATION_DISCOVERY_URL="https://station.massa/web/index",t.ON_MASSA_STATION_DISCOVERED="ON_MASSA_STATION_DISCOVERED",t.ON_MASSA_STATION_DISCONNECTED="ON_MASSA_STATION_DISCONNECTED";class s extends n.EventEmitter{constructor(){super(),this.isDiscovered=!1,this.startListening=this.startListening.bind(this)}async startListening(){let e=null;try{e=await(0,o.getRequest)(t.MASSA_STATION_DISCOVERY_URL,2e3)}catch(e){console.error(`Error calling ${t.MASSA_STATION_DISCOVERY_URL}`)}e.isError||e.error||(this.isDiscovered=!0,this.emit(t.ON_MASSA_STATION_DISCOVERED)),(e.isError||e.error)&&this.isDiscovered&&(this.isDiscovered=!1,this.emit(t.ON_MASSA_STATION_DISCONNECTED))}}t.MassaStationDiscovery=s},"./src/massaStation/MassaStationProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationProvider=t.MASSA_STATION_PROVIDER_NAME=t.MASSA_STATION_IMPORT_ACCOUNTS_URL=t.MASSA_STATION_ACCOUNTS_URL=t.MASSA_STATION_URL=void 0;const n=r("./src/provider/AccountDeletion.ts"),o=r("./src/provider/AccountImport.ts"),s=r("./src/massaStation/RequestHandler.ts"),i=r("./src/massaStation/MassaStationAccount.ts");t.MASSA_STATION_URL="https://station.massa/",t.MASSA_STATION_ACCOUNTS_URL=`${t.MASSA_STATION_URL}plugin/massa-labs/massa-wallet/api/accounts`,t.MASSA_STATION_IMPORT_ACCOUNTS_URL=`${t.MASSA_STATION_ACCOUNTS_URL}/import/`,t.MASSA_STATION_PROVIDER_NAME="MASSASTATION",t.MassaStationProvider=class{constructor(){this.providerName=t.MASSA_STATION_PROVIDER_NAME}name(){return this.providerName}async accounts(){let e=null;try{e=await(0,s.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.error("MassaStation accounts retrieval error"),e}if(e.isError||e.error)throw e.error.message;return e.result.map((e=>new i.MassaStationAccount({address:e.address,name:e.nickname},this.providerName)))}async importAccount(e,r){const n={publicKey:e,privateKey:r};let i=null;try{i=await(0,s.putRequest)(t.MASSA_STATION_ACCOUNTS_URL,n)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(i.isError||i.error)throw i.error.message;return{response:o.EAccountImportResponse.OK,message:"Account imported successfully"}}async deleteAccount(e){let r=null;try{r=await(0,s.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(r.isError||r.error)throw r.error.message;const o=r.result.find((t=>t.address.toLowerCase()===e.toLowerCase()));let i=null;try{i=await(0,s.deleteRequest)(`${t.MASSA_STATION_ACCOUNTS_URL}/${o.nickname}`)}catch(e){return console.log("MassaStation accounts deletion error",e),{response:n.EAccountDeletionResponse.ERROR}}return i.isError||i.error?(console.log("MassaStation accounts deletion error",i.error.message),{response:n.EAccountDeletionResponse.ERROR}):{response:n.EAccountDeletionResponse.OK}}async getNodesUrls(){let e=null;try{if(e=await(0,s.getRequest)(`${t.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;const r=e.result;return Array(r.url)}catch(e){throw console.error("MassaStation nodes retrieval error",e),e}}async generateNewAccount(e){let r=null;console.log(t.MASSA_STATION_ACCOUNTS_URL+"/"+e);try{if(r=await(0,s.postRequest)(t.MASSA_STATION_ACCOUNTS_URL+"/"+e,{}),r.isError||r.error)throw r.error.message;return{address:r.result.address,name:r.result.nickname}}catch(e){throw console.error(`Error while generating account: ${e}`),e}}}},"./src/massaStation/RequestHandler.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.putRequest=t.deleteRequest=t.postRequest=t.getRequest=void 0;const n=r("./node_modules/axios/index.js"),o={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Content-Type":"application/json"};t.getRequest=async function(e,t=null){let r=null;try{r=await n.default.get(e,{headers:o,timeout:t})}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:r.data,error:null}},t.postRequest=async function(e,t){try{return{isError:!1,result:(await n.default.post(e,t,{headers:o})).data,error:null}}catch(e){return{isError:!0,result:null,error:e.response?.data?.message?new Error(String(e.response.data.message)):new Error("Axios error: "+String(e))}}},t.deleteRequest=async function(e){let t=null;try{t=await n.default.delete(e,{headers:o})}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:t.data,error:null}},t.putRequest=async function(e,t){let r=null;try{r=await n.default.put(e,t,{headers:o})}catch(e){return{isError:!0,result:null,error:new Error("Axios error: "+String(e))}}return{isError:!1,result:r.data,error:null}}},"./src/provider/AccountDeletion.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountDeletionResponse=void 0,(r=t.EAccountDeletionResponse||(t.EAccountDeletionResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/AccountImport.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountImportResponse=void 0,(r=t.EAccountImportResponse||(t.EAccountImportResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/Provider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=void 0;const n=r("./src/connector/Connector.ts"),o=r("./src/account/Account.ts"),s=r("./src/index.ts");t.Provider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){const e=new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderListAccounts,{},((r,n)=>n?t(n):e(r)))})),t=await e;let r=[];for(const e of t){const t=new o.Account(e,this.providerName);r.push(t)}return r}async importAccount(e,t){const r={publicKey:e,privateKey:t};return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderImportAccount,r,((r,n)=>n?t(n):e(r)))}))}async deleteAccount(e){const t={address:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderDeleteAccount,t,((t,n)=>n?r(n):e(t)))}))}async getNodesUrls(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderGetNodesUrls,{},((r,n)=>n?t(n):e(r)))}))}async generateNewAccount(e){const t={name:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,s.AvailableCommands.ProviderGenerateNewAccount,t,((t,n)=>n?r(n):e(t)))}))}}},"./src/provider/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=void 0;var n=r("./src/provider/AccountDeletion.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return n.EAccountDeletionResponse}});var o=r("./src/provider/AccountImport.ts");Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return o.EAccountImportResponse}});var s=r("./src/provider/Provider.ts");Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return s.Provider}})},"./src/utils/argsToBase64.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint8ArrayToBase64=t.argsToBase64=void 0,t.argsToBase64=function(e){const t=e.serialize();return Buffer.from(t).toString("base64")},t.uint8ArrayToBase64=function(e){return Buffer.from(e).toString("base64")}},"./src/utils/time.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withTimeoutRejection=t.wait=t.Interval=t.Timeout=void 0;class r{constructor(e,t){this.clear=this.clear.bind(this);const r=this;this.isCleared=!1,this.isCalled=!1,this.timeoutHook=setTimeout((()=>{r.isCleared||(this.isCalled=!0,t())}),e)}clear(){this.isCleared||(clearTimeout(this.timeoutHook),this.isCleared=!0)}}t.Timeout=r,t.Interval=class{constructor(e,t){this.clear=this.clear.bind(this);const r=this;this.isCleared=!1,this.isCalled=!1,this.intervalHook=setInterval((()=>{r.isCleared||(this.isCalled=!0,t())}),e)}clear(){this.isCleared||(clearInterval(this.intervalHook),this.isCleared=!0)}},t.wait=async e=>new Promise(((t,n)=>{const o=new r(e,(()=>(o.clear(),t())))})),t.withTimeoutRejection=async function(e,t){const r=new Promise(((e,r)=>setTimeout((()=>r(new Error(`Timeout of ${t} has passed and promise did not resolve`))),t)));return Promise.race([e,r])}},"./node_modules/uid/dist/index.js":(e,t)=>{for(var r,n=256,o=[];n--;)o[n]=(n+256).toString(16).substring(1);t.uid=function(e){var t=0,s=e||11;if(!r||n+s>512)for(r="",n=0;t<256;t++)r+=o[256*Math.random()|0];return r.substring(n,n+++s)}},"./node_modules/@hicaru/bearby.js/dist/index.js":(e,t,r)=>{"use strict";function n(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function o(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}r.r(t),r.d(t,{ArgTypes:()=>u,ContentProvider:()=>V,Contract:()=>h,Massa:()=>Y,Wallet:()=>te,Web3:()=>re,web3:()=>ne});const s="Wallet is not connected";class i{get payload(){return JSON.parse(JSON.stringify({type:this.type,amount:this.amount,fee:this.fee,gasPrice:this.gasPrice,gasLimit:this.gasLimit,coins:this.coins,maxCoins:this.maxCoins,code:this.contract,func:this.functionName,params:this.parameters,toAddr:this.recipient||this.contract,deployer:this.deployer}))}constructor(e,t,r,n,o,s){this.type=e,this.amount=String(t),this.recipient=r,this.parameters=n||[],this.contract=o,this.functionName=s}}var a,c,u,l,d;function f(e){let t=new Uint8Array(e.length);return Array.prototype.forEach.call(t,((t,r,n)=>{n[r]=e.charCodeAt(r)})),t}!function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(a||(a={})),function(e){e.GET_STATUS="get_status",e.GET_ADDRESSES="get_addresses",e.GET_GRAPH_INTERVAL="get_graph_interval",e.GET_BLOCKS="get_blocks",e.GET_ENDORSEMENTS="get_endorsements",e.GET_OPERATIONS="get_operations",e.GET_CLIQUES="get_cliques",e.GET_STAKERS="get_stakers",e.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",e.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",e.EXECUTE_READ_ONLY_CALL="execute_read_only_call",e.GET_DATASTORE_ENTRIES="get_datastore_entries"}(c||(c={})),function(e){e[e.STRING=0]="STRING",e[e.BOOL=1]="BOOL",e[e.U8=2]="U8",e[e.U32=3]="U32",e[e.U64=4]="U64",e[e.U128=5]="U128",e[e.U256=6]="U256",e[e.I32=7]="I32",e[e.I64=8]="I64",e[e.F32=9]="F32",e[e.F64=10]="F64"}(u||(u={}));class h{constructor(e,t){l.set(this,void 0),d.set(this,void 0),this.types=u,o(this,l,e,"f"),o(this,d,t,"f")}async deploy(e){const t=new i(a.ExecuteSC,"0",void 0,e.parameters,e.contractDataBase64,void 0);return t.deployer=e.deployerBase64,t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.gasPrice=String(e.gasPrice),t.maxCoins=String(e.maxCoins),t.coins=String(e.coins),n(this,d,"f").signTransaction(t)}async call(e){const t=new i(a.CallSC,"0",void 0,e.parameters,e.targetAddress,e.functionName);return t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.coins=String(e.coins||0),n(this,d,"f").signTransaction(t)}async getFilteredSCOutputEvent(...e){const t=c.GET_FILTERED_SC_OUTPUT_EVENT,r=await n(this,l,"f").send(e.map((e=>({method:t,params:[e]}))));return 1===e.length?r[0]:r}async getDatastoreEntries(...e){const t=c.GET_DATASTORE_ENTRIES,r=[];for(const{key:t,address:n}of e)r.push({address:n,key:Array.from(f(t))});return await n(this,l,"f").send([{method:t,params:[r]}])}async executeReadOlyBytecode(e){const t=c.EXECUTE_READ_ONLY_BYTECODE;return n(this,l,"f").send([{method:t,params:[e]}])}async readSmartContract(...e){const t=c.EXECUTE_READ_ONLY_CALL,r=await n(this,l,"f").send([{method:t,params:[e.map((e=>({max_gas:e.maxGas,simulated_gas_price:String(e.simulatedGasPrice),target_address:e.targetAddress,target_function:e.targetFunction,parameters:e.parameters,caller_address:e.callerAddress||n(this,d,"f").account.base58})))]}]);return 1===e.length?r[0]:r}}l=new WeakMap,d=new WeakMap;const p="BearBy",m={CONTENT:`@/${p}/content-script`,INJECTED:`@/${p}/injected-script`},y={GET_DATA:`@/${p}/get-wallet-data`,NEW_SLOT:`@/${p}/new-slot-emited`,ACCOUNT_CHANGED:`@/${p}/accounts-just-changed`,CONTENT_PROXY_MEHTOD:`@/${p}/proxy-method`,CONTENT_PROXY_RESULT:`@/${p}/response-from-content`,CONNECT_APP:`@/${p}/connect-app`,RESPONSE_CONNECT_APP:`@/${p}/respoonse-connect-app`,NETWORK_CHANGED:`@/${p}/network-just-changed`,DISCONNECT_APP:`@/${p}/disconnect_app`,DISCONNECT_APP_RESULT:`@/${p}/disconnect_app_result`,LOCKED:`@/${p}/guard-just-lock`,TX_TO_SEND:`@/${p}/add-tx-to-send`,TX_TO_SEND_RESULT:`@/${p}/response-tx-result`,CHECK_MASSA_ADDRESS:`@/${p}/check-massa-address`,CHECK_MASSA_ADDRESS_RES:`@/${p}/check-massa-address-response`,SIGN_MESSAGE:`@/${p}/sign-message-call`,SING_MESSAGE_RESULT:`@/${p}/sign-message-response`};var g,_,E,b,w;const{document:S}=globalThis;class A{constructor(e){g.add(this),_.set(this,void 0),o(this,_,e,"f")}listen(e){S.addEventListener(n(this,_,"f"),(t=>{t&&t.detail&&e(JSON.parse(t.detail))}))}send(e,t){e.from=n(this,_,"f"),Object.values(m).includes(t)&&n(this,g,"m",E).call(this,JSON.stringify(e),t)}}var v,T,O,C,N,R,x,I,B,P,j,U,M,L,D,k,$,G,q,W;_=new WeakMap,g=new WeakSet,E=function(e,t){S.dispatchEvent(n(this,g,"m",w).call(this,e,t))},b=function(e){return{detail:e}},w=function(e,t){return new CustomEvent(t,n(this,g,"m",b).call(this,e))};class F{constructor(){v.set(this,[])}on(e){return n(this,v,"f").push(e),()=>this.removeListener(e)}removeListener(e){const t=n(this,v,"f").indexOf(e);t>-1&&n(this,v,"f").splice(t,1)}removeAllListeners(){n(this,v,"f").splice(0,n(this,v,"f").length)}emit(...e){n(this,v,"f").forEach((t=>t.apply(this,e)))}once(e){const t=this.on(((...r)=>{t(),e.apply(this,r)}))}}v=new WeakMap;class H{get type(){return n(this,T,"f").type}get payload(){return n(this,T,"f").payload}constructor(e){T.set(this,void 0),o(this,T,e,"f")}send(e,t){const r=JSON.stringify(n(this,T,"f")),o=JSON.parse(r);e.send(o,t)}}T=new WeakMap;class K{constructor(){this.stream=new A(m.INJECTED),this.subject=new F,globalThis.document&&this.stream.listen((e=>{this.subject.emit(e)}))}initialized(){const e=m.CONTENT;new H({type:y.GET_DATA,payload:{}}).send(this.stream,e)}}function J(){return[...Array(20)].map((()=>Math.floor(16*Math.random()).toString(16))).join("")}class V{constructor(e,t){O.set(this,void 0),C.set(this,void 0),o(this,O,e,"f"),o(this,C,t,"f")}async send(e){const t=y.CONTENT_PROXY_MEHTOD,r=m.CONTENT,o=J();let s;new H({type:t,payload:{body:e,uuid:o}}).send(n(this,O,"f"),r);const i=new Promise(((e,t)=>{s=n(this,C,"f").on((r=>{if(r.type===y.CONTENT_PROXY_RESULT&&r.payload&&r.payload.uuid&&r.payload.uuid===o)return r.payload&&r.payload.reject?(s(),t(new Error(r.payload.reject))):(delete r.payload.uuid,s(),e(r.payload.resolve))}))})),a=new Promise(((e,t)=>{setTimeout((()=>{s&&s(),t(new Error("Request failed by timeout"))}),5e3)}));return Promise.race([i,a])}}O=new WeakMap,C=new WeakMap;class Y{constructor(e,t){N.set(this,void 0),R.set(this,void 0),o(this,N,e,"f"),o(this,R,t,"f")}async getNodesStatus(){const e=c.GET_STATUS,[t]=await n(this,N,"f").send([{method:e,params:[]}]);return t}async getAddresses(...e){const t=c.GET_ADDRESSES,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getBlocks(...e){const t=c.GET_BLOCKS,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getGraphInterval(e,t){const r=c.GET_GRAPH_INTERVAL,[o]=await n(this,N,"f").send([{method:r,params:[{start:e,end:t}]}]);return o}async getOperations(...e){const t=c.GET_OPERATIONS,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getStakers(){const e=c.GET_STAKERS,[t]=await n(this,N,"f").send([{method:e,params:[]}]);return t}async getEndorsements(...e){const t=c.GET_ENDORSEMENTS,[r]=await n(this,N,"f").send([{method:t,params:[e]}]);return r}async getCliques(){const e=c.GET_CLIQUES,[t]=await n(this,N,"f").send([{method:e,params:[]}]);return t}async payment(e,t){const r=new i(a.Payment,e,t);return n(this,R,"f").signTransaction(r)}async buyRolls(e="1"){const t=new i(a.RollBuy,e);return n(this,R,"f").signTransaction(t)}async sellRolls(e="1"){const t=new i(a.RollSell,e);return n(this,R,"f").signTransaction(t)}}function z(e,t){if(!e)throw new Error(t)}function X(){let e=globalThis.document.querySelector("link[rel*='icon']");if(!e)throw new Error("website favicon is required");return e.href}N=new WeakMap,R=new WeakMap;class Q{constructor(e){x.set(this,void 0),o(this,x,e,"f")}subscribe(e){if(!e)throw new Error("Missing callback arg. use subscribe(cb => /do something/)");this.base58&&e(this.base58);const t=n(this,x,"f").on((t=>{switch(t.type){case y.DISCONNECT_APP_RESULT:this.base58=void 0;break;case y.ACCOUNT_CHANGED:case y.RESPONSE_CONNECT_APP:case y.GET_DATA:this.base58=t.payload.base58;break;default:return}e(this.base58)}));return{unsubscribe:()=>t()}}}x=new WeakMap;class Z{constructor(e){I.set(this,void 0),o(this,I,e,"f")}subscribe(e){e(this.net);const t=n(this,I,"f").on((t=>{switch(t.type){case y.RESPONSE_CONNECT_APP:case y.GET_DATA:case y.NETWORK_CHANGED:this.net=t.payload.net;break;default:return}e(this.net)}));return{unsubscribe:()=>t()}}}I=new WeakMap;class ee{constructor(e){B.set(this,void 0),this.period=-1,o(this,B,e,"f")}subscribe(e){const t=n(this,B,"f").on((t=>{switch(t.type){case y.NEW_SLOT:this.period=t.payload,e(this.period);break;case y.GET_DATA:case y.NETWORK_CHANGED:this.period=t.payload.period,e(this.period)}}));return{unsubscribe:()=>t()}}}B=new WeakMap;class te{get account(){return n(this,j,"f")}get network(){return n(this,U,"f")}get blockchain(){return n(this,M,"f")}get connected(){return n(this,k,"f")}get enabled(){return n(this,$,"f")}constructor(e,t){P.add(this),j.set(this,void 0),U.set(this,void 0),M.set(this,void 0),L.set(this,void 0),D.set(this,void 0),k.set(this,!1),$.set(this,!1),o(this,L,e,"f"),o(this,D,t,"f"),o(this,j,new Q(t),"f"),o(this,U,new Z(t),"f"),o(this,M,new ee(t),"f"),n(this,P,"m",G).call(this)}async diconnect(){const e=y.DISCONNECT_APP,t=m.CONTENT,r=window.document.title,s=X(),i=J();return new H({type:e,payload:{title:r,icon:s,uuid:i}}).send(n(this,L,"f"),t),new Promise(((e,t)=>{const r=n(this,D,"f").on((s=>{if(s.type===y.DISCONNECT_APP_RESULT&&s.payload.uuid===i)return s.payload.reject?(r(),t(new Error(s.payload.reject))):(o(this,k,!1,"f"),n(this,j,"f").base58=void 0,n(this,U,"f").net=s.payload.net,r(),e(this.connected))}))}))}async isMassaAddress(e){const t=y.CHECK_MASSA_ADDRESS,r=m.CONTENT,o=J();return new H({type:t,payload:{uuid:o,addr:e}}).send(n(this,L,"f"),r),new Promise((e=>{const t=n(this,D,"f").on((r=>{if(r.type===y.CHECK_MASSA_ADDRESS_RES&&r.payload.uuid===o)return t(),e(r.payload.resolve)}))}))}async connect(){const e=y.CONNECT_APP,t=m.CONTENT,r=J(),s=window.document.title,i=X();return new H({type:e,payload:{title:s,icon:i,uuid:r}}).send(n(this,L,"f"),t),new Promise(((e,t)=>{const s=n(this,D,"f").on((i=>{if(i.type===y.RESPONSE_CONNECT_APP&&i.payload.uuid===r)return i.payload.reject?(s(),t(new Error(i.payload.reject))):(o(this,k,Boolean(i.payload.resolve),"f"),n(this,j,"f").base58=i.payload.base58,n(this,U,"f").net=i.payload.net,s(),e(this.connected))}))}))}async signMessage(e){z(this.connected,s);const t=y.SIGN_MESSAGE,r=m.CONTENT,o=J(),i=window.document.title,a=X();return new H({type:t,payload:{message:e,uuid:o,title:i,icon:a}}).send(n(this,L,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===y.SING_MESSAGE_RESULT&&n.payload.uuid===o)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}async signTransaction(e){z(this.connected,s),z(e instanceof i,"Invalid sign params");const t=y.TX_TO_SEND,r=m.CONTENT,o=J(),a={...e.payload,uuid:o,title:window.document.title,icon:X()};return new H({type:t,payload:a}).send(n(this,L,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===y.TX_TO_SEND_RESULT&&n.payload.uuid===o)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}}j=new WeakMap,U=new WeakMap,M=new WeakMap,L=new WeakMap,D=new WeakMap,k=new WeakMap,$=new WeakMap,P=new WeakSet,G=function(){globalThis.window&&n(this,D,"f").on((e=>{switch(e.type){case y.NEW_SLOT:n(this,M,"f").period=e.payload;break;case y.LOCKED:o(this,$,e.payload.enabled,"f");break;case y.ACCOUNT_CHANGED:n(this,j,"f").base58=e.payload.base58;break;case y.GET_DATA:n(this,M,"f").period=e.payload.period,n(this,j,"f").base58=e.payload.base58,o(this,$,e.payload.enabled,"f"),o(this,k,e.payload.connected,"f"),n(this,U,"f").net=e.payload.net;break;case y.NETWORK_CHANGED:n(this,U,"f").net=e.payload.net,n(this,M,"f").period=e.payload.period}}))};class re{constructor(){if(q.set(this,new K),W.set(this,new V(n(this,q,"f").stream,n(this,q,"f").subject)),this.wallet=new te(n(this,q,"f").stream,n(this,q,"f").subject),this.contract=new h(n(this,W,"f"),this.wallet),this.massa=new Y(n(this,W,"f"),this.wallet),globalThis.window){if(globalThis.window.bearby)throw new Error("bearby Web3 instance already created!");try{n(this,q,"f").initialized(),globalThis.window.bearby=Object.freeze(this)}catch{console.debug("bearby-web3 available only browser")}}}}q=new WeakMap,W=new WeakMap;const ne=globalThis.window&&globalThis.window.bearby?globalThis.window.bearby:new re}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r("./src/index.ts");window.massaWallet=n})();
3
3
  //# sourceMappingURL=bundle.min.js.map
@@ -15,7 +15,7 @@ export class BearbyProvider {
15
15
  }
16
16
  async accounts() {
17
17
  // check if bearby is unlocked
18
- if (!web3.wallet.enabled) {
18
+ if (!web3.wallet.connected) {
19
19
  await web3.wallet.connect();
20
20
  }
21
21
  const account = {
@@ -18,7 +18,7 @@ class BearbyProvider {
18
18
  }
19
19
  async accounts() {
20
20
  // check if bearby is unlocked
21
- if (!bearby_js_1.web3.wallet.enabled) {
21
+ if (!bearby_js_1.web3.wallet.connected) {
22
22
  await bearby_js_1.web3.wallet.connect();
23
23
  }
24
24
  const account = {
@@ -1 +1 @@
1
- {"version":3,"file":"BearbyProvider.js","sourceRoot":"","sources":["../../../src/bearbyWallet/BearbyProvider.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAOzC,mDAAgD;AAEhD,MAAa,cAAc;IAGzB;;;;;OAKG;IACH,YAAmB,YAAoB;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,8BAA8B;QAC9B,IAAI,CAAC,gBAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACxB,MAAM,gBAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,MAAM,OAAO,GAAG;YACd,OAAO,EAAE,MAAM,gBAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;YACzC,IAAI,EAAE,QAAQ;SACf,CAAC;QACF,OAAO,CAAC,IAAI,6BAAa,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,SAAiB,EACjB,UAAkB;QAElB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,OAAe;QAEf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,IAAY;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AAlDD,wCAkDC","sourcesContent":["import { web3 } from '@hicaru/bearby.js';\nimport { IAccount, IAccountDetails } from '../account';\nimport {\n IAccountDeletionResponse,\n IAccountImportResponse,\n IProvider,\n} from '../provider';\nimport { BearbyAccount } from './BearbyAccount';\n\nexport class BearbyProvider implements IProvider {\n private providerName: string;\n\n /**\n * Provider constructor\n *\n * @param providerName - The name of the provider.\n * @returns An instance of the Provider class.\n */\n public constructor(providerName: string) {\n this.providerName = providerName;\n }\n\n public name(): string {\n return this.providerName;\n }\n\n public async accounts(): Promise<IAccount[]> {\n // check if bearby is unlocked\n if (!web3.wallet.enabled) {\n await web3.wallet.connect();\n }\n\n const account = {\n address: await web3.wallet.account.base58,\n name: 'BEARBY',\n };\n return [new BearbyAccount(account, this.providerName)];\n }\n\n public async importAccount(\n publicKey: string,\n privateKey: string,\n ): Promise<IAccountImportResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async deleteAccount(\n address: string,\n ): Promise<IAccountDeletionResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async getNodesUrls(): Promise<string[]> {\n return ['https://buildnet.massa.net/api/v2'];\n }\n\n public async generateNewAccount(name: string): Promise<IAccountDetails> {\n throw new Error('Method not implemented.');\n }\n}\n"]}
1
+ {"version":3,"file":"BearbyProvider.js","sourceRoot":"","sources":["../../../src/bearbyWallet/BearbyProvider.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAOzC,mDAAgD;AAEhD,MAAa,cAAc;IAGzB;;;;;OAKG;IACH,YAAmB,YAAoB;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,8BAA8B;QAC9B,IAAI,CAAC,gBAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC1B,MAAM,gBAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,MAAM,OAAO,GAAG;YACd,OAAO,EAAE,MAAM,gBAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;YACzC,IAAI,EAAE,QAAQ;SACf,CAAC;QACF,OAAO,CAAC,IAAI,6BAAa,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,SAAiB,EACjB,UAAkB;QAElB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,OAAe;QAEf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,IAAY;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AAlDD,wCAkDC","sourcesContent":["import { web3 } from '@hicaru/bearby.js';\nimport { IAccount, IAccountDetails } from '../account';\nimport {\n IAccountDeletionResponse,\n IAccountImportResponse,\n IProvider,\n} from '../provider';\nimport { BearbyAccount } from './BearbyAccount';\n\nexport class BearbyProvider implements IProvider {\n private providerName: string;\n\n /**\n * Provider constructor\n *\n * @param providerName - The name of the provider.\n * @returns An instance of the Provider class.\n */\n public constructor(providerName: string) {\n this.providerName = providerName;\n }\n\n public name(): string {\n return this.providerName;\n }\n\n public async accounts(): Promise<IAccount[]> {\n // check if bearby is unlocked\n if (!web3.wallet.connected) {\n await web3.wallet.connect();\n }\n\n const account = {\n address: await web3.wallet.account.base58,\n name: 'BEARBY',\n };\n return [new BearbyAccount(account, this.providerName)];\n }\n\n public async importAccount(\n publicKey: string,\n privateKey: string,\n ): Promise<IAccountImportResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async deleteAccount(\n address: string,\n ): Promise<IAccountDeletionResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async getNodesUrls(): Promise<string[]> {\n return ['https://buildnet.massa.net/api/v2'];\n }\n\n public async generateNewAccount(name: string): Promise<IAccountDetails> {\n throw new Error('Method not implemented.');\n }\n}\n"]}
@@ -16,7 +16,7 @@ export class BearbyProvider {
16
16
  }
17
17
  async accounts() {
18
18
  // check if bearby is unlocked
19
- if (!web3.wallet.enabled) {
19
+ if (!web3.wallet.connected) {
20
20
  await web3.wallet.connect();
21
21
  }
22
22
  const account = {
@@ -1 +1 @@
1
- {"version":3,"file":"BearbyProvider.js","sourceRoot":"","sources":["../../../src/bearbyWallet/BearbyProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,OAAO,cAAc;IACjB,YAAY,CAAS;IAE7B;;;;;OAKG;IACH,YAAmB,YAAoB;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,8BAA8B;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACxB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,MAAM,OAAO,GAAG;YACd,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;YACzC,IAAI,EAAE,QAAQ;SACf,CAAC;QACF,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,SAAiB,EACjB,UAAkB;QAElB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,OAAe;QAEf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,IAAY;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { web3 } from '@hicaru/bearby.js';\nimport { IAccount, IAccountDetails } from '../account';\nimport {\n IAccountDeletionResponse,\n IAccountImportResponse,\n IProvider,\n} from '../provider';\nimport { BearbyAccount } from './BearbyAccount';\n\nexport class BearbyProvider implements IProvider {\n private providerName: string;\n\n /**\n * Provider constructor\n *\n * @param providerName - The name of the provider.\n * @returns An instance of the Provider class.\n */\n public constructor(providerName: string) {\n this.providerName = providerName;\n }\n\n public name(): string {\n return this.providerName;\n }\n\n public async accounts(): Promise<IAccount[]> {\n // check if bearby is unlocked\n if (!web3.wallet.enabled) {\n await web3.wallet.connect();\n }\n\n const account = {\n address: await web3.wallet.account.base58,\n name: 'BEARBY',\n };\n return [new BearbyAccount(account, this.providerName)];\n }\n\n public async importAccount(\n publicKey: string,\n privateKey: string,\n ): Promise<IAccountImportResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async deleteAccount(\n address: string,\n ): Promise<IAccountDeletionResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async getNodesUrls(): Promise<string[]> {\n return ['https://buildnet.massa.net/api/v2'];\n }\n\n public async generateNewAccount(name: string): Promise<IAccountDetails> {\n throw new Error('Method not implemented.');\n }\n}\n"]}
1
+ {"version":3,"file":"BearbyProvider.js","sourceRoot":"","sources":["../../../src/bearbyWallet/BearbyProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,OAAO,cAAc;IACjB,YAAY,CAAS;IAE7B;;;;;OAKG;IACH,YAAmB,YAAoB;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,8BAA8B;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC1B,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,MAAM,OAAO,GAAG;YACd,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;YACzC,IAAI,EAAE,QAAQ;SACf,CAAC;QACF,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,SAAiB,EACjB,UAAkB;QAElB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,OAAe;QAEf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,IAAY;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { web3 } from '@hicaru/bearby.js';\nimport { IAccount, IAccountDetails } from '../account';\nimport {\n IAccountDeletionResponse,\n IAccountImportResponse,\n IProvider,\n} from '../provider';\nimport { BearbyAccount } from './BearbyAccount';\n\nexport class BearbyProvider implements IProvider {\n private providerName: string;\n\n /**\n * Provider constructor\n *\n * @param providerName - The name of the provider.\n * @returns An instance of the Provider class.\n */\n public constructor(providerName: string) {\n this.providerName = providerName;\n }\n\n public name(): string {\n return this.providerName;\n }\n\n public async accounts(): Promise<IAccount[]> {\n // check if bearby is unlocked\n if (!web3.wallet.connected) {\n await web3.wallet.connect();\n }\n\n const account = {\n address: await web3.wallet.account.base58,\n name: 'BEARBY',\n };\n return [new BearbyAccount(account, this.providerName)];\n }\n\n public async importAccount(\n publicKey: string,\n privateKey: string,\n ): Promise<IAccountImportResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async deleteAccount(\n address: string,\n ): Promise<IAccountDeletionResponse> {\n throw new Error('Method not implemented.');\n }\n\n public async getNodesUrls(): Promise<string[]> {\n return ['https://buildnet.massa.net/api/v2'];\n }\n\n public async generateNewAccount(name: string): Promise<IAccountDetails> {\n throw new Error('Method not implemented.');\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/wallet-provider",
3
- "version": "1.2.1-dev.20230818073036",
3
+ "version": "1.3.1-dev.20230822115102",
4
4
  "description": "massa's wallet provider",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",