-
Notifications
You must be signed in to change notification settings - Fork 11
/
1869.6ae45c26.bundle.js
1 lines (1 loc) · 40 KB
/
1869.6ae45c26.bundle.js
1
"use strict";(self.webpackChunkbingo_frontend=self.webpackChunkbingo_frontend||[]).push([[1869],{81869:(e,t,n)=>{n.r(t),n.d(t,{ParticleDelegateProvider:()=>kt,ParticleProvider:()=>Bt});var r={};n.r(r),n.d(r,{hasBrowserEnv:()=>ce,hasStandardBrowserEnv:()=>ue,hasStandardBrowserWebWorkerEnv:()=>he});var o=n(79368),i=n(44586),s=n(43478),a=n(48764),c=n(17187);function u(e,t){return function(){return e.apply(t,arguments)}}const{toString:l}=Object.prototype,{getPrototypeOf:h}=Object,d=(f=Object.create(null),e=>{const t=l.call(e);return f[t]||(f[t]=t.slice(8,-1).toLowerCase())});var f;const p=e=>(e=e.toLowerCase(),t=>d(t)===e),m=e=>t=>typeof t===e,{isArray:g}=Array,y=m("undefined");const b=p("ArrayBuffer");const w=m("string"),E=m("function"),v=m("number"),O=e=>null!==e&&"object"==typeof e,S=e=>{if("object"!==d(e))return!1;const t=h(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},P=p("Date"),T=p("File"),R=p("Blob"),j=p("FileList"),_=p("URLSearchParams");function A(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),g(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function C(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,N=e=>!y(e)&&e!==x;const D=(L="undefined"!=typeof Uint8Array&&h(Uint8Array),e=>L&&e instanceof L);var L;const U=p("HTMLFormElement"),F=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),I=p("RegExp"),B=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};A(n,((n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)})),Object.defineProperties(e,r)},k="abcdefghijklmnopqrstuvwxyz",q="0123456789",M={DIGIT:q,ALPHA:k,ALPHA_DIGIT:k+k.toUpperCase()+q};const z=p("AsyncFunction"),H={isArray:g,isArrayBuffer:b,isBuffer:function(e){return null!==e&&!y(e)&&null!==e.constructor&&!y(e.constructor)&&E(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||E(e.append)&&("formdata"===(t=d(e))||"object"===t&&E(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&b(e.buffer),t},isString:w,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:O,isPlainObject:S,isUndefined:y,isDate:P,isFile:T,isBlob:R,isRegExp:I,isFunction:E,isStream:e=>O(e)&&E(e.pipe),isURLSearchParams:_,isTypedArray:D,isFileList:j,forEach:A,merge:function e(){const{caseless:t}=N(this)&&this||{},n={},r=(r,o)=>{const i=t&&C(n,o)||o;S(n[i])&&S(r)?n[i]=e(n[i],r):S(r)?n[i]=e({},r):g(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&A(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(A(t,((t,r)=>{n&&E(t)?e[r]=u(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&h(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:d,kindOfTest:p,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(g(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:U,hasOwnProperty:F,hasOwnProp:F,reduceDescriptors:B,freezeMethods:e=>{B(e,((t,n)=>{if(E(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];E(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return g(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:C,global:x,isContextDefined:N,ALPHABET:M,generateString:(e=16,t=M.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&E(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(O(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=g(e)?[]:{};return A(e,((e,t)=>{const i=n(e,r+1);!y(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:z,isThenable:e=>e&&(O(e)||E(e))&&E(e.then)&&E(e.catch)};function W(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}H.inherits(W,Error,{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:H.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const J=W.prototype,K={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{K[e]={value:e}})),Object.defineProperties(W,K),Object.defineProperty(J,"isAxiosError",{value:!0}),W.from=(e,t,n,r,o,i)=>{const s=Object.create(J);return H.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),W.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const V=W;function $(e){return H.isPlainObject(e)||H.isArray(e)}function G(e){return H.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map((function(e,t){return e=G(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const Z=H.toFlatObject(H,{},null,(function(e){return/^is[A-Z]/.test(e)}));const Q=function(e,t,n){if(!H.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=H.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!H.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&H.isSpecCompliantForm(t);if(!H.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(H.isDate(e))return e.toISOString();if(!a&&H.isBlob(e))throw new V("Blob is not supported. Use a Buffer instead.");return H.isArrayBuffer(e)||H.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(H.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(H.isArray(e)&&function(e){return H.isArray(e)&&!e.some($)}(e)||(H.isFileList(e)||H.endsWith(n,"[]"))&&(a=H.toArray(e)))return n=G(n),a.forEach((function(e,r){!H.isUndefined(e)&&null!==e&&t.append(!0===s?X([n],r,i):null===s?n:n+"[]",c(e))})),!1;return!!$(e)||(t.append(X(o,n,i),c(e)),!1)}const l=[],h=Object.assign(Z,{defaultVisitor:u,convertValue:c,isVisitable:$});if(!H.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!H.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),H.forEach(n,(function(n,i){!0===(!(H.isUndefined(n)||null===n)&&o.call(t,n,H.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i])})),l.pop()}}(e),t};function Y(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ee(e,t){this._pairs=[],e&&Q(e,this,t)}const te=ee.prototype;te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Y)}:Y;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const ne=ee;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function oe(e,t,n){if(!t)return e;const r=n&&n.encode||re,o=n&&n.serialize;let i;if(i=o?o(t,n):H.isURLSearchParams(t)?t.toString():new ne(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const ie=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){H.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ne,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ce="undefined"!=typeof window&&"undefined"!=typeof document,ue=(le="undefined"!=typeof navigator&&navigator.product,ce&&["ReactNative","NativeScript","NS"].indexOf(le)<0);var le;const he="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,de={...r,...ae};const fe=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&H.isArray(r)?r.length:i,a)return H.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&H.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&H.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(H.isFormData(e)&&H.isFunction(e.entries)){const n={};return H.forEachEntry(e,((e,r)=>{t(function(e){return H.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null};const pe={transitional:se,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=H.isObject(e);o&&H.isHTMLForm(e)&&(e=new FormData(e));if(H.isFormData(e))return r&&r?JSON.stringify(fe(e)):e;if(H.isArrayBuffer(e)||H.isBuffer(e)||H.isStream(e)||H.isFile(e)||H.isBlob(e))return e;if(H.isArrayBufferView(e))return e.buffer;if(H.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new de.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return de.isNode&&H.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=H.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(H.isString(e))try{return(t||JSON.parse)(e),H.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||pe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&H.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw V.from(e,V.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};H.forEach(["delete","get","head","post","put","patch"],(e=>{pe.headers[e]={}}));const me=pe,ge=H.toObjectSet(["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"]),ye=Symbol("internals");function be(e){return e&&String(e).trim().toLowerCase()}function we(e){return!1===e||null==e?e:H.isArray(e)?e.map(we):String(e)}function Ee(e,t,n,r,o){return H.isFunction(r)?r.call(this,t,n):(o&&(t=n),H.isString(t)?H.isString(r)?-1!==t.indexOf(r):H.isRegExp(r)?r.test(t):void 0:void 0)}class ve{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=be(t);if(!o)throw new Error("header name must be a non-empty string");const i=H.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=we(e))}const i=(e,t)=>H.forEach(e,((e,n)=>o(e,n,t)));return H.isPlainObject(e)||e instanceof this.constructor?i(e,t):H.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ge[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=be(e)){const n=H.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(H.isFunction(t))return t.call(this,e,n);if(H.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=be(e)){const n=H.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ee(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=be(e)){const o=H.findKey(n,e);!o||t&&!Ee(0,n[o],o,t)||(delete n[o],r=!0)}}return H.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Ee(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return H.forEach(this,((r,o)=>{const i=H.findKey(n,o);if(i)return t[i]=we(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=we(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return H.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&H.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[ye]=this[ye]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=be(e);t[r]||(!function(e,t){const n=H.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return H.isArray(e)?e.forEach(r):r(e),this}}ve.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),H.reduceDescriptors(ve.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),H.freezeMethods(ve);const Oe=ve;function Se(e,t){const n=this||me,r=t||n,o=Oe.from(r.headers);let i=r.data;return H.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function Pe(e){return!(!e||!e.__CANCEL__)}function Te(e,t,n){V.call(this,null==e?"canceled":e,V.ERR_CANCELED,t,n),this.name="CanceledError"}H.inherits(Te,V,{__CANCEL__:!0});const Re=Te;const je=de.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];H.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),H.isString(r)&&s.push("path="+r),H.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function _e(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ae=de.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=H.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};const Ce=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,h=0;for(;l!==i;)h+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}};function xe(e,t){let n=0;const r=Ce(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const u={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}const Ne="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=Oe.from(e.headers).normalize();let i,s,{responseType:a,withXSRFToken:c}=e;function u(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}if(H.isFormData(r))if(de.hasStandardBrowserEnv||de.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if(!1!==(s=o.getContentType())){const[e,...t]=s?s.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const h=_e(e.baseURL,e.url);function d(){if(!l)return;const r=Oe.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new V("Request failed with status code "+n.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),u()}),(function(e){n(e),u()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),oe(h,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new V("Request aborted",V.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new V("Network Error",V.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||se;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new V(t,r.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,e,l)),l=null},de.hasStandardBrowserEnv&&(c&&H.isFunction(c)&&(c=c(e)),c||!1!==c&&Ae(h))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&je.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in l&&H.forEach(o.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),H.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),a&&"json"!==a&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",xe(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",xe(e.onUploadProgress)),(e.cancelToken||e.signal)&&(i=t=>{l&&(n(!t||t.type?new Re(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(h);f&&-1===de.protocols.indexOf(f)?n(new V("Unsupported protocol "+f+":",V.ERR_BAD_REQUEST,e)):l.send(r||null)}))},De={http:null,xhr:Ne};H.forEach(De,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Le=e=>`- ${e}`,Ue=e=>H.isFunction(e)||null===e||!1===e,Fe=e=>{e=H.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){let t;if(n=e[i],r=n,!Ue(n)&&(r=De[(t=String(n)).toLowerCase()],void 0===r))throw new V(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+i]=r}if(!r){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let n=t?e.length>1?"since :\n"+e.map(Le).join("\n"):" "+Le(e[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Ie(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Re(null,e)}function Be(e){Ie(e),e.headers=Oe.from(e.headers),e.data=Se.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Fe(e.adapter||me.adapter)(e).then((function(t){return Ie(e),t.data=Se.call(e,e.transformResponse,t),t.headers=Oe.from(t.headers),t}),(function(t){return Pe(t)||(Ie(e),t&&t.response&&(t.response.data=Se.call(e,e.transformResponse,t.response),t.response.headers=Oe.from(t.response.headers))),Promise.reject(t)}))}const ke=e=>e instanceof Oe?e.toJSON():e;function qe(e,t){t=t||{};const n={};function r(e,t,n){return H.isPlainObject(e)&&H.isPlainObject(t)?H.merge.call({caseless:n},e,t):H.isPlainObject(t)?H.merge({},t):H.isArray(t)?t.slice():t}function o(e,t,n){return H.isUndefined(t)?H.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!H.isUndefined(t))return r(void 0,t)}function s(e,t){return H.isUndefined(t)?H.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(ke(e),ke(t),!0)};return H.forEach(Object.keys(Object.assign({},e,t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);H.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Me="1.6.5",ze={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ze[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const He={};ze.transitional=function(e,t,n){function r(e,t){return"[Axios v1.6.5] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new V(r(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!He[o]&&(He[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};const We={assertOptions:function(e,t,n){if("object"!=typeof e)throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new V("option "+i+" must be "+n,V.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new V("Unknown option "+i,V.ERR_BAD_OPTION)}},validators:ze},Je=We.validators;class Ke{constructor(e){this.defaults=e,this.interceptors={request:new ie,response:new ie}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=qe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&We.assertOptions(n,{silentJSONParsing:Je.transitional(Je.boolean),forcedJSONParsing:Je.transitional(Je.boolean),clarifyTimeoutError:Je.transitional(Je.boolean)},!1),null!=r&&(H.isFunction(r)?t.paramsSerializer={serialize:r}:We.assertOptions(r,{encode:Je.function,serialize:Je.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&H.merge(o.common,o[t.method]);o&&H.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Oe.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,h=0;if(!a){const e=[Be.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=s.length;let d=t;for(h=0;h<l;){const e=s[h++],t=s[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=Be.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return oe(_e((e=qe(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}H.forEach(["delete","get","head","options"],(function(e){Ke.prototype[e]=function(t,n){return this.request(qe(n||{},{method:e,url:t,data:(n||{}).data}))}})),H.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(qe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ke.prototype[e]=t(),Ke.prototype[e+"Form"]=t(!0)}));const Ve=Ke;class $e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new Re(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new $e((function(t){e=t})),cancel:e}}}const Ge=$e;const Xe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xe).forEach((([e,t])=>{Xe[t]=e}));const Ze=Xe;const Qe=function e(t){const n=new Ve(t),r=u(Ve.prototype.request,n);return H.extend(r,Ve.prototype,n,{allOwnKeys:!0}),H.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(qe(t,n))},r}(me);Qe.Axios=Ve,Qe.CanceledError=Re,Qe.CancelToken=Ge,Qe.isCancel=Pe,Qe.VERSION=Me,Qe.toFormData=Q,Qe.AxiosError=V,Qe.Cancel=Qe.CanceledError,Qe.all=function(e){return Promise.all(e)},Qe.spread=function(e){return function(t){return e.apply(null,t)}},Qe.isAxiosError=function(e){return H.isObject(e)&&!0===e.isAxiosError},Qe.mergeConfig=qe,Qe.AxiosHeaders=Oe,Qe.formToJSON=e=>fe(H.isHTMLForm(e)?new FormData(e):e),Qe.getAdapter=Fe,Qe.HttpStatusCode=Ze,Qe.default=Qe;const Ye=Qe;var et,tt,nt,rt,ot,it,st,at,ct,ut,lt,ht,dt,ft,pt,mt=Object.defineProperty,gt=Object.defineProperties,yt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyDescriptors,wt=Object.getOwnPropertyNames,Et=Object.getOwnPropertySymbols,vt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,St=(e,t,n)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pt=e=>((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of wt(t))vt.call(e,o)||o===n||mt(e,o,{get:()=>t[o],enumerable:!(r=yt(t,o))||r.enumerable});return e})(mt({},"__esModule",{value:!0}),e),Tt=(e,t,n)=>new Promise(((r,o)=>{var i=e=>{try{a(n.next(e))}catch(e){o(e)}},s=e=>{try{a(n.throw(e))}catch(e){o(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())})),Rt={};((e,t)=>{for(var n in t)mt(e,n,{get:t[n],enumerable:!0})})(Rt,{default:()=>pt,dependencies:()=>lt,devDependencies:()=>ht,files:()=>nt,gitHead:()=>ft,license:()=>at,main:()=>ot,module:()=>it,name:()=>et,peerDependencies:()=>ut,publishConfig:()=>ct,scripts:()=>dt,type:()=>rt,types:()=>st,version:()=>tt});var jt,_t,At=(jt={"package.json"(){pt={name:et="@particle-network/provider",version:tt="1.3.0",files:nt=["es","lib","LICENSE"],type:rt="module",main:ot="lib/index.js",module:it="es/index.js",types:st="lib/types/index.d.ts",license:at="Apache-2.0",publishConfig:ct={access:"public"},peerDependencies:ut={"@particle-network/auth":"*"},dependencies:lt={"@particle-network/chains":"*",axios:"^1.3.6",uuid:"^8.3.2"},devDependencies:ht={"@particle-network/auth":"^1.3.0","@types/uuid":"^8.3.4","ts-loader":"^9.3.1","webpack-cli":"^4.10.0"},scripts:dt={package:'shx echo \'{ "type": "commonjs" }\' > lib/package.json',build:"yarn clean && node ./esBuild.js && tsc --emitDeclarationOnly -p tsconfig.json && yarn package",clean:"shx rm -rf lib/* && shx rm -rf es/*","build:min.js":"webpack",version:"yarn build"},gitHead:ft="cc999e430ebfb1dd821783f7cf099ddd51f3495a"}}},function(){return jt&&(_t=(0,jt[wt(jt)[0]])(jt=0)),_t}),Ct=class extends Error{constructor(e,t,n){super(t),this.code=e,this.message=t,this.data=n,this.code=e,this.message=t,this.data=n}static userRejectedRequest(){return new Ct(4001,"The user rejected the request")}static userCancelOperation(){return new Ct(4011,"The user cancel the operation")}static unauthorized(){return new Ct(4100,"The requested method and/or account has not been authorized by the user")}static unsupportedMethod(){return new Ct(4200,"The Provider does not support the requested method")}static unsupportedChain(){return new Ct(4201,"The Provider does not support the chain")}static disconnected(){return new Ct(4900,"The Provider is disconnected from all chains")}static chainDisconnected(){return new Ct(4901,"The Provider is not connected to the requested chain")}static paramsError(){return new Ct(8002,"Param error, see doc for more info")}},xt=class{},Nt=class extends xt{constructor(){super(...arguments),this.events=new c.EventEmitter}on(e,t){return this.events.on(e,t),this}once(e,t){return this.events.once(e,t),this}off(e,t){return this.events.off(e,t),this}removeListener(e,t){return this.events.removeListener(e,t),this}},Dt=class extends xt{constructor(){super(...arguments),this.events=new c.EventEmitter}on(e,t){return this.events.on(e,t),this}once(e,t){return this.events.once(e,t),this}off(e,t){return this.events.off(e,t),this}removeListener(e,t){return this.events.removeListener(e,t),this}},Lt=["eth_signTransaction","eth_sign","eth_sendRawTransaction"],Ut=["eth_requestAccounts","eth_accounts","eth_chainId","eth_sendTransaction","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_watchAsset"],Ft=["personal_sign_uniq","eth_signTypedData_v4_uniq"],It=class extends Nt{constructor(e){if(super(),this.config=e,this.registering=!1,!(0,o.jK)(e.url))throw new Error(`Provided URL is not compatible with HTTP connection: ${e.url}`);this.config=e}get connected(){return void 0!==this.api}get connecting(){return this.registering}open(){return Tt(this,null,(function*(){this.api=yield this.register()}))}close(){return Tt(this,null,(function*(){this.onClose()}))}send(e){return Tt(this,null,(function*(){return void 0===this.api&&(this.api=yield this.register()),this.api.post("/",e).then((e=>e.data))}))}register(){return Tt(this,null,(function*(){const e=this.config;if(!(0,o.jK)(e.url))throw new Error(`Provided URL is not compatible with HTTP connection: ${e.url}`);if(this.registering)return new Promise(((e,t)=>{this.events.once("open",(()=>{if(void 0===this.api)return t(new Error("HTTP connection is missing or invalid"));e(this.api)}))}));this.registering=!0;const t=Ye.create({baseURL:e.url,timeout:3e4,headers:{Accept:"application/json","Content-Type":"application/json"}});return t.interceptors.request.use((function(t){var n,r;return t.params||(t.params={}),t.params.chainId=null!=(r=null==(n=t.data)?void 0:n.chainId)?r:e.chainId(),t.params.projectUuid=e.authentication.projectId,t.params.projectKey=e.authentication.clientKey,t}),(e=>Promise.reject(e))),this.onOpen(t),t}))}onOpen(e){this.api=e,this.registering=!1,this.events.emit("open")}onClose(){this.api=void 0,this.events.emit("close")}};var Bt=class extends Dt{constructor(e){super(),this.auth=e,this.isParticleNetwork=!0,this.auth=e,this.connection=this.setConnection(),this.authAdapter=new class{constructor(e){this.auth=e,this.auth=e}request(e){return Tt(this,null,(function*(){if("eth_requestAccounts"===e.method||"eth_accounts"===e.method){let e=this.auth.getWallet();if(e)return[e.public_address];if(yield this.auth.login(),e=this.auth.getWallet(),e)return[e.public_address];throw new Error("Create wallet failed")}if("eth_chainId"===e.method)return(0,o.I4)(this.auth.getChainId());if("eth_sendTransaction"===e.method){if(e.params&&e.params instanceof Array&&e.params[0]){const t=e.params[0];return(0,o.Rw)(t.type)&&(s.p5.isChainSupportEIP1559(this.auth.getChain())?t.type="0x2":t.type="0x0"),(0,o.Rw)(t.chainId)&&(t.chainId=(0,o.I4)(this.auth.getChainId())),(0,o.Rw)(t.nonce)&&(t.nonce="0x0"),(0,o.Rw)(t.data)&&(t.data="0x"),this.auth.sendTransaction(this.legacyToString(e.params[0]))}return Promise.reject(Ct.paramsError())}if("eth_signTypedData_v3"===e.method||"eth_signTypedData_v4"===e.method||"eth_signTypedData_v4_uniq"===e.method){if(e.params&&e.params instanceof Array&&e.params.length>=2){let t=e.params[1];return"string"!=typeof t||t.startsWith("0x")||(t=(0,o.L_)(a.lW.from(t).toString("hex"))),this.auth.sign(e.method,this.legacyToString(t))}return Promise.reject(Ct.paramsError())}if("eth_signTypedData"===e.method||"eth_signTypedData_v1"===e.method){if(e.params&&e.params instanceof Array&&e.params[0]){let t=e.params[0];return"string"!=typeof t||t.startsWith("0x")||(t=(0,o.L_)(a.lW.from(t).toString("hex"))),this.auth.sign(e.method,this.legacyToString(t))}return Promise.reject(Ct.paramsError())}if("personal_sign"===e.method||"personal_sign_uniq"===e.method)return e.params&&e.params instanceof Array&&e.params[0]?this.auth.sign(e.method,this.legacyToString(e.params[0])):Promise.reject(Ct.paramsError());if("wallet_switchEthereumChain"===e.method){if(e.params&&e.params instanceof Array&&e.params[0]&&e.params[0].chainId){const t=Number(e.params[0].chainId),n=s.p5.getEVMChainInfoById(t);return n?(yield this.auth.switchChain(n),Promise.resolve(null)):Promise.reject(Ct.unsupportedChain())}return Promise.reject(Ct.paramsError())}return Promise.reject(Ct.unsupportedMethod())}))}legacyToString(e){let t;return t="number"==typeof e?(0,o.L_)(e.toString(16)):"string"==typeof e?e.toString().startsWith("0x")?e:(0,o.L_)(a.lW.from(e).toString("hex")):(0,o.L_)(a.lW.from(JSON.stringify(e)).toString("hex")),t}}(this.auth),this.auth.on("chainChanged",(e=>{"Solana"!==e.name&&this.emit("chainChanged",(0,o.I4)(e.id))})),"undefined"!=typeof window&&window.particle&&(window.particle.particleProvider=this)}get version(){return`web_${(At(),Pt(Rt)).version}`}setConnection(){return new It({url:`${(0,o.oy)()}/evm-chain`,basicCredentials:this.auth.basicCredentials(),chainId:()=>this.auth.getChainId(),authentication:this.auth.config})}emit(e,...t){return this.events.emit(e,...t)}disconnect(){return Tt(this,null,(function*(){return this.auth.logout()}))}enable(){return Tt(this,null,(function*(){return this.request({method:"eth_requestAccounts"})}))}request(e){return Tt(this,null,(function*(){var t,n;if(!e.method||Lt.includes(e.method))return Promise.reject(Ct.unsupportedMethod());this.connection.connected||(yield this.open());const r={chainId:Number(this.auth.getChainId()),id:null!=(t=e.id)?t:(0,i.Z)(),jsonrpc:null!=(n=e.jsonrpc)?n:"2.0",method:e.method,params:e.params};return Ut.includes(e.method)||Ft.includes(e.method)?this.authAdapter.request(e):this.requestStrict(r)}))}requestStrict(e){return Tt(this,null,(function*(){return this.connection.send(e).then((e=>e.error?Promise.reject(e.error):Promise.resolve(e.result)))}))}open(){return Tt(this,null,(function*(){yield this.connection.open(),this.connection.on("close",(()=>this.emit("disconnect"))),this.emit("connect",{chainId:(0,o.I4)(this.auth.getChainId())})}))}close(){return Tt(this,null,(function*(){yield this.connection.close()}))}},kt=class extends Dt{constructor(e,t){super(),this.auth=e,this.signerProvider=t,this.isParticleDelegateProvider=!0,this.connection=this.setConnection(),this.listenEvent()}listenEvent(){const e=this.events;this.signerProvider.on("connect",(t=>e.emit("connect",t))),this.signerProvider.on("disconnect",(t=>e.emit("disconnect",t))),this.signerProvider.on("message",(t=>e.emit("message",t))),this.signerProvider.on("chainChanged",(t=>e.emit("chainChanged",t))),this.signerProvider.on("accountsChanged",(t=>e.emit("accountsChanged",t)))}setConnection(){return new It({url:`${(0,o.oy)()}/evm-chain`,basicCredentials:this.auth.basicCredentials(),chainId:()=>{var e;return null!=(e=this.chainId)?e:this.auth.getChainId()},authentication:this.auth.config})}disconnect(){return Tt(this,null,(function*(){const e=this.signerProvider;if(e.disconnect&&"function"==typeof e.disconnect)try{yield e.disconnect()}catch(e){}}))}enable(){return Tt(this,null,(function*(){const e=this.signerProvider;let t;if(e.enable&&"function"==typeof e.enable)try{t=yield e.enable()}catch(e){t=yield this.request({method:"eth_requestAccounts"})}return t}))}request(e){return Tt(this,null,(function*(){var t,n;if(!e.method||Lt.includes(e.method))return Promise.reject(Ct.unsupportedMethod());this.connection.connected||(yield this.open());const r={id:null!=(t=e.id)?t:(0,i.Z)(),jsonrpc:null!=(n=e.jsonrpc)?n:"2.0",method:e.method,params:e.params};if(Ut.includes(r.method)||this.isParticleSignerMethod(r.method))return yield this.signerProvider.request(r);{try{this.chainId=Number(yield this.signerProvider.request({method:"eth_chainId"}))}catch(e){this.chainId=Number(this.auth.getChainId())}const e=(o=((e,t)=>{for(var n in t||(t={}))vt.call(t,n)&&St(e,n,t[n]);if(Et)for(var n of Et(t))Ot.call(t,n)&&St(e,n,t[n]);return e})({},r),s={chainId:this.chainId},gt(o,bt(s)));return yield this.requestStrict(e)}var o,s}))}isParticleSignerMethod(e){return this.signerProvider.isParticleNetwork&&Ft.includes(e)}requestStrict(e){return Tt(this,null,(function*(){return this.connection.send(e).then((e=>e.error?Promise.reject(e.error):Promise.resolve(e.result)))}))}open(){return Tt(this,null,(function*(){yield this.connection.open()}))}}}}]);