@snapshot-labs/snapshot.js 0.14.17 → 0.14.19

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.
@@ -229,4 +229,4 @@ const{fromCallback:dA}=ME,fA=kE.Store,mA=EE.permuteDomain,pA=AE.pathMatch,{getCu
229
229
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
230
230
  * POSSIBILITY OF SUCH DAMAGE.
231
231
  */
232
- const TA=kE.Store,CA=bA.MemoryCookieStore,zA=AE.pathMatch,{fromCallback:OA}=ME,{getCustomInspectSymbol:RA}=cA,PA=/^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/,BA=/[\x00-\x1F]/,DA=["\n","\r","\0"],$A=/[\x20-\x3A\x3C-\x7E]+/,LA=/[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/,UA={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},FA=2147483647e3,qA='Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"';function VA(t){SA.validate(SA.isNonEmptyString(t),t);const e=String(t).toLowerCase();return"none"===e||"lax"===e||"strict"===e?e:null}const HA=Object.freeze({SILENT:"silent",STRICT:"strict",DISABLED:"unsafe-disabled"}),GA=/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/,ZA="\n\\[?(?:\n(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)|\n(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)|\n(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)|\n(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|\n(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:))\n)(?:%[0-9a-zA-Z]{1,})?\\]?\n".replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),KA=new RegExp(`^${ZA}$`);function JA(t,e,r,i){let n=0;for(;n<t.length;){const e=t.charCodeAt(n);if(e<=47||e>=58)break;n++}return n<e||n>r?null:i||n==t.length?parseInt(t.substr(0,n),10):null}function WA(t){const e=t.split(":"),r=[0,0,0];if(3!==e.length)return null;for(let t=0;t<3;t++){const i=2==t,n=JA(e[t],1,2,i);if(null===n)return null;r[t]=n}return r}function YA(t){t=String(t).substr(0,3).toLowerCase();const e=UA[t];return e>=0?e:null}function QA(t){if(!t)return;const e=t.split(LA);if(!e)return;let r=null,i=null,n=null,o=null,a=null,s=null;for(let t=0;t<e.length;t++){const h=e[t].trim();if(!h.length)continue;let u;null===n&&(u=WA(h),u)?(r=u[0],i=u[1],n=u[2]):null!==o||(u=JA(h,1,2,!0),null===u)?null!==a||(u=YA(h),null===u)?null===s&&(u=JA(h,2,4,!0),null!==u&&(s=u,s>=70&&s<=99?s+=1900:s>=0&&s<=69&&(s+=2e3))):a=u:o=u}return null===o||null===a||null===s||null===n||o<1||o>31||s<1601||r>23||i>59||n>59?void 0:new Date(Date.UTC(s,a,o,r,i,n))}function XA(t){return SA.validate(SA.isDate(t),t),t.toUTCString()}function tj(t){return null==t?null:(t=t.trim().replace(/^\./,""),KA.test(t)&&(t=t.replace("[","").replace("]","")),IA&&/[^\u0001-\u007f]/.test(t)&&(t=IA.toASCII(t)),t.toLowerCase())}function ej(t,e,r){if(null==t||null==e)return null;if(!1!==r&&(t=tj(t),e=tj(e)),t==e)return!0;const i=t.lastIndexOf(e);return!(i<=0)&&(t.length===e.length+i&&("."===t.substr(i-1,1)&&!GA.test(t)))}function rj(t){if(!t||"/"!==t.substr(0,1))return"/";if("/"===t)return t;const e=t.lastIndexOf("/");return 0===e?"/":t.slice(0,e)}function ij(t,e){t=function(t){if(SA.isEmptyString(t))return t;for(let e=0;e<DA.length;e++){const r=t.indexOf(DA[e]);-1!==r&&(t=t.substr(0,r))}return t}(t),SA.validate(SA.isString(t),t);let r,i,n=t.indexOf("=");if(e)0===n&&(n=(t=t.substr(1)).indexOf("="));else if(n<=0)return;if(n<=0?(r="",i=t.trim()):(r=t.substr(0,n).trim(),i=t.substr(n+1).trim()),BA.test(r)||BA.test(i))return;const o=new lj;return o.key=r,o.value=i,o}function nj(t,e){if(e&&"object"==typeof e||(e={}),SA.isEmptyString(t)||!SA.isString(t))return null;const r=(t=t.trim()).indexOf(";"),i=ij(-1===r?t:t.substr(0,r),!!e.loose);if(!i)return;if(-1===r)return i;const n=t.slice(r+1).trim();if(0===n.length)return i;const o=n.split(";");for(;o.length;){const t=o.shift().trim();if(0===t.length)continue;const e=t.indexOf("=");let r,n;switch(-1===e?(r=t,n=null):(r=t.substr(0,e),n=t.substr(e+1)),r=r.trim().toLowerCase(),n&&(n=n.trim()),r){case"expires":if(n){const t=QA(n);t&&(i.expires=t)}break;case"max-age":if(n&&/^-?[0-9]+$/.test(n)){const t=parseInt(n,10);i.setMaxAge(t)}break;case"domain":if(n){const t=n.trim().replace(/^\./,"");t&&(i.domain=t.toLowerCase())}break;case"path":i.path=n&&"/"===n[0]?n:null;break;case"secure":i.secure=!0;break;case"httponly":i.httpOnly=!0;break;case"samesite":switch(n?n.toLowerCase():""){case"strict":i.sameSite="strict";break;case"lax":i.sameSite="lax";break;case"none":i.sameSite="none";break;default:i.sameSite=void 0}break;default:i.extensions=i.extensions||[],i.extensions.push(t)}}return i}function oj(t){let e;try{e=JSON.parse(t)}catch(t){return t}return e}function aj(t){if(!t||SA.isEmptyString(t))return null;let e;if("string"==typeof t){if(e=oj(t),e instanceof Error)return null}else e=t;const r=new lj;for(let t=0;t<lj.serializableProperties.length;t++){const i=lj.serializableProperties[t];void 0!==e[i]&&e[i]!==uj[i]&&("expires"===i||"creation"===i||"lastAccessed"===i?null===e[i]?r[i]=null:r[i]="Infinity"==e[i]?"Infinity":new Date(e[i]):r[i]=e[i])}return r}function sj(t,e){SA.validate(SA.isObject(t),t),SA.validate(SA.isObject(e),e);let r=0;const i=t.path?t.path.length:0;if(r=(e.path?e.path.length:0)-i,0!==r)return r;return r=(t.creation?t.creation.getTime():FA)-(e.creation?e.creation.getTime():FA),0!==r||(r=t.creationIndex-e.creationIndex),r}function hj(t){if(t instanceof Object)return t;try{t=decodeURI(t)}catch(t){}return pE(t)}const uj={key:"",value:"",expires:"Infinity",maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0};class lj{constructor(t={}){const e=RA();e&&(this[e]=this.inspect),Object.assign(this,uj,t),this.creation=this.creation||new Date,Object.defineProperty(this,"creationIndex",{configurable:!1,enumerable:!1,writable:!0,value:++lj.cookiesCreated})}inspect(){const t=Date.now(),e=null!=this.hostOnly?this.hostOnly:"?",r=this.creation?t-this.creation.getTime()+"ms":"?",i=this.lastAccessed?t-this.lastAccessed.getTime()+"ms":"?";return`Cookie="${this.toString()}; hostOnly=${e}; aAge=${i}; cAge=${r}"`}toJSON(){const t={};for(const e of lj.serializableProperties)this[e]!==uj[e]&&("expires"===e||"creation"===e||"lastAccessed"===e?null===this[e]?t[e]=null:t[e]="Infinity"==this[e]?"Infinity":this[e].toISOString():"maxAge"===e?null!==this[e]&&(t[e]=this[e]==1/0||this[e]==-1/0?this[e].toString():this[e]):this[e]!==uj[e]&&(t[e]=this[e]));return t}clone(){return aj(this.toJSON())}validate(){if(!PA.test(this.value))return!1;if(!(this.expires==1/0||this.expires instanceof Date||QA(this.expires)))return!1;if(null!=this.maxAge&&this.maxAge<=0)return!1;if(null!=this.path&&!$A.test(this.path))return!1;const t=this.cdomain();if(t){if(t.match(/\.$/))return!1;if(null==bE.getPublicSuffix(t))return!1}return!0}setExpires(t){t instanceof Date?this.expires=t:this.expires=QA(t)||"Infinity"}setMaxAge(t){this.maxAge=t===1/0||t===-1/0?t.toString():t}cookieString(){let t=this.value;return null==t&&(t=""),""===this.key?t:`${this.key}=${t}`}toString(){let t=this.cookieString();if(this.expires!=1/0&&(this.expires instanceof Date?t+=`; Expires=${XA(this.expires)}`:t+=`; Expires=${this.expires}`),null!=this.maxAge&&this.maxAge!=1/0&&(t+=`; Max-Age=${this.maxAge}`),this.domain&&!this.hostOnly&&(t+=`; Domain=${this.domain}`),this.path&&(t+=`; Path=${this.path}`),this.secure&&(t+="; Secure"),this.httpOnly&&(t+="; HttpOnly"),this.sameSite&&"none"!==this.sameSite){const e=lj.sameSiteCanonical[this.sameSite.toLowerCase()];t+=`; SameSite=${e||this.sameSite}`}return this.extensions&&this.extensions.forEach((e=>{t+=`; ${e}`})),t}TTL(t){if(null!=this.maxAge)return this.maxAge<=0?0:1e3*this.maxAge;let e=this.expires;return e!=1/0?(e instanceof Date||(e=QA(e)||1/0),e==1/0?1/0:e.getTime()-(t||Date.now())):1/0}expiryTime(t){if(null!=this.maxAge){const e=t||this.creation||new Date,r=this.maxAge<=0?-1/0:1e3*this.maxAge;return e.getTime()+r}return this.expires==1/0?1/0:this.expires.getTime()}expiryDate(t){const e=this.expiryTime(t);return e==1/0?new Date(FA):e==-1/0?new Date(0):new Date(e)}isPersistent(){return null!=this.maxAge||this.expires!=1/0}canonicalizedDomain(){return null==this.domain?null:tj(this.domain)}cdomain(){return this.canonicalizedDomain()}}function cj(t){if(null!=t){const e=t.toLowerCase();switch(e){case HA.STRICT:case HA.SILENT:case HA.DISABLED:return e}}return HA.SILENT}lj.cookiesCreated=0,lj.parse=nj,lj.fromJSON=aj,lj.serializableProperties=Object.keys(uj),lj.sameSiteLevel={strict:3,lax:2,none:1},lj.sameSiteCanonical={strict:"Strict",lax:"Lax"};class dj{constructor(t,e={rejectPublicSuffixes:!0}){"boolean"==typeof e&&(e={rejectPublicSuffixes:e}),SA.validate(SA.isObject(e),e),this.rejectPublicSuffixes=e.rejectPublicSuffixes,this.enableLooseMode=!!e.looseMode,this.allowSpecialUseDomain="boolean"!=typeof e.allowSpecialUseDomain||e.allowSpecialUseDomain,this.store=t||new CA,this.prefixSecurity=cj(e.prefixSecurity),this._cloneSync=fj("clone"),this._importCookiesSync=fj("_importCookies"),this.getCookiesSync=fj("getCookies"),this.getCookieStringSync=fj("getCookieString"),this.getSetCookieStringsSync=fj("getSetCookieStrings"),this.removeAllCookiesSync=fj("removeAllCookies"),this.setCookieSync=fj("setCookie"),this.serializeSync=fj("serialize")}setCookie(t,e,r,i){let n;if(SA.validate(SA.isUrlStringOrObject(e),i,r),SA.isFunction(e))return(i=e)(new Error("No URL was specified"));const o=hj(e);if(SA.isFunction(r)&&(i=r,r={}),SA.validate(SA.isFunction(i),i),!SA.isNonEmptyString(t)&&!SA.isObject(t)&&t instanceof String&&0==t.length)return i(null);const a=tj(o.hostname),s=r.loose||this.enableLooseMode;let h=null;if(r.sameSiteContext&&(h=VA(r.sameSiteContext),!h))return i(new Error(qA));if("string"==typeof t||t instanceof String){if(!(t=lj.parse(t,{loose:s})))return n=new Error("Cookie failed to parse"),i(r.ignoreError?null:n)}else if(!(t instanceof lj))return n=new Error("First argument to setCookie must be a Cookie object or string"),i(r.ignoreError?null:n);const u=r.now||new Date;if(this.rejectPublicSuffixes&&t.domain){if(null==bE.getPublicSuffix(t.cdomain(),{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:r.ignoreError})&&!KA.test(t.domain))return n=new Error("Cookie has domain set to a public suffix"),i(r.ignoreError?null:n)}if(t.domain){if(!ej(a,t.cdomain(),!1))return n=new Error(`Cookie not in this host's domain. Cookie:${t.cdomain()} Request:${a}`),i(r.ignoreError?null:n);null==t.hostOnly&&(t.hostOnly=!1)}else t.hostOnly=!0,t.domain=a;if(t.path&&"/"===t.path[0]||(t.path=rj(o.pathname),t.pathIsDefault=!0),!1===r.http&&t.httpOnly)return n=new Error("Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:n);if("none"!==t.sameSite&&void 0!==t.sameSite&&h&&"none"===h)return n=new Error("Cookie is SameSite but this is a cross-origin request"),i(r.ignoreError?null:n);const l=this.prefixSecurity===HA.SILENT;if(!(this.prefixSecurity===HA.DISABLED)){let e,n=!1;if(!function(t){return SA.validate(SA.isObject(t),t),!t.key.startsWith("__Secure-")||t.secure}(t)?(n=!0,e="Cookie has __Secure prefix but Secure attribute is not set"):function(t){return SA.validate(SA.isObject(t)),!t.key.startsWith("__Host-")||t.secure&&t.hostOnly&&null!=t.path&&"/"===t.path}(t)||(n=!0,e="Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'"),n)return i(r.ignoreError||l?null:new Error(e))}const c=this.store;c.updateCookie||(c.updateCookie=function(t,e,r){this.putCookie(e,r)}),c.findCookie(t.domain,t.path,t.key,(function(e,n){if(e)return i(e);const o=function(e){if(e)return i(e);i(null,t)};if(n){if(!1===r.http&&n.httpOnly)return e=new Error("old Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:e);t.creation=n.creation,t.creationIndex=n.creationIndex,t.lastAccessed=u,c.updateCookie(n,t,o)}else t.creation=t.lastAccessed=u,c.putCookie(t,o)}))}getCookies(t,e,r){SA.validate(SA.isUrlStringOrObject(t),r,t);const i=hj(t);SA.isFunction(e)&&(r=e,e={}),SA.validate(SA.isObject(e),r,e),SA.validate(SA.isFunction(r),r);const n=tj(i.hostname),o=i.pathname||"/";let a=e.secure;null!=a||!i.protocol||"https:"!=i.protocol&&"wss:"!=i.protocol||(a=!0);let s=0;if(e.sameSiteContext){const t=VA(e.sameSiteContext);if(s=lj.sameSiteLevel[t],!s)return r(new Error(qA))}let h=e.http;null==h&&(h=!0);const u=e.now||Date.now(),l=!1!==e.expire,c=!!e.allPaths,d=this.store;function f(t){if(t.hostOnly){if(t.domain!=n)return!1}else if(!ej(n,t.domain,!1))return!1;if(!c&&!zA(o,t.path))return!1;if(t.secure&&!a)return!1;if(t.httpOnly&&!h)return!1;if(s){if(lj.sameSiteLevel[t.sameSite||"none"]>s)return!1}return!(l&&t.expiryTime()<=u)||(d.removeCookie(t.domain,t.path,t.key,(()=>{})),!1)}d.findCookies(n,c?null:o,this.allowSpecialUseDomain,((t,i)=>{if(t)return r(t);i=i.filter(f),!1!==e.sort&&(i=i.sort(sj));const n=new Date;for(const t of i)t.lastAccessed=n;r(null,i)}))}getCookieString(...t){const e=t.pop();SA.validate(SA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.sort(sj).map((t=>t.cookieString())).join("; "))})),this.getCookies.apply(this,t)}getSetCookieStrings(...t){const e=t.pop();SA.validate(SA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.map((t=>t.toString())))})),this.getCookies.apply(this,t)}serialize(t){SA.validate(SA.isFunction(t),t);let e=this.store.constructor.name;SA.isObject(e)&&(e=null);const r={version:"tough-cookie@4.1.4",storeType:e,rejectPublicSuffixes:!!this.rejectPublicSuffixes,enableLooseMode:!!this.enableLooseMode,allowSpecialUseDomain:!!this.allowSpecialUseDomain,prefixSecurity:cj(this.prefixSecurity),cookies:[]};if(!this.store.getAllCookies||"function"!=typeof this.store.getAllCookies)return t(new Error("store does not support getAllCookies and cannot be serialized"));this.store.getAllCookies(((e,i)=>e?t(e):(r.cookies=i.map((t=>(delete(t=t instanceof lj?t.toJSON():t).creationIndex,t))),t(null,r))))}toJSON(){return this.serializeSync()}_importCookies(t,e){let r=t.cookies;if(!r||!Array.isArray(r))return e(new Error("serialized jar has no cookies array"));r=r.slice();const i=t=>{if(t)return e(t);if(!r.length)return e(t,this);let n;try{n=aj(r.shift())}catch(t){return e(t)}if(null===n)return i(null);this.store.putCookie(n,i)};i()}clone(t,e){1===arguments.length&&(e=t,t=null),this.serialize(((r,i)=>{if(r)return e(r);dj.deserialize(i,t,e)}))}cloneSync(t){if(0===arguments.length)return this._cloneSync();if(!t.synchronous)throw new Error("CookieJar clone destination store is not synchronous; use async API instead.");return this._cloneSync(t)}removeAllCookies(t){SA.validate(SA.isFunction(t),t);const e=this.store;if("function"==typeof e.removeAllCookies&&e.removeAllCookies!==TA.prototype.removeAllCookies)return e.removeAllCookies(t);e.getAllCookies(((r,i)=>{if(r)return t(r);if(0===i.length)return t(null);let n=0;const o=[];function a(e){if(e&&o.push(e),n++,n===i.length)return t(o.length?o[0]:null)}i.forEach((t=>{e.removeCookie(t.domain,t.path,t.key,a)}))}))}static deserialize(t,e,r){let i;if(3!==arguments.length&&(r=e,e=null),SA.validate(SA.isFunction(r),r),"string"==typeof t){if(i=oj(t),i instanceof Error)return r(i)}else i=t;const n=new dj(e,{rejectPublicSuffixes:i.rejectPublicSuffixes,looseMode:i.enableLooseMode,allowSpecialUseDomain:i.allowSpecialUseDomain,prefixSecurity:i.prefixSecurity});n._importCookies(i,(t=>{if(t)return r(t);r(null,n)}))}static deserializeSync(t,e){const r="string"==typeof t?JSON.parse(t):t,i=new dj(e,{rejectPublicSuffixes:r.rejectPublicSuffixes,looseMode:r.enableLooseMode});if(!i.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");return i._importCookiesSync(r),i}}function fj(t){return function(...e){if(!this.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");let r,i;if(this[t](...e,((t,e)=>{r=t,i=e})),r)throw r;return i}}dj.fromJSON=dj.deserializeSync,["_importCookies","clone","getCookies","getCookieString","getSetCookieStrings","removeAllCookies","serialize","setCookie"].forEach((t=>{dj.prototype[t]=OA(dj.prototype[t])})),dj.deserialize=OA(dj.deserialize);var mj=NA,pj=dj,gj=lj,yj=TA,wj=CA,vj=QA,bj=XA,kj=nj,Mj=aj,_j=ej,Ej=rj,Aj=zA,jj=bE.getPublicSuffix,xj=sj,Sj=EE.permuteDomain,Nj=function(t){if(SA.validate(SA.isString(t)),"/"===t)return["/"];const e=[t];for(;t.length>1;){const r=t.lastIndexOf("/");if(0===r)break;t=t.substr(0,r),e.push(t)}return e.push("/"),e},Ij=tj,Tj=HA,Cj=SA.ParameterError,zj={version:mj,CookieJar:pj,Cookie:gj,Store:yj,MemoryCookieStore:wj,parseDate:vj,formatDate:bj,parse:kj,fromJSON:Mj,domainMatch:_j,defaultPath:Ej,pathMatch:Aj,getPublicSuffix:jj,cookieCompare:xj,permuteDomain:Sj,permutePath:Nj,canonicalDomain:Ij,PrefixSecurityEnum:Tj,ParameterError:Cj},Oj=Object.freeze(Object.assign(Object.create(null),zj,{default:zj,version:mj,CookieJar:pj,Cookie:gj,Store:yj,MemoryCookieStore:wj,parseDate:vj,formatDate:bj,parse:kj,fromJSON:Mj,domainMatch:_j,defaultPath:Ej,pathMatch:Aj,getPublicSuffix:jj,cookieCompare:xj,permuteDomain:Sj,permutePath:Nj,canonicalDomain:Ij,PrefixSecurityEnum:Tj,ParameterError:Cj}));var Rj=function(t){if(Array.isArray(t))return t;if("string"!=typeof t)return[];var e,r,i,n,o,a=[],s=0;function h(){for(;s<t.length&&/\s/.test(t.charAt(s));)s+=1;return s<t.length}for(;s<t.length;){for(e=s,o=!1;h();)if(","===(r=t.charAt(s))){for(i=s,s+=1,h(),n=s;s<t.length&&"="!==(r=t.charAt(s))&&";"!==r&&","!==r;)s+=1;s<t.length&&"="===t.charAt(s)?(o=!0,s=n,a.push(t.substring(e,i)),e=s):s=i+1}else s+=1;(!o||s>=t.length)&&a.push(t.substring(e,t.length))}return a};const Pj=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);function Bj(t,e){}function Dj(t,e){t.headers.delete(e)}function $j(t,e){const r=t.headers;for(const t of Object.keys(r))t.toLowerCase()===e&&delete r[t]}const Lj=new Set([301,302,303,307,308]);async function Uj(t,e,r){switch(e.redirect??"follow"){case"error":throw new TypeError(`URI requested responded with a redirect and redirect mode is set to error: ${r.url}`);case"manual":return r;case"follow":break;default:throw new TypeError(`Invalid redirect option: ${e.redirect}`)}const i=r.headers.get("location");if(null===i)return r;const n=r.url,o=new URL(i,n).toString(),a=e.redirectCount??0,s=e.maxRedirect??20;if(a>=s)throw new TypeError(`Reached maximum redirect of ${s} for URL: ${n}`);const h=function(t){return null==t.headers?Bj:"function"==typeof t.headers.delete?Dj:$j}(e={...e,redirectCount:a+1});if(!function(t,e){const r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)}(n,o))for(const t of["authorization","www-authenticate","cookie","cookie2"])h(e,t);const u=e.body,l=e.body;if(303!==r.status&&null!=e.body&&("function"==typeof u.pipe||"function"==typeof l.pipeTo))throw new TypeError("Cannot follow redirect with body being a readable stream");return 303!==r.status&&(301!==r.status&&302!==r.status||"POST"!==e.method)||(e.method="GET",e.body=void 0,h(e,"content-length")),r.headers.has("referrer-policy")&&(e.referrerPolicy=function(t){const e=t.split(/[,\s]+/);let r="";for(const t of e)""!==t&&Pj.has(t)&&(r=t);return r}(r.headers.get("referrer-policy"))),await t(o,e)}function Fj(t,e,r=!0){const i=t,n=e??new pj;async function o(t,e){const a=e??{};e={...e,redirect:"manual"};const s="string"==typeof t?t:t.url??t.href;e=function(t,e,r){if(""===r)return e;const i=t,n=e.headers;return i.headers&&"function"==typeof i.headers.append?i.headers.append("cookie",r):n&&"function"==typeof n.append?n.append("cookie",r):e={...e,headers:{...e.headers,cookie:r}},e}(t,e,await n.getCookieString(s));const h=await i(t,e),u=function(t){const e=t.headers;if("function"==typeof e.getAll)return e.getAll("set-cookie");if("function"==typeof e.raw){const t=e.raw();return Array.isArray(t["set-cookie"])?t["set-cookie"]:[]}const r=t.headers.get("set-cookie");return null!==r?Rj(r):[]}(h);return await Promise.all(u.map((async t=>await n.setCookie(t,h.url,{ignoreError:r})))),(e.redirectCount??0)>0&&Object.defineProperty(h,"redirected",{value:!0}),l=h.status,Lj.has(l)?await Uj(o,a,h):h;var l}return o.toughCookie=Oj,o}Fj.toughCookie=Oj;var qj="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t||{},Vj="URLSearchParams"in qj,Hj="Symbol"in qj&&"iterator"in Symbol,Gj="FileReader"in qj&&"Blob"in qj&&function(){try{return new Blob,!0}catch(t){return!1}}(),Zj="FormData"in qj,Kj="ArrayBuffer"in qj;if(Kj)var Jj=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Wj=ArrayBuffer.isView||function(t){return t&&Jj.indexOf(Object.prototype.toString.call(t))>-1};function Yj(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function Qj(t){return"string"!=typeof t&&(t=String(t)),t}function Xj(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return Hj&&(e[Symbol.iterator]=function(){return e}),e}function tx(t){this.map={},t instanceof tx?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function ex(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function rx(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function ix(t){var e=new FileReader,r=rx(e);return e.readAsArrayBuffer(t),r}function nx(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function ox(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:Gj&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Zj&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Vj&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Kj&&Gj&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=nx(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Kj&&(ArrayBuffer.prototype.isPrototypeOf(t)||Wj(t))?this._bodyArrayBuffer=nx(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Vj&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Gj&&(this.blob=function(){var t=ex(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=ex(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(Gj)return this.blob().then(ix);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,i,n,o=ex(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=rx(e),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),n=i?i[1]:"utf-8",e.readAsText(t,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Zj&&(this.formData=function(){return this.text().then(hx)}),this.json=function(){return this.text().then(JSON.parse)},this}tx.prototype.append=function(t,e){t=Yj(t),e=Qj(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},tx.prototype.delete=function(t){delete this.map[Yj(t)]},tx.prototype.get=function(t){return t=Yj(t),this.has(t)?this.map[t]:null},tx.prototype.has=function(t){return this.map.hasOwnProperty(Yj(t))},tx.prototype.set=function(t,e){this.map[Yj(t)]=Qj(e)},tx.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},tx.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),Xj(t)},tx.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),Xj(t)},tx.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),Xj(t)},Hj&&(tx.prototype[Symbol.iterator]=tx.prototype.entries);var ax=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function sx(t,e){if(!(this instanceof sx))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,i,n=(e=e||{}).body;if(t instanceof sx){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new tx(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new tx(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),ax.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in qj)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function hx(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function ux(t,e){if(!(this instanceof ux))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new tx(e.headers),this.url=e.url||"",this._initBody(t)}sx.prototype.clone=function(){return new sx(this,{body:this._bodyInit})},ox.call(sx.prototype),ox.call(ux.prototype),ux.prototype.clone=function(){return new ux(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new tx(this.headers),url:this.url})},ux.error=function(){var t=new ux(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var lx=[301,302,303,307,308];ux.redirect=function(t,e){if(-1===lx.indexOf(e))throw new RangeError("Invalid status code");return new ux(null,{status:e,headers:{location:t}})};var cx=qj.DOMException;try{new cx}catch(wk){cx=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},cx.prototype=Object.create(Error.prototype),cx.prototype.constructor=cx}function dx(t,e){return new Promise((function(r,i){var n=new sx(t,e);if(n.signal&&n.signal.aborted)return i(new cx("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}if(o.onload=function(){var t,e,i={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new tx,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{e.append(i,n)}catch(t){console.warn("Response "+t.message)}}})),e)};0===n.url.indexOf("file://")&&(o.status<200||o.status>599)?i.status=200:i.status=o.status,i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var a="response"in o?o.response:o.responseText;setTimeout((function(){r(new ux(a,i))}),0)},o.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){i(new cx("Aborted","AbortError"))}),0)},o.open(n.method,function(t){try{return""===t&&qj.location.href?qj.location.href:t}catch(e){return t}}(n.url),!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&(Gj?o.responseType="blob":Kj&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof tx||qj.Headers&&e.headers instanceof qj.Headers)){var s=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){s.push(Yj(t)),o.setRequestHeader(t,Qj(e.headers[t]))})),n.headers.forEach((function(t,e){-1===s.indexOf(e)&&o.setRequestHeader(e,t)}))}else n.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));n.signal&&(n.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&n.signal.removeEventListener("abort",a)}),o.send(void 0===n._bodyInit?null:n._bodyInit)}))}dx.polyfill=!0,qj.fetch||(qj.fetch=dx,qj.Headers=tx,qj.Request=sx,qj.Response=ux);var fx=self.fetch.bind(self);const mx=(t,e,r=[])=>{const i=Object.getOwnPropertyDescriptors(e);for(let t of r)delete i[t];Object.defineProperties(t,i)},px=(t,e=[t])=>{const r=Object.getPrototypeOf(t);return null===r?e:px(r,[...e,r])},gx=(t,e,r=[])=>{var i;const n=null!==(i=((...t)=>{if(0===t.length)return;let e;const r=t.map((t=>px(t)));for(;r.every((t=>t.length>0));){const t=r.map((t=>t.pop())),i=t[0];if(!t.every((t=>t===i)))break;e=i}return e})(...t))&&void 0!==i?i:Object.prototype,o=Object.create(n),a=px(n);for(let e of t){let t=px(e);for(let e=t.length-1;e>=0;e--){let i=t[e];-1===a.indexOf(i)&&(mx(o,i,["constructor",...r]),a.push(i))}}return o.constructor=e,o},yx=t=>t.filter(((e,r)=>t.indexOf(e)==r)),wx=new WeakMap,vx=t=>wx.get(t),bx=(t,e)=>{var r,i;const n=yx([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]),o={};for(let a of n)o[a]=yx([...null!==(r=null==t?void 0:t[a])&&void 0!==r?r:[],...null!==(i=null==e?void 0:e[a])&&void 0!==i?i:[]]);return o},kx=(t,e)=>{var r,i,n,o;return{property:bx(null!==(r=null==t?void 0:t.property)&&void 0!==r?r:{},null!==(i=null==e?void 0:e.property)&&void 0!==i?i:{}),method:bx(null!==(n=null==t?void 0:t.method)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.method)&&void 0!==o?o:{})}},Mx=new Map,_x=(...t)=>{const e=((...t)=>{var e;const r=new Set,i=new Set([...t]);for(;i.size>0;)for(let t of i){const n=[...px(t.prototype).map((t=>t.constructor)),...null!==(e=vx(t))&&void 0!==e?e:[]].filter((t=>!r.has(t)));for(let t of n)i.add(t);r.add(t),i.delete(t)}return[...r]})(...t).map((t=>Mx.get(t))).filter((t=>!!t));return 0==e.length?{}:1==e.length?e[0]:e.reduce(((t,e)=>((t,e)=>{var r,i,n,o,a,s;return{class:yx([...null!==(r=null==t?void 0:t.class)&&void 0!==r?r:[],...null!==(i=null==e?void 0:e.class)&&void 0!==i?i:[]]),static:kx(null!==(n=null==t?void 0:t.static)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.static)&&void 0!==o?o:{}),instance:kx(null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{},null!==(s=null==e?void 0:e.instance)&&void 0!==s?s:{})}})(t,e)))};function Ex(...t){var e,r,i;const n=t.map((t=>t.prototype));function o(...e){for(const r of t)mx(this,new r(...e))}o.prototype=gx(n,o),Object.setPrototypeOf(o,gx(t,null,["prototype"]));let a=o;{const n=_x(...t);for(let t of null!==(e=null==n?void 0:n.class)&&void 0!==e?e:[]){const e=t(a);e&&(a=e)}Ax(null!==(r=null==n?void 0:n.static)&&void 0!==r?r:{},a),Ax(null!==(i=null==n?void 0:n.instance)&&void 0!==i?i:{},a.prototype)}var s,h;return s=a,h=t,wx.set(s,h),a}const Ax=(t,e)=>{const r=t.property,i=t.method;if(r)for(let t in r)for(let i of r[t])i(e,t);if(i)for(let t in i)for(let r of i[t])r(e,t,Object.getOwnPropertyDescriptor(e,t))};var jx=Object.defineProperty,xx=Object.getOwnPropertyDescriptor,Sx=Object.getOwnPropertyNames,Nx=Object.prototype.hasOwnProperty,Ix=(t,e)=>{for(var r in e)jx(t,r,{get:e[r],enumerable:!0})},Tx=(t,e,r,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of Sx(e))Nx.call(t,n)||n===r||jx(t,n,{get:()=>e[n],enumerable:!(i=xx(e,n))||i.enumerable});return t};Ix({},{ADDR_BOUND:()=>gS,API_VERSION:()=>fS,BaseUrl:()=>kS,DEFAULT_GLOBAL_CONFIG:()=>OS,FeeMarginPercentage:()=>AS,HARDENING_4BYTES:()=>zS,HARDENING_BYTE:()=>CS,IS_BROWSER:()=>Kx,MASK_250:()=>cS,MASK_31:()=>dS,MAX_STORAGE_ITEM_SIZE:()=>pS,NetworkName:()=>MS,OutsideExecutionCallerAny:()=>NS,PRIME:()=>mS,RANGE_FELT:()=>wS,RANGE_I128:()=>vS,RANGE_U128:()=>bS,RPC_DEFAULT_VERSION:()=>xS,RPC_NODES:()=>SS,SNIP9_V1_INTERFACE_ID:()=>IS,SNIP9_V2_INTERFACE_ID:()=>TS,SYSTEM_MESSAGES:()=>RS,StarknetChainId:()=>_S,TEXT_TO_FELT_MAX_LEN:()=>uS,TRANSACTION_VERSION:()=>Cx.ETransactionVersion,TransactionHashPrefix:()=>ES,UDC:()=>jS,ZERO:()=>lS});var Cx={};Ix(Cx,{JRPC:()=>zx,RPCSPEC06:()=>Ox,RPCSPEC07:()=>qm});var zx={},Ox={};Ix(Ox,{EBlockTag:()=>Fx,EDAMode:()=>Vx,EDataAvailabilityMode:()=>qx,ESimulationFlag:()=>Dx,ETransactionExecutionStatus:()=>Ux,ETransactionFinalityStatus:()=>Lx,ETransactionStatus:()=>$x,ETransactionType:()=>Bx,ETransactionVersion:()=>Hx,ETransactionVersion2:()=>Gx,ETransactionVersion3:()=>Zx,Errors:()=>Rx,SPEC:()=>Px});var Rx={},Px={},Bx={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},Dx={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},$x={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Lx={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Ux={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},Fx={PENDING:"pending",LATEST:"latest"},qx={L1:"L1",L2:"L2"},Vx={L1:0,L2:1},Hx={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},Gx={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},Zx={V3:"0x3",F3:"0x100000000000000000000000000000003"};((t,e,r)=>{Tx(t,e,"default"),r&&Tx(r,e,"default")})(Cx,qm);Ix({},{IS_BROWSER:()=>Kx,addHexPrefix:()=>rS,arrayBufferToString:()=>Jx,atobUniversal:()=>Qx,btoaUniversal:()=>Xx,buf2hex:()=>tS,calcByteLength:()=>nS,concatenateArrayBuffer:()=>hS,padLeft:()=>iS,pascalToSnake:()=>sS,removeHexPrefix:()=>eS,sanitizeBytes:()=>oS,sanitizeHex:()=>aS,stringToArrayBuffer:()=>Yx,utf8ToArray:()=>Wx});var Kx="undefined"!=typeof window;function Jx(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function Wx(t){return(new TextEncoder).encode(t)}function Yx(t){return Wx(t)}function Qx(t){return lp.decode(t)}function Xx(t){return lp.encode(new Uint8Array(t))}function tS(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function eS(t){return t.replace(/^0x/i,"")}function rS(t){return`0x${eS(t)}`}function iS(t,e,r="0"){return function(t,e,r,i="0"){const n=e-t.length;let o=t;if(n>0){const e=i.repeat(n);o=r?e+t:t+e}return o}(t,e,!0,r)}function nS(t,e=8){const{length:r}=t,i=r%e;return i?(r-i)/e*e+e:r}function oS(t,e=8,r="0"){return iS(t,nS(t,e),r)}function aS(t){const e=oS(eS(t),2);return e?rS(e):e}var sS=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function hS(t){const e=t.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(e);let i=0;return t.forEach((t=>{r.set(t,i),i+=t.byteLength})),r}var uS=31,lS=0n,cS=2n**250n-1n,dS=2n**31n-1n,fS=lS,mS=2n**251n+17n*2n**192n+1n,pS=256n,gS=2n**251n-pS,yS=(t,e)=>({min:t,max:e}),wS=yS(lS,mS-1n),vS=yS(-(2n**127n),2n**127n-1n),bS=yS(lS,2n**128n-1n),kS=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_SEPOLIA="https://alpha-sepolia.starknet.io",t))(kS||{}),MS=(t=>(t.SN_MAIN="SN_MAIN",t.SN_SEPOLIA="SN_SEPOLIA",t))(MS||{}),_S=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_SEPOLIA="0x534e5f5345504f4c4941",t))(_S||{}),ES=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(ES||{}),AS=(t=>(t[t.L1_BOUND_MAX_AMOUNT=50]="L1_BOUND_MAX_AMOUNT",t[t.L1_BOUND_MAX_PRICE_PER_UNIT=50]="L1_BOUND_MAX_PRICE_PER_UNIT",t[t.MAX_FEE=50]="MAX_FEE",t))(AS||{}),jS={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},xS="v0_7",SS={SN_MAIN:[`https://starknet-mainnet.public.blastapi.io/rpc/${xS}`,`https://free-rpc.nethermind.io/mainnet-juno/${xS}`],SN_SEPOLIA:[`https://starknet-sepolia.public.blastapi.io/rpc/${xS}`,`https://free-rpc.nethermind.io/sepolia-juno/${xS}`]},NS="0x414e595f43414c4c4552",IS="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",TS="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",CS=128,zS=2147483648n,OS={legacyMode:!1,logLevel:"INFO",accountTxVersion:Cx.ETransactionVersion.V2},RS={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"},PS={};Ix(PS,{RpcChannel:()=>qC});Ix({},{parse:()=>DS,parseAlwaysAsBig:()=>$S,stringify:()=>LS,stringifyAlwaysAsBig:()=>US});var BS=t=>{if(!yp(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},DS=t=>zp(String(t),void 0,BS),$S=t=>zp(String(t),void 0,Ip),LS=(t,e,r,i)=>dg(t,e,r,i),US=LS,FS={FAILED_TO_RECEIVE_TXN:1,NO_TRACE_AVAILABLE:10,CONTRACT_NOT_FOUND:20,BLOCK_NOT_FOUND:24,INVALID_TXN_INDEX:27,CLASS_HASH_NOT_FOUND:28,TXN_HASH_NOT_FOUND:29,PAGE_SIZE_TOO_BIG:31,NO_BLOCKS:32,INVALID_CONTINUATION_TOKEN:33,TOO_MANY_KEYS_IN_FILTER:34,CONTRACT_ERROR:40,TRANSACTION_EXECUTION_ERROR:41,CLASS_ALREADY_DECLARED:51,INVALID_TRANSACTION_NONCE:52,INSUFFICIENT_MAX_FEE:53,INSUFFICIENT_ACCOUNT_BALANCE:54,VALIDATION_FAILURE:55,COMPILATION_FAILED:56,CONTRACT_CLASS_SIZE_IS_TOO_LARGE:57,NON_ACCOUNT:58,DUPLICATE_TX:59,COMPILED_CLASS_HASH_MISMATCH:60,UNSUPPORTED_TX_VERSION:61,UNSUPPORTED_CONTRACT_CLASS_VERSION:62,UNEXPECTED_ERROR:63};var qS=class extends Error{name;constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){const{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){const{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},VS=class extends qS{},HS=class extends VS{constructor(t,e,r){super(`RPC: ${e} with params ${LS(r,null,2)}\n\n ${t.code}: ${t.message}: ${LS(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return FS[t]===this.code}};Ix({},{BlockStatus:()=>YS,BlockTag:()=>QS,ETH_ADDRESS:()=>rN,EntryPointType:()=>GS,Literal:()=>eN,NON_ZERO_PREFIX:()=>iN,OutsideExecutionTypesV1:()=>nN,OutsideExecutionTypesV2:()=>oN,OutsideExecutionVersion:()=>aN,RPC:()=>Cx,TransactionExecutionStatus:()=>WS,TransactionFinalityStatus:()=>JS,TransactionStatus:()=>KS,TransactionType:()=>ZS,TypedDataRevision:()=>Um,Uint:()=>tN,ValidateType:()=>XS});var GS={EXTERNAL:"EXTERNAL",L1_HANDLER:"L1_HANDLER",CONSTRUCTOR:"CONSTRUCTOR"},ZS={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE_FUNCTION"},KS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",REJECTED:"REJECTED",REVERTED:"REVERTED"},JS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},WS={REJECTED:"REJECTED",REVERTED:"REVERTED",SUCCEEDED:"SUCCEEDED"},YS={PENDING:"PENDING",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",REJECTED:"REJECTED"},QS={PENDING:"pending",LATEST:"latest"},XS={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},tN={u8:"core::integer::u8",u16:"core::integer::u16",u32:"core::integer::u32",u64:"core::integer::u64",u128:"core::integer::u128",u256:"core::integer::u256",u512:"core::integer::u512"},eN={ClassHash:"core::starknet::class_hash::ClassHash",ContractAddress:"core::starknet::contract_address::ContractAddress",Secp256k1Point:"core::starknet::secp256k1::Secp256k1Point",U96:"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"},rN="core::starknet::eth_address::EthAddress",iN="core::zeroable::NonZero::",nN={StarkNetDomain:[{name:"name",type:"felt"},{name:"version",type:"felt"},{name:"chainId",type:"felt"}],OutsideExecution:[{name:"caller",type:"felt"},{name:"nonce",type:"felt"},{name:"execute_after",type:"felt"},{name:"execute_before",type:"felt"},{name:"calls_len",type:"felt"},{name:"calls",type:"OutsideCall*"}],OutsideCall:[{name:"to",type:"felt"},{name:"selector",type:"felt"},{name:"calldata_len",type:"felt"},{name:"calldata",type:"felt*"}]},oN={StarknetDomain:[{name:"name",type:"shortstring"},{name:"version",type:"shortstring"},{name:"chainId",type:"shortstring"},{name:"revision",type:"shortstring"}],OutsideExecution:[{name:"Caller",type:"ContractAddress"},{name:"Nonce",type:"felt"},{name:"Execute After",type:"u128"},{name:"Execute Before",type:"u128"},{name:"Calls",type:"Call*"}],Call:[{name:"To",type:"ContractAddress"},{name:"Selector",type:"selector"},{name:"Calldata",type:"felt*"}]},aN=(t=>(t.UNSUPPORTED="0",t.V1="1",t.V2="2",t))(aN||{}),sN=class{nodeUrl;headers;interval;requestId=0;pendingRequests={};batchPromises={};delayTimer;delayPromise;delayPromiseResolve;baseFetch;constructor(t){this.nodeUrl=t.nodeUrl,this.headers=t.headers,this.interval=t.interval,this.baseFetch=t.baseFetch}async wait(){return this.delayPromise&&this.delayPromiseResolve||(this.delayPromise=new Promise((t=>{this.delayPromiseResolve=t}))),this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=void 0),this.delayTimer=setTimeout((()=>{this.delayPromiseResolve&&(this.delayPromiseResolve(),this.delayPromise=void 0,this.delayPromiseResolve=void 0)}),this.interval),this.delayPromise}addPendingRequest(t,e,r){const i={id:r??`batched_${this.requestId+=1}`,jsonrpc:"2.0",method:t,params:e??void 0};return this.pendingRequests[i.id]=i,i.id}async sendBatch(t){return(await this.baseFetch(this.nodeUrl,{method:"POST",body:LS(t),headers:this.headers})).json()}async fetch(t,e,r){const i=this.addPendingRequest(t,e,r);await this.wait();const n=this.pendingRequests;if(this.pendingRequests={},!this.batchPromises[i]){const t=this.sendBatch(Object.values(n));Object.keys(n).forEach((e=>{this.batchPromises[e]=t}))}const o=await this.batchPromises[i];delete this.batchPromises[i];const a=o.find((t=>t.id===i));if(!a)throw new Error(`Couldn't find the result for the request. Method: ${t}`);return a}};function hN(t,e){if(!t)throw new Error(e||"Assertion failure")}var uN={};Ix(uN,{addPercent:()=>zN,assertInRange:()=>EN,bigNumberishArrayToDecimalStringArray:()=>AN,bigNumberishArrayToHexadecimalStringArray:()=>jN,cleanHex:()=>_N,getDecimalString:()=>SN,getHexString:()=>NN,getHexStringArray:()=>IN,hexToBytes:()=>CN,hexToDecimalString:()=>MN,isBigNumberish:()=>RN,isHex:()=>gN,isStringWholeNumber:()=>xN,stringToSha256ToArrayBuff4:()=>ON,toBigInt:()=>yN,toCairoBool:()=>TN,toHex:()=>wN,toHex64:()=>kN,toHexString:()=>vN,toStorageKey:()=>bN});var lN=t=>void 0===t||void 0===t;function cN(t){return"number"==typeof t}function dN(t){return"boolean"==typeof t}function fN(t){return"bigint"==typeof t}function mN(t){return"string"==typeof t}function pN(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function gN(t){return/^0x[0-9a-f]*$/i.test(t)}function yN(t){return BigInt(t)}function wN(t){return rS(yN(t).toString(16))}var vN=wN;function bN(t){return rS(yN(t).toString(16).padStart(64,"0"))}function kN(t){const e=rS(yN(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function MN(t){return BigInt(rS(t)).toString(10)}function _N(t){return t.toLowerCase().replace(/^(0x)0+/,"$1")}function EN(t,e,r,i=""){const n=""===i?"invalid length":`invalid ${i} length`,o=BigInt(t),a=BigInt(e),s=BigInt(r);hN(o>=a&&o<=s,`Message not signable, ${n}.`)}function AN(t){return t.map((t=>yN(t).toString(10)))}function jN(t){return t.map((t=>wN(t)))}function xN(t){return/^\d+$/.test(t)}function SN(t){if(gN(t))return MN(t);if(xN(t))return t;throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function NN(t){if(gN(t))return t;if(xN(t))return vN(t);throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function IN(t){return t.map(NN)}function TN(t){return(+t).toString()}function CN(t){if(!gN(t))throw new Error(`${t} needs to be a hex-string`);let e=eS(t);return e.length%2!=0&&(e=`0${e}`),Ig(e)}function zN(t,e){const r=BigInt(t);return r+r*BigInt(e)/100n}function ON(t){var e;return CN(wN((e=BigInt(rS(tS(py(t)))),Number(e&dS))))}function RN(t){return cN(t)||fN(t)||mN(t)&&(gN(t)||xN(t))}function PN(t){const e=eS(wN(BigInt(t))),r=e.length%2==0?e:`0${e}`;return rS(_v(CN(rS(r))).toString(16))}function BN(t){const e=BigInt(function(t){return rS(_v(Wx(t)).toString(16))}(t));return e&cS}function DN(t){return wN(BN(t))}function $N(t){return cN(t)||fN(t)?wN(t):gN(t)?t:xN(t)?wN(t):DN(t)}function LN(t){const e=rS(t.reduce(((t,e)=>t+eS(wN(e)).padStart(64,"0")),""));return rS(bg(Yv(CN(e))))}function UN(t,e,r,i,n){return LN([t,e,n,r,i.length,...i])}Ix({},{getL2MessageHash:()=>UN,getSelector:()=>$N,getSelectorFromName:()=>DN,keccakBn:()=>PN,solidityUint256PackedKeccak256:()=>LN,starknetKeccak:()=>BN});var FN={};function qN(t){return/^[\x00-\x7F]*$/.test(t)}function VN(t){return t.length<=uS}function HN(t){return/^[0-9]*$/i.test(t)}function GN(t){return mN(t)&&!gN(t)&&!xN(t)}Ix(FN,{decodeShortString:()=>YN,encodeShortString:()=>WN,isASCII:()=>qN,isDecimalString:()=>HN,isLongText:()=>KN,isShortString:()=>VN,isShortText:()=>ZN,isText:()=>GN,splitLongString:()=>JN});var ZN=t=>GN(t)&&VN(t),KN=t=>GN(t)&&!VN(t);function JN(t){const e=RegExp(`[^]{1,${uS}}`,"g");return t.match(e)||[]}function WN(t){if(!qN(t))throw new Error(`${t} is not an ASCII string`);if(!VN(t))throw new Error(`${t} is too long`);return rS(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function YN(t){if(!qN(t))throw new Error(`${t} is not an ASCII string`);if(gN(t))return eS(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(HN(t))return YN("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}function QN(t){const e=0n===BigInt(t.pending_word)?"":YN(wN(t.pending_word));return t.data.reduce(((t,e)=>t+(0n===BigInt(e)?"":YN(wN(e)))),"")+e}function XN(t){const e=JN(t),r=e[e.length-1],i=e.map(WN),[n,o]=void 0===r||31===r.length?["0x00",0]:[i.pop(),r.length];return{data:0===i.length?[]:i,pending_word:n,pending_word_len:o}}Ix({},{byteArrayFromString:()=>XN,stringFromByteArray:()=>QN});function tI(t){if(fN(t)||Number.isInteger(t))return t.toString();if(mN(t)){if(gN(t))return BigInt(t).toString();if(GN(t)){if(!VN(t))throw new Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(WN(t)).toString()}if(xN(t))return t}if(dN(t))return""+ +t;throw new Error(`${t} can't be computed by felt()`)}Ix({},{felt:()=>LI,getAbiContractVersion:()=>PI,getArrayType:()=>zI,isCairo1Abi:()=>OI,isCairo1Type:()=>CI,isLen:()=>fI,isTypeArray:()=>pI,isTypeBool:()=>AI,isTypeByteArray:()=>NI,isTypeBytes31:()=>SI,isTypeContractAddress:()=>jI,isTypeEnum:()=>vI,isTypeEthAddress:()=>xI,isTypeFelt:()=>mI,isTypeLiteral:()=>EI,isTypeNamedTuple:()=>yI,isTypeNonZero:()=>RI,isTypeOption:()=>bI,isTypeResult:()=>kI,isTypeSecp256k1Point:()=>TI,isTypeStruct:()=>wI,isTypeTuple:()=>gI,isTypeU96:()=>II,isTypeUint:()=>MI,isTypeUint256:()=>_I,tuple:()=>$I,uint256:()=>BI,uint512:()=>DI});var eI=(1n<<128n)-1n,rI=(1n<<256n)-1n,iI=0n,nI=340282366920938463463374607431768211455n,oI=340282366920938463463374607431768211455n,aI=0n,sI=0n,hI=class t{low;high;static abiSelector="core::integer::u256";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"low"in e[0]&&"high"in e[0]){const r=t.validateProps(e[0].low,e[0].high);this.low=r.low,this.high=r.high}else if(1===e.length){const r=t.validate(e[0]);this.low=r&eI,this.high=r>>128n}else{if(2!==e.length)throw Error("Incorrect constructor parameters");{const r=t.validateProps(e[0],e[1]);this.low=r.low,this.high=r.high}}}static validate(t){const e=BigInt(t);if(e<iI)throw Error("bigNumberish is smaller than UINT_256_MIN");if(e>rI)throw new Error("bigNumberish is bigger than UINT_256_MAX");return e}static validateProps(t,e){const r=BigInt(t),i=BigInt(e);if(r<aI||r>nI)throw new Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX");if(i<sI||i>oI)throw new Error("high is out of range UINT_256_HIGH_MIN - UINT_256_HIGH_MAX");return{low:r,high:i}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.high<<128n)+this.low}toUint256HexString(){return{low:rS(this.low.toString(16)),high:rS(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[tI(this.low),tI(this.high)]}},uI=(1n<<512n)-1n,lI=0n,cI=0n,dI=class t{limb0;limb1;limb2;limb3;static abiSelector="core::integer::u512";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"limb0"in e[0]&&"limb1"in e[0]&&"limb2"in e[0]&&"limb3"in e[0]){const r=t.validateProps(e[0].limb0,e[0].limb1,e[0].limb2,e[0].limb3);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}else if(1===e.length){const r=t.validate(e[0]);this.limb0=r&eI,this.limb1=(r&eI<<128n)>>128n,this.limb2=(r&eI<<256n)>>256n,this.limb3=r>>384n}else{if(4!==e.length)throw Error("Incorrect Uint512 constructor parameters");{const r=t.validateProps(e[0],e[1],e[2],e[3]);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}}}static validate(t){const e=BigInt(t);if(e<lI)throw Error("bigNumberish is smaller than UINT_512_MIN.");if(e>uI)throw Error("bigNumberish is bigger than UINT_512_MAX.");return e}static validateProps(t,e,r,i){const n=BigInt(t),o=BigInt(e),a=BigInt(r),s=BigInt(i);return[n,o,a,s].forEach(((t,e)=>{if(t<cI||t>eI)throw Error(`limb${e} is not in the range of a u128 number`)})),{limb0:n,limb1:o,limb2:a,limb3:s}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.limb3<<384n)+(this.limb2<<256n)+(this.limb1<<128n)+this.limb0}toUint512HexString(){return{limb0:rS(this.limb0.toString(16)),limb1:rS(this.limb1.toString(16)),limb2:rS(this.limb2.toString(16)),limb3:rS(this.limb3.toString(16))}}toUint512DecimalString(){return{limb0:this.limb0.toString(10),limb1:this.limb1.toString(10),limb2:this.limb2.toString(10),limb3:this.limb3.toString(10)}}toApiRequest(){return[tI(this.limb0),tI(this.limb1),tI(this.limb2),tI(this.limb3)]}},fI=t=>/_len$/.test(t),mI=t=>"felt"===t||"core::felt252"===t,pI=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),gI=t=>/^\(.*\)$/i.test(t),yI=t=>/\(.*\)/i.test(t)&&t.includes(":"),wI=(t,e)=>t in e,vI=(t,e)=>t in e,bI=t=>t.startsWith("core::option::Option::"),kI=t=>t.startsWith("core::result::Result::"),MI=t=>Object.values(tN).includes(t),_I=t=>hI.isAbiType(t),EI=t=>Object.values(eN).includes(t),AI=t=>"core::bool"===t,jI=t=>t===eN.ContractAddress,xI=t=>t===rN,SI=t=>"core::bytes_31::bytes31"===t,NI=t=>"core::byte_array::ByteArray"===t,II=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,TI=t=>t===eN.Secp256k1Point,CI=t=>t.includes("::"),zI=t=>CI(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function OI(t){const{cairo:e}=PI(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function RI(t){return t.startsWith(iN)}function PI(t){if(t.find((t=>"interface"===t.type)))return{cairo:"1",compiler:"2"};const e=t.find((t=>("function"===t.type||"constructor"===t.type)&&(t.inputs.length||t.outputs.length)));if(!e)return{cairo:void 0,compiler:void 0};const r=e.inputs.length?e.inputs:e.outputs;return CI(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var BI=t=>new hI(t).toUint256DecimalString(),DI=t=>new dI(t).toUint512DecimalString(),$I=(...t)=>({...t});function LI(t){return tI(t)}var UI=class{variant;constructor(t){const e=Object.values(t);if(0===e.length)throw new Error("This Enum must have at least 1 variant");if(1!==e.filter((t=>!lN(t))).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find((t=>!lN(t)))}activeVariant(){const t=Object.entries(this.variant).find((t=>!lN(t[1])));return lN(t)?"":t[0]}},FI={Some:0,None:1},qI=class{Some;None;constructor(t,e){if(!(t in Object.values(FI)))throw new Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===FI.Some){if(lN(e))throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){return this.None?void 0:this.Some}isSome(){return!lN(this.Some)}isNone(){return!0===this.None}},VI={Ok:0,Err:1},HI=class{Ok;Err;constructor(t,e){if(!(t in Object.values(VI)))throw new Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===VI.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!lN(this.Ok))return this.Ok;if(!lN(this.Err))return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!lN(this.Ok)}isErr(){return!lN(this.Err)}},GI=(t,e,r)=>{if(!fN(t[r]))throw new Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},ZI=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function KI(t,e,r){return Object.entries(t).reduce(((i,[n,o])=>{const a=r??e[n];if(!(n in e)&&!r)return i[n]=o,i;if("string"===a){if(Array.isArray(t[n])){const e=KI(t[n],t[n].map((t=>a)));return i[n]=Object.values(e).join(""),i}return GI(t,e,n),i[n]=YN(o),i}if("number"===a)return GI(t,e,n),i[n]=Number(o),i;if("function"==typeof a)return i[n]=a(o),i;if(Array.isArray(a)){const e=KI(t[n],a,a[0]);return i[n]=Object.values(e),i}return pN(a)?(i[n]=KI(t[n],a),i):(ZI(t,e,n),i)}),{})}function JI(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:OI(t)?1:0}(t);if(0===e||1===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.reduce(((t,e)=>fI(e.name)?t:t+1),0)}getMethod(t){return this.abi.find((e=>e.name===t))}getLegacyFormat(){return this.abi}}(t);if(2===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.length}getMethod(t){return this.abi.find((t=>"interface"===t.type))?.items?.find((e=>e.name===t))}getLegacyFormat(){return this.abi.flatMap((t=>"interface"===t.type?t.items:t))}}(t);throw Error(`Unsupported ABI version ${e}`)}function WI(t,e,r){return"constructor"===t&&!r&&!e.length}function YI(t,e,r){for(let i=0,n=0;i<t.length;i++)if(t[i]===e)n++;else if(t[i]===r&&0==--n)return i;return Number.POSITIVE_INFINITY}function QI(t){return CI(t)?function(t){const e=t.slice(1,-1),r=[];let i,n=0;for(;n<e.length;){switch(!0){case"("===e[n]:i=n+YI(e.slice(n),"(",")")+1;break;case e.startsWith("core::result::Result::<",n)||e.startsWith("core::array::Array::<",n)||e.startsWith("core::option::Option::<",n):i=n+YI(e.slice(n),"<",">")+1;break;default:{const t=e.indexOf(",",n);i=-1!==t?t:Number.POSITIVE_INFINITY}}r.push(e.slice(n,i)),n=i+2}return r}(t):function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:i}=function(t){if(!t.includes("("))return{subTuple:[],result:t};const e=[];let r="",i=0;for(;i<t.length;){if("("===t[i]){let n=1;const o=i;for(i++;n;)")"===t[i]&&n--,"("===t[i]&&n++,i++;e.push(t.substring(o,i)),r+=" ",i--}else r+=t[i];i++}return{subTuple:e,result:r}}(e);let n=i.split(",").map((t=>r.length?t.replace(" ",r.shift()):t));return yI(t)&&(n=n.reduce(((t,e)=>t.concat(function(t){const e=t.substring(0,t.indexOf(":"));return{name:e,type:t.substring(e.length+":".length)}}(e))),[])),n}(t)}var XI=class t{content;arrayType;constructor(e,r){hN(t.isTypeFixedArray(r),`The type ${r} is not a Cairo fixed array. Needs [type; length].`);try{t.getFixedArrayType(r)}catch{throw new Error(`The type ${r} do not includes any content type. Needs [type; length].`)}try{t.getFixedArraySize(r)}catch{throw new Error(`The type ${r} type do not includes any length. Needs [type; length].`)}hN(t.getFixedArraySize(r)===e.length,`The ABI type ${r} is expecting ${t.getFixedArraySize(r)} items. ${e.length} items provided.`),this.content=e,this.arrayType=r}static getFixedArraySize(t){const e=t.match(/(?<=; )\d+(?=\])/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid number after ';' character.`);return Number(e[0])}getFixedArraySize(){return t.getFixedArraySize(this.arrayType)}static getFixedArrayType=t=>{const e=t.match(/(?<=\[).+(?=;)/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid type of data.`);return e[0]};getFixedArrayType(){return t.getFixedArrayType(this.arrayType)}static compile(t){return t.reduce(((t,e,r)=>(t[r]=e,t)),{})}compile(){return t.compile(this.content)}static isTypeFixedArray(t){return/^\[.*;\s.*\]$/.test(t)&&/(?<=\[).+(?=;)/.test(t)&&/(?<=; )\d+(?=\])/.test(t)}};function tT(t,e,r,i){const n=(t,e)=>{if(XI.isTypeFixedArray(e))return function(t,e){const r=XI.getFixedArrayType(e),i=XI.getFixedArraySize(e);if(Array.isArray(t)){if(i!==t.length)throw new Error(`ABI type ${e}: array provided do not includes ${i} items. ${t.length} items provided.`);return t.map((t=>n(t,r)))}if(i!==Object.keys(t).length)throw new Error(`ABI type ${e}: object provided do not includes ${i} properties. ${Object.keys(t).length} items provided.`);return n(t,r)}(t,e);if(pI(e))return function(t,e){const r=zI(e);if(mN(t))return t;return t.map((t=>n(t,r)))}(t,e);if(vI(e,i)){const r=i[e];return a(t,r)}if(gI(e))return function(t,e){const r=QI(e).reduce(((e,r,i)=>{const o=Object.keys(t),a=r=>Object.defineProperty(e,i.toString(),{enumerable:!0,value:r??t[o[i]]}),s=r?.type?r.type:r;return a(n(t[o[i]],s)),e}),{});return r}(t,e);if(xI(e))return t;if(RI(e))return t;if(NI(e))return t;if(II(e))return t;if(TI(e))return t;if(hI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!("low"in r)||!("high"in r))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint256 object without the 'low' and 'high' keys.`)}(e);return{low:r.low,high:r.high}}if(dI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!["limb0","limb1","limb2","limb3"].every((t=>t in r)))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint512 object without the 'limb0' to 'limb3' keys.`)}(e);return{limb0:r.limb0,limb1:r.limb1,limb2:r.limb2,limb3:r.limb3}}if(wI(e,r)){const i=r[e].members;return o(t,i)}return t},o=(t,e)=>e.reduce(((e,r)=>{if("undefined"===t[r.name]&&(CI(r.type)||!fI(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);var i;return i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i??t[r.name]}),e}),{});const a=(t,e)=>{if(kI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),o=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return r.isOk()?new HI(VI.Ok,n(t.unwrap(),i)):new HI(VI.Err,n(t.unwrap(),o))}if(bI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new qI(FI.Some,n(r.unwrap(),i)):new qI(FI.None,{})}const r=t,i=Object.entries(r.variant).map((t=>{if(lN(t[1]))return t;const i=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===i?t:[t[0],n(r.unwrap(),i)]}));return new UI(Object.fromEntries(i))};return e.reduce(((e,r)=>{return fI(r.name)&&!CI(r.type)||(i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i})),e;var i}),{})}function eT(t,e){switch(!0){case hI.isAbiType(t):return new hI(e).toApiRequest();case dI.isAbiType(t):return new dI(e).toApiRequest();case SI(t):return WN(e.toString());case TI(t):{const t=eS(wN(e)).padStart(128,"0"),r=BI(rS(t.slice(-64))),i=BI(rS(t.slice(0,-64)));return[LI(i.low),LI(i.high),LI(r.low),LI(r.high)]}default:return LI(e)}}function rT(t,e,r,i){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(XI.isTypeFixedArray(e)){const n=XI.getFixedArrayType(e);let o=[];if(Array.isArray(t)){o=new XI(t,e).content}else{if("object"!=typeof t)throw new Error(`ABI type ${e}: not an Array representing a cairo.fixedArray() provided.`);o=Object.values(t),hN(o.length===XI.getFixedArraySize(e),`ABI type ${e}: object provided do not includes ${XI.getFixedArraySize(e)} items. ${o.length} items provided.`)}return o.reduce(((t,e)=>t.concat(rT(e,n,r,i))),[])}if(Array.isArray(t)){const n=[];n.push(LI(t.length));const o=zI(e);return t.reduce(((t,e)=>t.concat(rT(e,o,r,i))),n)}if(r[e]&&r[e].members.length){if(hI.isAbiType(e))return new hI(t).toApiRequest();if(dI.isAbiType(e))return new dI(t).toApiRequest();if(xI(e))return eT(e,t);if(NI(e))return function(t){const e=XN(t);return[e.data.length.toString(),...e.data.map((t=>t.toString())),e.pending_word.toString(),e.pending_word_len.toString()]}(t);const{members:n}=r[e],o=t;return n.reduce(((t,e)=>t.concat(rT(o[e.name],e.type,r,i))),[])}if(gI(e)){const n=function(t,e){const r=QI(e),i=Object.values(t);if(i.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.\n provided: ${i}\n expected: ${r}`);return r.map(((t,e)=>({element:i[e],type:t.type??t})))}(t,e);return n.reduce(((t,e)=>{const n=rT(e.element,e.type,r,i);return t.concat(n)}),[])}if(hI.isAbiType(e))return new hI(t).toApiRequest();if(dI.isAbiType(e))return new dI(t).toApiRequest();if(vI(e,i)){const{variants:n}=i[e];if(bI(e)){const e=t;if(e.isSome()){const t=n.find((t=>"Some"===t.name));if(lN(t))throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return FI.Some.toString();const a=rT(e.unwrap(),o,r,i);return Array.isArray(a)?[FI.Some.toString(),...a]:[FI.Some.toString(),a]}return FI.None.toString()}if(kI(e)){const e=t;if(e.isOk()){const t=n.find((t=>"Ok"===t.name));if(lN(t))throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return VI.Ok.toString();const a=rT(e.unwrap(),o,r,i);return Array.isArray(a)?[VI.Ok.toString(),...a]:[VI.Ok.toString(),a]}const o=n.find((t=>"Err"===t.name));if(lN(o))throw Error("Error in abi : Result has no 'Err' variant.");const a=o.type;if("()"===a)return VI.Err.toString();const s=rT(e.unwrap(),a,r,i);return Array.isArray(s)?[VI.Err.toString(),...s]:[VI.Err.toString(),s]}const o=t,a=o.activeVariant(),s=n.find((t=>t.name===a));if(lN(s))throw Error(`Not find in abi : Enum has no '${a}' variant.`);const h=s.type,u=n.findIndex((t=>t.name===a));if("()"===h)return u.toString();const l=rT(o.unwrap(),h,r,i);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if(RI(e))return eT(zI(e),t);if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return eT(e,t)}function iT(t,e){let r;switch(!0){case AI(t):return r=e.next().value,Boolean(BigInt(r));case hI.isAbiType(t):const i=e.next().value,n=e.next().value;return new hI(i,n).toBigInt();case dI.isAbiType(t):const o=e.next().value,a=e.next().value,s=e.next().value,h=e.next().value;return new dI(o,a,s,h).toBigInt();case xI(t):return r=e.next().value,BigInt(r);case SI(t):return r=e.next().value,YN(r);case TI(t):const u=eS(e.next().value).padStart(32,"0"),l=eS(e.next().value).padStart(32,"0"),c=eS(e.next().value).padStart(32,"0"),d=eS(e.next().value).padStart(32,"0");return BigInt(rS(l+u+d+c));default:return r=e.next().value,BigInt(r)}}function nT(t,e,r,i){if("()"===e.type)return{};if(hI.isAbiType(e.type)){const e=t.next().value,r=t.next().value;return new hI(e,r).toBigInt()}if(dI.isAbiType(e.type)){const e=t.next().value,r=t.next().value,i=t.next().value,n=t.next().value;return new dI(e,r,i,n).toBigInt()}if(NI(e.type)){const e=[],r=BigInt(t.next().value);for(;e.length<r;)e.push(wN(t.next().value));return QN({data:e,pending_word:wN(t.next().value),pending_word_len:BigInt(t.next().value)})}if(XI.isTypeFixedArray(e.type)){const n=[],o={name:"",type:XI.getFixedArrayType(e.type)},a=XI.getFixedArraySize(e.type);for(;n.length<a;)n.push(nT(t,o,r,i));return n}if(pI(e.type)){const n=[],o={name:"",type:zI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(nT(t,o,r,i));return n}if(RI(e.type)){const n={name:"",type:zI(e.type)};return nT(t,n,r,i)}if(r&&e.type in r&&r[e.type])return xI(e.type)?iT(e.type,t):r[e.type].members.reduce(((e,n)=>(e[n.name]=nT(t,n,r,i),e)),{});if(i&&e.type in i&&i[e.type]){const n=Number(t.next().value),o=i[e.type].variants.reduce(((e,o,a)=>a===n?(e[o.name]=nT(t,{name:"",type:o.type},r,i),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=n===FI.Some?o.Some:void 0;return new qI(n,t)}if(e.type.startsWith("core::result::Result")){let t;return t=n===VI.Ok?o.Ok:o.Err,new HI(n,t)}return new UI(o)}if(gI(e.type)){return QI(e.type).reduce(((e,n,o)=>{const a=n?.name?n.name:o,s={name:a,type:n?.type?n.type:n};return e[a]=nT(t,s,r,i),e}),{})}if(pI(e.type)){const n=[],o={name:"",type:zI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(nT(t,o,r,i));return n}return iT(e.type,t)}function oT(t,e,r,i,n){const{name:o,type:a}=e;let s;switch(!0){case fI(o):return s=t.next().value,BigInt(s);case r&&a in r||gI(a):case i&&vI(a,i):case XI.isTypeFixedArray(a):return nT(t,e,r,i);case pI(a):if(CI(a))return nT(t,e,r,i);const h=[];if(n&&n[`${o}_len`]){const a=n[`${o}_len`];for(;h.length<a;)h.push(nT(t,{name:o,type:e.type.replace("*","")},r,i))}return h;case RI(a):return nT(t,e,r,i);default:return iT(a,t)}}var aT=(t,e)=>{if(hN(mN(t)||cN(t)||fN(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),mN(t)&&!gN(t))return;const r=BigInt(t.toString(10));hN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},sT=(t,e)=>{let r;switch(cN(t)&&hN(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),hN(mN(t)||cN(t)||fN(t)||pN(t)&&"low"in t&&"high"in t||pN(t)&&["limb0","limb1","limb2","limb3"].every((e=>e in t)),`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`),e.type){case tN.u256:r=new hI(t).toBigInt();break;case tN.u512:r=new dI(t).toBigInt();break;default:r=yN(t)}switch(e.type){case tN.u8:hN(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case tN.u16:hN(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case tN.u32:hN(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case tN.u64:hN(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case tN.u128:hN(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case tN.u256:hN(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case tN.u512:hN(dI.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case eN.ClassHash:case eN.ContractAddress:hN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case eN.Secp256k1Point:hN(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case eN.U96:hN(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},hT=(t,e)=>{hN(dN(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},uT=(t,e,r)=>{if(e.type!==tN.u256&&e.type!==tN.u512)if(xI(e.type)){hN(!pN(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);const r=BigInt(t.toString(10));hN(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else hN(pN(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as a js object (not array)`),r[e.type].members.forEach((({name:r})=>{hN(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else sT(t,e)},lT=(t,e)=>{hN(pN(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as a js object (not array)`);const r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),i=[...Object.getOwnPropertyNames(t),...r];if(!(bI(e.type)&&i.includes("isSome")&&i.includes("isNone")||kI(e.type)&&i.includes("isOk")&&i.includes("isErr")||i.includes("variant")&&i.includes("activeVariant")))throw new Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received "${t}", is not an Enum.`)},cT=(t,e)=>{hN(pN(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},dT=(t,e,r,i)=>{const n=pI(e.type),o=n?zI(e.type):XI.getFixedArrayType(e.type);if(n&&mI(o)&&KN(t))return;let a=[];if(n)hN(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),a=t;else switch(!0){case Array.isArray(t):a=t;break;case"object"==typeof t:a=Object.values(t);break;default:throw new Error(`Validate: arg ${e.name} should be an Array or an object.`)}switch(!0){case mI(o):a.forEach((t=>aT(t,e)));break;case gI(o):a.forEach((t=>cT(t,{name:e.name,type:o})));break;case pI(o):a.forEach((t=>dT(t,{name:"",type:o},r,i)));break;case wI(o,r):a.forEach((t=>uT(t,{name:e.name,type:o},r)));break;case vI(o,i):a.forEach((t=>lT(t,{name:e.name,type:o})));break;case MI(o)||EI(o):a.forEach((t=>sT(t,{name:"",type:o})));break;case AI(o):a.forEach((t=>hT(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${a}`)}};function fT(t,e,r,i){t.inputs.reduce(((t,n)=>{const o=e[t];switch(!0){case fI(n.name):return t;case mI(n.type):aT(o,n);break;case SI(n.type):((t,e)=>{hN(mN(t),`Validate: arg ${e.name} should be a string.`),hN(t.length<32,`Validate: arg ${e.name} cairo typed ${e.type} should be a string of less than 32 characters.`)})(o,n);break;case MI(n.type)||EI(n.type):sT(o,n);break;case AI(n.type):hT(o,n);break;case NI(n.type):((t,e)=>{hN(mN(t),`Validate: arg ${e.name} should be a string.`)})(o,n);break;case pI(n.type)||XI.isTypeFixedArray(n.type):dT(o,n,r,i);break;case wI(n.type,r):uT(o,n,r);break;case vI(n.type,i):lT(o,n);break;case gI(n.type):cT(o,n);break;case RI(n.type):((t,e)=>{const r=zI(e.type);switch(hN(MI(r)&&r!==dI.abiSelector||mI(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case mI(r):aT(t,e),hN(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case MI(r):sT(t,{name:"",type:r}),r===tN.u256?hN(new hI(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):hN(yN(t)>0,"Validate: value 0 is not authorized in NonZero uint type.");break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value "${t}"`)}})(o,n);break;default:throw new Error(`Validate Unhandled: argument ${n.name}, type ${n.type}, value ${o}`)}return t+1}),0)}var mT=class t{abi;parser;structs;enums;constructor(e){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=JI(e),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if(t!==XS.DEPLOY){hN(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return t===XS.INVOKE?!r:r})).map((t=>t.name)).includes(e),(t===XS.INVOKE?"invocable":"viewable")+" method not found in abi")}const i=this.abi.find((r=>t===XS.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(WI(e,r,i))return;const n=this.parser.methodInputsLength(i);if(r.length!==n)throw Error(`Invalid number of arguments, expected ${n} arguments, but got ${r.length}`);fT(i,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(WI(t,e,r))return[];let i;if(Array.isArray(e))i=e;else{const t=tT(e,r.inputs,this.structs,this.enums);i=Object.values(t),fT(r,i,this.structs,this.enums)}const n=i[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>fI(e.name)&&!CI(e.type)?t:t.concat(function(t,e,r,i){const{name:n,type:o}=e;let{value:a}=t.next();switch(!0){case XI.isTypeFixedArray(o):if(!Array.isArray(a)&&"object"!=typeof a)throw Error(`ABI expected parameter ${n} to be an array or an object, got ${a}`);return rT(a,e.type,r,i);case pI(o):if(!Array.isArray(a)&&!GN(a))throw Error(`ABI expected parameter ${n} to be array or long string, got ${a}`);return mN(a)&&(a=JN(a)),rT(a,e.type,r,i);case RI(o):return eT(zI(o),a);case xI(o):return eT(o,a);case wI(o,r)||gI(o)||hI.isAbiType(o):case vI(o,i):return rT(a,o,r,i);default:return eT(o,a)}}(n,e,this.structs,this.enums))),[]);return Object.defineProperty(o,"__compiled__",{enumerable:!1,writable:!1,value:!0}),o}static compile(t){const e=t=>{const e=(t,r=".")=>{const i=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(i).flatMap((([t,n])=>{let o=n;"entrypoint"===t?o=DN(o):KN(o)&&(o=XN(o));const a=Array.isArray(i)&&"0"===t?"$$len":t;if(fN(o))return[[`${r}${a}`,LI(o)]];if(Object(o)===o){const t=Object.getOwnPropertyNames(Object.getPrototypeOf(o)),i=[...Object.getOwnPropertyNames(o),...t];if(i.includes("isSome")&&i.includes("isNone")){const t=o,i=t.isSome()?FI.Some:FI.None;return t.isSome()?e({0:i,1:t.unwrap()},`${r}${a}.`):[[`${r}${a}`,LI(i)]]}if(i.includes("isOk")&&i.includes("isErr")){const t=o,i=t.isOk()?VI.Ok:VI.Err;return e({0:i,1:t.unwrap()},`${r}${a}.`)}if(i.includes("variant")&&i.includes("activeVariant")){const t=o,i=t.activeVariant(),n=Object.keys(t.variant).findIndex((t=>t===i));return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${a}`,LI(n)]]:e({0:n,1:t.unwrap()},`${r}${a}.`)}return e(o,`${r}${a}.`)}return[[`${r}${a}`,LI(o)]]}))};return Object.fromEntries(e(t))};let r;if(Array.isArray(t)){const i=e({...t});r=Object.values(i)}else{const i=e(t);r=Object.values(i)}return Object.defineProperty(r,"__compiled__",{enumerable:!1,writable:!1,value:!0}),r}parse(t,e){const{outputs:r}=this.abi.find((e=>e.name===t)),i=e.flat()[Symbol.iterator](),n=r.flat().reduce(((t,e,r)=>{const n=e.name??r;return t[n]=oT(i,e,this.structs,this.enums,t),t[n]&&t[`${n}_len`]&&delete t[`${n}_len`],t}),{});return 1===Object.keys(n).length&&0 in n?n[0]:n}format(t,e,r){return KI(this.parse(t,e),r)}static getAbiStruct(t){return t.filter((t=>"struct"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{})}static getAbiEnum(t){const e=t.filter((t=>"enum"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{});return delete e["core::bool"],e}static toCalldata(e=[]){return t.compile(e)}static toHex(e=[]){return t.compile(e).map((t=>wN(t)))}decodeParameters(t,e){const r=Array.isArray(t)?t:[t],i=e.flat()[Symbol.iterator](),n=r.map((t=>oT(i,{name:"",type:t},this.structs,this.enums)));return 1===n.length?n[0]:n}};Ix({},{calculateContractAddressFromHash:()=>qT,calculateDeclareTransactionHash:()=>PT,calculateDeployAccountTransactionHash:()=>BT,calculateInvokeTransactionHash:()=>RT,calculateL2MessageTxHash:()=>bT,computeCompiledClassHash:()=>WT,computeContractClassHash:()=>XT,computeHashOnElements:()=>LT,computeHintedClassHash:()=>GT,computeLegacyContractClassHash:()=>ZT,computePedersenHash:()=>DT,computePedersenHashOnElements:()=>UT,computePoseidonHash:()=>$T,computePoseidonHashOnElements:()=>FT,computeSierraContractClassHash:()=>QT,formatSpaces:()=>HT,getL2MessageHash:()=>UN,getSelector:()=>$N,getSelectorFromName:()=>DN,hashByteCodeSegments:()=>JT,keccakBn:()=>PN,poseidon:()=>kw,solidityUint256PackedKeccak256:()=>LN,starknetKeccak:()=>BN});Ix({},{calculateDeclareTransactionHash:()=>yT,calculateDeployAccountTransactionHash:()=>wT,calculateL2MessageTxHash:()=>bT,calculateTransactionHash:()=>vT,calculateTransactionHashCommon:()=>gT,computeHashOnElements:()=>pT});function pT(t){return[...t,t.length].reduce(((t,e)=>kv(yN(t),yN(e))),0).toString()}function gT(t,e,r,i,n,o,a,s=[]){const h=pT(n);return pT([t,e,r,i,h,o,a,...s])}function yT(t,e,r,i,n,o,a){return gT("0x6465636c617265",r,e,0,[t],i,n,[o,...a?[a]:[]])}function wT(t,e,r,i,n,o,a,s){return gT("0x6465706c6f795f6163636f756e74",n,t,0,[e,i,...r],o,a,[s])}function vT(t,e,r,i,n,o){return gT("0x696e766f6b65",e,t,0,r,i,n,[o])}function bT(t,e,r,i,n,o){const a=[t,...i];return gT("0x6c315f68616e646c6572",0,e,$N(r),a,0,n,[o])}Ix({},{starkCurve:()=>Cv,weierstrass:()=>Vw});Ix({},{calculateDeclareTransactionHash:()=>zT,calculateDeployAccountTransactionHash:()=>CT,calculateInvokeTransactionHash:()=>OT,calculateTransactionHashCommon:()=>TT,encodeResourceBoundsL1:()=>ST,encodeResourceBoundsL2:()=>NT,hashDAMode:()=>xT,hashFeeField:()=>IT});var kT=t=>t.map((t=>BigInt(t))),MT=32n,_T=128n,ET=64n+_T,AT=BigInt(WN("L1_GAS")),jT=BigInt(WN("L2_GAS"));function xT(t,e){return(BigInt(t)<<MT)+BigInt(e)}function ST(t){return(AT<<ET)+(BigInt(t.l1_gas.max_amount)<<_T)+BigInt(t.l1_gas.max_price_per_unit)}function NT(t){return(jT<<ET)+(BigInt(t.l2_gas.max_amount)<<_T)+BigInt(t.l2_gas.max_price_per_unit)}function IT(t,e){const r=ST(e),i=NT(e);return Tv([BigInt(t),r,i])}function TT(t,e,r,i,n,o,a,s,h,u,l=[]){const c=IT(o,u),d=xT(s,h),f=kT([t,e,r,c,Tv(kT(a)),i,n,d,...kT(l)]);return wN(Tv(f))}function CT(t,e,r,i,n,o,a,s,h,u,l,c){return TT("0x6465706c6f795f6163636f756e74",n,t,o,a,l,c,s,h,u,[Tv(kT(r)),e,i])}function zT(t,e,r,i,n,o,a,s,h,u,l,c){return TT("0x6465636c617265",i,r,n,o,l,kT(c),s,h,u,[Tv(kT(a)),t,e])}function OT(t,e,r,i,n,o,a,s,h,u,l){return TT("0x696e766f6b65",e,t,i,n,u,l,a,s,h,[Tv(kT(o)),Tv(kT(r))])}function RT(t){return function(t){return[Cx.ETransactionVersion.V3,Cx.ETransactionVersion.F3].includes(t.version)}(t)?OT(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):vT(t.senderAddress,t.version,t.compiledCalldata,t.maxFee,t.chainId,t.nonce)}function PT(t){return function(t){return[Cx.ETransactionVersion.V3,Cx.ETransactionVersion.F3].includes(t.version)}(t)?zT(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):yT(t.classHash,t.senderAddress,t.version,t.maxFee,t.chainId,t.nonce,t.compiledClassHash)}function BT(t){return function(t){return[Cx.ETransactionVersion.V3,Cx.ETransactionVersion.F3].includes(t.version)}(t)?CT(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):wT(t.contractAddress,t.classHash,t.constructorCalldata,t.salt,t.version,t.maxFee,t.chainId,t.nonce)}function DT(t,e){return kv(BigInt(t),BigInt(e))}function $T(t,e){return wN(Iv(BigInt(t),BigInt(e)))}function LT(t){return[...t,t.length].reduce(((t,e)=>kv(BigInt(t),BigInt(e))),0).toString()}var UT=LT;function FT(t){return wN(Tv(t.map((t=>BigInt(t)))))}function qT(t,e,r,i){const n=LT(mT.compile(r)),o=LT([LI("0x535441524b4e45545f434f4e54524143545f41444452455353"),i,t,e,n]);return wN(BigInt(o)%gS)}function VT(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function HT(t){let e=!1;const r=[];for(const i of t)'"'===i&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(i):r.push(":"===i?": ":","===i?", ":i);return r.join("")}function GT(t){const{abi:e,program:r}=t,i=HT(LS({abi:e,program:r},VT));return rS(_v(Wx(i)).toString(16))}function ZT(t){const e=mN(t)?DS(t):t,r=wN(fS),i=LT(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),n=LT(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=LT(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),a=LT(e.program.builtins.map((t=>WN(t)))),s=GT(e),h=LT(e.program.data);return LT([r,i,n,o,a,s,h])}function KT(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,Tv(e.flatMap((t=>BigInt(WN(t))))))];var e}));return Tv(e)}function JT(t){const e=t.bytecode.map((t=>BigInt(t))),r=t.bytecode_segment_lengths??[];let i=0;const n=r.flatMap((t=>{const r=e.slice(i,i+=t);return[BigInt(t),Tv(r)]}));return 1n+Tv(n)}function WT(t){const e=BigInt(WN("COMPILED_CLASS_V1")),r=KT(t.entry_points_by_type.EXTERNAL),i=KT(t.entry_points_by_type.L1_HANDLER),n=KT(t.entry_points_by_type.CONSTRUCTOR),o=t.bytecode_segment_lengths?JT(t):Tv(t.bytecode.map((t=>BigInt(t))));return wN(Tv([e,r,i,n,o]))}function YT(t){return Tv(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function QT(t){const e=BigInt(WN("CONTRACT_CLASS_V0.1.0")),r=YT(t.entry_points_by_type.EXTERNAL),i=YT(t.entry_points_by_type.L1_HANDLER),n=YT(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=HT(LS(t.abi,null));return BigInt(rS(_v(Wx(e)).toString(16)))}(t),a=Tv(t.sierra_program.map((t=>BigInt(t))));return wN(Tv([e,r,i,n,o,a]))}function XT(t){const e=mN(t)?DS(t):t;return"sierra_program"in e?QT(e):ZT(e)}function tC(t){const e=mN(t)?t:LS(t);return Xx(b_(e))}function eC(t){if(Array.isArray(t))return t;const e=Jx(k_(Qx(t)));return DS(e)}function rC(){return fv(uv.randomPrivateKey())}function iC(t){return rS(t).toLowerCase()}function nC(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>wN(t)));try{const{r:e,s:r}=t;return[wN(e),wN(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function oC(t){return AN(nC(t))}function aC(t){return jN(nC(t))}function sC(t,e=50){return zN(t,e)}function hC(t,e=50,r=50){if(fN(t))return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:"0x0",max_price_per_unit:"0x0"}};if(lN(t.gas_consumed)||lN(t.gas_price))throw Error("estimateFeeToBounds: estimate is undefined");return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:void 0!==t.data_gas_consumed&&void 0!==t.data_gas_price?wN(zN(BigInt(t.overall_fee)/BigInt(t.gas_price),e)):wN(zN(t.gas_consumed,e)),max_price_per_unit:wN(zN(t.gas_price,r))}}}function uC(t){if(t===Cx.EDataAvailabilityMode.L1)return Cx.EDAMode.L1;if(t===Cx.EDataAvailabilityMode.L2)return Cx.EDAMode.L2;throw Error("EDAM conversion")}function lC(t,e){const r=e?wN(e):void 0,i=wN(t);if(e&&!Object.values(Cx.ETransactionVersion).includes(r))throw Error(`providedVersion ${e} is not ETransactionVersion`);if(!Object.values(Cx.ETransactionVersion).includes(i))throw Error(`defaultVersion ${t} is not ETransactionVersion`);return e?r:i}function cC(t){if(!t)return;const e=wN(t);if(e===Cx.ETransactionVersion.V0)return Cx.ETransactionVersion.F0;if(e===Cx.ETransactionVersion.V1)return Cx.ETransactionVersion.F1;if(e===Cx.ETransactionVersion.V2)return Cx.ETransactionVersion.F2;if(e===Cx.ETransactionVersion.V3)return Cx.ETransactionVersion.F3;throw Error(`toFeeVersion: ${e} is not supported`)}function dC(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||Cx.EDataAvailabilityMode.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||Cx.EDataAvailabilityMode.L1,resourceBounds:t.resourceBounds??hC(lS)}}function fC(t){return t===Cx.ETransactionVersion.F2?Cx.ETransactionVersion.F1:t===Cx.ETransactionVersion.V2?Cx.ETransactionVersion.V1:t}function mC(t){return rS(tS(rv(wN(t),!1)))}function pC(t){return"sierra_program"in(mN(t)?DS(t):t)}Ix({},{compressProgram:()=>tC,decompressProgram:()=>eC,estimateFeeToBounds:()=>hC,estimatedFeeToMaxFee:()=>sC,formatSignature:()=>nC,getFullPublicKey:()=>mC,intDAM:()=>uC,makeAddress:()=>iC,randomAddress:()=>rC,reduceV2:()=>fC,signatureToDecimalArray:()=>oC,signatureToHexArray:()=>aC,toFeeVersion:()=>cC,toTransactionVersion:()=>lC,v3Details:()=>dC});function gC(){return aS(tS(S_.utils.randomPrivateKey()))}function yC(t){EN(t,lS,2n**160n-1n,"Ethereum Address ");const e=rS(eS(wN(t)).padStart(40,"0"));return hN(Boolean(e.match(/^(0x)?[0-9a-f]{40}$/)),"Invalid Ethereum Address Format"),e}Ix({},{ethRandomPrivateKey:()=>gC,validateAndParseEthAddress:()=>yC});var wC=Kx&&window.fetch.bind(window)||!lN(t)&&Fj(t.fetch)||fx;Ix({},{Block:()=>xC,createSierraContractClass:()=>_C,getDefaultNodeUrl:()=>AC,isPendingBlock:()=>IC,isPendingStateUpdate:()=>CC,isPendingTransaction:()=>TC,isV3Tx:()=>SC,isVersion:()=>NC,parseContract:()=>EC,validBlockTags:()=>jC,wait:()=>MC});var vC=class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...OS}}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(t,e){return this.config[t]??e}set(t,e){this.config[t]=e}update(t){this.config={...this.config,...t}}getAll(){return{...this.config}}reset(){this.initialize()}delete(t){delete this.config[t]}hasKey(t){return t in this.config}}.getInstance(),bC={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},kC=class t{static instance;config;constructor(){this.config=vC}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTimestamp(){return(new Date).toISOString()}shouldLog(t){const e=this.config.get("logLevel","INFO");return t<=bC[e]}formatMessage(t){const{level:e,message:r,timestamp:i,data:n}=t;let o=`[${i}] ${e}: ${r}`;if(n)try{o+=`\n${JSON.stringify(n,null,2)}`}catch(t){o+=`\n[JSON.stringify Error/Circular]: ${t}`}return o}log(t,e,r){if(!this.shouldLog(bC[t]))return;const i={level:t,message:e,timestamp:this.getTimestamp(),data:r},n=this.formatMessage(i);switch(t){case"DEBUG":console.debug(n);break;case"INFO":console.info(n);break;case"WARN":console.warn(n);break;case"ERROR":case"FATAL":console.error(n);break;case"OFF":break;default:console.log(n)}}debug(t,e){this.log("DEBUG",t,e)}info(t,e){this.log("INFO",t,e)}warn(t,e){this.log("WARN",t,e)}error(t,e){this.log("ERROR",t,e)}fatal(t,e){this.log("FATAL",t,e)}setLogLevel(t){this.config.set("logLevel",t)}getLogLevel(){return this.config.get("logLevel","INFO")}getEnabledLogLevels(){return Object.keys(bC).filter((t=>this.shouldLog(bC[t])&&"OFF"!==t))}}.getInstance();function MC(t){return new Promise((e=>{setTimeout(e,t)}))}function _C(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=HT(LS(t.abi)),e.sierra_program=HT(LS(t.sierra_program)),e.sierra_program=tC(e.sierra_program),e}function EC(t){const e=mN(t)?DS(t):t;return pC(t)?_C(e):{...e,..."program"in e&&{program:tC(e.program)}}}var AC=(t,e=!1)=>{e||kC.info("Using default public node url, please provide nodeUrl in provider options!");const r=SS[t??"SN_SEPOLIA"];return r[Math.floor(Math.random()*r.length)]},jC=Object.values(QS),xC=class{hash=null;number=null;tag=null;setIdentifier(t){if(mN(t))if(HN(t))this.number=parseInt(t,10);else if(gN(t))this.hash=t;else{if(!jC.includes(t))throw TypeError(`Block identifier unmanaged: ${t}`);this.tag=t}else fN(t)?this.hash=wN(t):cN(t)?this.number=t:this.tag=QS.PENDING;if(cN(this.number)&&this.number<0)throw TypeError(`Block number (${this.number}) can't be negative`)}constructor(t){this.setIdentifier(t)}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}valueOf=()=>this.number;toString=()=>this.hash};function SC(t){const e=t.version?wN(t.version):Cx.ETransactionVersion.V3;return e===Cx.ETransactionVersion.V3||e===Cx.ETransactionVersion.F3}function NC(t,e){const[r,i]=t.split("."),[n,o]=e.split(".");return r===n&&i===o}function IC(t){return"PENDING"===t.status}function TC(t){return!("block_hash"in t)}function CC(t){return!("block_hash"in t)}var zC={};Ix(zC,{buildUDCCall:()=>LC,fromCallsToExecuteCalldata:()=>RC,fromCallsToExecuteCalldataWithNonce:()=>PC,fromCallsToExecuteCalldata_cairo1:()=>DC,getExecuteCalldata:()=>$C,getVersionsByType:()=>UC,transformCallsToMulticallArrays:()=>OC,transformCallsToMulticallArrays_cairo1:()=>BC});var OC=t=>{const e=[],r=[];return t.forEach((t=>{const i=mT.compile(t.calldata||[]);e.push({to:yN(t.contractAddress).toString(10),selector:yN(DN(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:i.length.toString()}),r.push(...i)})),{callArray:e,calldata:mT.compile({calldata:r})}},RC=t=>{const{callArray:e,calldata:r}=OC(t);return[...mT.compile({callArray:e}),...r]},PC=(t,e)=>[...RC(t),yN(e).toString()],BC=t=>{const e=t.map((t=>({to:yN(t.contractAddress).toString(10),selector:yN(DN(t.entrypoint)).toString(10),calldata:mT.compile(t.calldata||[])})));return e},DC=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:mT.compile(t.calldata)})));return mT.compile({orderCalls:e})},$C=(t,e="0")=>"1"===e?DC(t):RC(t);function LC(t,e){const r=[].concat(t).map((t=>{const{classHash:r,salt:i,unique:n=!0,constructorCalldata:o=[]}=t,a=mT.compile(o),s=i??rC();return{call:{contractAddress:jS.ADDRESS,entrypoint:jS.ENTRYPOINT,calldata:[r,s,TN(n),a.length,...a]},address:qT(n?kv(e,s):s,r,a,n?jS.ADDRESS:0)}}));return{calls:r.map((t=>t.call)),addresses:r.map((t=>t.address))}}function UC(t){return"fee"===t?{v1:Cx.ETransactionVersion.F1,v2:Cx.ETransactionVersion.F2,v3:Cx.ETransactionVersion.F3}:{v1:Cx.ETransactionVersion.V1,v2:Cx.ETransactionVersion.V2,v3:Cx.ETransactionVersion.V3}}var FC={headers:{"Content-Type":"application/json"},blockIdentifier:QS.PENDING,retries:200},qC=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(MS).includes(a)?this.nodeUrl=AC(a,t?.default):this.nodeUrl=a||AC(void 0,t?.default),this.baseFetch=e??wC,this.blockIdentifier=i??FC.blockIdentifier,this.chainId=n,this.headers={...FC.headers,...o},this.retries=s??FC.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new sN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:LS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new HS(r,t,e);if(i instanceof VS)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new xC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=wN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new xC(r).identifier,a=[];return i&&a.push(Ox.ESimulationFlag.SKIP_VALIDATE),n&&a.push(Ox.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=wN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Ox.ETransactionStatus.REJECTED],h=e?.successStates??[Ox.ETransactionExecutionStatus.SUCCEEDED,Ox.ETransactionStatus.ACCEPTED_ON_L2,Ox.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!n;){await MC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await MC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=wN(t),n=bN(e),o=new xC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new xC(e).identifier;let n={};return NC("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Ox.ESimulationFlag.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return SC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Ox.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:Ox.ETransactionVersion.V3,signature:aC(t.signature),nonce:wN(e.nonce),resource_bounds:e.resourceBounds,tip:wN(e.tip),paymaster_data:e.paymasterData.map((t=>wN(t))),account_deployment_data:e.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),type:Ox.ETransactionType.INVOKE,max_fee:wN(e.maxFee||0),version:Ox.ETransactionVersion.V1,signature:aC(t.signature),nonce:wN(e.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V1,type:Ox.ETransactionType.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(pC(t)||SC(n))if(pC(t)&&!SC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ox.ETransactionType.DECLARE,contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:Ox.ETransactionVersion.V2,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V2,type:Ox.ETransactionType.DECLARE});else{if(!pC(t)||!SC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ox.ETransactionType.DECLARE,sender_address:r,compiled_class_hash:i||"",version:Ox.ETransactionVersion.V3,signature:aC(e),nonce:wN(n.nonce),contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),account_deployment_data:n.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ox.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:Ox.ETransactionVersion.V1,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V1,type:Ox.ETransactionType.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return SC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Ox.ETransactionType.DEPLOY_ACCOUNT,version:Ox.ETransactionVersion.V3,signature:aC(i),nonce:wN(n.nonce),contract_address_salt:wN(r||0),constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),contract_address_salt:wN(r||0),type:Ox.ETransactionType.DEPLOY_ACCOUNT,max_fee:wN(n.maxFee||0),version:Ox.ETransactionVersion.V1,signature:aC(i),nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V1,type:Ox.ETransactionType.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new xC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:DN(t.entrypoint),calldata:mT.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:yC(r),to_address:wN(i),entry_point_selector:$N(n),payload:IN(o)},s=new xC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=UC(e);let i;if(SC(t)?i={signature:aC(t.signature),nonce:wN(t.nonce),resource_bounds:t.resourceBounds,tip:wN(t.tip),paymaster_data:t.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>wN(t)))}:(i={signature:aC(t.signature),nonce:wN(t.nonce),max_fee:wN(t.maxFee||0)},kC.warn(RS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===ZS.INVOKE)return{type:Ox.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:wN(t.version||r.v3),...i};if(t.type===ZS.DECLARE)return pC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:eC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:wN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:wN(t.version||r.v1),...i};if(t.type===ZS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:mT.toHex(t.constructorCalldata||[]),class_hash:wN(t.classHash),contract_address_salt:wN(t.addressSalt||0),version:wN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}};Ix({},{RpcChannel:()=>HC});var VC={headers:{"Content-Type":"application/json"},blockIdentifier:QS.PENDING,retries:200},HC=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(MS).includes(a)?this.nodeUrl=AC(a,t?.default):this.nodeUrl=a||AC(void 0,t?.default),this.baseFetch=e??wC,this.blockIdentifier=i??VC.blockIdentifier,this.chainId=n,this.headers={...VC.headers,...o},this.retries=s??VC.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new sN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:LS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new HS(r,t,e);if(i instanceof VS)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new xC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=wN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new xC(r).identifier,a=[];return i&&a.push(Nm.SKIP_VALIDATE),n&&a.push(Nm.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=wN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Im.REJECTED],h=e?.successStates??[Cm.SUCCEEDED,Im.ACCEPTED_ON_L2,Im.ACCEPTED_ON_L1];let u;for(;!n;){await MC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await MC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=wN(t),n=bN(e),o=new xC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new xC(e).identifier;let n={};return NC("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Nm.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return SC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:Pm.V3,signature:aC(t.signature),nonce:wN(e.nonce),resource_bounds:e.resourceBounds,tip:wN(e.tip),paymaster_data:e.paymasterData.map((t=>wN(t))),account_deployment_data:e.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),type:Sm.INVOKE,max_fee:wN(e.maxFee||0),version:Pm.V1,signature:aC(t.signature),nonce:wN(e.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V1,type:Sm.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(pC(t)||SC(n))if(pC(t)&&!SC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:Pm.V2,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V2,type:Sm.DECLARE});else{if(!pC(t)||!SC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,sender_address:r,compiled_class_hash:i||"",version:Pm.V3,signature:aC(e),nonce:wN(n.nonce),contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),account_deployment_data:n.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:Pm.V1,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V1,type:Sm.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return SC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Sm.DEPLOY_ACCOUNT,version:Pm.V3,signature:aC(i),nonce:wN(n.nonce),contract_address_salt:wN(r||0),constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),contract_address_salt:wN(r||0),type:Sm.DEPLOY_ACCOUNT,max_fee:wN(n.maxFee||0),version:Pm.V1,signature:aC(i),nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V1,type:Sm.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new xC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:DN(t.entrypoint),calldata:mT.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:yC(r),to_address:wN(i),entry_point_selector:$N(n),payload:IN(o)},s=new xC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=UC(e);let i;if(SC(t)?i={signature:aC(t.signature),nonce:wN(t.nonce),resource_bounds:t.resourceBounds,tip:wN(t.tip),paymaster_data:t.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>wN(t)))}:(i={signature:aC(t.signature),nonce:wN(t.nonce),max_fee:wN(t.maxFee||0)},kC.warn(RS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===ZS.INVOKE)return{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:wN(t.version||r.v3),...i};if(t.type===ZS.DECLARE)return pC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:eC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:wN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:wN(t.version||r.v1),...i};if(t.type===ZS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:mT.toHex(t.constructorCalldata||[]),class_hash:wN(t.classHash),contract_address_salt:wN(t.addressSalt||0),version:wN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}},GC=class{margin;constructor(t){this.margin=t}estimatedFeeToMaxFee(t){return sC(t,this.margin?.maxFee)}estimateFeeToBounds(t){return hC(t,this.margin?.l1BoundMaxAmount,this.margin?.l1BoundMaxPricePerUnit)}parseGetBlockResponse(t){return{status:"PENDING",...t}}parseTransactionReceipt(t){return"actual_fee"in t&&mN(t.actual_fee)?{...t,actual_fee:{amount:t.actual_fee,unit:"FRI"}}:t}parseFeeEstimateResponse(t){const e=t[0];return{overall_fee:yN(e.overall_fee),gas_consumed:yN(e.gas_consumed),gas_price:yN(e.gas_price),unit:e.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(e.overall_fee),resourceBounds:this.estimateFeeToBounds(e),data_gas_consumed:e.data_gas_consumed?yN(e.data_gas_consumed):0n,data_gas_price:e.data_gas_price?yN(e.data_gas_price):0n}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:yN(t.overall_fee),gas_consumed:yN(t.gas_consumed),gas_price:yN(t.gas_price),unit:t.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(t.overall_fee),resourceBounds:this.estimateFeeToBounds(t),data_gas_consumed:t.data_gas_consumed?yN(t.data_gas_consumed):0n,data_gas_price:t.data_gas_price?yN(t.data_gas_price):0n})))}parseSimulateTransactionResponse(t){return t.map((t=>({...t,suggestedMaxFee:this.estimatedFeeToMaxFee(t.fee_estimation.overall_fee),resourceBounds:this.estimateFeeToBounds(t.fee_estimation)})))}parseContractClassResponse(t){return{...t,abi:mN(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}},ZC=class t{statusReceipt;value;constructor(e){[this.statusReceipt,this.value]=t.isSuccess(e)?["success",e]:t.isReverted(e)?["reverted",e]:t.isRejected(e)?["rejected",e]:["error",new Error("Unknown response type")];for(const[t]of Object.entries(this))Object.defineProperty(this,t,{enumerable:!1});for(const[t,r]of Object.entries(e))Object.defineProperty(this,t,{enumerable:!0,writable:!1,value:r})}match(t){return this.statusReceipt in t?t[this.statusReceipt](this.value):t._()}isSuccess(){return"success"===this.statusReceipt}isReverted(){return"reverted"===this.statusReceipt}isRejected(){return"rejected"===this.statusReceipt}isError(){return"error"===this.statusReceipt}static isSuccess(t){return t.execution_status===WS.SUCCEEDED}static isReverted(t){return t.execution_status===WS.REVERTED}static isRejected(t){return t.status===WS.REJECTED}},KC={};Ix(KC,{TypedDataRevision:()=>Um,encodeData:()=>uz,encodeType:()=>az,encodeValue:()=>hz,getDependencies:()=>oz,getMessageHash:()=>cz,getStructHash:()=>lz,getTypeHash:()=>sz,isMerkleTreeType:()=>nz,prepareSelector:()=>iz,validateTypedData:()=>rz,verifyMessage:()=>dz});Ix({},{MerkleTree:()=>JC,proofMerklePath:()=>WC});var JC=class t{leaves;branches=[];root;hashMethod;constructor(t,e=DT){this.hashMethod=e,this.leaves=t,this.root=this.build(t)}build(e){if(1===e.length)return e[0];e.length!==this.leaves.length&&this.branches.push(e);const r=[];for(let i=0;i<e.length;i+=2)i+1===e.length?r.push(t.hash(e[i],"0x0",this.hashMethod)):r.push(t.hash(e[i],e[i+1],this.hashMethod));return this.build(r)}static hash(t,e,r=DT){const[i,n]=[BigInt(t),BigInt(e)].sort(((t,e)=>t>=e?1:-1));return r(i,n)}getProof(e,r=this.leaves,i=[]){const n=r.indexOf(e);if(-1===n)throw new Error("leaf not found");if(1===r.length)return i;const o=n%2==0,a=(o?r[n+1]:r[n-1])??"0x0",s=[...i,a],h=this.leaves.length===r.length?-1:this.branches.findIndex((t=>t.length===r.length)),u=this.branches[h+1]??[this.root];return this.getProof(t.hash(o?e:a,o?a:e,this.hashMethod),u,s)}};function WC(t,e,r,i=DT){if(0===r.length)return t===e;const[n,...o]=r;return WC(t,JC.hash(e,n,i),o,i)}var YC={u256:JSON.parse('[{ "name": "low", "type": "u128" }, { "name": "high", "type": "u128" }]'),TokenAmount:JSON.parse('[{ "name": "token_address", "type": "ContractAddress" }, { "name": "amount", "type": "u256" }]'),NftId:JSON.parse('[{ "name": "collection_address", "type": "ContractAddress" }, { "name": "token_id", "type": "u256" }]')},QC={[Um.ACTIVE]:{domain:"StarknetDomain",hashMethod:FT,hashMerkleMethod:$T,escapeTypeString:t=>`"${t}"`,presetTypes:YC},[Um.LEGACY]:{domain:"StarkNetDomain",hashMethod:UT,hashMerkleMethod:DT,escapeTypeString:t=>t,presetTypes:{}}};function XC(t,e,{min:r,max:i}){const n=BigInt(t);hN(n>=r&&n<=i,`${n} (${e}) is out of bounds [${r}, ${i}]`)}function tz({types:t,domain:e}){return QC[Um.ACTIVE].domain in t&&e.revision===Um.ACTIVE?Um.ACTIVE:QC[Um.LEGACY].domain in t&&(e.revision??Um.LEGACY)===Um.LEGACY?Um.LEGACY:void 0}function ez(t){try{return wN(t)}catch(e){if(mN(t))return wN(WN(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function rz(t){const e=t;return Boolean(e.message&&e.primaryType&&e.types&&tz(e))}function iz(t){return gN(t)?t:DN(t)}function nz(t){return"merkletree"===t.type}function oz(t,e,r=[],i="",n=Um.LEGACY){let o=[e];return"*"===e[e.length-1]?o=[e.slice(0,-1)]:n===Um.ACTIVE&&("enum"===e?o=[i]:e.match(/^\(.*\)$/)&&(o=e.slice(1,-1).split(",").map((t=>"*"===t[t.length-1]?t.slice(0,-1):t)))),o.filter((e=>!r.includes(e)&&t[e])).reduce(((e,r)=>[...e,...[r,...t[r].reduce(((e,r)=>[...e,...oz(t,r.type,e,r.contains,n).filter((t=>!e.includes(t)))]),[])].filter((t=>!e.includes(t)))]),[])}function az(t,e,r=Um.LEGACY){const i=r===Um.ACTIVE?{...t,...QC[r].presetTypes}:t,[n,...o]=oz(i,e,void 0,void 0,r),a=n?[n,...o.sort()]:[],s=QC[r].escapeTypeString;return a.map((t=>{const e=i[t].map((t=>{const e="enum"===t.type&&r===Um.ACTIVE?t.contains:t.type,i=e.match(/^\(.*\)$/)?`(${e.slice(1,-1).split(",").map((t=>t?s(t):t)).join(",")})`:s(e);return`${s(t.name)}:${i}`}));return`${s(t)}(${e})`})).join("")}function sz(t,e,r=Um.LEGACY){return DN(az(t,e,r))}function hz(t,e,r,i={},n=Um.LEGACY){if(t[e])return[e,lz(t,e,r,n)];if(QC[n].presetTypes[e])return[e,lz(QC[n].presetTypes,e,r,n)];if(e.endsWith("*")){const i=r.map((r=>hz(t,e.slice(0,-1),r,void 0,n)[1]));return[e,QC[n].hashMethod(i)]}switch(e){case"enum":if(n===Um.ACTIVE){const[o,a]=Object.entries(r)[0],s=t[i.parent].find((t=>t.name===i.key)),h=t[s.contains],u=h.find((t=>t.name===o)),l=h.indexOf(u),c=u.type.slice(1,-1).split(",").map(((e,r)=>{if(!e)return e;const i=a[r];return hz(t,e,i,void 0,n)[1]}));return[e,QC[n].hashMethod([l,...c])]}return[e,ez(r)];case"merkletree":{const e=function(t,e){if(e.parent&&e.key){const r=t[e.parent].find((t=>t.name===e.key));if(!nz(r))throw new Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,i),o=r.map((r=>hz(t,e,r,void 0,n)[1])),{root:a}=new JC(o,QC[n].hashMerkleMethod);return["felt",a]}case"selector":return["felt",iz(r)];case"string":if(n===Um.ACTIVE){const t=XN(r),i=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,QC[n].hashMethod(i)]}return[e,ez(r)];case"i128":if(n===Um.ACTIVE){const t=BigInt(r);return XC(t,e,vS),[e,ez(t<0n?mS+t:t)]}return[e,ez(r)];case"timestamp":case"u128":return n===Um.ACTIVE&&XC(r,e,bS),[e,ez(r)];case"felt":case"shortstring":return n===Um.ACTIVE&&XC(ez(r),e,wS),[e,ez(r)];case"ClassHash":case"ContractAddress":return n===Um.ACTIVE&&XC(r,e,wS),[e,ez(r)];case"bool":return n===Um.ACTIVE&&hN(dN(r),`Type mismatch for ${e} ${r}`),[e,ez(r)];default:if(n===Um.ACTIVE)throw new Error(`Unsupported type: ${e}`);return[e,ez(r)]}}function uz(t,e,r,i=Um.LEGACY){const n=t[e]??QC[i].presetTypes[e],[o,a]=n.reduce((([n,o],a)=>{if(void 0===r[a.name]||null===r[a.name]&&"enum"!==a.type)throw new Error(`Cannot encode data: missing data for '${a.name}'`);const s=r[a.name],h={parent:e,key:a.name},[u,l]=hz(t,a.type,s,h,i);return[[...n,u],[...o,l]]}),[["felt"],[sz(t,e,i)]]);return[o,a]}function lz(t,e,r,i=Um.LEGACY){return QC[i].hashMethod(uz(t,e,r,i)[1])}function cz(t,e){if(!rz(t))throw new Error("Typed data does not match JSON schema");const r=tz(t),{domain:i,hashMethod:n}=QC[r];return n([WN("StarkNet Message"),lz(t.types,i,t.domain,r),e,lz(t.types,t.primaryType,t.message,r)])}function dz(t,e,r,i){const n=rz(t);if(!RN(t)&&!n)throw new Error("message has a wrong format.");if(n&&void 0===i)throw new Error("When providing a TypedData in message parameter, the accountAddress parameter has to be provided.");if(n&&!RN(i))throw new Error("accountAddress shall be a BigNumberish");const o=n?cz(t,i):wN(t);return ov(Array.isArray(e)?new hv(BigInt(e[0]),BigInt(e[1])):e,o,wN(r))}var fz=class{responseParser;channel;constructor(t){t&&"channel"in t?(this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new GC):(this.channel=new HC({...t,waitMode:!1}),this.responseParser=new GC(t?.feeMarginPercentage))}fetch(t,e,r=0){return this.channel.fetch(t,e,r)}async getChainId(){return this.channel.getChainId()}async getSpecVersion(){return this.channel.getSpecVersion()}async getNonceForAddress(t,e){return this.channel.getNonceForAddress(t,e)}async getBlock(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.channel.getBlockLatestAccepted()}async getBlockNumber(){return this.channel.getBlockNumber()}async getBlockWithTxHashes(t){return this.channel.getBlockWithTxHashes(t)}async getBlockWithTxs(t){return this.channel.getBlockWithTxs(t)}async waitForBlock(t="pending",e=5e3){if(t===QS.LATEST)return;const r=await this.getBlockNumber(),i=t===QS.PENDING?r+1:Number(wN(t));if(i<=r)return;const{retries:n}=this.channel;let o=n,a=!1;for(;!a;){if(await this.getBlockNumber()===i?a=!0:await MC(e),o-=1,o<=0)throw new Error(`waitForBlock() timed-out after ${n} tries.`)}}async getL1GasPrice(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseL1GasPriceResponse)}async getL1MessageHash(t){const e=await this.channel.getTransactionByHash(t);hN("L1_HANDLER"===e.type,"This L2 transaction is not a L1 message.");const{calldata:r,contract_address:i,entry_point_selector:n,nonce:o}=e;return LN([r[0],i,o,n,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){if(this.channel instanceof PS.RpcChannel)throw new VS("Unsupported method for RPC version");return this.channel.getBlockWithReceipts(t)}getStateUpdate=this.getBlockStateUpdate;async getBlockStateUpdate(t){return this.channel.getBlockStateUpdate(t)}async getBlockTransactionsTraces(t){return this.channel.getBlockTransactionsTraces(t)}async getBlockTransactionCount(t){return this.channel.getBlockTransactionCount(t)}async getPendingTransactions(){const{transactions:t}=await this.getBlockWithTxHashes(QS.PENDING).then(this.responseParser.parseGetBlockResponse);return Promise.all(t.map((t=>this.getTransactionByHash(t))))}async getTransaction(t){return this.channel.getTransactionByHash(t)}async getTransactionByHash(t){return this.channel.getTransactionByHash(t)}async getTransactionByBlockIdAndIndex(t,e){return this.channel.getTransactionByBlockIdAndIndex(t,e)}async getTransactionReceipt(t){const e=await this.channel.getTransactionReceipt(t),r=this.responseParser.parseTransactionReceipt(e);return new ZC(r)}async getTransactionTrace(t){return this.channel.getTransactionTrace(t)}async getTransactionStatus(t){return this.channel.getTransactionStatus(t)}async getSimulateTransaction(t,e){return this.channel.simulateTransaction(t,e).then((t=>this.responseParser.parseSimulateTransactionResponse(t)))}async waitForTransaction(t,e){const r=await this.channel.waitForTransaction(t,e);return new ZC(r)}async getStorageAt(t,e,r){return this.channel.getStorageAt(t,e,r)}async getClassHashAt(t,e){return this.channel.getClassHashAt(t,e)}async getClassByHash(t){return this.getClass(t)}async getClass(t,e){return this.channel.getClass(t,e).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e){return this.channel.getClassAt(t,e).then(this.responseParser.parseContractClassResponse)}async getContractVersion(t,e,{blockIdentifier:r=this.channel.blockIdentifier,compiler:i=!0}={}){let n;if(t)n=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");n=await this.getClass(e,r)}if(pC(n)){if(i){return{cairo:"1",compiler:PI(n.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async getEstimateFee(t,e,r,i){return this.getInvokeEstimateFee(t,e,r,i)}async getInvokeEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:ZS.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeclareEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:ZS.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeployAccountEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:ZS.DEPLOY_ACCOUNT,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getEstimateFeeBulk(t,e){return this.channel.getEstimateFee(t,e).then((t=>this.responseParser.parseFeeEstimateBulkResponse(t)))}async invokeFunction(t,e){return this.channel.invoke(t,e)}async declareContract(t,e){return this.channel.declare(t,e)}async deployAccountContract(t,e){return this.channel.deployAccount(t,e)}async callContract(t,e){return this.channel.callContract(t,e)}async estimateMessageFee(t,e){return this.channel.estimateMessageFee(t,e)}async getSyncingStats(){return this.channel.getSyncingStats()}async getEvents(t){return this.channel.getEvents(t)}async verifyMessageInStarknet(t,e,r,i,n){const o=rz(t);if(!RN(t)&&!o)throw new Error("message has a wrong format.");if(!RN(r))throw new Error("accountAddress shall be a BigNumberish");const a=o?cz(t,r):wN(t),s=i?[i]:["isValidSignature","is_valid_signature"],h=n||{okResponse:[],nokResponse:["0x0","0x00"],error:["argent/invalid-signature","is invalid, with respect to the public key","INVALID_SIG"]};let u;for(const t of s)try{const i=await this.callContract({contractAddress:wN(r),entrypoint:t,calldata:mT.compile({hash:yN(a).toString(),signature:nC(e)})});if(h.nokResponse.includes(i[0].toString()))return!1;if(0===h.okResponse.length||h.okResponse.includes(i[0].toString()))return!0;throw Error("signatureVerificationResponse Error: response is not part of known responses")}catch(t){if(h.error.some((e=>t.message.includes(e))))return!1;u=t}throw Error(`Signature verification Error: ${u}`)}async isClassDeclared(t,e){let r;if(!t.classHash&&"contract"in t){r=function(t){const e={...t};if(pC(t.contract)&&(!t.compiledClassHash&&t.casm&&(e.compiledClassHash=WT(t.casm)),!e.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(e.classHash=t.classHash??XT(t.contract),!e.classHash)throw new Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return e}(t).classHash}else{if(!t.classHash)throw Error("contractClassIdentifier type not satisfied");r=t.classHash}try{return await this.getClass(r,e)instanceof Object}catch(t){if(t instanceof VS)return!1;throw t}}async prepareInvocations(t){const e=[];for(const r of t)if(r.type===ZS.DECLARE){await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r)}else e.push(r);return e}};Ix({},{StarknetIdContract:()=>_z,StarknetIdIdentityContract:()=>Az,StarknetIdMulticallContract:()=>xz,StarknetIdPfpContract:()=>Tz,StarknetIdPopContract:()=>zz,StarknetIdVerifierContract:()=>Nz,dynamicCallData:()=>Bz,dynamicFelt:()=>Pz,execution:()=>Rz,getStarknetIdContract:()=>Ez,getStarknetIdIdentityContract:()=>jz,getStarknetIdMulticallContract:()=>Sz,getStarknetIdPfpContract:()=>Cz,getStarknetIdPopContract:()=>Oz,getStarknetIdVerifierContract:()=>Iz,isStarkDomain:()=>Dz,useDecoded:()=>kz,useEncoded:()=>Mz});var mz="abcdefghijklmnopqrstuvwxyz0123456789-",pz=BigInt(mz.length+1),gz="这来",yz=BigInt(mz.length),wz=BigInt(gz.length),vz=BigInt(gz.length+1);function bz(t){let e=0;for(;t.endsWith(gz[gz.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function kz(t){let e="";return t.forEach((t=>{for(;t!==lS;){const r=t%pz;if(t/=pz,r===BigInt(mz.length)){const r=t/vz;if(r===lS){const i=t%vz;t=r,e+=i===lS?mz[0]:gz[Number(i)-1]}else{e+=gz[Number(t%wz)],t/=wz}}else e+=mz[Number(r)]}const[r,i]=bz(e);i&&(e=r+(i%2==0?gz[gz.length-1].repeat(i/2-1)+gz[0]+mz[1]:gz[gz.length-1].repeat((i-1)/2+1))),e+="."})),e?e.concat("stark"):e}function Mz(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(gz[0]+mz[1])){const[e,r]=bz(t.substring(0,t.length-2));t=e+gz[gz.length-1].repeat(2*(r+1))}else{const[e,r]=bz(t);r&&(t=e+gz[gz.length-1].repeat(1+2*(r-1)))}for(let i=0;i<t.length;i+=1){const n=t[i],o=mz.indexOf(n),a=BigInt(mz.indexOf(n));if(-1!==o)i===t.length-1&&t[i]===mz[0]?(e+=r*yz,r*=pz,r*=pz):(e+=r*a,r*=pz);else if(-1!==gz.indexOf(n)){e+=r*yz,r*=pz;const o=(i===t.length-1?1:0)+gz.indexOf(n);e+=r*BigInt(o),r*=wz}}return e}var _z={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function Ez(t){switch(t){case"0x534e5f4d41494e":return _z.MAINNET;case"0x534e5f5345504f4c4941":return _z.TESTNET_SEPOLIA;default:throw new Error("Starknet.id is not yet deployed on this network")}}var Az={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function jz(t){switch(t){case"0x534e5f4d41494e":return Az.MAINNET;case"0x534e5f5345504f4c4941":return Az.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var xz="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function Sz(t){switch(t){case"0x534e5f4d41494e":case"0x534e5f5345504f4c4941":return xz;default:throw new Error("Starknet.id multicall contract is not yet deployed on this network")}}var Nz={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function Iz(t){switch(t){case"0x534e5f4d41494e":return Nz.MAINNET;case"0x534e5f5345504f4c4941":return Nz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var Tz={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function Cz(t){switch(t){case"0x534e5f4d41494e":return Tz.MAINNET;case"0x534e5f5345504f4c4941":return Tz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var zz={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function Oz(t){switch(t){case"0x534e5f4d41494e":return zz.MAINNET;case"0x534e5f5345504f4c4941":return zz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function Rz(t,e,r){return new UI({Static:t,IfEqual:e?$I(e[0],e[1],e[2]):void 0,IfNotEqual:r?$I(r[0],r[1],r[2]):void 0})}function Pz(t,e){return new UI({Hardcoded:t,Reference:e?$I(e[0],e[1]):void 0})}function Bz(t,e,r){return new UI({Hardcoded:t,Reference:e?$I(e[0],e[1]):void 0,ArrayReference:r?$I(r[0],r[1]):void 0})}function Dz(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var $z=class extends(Ex(fz,class t{async getStarkName(e,r){return t.getStarkName(this,e,r)}async getAddressFromStarkName(e,r){return t.getAddressFromStarkName(this,e,r)}async getStarkProfile(e,r,i,n,o,a,s){return t.getStarkProfile(this,e,r,i,n,o,a,s)}static async getStarkName(t,e,r){const i=await t.getChainId(),n=r??Ez(i);try{const r=await t.callContract({contractAddress:n,entrypoint:"address_to_domain",calldata:mT.compile({address:e,hint:[]})}),i=kz(r.map((t=>BigInt(t))).slice(1));if(!i)throw Error("Starkname not found");return i}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}static async getAddressFromStarkName(t,e,r){const i=e.endsWith(".stark")?e:`${e}.stark`;if(!Dz(i))throw new Error("Invalid domain, must be a valid .stark domain");const n=await t.getChainId(),o=r??Ez(n);try{const e=i.replace(".stark","").split(".").map((t=>Mz(t).toString(10)));return(await t.callContract({contractAddress:o,entrypoint:"domain_to_address",calldata:mT.compile({domain:e,hint:[]})}))[0]}catch{throw Error("Could not get address from stark name")}}static async getStarkProfile(t,e,r,i,n,o,a,s){const h=await t.getChainId(),u=r??Ez(h),l=i??jz(h),c=n??Iz(h),d=o??Cz(h),f=a??Oz(h),m=s??Sz(h);try{const r=[{execution:Rz({}),to:Bz(u),selector:Bz(DN("address_to_domain")),calldata:[Bz(e),Bz("0")]},{execution:Rz({}),to:Pz(u),selector:Pz(DN("domain_to_id")),calldata:[Bz(void 0,void 0,[0,0])]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("twitter")),Bz(c),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("github")),Bz(c),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("discord")),Bz(c),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("proof_of_personhood")),Bz(f),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("nft_pp_contract")),Bz(d),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_extended_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("nft_pp_id")),Bz("2"),Bz(d),Bz("0")]},{execution:Rz(void 0,void 0,[6,0,0]),to:Pz(void 0,[6,0]),selector:Pz(DN("tokenURI")),calldata:[Bz(void 0,[7,1]),Bz(void 0,[7,2])]}],i=await t.callContract({contractAddress:m,entrypoint:"aggregate",calldata:mT.compile({calls:r})});if(Array.isArray(i)){const t=parseInt(i[0],16),e=[];let r=1;for(let n=0;n<t&&r<i.length;n+=1){const t=parseInt(i[r],16);r+=1;const n=i.slice(r,r+t);e.push(n),r+=t}const n=kz(e[0].slice(1).map((t=>BigInt(t)))),o="0x0"!==e[2][0]?BigInt(e[2][0]).toString():void 0,a="0x0"!==e[3][0]?BigInt(e[3][0]).toString():void 0,s="0x0"!==e[4][0]?BigInt(e[4][0]).toString():void 0,h="0x1"===e[5][0],u="0x9"===i[0]?e[8].slice(1).map((t=>YN(t))).join(""):void 0;return{name:n,twitter:o,github:a,discord:s,proofOfPersonhood:h,profilePicture:u||`https://starknet.id/api/identicons/${BigInt(e[1][0]).toString()}`}}throw Error("Error while calling aggregate function")}catch(t){if(t instanceof Error)throw t;throw Error("Could not get user stark profile data from address")}}})){},Lz=(new fz({default:!0}),{});function Uz(t){return new hI(t).toBigInt()}function Fz(t){return hI.is(t)}function qz(t){return new hI(t).toUint256HexString()}function Vz(t){const e=function(t){const e=wN(rS(t.toString()));return rS(eS(e).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return EN(e,lS,gS-1n,"Starknet Address"),e}Ix(Lz,{UINT_128_MAX:()=>eI,UINT_256_MAX:()=>rI,bnToUint256:()=>qz,isUint256:()=>Fz,uint256ToBN:()=>Uz});function Hz(t){return"event"===t.type}function Gz(t){const e=t.filter((t=>Hz(t)&&"struct"===t.kind)),r=t.filter((t=>Hz(t)&&"enum"===t.kind)),i=e.reduce(((t,e)=>{let i=[],{name:n}=e,o=!1;const a=t=>t.type===n;for(;;){const t=r.find((t=>t.variants.some(a)));if(lN(t))break;const e=t.variants.find(a);i.unshift(e.name),"flat"===e.kind&&(o=!0),n=t.name}if(0===i.length)throw new Error("inconsistency in ABI events definition.");o&&(i=[i[i.length-1]]);const s=i.pop();let h={[rS(_v(Wx(s)).toString(16))]:e};for(;i.length>0;)h={[rS(_v(Wx(i.pop())).toString(16))]:h};return h={...h},Kz(t,h)}),{});return i}function Zz(t){return OI(t)?Gz(t):function(t){return t.filter((t=>"event"===t.type)).reduce(((t,e)=>{const r=e.name,i={...e};return i.name=r,{...t,[rS(_v(Wx(r)).toString(16))]:i}}),{})}(t)}function Kz(t,e){const r={...t};return pN(t)&&pN(e)&&Object.keys(e).forEach((i=>{pN(e[i])?i in t?r[i]=Kz(t[i],e[i]):Object.assign(r,{[i]:e[i]}):Object.assign(r,{[i]:e[i]})})),r}function Jz(t,e,r,i){const n=t.flat().reduce(((t,n)=>{let o=e[n.keys.shift()??0];if(!o)return t;for(;!o.name;){const t=n.keys.shift();hN(!!t,'Not enough data in "keys" property of this event.'),o=o[t]}const a={};a[o.name]={};const s=n.keys[Symbol.iterator](),h=n.data[Symbol.iterator](),u=o.members?.filter((t=>"key"===t.kind))||o.keys,l=o.members?.filter((t=>"data"===t.kind))||o.data;return u.forEach((t=>{a[o.name][t.name]=oT(s,t,r,i,a[o.name])})),l.forEach((t=>{a[o.name][t.name]=oT(h,t,r,i,a[o.name])})),"block_hash"in n&&(a.block_hash=n.block_hash),"block_number"in n&&(a.block_number=n.block_number),"transaction_hash"in n&&(a.transaction_hash=n.transaction_hash),t.push(a),t}),[]);return n}function Wz(t){if(!t.events?.length)throw new Error("UDC emitted event is empty");const e=t.events.find((t=>_N(t.from_address)===_N(jS.ADDRESS)))||{data:[]};return{transaction_hash:t.transaction_hash,contract_address:e.data[0],address:e.data[0],deployer:e.data[1],unique:e.data[2],classHash:e.data[3],calldata_len:e.data[4],calldata:e.data.slice(5,5+parseInt(e.data[4],16)),salt:e.data[e.data.length-1]}}Ix({},{getAbiEvents:()=>Zz,isAbiEvent:()=>Hz,parseEvents:()=>Jz,parseUDCEvent:()=>Wz});function Yz(t){const e=t.calldata??[],r=Array.isArray(e)?e:mT.compile(e);return{to:t.contractAddress,selector:DN(t.entrypoint),calldata:r}}function Qz(t,e){const r=Yz(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function Xz(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function tO(t,e,r,i,n){return"1"===n?{types:nN,primaryType:"OutsideExecution",domain:Xz(t,n),message:{...e,nonce:r,calls_len:i.length,calls:i.map((t=>Qz(t,n)))}}:{types:oN,primaryType:"OutsideExecution",domain:Xz(t,n),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:i.map((t=>Qz(t,n)))}}}function eO(t){const e=t.outsideExecution,r=nC(t.signature);return mT.compile({outside_execution:e,signature:r})}function rO(t){return(Array.isArray(t)?t:[t]).map((t=>{let e;if("1"===t.version)e="execute_from_outside";else{if("2"!==t.version)throw new Error("Unsupported OutsideExecution version");e="execute_from_outside_v2"}return{contractAddress:wN(t.signerAddress),entrypoint:e,calldata:eO(t)}}))}Ix({},{buildExecuteFromOutsideCall:()=>rO,buildExecuteFromOutsideCallData:()=>eO,getOutsideCall:()=>Yz,getTypedData:()=>tO});async function iO(t,e,r){const i={contractAddress:wN(e),entrypoint:"supports_interface",calldata:[wN(r)]};try{const e=await t.callContract(i);return 0n!==BigInt(e[0])}catch{return!1}}Ix({},{supportsInterface:()=>iO});function nO(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function oO(t){return t.request({type:"wallet_getPermissions"})}function aO(t,e){return t.request({type:"wallet_watchAsset",params:e})}function sO(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function hO(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function uO(t){return t.request({type:"wallet_requestChainId"})}function lO(t){return t.request({type:"wallet_deploymentData"})}function cO(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function dO(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function fO(t,e){return t.request({type:"wallet_signTypedData",params:e})}function mO(t){return t.request({type:"wallet_supportedSpecs"})}function pO(t,e){t.on("accountsChanged",e)}function gO(t,e){t.on("networkChanged",e)}Ix({},{addDeclareTransaction:()=>dO,addInvokeTransaction:()=>cO,addStarknetChain:()=>sO,deploymentData:()=>lO,getPermissions:()=>oO,onAccountChange:()=>pO,onNetworkChanged:()=>gO,requestAccounts:()=>nO,requestChainId:()=>uO,signMessage:()=>fO,supportedSpecs:()=>mO,switchStarknetChain:()=>hO,watchAsset:()=>aO});var yO={1:{key:"1",name:"Ethereum",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",ensResolvers:["0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63","0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",rpc:["https://rpc.ankr.com/eth",{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],light:["https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:{url:"https://etherscan.io",apiUrl:"https://api.etherscan.io"},start:7929876,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},8:{key:"8",name:"Ubiq",chainId:8,network:"Ubiq",multicall:"0x6668750957e4083725926B71C41bDF1434C73262",rpc:["https://rpc.octano.dev"],ws:["wss://ws.octano.dev"],explorer:{url:"https://ubiqscan.io"},start:1,logo:"ipfs://Qmec3HLoN4QhwZAhw4XTi2aN8Wwmcko5hHN22sHARzb9tw"},10:{key:"10",name:"OP Mainnet",chainId:10,network:"OP Mainnet",multicall:"0x35A6Cdb2C9AD4a45112df4a04147EB07dFA01aB7",rpc:["https://opt-mainnet.g.alchemy.com/v2/JzmIL4Q3jBj7it2duxLFeuCa9Wobmm7D"],explorer:{url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io"},start:657806,logo:"ipfs://bafkreifu2remiqfpsb4hgisbwb3qxedrzpwsea7ik4el45znjcf56xf2ku"},19:{key:"19",name:"Songbird Canary-Network",shortName:"Songbird",chainId:19,network:"songbird",multicall:"0x17032Ea9c3a13Ed337665145364c0d2aD1108c91",rpc:["https://songbird-api.flare.network/ext/C/rpc"],explorer:{url:"https://songbird-explorer.flare.network"},start:21807126,logo:"ipfs://QmXyvnrZY8FUxSULfnKKA99sAEkjAHtvhRx5WeHixgaEdu"},24:{key:"24",name:"KardiaChain Mainnet",shortName:"KAI",chainId:24,network:"mainnet",multicall:"0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",rpc:["https://kai-internal.kardiachain.io"],explorer:{url:"https://explorer.kardiachain.io"},start:8260245,logo:"ipfs://bafkreig73yfyqzbxydv6e3dbj5nks3f57px2iez7tywayey4rilfhhrr34"},25:{key:"25",name:"Cronos",shortName:"Cronos",chainId:25,network:"mainnet",multicall:"0x6F522a3982e8F9A50A2EDc9E46ed1A3aE2B3FD3a",rpc:["https://evm-cronos.crypto.org"],explorer:{url:"https://cronos.crypto.org/explorer"},start:4067,logo:"ipfs://QmfSJbtirJoa3Pt7o5Fdm85wbyw9V1hpzqLr5PQbdnfsAj"},30:{key:"30",name:"RSK",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:{url:"https://explorer.rsk.co"},start:2516442,logo:"ipfs://QmXTwpE1SqoNZmyY4c3fYWy6qUgQELsyWKbgJo2Pg6K6V9"},46:{key:"46",name:"Darwinia Network",shortName:"Darwinia",chainId:46,network:"mainnet",multicall:"0x67f9ae42EaA9a8aBf065D60ec6Ab3C1A11370607",rpc:["https://rpc.darwinia.network"],explorer:{url:"https://darwinia.subscan.io"},start:141853,logo:"ipfs://bafkreicf55maidhx46pyu3mwsshlr43xbewr6tkckkonh4nesbkp7krwkm"},56:{key:"56",name:"BNB Smart Chain",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://rpc.ankr.com/bsc","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org"],explorer:{url:"https://bscscan.com"},start:461230,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},61:{key:"61",name:"Ethereum Classic",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"0x51be3a92C56ae7E207C5b5Fd87F7798Ce82C1AC2",rpc:["https://www.ethercluster.com/etc"],explorer:{url:"https://blockscout.com/etc/mainnet"},start:13307544,logo:"ipfs://QmVegc28DvA7LjKUFysab81c9BSuN4wQVDQkRXyAtuEBis"},66:{key:"66",name:"OKExChain",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:{url:"https://www.oklink.com/okexchain"},start:5076543,logo:"ipfs://Qmd7dKnNwHRZ4HRCbCXUbkNV7gP28fGqPdjbHtjRtT9sQF"},75:{key:"75",name:"Decimal",shortName:"mainnet",chainId:75,network:"mainnet",multicall:"0x949d1A0757803C51F2EfFFEb5472C861A898B8E8",rpc:[],explorer:{url:"https://explorer.decimalchain.com"},start:16031065,logo:"ipfs://bafkreihkdhbce5rkogl63xegaarlirjrvbfarxbtbf5mqme3s5grvbjyxm"},81:{key:"81",name:"Shibuya Network",shortName:"Shibuya",chainId:81,network:"testnet",testnet:!0,multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shibuya.astar.network:8545"],explorer:{url:"https://blockscout.com/shibuya"},start:856303,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},82:{key:"82",name:"Meter",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:{url:"https://scan.meter.io"},start:4992871,logo:"ipfs://QmSZvT9w9eUDvV1YVaq3BKKEbubtNVqu1Rin44FuN4wz11"},97:{key:"97",name:"BNB Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",testnet:!0,multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://data-seed-prebsc-1-s1.binance.org:8545","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive"],explorer:{url:"https://testnet.bscscan.com"},start:3599656,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},100:{key:"100",name:"Gnosis Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://gno.getblock.io/mainnet/6c1d1e6e-75d9-452f-a863-a694bff93d5c/","https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://rpc.gnosischain.com"],light:["https://rpc.gnosischain.com"],ws:["wss://rpc.xdaichain.com/wss"],explorer:{url:"https://gnosis.blockscout.com"},start:4108192,logo:"ipfs://QmZeiy8Ax4133wzxUQM9ky8z5XFVf6YLFjJMmTWbWVniZR"},108:{key:"108",name:"Thundercore",chainId:108,network:"mainnet",multicall:"0x3017086deef56679e267f67f66c4415109b7a97f",rpc:["https://mainnet-rpc.thundercore.com/archived/SNAPSHOTEuR82a75fLYA"],explorer:{url:"https://viewblock.io/thundercore"},start:94425385,logo:"ipfs://bafkreifc5z5vtvqx2luzgateyvoocwpd2ifv2hwufxdnyl2a767wa6icli"},109:{key:"109",name:"Shibarium",shortName:"mainnet",chainId:109,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://shibariumscan.io"},start:3485946,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm"},122:{key:"122",name:"Fuse",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://explorer-node.fuse.io/","https://oefusefull1.liquify.info/"],explorer:{url:"https://explorer.fuse.io"},start:11923459,logo:"ipfs://QmXjWb64nako7voaVEifgdjAbDbswpTY8bghsiHpv8yWtb"},137:{key:"137",name:"Polygon PoS",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://rpc.ankr.com/polygon","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e"],ws:["wss://ws-mainnet.matic.network"],explorer:{url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com"},start:9834491,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},144:{key:"144",name:"PHI Network",shortName:"PHI",chainId:144,network:"mainnet",multicall:"0xc2f41B404a6757863AAeF49ff93039421acCd630",rpc:["https://connect.phi.network"],explorer:{url:"https://phiscan.com"},start:360030,logo:"ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"},146:{key:"146",name:"Sonic",shortName:"mainnet",chainId:146,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.soniclabs.com"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44"},148:{key:"148",name:"ShimmerEVM",shortName:"ShimmerEVM",chainId:148,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.evm.shimmer.network"},start:1290,logo:"ipfs://bafkreib4xhbgbhrwkmizp4d4nz3wzbpyhdm6wpz2v2pbkk7jxsgg3hdt74"},151:{key:"151",name:"Redbelly",shortName:"mainnet",chainId:151,network:"mainnet",multicall:"0xEe43BBcC6340038130681F98d855E416F7F728e9",rpc:[],explorer:{url:"https://redbelly.routescan.io"},start:1908395,logo:"ipfs://bafkreie5mdk5shaebcec6zs5dc4722u2tn7oxvkksjy62kkjdzgnvmad7q"},157:{key:"157",name:"Shibarium Puppynet Testnet",shortName:"testnet",chainId:157,network:"testnet",multicall:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",rpc:[],explorer:{url:"https://puppyscan.shib.io"},start:3035769,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm",testnet:!0},169:{key:"169",name:"Manta Pacific",shortName:"Manta",chainId:169,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.oklink.com/manta"},start:332890,logo:"ipfs://bafkreibbrwgwdcfh755dqh4ndta6tja77qbaa36bfv4pstub6prhhore7a"},204:{key:"204",name:"opBNB",shortName:"mainnet",chainId:204,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"http://opbnbscan.com"},start:512881,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:{url:"https://explorer.energyweb.org"},start:12086501,logo:"ipfs://Qmai7AGHgs8NpeGeXgbMZz7pS2i4kw44qubCJYGrZW2f3a"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ankr.com/fantom","https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:{url:"https://ftmscan.com"},start:2497732,logo:"ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"},252:{key:"252",name:"Fraxtal",shortName:"mainnet",chainId:252,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu"},269:{key:"269",name:"High Performance Blockchain",shortName:"HPB",chainId:269,network:"mainnet",multicall:"0x67D0f263aef2F6167FA77353695D75b582Ff4Bca",rpc:["https://hpbnode.com"],ws:["wss://ws.hpbnode.com"],explorer:{url:"https://hscan.org"},start:13960096,logo:"ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"},291:{key:"291",name:"Orderly",shortName:"mainnet",chainId:291,network:"mainnet",multicall:"0x73e524d811263a145026113219F13f9133966b6b",rpc:[],explorer:{url:"https://explorer.orderly.network"},start:22457562,logo:"ipfs://bafkreibo62xtgkpam6nm34mau26gn65jlw6npb5odw4ylcd6dkwocea5ni"},296:{key:"296",name:"Hedera Testnet",shortName:"testnet",chainId:296,network:"testnet",multicall:"0xADE3166b0afA89b2CDB64870D70ADeD330Eab015",rpc:[],explorer:{url:"https://hashscan.io/testnet"},start:17561901,logo:"ipfs://bafkreia5gpitwgo4sspvvtwqcxosq2krrqo5dbrnvylgibvmypzotfmbuu",testnet:!0},300:{key:"300",name:"zkSync Sepolia Testnet",shortName:"testnet",chainId:300,network:"testnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:[],explorer:{url:"https://sepolia.explorer.zksync.dev"},start:2292,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",testnet:!0},314:{key:"314",name:"Filecoin",shortName:"mainnet",chainId:314,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://filfox.io"},start:3328594,logo:"ipfs://bafybeibyvjfmk6aqlfdrczvth55jkmnoadtrch7ht3rdmvqmy2bfxynecm"},321:{key:"321",name:"KCC",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:{url:"https://explorer.kcc.io"},start:1487453,logo:"ipfs://QmRdzYGhFRG8QLzMJahHrw3vETE2YZ9sywQbEkenSjKEvb"},324:{key:"324",name:"zkSync Era",shortName:"zkSync-era",chainId:324,network:"zkSync Era Mainnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:["https://mainnet.era.zksync.io"],explorer:{url:"https://explorer.zksync.io"},start:3908235,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"},336:{key:"336",name:"Shiden Network",shortName:"Shiden",chainId:336,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shiden.astar.network:8545","https://shiden.api.onfinality.io/public"],explorer:{url:"https://blockscout.com/shiden"},start:1170016,logo:"ipfs://QmcqGQE4Sk73zXc3e91TUFFefKBVeaNgbxV141XkSNE4xj"},369:{key:"369",name:"Pulsechain",shortName:"Pulsechain",chainId:369,network:"mainnet",multicall:"0xdbdd0FD8B16F0092f306392b699D7fbddaA9011B",rpc:["https://rpc.pulsechain.com"],explorer:{url:"https://scan.pulsechain.com"},start:17657774,logo:"ipfs://QmWUsiEWdejtHZ9B9981TYXn7Ds8C7fkB1S4h5rP3kCCZR"},416:{key:"416",name:"SX Network",shortName:"SX",chainId:416,network:"mainnet",multicall:"0x834a005DDCF990Ba1a79f259e840e58F2D14F49a",rpc:["https://rpc.sx.technology"],ws:["wss://rpc.sx.technology/ws"],explorer:{url:"https://explorer.sx.technology"},start:2680605,logo:"ipfs://QmSXLXqyr2H6Ja5XrmznXbWTEvF2gFaL8RXNXgyLmDHjAF"},592:{key:"592",name:"Astar Network",shortName:"Astar",chainId:592,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://astar.api.onfinality.io/public","https://rpc.astar.network:8545"],explorer:{url:"https://blockscout.com/astar"},start:366482,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},813:{key:"813",name:"Qitmeer",shortName:"MEER",chainId:813,network:"mainnet",multicall:"0x55034b2cF530ae3A8fC1e2e4523F58496796610F",rpc:["https://evm-dataseed1.meerscan.io","https://evm-dataseed.meerscan.com","https://evm-dataseed2.meerscan.io","https://evm-dataseed3.meerscan.io"],explorer:{url:"https://evm.meerscan.io"},start:43317,logo:"ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"},841:{key:"841",name:"Taraxa",shortName:"841",chainId:841,network:"mainnet",multicall:"0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",rpc:["https://rpc.mainnet.taraxa.io"],ws:["wss://ws.mainnet.taraxa.io"],explorer:{url:"https://mainnet.explorer.taraxa.io"},start:1515906,logo:"ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"},888:{key:"888",name:"Wanchain",chainId:888,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:{url:"https://www.wanscan.org"},start:11302663,logo:"ipfs://QmewFFN44rkxESFsHG8edaLt1znr62hjvZhGynfXqruzX3"},1001:{key:"1001",name:"Kaia Kairos Testnet",shortName:"kaia-kairos",chainId:1001,network:"testnet",testnet:!0,multicall:"0x40643B8Aeaaca0b87Ea1A1E596e64a0e14B1d244",rpc:["https://archive-en-kairos.node.kaia.io"],ws:["wss://archive-en-kairos.node.kaia.io/ws"],explorer:{url:"https://kairos.kaiascan.com"},start:87232478,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},1072:{key:"1072",name:"Shimmer EVM Testnet",shortName:"ShimmerEVM",chainId:1072,network:"testnet",testnet:!0,multicall:"0x751d21047C116413895c259f3f305e38C10B7cF6",rpc:["https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"],explorer:{url:"https://explorer.evm.testnet.shimmer.network"},start:10614,logo:"ipfs://bafkreihtwfwrue7klzedwx4rqlk6agklz4lbbk7owsyw6xzn6c2m4t5tgy"},1088:{key:"1088",name:"Metis",shortName:"metis",chainId:1088,network:"mainnet",multicall:"0xc39aBB6c4451089dE48Cffb013c39d3110530e5C",rpc:["https://andromeda.metis.io/?owner=1088"],explorer:{url:"https://andromeda-explorer.metis.io"},start:451,logo:"ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"},1101:{key:"1101",name:"Polygon zkEVM",shortName:"mainnet",chainId:1101,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://zkevm.polygonscan.com"},start:57746,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm"},1116:{key:"1116",name:"Core Chain",shortName:"Core",chainId:1116,network:"mainnet",multicall:"0x024f0041b76B598c2A0a75004F8447FaF67BD004",rpc:["https://rpcar.coredao.org/"],explorer:{url:"https://scan.coredao.org"},start:853908,logo:"ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"},1284:{key:"1284",name:"Moonbeam",shortName:"GLMR",chainId:1284,network:"mainnet",multicall:"0x83e3b61886770de2F64AAcaD2724ED4f08F7f36B",rpc:["https://rpc.api.moonbeam.network"],explorer:{url:"https://moonscan.io"},start:171135,logo:"ipfs://QmWKTEK2pj5sBBbHnMHQbWgw6euVdBrk2Ligpi2chrWASk"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.api.moonriver.moonbeam.network"],explorer:{url:"https://blockscout.moonriver.moonbeam.network"},start:413539,logo:"ipfs://QmXtgPesL87Ejhq2Y7yxsaPYpf4RcnoTYPJWPcv6iiYhoi"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",testnet:!0,multicall:"0xf09FD6B6FF3f41614b9d6be2166A0D07045A3A97",rpc:["https://rpc.testnet.moonbeam.network"],explorer:{url:"https://moonbase-blockscout.testnet.moonbeam.network"},start:859041,logo:"ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"},1315:{key:"1315",name:"Story Aeneid Testnet",shortName:"testnet",chainId:1315,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://aeneid.storyscan.io"},start:1792,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne",testnet:!0},1328:{key:"1328",name:"Sei atlantic testnet",shortName:"testnet",chainId:1328,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://seitrace.com"},start:96978658,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},1329:{key:"1329",name:"Sei",shortName:"mainnet",chainId:1329,network:"mainnet",multicall:"0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",rpc:[],explorer:{url:"https://seitrace.com"},start:79164574,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"},1480:{key:"1480",name:"Vana",shortName:"mainnet",chainId:1480,network:"mainnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://islander.vanascan.io"},start:716763,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa"},1514:{key:"1514",name:"Story",shortName:"mainnet",chainId:1514,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.storyscan.io"},start:340998,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne"},1559:{key:"1559",name:"Tenet",shortName:"tenet",chainId:1559,network:"mainnet",multicall:"0xcCB3F00bE353950E4C08501ac8Af48765EAAa738",rpc:[],explorer:{url:"https://tenetscan.io"},start:944415,logo:"ipfs://Qmc1gqjWTzNo4pyFSGtQuCu7kRSZZBUVybtTjHn2nNEEPA"},1663:{key:"1663",name:"Horizen Gobi Testnet",shortName:"Gobi",chainId:1663,network:"testnet",testnet:!0,multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:["https://gobi-testnet.horizenlabs.io/ethv1"],explorer:{url:"https://gobi-explorer.horizen.io"},start:1,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},2e3:{key:"2000",name:"Doge Chain",shortName:"dogechain",chainId:2e3,network:"mainnet",multicall:"0x6f9D3f3932B417bd4957585D236Cbc32b32C0BDc",rpc:["https://rpc.dogechain.dog"],explorer:{url:"https://explorer.dogechain.dog"},start:877115,logo:"ipfs://bafkreigovfh3pinsdih777issfgaflwu2yjzroljs2642gbvwikcd3nm4i"},2109:{key:"2109",name:"Exosama Network",shortName:"EXN",chainId:2109,network:"mainnet",multicall:"0x2feFC828e2fEfdE0C9f7740919c6A9139F886067",rpc:["https://rpc.exosama.com"],explorer:{url:"https://explorer.exosama.com"},start:94085,logo:"ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS"},2152:{key:"2152",name:"Findora",shortName:"Findora",chainId:2152,network:"mainnet",multicall:"0xCF7D1e21CBe9bdEF235aef06C5d8051B3d4DF0f5",rpc:["https://archive.prod.findora.org:8545/"],explorer:{url:"https://evm.findorascan.io"},start:4219343,logo:"ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"},2221:{key:"2221",name:"Kava Testnet",shortName:"testnet",chainId:2221,network:"testnet",multicall:"0xc7193EFE367DF0C9349a1149F4E95A2A35604262",rpc:[],explorer:{url:"https://testnet.kavascan.com"},start:6193104,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",testnet:!0},2222:{key:"2222",name:"Kava",shortName:"mainnet",chainId:2222,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://kavascan.com"},start:3661165,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"},2400:{key:"2400",name:"TCG Verse",shortName:"TCGV",chainId:2400,network:"mainnet",multicall:"0xceC65DEE0b5012F1b7321b2647681F997c7204FC",rpc:["https://rpc.tcgverse.xyz"],explorer:{url:"https://explorer.tcgverse.xyz"},start:57500,logo:"ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"},2522:{key:"2522",name:"Fraxtal Testnet",shortName:"testnet",chainId:2522,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://holesky.fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu",testnet:!0},3338:{key:"3338",name:"peaq",shortName:"mainnet",chainId:3338,network:"mainnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://peaq.subscan.io"},start:3525964,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm"},4162:{key:"4162",name:"SX Rollup",shortName:"mainnet",chainId:4162,network:"mainnet",multicall:"0x46997eb05F6A6A0bD5C140ABed09Cb02CA36b98c",rpc:[],explorer:{url:"https://explorerl2.sx.technology"},start:1847483,logo:"ipfs://bafkreibjkjx7evbw74e3sx65dtmcdr4g2rrbcorb2ivd6jz6yh6on6ozw4"},4200:{key:"4200",name:"Merlin",shortName:"merlin",chainId:4200,network:"mainnet",multicall:"0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980",rpc:[],explorer:{url:"https://scan.merlinchain.io"},start:589494,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe"},4337:{key:"4337",name:"Beam",shortName:"Beam",chainId:4337,network:"mainnet",multicall:"0x4956F15eFdc3dC16645e90Cc356eAFA65fFC65Ec",rpc:[],explorer:{url:"https://subnets.avax.network/beam"},start:1,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF"},4689:{key:"4689",name:"IoTeX",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:{url:"https://iotexscan.io"},start:11533283,logo:"ipfs://QmNkr1UPcBYbvLp7d7Pk4eF3YCsHpaNkfusKZNtykL2EQC"},5e3:{key:"5000",name:"Mantle",chainId:5e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.mantle.xyz"],explorer:{url:"https://mantlescan.xyz"},start:304717,logo:"ipfs://bafkreidkucwfn4mzo2gtydrt2wogk3je5xpugom67vhi4h4comaxxjzoz4"},5555:{key:"5555",name:"Chain Verse",shortName:"ChainVerse",chainId:5555,network:"ChainVerse",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.chainverse.info"],explorer:{url:"https://explorer.chainverse.info"},start:6334180,logo:"ipfs://QmQyJt28h4wN3QHPXUQJQYQqGiFUD77han3zibZPzHbitk"},5611:{key:"5611",name:"opBNB Testnet",shortName:"testnet",chainId:5611,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://opbnb-testnet.bscscan.com"},start:3705108,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64",testnet:!0},6102:{key:"6102",name:"Cascadia Testnet",shortName:"Cascadia",chainId:6102,network:"testnet",multicall:"0x728989819bAD588F193563008E0a03E8cD6a3e4a",rpc:["https://testnet.cascadia.foundation"],explorer:{url:"https://explorer.cascadia.foundation"},testnet:!0,start:370457,logo:"ipfs://QmWkhZYhReYyaa5pQXj32hEGxoRcBqarFMcfQScELmjYQj"},6900:{key:"6900",name:"Animechain Testnet",shortName:"testnet",chainId:6900,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-testnet-i8yja6a1a0.t.conduit.xyz"},start:1666749,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi",testnet:!0},7332:{key:"7332",name:"Horizen EON",shortName:"EON",chainId:7332,network:"mainnet",multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:[],explorer:{url:"https://eon-explorer.horizenlabs.io"},start:85108,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},7341:{key:"7341",name:"Shyft",shortName:"Shyft",chainId:7341,network:"mainnet",multicall:"0xceb10e9133D771cA93c8002Be527A465E85381a2",rpc:["https://rpc.shyft.network"],explorer:{url:"https://bx.shyft.network"},start:3673983,logo:"ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"},7560:{key:"7560",name:"Cyber",shortName:"mainnet",chainId:7560,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://cyberscan.co"},start:1731707,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"},8217:{key:"8217",name:"Kaia Mainnet",shortName:"kaia-mainnet",chainId:8217,network:"mainnet",multicall:"0x5f5f0d1b9ff8b3dcace308e39b13b203354906e9",rpc:["https://archive-en.node.kaia.io"],ws:["wss://archive-en.node.kaia.io/ws"],explorer:{url:"https://kaiascan.com"},start:91582357,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},8453:{key:"8453",name:"Base",shortName:"mainnet",chainId:8453,network:"mainnet",multicall:"0xca11bde05977b3631167028862be2a173976ca11",rpc:[],explorer:{url:"https://basescan.org"},start:5022,logo:"ipfs://bafkreid4ek4gnj6ccxl3yubwj2wr3d5t6dqelvvh4hv5wo5eldkqs725ri"},9001:{key:"9001",name:"Evmos Network",shortName:"Evmos",chainId:9001,network:"mainnet",multicall:"0x37763d16f8dBf6F185368E0f256350cAb7E24b26",rpc:["https://eth.bd.evmos.org:8545"],ws:["wss://eth.bd.evmos.org:8546"],explorer:{url:"https://escan.live"},start:13959539,logo:"ipfs://bafkreif4obrdoiretpozdd56seziywc6clha7wwkbldng3ovry2bpzly34"},9990:{key:"9990",name:"Agung testnet",shortName:"testnet",chainId:9990,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://agung-testnet.subscan.io"},start:2031789,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm",testnet:!0},1e4:{key:"10000",name:"smartBCH",shortName:"BCH",chainId:1e4,network:"mainnet",multicall:"0x1b38EBAd553f218e2962Cb1C0539Abb5d6A37774",rpc:["https://smartbch.greyh.at/"],explorer:{url:"https://smartbch-explorer.web.app"},start:268248,logo:"ipfs://QmWG1p7om4hZ4Yi4uQvDpxg4si7qVYhtppGbcDGrhVFvMd"},10243:{key:"10243",name:"Arthera Testnet",shortName:"Arthera_",chainId:10243,network:"testnet",testnet:!0,multicall:"0x27c7FC597aD2E81C4c1cA1769972f79DaF042Da7",rpc:["https://rpc-test.arthera.net"],explorer:{url:"https://explorer-test.arthera.net"},start:10523,logo:"ipfs://QmYQp3e52KjkT4bYdAvB6ACEEpXs2D8DozsDitaADRY2Ak"},13337:{key:"13337",name:"Beam Testnet",shortName:"testnet",chainId:13337,network:"testnet",multicall:"0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E",rpc:[],explorer:{url:"https://subnets-test.avax.network/beam"},start:3,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",testnet:!0},13371:{key:"13371",name:"Immutable zkEVM",shortName:"mainnet",chainId:13371,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.immutable.com"},start:3680945,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"},13473:{key:"13473",name:"Immutable zkEVM Testnet",shortName:"testnet",chainId:13473,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.testnet.immutable.com"},start:5307209,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",testnet:!0},14800:{key:"14800",name:"Vana Moksha Testnet",shortName:"testnet",chainId:14800,network:"testnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://moksha.vanascan.io"},start:732283,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa",testnet:!0},16718:{key:"16718",name:"AirDAO",chainId:16718,network:"mainnet",multicall:"0x25e81aC81A8B03389D78CB45faB78353aB528574",rpc:["https://network-archive.ambrosus.io"],ws:["wss://network-archive.ambrosus.io/ws"],explorer:{url:"https://airdao.io/explorer"},start:22922566,logo:"ipfs://QmSxXjvWng3Diz4YwXDV2VqSPgMyzLYBNfkjJcr7rzkxom"},29548:{key:"29548",name:"MCH Verse",shortName:"mainnet",chainId:29548,network:"mainnet",multicall:"0x1d39652386488CE1fE4254E105F5A42a04d43dB2",rpc:[],explorer:{url:"https://explorer.oasys.mycryptoheroes.net"},start:27458402,logo:"ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"},33111:{key:"33111",name:"Curtis",shortName:"apechain",chainId:33111,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://curtis.apescan.io"},start:6661339,logo:"ipfs://bafkreicljxttjq2xkgfwwpii5xegirgq2ctrnsjnzelxudjj33qzq65apu",testnet:!0},33139:{key:"33139",name:"ApeChain",shortName:"mainnet",chainId:33139,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://apescan.io"},start:20889,logo:"ipfs://bafkreielbgcox2jsw3g6pqulqb7pyjgx7czjt6ahnibihaij6lozoy53w4"},42161:{key:"42161",name:"Arbitrum One",chainId:42161,network:"Arbitrum mainnet",multicall:"0x7A7443F8c577d537f1d8cD4a629d40a3148Dd7ee",rpc:["https://rpc.ankr.com/arbitrum","https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/arbitrum/mainnet","https://arb-mainnet.g.alchemy.com/v2/JDvtNGwnHhTltIwfnxQocKwKkCTKA1DL"],explorer:{url:"https://arbiscan.io"},start:256508,logo:"ipfs://QmWZ5SMRfvcK8tycsDqojQaSiKedgtVkS7CkZdxPgeCVsZ"},42170:{key:"42170",name:"Arbitrum Nova",chainId:42170,network:"Arbitrum Nova",multicall:"0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14",rpc:["https://nova.arbitrum.io/rpc","https://arbitrum-nova.public.blastapi.io"],explorer:{url:"https://nova.arbiscan.io"},start:6006607,logo:"ipfs://bafkreie5xsqt3mrrwu7v32qpmmctibhzhgxf4emfzzddsdhdlfsa7fmplu"},42220:{key:"42220",name:"Celo",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo.snapshot.org","https://forno.celo.org","https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:{url:"https://celoscan.io"},start:6599803,logo:"ipfs://bafkreidvcofeczigbjr7ddapgdugwso6v2l4iolfxys7qg6kfvu2uduyva"},43113:{key:"43113",name:"Avalanche FUJI Testnet",chainId:43113,network:"testnet",testnet:!0,multicall:"0x984476ea55e32e785A9D8FF14329f99D74E3d2A2",rpc:["https://api.avax-test.network/ext/bc/C/rpc"],explorer:{url:"https://testnet.snowtrace.io"},start:10528153,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://nd-784-543-849.p2pify.com/aa7b29fc5fed65b34f0ee6b8de33f8c0/ext/bc/C/rpc","https://rpc.ankr.com/avalanche","https://api.avax.network/ext/bc/C/rpc"],explorer:{url:"https://snowtrace.io"},start:536483,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},47805:{key:"47805",name:"REI Mainnet",chainId:47805,network:"mainnet",multicall:"0x9eE9904815B80C39C1a27294E69a8626EAa7952d",rpc:["https://rpc.rei.network"],explorer:{url:"https://scan.rei.network"},start:1715902,logo:"ipfs://QmTogMDLmDgJjDjUKDHDuc2KVTVDbXf8bXJLFiVe8PRxgo"},53935:{key:"53935",name:"DFK Chain",chainId:53935,network:"mainnet",multicall:"0x5b24224dC16508DAD755756639E420817DD4c99E",rpc:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"],explorer:{url:"https://subnets.avax.network/defi-kingdoms"},start:62,logo:"ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"},57054:{key:"57054",name:"Sonic Blaze Testnet",shortName:"testnet",chainId:57054,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://testnet.sonicscan.org"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44",testnet:!0},57073:{key:"57073",name:"Ink",shortName:"mainnet",chainId:57073,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.inkonchain.com"},start:6659154,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju"},59141:{key:"59141",name:"Linea Sepolia",shortName:"testnet",chainId:59141,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.lineascan.build"},start:227427,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",testnet:!0},59144:{key:"59144",name:"Linea",shortName:"linea",chainId:59144,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://lineascan.build"},start:42,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce"},69e3:{key:"69000",name:"Animechain",shortName:"mainnet",chainId:69e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-39xf6m45e3.t.conduit.xyz"},start:23482,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi"},80001:{key:"80001",name:"Polygon Mumbai",chainId:80001,network:"testnet",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:{url:"https://mumbai.polygonscan.com",apiUrl:"https://api-mumbai.polygonscan.com"},start:12011090,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},80002:{key:"80002",name:"Polygon Amoy Testnet",shortName:"testnet",chainId:80002,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://amoy.polygonscan.com"},start:3127388,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm",testnet:!0},81457:{key:"81457",name:"Blast",shortName:"mainnet",chainId:81457,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://blastscan.io"},start:88189,logo:"ipfs://bafkreicqhrimt2zyp2kvhmbpvffxlmxovkg5vw6zkissyzibcfy45kbvrm"},84532:{key:"84532",name:"Base Sepolia",shortName:"testnet",chainId:84532,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://base-sepolia.blockscout.com"},start:1059647,logo:"ipfs://bafkreid4ek4gnj6ccxl3yubwj2wr3d5t6dqelvvh4hv5wo5eldkqs725ri",testnet:!0},88811:{key:"88811",name:"Unit Zero",shortName:"mainnet",chainId:88811,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.unit0.dev"},start:9727,logo:"ipfs://bafkreihbmy3rqlammea35nniemipxrwcgitzkiahs6nlrfjunnvgfnakp4"},88817:{key:"88817",name:"Unit Zero testnet",shortName:"testnet",chainId:88817,network:"testnet",multicall:"0x017181efb3bDB325C17800799b33Ae80B395024c",rpc:[],explorer:{url:"https://explorer-testnet.unit0.dev"},start:3973744,logo:"ipfs://bafkreihbmy3rqlammea35nniemipxrwcgitzkiahs6nlrfjunnvgfnakp4",testnet:!0},314159:{key:"314159",name:"Filecoin Calibration Testnet",shortName:"testnet",chainId:314159,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://calibration.filscan.io/en"},start:1446201,logo:"ipfs://bafkreiffbopdjior7li3nlemzko7rjua6wd2hfh2vhdbenqbv4tfsbnzwu",testnet:!0},686868:{key:"686868",name:"Merlin Testnet",shortName:"merlin",chainId:686868,network:"testnet",multicall:"0x758BC6321b7c68F4986d62a4D46E83A2DCb58c80",rpc:[],explorer:{url:"https://testnet-scan.merlinchain.io"},start:3562021,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe",testnet:!0},713715:{key:"713715",name:"Sei EVM Devnet",shortName:"devnet",chainId:713715,network:"testnet",multicall:"0xEe8d287B844959ADe40d718Dc23077ba920e2f07",rpc:[],explorer:{url:"https://seitrace.com"},start:1463669,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},763373:{key:"763373",name:"Ink Sepolia",shortName:"testnet",chainId:763373,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-sepolia.inkonchain.com"},start:9701940,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju",testnet:!0},810180:{key:"810180",name:"zkLink Nova",shortName:"zlink",chainId:810180,network:"mainnet",multicall:"0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",rpc:[],explorer:{url:"https://explorer.zklink.io"},start:146055,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"},810181:{key:"810181",name:"zkLink Nova Sepolia",shortName:"testnet",chainId:810181,network:"testnet",multicall:"0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",rpc:[],explorer:{url:"https://sepolia.explorer.zklink.io"},start:43723,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",testnet:!0},11155111:{key:"11155111",name:"Sepolia testnet",shortName:"Sepolia",chainId:11155111,network:"sepolia",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://sepolia.infura.io/v3/d26b4fd748814fe994b05899fd89e667"],ensResolvers:["0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"],ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/CA5t8ep58QKXBdLrjJHaREETHpCsy63kro9Eem6zBQAD",explorer:{url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io"},start:751532,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},11155420:{key:"11155420",name:"OP Sepolia",shortName:"testnet",chainId:11155420,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia-optimism.etherscan.io"},start:1620204,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",testnet:!0},111557560:{key:"111557560",name:"Cyber Testnet",shortName:"testnet",chainId:111557560,network:"testnet",multicall:"0xffc391F0018269d4758AEA1a144772E8FB99545E",rpc:[],explorer:{url:"https://testnet.cyberscan.co"},start:304545,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",testnet:!0},168587773:{key:"168587773",name:"Blast Sepolia",shortName:"testnet",chainId:168587773,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.blastexplorer.io"},start:756690,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",testnet:!0},245022926:{key:"245022926",name:"Neon Devnet",shortName:"devnet",chainId:245022926,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://devnet.neonscan.org"},start:205206112,logo:"ipfs://QmecRPQGa4bU7tybg1sUQY48Md9rWnmhrT6WW5ueqvhg6P",testnet:!0},1313161554:{key:"1313161554",name:"Aurora",shortName:"Aurora",chainId:1313161554,network:"mainnet",multicall:"0x32b50c286DEFd2932a0247b8bb940b78c063F16c",rpc:["https://mainnet.aurora.dev"],explorer:{url:"https://explorer.mainnet.aurora.dev"},start:57190533,logo:"ipfs://QmeRhsR1UPRTQCizdhmgr2XxphXebVKU5di97uCV2UMFpa"},16666e5:{key:"1666600000",name:"Harmony",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:{url:"https://explorer.harmony.one"},start:10911984,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",testnet:!0,multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:{url:"https://explorer.pops.one"},start:7521509,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},"0x534e5f4d41494e":{key:"0x534e5f4d41494e",name:"Starknet",shortName:"Starknet",chainId:"0x534e5f4d41494e",network:"mainnet",starknet:!0,broviderId:"sn",multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://starkscan.co"},rpc:[],start:8446,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"},"0x534e5f5345504f4c4941":{key:"0x534e5f5345504f4c4941",name:"Starknet Sepolia",shortName:"testnet",chainId:"0x534e5f5345504f4c4941",network:"testnet",starknet:!0,broviderId:"sn-sep",testnet:!0,multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://sepolia.starkscan.co"},rpc:[],start:7,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"}};const wO=new Map,vO={evm:function(t,e){return new Am({url:`${e.broviderUrl}/${t}`,timeout:e.timeout,allowGzip:!0},Number(t))},starknet:function(t,e){return new $z({nodeUrl:`${e.broviderUrl}/${t}`})}};function bO(t,e={}){const r=function(t){const e=yO[t];if(!e)throw new Error(`Network '${t}' is not supported`);return e.broviderId||String(t)}(t),i=function(t={}){var e;return{broviderUrl:t.broviderUrl||"https://rpc.snapshot.org",timeout:null!==(e=t.timeout)&&void 0!==e?e:25e3}}(e),n=function(t,e){return`${t}:${e.broviderUrl}:${e.timeout}`}(r,i),o=wO.get(n);if(o)return o;const a=function(t){var e;return(null===(e=yO[t])||void 0===e?void 0:e.starknet)?"starknet":"evm"}(t),s=vO[a](r,i);return wO.set(n,s),s}function kO(t){return!!t.primaryType&&!!t.types.StarkNetDomain}var MO=Object.freeze({__proto__:null,isStarknetMessage:kO,getHash:function(t,e){const{domain:r,types:i,primaryType:n,message:o}=t;return KC.getMessageHash({types:i,primaryType:n,domain:r,message:o},e)},default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="0x534e5f4d41494e",n={}){try{const o=bO(i,n);return yield o.getClassAt(t),o.verifyMessageInStarknet(r,e,t)}catch(t){if(t.message.includes("Contract not found"))throw new Error("Contract not deployed");throw t}}))}});function _O(t){return He(Lr(t))}var EO=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ht.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191&lt,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));var AO=EO.BN;const jO=new vt("bignumber/5.6.2"),xO={},SO=9007199254740991;let NO=!1;class IO{constructor(t,e){t!==xO&&jO.throwError("cannot call constructor directly; use BigNumber.from",vt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return CO(zO(this).fromTwos(t))}toTwos(t){return CO(zO(this).toTwos(t))}abs(){return"-"===this._hex[0]?IO.from(this._hex.substring(1)):this}add(t){return CO(zO(this).add(zO(t)))}sub(t){return CO(zO(this).sub(zO(t)))}div(t){return IO.from(t).isZero()&&OO("division-by-zero","div"),CO(zO(this).div(zO(t)))}mul(t){return CO(zO(this).mul(zO(t)))}mod(t){const e=zO(t);return e.isNeg()&&OO("division-by-zero","mod"),CO(zO(this).umod(e))}pow(t){const e=zO(t);return e.isNeg()&&OO("negative-power","pow"),CO(zO(this).pow(e))}and(t){const e=zO(t);return(this.isNegative()||e.isNeg())&&OO("unbound-bitwise-result","and"),CO(zO(this).and(e))}or(t){const e=zO(t);return(this.isNegative()||e.isNeg())&&OO("unbound-bitwise-result","or"),CO(zO(this).or(e))}xor(t){const e=zO(t);return(this.isNegative()||e.isNeg())&&OO("unbound-bitwise-result","xor"),CO(zO(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&OO("negative-width","mask"),CO(zO(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&OO("negative-width","shl"),CO(zO(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&OO("negative-width","shr"),CO(zO(this).shrn(t))}eq(t){return zO(this).eq(zO(t))}lt(t){return zO(this).lt(zO(t))}lte(t){return zO(this).lte(zO(t))}gt(t){return zO(this).gt(zO(t))}gte(t){return zO(this).gte(zO(t))}isNegative(){return"-"===this._hex[0]}isZero(){return zO(this).isZero()}toNumber(){try{return zO(this).toNumber()}catch(t){OO("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return jO.throwError("this platform does not support BigInt",vt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?NO||(NO=!0,jO.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?jO.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",vt.errors.UNEXPECTED_ARGUMENT,{}):jO.throwError("BigNumber.toString does not accept parameters",vt.errors.UNEXPECTED_ARGUMENT,{})),zO(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof IO)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new IO(xO,TO(t)):t.match(/^-?[0-9]+$/)?new IO(xO,TO(new AO(t))):jO.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&OO("underflow","BigNumber.from",t),(t>=SO||t<=-SO)&&OO("overflow","BigNumber.from",t),IO.from(String(t));const e=t;if("bigint"==typeof e)return IO.from(e.toString());if(At(e))return IO.from(Tt(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return IO.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Nt(t)||"-"===t[0]&&Nt(t.substring(1))))return IO.from(t)}return jO.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function TO(t){if("string"!=typeof t)return TO(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&jO.throwArgumentError("invalid hex","value",t),"0x00"===(t=TO(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function CO(t){return IO.from(TO(t))}function zO(t){const e=IO.from(t).toHexString();return"-"===e[0]?new AO("-"+e.substring(3),16):new AO(e.substring(2),16)}function OO(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),jO.throwError(t,vt.errors.NUMERIC_FAULT,i)}var RO=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const PO=new vt("hash/5.6.1"),BO=new Uint8Array(32);BO.fill(0);const DO=IO.from(-1),$O=IO.from(0),LO=IO.from(1),UO=IO.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const FO=Pt(LO.toHexString(),32),qO=Pt($O.toHexString(),32),VO={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},HO=["name","version","chainId","verifyingContract","salt"];function GO(t){return function(e){return"string"!=typeof e&&PO.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const ZO={name:GO("name"),version:GO("version"),chainId:function(t){try{return IO.from(t).toString()}catch(t){}return PO.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return nr(t).toLowerCase()}catch(t){}return PO.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=jt(t);if(32!==e.length)throw new Error("bad length");return Tt(e)}catch(t){}return PO.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function KO(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&PO.throwArgumentError("invalid numeric width","type",t);const n=UO.mask(r?i-1:i),o=r?n.add(LO).mul(DO):$O;return function(e){const r=IO.from(e);return(r.lt(o)||r.gt(n))&&PO.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Pt(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&PO.throwArgumentError("invalid bytes width","type",t),function(e){return jt(e).length!==r&&PO.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=jt(t),r=e.length%32;return r?Ot([e,BO.slice(r)]):Tt(e)}(e)}}}switch(t){case"address":return function(t){return Pt(nr(t),32)};case"bool":return function(t){return t?FO:qO};case"bytes":return function(t){return He(t)};case"string":return function(t){return _O(t)}}return null}function JO(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class WO{constructor(t){Wt(this,"types",Object.freeze(ie(t))),Wt(this,"_encoderCache",{}),Wt(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&PO.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===i&&PO.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);KO(a)||(r[a]||PO.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),r[a].push(i),e[i][a]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?PO.throwArgumentError("missing primary type","types",t):n.length>1&&PO.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Wt(this,"primaryType",n[0]),function n(o,a){a[o]&&PO.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,a),Object.keys(a).forEach((e=>{i[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=JO(e,t[e])+r.map((e=>JO(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=KO(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&PO.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(He)),He(Ot(n))}}const r=this.types[t];if(r){const e=_O(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?He(i):i}));return i.unshift(e),Ot(i)}}return PO.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||PO.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return He(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(KO(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&PO.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):PO.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new WO(t)}static getPrimaryType(t){return WO.from(t).primaryType}static hashStruct(t,e,r){return WO.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=VO[r];i||PO.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>HO.indexOf(t.name)-HO.indexOf(e.name))),WO.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Ot(["0x1901",WO.hashDomain(t),WO.from(e).hash(r)])}static hash(t,e,r){return He(WO.encode(t,e,r))}static resolveNames(t,e,r,i){return RO(this,void 0,void 0,(function*(){t=Xt(t);const n={};t.verifyingContract&&!Nt(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=WO.from(e);o.visit(r,((t,e)=>("address"!==t||Nt(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){WO.hashDomain(t);const i={},n=[];HO.forEach((e=>{const r=t[e];null!=r&&(i[e]=ZO[e](r),n.push({name:e,type:VO[e]}))}));const o=WO.from(e),a=Xt(e);return a.EIP712Domain?PO.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=n,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return Tt(jt(e));if(t.match(/^u?int/))return IO.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&PO.throwArgumentError("invalid string","value",e),e}return PO.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new vt("wallet/5.6.2");function YO(t,e,r,i){return Ba(WO.hash(t,e,r),i)}const QO="6492649264926492649264926492649264926492649264926492649264926492";function XO(t,e){return t.toLowerCase()===e.toLowerCase()}function tR(t){const{domain:e,types:r,message:i}=t;return $u.hash(e,r,i)}function eR(t,e,i,n){return r(this,void 0,void 0,(function*(){let r;try{r=yield UP(n,["function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[jt(i),e]])}catch(t){if(t.message.startsWith("missing revert data in call exception"))return!1;throw t}return XO(r,"0x1626ba7e")}))}function rR(t,e,i,n){return r(this,void 0,void 0,(function*(){return XO(yield UP(n,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[jt(i),e]]),"0x20c13b0b")}))}var iR=Object.freeze({__proto__:null,getHash:tR,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){const{domain:o,types:a,message:s}=r;try{if(XO(t,YO(o,a,s,e)))return!0}catch(t){}const h=bO(i,n),u=tR(r);if(e.endsWith(QO))try{return"0x01"===(yield h.call({data:xt(["0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",(new ai).encode(["address","bytes32","bytes"],[t,jt(u),e])])}))}catch(t){return!1}return!!(yield eR(t,e,u,h))||(yield rR(t,e,u,h))}))}});var nR=["ipfs.snapshot.box","snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];class oR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"number"==typeof t&&void 0!==(null==e?void 0:e[t-1])}getValidVotes(){return this.votes.filter((t=>oR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>{const r=this.getValidVotes().filter((t=>t.choice===e+1));return r.reduce(((t,e)=>t+e.balance),0)}))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>{const r=this.strategies.map(((t,r)=>{const i=this.getValidVotes().filter((t=>t.choice===e+1));return i.reduce(((t,e)=>t+e.scores[r]),0)}));return r}))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices[this.selected-1]}}class aR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size}getValidVotes(){return this.votes.filter((t=>aR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.balance),0)))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.scores[r]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected?this.proposal.choices.filter(((t,e)=>this.selected.includes(e+1))).join(", "):""}}function sR(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function hR(t,e){return Math.sqrt(t*e)}function uR(t){return t*t}function lR(t,e){return t.map((t=>e*t))}class cR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>cR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>{const i=t.map((t=>hR(sR(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return uR(i)}));return lR(r.map(((t,e)=>sR(r[e],r))),e)}getScoresByStrategy(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.map((t=>hR(sR(t.choice[r+1],Object.values(t.choice)),t.scores[i]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[uR(t)]))));return r.map(((t,i)=>lR(this.strategies.map(((t,e)=>sR(r[i][e][0],r.flat(2)))),e)))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1]){const r=sR(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function dR(t,e){const r=[...new Set(t.map((t=>t[0])).flat())],i=Object.entries(t.reduce(((t,[e],r,i)=>{const n=i[r][1];t[e[0]][0]+=n;const o=i[r][2];return o.length>1?t[e[0]][1]=o.map(((r,i)=>r+t[e[0]][1][i]||r)):t[e[0]][1]=[t[e[0]][1].concat(o).reduce(((t,e)=>t+e),0)],t}),Object.assign({},...r.map((t=>({[t]:[0,[]]})))))),n=i.map((t=>[t[0],t[1][0]])),[o,a]=n.reduce((([t,e],[r,i])=>i>e?[r,i]:[t,e]),["?",-1/0]),[s,h]=n.reduce((([t,e],[r,i])=>i<e?[r,i]:[t,e]),["?",1/0]),u=i.sort(((t,e)=>e[1][0]-t[1][0])),l=t.map((t=>t[1])).reduce(((t,e)=>t+e),0);return e.push({round:e.length+1,sortedByHighest:u}),a>l/2||u.length<3?e:dR(t.map((t=>[t[0].filter((t=>t!=s)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function fR(t){const e=dR(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class mR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size&&t.length>0&&t.length===e.length}getValidVotes(){return this.votes.filter((t=>mR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=fR(t);return e.choices.map(((t,e)=>r.filter((t=>Number(t[0])===e+1)).reduce(((t,e)=>t+e[1][0]),0)))}(this.getValidVotes(),this.proposal)}getScoresByStrategy(){const t=fR(this.getValidVotes());return this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.filter((t=>Number(t[0])===r+1)).reduce(((t,e)=>t+(e[1][1][i]||0)),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>this.proposal.choices[t-1])).filter(Boolean).map(((t,e)=>`(${YP(e+1)}) ${t}`)).join(", ")}}class pR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return!(!Array.isArray(t)||0===t.length||t.length>e.length||new Set(t).size!==t.length)&&t.every((t=>Number.isInteger(t)&&t>=1&&t<=e.length))}getValidVotes(){return this.votes.filter((t=>pR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=Array.from({length:e},(()=>Array(e).fill(0))),i=this.getScoresTotal();for(const e of t)for(let t=0;t<e.choice.length;t++)for(let i=t+1;i<e.choice.length;i++){const n=e.choice[t]-1,o=e.choice[i]-1;r[n][o]+=e.balance,r[o][n]-=e.balance}const n=Array(e).fill(0);let o=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++)if(t!==i){const e=r[t][i];e>0?n[t]++:e<0?n[i]++:(n[t]+=.5,n[i]+=.5)}return o=n.reduce(((t,e)=>t+e),0),o>0?n.map((t=>t/o*i)):n.map((()=>i/e))}getScoresByStrategy(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=this.strategies.length,i=Array.from({length:e},(()=>Array.from({length:e},(()=>Array(r).fill(0))))),n=Array(r).fill(0);for(const e of t)for(let t=0;t<r;t++)n[t]+=e.scores[t];for(const e of t)for(let t=0;t<e.choice.length;t++)for(let n=t+1;n<e.choice.length;n++){const o=e.choice[t]-1,a=e.choice[n]-1;for(let t=0;t<r;t++)i[o][a][t]+=e.scores[t],i[a][o][t]-=e.scores[t]}const o=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<e;t++)for(let n=0;n<e;n++)if(t!==n)for(let e=0;e<r;e++){const r=i[t][n][e];r>0?o[t][e]++:r<0?o[n][e]++:(o[t][e]+=.5,o[n][e]+=.5)}const a=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<r;t++){let r=0;for(let i=0;i<e;i++)r+=o[i][t];if(r>0)for(let i=0;i<e;i++)a[i][t]=o[i][t]/r*n[t];else if(n[t]>0)for(let r=0;r<e;r++)a[r][t]=n[t]/e}return a}getScoresTotal(){return this.getValidVotes().reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>this.proposal.choices[t-1])).join(", ")}}function gR(t,e,r){const i=r.reduce(((t,e)=>t+e),0),n=e[t]/i*100;return isNaN(n)?0:n}function yR(t,e,r){return gR(t+1,e,Object.values(e))/100*r}class wR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>wR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>yR(e,t.choice,t.balance))).reduce(((t,e)=>t+e),0))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((e,r)=>gR(r,t,t))).map((t=>e/100*t))}getScoresByStrategy(){const t=this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().map((t=>yR(e,t.choice,t.scores[r]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[t])))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((r,i)=>this.strategies.map(((e,r)=>gR(0,t[i][r],t.flat(2)))).map((t=>[e/100*t])).flat()))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1])return`${Math.round(10*gR(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var vR={"single-choice":oR,approval:aR,quadratic:cR,"ranked-choice":mR,copeland:pR,weighted:wR,basic:oR};const bR={1:"https://subgrapher.snapshot.org/delegation/1",10:"https://subgrapher.snapshot.org/delegation/10",56:"https://subgrapher.snapshot.org/delegation/56",100:"https://subgrapher.snapshot.org/delegation/100",137:"https://subgrapher.snapshot.org/delegation/137",146:"https://subgrapher.snapshot.org/delegation/146",250:"https://subgrapher.snapshot.org/delegation/250",5e3:"https://subgrapher.snapshot.org/delegation/5000",8453:"https://subgrapher.snapshot.org/delegation/8453",42161:"https://subgrapher.snapshot.org/delegation/42161",59144:"https://subgrapher.snapshot.org/delegation/59144",81457:"https://subgrapher.snapshot.org/delegation/81457",84532:"https://subgrapher.snapshot.org/delegation/84532",11155111:"https://subgrapher.snapshot.org/delegation/11155111"},kR=1e3;function MR(t){return t.length===kR&&t[0].timestamp===t[t.length-1].timestamp}function _R(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function ER(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function AR(t){return r(this,arguments,void 0,(function*({url:t,spaces:e,pivot:r,snapshot:i}){const n={delegations:{__args:{where:{timestamp_gte:r},first:kR,skip:0,orderBy:"timestamp",orderDirection:"asc"},delegator:!0,space:!0,delegate:!0,timestamp:!0}};return"latest"!==i&&(n.delegations.__args.block={number:i}),null!==e&&(n.delegations.__args.where.space_in=e),(yield FP(t,n)).delegations||[]}))}const jR=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"];function xR(t,e){if(!e||!e.outputs||!Array.isArray(t)||0===t.length)return t;const r=e.outputs,i=[];let n=0;try{for(let e=0;e<r.length;e++){const o=r[e],a=t[n];switch(o.type){case"core::felt252":try{i.push(FN.decodeShortString(a))}catch(t){i.push(a)}n++;break;case"core::integer::u8":case"core::integer::u16":case"core::integer::u32":case"core::integer::u64":case"core::integer::i8":case"core::integer::i16":case"core::integer::i32":case"core::integer::i64":i.push(parseInt(a,16)),n++;break;case"core::integer::u128":case"core::integer::usize":case"core::integer::i128":i.push(BigInt(a).toString()),n++;break;case"core::integer::u256":i.push(Lz.uint256ToBN({low:a,high:t[n+1]||"0x0"})),n+=2;break;case"core::bool":i.push("0x1"===a||"0x01"===a),n++;break;default:i.push(a),n++}}return i}catch(e){return t}}const SR=t=>{if(0===t.length)return[];const[e,...r]=t,i=Number(uN.toBigInt(e)),n=r.slice(0,i),o=r.slice(i);return[n,...SR(o)]};var NR="__lodash_hash_undefined__",IR="[object Function]",TR="[object GeneratorFunction]",CR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zR=/^\w*$/,OR=/^\./,RR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PR=/\\(\\)?/g,BR=/^\[object .+?Constructor\]$/,DR=/^(?:0|[1-9]\d*)$/,$R="object"==typeof i&&i&&i.Object===Object&&i,LR="object"==typeof self&&self&&self.Object===Object&&self,UR=$R||LR||Function("return this")();var FR,qR=Array.prototype,VR=Function.prototype,HR=Object.prototype,GR=UR["__core-js_shared__"],ZR=(FR=/[^.]+$/.exec(GR&&GR.keys&&GR.keys.IE_PROTO||""))?"Symbol(src)_1."+FR:"",KR=VR.toString,JR=HR.hasOwnProperty,WR=HR.toString,YR=RegExp("^"+KR.call(JR).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),QR=UR.Symbol,XR=qR.splice,tP=dP(UR,"Map"),eP=dP(Object,"create"),rP=QR?QR.prototype:void 0,iP=rP?rP.toString:void 0;function nP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function oP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function aP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function sP(t,e,r){var i=t[e];JR.call(t,e)&&yP(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function hP(t,e){for(var r=t.length;r--;)if(yP(t[r][0],e))return r;return-1}function uP(t){if(!vP(t)||(e=t,ZR&&ZR in e))return!1;var e,r=function(t){var e=vP(t)?WR.call(t):"";return e==IR||e==TR}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?YR:BR;return r.test(function(t){if(null!=t){try{return KR.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function lP(t,e,r,i){if(!vP(t))return t;e=function(t,e){if(wP(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||bP(t))return!0;return zR.test(t)||!CR.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return wP(t)?t:mP(t)}(e);for(var n=-1,o=e.length,a=o-1,s=t;null!=s&&++n<o;){var h=pP(e[n]),u=r;if(n!=a){var l=s[h];void 0===(u=i?i(l,h,s):void 0)&&(u=vP(l)?l:fP(e[n+1])?[]:{})}sP(s,h,u),s=s[h]}return t}function cP(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function dP(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return uP(r)?r:void 0}function fP(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||DR.test(t))&&t>-1&&t%1==0&&t<e}nP.prototype.clear=function(){this.__data__=eP?eP(null):{}},nP.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},nP.prototype.get=function(t){var e=this.__data__;if(eP){var r=e[t];return r===NR?void 0:r}return JR.call(e,t)?e[t]:void 0},nP.prototype.has=function(t){var e=this.__data__;return eP?void 0!==e[t]:JR.call(e,t)},nP.prototype.set=function(t,e){return this.__data__[t]=eP&&void 0===e?NR:e,this},oP.prototype.clear=function(){this.__data__=[]},oP.prototype.delete=function(t){var e=this.__data__,r=hP(e,t);return!(r<0)&&(r==e.length-1?e.pop():XR.call(e,r,1),!0)},oP.prototype.get=function(t){var e=this.__data__,r=hP(e,t);return r<0?void 0:e[r][1]},oP.prototype.has=function(t){return hP(this.__data__,t)>-1},oP.prototype.set=function(t,e){var r=this.__data__,i=hP(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},aP.prototype.clear=function(){this.__data__={hash:new nP,map:new(tP||oP),string:new nP}},aP.prototype.delete=function(t){return cP(this,t).delete(t)},aP.prototype.get=function(t){return cP(this,t).get(t)},aP.prototype.has=function(t){return cP(this,t).has(t)},aP.prototype.set=function(t,e){return cP(this,t).set(t,e),this};var mP=gP((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(bP(t))return iP?iP.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return OR.test(t)&&r.push(""),t.replace(RR,(function(t,e,i,n){r.push(i?n.replace(PR,"$1"):e||t)})),r}));function pP(t){if("string"==typeof t||bP(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function gP(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var a=t.apply(this,i);return r.cache=o.set(n,a),a};return r.cache=new(gP.Cache||aP),r}function yP(t,e){return t===e||t!=t&&e!=e}gP.Cache=aP;var wP=Array.isArray;function vP(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function bP(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==WR.call(t)}var kP=function(t,e,r){return null==t?t:lP(t,e,r)};const MP={evm:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=new os(t,jR,e),s=new gi(r);try{const t=Math.ceil(i.length/n),e=[];Array.from(Array(t)).forEach(((t,r)=>{const h=i.slice(n*r,n*(r+1));e.push(a.aggregate(h.map((t=>[t[0].toLowerCase(),s.encodeFunctionData(t[1],t[2])])),o))}));let r=yield Promise.all(e);return r=r.reduce(((t,[,e])=>t.concat(e)),[]),r.map(((t,e)=>s.decodeFunctionResult(i[e][1],t)))}catch(t){return Promise.reject(t)}}))},starknet:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=i.map((t=>({contractAddress:t[0],entrypoint:t[1],calldata:t[2]||[]}))),s=[];for(let t=0;t<a.length;t+=n)s.push(a.slice(t,t+n));return(yield Promise.all(s.map((r=>{var i;return e.callContract({contractAddress:t,entrypoint:"aggregate",calldata:zC.fromCallsToExecuteCalldata(r)},null!==(i=o.blockTag)&&void 0!==i?i:"latest")})))).map((t=>{const[e,r,...i]=t;return SR(i)})).flat().map(((t,e)=>{const[,n]=i[e];return xR(t,r.find((t=>t.name===n)))}))}))}};function _P(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){var o;const a=(null==n?void 0:n.multicallAddress)||yO[t].multicall;if(!a)throw new Error("missing multicall address");const s=Object.assign({},n),h=(null==s?void 0:s.limit)||500;delete s.limit,delete s.multicallAddress;const u=(null===(o=yO[t])||void 0===o?void 0:o.starknet)?"starknet":"evm";return MP[u](a,e,r,i,h,s)}))}const EP=["response not found during CCIP fetch","UNSUPPORTED_OPERATION"],AP="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",jP=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],xP={146:{tlds:[".sonic"],registryContract:"0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4"}},SP=["function ownerOf(uint256 tokenId) view returns (address owner)"],NP=["1","11155111"],IP=["109","157"],TP="0x0000000000000000000000000000000000000000",CP={Accept:"application/json","Content-Type":"application/json"},zP="https://score.snapshot.org";function OP(t=zP,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const i=r.searchParams.get("apiKey");let n=Object.assign({},CP);return i&&(r.searchParams.delete("apiKey"),n=Object.assign(Object.assign({},CP),{"X-API-KEY":i})),{url:r.toString(),headers:n}}function RP(t){return r(this,void 0,void 0,(function*(){let e=yield t.text();try{e=JSON.parse(e)}catch(r){return Promise.reject({code:t.status||500,message:"Failed to parse response from score API",data:e})}return e.error?Promise.reject(e.error):e}))}const PP=new vd({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});_d(PP),Ad(PP),PP.addFormat("address",{validate:t=>{try{return t===nr(t)}catch(t){return!1}}}),PP.addFormat("evmAddress",{validate:t=>{try{return nr(t),!0}catch(t){return!1}}}),PP.addFormat("starknetAddress",{validate:t=>{try{return Vz(t).toLowerCase()===t.toLowerCase()}catch(t){return!1}}}),PP.addFormat("long",{validate:()=>!0}),PP.addFormat("lowercase",{validate:t=>t===t.toLowerCase()}),PP.addFormat("color",{validate:t=>!!t&&!!t.match(/^#[0-9A-F]{6}$/)}),PP.addFormat("ethValue",{validate:t=>{if(!t.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/))return!1;try{return function(t,e){if("string"!=typeof t&&ah.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=sh.indexOf(e);-1!==t&&(e=3*t)}Hs(t,null!=e?e:18)}(t,18),!0}catch(t){return!1}}});const BP=Object.keys(yO),DP=Object.keys(yO).filter((t=>!yO[t].testnet));function $P(t){const e=t.endsWith(".eth"),r=t.split(".");if(1===r.length)return"tld";if(2!==r.length||e){if(r.length>2)return"subdomain";if(e)return"ens";throw new Error("Invalid domain")}return"other-tld"}function LP(t){return r(this,void 0,void 0,(function*(){var e;const r=yield VP(`https://cloudflare-dns.com/dns-query?name=${t}&type=TXT`,{headers:{accept:"application/dns-json"}}),i=yield r.json();if(3===i.Status)return TP;if(0!==i.Status)throw new Error("Failed to fetch DNS Owner");const n=null===(e=i.Answer)||void 0===e?void 0:e.find((t=>t.data.includes("ENS1")));return n?nr(n.data.replace(new RegExp('"',"g"),"").split(" ").pop()):TP}))}function UP(t,e,i,n){return r(this,void 0,void 0,(function*(){const r=new os(i[0],e,t);try{const t=i[2]||[];return yield r[i[1]](...t,n||{})}catch(t){return Promise.reject(t)}}))}function FP(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i={query:Hu.jsonToGraphQLQuery({query:e})};r.variables&&(i.variables=r.variables);const n=yield VP(t,{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},null==r?void 0:r.headers),body:JSON.stringify(i)});let o=yield n.text();try{o=JSON.parse(o)}catch(e){throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${o.substring(0,400)}`)}if(o.errors)throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${JSON.stringify(o.errors).substring(0,400)}`);const{data:a}=o;return a||{}}))}function qP(t,e=nR[0]){const r=`https://${e}`;if(!t)return null;if(!(t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("https://")||t.startsWith("http://")))return`${r}/ipfs/${t}`;const i=t.split("://")[0];return"ipfs"===i?t.replace("ipfs://",`${r}/ipfs/`):"ipns"===i?t.replace("ipns://",`${r}/ipns/`):t}function VP(t){return r(this,arguments,void 0,(function*(t,r={}){const{timeout:i=3e4}=r,n=e(r,["timeout"]);if(i>0){const e=new AbortController,r=setTimeout((()=>e.abort()),i);try{return yield h(t,Object.assign(Object.assign({},n),{signal:e.signal}))}catch(t){if(t instanceof Error&&"AbortError"===t.name)throw new Error(`Request timeout after ${i}ms`);throw t}finally{clearTimeout(r)}}const o=e(n,["signal"]);return h(t,o)}))}function HP(t,i){return r(this,arguments,void 0,(function*(t,r,i="1",n={}){var o,a;const{ensResolvers:s=(null===(o=yO[i])||void 0===o?void 0:o.ensResolvers)||yO[1].ensResolvers,broviderUrl:h}=n,u=e(n,["ensResolvers","broviderUrl"]);let l;try{l=cu(lu(t))}catch(t){return null}const c=bO(i,{broviderUrl:h}),d=[[AP,"resolver",[l]],...s.map((t=>[t,"text",[l,r]]))],[[f],...m]=yield _P(i,c,jP,d,u),p=s.indexOf(f);return-1!==p?null===(a=m[p])||void 0===a?void 0:a[0]:null}))}function GP(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield HP(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function ZP(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){var i,n;if(!(null===(n=null===(i=yO[e])||void 0===i?void 0:i.ensResolvers)||void 0===n?void 0:n.length))throw new Error("Network not supported");const o=$P(t),a=bO(e,r),s=new os(AP,["function owner(bytes32) view returns (address)"],a);let h;try{h=cu(lu(t))}catch(t){return TP}const u=r.ensNameWrapper||yO[e].ensNameWrapper;let l=yield s.owner(h);if(l===u){const t=new os(u,["function ownerOf(uint256) view returns (address)"],a);l=yield t.ownerOf(h)}if(l===TP&&"other-tld"===o){(yield a.resolveName(t))&&(l=yield LP(t))}if(l===TP&&"subdomain"===o)try{l=yield a.resolveName(t)}catch(t){if(EP.every((e=>!t.message.includes(e))))throw t;l=TP}return l||TP}))}function KP(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i=yield GP(t,e,r);if(i){let t=or(i);if(t)return i;const e=i.split("/"),r=e.includes("testnet")?5:4,n=e[r];if(t=or(n),t)return n}return yield ZP(t,e,r)}))}function JP(t,e){return r(this,void 0,void 0,(function*(){if(!t.endsWith(".shib"))return TP;const r=yield VP("https://stamp.fyi",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"get_owner",params:t,network:e})});return(yield r.json()).result}))}function WP(t,e){return r(this,void 0,void 0,(function*(){var r;if(!((null===(r=xP[e])||void 0===r?void 0:r.tlds)||[]).some((e=>t.endsWith(e))))return Promise.resolve(TP);try{const r=cu(lu(t)),i=BigInt(r),n=bO(e);return yield UP(n,SP,[xP[e].registryContract,"ownerOf",[i]],{blockTag:"latest"})}catch(t){return TP}}))}function YP(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function QP(t){return!!yO[t]}function XP(t){return t!==TP&&(or(t)||eB(t))}function tB(t,e){return"latest"===t||"number"==typeof t&&t>=yO[e].start}function eB(t){if(!t)return!1;try{return Vz(t),!0}catch(t){return!1}}function rB(t){return or(t)}function iB(t,e){if("string"!=typeof t||!/^0[xX]/.test(t))throw new Error(`Invalid address: ${t}`);const r=null!=e?e:42===t.length?"evm":"starknet";if("evm"===r&&rB(t))return nr(t);if("starknet"===r&&eB(t))return Vz(t);throw new Error(`Invalid ${r} address: ${t}`)}function nB(t){return Promise.reject(new Error(t))}PP.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?DP.includes(e):BP.includes(e)},error:{message:"network not allowed"}}),PP.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))}),PP.addFormat("domain",{validate:t=>!!t&&!!t.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(\/)?$/)});var oB={call:UP,multicall:_P,fetch:VP,subgraphRequest:FP,ipfsGet:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="ipfs"){return VP(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:qP,getJSON:function(t){return r(this,arguments,void 0,(function*(t,e={}){const r=qP(t,e.gateways);return(yield VP(r,e)).json()}))},sendTransaction:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=t.getSigner(),s=new os(e,r,t).connect(a);return yield s[i](...n,o)}))},getScores:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n="latest",o=zP,a={}){if(!Array.isArray(i))return nB("addresses should be an array of addresses");if(0===i.length)return nB("addresses can not be empty");const s=i.find((t=>!XP(t)));if(s)return nB(`Invalid address: ${s}`);if(!QP(r))return nB(`Invalid network: ${r}`);const h=e.find((t=>t.network&&!QP(t.network)));if(h)return nB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!tB(n,r))return nB(`Snapshot (${n}) must be 'latest' or greater than network start block (${yO[r].start})`);new URL(o).pathname="/api/scores";const{url:u,headers:l}=OP(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:n,strategies:e,addresses:i},s=yield VP(u,{method:"POST",headers:l,body:JSON.stringify({params:o})}),h=yield RP(s);return"all"===a.returnValue?h.result:h.result[a.returnValue||"scores"]}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},getVp:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){const{url:r,headers:a}=OP(null==s?void 0:s.url);if(!XP(t))return nB(`Invalid voter address: ${t}`);if(!QP(e))return nB(`Invalid network: ${e}`);const h=i.find((t=>t.network&&!QP(t.network)));if(h)return nB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!tB(n,e))return nB(`Snapshot (${n}) must be 'latest' or greater than network start block (${yO[e].start})`);const u={method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",method:"get_vp",params:{address:t,network:e,strategies:i,snapshot:n,space:o}})};try{const t=yield VP(r,u);return(yield RP(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},validateSchema:function(t,e,r={snapshotEnv:"default",spaceType:"default"}){const i=PP.compile(t),n=i.call(r,e);return n||i.errors},getEnsTextRecord:HP,getSpaceUri:GP,getEnsOwner:ZP,getSpaceController:function(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){if(NP.includes(e))return KP(t,e,r);if(IP.includes(e))return JP(t,e);if(xP[String(e)])return WP(t,e);throw new Error(`Network not supported: ${e}`)}))},getDelegatesBySpace:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="latest",i={}){const n=i.subgraphUrl||bR[t];if(!n)return Promise.reject(`Delegation subgraph not available for network ${t}`);let o=0;const a=new Map,s=e?ER(e):null;for(;;){const t=yield AR({url:n,spaces:s,pivot:o,snapshot:r});if(MR(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{_R(a,t),o=t.timestamp})),t.length<kR)break}return[...a.values()]}))},clone:function(t){return JSON.parse(JSON.stringify(t))},sleep:function(t){return r(this,void 0,void 0,(function*(){return new Promise((e=>{setTimeout(e,t)}))}))},getNumberWithOrdinal:YP,voting:vR,getProvider:bO,signMessage:function(t,e,i){return r(this,void 0,void 0,(function*(){return e=Tt(new _(e,"utf8")),yield t.send("personal_sign",[e,i])}))},getBlockNumber:function(t){return r(this,void 0,void 0,(function*(){try{const e=yield t.getBlockNumber();return parseInt(e)}catch(t){return Promise.reject()}}))},Multicaller:class{constructor(t,e,r,i={}){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=i}call(t,e,r,i){return this.calls.push([e,r,i]),this.paths.push(t),this}execute(t){return r(this,void 0,void 0,(function*(){const e=t||{};return(yield _P(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>kP(e,this.paths[r],t.length>1?t:t[0]))),this.calls=[],this.paths=[],e}))}},getSnapshots:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){const o={};if(i.forEach((t=>o[t]="latest")),"latest"===e)return o;const a=`${t}-${e}-${i.join("-")}`,s=jd[a],h=Date.now();if(s&&xd>h)return s;xd<h&&(jd={},xd=h+36e5-h%36e5),o[t]=e;const u=Object.keys(o).filter((e=>t!==e));if(0===u.length)return o;const l={blocks:{__args:{where:{ts:(yield r.getBlock(e)).timestamp,network_in:u}},network:!0,number:!0}},c=n.blockFinderUrl||"https://blockfinder.snapshot.org";return(yield FP(c,l)).blocks.forEach((t=>o[t.network]=t.number)),jd[a]=o,o}))},getHash:function(t,e){return(kO(t)?MO:iR).getHash(t,e)},verify:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){if(!eB(t)&&!rB(t))throw new Error("Invalid address");const o=kO(r)?MO:iR;return yield o.default(t,e,r,i,n)}))},validate:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){if(!XP(e))return nB(`Invalid author: ${e}`);if(!QP(n))return nB(`Invalid network: ${n}`);if(!tB(o,n))return nB(`Snapshot (${o}) must be 'latest' or greater than network start block (${yO[n].start})`);s||(s={});const{url:r,headers:h}=OP(s.url),u={method:"POST",headers:h,body:JSON.stringify({jsonrpc:"2.0",method:"validate",params:{validation:t,author:e,space:i,network:n,snapshot:o,params:a}})};try{const t=yield VP(r,u);return(yield RP(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:eB,isEvmAddress:rB,getFormattedAddress:iB,SNAPSHOT_SUBGRAPH_URL:bR};const aB={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},sB={Proposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"privacy",type:"string"},{name:"app",type:"string"}]},hB={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"plugins",type:"string"},{name:"privacy",type:"string"}]},uB={FlagProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},lB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},cB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},dB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},fB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},mB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},pB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},gB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},yB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},wB={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},vB={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},bB={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},kB={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},MB={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},_B={Statement:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"space",type:"string"},{name:"about",type:"string"},{name:"statement",type:"string"},{name:"discourse",type:"string"},{name:"status",type:"string"},{name:"network",type:"string"}]},EB={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},AB={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var jB={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},xB={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},SB={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const NB={name:"snapshot",version:"0.1.4"};class IB{constructor(t=jB.sequencer,e={}){t=(t=(t=t.replace(jB.hub,jB.sequencer)).replace(xB.hub,xB.sequencer)).replace(SB.hub,SB.sequencer),this.address=t,this.options=e}sign(t,e,i,n){return r(this,void 0,void 0,(function*(){var r;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,a=iB(e,"evm");i.from=i.from?iB(i.from):a,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const s=Object.assign({},NB);"undefined"!=typeof window&&(null===(r=window.ethereum)||void 0===r?void 0:r.isTrust)&&(s.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:s,types:n,message:i},u=yield o._signTypedData(s,h.types,i);return yield this.send({address:a,sig:u,data:h})}))}send(t){return r(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,i)=>{VP(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(i).catch(i);throw e})).catch(i)}))}))}space(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,aB)}))}proposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.labels||(i.labels=[]),i.discussion||(i.discussion=""),i.app||(i.app=""),i.privacy||(i.privacy=""),yield this.sign(t,e,i,sB)}))}updateProposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.privacy||(i.privacy=""),yield this.sign(t,e,i,hB)}))}flagProposal(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,uB)}))}cancelProposal(t,e,i){return r(this,void 0,void 0,(function*(){const r=i.proposal.startsWith("0x");return yield this.sign(t,e,i,r?cB:lB)}))}vote(t,e,i){return r(this,void 0,void 0,(function*(){const r="shutter"===(null==i?void 0:i.privacy);i.reason||(i.reason=""),i.app||(i.app=""),i.metadata||(i.metadata="{}");const n=i.proposal.startsWith("0x");let o=n?pB:dB;return["approval","ranked-choice"].includes(i.type)&&(o=n?gB:fB),!r&&["quadratic","weighted"].includes(i.type)&&(o=n?yB:mB,i.choice=JSON.stringify(i.choice)),r&&(o=n?yB:mB),delete i.privacy,delete i.type,yield this.sign(t,e,i,o)}))}follow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,wB)}))}unfollow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,vB)}))}subscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,bB)}))}unsubscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,kB)}))}profile(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,MB)}))}statement(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,_B)}))}alias(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,EB)}))}deleteSpace(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,AB)}))}}var TB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","copeland","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24},privacy:{type:"string",enum:["","shutter"]}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},CB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"},privacy:{type:"string",enum:["","shutter"]}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},zB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:5e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},OB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},RB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},PB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},BB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}};return{Client:IB,Client712:IB,schemas:{space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},farcaster:{type:"string",title:"farcaster"},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1},symbol:{type:"string",title:"symbol",maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64,format:"domain"},discussions:{type:"string",format:"uri",title:"Discussions link",maxLength:256},discourseCategory:{type:"integer",minimum:1,title:"Discourse category"},strategies:{type:"array",minItems:1,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"},{const:"apechain-delegate-registry",title:"ApeChain Delegate Registry"}]},delegationContract:{type:"string",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},delegationNetwork:{type:"string",title:"Delegation network",description:"The network of your delegation contract",snapshotNetwork:!0},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:31622400,errorMessage:{maximum:"Delay must be less than a year"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter","any"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector","ai-agent","gaming","wallet","music","layer-2","defai","defi","rwa","depin","meme"]}},treasuries:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},network:{type:"string",title:"Network",snapshotNetwork:!0}},required:["name","address","network"],additionalProperties:!1}},labels:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{id:{type:"string",title:"Id",minLength:1,maxLength:8},name:{type:"string",title:"Name",minLength:1,maxLength:32},description:{type:"string",title:"Description",maxLength:100},color:{type:"string",title:"Color",format:"color"}},required:["id","name","color"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1},skinSettings:{type:"object",properties:{bg_color:{type:"string",format:"color"},link_color:{type:"string",format:"color"},text_color:{type:"string",format:"color"},content_color:{type:"string",format:"color"},border_color:{type:"string",format:"color"},heading_color:{type:"string",format:"color"},primary_color:{type:"string",format:"color"},header_color:{type:"string",format:"color"},theme:{type:"string",enum:["light","dark"]},logo:{type:"string",title:"logo",format:"customUrl",maxLength:256}},additionalProperties:!1}},required:["name","network","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:TB.definitions.Proposal,updateProposal:CB.definitions.UpdateProposal,vote:zB.definitions.Vote,profile:OB.definitions.Profile,statement:RB.definitions.Statement,zodiac:PB.definitions.Zodiac,alias:BB.definitions.Alias},utils:oB}}));
232
+ const TA=kE.Store,CA=bA.MemoryCookieStore,zA=AE.pathMatch,{fromCallback:OA}=ME,{getCustomInspectSymbol:RA}=cA,PA=/^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/,BA=/[\x00-\x1F]/,DA=["\n","\r","\0"],$A=/[\x20-\x3A\x3C-\x7E]+/,LA=/[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/,UA={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},FA=2147483647e3,qA='Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"';function VA(t){SA.validate(SA.isNonEmptyString(t),t);const e=String(t).toLowerCase();return"none"===e||"lax"===e||"strict"===e?e:null}const HA=Object.freeze({SILENT:"silent",STRICT:"strict",DISABLED:"unsafe-disabled"}),GA=/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/,ZA="\n\\[?(?:\n(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)|\n(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)|\n(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)|\n(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|\n(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:))\n)(?:%[0-9a-zA-Z]{1,})?\\]?\n".replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),KA=new RegExp(`^${ZA}$`);function JA(t,e,r,i){let n=0;for(;n<t.length;){const e=t.charCodeAt(n);if(e<=47||e>=58)break;n++}return n<e||n>r?null:i||n==t.length?parseInt(t.substr(0,n),10):null}function WA(t){const e=t.split(":"),r=[0,0,0];if(3!==e.length)return null;for(let t=0;t<3;t++){const i=2==t,n=JA(e[t],1,2,i);if(null===n)return null;r[t]=n}return r}function YA(t){t=String(t).substr(0,3).toLowerCase();const e=UA[t];return e>=0?e:null}function QA(t){if(!t)return;const e=t.split(LA);if(!e)return;let r=null,i=null,n=null,o=null,a=null,s=null;for(let t=0;t<e.length;t++){const h=e[t].trim();if(!h.length)continue;let u;null===n&&(u=WA(h),u)?(r=u[0],i=u[1],n=u[2]):null!==o||(u=JA(h,1,2,!0),null===u)?null!==a||(u=YA(h),null===u)?null===s&&(u=JA(h,2,4,!0),null!==u&&(s=u,s>=70&&s<=99?s+=1900:s>=0&&s<=69&&(s+=2e3))):a=u:o=u}return null===o||null===a||null===s||null===n||o<1||o>31||s<1601||r>23||i>59||n>59?void 0:new Date(Date.UTC(s,a,o,r,i,n))}function XA(t){return SA.validate(SA.isDate(t),t),t.toUTCString()}function tj(t){return null==t?null:(t=t.trim().replace(/^\./,""),KA.test(t)&&(t=t.replace("[","").replace("]","")),IA&&/[^\u0001-\u007f]/.test(t)&&(t=IA.toASCII(t)),t.toLowerCase())}function ej(t,e,r){if(null==t||null==e)return null;if(!1!==r&&(t=tj(t),e=tj(e)),t==e)return!0;const i=t.lastIndexOf(e);return!(i<=0)&&(t.length===e.length+i&&("."===t.substr(i-1,1)&&!GA.test(t)))}function rj(t){if(!t||"/"!==t.substr(0,1))return"/";if("/"===t)return t;const e=t.lastIndexOf("/");return 0===e?"/":t.slice(0,e)}function ij(t,e){t=function(t){if(SA.isEmptyString(t))return t;for(let e=0;e<DA.length;e++){const r=t.indexOf(DA[e]);-1!==r&&(t=t.substr(0,r))}return t}(t),SA.validate(SA.isString(t),t);let r,i,n=t.indexOf("=");if(e)0===n&&(n=(t=t.substr(1)).indexOf("="));else if(n<=0)return;if(n<=0?(r="",i=t.trim()):(r=t.substr(0,n).trim(),i=t.substr(n+1).trim()),BA.test(r)||BA.test(i))return;const o=new lj;return o.key=r,o.value=i,o}function nj(t,e){if(e&&"object"==typeof e||(e={}),SA.isEmptyString(t)||!SA.isString(t))return null;const r=(t=t.trim()).indexOf(";"),i=ij(-1===r?t:t.substr(0,r),!!e.loose);if(!i)return;if(-1===r)return i;const n=t.slice(r+1).trim();if(0===n.length)return i;const o=n.split(";");for(;o.length;){const t=o.shift().trim();if(0===t.length)continue;const e=t.indexOf("=");let r,n;switch(-1===e?(r=t,n=null):(r=t.substr(0,e),n=t.substr(e+1)),r=r.trim().toLowerCase(),n&&(n=n.trim()),r){case"expires":if(n){const t=QA(n);t&&(i.expires=t)}break;case"max-age":if(n&&/^-?[0-9]+$/.test(n)){const t=parseInt(n,10);i.setMaxAge(t)}break;case"domain":if(n){const t=n.trim().replace(/^\./,"");t&&(i.domain=t.toLowerCase())}break;case"path":i.path=n&&"/"===n[0]?n:null;break;case"secure":i.secure=!0;break;case"httponly":i.httpOnly=!0;break;case"samesite":switch(n?n.toLowerCase():""){case"strict":i.sameSite="strict";break;case"lax":i.sameSite="lax";break;case"none":i.sameSite="none";break;default:i.sameSite=void 0}break;default:i.extensions=i.extensions||[],i.extensions.push(t)}}return i}function oj(t){let e;try{e=JSON.parse(t)}catch(t){return t}return e}function aj(t){if(!t||SA.isEmptyString(t))return null;let e;if("string"==typeof t){if(e=oj(t),e instanceof Error)return null}else e=t;const r=new lj;for(let t=0;t<lj.serializableProperties.length;t++){const i=lj.serializableProperties[t];void 0!==e[i]&&e[i]!==uj[i]&&("expires"===i||"creation"===i||"lastAccessed"===i?null===e[i]?r[i]=null:r[i]="Infinity"==e[i]?"Infinity":new Date(e[i]):r[i]=e[i])}return r}function sj(t,e){SA.validate(SA.isObject(t),t),SA.validate(SA.isObject(e),e);let r=0;const i=t.path?t.path.length:0;if(r=(e.path?e.path.length:0)-i,0!==r)return r;return r=(t.creation?t.creation.getTime():FA)-(e.creation?e.creation.getTime():FA),0!==r||(r=t.creationIndex-e.creationIndex),r}function hj(t){if(t instanceof Object)return t;try{t=decodeURI(t)}catch(t){}return pE(t)}const uj={key:"",value:"",expires:"Infinity",maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0};class lj{constructor(t={}){const e=RA();e&&(this[e]=this.inspect),Object.assign(this,uj,t),this.creation=this.creation||new Date,Object.defineProperty(this,"creationIndex",{configurable:!1,enumerable:!1,writable:!0,value:++lj.cookiesCreated})}inspect(){const t=Date.now(),e=null!=this.hostOnly?this.hostOnly:"?",r=this.creation?t-this.creation.getTime()+"ms":"?",i=this.lastAccessed?t-this.lastAccessed.getTime()+"ms":"?";return`Cookie="${this.toString()}; hostOnly=${e}; aAge=${i}; cAge=${r}"`}toJSON(){const t={};for(const e of lj.serializableProperties)this[e]!==uj[e]&&("expires"===e||"creation"===e||"lastAccessed"===e?null===this[e]?t[e]=null:t[e]="Infinity"==this[e]?"Infinity":this[e].toISOString():"maxAge"===e?null!==this[e]&&(t[e]=this[e]==1/0||this[e]==-1/0?this[e].toString():this[e]):this[e]!==uj[e]&&(t[e]=this[e]));return t}clone(){return aj(this.toJSON())}validate(){if(!PA.test(this.value))return!1;if(!(this.expires==1/0||this.expires instanceof Date||QA(this.expires)))return!1;if(null!=this.maxAge&&this.maxAge<=0)return!1;if(null!=this.path&&!$A.test(this.path))return!1;const t=this.cdomain();if(t){if(t.match(/\.$/))return!1;if(null==bE.getPublicSuffix(t))return!1}return!0}setExpires(t){t instanceof Date?this.expires=t:this.expires=QA(t)||"Infinity"}setMaxAge(t){this.maxAge=t===1/0||t===-1/0?t.toString():t}cookieString(){let t=this.value;return null==t&&(t=""),""===this.key?t:`${this.key}=${t}`}toString(){let t=this.cookieString();if(this.expires!=1/0&&(this.expires instanceof Date?t+=`; Expires=${XA(this.expires)}`:t+=`; Expires=${this.expires}`),null!=this.maxAge&&this.maxAge!=1/0&&(t+=`; Max-Age=${this.maxAge}`),this.domain&&!this.hostOnly&&(t+=`; Domain=${this.domain}`),this.path&&(t+=`; Path=${this.path}`),this.secure&&(t+="; Secure"),this.httpOnly&&(t+="; HttpOnly"),this.sameSite&&"none"!==this.sameSite){const e=lj.sameSiteCanonical[this.sameSite.toLowerCase()];t+=`; SameSite=${e||this.sameSite}`}return this.extensions&&this.extensions.forEach((e=>{t+=`; ${e}`})),t}TTL(t){if(null!=this.maxAge)return this.maxAge<=0?0:1e3*this.maxAge;let e=this.expires;return e!=1/0?(e instanceof Date||(e=QA(e)||1/0),e==1/0?1/0:e.getTime()-(t||Date.now())):1/0}expiryTime(t){if(null!=this.maxAge){const e=t||this.creation||new Date,r=this.maxAge<=0?-1/0:1e3*this.maxAge;return e.getTime()+r}return this.expires==1/0?1/0:this.expires.getTime()}expiryDate(t){const e=this.expiryTime(t);return e==1/0?new Date(FA):e==-1/0?new Date(0):new Date(e)}isPersistent(){return null!=this.maxAge||this.expires!=1/0}canonicalizedDomain(){return null==this.domain?null:tj(this.domain)}cdomain(){return this.canonicalizedDomain()}}function cj(t){if(null!=t){const e=t.toLowerCase();switch(e){case HA.STRICT:case HA.SILENT:case HA.DISABLED:return e}}return HA.SILENT}lj.cookiesCreated=0,lj.parse=nj,lj.fromJSON=aj,lj.serializableProperties=Object.keys(uj),lj.sameSiteLevel={strict:3,lax:2,none:1},lj.sameSiteCanonical={strict:"Strict",lax:"Lax"};class dj{constructor(t,e={rejectPublicSuffixes:!0}){"boolean"==typeof e&&(e={rejectPublicSuffixes:e}),SA.validate(SA.isObject(e),e),this.rejectPublicSuffixes=e.rejectPublicSuffixes,this.enableLooseMode=!!e.looseMode,this.allowSpecialUseDomain="boolean"!=typeof e.allowSpecialUseDomain||e.allowSpecialUseDomain,this.store=t||new CA,this.prefixSecurity=cj(e.prefixSecurity),this._cloneSync=fj("clone"),this._importCookiesSync=fj("_importCookies"),this.getCookiesSync=fj("getCookies"),this.getCookieStringSync=fj("getCookieString"),this.getSetCookieStringsSync=fj("getSetCookieStrings"),this.removeAllCookiesSync=fj("removeAllCookies"),this.setCookieSync=fj("setCookie"),this.serializeSync=fj("serialize")}setCookie(t,e,r,i){let n;if(SA.validate(SA.isUrlStringOrObject(e),i,r),SA.isFunction(e))return(i=e)(new Error("No URL was specified"));const o=hj(e);if(SA.isFunction(r)&&(i=r,r={}),SA.validate(SA.isFunction(i),i),!SA.isNonEmptyString(t)&&!SA.isObject(t)&&t instanceof String&&0==t.length)return i(null);const a=tj(o.hostname),s=r.loose||this.enableLooseMode;let h=null;if(r.sameSiteContext&&(h=VA(r.sameSiteContext),!h))return i(new Error(qA));if("string"==typeof t||t instanceof String){if(!(t=lj.parse(t,{loose:s})))return n=new Error("Cookie failed to parse"),i(r.ignoreError?null:n)}else if(!(t instanceof lj))return n=new Error("First argument to setCookie must be a Cookie object or string"),i(r.ignoreError?null:n);const u=r.now||new Date;if(this.rejectPublicSuffixes&&t.domain){if(null==bE.getPublicSuffix(t.cdomain(),{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:r.ignoreError})&&!KA.test(t.domain))return n=new Error("Cookie has domain set to a public suffix"),i(r.ignoreError?null:n)}if(t.domain){if(!ej(a,t.cdomain(),!1))return n=new Error(`Cookie not in this host's domain. Cookie:${t.cdomain()} Request:${a}`),i(r.ignoreError?null:n);null==t.hostOnly&&(t.hostOnly=!1)}else t.hostOnly=!0,t.domain=a;if(t.path&&"/"===t.path[0]||(t.path=rj(o.pathname),t.pathIsDefault=!0),!1===r.http&&t.httpOnly)return n=new Error("Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:n);if("none"!==t.sameSite&&void 0!==t.sameSite&&h&&"none"===h)return n=new Error("Cookie is SameSite but this is a cross-origin request"),i(r.ignoreError?null:n);const l=this.prefixSecurity===HA.SILENT;if(!(this.prefixSecurity===HA.DISABLED)){let e,n=!1;if(!function(t){return SA.validate(SA.isObject(t),t),!t.key.startsWith("__Secure-")||t.secure}(t)?(n=!0,e="Cookie has __Secure prefix but Secure attribute is not set"):function(t){return SA.validate(SA.isObject(t)),!t.key.startsWith("__Host-")||t.secure&&t.hostOnly&&null!=t.path&&"/"===t.path}(t)||(n=!0,e="Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'"),n)return i(r.ignoreError||l?null:new Error(e))}const c=this.store;c.updateCookie||(c.updateCookie=function(t,e,r){this.putCookie(e,r)}),c.findCookie(t.domain,t.path,t.key,(function(e,n){if(e)return i(e);const o=function(e){if(e)return i(e);i(null,t)};if(n){if(!1===r.http&&n.httpOnly)return e=new Error("old Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:e);t.creation=n.creation,t.creationIndex=n.creationIndex,t.lastAccessed=u,c.updateCookie(n,t,o)}else t.creation=t.lastAccessed=u,c.putCookie(t,o)}))}getCookies(t,e,r){SA.validate(SA.isUrlStringOrObject(t),r,t);const i=hj(t);SA.isFunction(e)&&(r=e,e={}),SA.validate(SA.isObject(e),r,e),SA.validate(SA.isFunction(r),r);const n=tj(i.hostname),o=i.pathname||"/";let a=e.secure;null!=a||!i.protocol||"https:"!=i.protocol&&"wss:"!=i.protocol||(a=!0);let s=0;if(e.sameSiteContext){const t=VA(e.sameSiteContext);if(s=lj.sameSiteLevel[t],!s)return r(new Error(qA))}let h=e.http;null==h&&(h=!0);const u=e.now||Date.now(),l=!1!==e.expire,c=!!e.allPaths,d=this.store;function f(t){if(t.hostOnly){if(t.domain!=n)return!1}else if(!ej(n,t.domain,!1))return!1;if(!c&&!zA(o,t.path))return!1;if(t.secure&&!a)return!1;if(t.httpOnly&&!h)return!1;if(s){if(lj.sameSiteLevel[t.sameSite||"none"]>s)return!1}return!(l&&t.expiryTime()<=u)||(d.removeCookie(t.domain,t.path,t.key,(()=>{})),!1)}d.findCookies(n,c?null:o,this.allowSpecialUseDomain,((t,i)=>{if(t)return r(t);i=i.filter(f),!1!==e.sort&&(i=i.sort(sj));const n=new Date;for(const t of i)t.lastAccessed=n;r(null,i)}))}getCookieString(...t){const e=t.pop();SA.validate(SA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.sort(sj).map((t=>t.cookieString())).join("; "))})),this.getCookies.apply(this,t)}getSetCookieStrings(...t){const e=t.pop();SA.validate(SA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.map((t=>t.toString())))})),this.getCookies.apply(this,t)}serialize(t){SA.validate(SA.isFunction(t),t);let e=this.store.constructor.name;SA.isObject(e)&&(e=null);const r={version:"tough-cookie@4.1.4",storeType:e,rejectPublicSuffixes:!!this.rejectPublicSuffixes,enableLooseMode:!!this.enableLooseMode,allowSpecialUseDomain:!!this.allowSpecialUseDomain,prefixSecurity:cj(this.prefixSecurity),cookies:[]};if(!this.store.getAllCookies||"function"!=typeof this.store.getAllCookies)return t(new Error("store does not support getAllCookies and cannot be serialized"));this.store.getAllCookies(((e,i)=>e?t(e):(r.cookies=i.map((t=>(delete(t=t instanceof lj?t.toJSON():t).creationIndex,t))),t(null,r))))}toJSON(){return this.serializeSync()}_importCookies(t,e){let r=t.cookies;if(!r||!Array.isArray(r))return e(new Error("serialized jar has no cookies array"));r=r.slice();const i=t=>{if(t)return e(t);if(!r.length)return e(t,this);let n;try{n=aj(r.shift())}catch(t){return e(t)}if(null===n)return i(null);this.store.putCookie(n,i)};i()}clone(t,e){1===arguments.length&&(e=t,t=null),this.serialize(((r,i)=>{if(r)return e(r);dj.deserialize(i,t,e)}))}cloneSync(t){if(0===arguments.length)return this._cloneSync();if(!t.synchronous)throw new Error("CookieJar clone destination store is not synchronous; use async API instead.");return this._cloneSync(t)}removeAllCookies(t){SA.validate(SA.isFunction(t),t);const e=this.store;if("function"==typeof e.removeAllCookies&&e.removeAllCookies!==TA.prototype.removeAllCookies)return e.removeAllCookies(t);e.getAllCookies(((r,i)=>{if(r)return t(r);if(0===i.length)return t(null);let n=0;const o=[];function a(e){if(e&&o.push(e),n++,n===i.length)return t(o.length?o[0]:null)}i.forEach((t=>{e.removeCookie(t.domain,t.path,t.key,a)}))}))}static deserialize(t,e,r){let i;if(3!==arguments.length&&(r=e,e=null),SA.validate(SA.isFunction(r),r),"string"==typeof t){if(i=oj(t),i instanceof Error)return r(i)}else i=t;const n=new dj(e,{rejectPublicSuffixes:i.rejectPublicSuffixes,looseMode:i.enableLooseMode,allowSpecialUseDomain:i.allowSpecialUseDomain,prefixSecurity:i.prefixSecurity});n._importCookies(i,(t=>{if(t)return r(t);r(null,n)}))}static deserializeSync(t,e){const r="string"==typeof t?JSON.parse(t):t,i=new dj(e,{rejectPublicSuffixes:r.rejectPublicSuffixes,looseMode:r.enableLooseMode});if(!i.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");return i._importCookiesSync(r),i}}function fj(t){return function(...e){if(!this.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");let r,i;if(this[t](...e,((t,e)=>{r=t,i=e})),r)throw r;return i}}dj.fromJSON=dj.deserializeSync,["_importCookies","clone","getCookies","getCookieString","getSetCookieStrings","removeAllCookies","serialize","setCookie"].forEach((t=>{dj.prototype[t]=OA(dj.prototype[t])})),dj.deserialize=OA(dj.deserialize);var mj=NA,pj=dj,gj=lj,yj=TA,wj=CA,vj=QA,bj=XA,kj=nj,Mj=aj,_j=ej,Ej=rj,Aj=zA,jj=bE.getPublicSuffix,xj=sj,Sj=EE.permuteDomain,Nj=function(t){if(SA.validate(SA.isString(t)),"/"===t)return["/"];const e=[t];for(;t.length>1;){const r=t.lastIndexOf("/");if(0===r)break;t=t.substr(0,r),e.push(t)}return e.push("/"),e},Ij=tj,Tj=HA,Cj=SA.ParameterError,zj={version:mj,CookieJar:pj,Cookie:gj,Store:yj,MemoryCookieStore:wj,parseDate:vj,formatDate:bj,parse:kj,fromJSON:Mj,domainMatch:_j,defaultPath:Ej,pathMatch:Aj,getPublicSuffix:jj,cookieCompare:xj,permuteDomain:Sj,permutePath:Nj,canonicalDomain:Ij,PrefixSecurityEnum:Tj,ParameterError:Cj},Oj=Object.freeze(Object.assign(Object.create(null),zj,{default:zj,version:mj,CookieJar:pj,Cookie:gj,Store:yj,MemoryCookieStore:wj,parseDate:vj,formatDate:bj,parse:kj,fromJSON:Mj,domainMatch:_j,defaultPath:Ej,pathMatch:Aj,getPublicSuffix:jj,cookieCompare:xj,permuteDomain:Sj,permutePath:Nj,canonicalDomain:Ij,PrefixSecurityEnum:Tj,ParameterError:Cj}));var Rj=function(t){if(Array.isArray(t))return t;if("string"!=typeof t)return[];var e,r,i,n,o,a=[],s=0;function h(){for(;s<t.length&&/\s/.test(t.charAt(s));)s+=1;return s<t.length}for(;s<t.length;){for(e=s,o=!1;h();)if(","===(r=t.charAt(s))){for(i=s,s+=1,h(),n=s;s<t.length&&"="!==(r=t.charAt(s))&&";"!==r&&","!==r;)s+=1;s<t.length&&"="===t.charAt(s)?(o=!0,s=n,a.push(t.substring(e,i)),e=s):s=i+1}else s+=1;(!o||s>=t.length)&&a.push(t.substring(e,t.length))}return a};const Pj=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);function Bj(t,e){}function Dj(t,e){t.headers.delete(e)}function $j(t,e){const r=t.headers;for(const t of Object.keys(r))t.toLowerCase()===e&&delete r[t]}const Lj=new Set([301,302,303,307,308]);async function Uj(t,e,r){switch(e.redirect??"follow"){case"error":throw new TypeError(`URI requested responded with a redirect and redirect mode is set to error: ${r.url}`);case"manual":return r;case"follow":break;default:throw new TypeError(`Invalid redirect option: ${e.redirect}`)}const i=r.headers.get("location");if(null===i)return r;const n=r.url,o=new URL(i,n).toString(),a=e.redirectCount??0,s=e.maxRedirect??20;if(a>=s)throw new TypeError(`Reached maximum redirect of ${s} for URL: ${n}`);const h=function(t){return null==t.headers?Bj:"function"==typeof t.headers.delete?Dj:$j}(e={...e,redirectCount:a+1});if(!function(t,e){const r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)}(n,o))for(const t of["authorization","www-authenticate","cookie","cookie2"])h(e,t);const u=e.body,l=e.body;if(303!==r.status&&null!=e.body&&("function"==typeof u.pipe||"function"==typeof l.pipeTo))throw new TypeError("Cannot follow redirect with body being a readable stream");return 303!==r.status&&(301!==r.status&&302!==r.status||"POST"!==e.method)||(e.method="GET",e.body=void 0,h(e,"content-length")),r.headers.has("referrer-policy")&&(e.referrerPolicy=function(t){const e=t.split(/[,\s]+/);let r="";for(const t of e)""!==t&&Pj.has(t)&&(r=t);return r}(r.headers.get("referrer-policy"))),await t(o,e)}function Fj(t,e,r=!0){const i=t,n=e??new pj;async function o(t,e){const a=e??{};e={...e,redirect:"manual"};const s="string"==typeof t?t:t.url??t.href;e=function(t,e,r){if(""===r)return e;const i=t,n=e.headers;return i.headers&&"function"==typeof i.headers.append?i.headers.append("cookie",r):n&&"function"==typeof n.append?n.append("cookie",r):e={...e,headers:{...e.headers,cookie:r}},e}(t,e,await n.getCookieString(s));const h=await i(t,e),u=function(t){const e=t.headers;if("function"==typeof e.getAll)return e.getAll("set-cookie");if("function"==typeof e.raw){const t=e.raw();return Array.isArray(t["set-cookie"])?t["set-cookie"]:[]}const r=t.headers.get("set-cookie");return null!==r?Rj(r):[]}(h);return await Promise.all(u.map((async t=>await n.setCookie(t,h.url,{ignoreError:r})))),(e.redirectCount??0)>0&&Object.defineProperty(h,"redirected",{value:!0}),l=h.status,Lj.has(l)?await Uj(o,a,h):h;var l}return o.toughCookie=Oj,o}Fj.toughCookie=Oj;var qj="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t||{},Vj="URLSearchParams"in qj,Hj="Symbol"in qj&&"iterator"in Symbol,Gj="FileReader"in qj&&"Blob"in qj&&function(){try{return new Blob,!0}catch(t){return!1}}(),Zj="FormData"in qj,Kj="ArrayBuffer"in qj;if(Kj)var Jj=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Wj=ArrayBuffer.isView||function(t){return t&&Jj.indexOf(Object.prototype.toString.call(t))>-1};function Yj(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function Qj(t){return"string"!=typeof t&&(t=String(t)),t}function Xj(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return Hj&&(e[Symbol.iterator]=function(){return e}),e}function tx(t){this.map={},t instanceof tx?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function ex(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function rx(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function ix(t){var e=new FileReader,r=rx(e);return e.readAsArrayBuffer(t),r}function nx(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function ox(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:Gj&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Zj&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Vj&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Kj&&Gj&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=nx(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Kj&&(ArrayBuffer.prototype.isPrototypeOf(t)||Wj(t))?this._bodyArrayBuffer=nx(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Vj&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Gj&&(this.blob=function(){var t=ex(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=ex(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(Gj)return this.blob().then(ix);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,i,n,o=ex(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=rx(e),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),n=i?i[1]:"utf-8",e.readAsText(t,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Zj&&(this.formData=function(){return this.text().then(hx)}),this.json=function(){return this.text().then(JSON.parse)},this}tx.prototype.append=function(t,e){t=Yj(t),e=Qj(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},tx.prototype.delete=function(t){delete this.map[Yj(t)]},tx.prototype.get=function(t){return t=Yj(t),this.has(t)?this.map[t]:null},tx.prototype.has=function(t){return this.map.hasOwnProperty(Yj(t))},tx.prototype.set=function(t,e){this.map[Yj(t)]=Qj(e)},tx.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},tx.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),Xj(t)},tx.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),Xj(t)},tx.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),Xj(t)},Hj&&(tx.prototype[Symbol.iterator]=tx.prototype.entries);var ax=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function sx(t,e){if(!(this instanceof sx))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,i,n=(e=e||{}).body;if(t instanceof sx){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new tx(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new tx(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),ax.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in qj)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function hx(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function ux(t,e){if(!(this instanceof ux))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new tx(e.headers),this.url=e.url||"",this._initBody(t)}sx.prototype.clone=function(){return new sx(this,{body:this._bodyInit})},ox.call(sx.prototype),ox.call(ux.prototype),ux.prototype.clone=function(){return new ux(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new tx(this.headers),url:this.url})},ux.error=function(){var t=new ux(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var lx=[301,302,303,307,308];ux.redirect=function(t,e){if(-1===lx.indexOf(e))throw new RangeError("Invalid status code");return new ux(null,{status:e,headers:{location:t}})};var cx=qj.DOMException;try{new cx}catch(wk){cx=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},cx.prototype=Object.create(Error.prototype),cx.prototype.constructor=cx}function dx(t,e){return new Promise((function(r,i){var n=new sx(t,e);if(n.signal&&n.signal.aborted)return i(new cx("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}if(o.onload=function(){var t,e,i={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new tx,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{e.append(i,n)}catch(t){console.warn("Response "+t.message)}}})),e)};0===n.url.indexOf("file://")&&(o.status<200||o.status>599)?i.status=200:i.status=o.status,i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var a="response"in o?o.response:o.responseText;setTimeout((function(){r(new ux(a,i))}),0)},o.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){i(new cx("Aborted","AbortError"))}),0)},o.open(n.method,function(t){try{return""===t&&qj.location.href?qj.location.href:t}catch(e){return t}}(n.url),!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&(Gj?o.responseType="blob":Kj&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof tx||qj.Headers&&e.headers instanceof qj.Headers)){var s=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){s.push(Yj(t)),o.setRequestHeader(t,Qj(e.headers[t]))})),n.headers.forEach((function(t,e){-1===s.indexOf(e)&&o.setRequestHeader(e,t)}))}else n.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));n.signal&&(n.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&n.signal.removeEventListener("abort",a)}),o.send(void 0===n._bodyInit?null:n._bodyInit)}))}dx.polyfill=!0,qj.fetch||(qj.fetch=dx,qj.Headers=tx,qj.Request=sx,qj.Response=ux);var fx=self.fetch.bind(self);const mx=(t,e,r=[])=>{const i=Object.getOwnPropertyDescriptors(e);for(let t of r)delete i[t];Object.defineProperties(t,i)},px=(t,e=[t])=>{const r=Object.getPrototypeOf(t);return null===r?e:px(r,[...e,r])},gx=(t,e,r=[])=>{var i;const n=null!==(i=((...t)=>{if(0===t.length)return;let e;const r=t.map((t=>px(t)));for(;r.every((t=>t.length>0));){const t=r.map((t=>t.pop())),i=t[0];if(!t.every((t=>t===i)))break;e=i}return e})(...t))&&void 0!==i?i:Object.prototype,o=Object.create(n),a=px(n);for(let e of t){let t=px(e);for(let e=t.length-1;e>=0;e--){let i=t[e];-1===a.indexOf(i)&&(mx(o,i,["constructor",...r]),a.push(i))}}return o.constructor=e,o},yx=t=>t.filter(((e,r)=>t.indexOf(e)==r)),wx=new WeakMap,vx=t=>wx.get(t),bx=(t,e)=>{var r,i;const n=yx([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]),o={};for(let a of n)o[a]=yx([...null!==(r=null==t?void 0:t[a])&&void 0!==r?r:[],...null!==(i=null==e?void 0:e[a])&&void 0!==i?i:[]]);return o},kx=(t,e)=>{var r,i,n,o;return{property:bx(null!==(r=null==t?void 0:t.property)&&void 0!==r?r:{},null!==(i=null==e?void 0:e.property)&&void 0!==i?i:{}),method:bx(null!==(n=null==t?void 0:t.method)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.method)&&void 0!==o?o:{})}},Mx=new Map,_x=(...t)=>{const e=((...t)=>{var e;const r=new Set,i=new Set([...t]);for(;i.size>0;)for(let t of i){const n=[...px(t.prototype).map((t=>t.constructor)),...null!==(e=vx(t))&&void 0!==e?e:[]].filter((t=>!r.has(t)));for(let t of n)i.add(t);r.add(t),i.delete(t)}return[...r]})(...t).map((t=>Mx.get(t))).filter((t=>!!t));return 0==e.length?{}:1==e.length?e[0]:e.reduce(((t,e)=>((t,e)=>{var r,i,n,o,a,s;return{class:yx([...null!==(r=null==t?void 0:t.class)&&void 0!==r?r:[],...null!==(i=null==e?void 0:e.class)&&void 0!==i?i:[]]),static:kx(null!==(n=null==t?void 0:t.static)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.static)&&void 0!==o?o:{}),instance:kx(null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{},null!==(s=null==e?void 0:e.instance)&&void 0!==s?s:{})}})(t,e)))};function Ex(...t){var e,r,i;const n=t.map((t=>t.prototype));function o(...e){for(const r of t)mx(this,new r(...e))}o.prototype=gx(n,o),Object.setPrototypeOf(o,gx(t,null,["prototype"]));let a=o;{const n=_x(...t);for(let t of null!==(e=null==n?void 0:n.class)&&void 0!==e?e:[]){const e=t(a);e&&(a=e)}Ax(null!==(r=null==n?void 0:n.static)&&void 0!==r?r:{},a),Ax(null!==(i=null==n?void 0:n.instance)&&void 0!==i?i:{},a.prototype)}var s,h;return s=a,h=t,wx.set(s,h),a}const Ax=(t,e)=>{const r=t.property,i=t.method;if(r)for(let t in r)for(let i of r[t])i(e,t);if(i)for(let t in i)for(let r of i[t])r(e,t,Object.getOwnPropertyDescriptor(e,t))};var jx=Object.defineProperty,xx=Object.getOwnPropertyDescriptor,Sx=Object.getOwnPropertyNames,Nx=Object.prototype.hasOwnProperty,Ix=(t,e)=>{for(var r in e)jx(t,r,{get:e[r],enumerable:!0})},Tx=(t,e,r,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of Sx(e))Nx.call(t,n)||n===r||jx(t,n,{get:()=>e[n],enumerable:!(i=xx(e,n))||i.enumerable});return t};Ix({},{ADDR_BOUND:()=>gS,API_VERSION:()=>fS,BaseUrl:()=>kS,DEFAULT_GLOBAL_CONFIG:()=>OS,FeeMarginPercentage:()=>AS,HARDENING_4BYTES:()=>zS,HARDENING_BYTE:()=>CS,IS_BROWSER:()=>Kx,MASK_250:()=>cS,MASK_31:()=>dS,MAX_STORAGE_ITEM_SIZE:()=>pS,NetworkName:()=>MS,OutsideExecutionCallerAny:()=>NS,PRIME:()=>mS,RANGE_FELT:()=>wS,RANGE_I128:()=>vS,RANGE_U128:()=>bS,RPC_DEFAULT_VERSION:()=>xS,RPC_NODES:()=>SS,SNIP9_V1_INTERFACE_ID:()=>IS,SNIP9_V2_INTERFACE_ID:()=>TS,SYSTEM_MESSAGES:()=>RS,StarknetChainId:()=>_S,TEXT_TO_FELT_MAX_LEN:()=>uS,TRANSACTION_VERSION:()=>Cx.ETransactionVersion,TransactionHashPrefix:()=>ES,UDC:()=>jS,ZERO:()=>lS});var Cx={};Ix(Cx,{JRPC:()=>zx,RPCSPEC06:()=>Ox,RPCSPEC07:()=>qm});var zx={},Ox={};Ix(Ox,{EBlockTag:()=>Fx,EDAMode:()=>Vx,EDataAvailabilityMode:()=>qx,ESimulationFlag:()=>Dx,ETransactionExecutionStatus:()=>Ux,ETransactionFinalityStatus:()=>Lx,ETransactionStatus:()=>$x,ETransactionType:()=>Bx,ETransactionVersion:()=>Hx,ETransactionVersion2:()=>Gx,ETransactionVersion3:()=>Zx,Errors:()=>Rx,SPEC:()=>Px});var Rx={},Px={},Bx={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},Dx={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},$x={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Lx={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Ux={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},Fx={PENDING:"pending",LATEST:"latest"},qx={L1:"L1",L2:"L2"},Vx={L1:0,L2:1},Hx={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},Gx={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},Zx={V3:"0x3",F3:"0x100000000000000000000000000000003"};((t,e,r)=>{Tx(t,e,"default"),r&&Tx(r,e,"default")})(Cx,qm);Ix({},{IS_BROWSER:()=>Kx,addHexPrefix:()=>rS,arrayBufferToString:()=>Jx,atobUniversal:()=>Qx,btoaUniversal:()=>Xx,buf2hex:()=>tS,calcByteLength:()=>nS,concatenateArrayBuffer:()=>hS,padLeft:()=>iS,pascalToSnake:()=>sS,removeHexPrefix:()=>eS,sanitizeBytes:()=>oS,sanitizeHex:()=>aS,stringToArrayBuffer:()=>Yx,utf8ToArray:()=>Wx});var Kx="undefined"!=typeof window;function Jx(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function Wx(t){return(new TextEncoder).encode(t)}function Yx(t){return Wx(t)}function Qx(t){return lp.decode(t)}function Xx(t){return lp.encode(new Uint8Array(t))}function tS(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function eS(t){return t.replace(/^0x/i,"")}function rS(t){return`0x${eS(t)}`}function iS(t,e,r="0"){return function(t,e,r,i="0"){const n=e-t.length;let o=t;if(n>0){const e=i.repeat(n);o=r?e+t:t+e}return o}(t,e,!0,r)}function nS(t,e=8){const{length:r}=t,i=r%e;return i?(r-i)/e*e+e:r}function oS(t,e=8,r="0"){return iS(t,nS(t,e),r)}function aS(t){const e=oS(eS(t),2);return e?rS(e):e}var sS=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function hS(t){const e=t.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(e);let i=0;return t.forEach((t=>{r.set(t,i),i+=t.byteLength})),r}var uS=31,lS=0n,cS=2n**250n-1n,dS=2n**31n-1n,fS=lS,mS=2n**251n+17n*2n**192n+1n,pS=256n,gS=2n**251n-pS,yS=(t,e)=>({min:t,max:e}),wS=yS(lS,mS-1n),vS=yS(-(2n**127n),2n**127n-1n),bS=yS(lS,2n**128n-1n),kS=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_SEPOLIA="https://alpha-sepolia.starknet.io",t))(kS||{}),MS=(t=>(t.SN_MAIN="SN_MAIN",t.SN_SEPOLIA="SN_SEPOLIA",t))(MS||{}),_S=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_SEPOLIA="0x534e5f5345504f4c4941",t))(_S||{}),ES=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(ES||{}),AS=(t=>(t[t.L1_BOUND_MAX_AMOUNT=50]="L1_BOUND_MAX_AMOUNT",t[t.L1_BOUND_MAX_PRICE_PER_UNIT=50]="L1_BOUND_MAX_PRICE_PER_UNIT",t[t.MAX_FEE=50]="MAX_FEE",t))(AS||{}),jS={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},xS="v0_7",SS={SN_MAIN:[`https://starknet-mainnet.public.blastapi.io/rpc/${xS}`,`https://free-rpc.nethermind.io/mainnet-juno/${xS}`],SN_SEPOLIA:[`https://starknet-sepolia.public.blastapi.io/rpc/${xS}`,`https://free-rpc.nethermind.io/sepolia-juno/${xS}`]},NS="0x414e595f43414c4c4552",IS="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",TS="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",CS=128,zS=2147483648n,OS={legacyMode:!1,logLevel:"INFO",accountTxVersion:Cx.ETransactionVersion.V2},RS={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"},PS={};Ix(PS,{RpcChannel:()=>qC});Ix({},{parse:()=>DS,parseAlwaysAsBig:()=>$S,stringify:()=>LS,stringifyAlwaysAsBig:()=>US});var BS=t=>{if(!yp(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},DS=t=>zp(String(t),void 0,BS),$S=t=>zp(String(t),void 0,Ip),LS=(t,e,r,i)=>dg(t,e,r,i),US=LS,FS={FAILED_TO_RECEIVE_TXN:1,NO_TRACE_AVAILABLE:10,CONTRACT_NOT_FOUND:20,BLOCK_NOT_FOUND:24,INVALID_TXN_INDEX:27,CLASS_HASH_NOT_FOUND:28,TXN_HASH_NOT_FOUND:29,PAGE_SIZE_TOO_BIG:31,NO_BLOCKS:32,INVALID_CONTINUATION_TOKEN:33,TOO_MANY_KEYS_IN_FILTER:34,CONTRACT_ERROR:40,TRANSACTION_EXECUTION_ERROR:41,CLASS_ALREADY_DECLARED:51,INVALID_TRANSACTION_NONCE:52,INSUFFICIENT_MAX_FEE:53,INSUFFICIENT_ACCOUNT_BALANCE:54,VALIDATION_FAILURE:55,COMPILATION_FAILED:56,CONTRACT_CLASS_SIZE_IS_TOO_LARGE:57,NON_ACCOUNT:58,DUPLICATE_TX:59,COMPILED_CLASS_HASH_MISMATCH:60,UNSUPPORTED_TX_VERSION:61,UNSUPPORTED_CONTRACT_CLASS_VERSION:62,UNEXPECTED_ERROR:63};var qS=class extends Error{name;constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){const{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){const{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},VS=class extends qS{},HS=class extends VS{constructor(t,e,r){super(`RPC: ${e} with params ${LS(r,null,2)}\n\n ${t.code}: ${t.message}: ${LS(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return FS[t]===this.code}};Ix({},{BlockStatus:()=>YS,BlockTag:()=>QS,ETH_ADDRESS:()=>rN,EntryPointType:()=>GS,Literal:()=>eN,NON_ZERO_PREFIX:()=>iN,OutsideExecutionTypesV1:()=>nN,OutsideExecutionTypesV2:()=>oN,OutsideExecutionVersion:()=>aN,RPC:()=>Cx,TransactionExecutionStatus:()=>WS,TransactionFinalityStatus:()=>JS,TransactionStatus:()=>KS,TransactionType:()=>ZS,TypedDataRevision:()=>Um,Uint:()=>tN,ValidateType:()=>XS});var GS={EXTERNAL:"EXTERNAL",L1_HANDLER:"L1_HANDLER",CONSTRUCTOR:"CONSTRUCTOR"},ZS={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE_FUNCTION"},KS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",REJECTED:"REJECTED",REVERTED:"REVERTED"},JS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},WS={REJECTED:"REJECTED",REVERTED:"REVERTED",SUCCEEDED:"SUCCEEDED"},YS={PENDING:"PENDING",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",REJECTED:"REJECTED"},QS={PENDING:"pending",LATEST:"latest"},XS={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},tN={u8:"core::integer::u8",u16:"core::integer::u16",u32:"core::integer::u32",u64:"core::integer::u64",u128:"core::integer::u128",u256:"core::integer::u256",u512:"core::integer::u512"},eN={ClassHash:"core::starknet::class_hash::ClassHash",ContractAddress:"core::starknet::contract_address::ContractAddress",Secp256k1Point:"core::starknet::secp256k1::Secp256k1Point",U96:"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"},rN="core::starknet::eth_address::EthAddress",iN="core::zeroable::NonZero::",nN={StarkNetDomain:[{name:"name",type:"felt"},{name:"version",type:"felt"},{name:"chainId",type:"felt"}],OutsideExecution:[{name:"caller",type:"felt"},{name:"nonce",type:"felt"},{name:"execute_after",type:"felt"},{name:"execute_before",type:"felt"},{name:"calls_len",type:"felt"},{name:"calls",type:"OutsideCall*"}],OutsideCall:[{name:"to",type:"felt"},{name:"selector",type:"felt"},{name:"calldata_len",type:"felt"},{name:"calldata",type:"felt*"}]},oN={StarknetDomain:[{name:"name",type:"shortstring"},{name:"version",type:"shortstring"},{name:"chainId",type:"shortstring"},{name:"revision",type:"shortstring"}],OutsideExecution:[{name:"Caller",type:"ContractAddress"},{name:"Nonce",type:"felt"},{name:"Execute After",type:"u128"},{name:"Execute Before",type:"u128"},{name:"Calls",type:"Call*"}],Call:[{name:"To",type:"ContractAddress"},{name:"Selector",type:"selector"},{name:"Calldata",type:"felt*"}]},aN=(t=>(t.UNSUPPORTED="0",t.V1="1",t.V2="2",t))(aN||{}),sN=class{nodeUrl;headers;interval;requestId=0;pendingRequests={};batchPromises={};delayTimer;delayPromise;delayPromiseResolve;baseFetch;constructor(t){this.nodeUrl=t.nodeUrl,this.headers=t.headers,this.interval=t.interval,this.baseFetch=t.baseFetch}async wait(){return this.delayPromise&&this.delayPromiseResolve||(this.delayPromise=new Promise((t=>{this.delayPromiseResolve=t}))),this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=void 0),this.delayTimer=setTimeout((()=>{this.delayPromiseResolve&&(this.delayPromiseResolve(),this.delayPromise=void 0,this.delayPromiseResolve=void 0)}),this.interval),this.delayPromise}addPendingRequest(t,e,r){const i={id:r??`batched_${this.requestId+=1}`,jsonrpc:"2.0",method:t,params:e??void 0};return this.pendingRequests[i.id]=i,i.id}async sendBatch(t){return(await this.baseFetch(this.nodeUrl,{method:"POST",body:LS(t),headers:this.headers})).json()}async fetch(t,e,r){const i=this.addPendingRequest(t,e,r);await this.wait();const n=this.pendingRequests;if(this.pendingRequests={},!this.batchPromises[i]){const t=this.sendBatch(Object.values(n));Object.keys(n).forEach((e=>{this.batchPromises[e]=t}))}const o=await this.batchPromises[i];delete this.batchPromises[i];const a=o.find((t=>t.id===i));if(!a)throw new Error(`Couldn't find the result for the request. Method: ${t}`);return a}};function hN(t,e){if(!t)throw new Error(e||"Assertion failure")}var uN={};Ix(uN,{addPercent:()=>zN,assertInRange:()=>EN,bigNumberishArrayToDecimalStringArray:()=>AN,bigNumberishArrayToHexadecimalStringArray:()=>jN,cleanHex:()=>_N,getDecimalString:()=>SN,getHexString:()=>NN,getHexStringArray:()=>IN,hexToBytes:()=>CN,hexToDecimalString:()=>MN,isBigNumberish:()=>RN,isHex:()=>gN,isStringWholeNumber:()=>xN,stringToSha256ToArrayBuff4:()=>ON,toBigInt:()=>yN,toCairoBool:()=>TN,toHex:()=>wN,toHex64:()=>kN,toHexString:()=>vN,toStorageKey:()=>bN});var lN=t=>void 0===t||void 0===t;function cN(t){return"number"==typeof t}function dN(t){return"boolean"==typeof t}function fN(t){return"bigint"==typeof t}function mN(t){return"string"==typeof t}function pN(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function gN(t){return/^0x[0-9a-f]*$/i.test(t)}function yN(t){return BigInt(t)}function wN(t){return rS(yN(t).toString(16))}var vN=wN;function bN(t){return rS(yN(t).toString(16).padStart(64,"0"))}function kN(t){const e=rS(yN(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function MN(t){return BigInt(rS(t)).toString(10)}function _N(t){return t.toLowerCase().replace(/^(0x)0+/,"$1")}function EN(t,e,r,i=""){const n=""===i?"invalid length":`invalid ${i} length`,o=BigInt(t),a=BigInt(e),s=BigInt(r);hN(o>=a&&o<=s,`Message not signable, ${n}.`)}function AN(t){return t.map((t=>yN(t).toString(10)))}function jN(t){return t.map((t=>wN(t)))}function xN(t){return/^\d+$/.test(t)}function SN(t){if(gN(t))return MN(t);if(xN(t))return t;throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function NN(t){if(gN(t))return t;if(xN(t))return vN(t);throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function IN(t){return t.map(NN)}function TN(t){return(+t).toString()}function CN(t){if(!gN(t))throw new Error(`${t} needs to be a hex-string`);let e=eS(t);return e.length%2!=0&&(e=`0${e}`),Ig(e)}function zN(t,e){const r=BigInt(t);return r+r*BigInt(e)/100n}function ON(t){var e;return CN(wN((e=BigInt(rS(tS(py(t)))),Number(e&dS))))}function RN(t){return cN(t)||fN(t)||mN(t)&&(gN(t)||xN(t))}function PN(t){const e=eS(wN(BigInt(t))),r=e.length%2==0?e:`0${e}`;return rS(_v(CN(rS(r))).toString(16))}function BN(t){const e=BigInt(function(t){return rS(_v(Wx(t)).toString(16))}(t));return e&cS}function DN(t){return wN(BN(t))}function $N(t){return cN(t)||fN(t)?wN(t):gN(t)?t:xN(t)?wN(t):DN(t)}function LN(t){const e=rS(t.reduce(((t,e)=>t+eS(wN(e)).padStart(64,"0")),""));return rS(bg(Yv(CN(e))))}function UN(t,e,r,i,n){return LN([t,e,n,r,i.length,...i])}Ix({},{getL2MessageHash:()=>UN,getSelector:()=>$N,getSelectorFromName:()=>DN,keccakBn:()=>PN,solidityUint256PackedKeccak256:()=>LN,starknetKeccak:()=>BN});var FN={};function qN(t){return/^[\x00-\x7F]*$/.test(t)}function VN(t){return t.length<=uS}function HN(t){return/^[0-9]*$/i.test(t)}function GN(t){return mN(t)&&!gN(t)&&!xN(t)}Ix(FN,{decodeShortString:()=>YN,encodeShortString:()=>WN,isASCII:()=>qN,isDecimalString:()=>HN,isLongText:()=>KN,isShortString:()=>VN,isShortText:()=>ZN,isText:()=>GN,splitLongString:()=>JN});var ZN=t=>GN(t)&&VN(t),KN=t=>GN(t)&&!VN(t);function JN(t){const e=RegExp(`[^]{1,${uS}}`,"g");return t.match(e)||[]}function WN(t){if(!qN(t))throw new Error(`${t} is not an ASCII string`);if(!VN(t))throw new Error(`${t} is too long`);return rS(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function YN(t){if(!qN(t))throw new Error(`${t} is not an ASCII string`);if(gN(t))return eS(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(HN(t))return YN("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}function QN(t){const e=0n===BigInt(t.pending_word)?"":YN(wN(t.pending_word));return t.data.reduce(((t,e)=>t+(0n===BigInt(e)?"":YN(wN(e)))),"")+e}function XN(t){const e=JN(t),r=e[e.length-1],i=e.map(WN),[n,o]=void 0===r||31===r.length?["0x00",0]:[i.pop(),r.length];return{data:0===i.length?[]:i,pending_word:n,pending_word_len:o}}Ix({},{byteArrayFromString:()=>XN,stringFromByteArray:()=>QN});function tI(t){if(fN(t)||Number.isInteger(t))return t.toString();if(mN(t)){if(gN(t))return BigInt(t).toString();if(GN(t)){if(!VN(t))throw new Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(WN(t)).toString()}if(xN(t))return t}if(dN(t))return""+ +t;throw new Error(`${t} can't be computed by felt()`)}Ix({},{felt:()=>LI,getAbiContractVersion:()=>PI,getArrayType:()=>zI,isCairo1Abi:()=>OI,isCairo1Type:()=>CI,isLen:()=>fI,isTypeArray:()=>pI,isTypeBool:()=>AI,isTypeByteArray:()=>NI,isTypeBytes31:()=>SI,isTypeContractAddress:()=>jI,isTypeEnum:()=>vI,isTypeEthAddress:()=>xI,isTypeFelt:()=>mI,isTypeLiteral:()=>EI,isTypeNamedTuple:()=>yI,isTypeNonZero:()=>RI,isTypeOption:()=>bI,isTypeResult:()=>kI,isTypeSecp256k1Point:()=>TI,isTypeStruct:()=>wI,isTypeTuple:()=>gI,isTypeU96:()=>II,isTypeUint:()=>MI,isTypeUint256:()=>_I,tuple:()=>$I,uint256:()=>BI,uint512:()=>DI});var eI=(1n<<128n)-1n,rI=(1n<<256n)-1n,iI=0n,nI=340282366920938463463374607431768211455n,oI=340282366920938463463374607431768211455n,aI=0n,sI=0n,hI=class t{low;high;static abiSelector="core::integer::u256";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"low"in e[0]&&"high"in e[0]){const r=t.validateProps(e[0].low,e[0].high);this.low=r.low,this.high=r.high}else if(1===e.length){const r=t.validate(e[0]);this.low=r&eI,this.high=r>>128n}else{if(2!==e.length)throw Error("Incorrect constructor parameters");{const r=t.validateProps(e[0],e[1]);this.low=r.low,this.high=r.high}}}static validate(t){const e=BigInt(t);if(e<iI)throw Error("bigNumberish is smaller than UINT_256_MIN");if(e>rI)throw new Error("bigNumberish is bigger than UINT_256_MAX");return e}static validateProps(t,e){const r=BigInt(t),i=BigInt(e);if(r<aI||r>nI)throw new Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX");if(i<sI||i>oI)throw new Error("high is out of range UINT_256_HIGH_MIN - UINT_256_HIGH_MAX");return{low:r,high:i}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.high<<128n)+this.low}toUint256HexString(){return{low:rS(this.low.toString(16)),high:rS(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[tI(this.low),tI(this.high)]}},uI=(1n<<512n)-1n,lI=0n,cI=0n,dI=class t{limb0;limb1;limb2;limb3;static abiSelector="core::integer::u512";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"limb0"in e[0]&&"limb1"in e[0]&&"limb2"in e[0]&&"limb3"in e[0]){const r=t.validateProps(e[0].limb0,e[0].limb1,e[0].limb2,e[0].limb3);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}else if(1===e.length){const r=t.validate(e[0]);this.limb0=r&eI,this.limb1=(r&eI<<128n)>>128n,this.limb2=(r&eI<<256n)>>256n,this.limb3=r>>384n}else{if(4!==e.length)throw Error("Incorrect Uint512 constructor parameters");{const r=t.validateProps(e[0],e[1],e[2],e[3]);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}}}static validate(t){const e=BigInt(t);if(e<lI)throw Error("bigNumberish is smaller than UINT_512_MIN.");if(e>uI)throw Error("bigNumberish is bigger than UINT_512_MAX.");return e}static validateProps(t,e,r,i){const n=BigInt(t),o=BigInt(e),a=BigInt(r),s=BigInt(i);return[n,o,a,s].forEach(((t,e)=>{if(t<cI||t>eI)throw Error(`limb${e} is not in the range of a u128 number`)})),{limb0:n,limb1:o,limb2:a,limb3:s}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.limb3<<384n)+(this.limb2<<256n)+(this.limb1<<128n)+this.limb0}toUint512HexString(){return{limb0:rS(this.limb0.toString(16)),limb1:rS(this.limb1.toString(16)),limb2:rS(this.limb2.toString(16)),limb3:rS(this.limb3.toString(16))}}toUint512DecimalString(){return{limb0:this.limb0.toString(10),limb1:this.limb1.toString(10),limb2:this.limb2.toString(10),limb3:this.limb3.toString(10)}}toApiRequest(){return[tI(this.limb0),tI(this.limb1),tI(this.limb2),tI(this.limb3)]}},fI=t=>/_len$/.test(t),mI=t=>"felt"===t||"core::felt252"===t,pI=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),gI=t=>/^\(.*\)$/i.test(t),yI=t=>/\(.*\)/i.test(t)&&t.includes(":"),wI=(t,e)=>t in e,vI=(t,e)=>t in e,bI=t=>t.startsWith("core::option::Option::"),kI=t=>t.startsWith("core::result::Result::"),MI=t=>Object.values(tN).includes(t),_I=t=>hI.isAbiType(t),EI=t=>Object.values(eN).includes(t),AI=t=>"core::bool"===t,jI=t=>t===eN.ContractAddress,xI=t=>t===rN,SI=t=>"core::bytes_31::bytes31"===t,NI=t=>"core::byte_array::ByteArray"===t,II=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,TI=t=>t===eN.Secp256k1Point,CI=t=>t.includes("::"),zI=t=>CI(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function OI(t){const{cairo:e}=PI(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function RI(t){return t.startsWith(iN)}function PI(t){if(t.find((t=>"interface"===t.type)))return{cairo:"1",compiler:"2"};const e=t.find((t=>("function"===t.type||"constructor"===t.type)&&(t.inputs.length||t.outputs.length)));if(!e)return{cairo:void 0,compiler:void 0};const r=e.inputs.length?e.inputs:e.outputs;return CI(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var BI=t=>new hI(t).toUint256DecimalString(),DI=t=>new dI(t).toUint512DecimalString(),$I=(...t)=>({...t});function LI(t){return tI(t)}var UI=class{variant;constructor(t){const e=Object.values(t);if(0===e.length)throw new Error("This Enum must have at least 1 variant");if(1!==e.filter((t=>!lN(t))).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find((t=>!lN(t)))}activeVariant(){const t=Object.entries(this.variant).find((t=>!lN(t[1])));return lN(t)?"":t[0]}},FI={Some:0,None:1},qI=class{Some;None;constructor(t,e){if(!(t in Object.values(FI)))throw new Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===FI.Some){if(lN(e))throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){return this.None?void 0:this.Some}isSome(){return!lN(this.Some)}isNone(){return!0===this.None}},VI={Ok:0,Err:1},HI=class{Ok;Err;constructor(t,e){if(!(t in Object.values(VI)))throw new Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===VI.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!lN(this.Ok))return this.Ok;if(!lN(this.Err))return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!lN(this.Ok)}isErr(){return!lN(this.Err)}},GI=(t,e,r)=>{if(!fN(t[r]))throw new Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},ZI=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function KI(t,e,r){return Object.entries(t).reduce(((i,[n,o])=>{const a=r??e[n];if(!(n in e)&&!r)return i[n]=o,i;if("string"===a){if(Array.isArray(t[n])){const e=KI(t[n],t[n].map((t=>a)));return i[n]=Object.values(e).join(""),i}return GI(t,e,n),i[n]=YN(o),i}if("number"===a)return GI(t,e,n),i[n]=Number(o),i;if("function"==typeof a)return i[n]=a(o),i;if(Array.isArray(a)){const e=KI(t[n],a,a[0]);return i[n]=Object.values(e),i}return pN(a)?(i[n]=KI(t[n],a),i):(ZI(t,e,n),i)}),{})}function JI(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:OI(t)?1:0}(t);if(0===e||1===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.reduce(((t,e)=>fI(e.name)?t:t+1),0)}getMethod(t){return this.abi.find((e=>e.name===t))}getLegacyFormat(){return this.abi}}(t);if(2===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.length}getMethod(t){return this.abi.find((t=>"interface"===t.type))?.items?.find((e=>e.name===t))}getLegacyFormat(){return this.abi.flatMap((t=>"interface"===t.type?t.items:t))}}(t);throw Error(`Unsupported ABI version ${e}`)}function WI(t,e,r){return"constructor"===t&&!r&&!e.length}function YI(t,e,r){for(let i=0,n=0;i<t.length;i++)if(t[i]===e)n++;else if(t[i]===r&&0==--n)return i;return Number.POSITIVE_INFINITY}function QI(t){return CI(t)?function(t){const e=t.slice(1,-1),r=[];let i,n=0;for(;n<e.length;){switch(!0){case"("===e[n]:i=n+YI(e.slice(n),"(",")")+1;break;case e.startsWith("core::result::Result::<",n)||e.startsWith("core::array::Array::<",n)||e.startsWith("core::option::Option::<",n):i=n+YI(e.slice(n),"<",">")+1;break;default:{const t=e.indexOf(",",n);i=-1!==t?t:Number.POSITIVE_INFINITY}}r.push(e.slice(n,i)),n=i+2}return r}(t):function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:i}=function(t){if(!t.includes("("))return{subTuple:[],result:t};const e=[];let r="",i=0;for(;i<t.length;){if("("===t[i]){let n=1;const o=i;for(i++;n;)")"===t[i]&&n--,"("===t[i]&&n++,i++;e.push(t.substring(o,i)),r+=" ",i--}else r+=t[i];i++}return{subTuple:e,result:r}}(e);let n=i.split(",").map((t=>r.length?t.replace(" ",r.shift()):t));return yI(t)&&(n=n.reduce(((t,e)=>t.concat(function(t){const e=t.substring(0,t.indexOf(":"));return{name:e,type:t.substring(e.length+":".length)}}(e))),[])),n}(t)}var XI=class t{content;arrayType;constructor(e,r){hN(t.isTypeFixedArray(r),`The type ${r} is not a Cairo fixed array. Needs [type; length].`);try{t.getFixedArrayType(r)}catch{throw new Error(`The type ${r} do not includes any content type. Needs [type; length].`)}try{t.getFixedArraySize(r)}catch{throw new Error(`The type ${r} type do not includes any length. Needs [type; length].`)}hN(t.getFixedArraySize(r)===e.length,`The ABI type ${r} is expecting ${t.getFixedArraySize(r)} items. ${e.length} items provided.`),this.content=e,this.arrayType=r}static getFixedArraySize(t){const e=t.match(/(?<=; )\d+(?=\])/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid number after ';' character.`);return Number(e[0])}getFixedArraySize(){return t.getFixedArraySize(this.arrayType)}static getFixedArrayType=t=>{const e=t.match(/(?<=\[).+(?=;)/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid type of data.`);return e[0]};getFixedArrayType(){return t.getFixedArrayType(this.arrayType)}static compile(t){return t.reduce(((t,e,r)=>(t[r]=e,t)),{})}compile(){return t.compile(this.content)}static isTypeFixedArray(t){return/^\[.*;\s.*\]$/.test(t)&&/(?<=\[).+(?=;)/.test(t)&&/(?<=; )\d+(?=\])/.test(t)}};function tT(t,e,r,i){const n=(t,e)=>{if(XI.isTypeFixedArray(e))return function(t,e){const r=XI.getFixedArrayType(e),i=XI.getFixedArraySize(e);if(Array.isArray(t)){if(i!==t.length)throw new Error(`ABI type ${e}: array provided do not includes ${i} items. ${t.length} items provided.`);return t.map((t=>n(t,r)))}if(i!==Object.keys(t).length)throw new Error(`ABI type ${e}: object provided do not includes ${i} properties. ${Object.keys(t).length} items provided.`);return n(t,r)}(t,e);if(pI(e))return function(t,e){const r=zI(e);if(mN(t))return t;return t.map((t=>n(t,r)))}(t,e);if(vI(e,i)){const r=i[e];return a(t,r)}if(gI(e))return function(t,e){const r=QI(e).reduce(((e,r,i)=>{const o=Object.keys(t),a=r=>Object.defineProperty(e,i.toString(),{enumerable:!0,value:r??t[o[i]]}),s=r?.type?r.type:r;return a(n(t[o[i]],s)),e}),{});return r}(t,e);if(xI(e))return t;if(RI(e))return t;if(NI(e))return t;if(II(e))return t;if(TI(e))return t;if(hI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!("low"in r)||!("high"in r))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint256 object without the 'low' and 'high' keys.`)}(e);return{low:r.low,high:r.high}}if(dI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!["limb0","limb1","limb2","limb3"].every((t=>t in r)))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint512 object without the 'limb0' to 'limb3' keys.`)}(e);return{limb0:r.limb0,limb1:r.limb1,limb2:r.limb2,limb3:r.limb3}}if(wI(e,r)){const i=r[e].members;return o(t,i)}return t},o=(t,e)=>e.reduce(((e,r)=>{if("undefined"===t[r.name]&&(CI(r.type)||!fI(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);var i;return i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i??t[r.name]}),e}),{});const a=(t,e)=>{if(kI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),o=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return r.isOk()?new HI(VI.Ok,n(t.unwrap(),i)):new HI(VI.Err,n(t.unwrap(),o))}if(bI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new qI(FI.Some,n(r.unwrap(),i)):new qI(FI.None,{})}const r=t,i=Object.entries(r.variant).map((t=>{if(lN(t[1]))return t;const i=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===i?t:[t[0],n(r.unwrap(),i)]}));return new UI(Object.fromEntries(i))};return e.reduce(((e,r)=>{return fI(r.name)&&!CI(r.type)||(i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i})),e;var i}),{})}function eT(t,e){switch(!0){case hI.isAbiType(t):return new hI(e).toApiRequest();case dI.isAbiType(t):return new dI(e).toApiRequest();case SI(t):return WN(e.toString());case TI(t):{const t=eS(wN(e)).padStart(128,"0"),r=BI(rS(t.slice(-64))),i=BI(rS(t.slice(0,-64)));return[LI(i.low),LI(i.high),LI(r.low),LI(r.high)]}default:return LI(e)}}function rT(t,e,r,i){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(XI.isTypeFixedArray(e)){const n=XI.getFixedArrayType(e);let o=[];if(Array.isArray(t)){o=new XI(t,e).content}else{if("object"!=typeof t)throw new Error(`ABI type ${e}: not an Array representing a cairo.fixedArray() provided.`);o=Object.values(t),hN(o.length===XI.getFixedArraySize(e),`ABI type ${e}: object provided do not includes ${XI.getFixedArraySize(e)} items. ${o.length} items provided.`)}return o.reduce(((t,e)=>t.concat(rT(e,n,r,i))),[])}if(Array.isArray(t)){const n=[];n.push(LI(t.length));const o=zI(e);return t.reduce(((t,e)=>t.concat(rT(e,o,r,i))),n)}if(r[e]&&r[e].members.length){if(hI.isAbiType(e))return new hI(t).toApiRequest();if(dI.isAbiType(e))return new dI(t).toApiRequest();if(xI(e))return eT(e,t);if(NI(e))return function(t){const e=XN(t);return[e.data.length.toString(),...e.data.map((t=>t.toString())),e.pending_word.toString(),e.pending_word_len.toString()]}(t);const{members:n}=r[e],o=t;return n.reduce(((t,e)=>t.concat(rT(o[e.name],e.type,r,i))),[])}if(gI(e)){const n=function(t,e){const r=QI(e),i=Object.values(t);if(i.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.\n provided: ${i}\n expected: ${r}`);return r.map(((t,e)=>({element:i[e],type:t.type??t})))}(t,e);return n.reduce(((t,e)=>{const n=rT(e.element,e.type,r,i);return t.concat(n)}),[])}if(hI.isAbiType(e))return new hI(t).toApiRequest();if(dI.isAbiType(e))return new dI(t).toApiRequest();if(vI(e,i)){const{variants:n}=i[e];if(bI(e)){const e=t;if(e.isSome()){const t=n.find((t=>"Some"===t.name));if(lN(t))throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return FI.Some.toString();const a=rT(e.unwrap(),o,r,i);return Array.isArray(a)?[FI.Some.toString(),...a]:[FI.Some.toString(),a]}return FI.None.toString()}if(kI(e)){const e=t;if(e.isOk()){const t=n.find((t=>"Ok"===t.name));if(lN(t))throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return VI.Ok.toString();const a=rT(e.unwrap(),o,r,i);return Array.isArray(a)?[VI.Ok.toString(),...a]:[VI.Ok.toString(),a]}const o=n.find((t=>"Err"===t.name));if(lN(o))throw Error("Error in abi : Result has no 'Err' variant.");const a=o.type;if("()"===a)return VI.Err.toString();const s=rT(e.unwrap(),a,r,i);return Array.isArray(s)?[VI.Err.toString(),...s]:[VI.Err.toString(),s]}const o=t,a=o.activeVariant(),s=n.find((t=>t.name===a));if(lN(s))throw Error(`Not find in abi : Enum has no '${a}' variant.`);const h=s.type,u=n.findIndex((t=>t.name===a));if("()"===h)return u.toString();const l=rT(o.unwrap(),h,r,i);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if(RI(e))return eT(zI(e),t);if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return eT(e,t)}function iT(t,e){let r;switch(!0){case AI(t):return r=e.next().value,Boolean(BigInt(r));case hI.isAbiType(t):const i=e.next().value,n=e.next().value;return new hI(i,n).toBigInt();case dI.isAbiType(t):const o=e.next().value,a=e.next().value,s=e.next().value,h=e.next().value;return new dI(o,a,s,h).toBigInt();case xI(t):return r=e.next().value,BigInt(r);case SI(t):return r=e.next().value,YN(r);case TI(t):const u=eS(e.next().value).padStart(32,"0"),l=eS(e.next().value).padStart(32,"0"),c=eS(e.next().value).padStart(32,"0"),d=eS(e.next().value).padStart(32,"0");return BigInt(rS(l+u+d+c));default:return r=e.next().value,BigInt(r)}}function nT(t,e,r,i){if("()"===e.type)return{};if(hI.isAbiType(e.type)){const e=t.next().value,r=t.next().value;return new hI(e,r).toBigInt()}if(dI.isAbiType(e.type)){const e=t.next().value,r=t.next().value,i=t.next().value,n=t.next().value;return new dI(e,r,i,n).toBigInt()}if(NI(e.type)){const e=[],r=BigInt(t.next().value);for(;e.length<r;)e.push(wN(t.next().value));return QN({data:e,pending_word:wN(t.next().value),pending_word_len:BigInt(t.next().value)})}if(XI.isTypeFixedArray(e.type)){const n=[],o={name:"",type:XI.getFixedArrayType(e.type)},a=XI.getFixedArraySize(e.type);for(;n.length<a;)n.push(nT(t,o,r,i));return n}if(pI(e.type)){const n=[],o={name:"",type:zI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(nT(t,o,r,i));return n}if(RI(e.type)){const n={name:"",type:zI(e.type)};return nT(t,n,r,i)}if(r&&e.type in r&&r[e.type])return xI(e.type)?iT(e.type,t):r[e.type].members.reduce(((e,n)=>(e[n.name]=nT(t,n,r,i),e)),{});if(i&&e.type in i&&i[e.type]){const n=Number(t.next().value),o=i[e.type].variants.reduce(((e,o,a)=>a===n?(e[o.name]=nT(t,{name:"",type:o.type},r,i),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=n===FI.Some?o.Some:void 0;return new qI(n,t)}if(e.type.startsWith("core::result::Result")){let t;return t=n===VI.Ok?o.Ok:o.Err,new HI(n,t)}return new UI(o)}if(gI(e.type)){return QI(e.type).reduce(((e,n,o)=>{const a=n?.name?n.name:o,s={name:a,type:n?.type?n.type:n};return e[a]=nT(t,s,r,i),e}),{})}if(pI(e.type)){const n=[],o={name:"",type:zI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(nT(t,o,r,i));return n}return iT(e.type,t)}function oT(t,e,r,i,n){const{name:o,type:a}=e;let s;switch(!0){case fI(o):return s=t.next().value,BigInt(s);case r&&a in r||gI(a):case i&&vI(a,i):case XI.isTypeFixedArray(a):return nT(t,e,r,i);case pI(a):if(CI(a))return nT(t,e,r,i);const h=[];if(n&&n[`${o}_len`]){const a=n[`${o}_len`];for(;h.length<a;)h.push(nT(t,{name:o,type:e.type.replace("*","")},r,i))}return h;case RI(a):return nT(t,e,r,i);default:return iT(a,t)}}var aT=(t,e)=>{if(hN(mN(t)||cN(t)||fN(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),mN(t)&&!gN(t))return;const r=BigInt(t.toString(10));hN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},sT=(t,e)=>{let r;switch(cN(t)&&hN(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),hN(mN(t)||cN(t)||fN(t)||pN(t)&&"low"in t&&"high"in t||pN(t)&&["limb0","limb1","limb2","limb3"].every((e=>e in t)),`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`),e.type){case tN.u256:r=new hI(t).toBigInt();break;case tN.u512:r=new dI(t).toBigInt();break;default:r=yN(t)}switch(e.type){case tN.u8:hN(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case tN.u16:hN(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case tN.u32:hN(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case tN.u64:hN(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case tN.u128:hN(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case tN.u256:hN(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case tN.u512:hN(dI.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case eN.ClassHash:case eN.ContractAddress:hN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case eN.Secp256k1Point:hN(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case eN.U96:hN(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},hT=(t,e)=>{hN(dN(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},uT=(t,e,r)=>{if(e.type!==tN.u256&&e.type!==tN.u512)if(xI(e.type)){hN(!pN(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);const r=BigInt(t.toString(10));hN(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else hN(pN(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as a js object (not array)`),r[e.type].members.forEach((({name:r})=>{hN(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else sT(t,e)},lT=(t,e)=>{hN(pN(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as a js object (not array)`);const r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),i=[...Object.getOwnPropertyNames(t),...r];if(!(bI(e.type)&&i.includes("isSome")&&i.includes("isNone")||kI(e.type)&&i.includes("isOk")&&i.includes("isErr")||i.includes("variant")&&i.includes("activeVariant")))throw new Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received "${t}", is not an Enum.`)},cT=(t,e)=>{hN(pN(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},dT=(t,e,r,i)=>{const n=pI(e.type),o=n?zI(e.type):XI.getFixedArrayType(e.type);if(n&&mI(o)&&KN(t))return;let a=[];if(n)hN(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),a=t;else switch(!0){case Array.isArray(t):a=t;break;case"object"==typeof t:a=Object.values(t);break;default:throw new Error(`Validate: arg ${e.name} should be an Array or an object.`)}switch(!0){case mI(o):a.forEach((t=>aT(t,e)));break;case gI(o):a.forEach((t=>cT(t,{name:e.name,type:o})));break;case pI(o):a.forEach((t=>dT(t,{name:"",type:o},r,i)));break;case wI(o,r):a.forEach((t=>uT(t,{name:e.name,type:o},r)));break;case vI(o,i):a.forEach((t=>lT(t,{name:e.name,type:o})));break;case MI(o)||EI(o):a.forEach((t=>sT(t,{name:"",type:o})));break;case AI(o):a.forEach((t=>hT(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${a}`)}};function fT(t,e,r,i){t.inputs.reduce(((t,n)=>{const o=e[t];switch(!0){case fI(n.name):return t;case mI(n.type):aT(o,n);break;case SI(n.type):((t,e)=>{hN(mN(t),`Validate: arg ${e.name} should be a string.`),hN(t.length<32,`Validate: arg ${e.name} cairo typed ${e.type} should be a string of less than 32 characters.`)})(o,n);break;case MI(n.type)||EI(n.type):sT(o,n);break;case AI(n.type):hT(o,n);break;case NI(n.type):((t,e)=>{hN(mN(t),`Validate: arg ${e.name} should be a string.`)})(o,n);break;case pI(n.type)||XI.isTypeFixedArray(n.type):dT(o,n,r,i);break;case wI(n.type,r):uT(o,n,r);break;case vI(n.type,i):lT(o,n);break;case gI(n.type):cT(o,n);break;case RI(n.type):((t,e)=>{const r=zI(e.type);switch(hN(MI(r)&&r!==dI.abiSelector||mI(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case mI(r):aT(t,e),hN(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case MI(r):sT(t,{name:"",type:r}),r===tN.u256?hN(new hI(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):hN(yN(t)>0,"Validate: value 0 is not authorized in NonZero uint type.");break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value "${t}"`)}})(o,n);break;default:throw new Error(`Validate Unhandled: argument ${n.name}, type ${n.type}, value ${o}`)}return t+1}),0)}var mT=class t{abi;parser;structs;enums;constructor(e){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=JI(e),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if(t!==XS.DEPLOY){hN(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return t===XS.INVOKE?!r:r})).map((t=>t.name)).includes(e),(t===XS.INVOKE?"invocable":"viewable")+" method not found in abi")}const i=this.abi.find((r=>t===XS.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(WI(e,r,i))return;const n=this.parser.methodInputsLength(i);if(r.length!==n)throw Error(`Invalid number of arguments, expected ${n} arguments, but got ${r.length}`);fT(i,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(WI(t,e,r))return[];let i;if(Array.isArray(e))i=e;else{const t=tT(e,r.inputs,this.structs,this.enums);i=Object.values(t),fT(r,i,this.structs,this.enums)}const n=i[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>fI(e.name)&&!CI(e.type)?t:t.concat(function(t,e,r,i){const{name:n,type:o}=e;let{value:a}=t.next();switch(!0){case XI.isTypeFixedArray(o):if(!Array.isArray(a)&&"object"!=typeof a)throw Error(`ABI expected parameter ${n} to be an array or an object, got ${a}`);return rT(a,e.type,r,i);case pI(o):if(!Array.isArray(a)&&!GN(a))throw Error(`ABI expected parameter ${n} to be array or long string, got ${a}`);return mN(a)&&(a=JN(a)),rT(a,e.type,r,i);case RI(o):return eT(zI(o),a);case xI(o):return eT(o,a);case wI(o,r)||gI(o)||hI.isAbiType(o):case vI(o,i):return rT(a,o,r,i);default:return eT(o,a)}}(n,e,this.structs,this.enums))),[]);return Object.defineProperty(o,"__compiled__",{enumerable:!1,writable:!1,value:!0}),o}static compile(t){const e=t=>{const e=(t,r=".")=>{const i=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(i).flatMap((([t,n])=>{let o=n;"entrypoint"===t?o=DN(o):KN(o)&&(o=XN(o));const a=Array.isArray(i)&&"0"===t?"$$len":t;if(fN(o))return[[`${r}${a}`,LI(o)]];if(Object(o)===o){const t=Object.getOwnPropertyNames(Object.getPrototypeOf(o)),i=[...Object.getOwnPropertyNames(o),...t];if(i.includes("isSome")&&i.includes("isNone")){const t=o,i=t.isSome()?FI.Some:FI.None;return t.isSome()?e({0:i,1:t.unwrap()},`${r}${a}.`):[[`${r}${a}`,LI(i)]]}if(i.includes("isOk")&&i.includes("isErr")){const t=o,i=t.isOk()?VI.Ok:VI.Err;return e({0:i,1:t.unwrap()},`${r}${a}.`)}if(i.includes("variant")&&i.includes("activeVariant")){const t=o,i=t.activeVariant(),n=Object.keys(t.variant).findIndex((t=>t===i));return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${a}`,LI(n)]]:e({0:n,1:t.unwrap()},`${r}${a}.`)}return e(o,`${r}${a}.`)}return[[`${r}${a}`,LI(o)]]}))};return Object.fromEntries(e(t))};let r;if(Array.isArray(t)){const i=e({...t});r=Object.values(i)}else{const i=e(t);r=Object.values(i)}return Object.defineProperty(r,"__compiled__",{enumerable:!1,writable:!1,value:!0}),r}parse(t,e){const{outputs:r}=this.abi.find((e=>e.name===t)),i=e.flat()[Symbol.iterator](),n=r.flat().reduce(((t,e,r)=>{const n=e.name??r;return t[n]=oT(i,e,this.structs,this.enums,t),t[n]&&t[`${n}_len`]&&delete t[`${n}_len`],t}),{});return 1===Object.keys(n).length&&0 in n?n[0]:n}format(t,e,r){return KI(this.parse(t,e),r)}static getAbiStruct(t){return t.filter((t=>"struct"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{})}static getAbiEnum(t){const e=t.filter((t=>"enum"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{});return delete e["core::bool"],e}static toCalldata(e=[]){return t.compile(e)}static toHex(e=[]){return t.compile(e).map((t=>wN(t)))}decodeParameters(t,e){const r=Array.isArray(t)?t:[t],i=e.flat()[Symbol.iterator](),n=r.map((t=>oT(i,{name:"",type:t},this.structs,this.enums)));return 1===n.length?n[0]:n}};Ix({},{calculateContractAddressFromHash:()=>qT,calculateDeclareTransactionHash:()=>PT,calculateDeployAccountTransactionHash:()=>BT,calculateInvokeTransactionHash:()=>RT,calculateL2MessageTxHash:()=>bT,computeCompiledClassHash:()=>WT,computeContractClassHash:()=>XT,computeHashOnElements:()=>LT,computeHintedClassHash:()=>GT,computeLegacyContractClassHash:()=>ZT,computePedersenHash:()=>DT,computePedersenHashOnElements:()=>UT,computePoseidonHash:()=>$T,computePoseidonHashOnElements:()=>FT,computeSierraContractClassHash:()=>QT,formatSpaces:()=>HT,getL2MessageHash:()=>UN,getSelector:()=>$N,getSelectorFromName:()=>DN,hashByteCodeSegments:()=>JT,keccakBn:()=>PN,poseidon:()=>kw,solidityUint256PackedKeccak256:()=>LN,starknetKeccak:()=>BN});Ix({},{calculateDeclareTransactionHash:()=>yT,calculateDeployAccountTransactionHash:()=>wT,calculateL2MessageTxHash:()=>bT,calculateTransactionHash:()=>vT,calculateTransactionHashCommon:()=>gT,computeHashOnElements:()=>pT});function pT(t){return[...t,t.length].reduce(((t,e)=>kv(yN(t),yN(e))),0).toString()}function gT(t,e,r,i,n,o,a,s=[]){const h=pT(n);return pT([t,e,r,i,h,o,a,...s])}function yT(t,e,r,i,n,o,a){return gT("0x6465636c617265",r,e,0,[t],i,n,[o,...a?[a]:[]])}function wT(t,e,r,i,n,o,a,s){return gT("0x6465706c6f795f6163636f756e74",n,t,0,[e,i,...r],o,a,[s])}function vT(t,e,r,i,n,o){return gT("0x696e766f6b65",e,t,0,r,i,n,[o])}function bT(t,e,r,i,n,o){const a=[t,...i];return gT("0x6c315f68616e646c6572",0,e,$N(r),a,0,n,[o])}Ix({},{starkCurve:()=>Cv,weierstrass:()=>Vw});Ix({},{calculateDeclareTransactionHash:()=>zT,calculateDeployAccountTransactionHash:()=>CT,calculateInvokeTransactionHash:()=>OT,calculateTransactionHashCommon:()=>TT,encodeResourceBoundsL1:()=>ST,encodeResourceBoundsL2:()=>NT,hashDAMode:()=>xT,hashFeeField:()=>IT});var kT=t=>t.map((t=>BigInt(t))),MT=32n,_T=128n,ET=64n+_T,AT=BigInt(WN("L1_GAS")),jT=BigInt(WN("L2_GAS"));function xT(t,e){return(BigInt(t)<<MT)+BigInt(e)}function ST(t){return(AT<<ET)+(BigInt(t.l1_gas.max_amount)<<_T)+BigInt(t.l1_gas.max_price_per_unit)}function NT(t){return(jT<<ET)+(BigInt(t.l2_gas.max_amount)<<_T)+BigInt(t.l2_gas.max_price_per_unit)}function IT(t,e){const r=ST(e),i=NT(e);return Tv([BigInt(t),r,i])}function TT(t,e,r,i,n,o,a,s,h,u,l=[]){const c=IT(o,u),d=xT(s,h),f=kT([t,e,r,c,Tv(kT(a)),i,n,d,...kT(l)]);return wN(Tv(f))}function CT(t,e,r,i,n,o,a,s,h,u,l,c){return TT("0x6465706c6f795f6163636f756e74",n,t,o,a,l,c,s,h,u,[Tv(kT(r)),e,i])}function zT(t,e,r,i,n,o,a,s,h,u,l,c){return TT("0x6465636c617265",i,r,n,o,l,kT(c),s,h,u,[Tv(kT(a)),t,e])}function OT(t,e,r,i,n,o,a,s,h,u,l){return TT("0x696e766f6b65",e,t,i,n,u,l,a,s,h,[Tv(kT(o)),Tv(kT(r))])}function RT(t){return function(t){return[Cx.ETransactionVersion.V3,Cx.ETransactionVersion.F3].includes(t.version)}(t)?OT(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):vT(t.senderAddress,t.version,t.compiledCalldata,t.maxFee,t.chainId,t.nonce)}function PT(t){return function(t){return[Cx.ETransactionVersion.V3,Cx.ETransactionVersion.F3].includes(t.version)}(t)?zT(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):yT(t.classHash,t.senderAddress,t.version,t.maxFee,t.chainId,t.nonce,t.compiledClassHash)}function BT(t){return function(t){return[Cx.ETransactionVersion.V3,Cx.ETransactionVersion.F3].includes(t.version)}(t)?CT(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):wT(t.contractAddress,t.classHash,t.constructorCalldata,t.salt,t.version,t.maxFee,t.chainId,t.nonce)}function DT(t,e){return kv(BigInt(t),BigInt(e))}function $T(t,e){return wN(Iv(BigInt(t),BigInt(e)))}function LT(t){return[...t,t.length].reduce(((t,e)=>kv(BigInt(t),BigInt(e))),0).toString()}var UT=LT;function FT(t){return wN(Tv(t.map((t=>BigInt(t)))))}function qT(t,e,r,i){const n=LT(mT.compile(r)),o=LT([LI("0x535441524b4e45545f434f4e54524143545f41444452455353"),i,t,e,n]);return wN(BigInt(o)%gS)}function VT(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function HT(t){let e=!1;const r=[];for(const i of t)'"'===i&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(i):r.push(":"===i?": ":","===i?", ":i);return r.join("")}function GT(t){const{abi:e,program:r}=t,i=HT(LS({abi:e,program:r},VT));return rS(_v(Wx(i)).toString(16))}function ZT(t){const e=mN(t)?DS(t):t,r=wN(fS),i=LT(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),n=LT(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=LT(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),a=LT(e.program.builtins.map((t=>WN(t)))),s=GT(e),h=LT(e.program.data);return LT([r,i,n,o,a,s,h])}function KT(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,Tv(e.flatMap((t=>BigInt(WN(t))))))];var e}));return Tv(e)}function JT(t){const e=t.bytecode.map((t=>BigInt(t))),r=t.bytecode_segment_lengths??[];let i=0;const n=r.flatMap((t=>{const r=e.slice(i,i+=t);return[BigInt(t),Tv(r)]}));return 1n+Tv(n)}function WT(t){const e=BigInt(WN("COMPILED_CLASS_V1")),r=KT(t.entry_points_by_type.EXTERNAL),i=KT(t.entry_points_by_type.L1_HANDLER),n=KT(t.entry_points_by_type.CONSTRUCTOR),o=t.bytecode_segment_lengths?JT(t):Tv(t.bytecode.map((t=>BigInt(t))));return wN(Tv([e,r,i,n,o]))}function YT(t){return Tv(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function QT(t){const e=BigInt(WN("CONTRACT_CLASS_V0.1.0")),r=YT(t.entry_points_by_type.EXTERNAL),i=YT(t.entry_points_by_type.L1_HANDLER),n=YT(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=HT(LS(t.abi,null));return BigInt(rS(_v(Wx(e)).toString(16)))}(t),a=Tv(t.sierra_program.map((t=>BigInt(t))));return wN(Tv([e,r,i,n,o,a]))}function XT(t){const e=mN(t)?DS(t):t;return"sierra_program"in e?QT(e):ZT(e)}function tC(t){const e=mN(t)?t:LS(t);return Xx(b_(e))}function eC(t){if(Array.isArray(t))return t;const e=Jx(k_(Qx(t)));return DS(e)}function rC(){return fv(uv.randomPrivateKey())}function iC(t){return rS(t).toLowerCase()}function nC(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>wN(t)));try{const{r:e,s:r}=t;return[wN(e),wN(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function oC(t){return AN(nC(t))}function aC(t){return jN(nC(t))}function sC(t,e=50){return zN(t,e)}function hC(t,e=50,r=50){if(fN(t))return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:"0x0",max_price_per_unit:"0x0"}};if(lN(t.gas_consumed)||lN(t.gas_price))throw Error("estimateFeeToBounds: estimate is undefined");return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:void 0!==t.data_gas_consumed&&void 0!==t.data_gas_price?wN(zN(BigInt(t.overall_fee)/BigInt(t.gas_price),e)):wN(zN(t.gas_consumed,e)),max_price_per_unit:wN(zN(t.gas_price,r))}}}function uC(t){if(t===Cx.EDataAvailabilityMode.L1)return Cx.EDAMode.L1;if(t===Cx.EDataAvailabilityMode.L2)return Cx.EDAMode.L2;throw Error("EDAM conversion")}function lC(t,e){const r=e?wN(e):void 0,i=wN(t);if(e&&!Object.values(Cx.ETransactionVersion).includes(r))throw Error(`providedVersion ${e} is not ETransactionVersion`);if(!Object.values(Cx.ETransactionVersion).includes(i))throw Error(`defaultVersion ${t} is not ETransactionVersion`);return e?r:i}function cC(t){if(!t)return;const e=wN(t);if(e===Cx.ETransactionVersion.V0)return Cx.ETransactionVersion.F0;if(e===Cx.ETransactionVersion.V1)return Cx.ETransactionVersion.F1;if(e===Cx.ETransactionVersion.V2)return Cx.ETransactionVersion.F2;if(e===Cx.ETransactionVersion.V3)return Cx.ETransactionVersion.F3;throw Error(`toFeeVersion: ${e} is not supported`)}function dC(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||Cx.EDataAvailabilityMode.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||Cx.EDataAvailabilityMode.L1,resourceBounds:t.resourceBounds??hC(lS)}}function fC(t){return t===Cx.ETransactionVersion.F2?Cx.ETransactionVersion.F1:t===Cx.ETransactionVersion.V2?Cx.ETransactionVersion.V1:t}function mC(t){return rS(tS(rv(wN(t),!1)))}function pC(t){return"sierra_program"in(mN(t)?DS(t):t)}Ix({},{compressProgram:()=>tC,decompressProgram:()=>eC,estimateFeeToBounds:()=>hC,estimatedFeeToMaxFee:()=>sC,formatSignature:()=>nC,getFullPublicKey:()=>mC,intDAM:()=>uC,makeAddress:()=>iC,randomAddress:()=>rC,reduceV2:()=>fC,signatureToDecimalArray:()=>oC,signatureToHexArray:()=>aC,toFeeVersion:()=>cC,toTransactionVersion:()=>lC,v3Details:()=>dC});function gC(){return aS(tS(S_.utils.randomPrivateKey()))}function yC(t){EN(t,lS,2n**160n-1n,"Ethereum Address ");const e=rS(eS(wN(t)).padStart(40,"0"));return hN(Boolean(e.match(/^(0x)?[0-9a-f]{40}$/)),"Invalid Ethereum Address Format"),e}Ix({},{ethRandomPrivateKey:()=>gC,validateAndParseEthAddress:()=>yC});var wC=Kx&&window.fetch.bind(window)||!lN(t)&&Fj(t.fetch)||fx;Ix({},{Block:()=>xC,createSierraContractClass:()=>_C,getDefaultNodeUrl:()=>AC,isPendingBlock:()=>IC,isPendingStateUpdate:()=>CC,isPendingTransaction:()=>TC,isV3Tx:()=>SC,isVersion:()=>NC,parseContract:()=>EC,validBlockTags:()=>jC,wait:()=>MC});var vC=class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...OS}}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(t,e){return this.config[t]??e}set(t,e){this.config[t]=e}update(t){this.config={...this.config,...t}}getAll(){return{...this.config}}reset(){this.initialize()}delete(t){delete this.config[t]}hasKey(t){return t in this.config}}.getInstance(),bC={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},kC=class t{static instance;config;constructor(){this.config=vC}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTimestamp(){return(new Date).toISOString()}shouldLog(t){const e=this.config.get("logLevel","INFO");return t<=bC[e]}formatMessage(t){const{level:e,message:r,timestamp:i,data:n}=t;let o=`[${i}] ${e}: ${r}`;if(n)try{o+=`\n${JSON.stringify(n,null,2)}`}catch(t){o+=`\n[JSON.stringify Error/Circular]: ${t}`}return o}log(t,e,r){if(!this.shouldLog(bC[t]))return;const i={level:t,message:e,timestamp:this.getTimestamp(),data:r},n=this.formatMessage(i);switch(t){case"DEBUG":console.debug(n);break;case"INFO":console.info(n);break;case"WARN":console.warn(n);break;case"ERROR":case"FATAL":console.error(n);break;case"OFF":break;default:console.log(n)}}debug(t,e){this.log("DEBUG",t,e)}info(t,e){this.log("INFO",t,e)}warn(t,e){this.log("WARN",t,e)}error(t,e){this.log("ERROR",t,e)}fatal(t,e){this.log("FATAL",t,e)}setLogLevel(t){this.config.set("logLevel",t)}getLogLevel(){return this.config.get("logLevel","INFO")}getEnabledLogLevels(){return Object.keys(bC).filter((t=>this.shouldLog(bC[t])&&"OFF"!==t))}}.getInstance();function MC(t){return new Promise((e=>{setTimeout(e,t)}))}function _C(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=HT(LS(t.abi)),e.sierra_program=HT(LS(t.sierra_program)),e.sierra_program=tC(e.sierra_program),e}function EC(t){const e=mN(t)?DS(t):t;return pC(t)?_C(e):{...e,..."program"in e&&{program:tC(e.program)}}}var AC=(t,e=!1)=>{e||kC.info("Using default public node url, please provide nodeUrl in provider options!");const r=SS[t??"SN_SEPOLIA"];return r[Math.floor(Math.random()*r.length)]},jC=Object.values(QS),xC=class{hash=null;number=null;tag=null;setIdentifier(t){if(mN(t))if(HN(t))this.number=parseInt(t,10);else if(gN(t))this.hash=t;else{if(!jC.includes(t))throw TypeError(`Block identifier unmanaged: ${t}`);this.tag=t}else fN(t)?this.hash=wN(t):cN(t)?this.number=t:this.tag=QS.PENDING;if(cN(this.number)&&this.number<0)throw TypeError(`Block number (${this.number}) can't be negative`)}constructor(t){this.setIdentifier(t)}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}valueOf=()=>this.number;toString=()=>this.hash};function SC(t){const e=t.version?wN(t.version):Cx.ETransactionVersion.V3;return e===Cx.ETransactionVersion.V3||e===Cx.ETransactionVersion.F3}function NC(t,e){const[r,i]=t.split("."),[n,o]=e.split(".");return r===n&&i===o}function IC(t){return"PENDING"===t.status}function TC(t){return!("block_hash"in t)}function CC(t){return!("block_hash"in t)}var zC={};Ix(zC,{buildUDCCall:()=>LC,fromCallsToExecuteCalldata:()=>RC,fromCallsToExecuteCalldataWithNonce:()=>PC,fromCallsToExecuteCalldata_cairo1:()=>DC,getExecuteCalldata:()=>$C,getVersionsByType:()=>UC,transformCallsToMulticallArrays:()=>OC,transformCallsToMulticallArrays_cairo1:()=>BC});var OC=t=>{const e=[],r=[];return t.forEach((t=>{const i=mT.compile(t.calldata||[]);e.push({to:yN(t.contractAddress).toString(10),selector:yN(DN(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:i.length.toString()}),r.push(...i)})),{callArray:e,calldata:mT.compile({calldata:r})}},RC=t=>{const{callArray:e,calldata:r}=OC(t);return[...mT.compile({callArray:e}),...r]},PC=(t,e)=>[...RC(t),yN(e).toString()],BC=t=>{const e=t.map((t=>({to:yN(t.contractAddress).toString(10),selector:yN(DN(t.entrypoint)).toString(10),calldata:mT.compile(t.calldata||[])})));return e},DC=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:mT.compile(t.calldata)})));return mT.compile({orderCalls:e})},$C=(t,e="0")=>"1"===e?DC(t):RC(t);function LC(t,e){const r=[].concat(t).map((t=>{const{classHash:r,salt:i,unique:n=!0,constructorCalldata:o=[]}=t,a=mT.compile(o),s=i??rC();return{call:{contractAddress:jS.ADDRESS,entrypoint:jS.ENTRYPOINT,calldata:[r,s,TN(n),a.length,...a]},address:qT(n?kv(e,s):s,r,a,n?jS.ADDRESS:0)}}));return{calls:r.map((t=>t.call)),addresses:r.map((t=>t.address))}}function UC(t){return"fee"===t?{v1:Cx.ETransactionVersion.F1,v2:Cx.ETransactionVersion.F2,v3:Cx.ETransactionVersion.F3}:{v1:Cx.ETransactionVersion.V1,v2:Cx.ETransactionVersion.V2,v3:Cx.ETransactionVersion.V3}}var FC={headers:{"Content-Type":"application/json"},blockIdentifier:QS.PENDING,retries:200},qC=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(MS).includes(a)?this.nodeUrl=AC(a,t?.default):this.nodeUrl=a||AC(void 0,t?.default),this.baseFetch=e??wC,this.blockIdentifier=i??FC.blockIdentifier,this.chainId=n,this.headers={...FC.headers,...o},this.retries=s??FC.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new sN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:LS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new HS(r,t,e);if(i instanceof VS)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new xC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=wN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new xC(r).identifier,a=[];return i&&a.push(Ox.ESimulationFlag.SKIP_VALIDATE),n&&a.push(Ox.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=wN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Ox.ETransactionStatus.REJECTED],h=e?.successStates??[Ox.ETransactionExecutionStatus.SUCCEEDED,Ox.ETransactionStatus.ACCEPTED_ON_L2,Ox.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!n;){await MC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await MC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=wN(t),n=bN(e),o=new xC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new xC(e).identifier;let n={};return NC("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Ox.ESimulationFlag.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return SC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Ox.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:Ox.ETransactionVersion.V3,signature:aC(t.signature),nonce:wN(e.nonce),resource_bounds:e.resourceBounds,tip:wN(e.tip),paymaster_data:e.paymasterData.map((t=>wN(t))),account_deployment_data:e.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),type:Ox.ETransactionType.INVOKE,max_fee:wN(e.maxFee||0),version:Ox.ETransactionVersion.V1,signature:aC(t.signature),nonce:wN(e.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V1,type:Ox.ETransactionType.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(pC(t)||SC(n))if(pC(t)&&!SC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ox.ETransactionType.DECLARE,contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:Ox.ETransactionVersion.V2,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V2,type:Ox.ETransactionType.DECLARE});else{if(!pC(t)||!SC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ox.ETransactionType.DECLARE,sender_address:r,compiled_class_hash:i||"",version:Ox.ETransactionVersion.V3,signature:aC(e),nonce:wN(n.nonce),contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),account_deployment_data:n.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ox.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:Ox.ETransactionVersion.V1,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V1,type:Ox.ETransactionType.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return SC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Ox.ETransactionType.DEPLOY_ACCOUNT,version:Ox.ETransactionVersion.V3,signature:aC(i),nonce:wN(n.nonce),contract_address_salt:wN(r||0),constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),contract_address_salt:wN(r||0),type:Ox.ETransactionType.DEPLOY_ACCOUNT,max_fee:wN(n.maxFee||0),version:Ox.ETransactionVersion.V1,signature:aC(i),nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Ox.ETransactionVersion.V1,type:Ox.ETransactionType.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new xC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:DN(t.entrypoint),calldata:mT.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:yC(r),to_address:wN(i),entry_point_selector:$N(n),payload:IN(o)},s=new xC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=UC(e);let i;if(SC(t)?i={signature:aC(t.signature),nonce:wN(t.nonce),resource_bounds:t.resourceBounds,tip:wN(t.tip),paymaster_data:t.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>wN(t)))}:(i={signature:aC(t.signature),nonce:wN(t.nonce),max_fee:wN(t.maxFee||0)},kC.warn(RS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===ZS.INVOKE)return{type:Ox.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:wN(t.version||r.v3),...i};if(t.type===ZS.DECLARE)return pC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:eC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:wN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:wN(t.version||r.v1),...i};if(t.type===ZS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:mT.toHex(t.constructorCalldata||[]),class_hash:wN(t.classHash),contract_address_salt:wN(t.addressSalt||0),version:wN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}};Ix({},{RpcChannel:()=>HC});var VC={headers:{"Content-Type":"application/json"},blockIdentifier:QS.PENDING,retries:200},HC=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(MS).includes(a)?this.nodeUrl=AC(a,t?.default):this.nodeUrl=a||AC(void 0,t?.default),this.baseFetch=e??wC,this.blockIdentifier=i??VC.blockIdentifier,this.chainId=n,this.headers={...VC.headers,...o},this.retries=s??VC.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new sN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:LS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new HS(r,t,e);if(i instanceof VS)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new xC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new xC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=wN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=wN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new xC(r).identifier,a=[];return i&&a.push(Nm.SKIP_VALIDATE),n&&a.push(Nm.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=wN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Im.REJECTED],h=e?.successStates??[Cm.SUCCEEDED,Im.ACCEPTED_ON_L2,Im.ACCEPTED_ON_L1];let u;for(;!n;){await MC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await MC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=wN(t),n=bN(e),o=new xC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=wN(t),i=new xC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new xC(e).identifier;let n={};return NC("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Nm.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return SC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:Pm.V3,signature:aC(t.signature),nonce:wN(e.nonce),resource_bounds:e.resourceBounds,tip:wN(e.tip),paymaster_data:e.paymasterData.map((t=>wN(t))),account_deployment_data:e.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),type:Sm.INVOKE,max_fee:wN(e.maxFee||0),version:Pm.V1,signature:aC(t.signature),nonce:wN(e.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V1,type:Sm.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(pC(t)||SC(n))if(pC(t)&&!SC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:Pm.V2,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V2,type:Sm.DECLARE});else{if(!pC(t)||!SC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,sender_address:r,compiled_class_hash:i||"",version:Pm.V3,signature:aC(e),nonce:wN(n.nonce),contract_class:{sierra_program:eC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),account_deployment_data:n.accountDeploymentData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:Pm.V1,max_fee:wN(n.maxFee||0),signature:aC(e),sender_address:r,nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V1,type:Sm.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return SC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Sm.DEPLOY_ACCOUNT,version:Pm.V3,signature:aC(i),nonce:wN(n.nonce),contract_address_salt:wN(r||0),constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),resource_bounds:n.resourceBounds,tip:wN(n.tip),paymaster_data:n.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:mT.toHex(e||[]),class_hash:wN(t),contract_address_salt:wN(r||0),type:Sm.DEPLOY_ACCOUNT,max_fee:wN(n.maxFee||0),version:Pm.V1,signature:aC(i),nonce:wN(n.nonce)}}),kC.warn(RS.legacyTxWarningMessage,{version:Pm.V1,type:Sm.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new xC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:DN(t.entrypoint),calldata:mT.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:yC(r),to_address:wN(i),entry_point_selector:$N(n),payload:IN(o)},s=new xC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=UC(e);let i;if(SC(t)?i={signature:aC(t.signature),nonce:wN(t.nonce),resource_bounds:t.resourceBounds,tip:wN(t.tip),paymaster_data:t.paymasterData.map((t=>wN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>wN(t)))}:(i={signature:aC(t.signature),nonce:wN(t.nonce),max_fee:wN(t.maxFee||0)},kC.warn(RS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===ZS.INVOKE)return{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:mT.toHex(t.calldata),version:wN(t.version||r.v3),...i};if(t.type===ZS.DECLARE)return pC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:eC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:wN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:wN(t.version||r.v1),...i};if(t.type===ZS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:mT.toHex(t.constructorCalldata||[]),class_hash:wN(t.classHash),contract_address_salt:wN(t.addressSalt||0),version:wN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}},GC=class{margin;constructor(t){this.margin=t}estimatedFeeToMaxFee(t){return sC(t,this.margin?.maxFee)}estimateFeeToBounds(t){return hC(t,this.margin?.l1BoundMaxAmount,this.margin?.l1BoundMaxPricePerUnit)}parseGetBlockResponse(t){return{status:"PENDING",...t}}parseTransactionReceipt(t){return"actual_fee"in t&&mN(t.actual_fee)?{...t,actual_fee:{amount:t.actual_fee,unit:"FRI"}}:t}parseFeeEstimateResponse(t){const e=t[0];return{overall_fee:yN(e.overall_fee),gas_consumed:yN(e.gas_consumed),gas_price:yN(e.gas_price),unit:e.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(e.overall_fee),resourceBounds:this.estimateFeeToBounds(e),data_gas_consumed:e.data_gas_consumed?yN(e.data_gas_consumed):0n,data_gas_price:e.data_gas_price?yN(e.data_gas_price):0n}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:yN(t.overall_fee),gas_consumed:yN(t.gas_consumed),gas_price:yN(t.gas_price),unit:t.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(t.overall_fee),resourceBounds:this.estimateFeeToBounds(t),data_gas_consumed:t.data_gas_consumed?yN(t.data_gas_consumed):0n,data_gas_price:t.data_gas_price?yN(t.data_gas_price):0n})))}parseSimulateTransactionResponse(t){return t.map((t=>({...t,suggestedMaxFee:this.estimatedFeeToMaxFee(t.fee_estimation.overall_fee),resourceBounds:this.estimateFeeToBounds(t.fee_estimation)})))}parseContractClassResponse(t){return{...t,abi:mN(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}},ZC=class t{statusReceipt;value;constructor(e){[this.statusReceipt,this.value]=t.isSuccess(e)?["success",e]:t.isReverted(e)?["reverted",e]:t.isRejected(e)?["rejected",e]:["error",new Error("Unknown response type")];for(const[t]of Object.entries(this))Object.defineProperty(this,t,{enumerable:!1});for(const[t,r]of Object.entries(e))Object.defineProperty(this,t,{enumerable:!0,writable:!1,value:r})}match(t){return this.statusReceipt in t?t[this.statusReceipt](this.value):t._()}isSuccess(){return"success"===this.statusReceipt}isReverted(){return"reverted"===this.statusReceipt}isRejected(){return"rejected"===this.statusReceipt}isError(){return"error"===this.statusReceipt}static isSuccess(t){return t.execution_status===WS.SUCCEEDED}static isReverted(t){return t.execution_status===WS.REVERTED}static isRejected(t){return t.status===WS.REJECTED}},KC={};Ix(KC,{TypedDataRevision:()=>Um,encodeData:()=>uz,encodeType:()=>az,encodeValue:()=>hz,getDependencies:()=>oz,getMessageHash:()=>cz,getStructHash:()=>lz,getTypeHash:()=>sz,isMerkleTreeType:()=>nz,prepareSelector:()=>iz,validateTypedData:()=>rz,verifyMessage:()=>dz});Ix({},{MerkleTree:()=>JC,proofMerklePath:()=>WC});var JC=class t{leaves;branches=[];root;hashMethod;constructor(t,e=DT){this.hashMethod=e,this.leaves=t,this.root=this.build(t)}build(e){if(1===e.length)return e[0];e.length!==this.leaves.length&&this.branches.push(e);const r=[];for(let i=0;i<e.length;i+=2)i+1===e.length?r.push(t.hash(e[i],"0x0",this.hashMethod)):r.push(t.hash(e[i],e[i+1],this.hashMethod));return this.build(r)}static hash(t,e,r=DT){const[i,n]=[BigInt(t),BigInt(e)].sort(((t,e)=>t>=e?1:-1));return r(i,n)}getProof(e,r=this.leaves,i=[]){const n=r.indexOf(e);if(-1===n)throw new Error("leaf not found");if(1===r.length)return i;const o=n%2==0,a=(o?r[n+1]:r[n-1])??"0x0",s=[...i,a],h=this.leaves.length===r.length?-1:this.branches.findIndex((t=>t.length===r.length)),u=this.branches[h+1]??[this.root];return this.getProof(t.hash(o?e:a,o?a:e,this.hashMethod),u,s)}};function WC(t,e,r,i=DT){if(0===r.length)return t===e;const[n,...o]=r;return WC(t,JC.hash(e,n,i),o,i)}var YC={u256:JSON.parse('[{ "name": "low", "type": "u128" }, { "name": "high", "type": "u128" }]'),TokenAmount:JSON.parse('[{ "name": "token_address", "type": "ContractAddress" }, { "name": "amount", "type": "u256" }]'),NftId:JSON.parse('[{ "name": "collection_address", "type": "ContractAddress" }, { "name": "token_id", "type": "u256" }]')},QC={[Um.ACTIVE]:{domain:"StarknetDomain",hashMethod:FT,hashMerkleMethod:$T,escapeTypeString:t=>`"${t}"`,presetTypes:YC},[Um.LEGACY]:{domain:"StarkNetDomain",hashMethod:UT,hashMerkleMethod:DT,escapeTypeString:t=>t,presetTypes:{}}};function XC(t,e,{min:r,max:i}){const n=BigInt(t);hN(n>=r&&n<=i,`${n} (${e}) is out of bounds [${r}, ${i}]`)}function tz({types:t,domain:e}){return QC[Um.ACTIVE].domain in t&&e.revision===Um.ACTIVE?Um.ACTIVE:QC[Um.LEGACY].domain in t&&(e.revision??Um.LEGACY)===Um.LEGACY?Um.LEGACY:void 0}function ez(t){try{return wN(t)}catch(e){if(mN(t))return wN(WN(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function rz(t){const e=t;return Boolean(e.message&&e.primaryType&&e.types&&tz(e))}function iz(t){return gN(t)?t:DN(t)}function nz(t){return"merkletree"===t.type}function oz(t,e,r=[],i="",n=Um.LEGACY){let o=[e];return"*"===e[e.length-1]?o=[e.slice(0,-1)]:n===Um.ACTIVE&&("enum"===e?o=[i]:e.match(/^\(.*\)$/)&&(o=e.slice(1,-1).split(",").map((t=>"*"===t[t.length-1]?t.slice(0,-1):t)))),o.filter((e=>!r.includes(e)&&t[e])).reduce(((e,r)=>[...e,...[r,...t[r].reduce(((e,r)=>[...e,...oz(t,r.type,e,r.contains,n).filter((t=>!e.includes(t)))]),[])].filter((t=>!e.includes(t)))]),[])}function az(t,e,r=Um.LEGACY){const i=r===Um.ACTIVE?{...t,...QC[r].presetTypes}:t,[n,...o]=oz(i,e,void 0,void 0,r),a=n?[n,...o.sort()]:[],s=QC[r].escapeTypeString;return a.map((t=>{const e=i[t].map((t=>{const e="enum"===t.type&&r===Um.ACTIVE?t.contains:t.type,i=e.match(/^\(.*\)$/)?`(${e.slice(1,-1).split(",").map((t=>t?s(t):t)).join(",")})`:s(e);return`${s(t.name)}:${i}`}));return`${s(t)}(${e})`})).join("")}function sz(t,e,r=Um.LEGACY){return DN(az(t,e,r))}function hz(t,e,r,i={},n=Um.LEGACY){if(t[e])return[e,lz(t,e,r,n)];if(QC[n].presetTypes[e])return[e,lz(QC[n].presetTypes,e,r,n)];if(e.endsWith("*")){const i=r.map((r=>hz(t,e.slice(0,-1),r,void 0,n)[1]));return[e,QC[n].hashMethod(i)]}switch(e){case"enum":if(n===Um.ACTIVE){const[o,a]=Object.entries(r)[0],s=t[i.parent].find((t=>t.name===i.key)),h=t[s.contains],u=h.find((t=>t.name===o)),l=h.indexOf(u),c=u.type.slice(1,-1).split(",").map(((e,r)=>{if(!e)return e;const i=a[r];return hz(t,e,i,void 0,n)[1]}));return[e,QC[n].hashMethod([l,...c])]}return[e,ez(r)];case"merkletree":{const e=function(t,e){if(e.parent&&e.key){const r=t[e.parent].find((t=>t.name===e.key));if(!nz(r))throw new Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,i),o=r.map((r=>hz(t,e,r,void 0,n)[1])),{root:a}=new JC(o,QC[n].hashMerkleMethod);return["felt",a]}case"selector":return["felt",iz(r)];case"string":if(n===Um.ACTIVE){const t=XN(r),i=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,QC[n].hashMethod(i)]}return[e,ez(r)];case"i128":if(n===Um.ACTIVE){const t=BigInt(r);return XC(t,e,vS),[e,ez(t<0n?mS+t:t)]}return[e,ez(r)];case"timestamp":case"u128":return n===Um.ACTIVE&&XC(r,e,bS),[e,ez(r)];case"felt":case"shortstring":return n===Um.ACTIVE&&XC(ez(r),e,wS),[e,ez(r)];case"ClassHash":case"ContractAddress":return n===Um.ACTIVE&&XC(r,e,wS),[e,ez(r)];case"bool":return n===Um.ACTIVE&&hN(dN(r),`Type mismatch for ${e} ${r}`),[e,ez(r)];default:if(n===Um.ACTIVE)throw new Error(`Unsupported type: ${e}`);return[e,ez(r)]}}function uz(t,e,r,i=Um.LEGACY){const n=t[e]??QC[i].presetTypes[e],[o,a]=n.reduce((([n,o],a)=>{if(void 0===r[a.name]||null===r[a.name]&&"enum"!==a.type)throw new Error(`Cannot encode data: missing data for '${a.name}'`);const s=r[a.name],h={parent:e,key:a.name},[u,l]=hz(t,a.type,s,h,i);return[[...n,u],[...o,l]]}),[["felt"],[sz(t,e,i)]]);return[o,a]}function lz(t,e,r,i=Um.LEGACY){return QC[i].hashMethod(uz(t,e,r,i)[1])}function cz(t,e){if(!rz(t))throw new Error("Typed data does not match JSON schema");const r=tz(t),{domain:i,hashMethod:n}=QC[r];return n([WN("StarkNet Message"),lz(t.types,i,t.domain,r),e,lz(t.types,t.primaryType,t.message,r)])}function dz(t,e,r,i){const n=rz(t);if(!RN(t)&&!n)throw new Error("message has a wrong format.");if(n&&void 0===i)throw new Error("When providing a TypedData in message parameter, the accountAddress parameter has to be provided.");if(n&&!RN(i))throw new Error("accountAddress shall be a BigNumberish");const o=n?cz(t,i):wN(t);return ov(Array.isArray(e)?new hv(BigInt(e[0]),BigInt(e[1])):e,o,wN(r))}var fz=class{responseParser;channel;constructor(t){t&&"channel"in t?(this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new GC):(this.channel=new HC({...t,waitMode:!1}),this.responseParser=new GC(t?.feeMarginPercentage))}fetch(t,e,r=0){return this.channel.fetch(t,e,r)}async getChainId(){return this.channel.getChainId()}async getSpecVersion(){return this.channel.getSpecVersion()}async getNonceForAddress(t,e){return this.channel.getNonceForAddress(t,e)}async getBlock(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.channel.getBlockLatestAccepted()}async getBlockNumber(){return this.channel.getBlockNumber()}async getBlockWithTxHashes(t){return this.channel.getBlockWithTxHashes(t)}async getBlockWithTxs(t){return this.channel.getBlockWithTxs(t)}async waitForBlock(t="pending",e=5e3){if(t===QS.LATEST)return;const r=await this.getBlockNumber(),i=t===QS.PENDING?r+1:Number(wN(t));if(i<=r)return;const{retries:n}=this.channel;let o=n,a=!1;for(;!a;){if(await this.getBlockNumber()===i?a=!0:await MC(e),o-=1,o<=0)throw new Error(`waitForBlock() timed-out after ${n} tries.`)}}async getL1GasPrice(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseL1GasPriceResponse)}async getL1MessageHash(t){const e=await this.channel.getTransactionByHash(t);hN("L1_HANDLER"===e.type,"This L2 transaction is not a L1 message.");const{calldata:r,contract_address:i,entry_point_selector:n,nonce:o}=e;return LN([r[0],i,o,n,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){if(this.channel instanceof PS.RpcChannel)throw new VS("Unsupported method for RPC version");return this.channel.getBlockWithReceipts(t)}getStateUpdate=this.getBlockStateUpdate;async getBlockStateUpdate(t){return this.channel.getBlockStateUpdate(t)}async getBlockTransactionsTraces(t){return this.channel.getBlockTransactionsTraces(t)}async getBlockTransactionCount(t){return this.channel.getBlockTransactionCount(t)}async getPendingTransactions(){const{transactions:t}=await this.getBlockWithTxHashes(QS.PENDING).then(this.responseParser.parseGetBlockResponse);return Promise.all(t.map((t=>this.getTransactionByHash(t))))}async getTransaction(t){return this.channel.getTransactionByHash(t)}async getTransactionByHash(t){return this.channel.getTransactionByHash(t)}async getTransactionByBlockIdAndIndex(t,e){return this.channel.getTransactionByBlockIdAndIndex(t,e)}async getTransactionReceipt(t){const e=await this.channel.getTransactionReceipt(t),r=this.responseParser.parseTransactionReceipt(e);return new ZC(r)}async getTransactionTrace(t){return this.channel.getTransactionTrace(t)}async getTransactionStatus(t){return this.channel.getTransactionStatus(t)}async getSimulateTransaction(t,e){return this.channel.simulateTransaction(t,e).then((t=>this.responseParser.parseSimulateTransactionResponse(t)))}async waitForTransaction(t,e){const r=await this.channel.waitForTransaction(t,e);return new ZC(r)}async getStorageAt(t,e,r){return this.channel.getStorageAt(t,e,r)}async getClassHashAt(t,e){return this.channel.getClassHashAt(t,e)}async getClassByHash(t){return this.getClass(t)}async getClass(t,e){return this.channel.getClass(t,e).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e){return this.channel.getClassAt(t,e).then(this.responseParser.parseContractClassResponse)}async getContractVersion(t,e,{blockIdentifier:r=this.channel.blockIdentifier,compiler:i=!0}={}){let n;if(t)n=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");n=await this.getClass(e,r)}if(pC(n)){if(i){return{cairo:"1",compiler:PI(n.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async getEstimateFee(t,e,r,i){return this.getInvokeEstimateFee(t,e,r,i)}async getInvokeEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:ZS.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeclareEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:ZS.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeployAccountEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:ZS.DEPLOY_ACCOUNT,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getEstimateFeeBulk(t,e){return this.channel.getEstimateFee(t,e).then((t=>this.responseParser.parseFeeEstimateBulkResponse(t)))}async invokeFunction(t,e){return this.channel.invoke(t,e)}async declareContract(t,e){return this.channel.declare(t,e)}async deployAccountContract(t,e){return this.channel.deployAccount(t,e)}async callContract(t,e){return this.channel.callContract(t,e)}async estimateMessageFee(t,e){return this.channel.estimateMessageFee(t,e)}async getSyncingStats(){return this.channel.getSyncingStats()}async getEvents(t){return this.channel.getEvents(t)}async verifyMessageInStarknet(t,e,r,i,n){const o=rz(t);if(!RN(t)&&!o)throw new Error("message has a wrong format.");if(!RN(r))throw new Error("accountAddress shall be a BigNumberish");const a=o?cz(t,r):wN(t),s=i?[i]:["isValidSignature","is_valid_signature"],h=n||{okResponse:[],nokResponse:["0x0","0x00"],error:["argent/invalid-signature","is invalid, with respect to the public key","INVALID_SIG"]};let u;for(const t of s)try{const i=await this.callContract({contractAddress:wN(r),entrypoint:t,calldata:mT.compile({hash:yN(a).toString(),signature:nC(e)})});if(h.nokResponse.includes(i[0].toString()))return!1;if(0===h.okResponse.length||h.okResponse.includes(i[0].toString()))return!0;throw Error("signatureVerificationResponse Error: response is not part of known responses")}catch(t){if(h.error.some((e=>t.message.includes(e))))return!1;u=t}throw Error(`Signature verification Error: ${u}`)}async isClassDeclared(t,e){let r;if(!t.classHash&&"contract"in t){r=function(t){const e={...t};if(pC(t.contract)&&(!t.compiledClassHash&&t.casm&&(e.compiledClassHash=WT(t.casm)),!e.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(e.classHash=t.classHash??XT(t.contract),!e.classHash)throw new Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return e}(t).classHash}else{if(!t.classHash)throw Error("contractClassIdentifier type not satisfied");r=t.classHash}try{return await this.getClass(r,e)instanceof Object}catch(t){if(t instanceof VS)return!1;throw t}}async prepareInvocations(t){const e=[];for(const r of t)if(r.type===ZS.DECLARE){await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r)}else e.push(r);return e}};Ix({},{StarknetIdContract:()=>_z,StarknetIdIdentityContract:()=>Az,StarknetIdMulticallContract:()=>xz,StarknetIdPfpContract:()=>Tz,StarknetIdPopContract:()=>zz,StarknetIdVerifierContract:()=>Nz,dynamicCallData:()=>Bz,dynamicFelt:()=>Pz,execution:()=>Rz,getStarknetIdContract:()=>Ez,getStarknetIdIdentityContract:()=>jz,getStarknetIdMulticallContract:()=>Sz,getStarknetIdPfpContract:()=>Cz,getStarknetIdPopContract:()=>Oz,getStarknetIdVerifierContract:()=>Iz,isStarkDomain:()=>Dz,useDecoded:()=>kz,useEncoded:()=>Mz});var mz="abcdefghijklmnopqrstuvwxyz0123456789-",pz=BigInt(mz.length+1),gz="这来",yz=BigInt(mz.length),wz=BigInt(gz.length),vz=BigInt(gz.length+1);function bz(t){let e=0;for(;t.endsWith(gz[gz.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function kz(t){let e="";return t.forEach((t=>{for(;t!==lS;){const r=t%pz;if(t/=pz,r===BigInt(mz.length)){const r=t/vz;if(r===lS){const i=t%vz;t=r,e+=i===lS?mz[0]:gz[Number(i)-1]}else{e+=gz[Number(t%wz)],t/=wz}}else e+=mz[Number(r)]}const[r,i]=bz(e);i&&(e=r+(i%2==0?gz[gz.length-1].repeat(i/2-1)+gz[0]+mz[1]:gz[gz.length-1].repeat((i-1)/2+1))),e+="."})),e?e.concat("stark"):e}function Mz(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(gz[0]+mz[1])){const[e,r]=bz(t.substring(0,t.length-2));t=e+gz[gz.length-1].repeat(2*(r+1))}else{const[e,r]=bz(t);r&&(t=e+gz[gz.length-1].repeat(1+2*(r-1)))}for(let i=0;i<t.length;i+=1){const n=t[i],o=mz.indexOf(n),a=BigInt(mz.indexOf(n));if(-1!==o)i===t.length-1&&t[i]===mz[0]?(e+=r*yz,r*=pz,r*=pz):(e+=r*a,r*=pz);else if(-1!==gz.indexOf(n)){e+=r*yz,r*=pz;const o=(i===t.length-1?1:0)+gz.indexOf(n);e+=r*BigInt(o),r*=wz}}return e}var _z={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function Ez(t){switch(t){case"0x534e5f4d41494e":return _z.MAINNET;case"0x534e5f5345504f4c4941":return _z.TESTNET_SEPOLIA;default:throw new Error("Starknet.id is not yet deployed on this network")}}var Az={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function jz(t){switch(t){case"0x534e5f4d41494e":return Az.MAINNET;case"0x534e5f5345504f4c4941":return Az.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var xz="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function Sz(t){switch(t){case"0x534e5f4d41494e":case"0x534e5f5345504f4c4941":return xz;default:throw new Error("Starknet.id multicall contract is not yet deployed on this network")}}var Nz={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function Iz(t){switch(t){case"0x534e5f4d41494e":return Nz.MAINNET;case"0x534e5f5345504f4c4941":return Nz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var Tz={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function Cz(t){switch(t){case"0x534e5f4d41494e":return Tz.MAINNET;case"0x534e5f5345504f4c4941":return Tz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var zz={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function Oz(t){switch(t){case"0x534e5f4d41494e":return zz.MAINNET;case"0x534e5f5345504f4c4941":return zz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function Rz(t,e,r){return new UI({Static:t,IfEqual:e?$I(e[0],e[1],e[2]):void 0,IfNotEqual:r?$I(r[0],r[1],r[2]):void 0})}function Pz(t,e){return new UI({Hardcoded:t,Reference:e?$I(e[0],e[1]):void 0})}function Bz(t,e,r){return new UI({Hardcoded:t,Reference:e?$I(e[0],e[1]):void 0,ArrayReference:r?$I(r[0],r[1]):void 0})}function Dz(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var $z=class extends(Ex(fz,class t{async getStarkName(e,r){return t.getStarkName(this,e,r)}async getAddressFromStarkName(e,r){return t.getAddressFromStarkName(this,e,r)}async getStarkProfile(e,r,i,n,o,a,s){return t.getStarkProfile(this,e,r,i,n,o,a,s)}static async getStarkName(t,e,r){const i=await t.getChainId(),n=r??Ez(i);try{const r=await t.callContract({contractAddress:n,entrypoint:"address_to_domain",calldata:mT.compile({address:e,hint:[]})}),i=kz(r.map((t=>BigInt(t))).slice(1));if(!i)throw Error("Starkname not found");return i}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}static async getAddressFromStarkName(t,e,r){const i=e.endsWith(".stark")?e:`${e}.stark`;if(!Dz(i))throw new Error("Invalid domain, must be a valid .stark domain");const n=await t.getChainId(),o=r??Ez(n);try{const e=i.replace(".stark","").split(".").map((t=>Mz(t).toString(10)));return(await t.callContract({contractAddress:o,entrypoint:"domain_to_address",calldata:mT.compile({domain:e,hint:[]})}))[0]}catch{throw Error("Could not get address from stark name")}}static async getStarkProfile(t,e,r,i,n,o,a,s){const h=await t.getChainId(),u=r??Ez(h),l=i??jz(h),c=n??Iz(h),d=o??Cz(h),f=a??Oz(h),m=s??Sz(h);try{const r=[{execution:Rz({}),to:Bz(u),selector:Bz(DN("address_to_domain")),calldata:[Bz(e),Bz("0")]},{execution:Rz({}),to:Pz(u),selector:Pz(DN("domain_to_id")),calldata:[Bz(void 0,void 0,[0,0])]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("twitter")),Bz(c),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("github")),Bz(c),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("discord")),Bz(c),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("proof_of_personhood")),Bz(f),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("nft_pp_contract")),Bz(d),Bz("0")]},{execution:Rz({}),to:Pz(l),selector:Pz(DN("get_extended_verifier_data")),calldata:[Bz(void 0,[1,0]),Bz(WN("nft_pp_id")),Bz("2"),Bz(d),Bz("0")]},{execution:Rz(void 0,void 0,[6,0,0]),to:Pz(void 0,[6,0]),selector:Pz(DN("tokenURI")),calldata:[Bz(void 0,[7,1]),Bz(void 0,[7,2])]}],i=await t.callContract({contractAddress:m,entrypoint:"aggregate",calldata:mT.compile({calls:r})});if(Array.isArray(i)){const t=parseInt(i[0],16),e=[];let r=1;for(let n=0;n<t&&r<i.length;n+=1){const t=parseInt(i[r],16);r+=1;const n=i.slice(r,r+t);e.push(n),r+=t}const n=kz(e[0].slice(1).map((t=>BigInt(t)))),o="0x0"!==e[2][0]?BigInt(e[2][0]).toString():void 0,a="0x0"!==e[3][0]?BigInt(e[3][0]).toString():void 0,s="0x0"!==e[4][0]?BigInt(e[4][0]).toString():void 0,h="0x1"===e[5][0],u="0x9"===i[0]?e[8].slice(1).map((t=>YN(t))).join(""):void 0;return{name:n,twitter:o,github:a,discord:s,proofOfPersonhood:h,profilePicture:u||`https://starknet.id/api/identicons/${BigInt(e[1][0]).toString()}`}}throw Error("Error while calling aggregate function")}catch(t){if(t instanceof Error)throw t;throw Error("Could not get user stark profile data from address")}}})){},Lz=(new fz({default:!0}),{});function Uz(t){return new hI(t).toBigInt()}function Fz(t){return hI.is(t)}function qz(t){return new hI(t).toUint256HexString()}function Vz(t){const e=function(t){const e=wN(rS(t.toString()));return rS(eS(e).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return EN(e,lS,gS-1n,"Starknet Address"),e}Ix(Lz,{UINT_128_MAX:()=>eI,UINT_256_MAX:()=>rI,bnToUint256:()=>qz,isUint256:()=>Fz,uint256ToBN:()=>Uz});function Hz(t){return"event"===t.type}function Gz(t){const e=t.filter((t=>Hz(t)&&"struct"===t.kind)),r=t.filter((t=>Hz(t)&&"enum"===t.kind)),i=e.reduce(((t,e)=>{let i=[],{name:n}=e,o=!1;const a=t=>t.type===n;for(;;){const t=r.find((t=>t.variants.some(a)));if(lN(t))break;const e=t.variants.find(a);i.unshift(e.name),"flat"===e.kind&&(o=!0),n=t.name}if(0===i.length)throw new Error("inconsistency in ABI events definition.");o&&(i=[i[i.length-1]]);const s=i.pop();let h={[rS(_v(Wx(s)).toString(16))]:e};for(;i.length>0;)h={[rS(_v(Wx(i.pop())).toString(16))]:h};return h={...h},Kz(t,h)}),{});return i}function Zz(t){return OI(t)?Gz(t):function(t){return t.filter((t=>"event"===t.type)).reduce(((t,e)=>{const r=e.name,i={...e};return i.name=r,{...t,[rS(_v(Wx(r)).toString(16))]:i}}),{})}(t)}function Kz(t,e){const r={...t};return pN(t)&&pN(e)&&Object.keys(e).forEach((i=>{pN(e[i])?i in t?r[i]=Kz(t[i],e[i]):Object.assign(r,{[i]:e[i]}):Object.assign(r,{[i]:e[i]})})),r}function Jz(t,e,r,i){const n=t.flat().reduce(((t,n)=>{let o=e[n.keys.shift()??0];if(!o)return t;for(;!o.name;){const t=n.keys.shift();hN(!!t,'Not enough data in "keys" property of this event.'),o=o[t]}const a={};a[o.name]={};const s=n.keys[Symbol.iterator](),h=n.data[Symbol.iterator](),u=o.members?.filter((t=>"key"===t.kind))||o.keys,l=o.members?.filter((t=>"data"===t.kind))||o.data;return u.forEach((t=>{a[o.name][t.name]=oT(s,t,r,i,a[o.name])})),l.forEach((t=>{a[o.name][t.name]=oT(h,t,r,i,a[o.name])})),"block_hash"in n&&(a.block_hash=n.block_hash),"block_number"in n&&(a.block_number=n.block_number),"transaction_hash"in n&&(a.transaction_hash=n.transaction_hash),t.push(a),t}),[]);return n}function Wz(t){if(!t.events?.length)throw new Error("UDC emitted event is empty");const e=t.events.find((t=>_N(t.from_address)===_N(jS.ADDRESS)))||{data:[]};return{transaction_hash:t.transaction_hash,contract_address:e.data[0],address:e.data[0],deployer:e.data[1],unique:e.data[2],classHash:e.data[3],calldata_len:e.data[4],calldata:e.data.slice(5,5+parseInt(e.data[4],16)),salt:e.data[e.data.length-1]}}Ix({},{getAbiEvents:()=>Zz,isAbiEvent:()=>Hz,parseEvents:()=>Jz,parseUDCEvent:()=>Wz});function Yz(t){const e=t.calldata??[],r=Array.isArray(e)?e:mT.compile(e);return{to:t.contractAddress,selector:DN(t.entrypoint),calldata:r}}function Qz(t,e){const r=Yz(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function Xz(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function tO(t,e,r,i,n){return"1"===n?{types:nN,primaryType:"OutsideExecution",domain:Xz(t,n),message:{...e,nonce:r,calls_len:i.length,calls:i.map((t=>Qz(t,n)))}}:{types:oN,primaryType:"OutsideExecution",domain:Xz(t,n),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:i.map((t=>Qz(t,n)))}}}function eO(t){const e=t.outsideExecution,r=nC(t.signature);return mT.compile({outside_execution:e,signature:r})}function rO(t){return(Array.isArray(t)?t:[t]).map((t=>{let e;if("1"===t.version)e="execute_from_outside";else{if("2"!==t.version)throw new Error("Unsupported OutsideExecution version");e="execute_from_outside_v2"}return{contractAddress:wN(t.signerAddress),entrypoint:e,calldata:eO(t)}}))}Ix({},{buildExecuteFromOutsideCall:()=>rO,buildExecuteFromOutsideCallData:()=>eO,getOutsideCall:()=>Yz,getTypedData:()=>tO});async function iO(t,e,r){const i={contractAddress:wN(e),entrypoint:"supports_interface",calldata:[wN(r)]};try{const e=await t.callContract(i);return 0n!==BigInt(e[0])}catch{return!1}}Ix({},{supportsInterface:()=>iO});function nO(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function oO(t){return t.request({type:"wallet_getPermissions"})}function aO(t,e){return t.request({type:"wallet_watchAsset",params:e})}function sO(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function hO(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function uO(t){return t.request({type:"wallet_requestChainId"})}function lO(t){return t.request({type:"wallet_deploymentData"})}function cO(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function dO(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function fO(t,e){return t.request({type:"wallet_signTypedData",params:e})}function mO(t){return t.request({type:"wallet_supportedSpecs"})}function pO(t,e){t.on("accountsChanged",e)}function gO(t,e){t.on("networkChanged",e)}Ix({},{addDeclareTransaction:()=>dO,addInvokeTransaction:()=>cO,addStarknetChain:()=>sO,deploymentData:()=>lO,getPermissions:()=>oO,onAccountChange:()=>pO,onNetworkChanged:()=>gO,requestAccounts:()=>nO,requestChainId:()=>uO,signMessage:()=>fO,supportedSpecs:()=>mO,switchStarknetChain:()=>hO,watchAsset:()=>aO});var yO={1:{key:"1",name:"Ethereum",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",ensResolvers:["0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63","0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",rpc:["https://rpc.ankr.com/eth",{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],light:["https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:{url:"https://etherscan.io",apiUrl:"https://api.etherscan.io"},start:7929876,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},8:{key:"8",name:"Ubiq",chainId:8,network:"Ubiq",multicall:"0x6668750957e4083725926B71C41bDF1434C73262",rpc:["https://rpc.octano.dev"],ws:["wss://ws.octano.dev"],explorer:{url:"https://ubiqscan.io"},start:1,logo:"ipfs://Qmec3HLoN4QhwZAhw4XTi2aN8Wwmcko5hHN22sHARzb9tw"},10:{key:"10",name:"OP Mainnet",chainId:10,network:"OP Mainnet",multicall:"0x35A6Cdb2C9AD4a45112df4a04147EB07dFA01aB7",rpc:["https://opt-mainnet.g.alchemy.com/v2/JzmIL4Q3jBj7it2duxLFeuCa9Wobmm7D"],explorer:{url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io"},start:657806,logo:"ipfs://bafkreifu2remiqfpsb4hgisbwb3qxedrzpwsea7ik4el45znjcf56xf2ku"},19:{key:"19",name:"Songbird Canary-Network",shortName:"Songbird",chainId:19,network:"songbird",multicall:"0x17032Ea9c3a13Ed337665145364c0d2aD1108c91",rpc:["https://songbird-api.flare.network/ext/C/rpc"],explorer:{url:"https://songbird-explorer.flare.network"},start:21807126,logo:"ipfs://QmXyvnrZY8FUxSULfnKKA99sAEkjAHtvhRx5WeHixgaEdu"},24:{key:"24",name:"KardiaChain Mainnet",shortName:"KAI",chainId:24,network:"mainnet",multicall:"0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",rpc:["https://kai-internal.kardiachain.io"],explorer:{url:"https://explorer.kardiachain.io"},start:8260245,logo:"ipfs://bafkreig73yfyqzbxydv6e3dbj5nks3f57px2iez7tywayey4rilfhhrr34"},25:{key:"25",name:"Cronos",shortName:"Cronos",chainId:25,network:"mainnet",multicall:"0x6F522a3982e8F9A50A2EDc9E46ed1A3aE2B3FD3a",rpc:["https://evm-cronos.crypto.org"],explorer:{url:"https://cronos.crypto.org/explorer"},start:4067,logo:"ipfs://QmfSJbtirJoa3Pt7o5Fdm85wbyw9V1hpzqLr5PQbdnfsAj"},30:{key:"30",name:"RSK",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:{url:"https://explorer.rsk.co"},start:2516442,logo:"ipfs://QmXTwpE1SqoNZmyY4c3fYWy6qUgQELsyWKbgJo2Pg6K6V9"},46:{key:"46",name:"Darwinia Network",shortName:"Darwinia",chainId:46,network:"mainnet",multicall:"0x67f9ae42EaA9a8aBf065D60ec6Ab3C1A11370607",rpc:["https://rpc.darwinia.network"],explorer:{url:"https://darwinia.subscan.io"},start:141853,logo:"ipfs://bafkreicf55maidhx46pyu3mwsshlr43xbewr6tkckkonh4nesbkp7krwkm"},56:{key:"56",name:"BNB Smart Chain",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://rpc.ankr.com/bsc","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org"],explorer:{url:"https://bscscan.com"},start:461230,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},61:{key:"61",name:"Ethereum Classic",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"0x51be3a92C56ae7E207C5b5Fd87F7798Ce82C1AC2",rpc:["https://www.ethercluster.com/etc"],explorer:{url:"https://blockscout.com/etc/mainnet"},start:13307544,logo:"ipfs://QmVegc28DvA7LjKUFysab81c9BSuN4wQVDQkRXyAtuEBis"},66:{key:"66",name:"OKExChain",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:{url:"https://www.oklink.com/okexchain"},start:5076543,logo:"ipfs://Qmd7dKnNwHRZ4HRCbCXUbkNV7gP28fGqPdjbHtjRtT9sQF"},75:{key:"75",name:"Decimal",shortName:"mainnet",chainId:75,network:"mainnet",multicall:"0x949d1A0757803C51F2EfFFEb5472C861A898B8E8",rpc:[],explorer:{url:"https://explorer.decimalchain.com"},start:16031065,logo:"ipfs://bafkreihkdhbce5rkogl63xegaarlirjrvbfarxbtbf5mqme3s5grvbjyxm"},81:{key:"81",name:"Shibuya Network",shortName:"Shibuya",chainId:81,network:"testnet",testnet:!0,multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shibuya.astar.network:8545"],explorer:{url:"https://blockscout.com/shibuya"},start:856303,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},82:{key:"82",name:"Meter",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:{url:"https://scan.meter.io"},start:4992871,logo:"ipfs://QmSZvT9w9eUDvV1YVaq3BKKEbubtNVqu1Rin44FuN4wz11"},97:{key:"97",name:"BNB Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",testnet:!0,multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://data-seed-prebsc-1-s1.binance.org:8545","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive"],explorer:{url:"https://testnet.bscscan.com"},start:3599656,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},100:{key:"100",name:"Gnosis Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://gno.getblock.io/mainnet/6c1d1e6e-75d9-452f-a863-a694bff93d5c/","https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://rpc.gnosischain.com"],light:["https://rpc.gnosischain.com"],ws:["wss://rpc.xdaichain.com/wss"],explorer:{url:"https://gnosis.blockscout.com"},start:4108192,logo:"ipfs://QmZeiy8Ax4133wzxUQM9ky8z5XFVf6YLFjJMmTWbWVniZR"},108:{key:"108",name:"Thundercore",chainId:108,network:"mainnet",multicall:"0x3017086deef56679e267f67f66c4415109b7a97f",rpc:["https://mainnet-rpc.thundercore.com/archived/SNAPSHOTEuR82a75fLYA"],explorer:{url:"https://viewblock.io/thundercore"},start:94425385,logo:"ipfs://bafkreifc5z5vtvqx2luzgateyvoocwpd2ifv2hwufxdnyl2a767wa6icli"},109:{key:"109",name:"Shibarium",shortName:"mainnet",chainId:109,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://shibariumscan.io"},start:3485946,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm"},122:{key:"122",name:"Fuse",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://explorer-node.fuse.io/","https://oefusefull1.liquify.info/"],explorer:{url:"https://explorer.fuse.io"},start:11923459,logo:"ipfs://QmXjWb64nako7voaVEifgdjAbDbswpTY8bghsiHpv8yWtb"},137:{key:"137",name:"Polygon PoS",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://rpc.ankr.com/polygon","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e"],ws:["wss://ws-mainnet.matic.network"],explorer:{url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com"},start:9834491,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},144:{key:"144",name:"PHI Network",shortName:"PHI",chainId:144,network:"mainnet",multicall:"0xc2f41B404a6757863AAeF49ff93039421acCd630",rpc:["https://connect.phi.network"],explorer:{url:"https://phiscan.com"},start:360030,logo:"ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"},146:{key:"146",name:"Sonic",shortName:"mainnet",chainId:146,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.soniclabs.com"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44"},148:{key:"148",name:"ShimmerEVM",shortName:"ShimmerEVM",chainId:148,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.evm.shimmer.network"},start:1290,logo:"ipfs://bafkreib4xhbgbhrwkmizp4d4nz3wzbpyhdm6wpz2v2pbkk7jxsgg3hdt74"},151:{key:"151",name:"Redbelly",shortName:"mainnet",chainId:151,network:"mainnet",multicall:"0xEe43BBcC6340038130681F98d855E416F7F728e9",rpc:[],explorer:{url:"https://redbelly.routescan.io"},start:1908395,logo:"ipfs://bafkreie5mdk5shaebcec6zs5dc4722u2tn7oxvkksjy62kkjdzgnvmad7q"},157:{key:"157",name:"Shibarium Puppynet Testnet",shortName:"testnet",chainId:157,network:"testnet",multicall:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",rpc:[],explorer:{url:"https://puppyscan.shib.io"},start:3035769,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm",testnet:!0},169:{key:"169",name:"Manta Pacific",shortName:"Manta",chainId:169,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.oklink.com/manta"},start:332890,logo:"ipfs://bafkreibbrwgwdcfh755dqh4ndta6tja77qbaa36bfv4pstub6prhhore7a"},204:{key:"204",name:"opBNB",shortName:"mainnet",chainId:204,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"http://opbnbscan.com"},start:512881,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:{url:"https://explorer.energyweb.org"},start:12086501,logo:"ipfs://Qmai7AGHgs8NpeGeXgbMZz7pS2i4kw44qubCJYGrZW2f3a"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ankr.com/fantom","https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:{url:"https://ftmscan.com"},start:2497732,logo:"ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"},252:{key:"252",name:"Fraxtal",shortName:"mainnet",chainId:252,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu"},269:{key:"269",name:"High Performance Blockchain",shortName:"HPB",chainId:269,network:"mainnet",multicall:"0x67D0f263aef2F6167FA77353695D75b582Ff4Bca",rpc:["https://hpbnode.com"],ws:["wss://ws.hpbnode.com"],explorer:{url:"https://hscan.org"},start:13960096,logo:"ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"},291:{key:"291",name:"Orderly",shortName:"mainnet",chainId:291,network:"mainnet",multicall:"0x73e524d811263a145026113219F13f9133966b6b",rpc:[],explorer:{url:"https://explorer.orderly.network"},start:22457562,logo:"ipfs://bafkreibo62xtgkpam6nm34mau26gn65jlw6npb5odw4ylcd6dkwocea5ni"},296:{key:"296",name:"Hedera Testnet",shortName:"testnet",chainId:296,network:"testnet",multicall:"0xADE3166b0afA89b2CDB64870D70ADeD330Eab015",rpc:[],explorer:{url:"https://hashscan.io/testnet"},start:17561901,logo:"ipfs://bafkreia5gpitwgo4sspvvtwqcxosq2krrqo5dbrnvylgibvmypzotfmbuu",testnet:!0},300:{key:"300",name:"zkSync Sepolia Testnet",shortName:"testnet",chainId:300,network:"testnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:[],explorer:{url:"https://sepolia.explorer.zksync.dev"},start:2292,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",testnet:!0},314:{key:"314",name:"Filecoin",shortName:"mainnet",chainId:314,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://filfox.io"},start:3328594,logo:"ipfs://bafybeibyvjfmk6aqlfdrczvth55jkmnoadtrch7ht3rdmvqmy2bfxynecm"},321:{key:"321",name:"KCC",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:{url:"https://explorer.kcc.io"},start:1487453,logo:"ipfs://QmRdzYGhFRG8QLzMJahHrw3vETE2YZ9sywQbEkenSjKEvb"},324:{key:"324",name:"zkSync Era",shortName:"zkSync-era",chainId:324,network:"zkSync Era Mainnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:["https://mainnet.era.zksync.io"],explorer:{url:"https://explorer.zksync.io"},start:3908235,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"},336:{key:"336",name:"Shiden Network",shortName:"Shiden",chainId:336,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shiden.astar.network:8545","https://shiden.api.onfinality.io/public"],explorer:{url:"https://blockscout.com/shiden"},start:1170016,logo:"ipfs://QmcqGQE4Sk73zXc3e91TUFFefKBVeaNgbxV141XkSNE4xj"},369:{key:"369",name:"Pulsechain",shortName:"Pulsechain",chainId:369,network:"mainnet",multicall:"0xdbdd0FD8B16F0092f306392b699D7fbddaA9011B",rpc:["https://rpc.pulsechain.com"],explorer:{url:"https://scan.pulsechain.com"},start:17657774,logo:"ipfs://QmWUsiEWdejtHZ9B9981TYXn7Ds8C7fkB1S4h5rP3kCCZR"},416:{key:"416",name:"SX Network",shortName:"SX",chainId:416,network:"mainnet",multicall:"0x834a005DDCF990Ba1a79f259e840e58F2D14F49a",rpc:["https://rpc.sx.technology"],ws:["wss://rpc.sx.technology/ws"],explorer:{url:"https://explorer.sx.technology"},start:2680605,logo:"ipfs://QmSXLXqyr2H6Ja5XrmznXbWTEvF2gFaL8RXNXgyLmDHjAF"},592:{key:"592",name:"Astar Network",shortName:"Astar",chainId:592,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://astar.api.onfinality.io/public","https://rpc.astar.network:8545"],explorer:{url:"https://blockscout.com/astar"},start:366482,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},813:{key:"813",name:"Qitmeer",shortName:"MEER",chainId:813,network:"mainnet",multicall:"0x55034b2cF530ae3A8fC1e2e4523F58496796610F",rpc:["https://evm-dataseed1.meerscan.io","https://evm-dataseed.meerscan.com","https://evm-dataseed2.meerscan.io","https://evm-dataseed3.meerscan.io"],explorer:{url:"https://evm.meerscan.io"},start:43317,logo:"ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"},841:{key:"841",name:"Taraxa",shortName:"841",chainId:841,network:"mainnet",multicall:"0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",rpc:["https://rpc.mainnet.taraxa.io"],ws:["wss://ws.mainnet.taraxa.io"],explorer:{url:"https://mainnet.explorer.taraxa.io"},start:1515906,logo:"ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"},888:{key:"888",name:"Wanchain",chainId:888,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:{url:"https://www.wanscan.org"},start:11302663,logo:"ipfs://QmewFFN44rkxESFsHG8edaLt1znr62hjvZhGynfXqruzX3"},1001:{key:"1001",name:"Kaia Kairos Testnet",shortName:"kaia-kairos",chainId:1001,network:"testnet",testnet:!0,multicall:"0x40643B8Aeaaca0b87Ea1A1E596e64a0e14B1d244",rpc:["https://archive-en-kairos.node.kaia.io"],ws:["wss://archive-en-kairos.node.kaia.io/ws"],explorer:{url:"https://kairos.kaiascan.com"},start:87232478,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},1072:{key:"1072",name:"Shimmer EVM Testnet",shortName:"ShimmerEVM",chainId:1072,network:"testnet",testnet:!0,multicall:"0x751d21047C116413895c259f3f305e38C10B7cF6",rpc:["https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"],explorer:{url:"https://explorer.evm.testnet.shimmer.network"},start:10614,logo:"ipfs://bafkreihtwfwrue7klzedwx4rqlk6agklz4lbbk7owsyw6xzn6c2m4t5tgy"},1088:{key:"1088",name:"Metis",shortName:"metis",chainId:1088,network:"mainnet",multicall:"0xc39aBB6c4451089dE48Cffb013c39d3110530e5C",rpc:["https://andromeda.metis.io/?owner=1088"],explorer:{url:"https://andromeda-explorer.metis.io"},start:451,logo:"ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"},1101:{key:"1101",name:"Polygon zkEVM",shortName:"mainnet",chainId:1101,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://zkevm.polygonscan.com"},start:57746,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm"},1116:{key:"1116",name:"Core Chain",shortName:"Core",chainId:1116,network:"mainnet",multicall:"0x024f0041b76B598c2A0a75004F8447FaF67BD004",rpc:["https://rpcar.coredao.org/"],explorer:{url:"https://scan.coredao.org"},start:853908,logo:"ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"},1284:{key:"1284",name:"Moonbeam",shortName:"GLMR",chainId:1284,network:"mainnet",multicall:"0x83e3b61886770de2F64AAcaD2724ED4f08F7f36B",rpc:["https://rpc.api.moonbeam.network"],explorer:{url:"https://moonscan.io"},start:171135,logo:"ipfs://QmWKTEK2pj5sBBbHnMHQbWgw6euVdBrk2Ligpi2chrWASk"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.api.moonriver.moonbeam.network"],explorer:{url:"https://blockscout.moonriver.moonbeam.network"},start:413539,logo:"ipfs://QmXtgPesL87Ejhq2Y7yxsaPYpf4RcnoTYPJWPcv6iiYhoi"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",testnet:!0,multicall:"0xf09FD6B6FF3f41614b9d6be2166A0D07045A3A97",rpc:["https://rpc.testnet.moonbeam.network"],explorer:{url:"https://moonbase-blockscout.testnet.moonbeam.network"},start:859041,logo:"ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"},1315:{key:"1315",name:"Story Aeneid Testnet",shortName:"testnet",chainId:1315,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://aeneid.storyscan.io"},start:1792,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne",testnet:!0},1328:{key:"1328",name:"Sei atlantic testnet",shortName:"testnet",chainId:1328,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://seitrace.com"},start:96978658,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},1329:{key:"1329",name:"Sei",shortName:"mainnet",chainId:1329,network:"mainnet",multicall:"0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",rpc:[],explorer:{url:"https://seitrace.com"},start:79164574,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"},1480:{key:"1480",name:"Vana",shortName:"mainnet",chainId:1480,network:"mainnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://islander.vanascan.io"},start:716763,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa"},1514:{key:"1514",name:"Story",shortName:"mainnet",chainId:1514,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.storyscan.io"},start:340998,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne"},1559:{key:"1559",name:"Tenet",shortName:"tenet",chainId:1559,network:"mainnet",multicall:"0xcCB3F00bE353950E4C08501ac8Af48765EAAa738",rpc:[],explorer:{url:"https://tenetscan.io"},start:944415,logo:"ipfs://Qmc1gqjWTzNo4pyFSGtQuCu7kRSZZBUVybtTjHn2nNEEPA"},1663:{key:"1663",name:"Horizen Gobi Testnet",shortName:"Gobi",chainId:1663,network:"testnet",testnet:!0,multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:["https://gobi-testnet.horizenlabs.io/ethv1"],explorer:{url:"https://gobi-explorer.horizen.io"},start:1,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},2e3:{key:"2000",name:"Doge Chain",shortName:"dogechain",chainId:2e3,network:"mainnet",multicall:"0x6f9D3f3932B417bd4957585D236Cbc32b32C0BDc",rpc:["https://rpc.dogechain.dog"],explorer:{url:"https://explorer.dogechain.dog"},start:877115,logo:"ipfs://bafkreigovfh3pinsdih777issfgaflwu2yjzroljs2642gbvwikcd3nm4i"},2109:{key:"2109",name:"Exosama Network",shortName:"EXN",chainId:2109,network:"mainnet",multicall:"0x2feFC828e2fEfdE0C9f7740919c6A9139F886067",rpc:["https://rpc.exosama.com"],explorer:{url:"https://explorer.exosama.com"},start:94085,logo:"ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS"},2152:{key:"2152",name:"Findora",shortName:"Findora",chainId:2152,network:"mainnet",multicall:"0xCF7D1e21CBe9bdEF235aef06C5d8051B3d4DF0f5",rpc:["https://archive.prod.findora.org:8545/"],explorer:{url:"https://evm.findorascan.io"},start:4219343,logo:"ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"},2221:{key:"2221",name:"Kava Testnet",shortName:"testnet",chainId:2221,network:"testnet",multicall:"0xc7193EFE367DF0C9349a1149F4E95A2A35604262",rpc:[],explorer:{url:"https://testnet.kavascan.com"},start:6193104,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",testnet:!0},2222:{key:"2222",name:"Kava",shortName:"mainnet",chainId:2222,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://kavascan.com"},start:3661165,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"},2400:{key:"2400",name:"TCG Verse",shortName:"TCGV",chainId:2400,network:"mainnet",multicall:"0xceC65DEE0b5012F1b7321b2647681F997c7204FC",rpc:["https://rpc.tcgverse.xyz"],explorer:{url:"https://explorer.tcgverse.xyz"},start:57500,logo:"ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"},2522:{key:"2522",name:"Fraxtal Testnet",shortName:"testnet",chainId:2522,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://holesky.fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu",testnet:!0},3338:{key:"3338",name:"peaq",shortName:"mainnet",chainId:3338,network:"mainnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://peaq.subscan.io"},start:3525964,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm"},4162:{key:"4162",name:"SX Rollup",shortName:"mainnet",chainId:4162,network:"mainnet",multicall:"0x46997eb05F6A6A0bD5C140ABed09Cb02CA36b98c",rpc:[],explorer:{url:"https://explorerl2.sx.technology"},start:1847483,logo:"ipfs://bafkreibjkjx7evbw74e3sx65dtmcdr4g2rrbcorb2ivd6jz6yh6on6ozw4"},4200:{key:"4200",name:"Merlin",shortName:"merlin",chainId:4200,network:"mainnet",multicall:"0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980",rpc:[],explorer:{url:"https://scan.merlinchain.io"},start:589494,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe"},4337:{key:"4337",name:"Beam",shortName:"Beam",chainId:4337,network:"mainnet",multicall:"0x4956F15eFdc3dC16645e90Cc356eAFA65fFC65Ec",rpc:[],explorer:{url:"https://subnets.avax.network/beam"},start:1,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF"},4689:{key:"4689",name:"IoTeX",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:{url:"https://iotexscan.io"},start:11533283,logo:"ipfs://QmNkr1UPcBYbvLp7d7Pk4eF3YCsHpaNkfusKZNtykL2EQC"},5e3:{key:"5000",name:"Mantle",chainId:5e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.mantle.xyz"],explorer:{url:"https://mantlescan.xyz"},start:304717,logo:"ipfs://bafkreidkucwfn4mzo2gtydrt2wogk3je5xpugom67vhi4h4comaxxjzoz4"},5555:{key:"5555",name:"Chain Verse",shortName:"ChainVerse",chainId:5555,network:"ChainVerse",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.chainverse.info"],explorer:{url:"https://explorer.chainverse.info"},start:6334180,logo:"ipfs://QmQyJt28h4wN3QHPXUQJQYQqGiFUD77han3zibZPzHbitk"},5611:{key:"5611",name:"opBNB Testnet",shortName:"testnet",chainId:5611,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://opbnb-testnet.bscscan.com"},start:3705108,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64",testnet:!0},6102:{key:"6102",name:"Cascadia Testnet",shortName:"Cascadia",chainId:6102,network:"testnet",multicall:"0x728989819bAD588F193563008E0a03E8cD6a3e4a",rpc:["https://testnet.cascadia.foundation"],explorer:{url:"https://explorer.cascadia.foundation"},testnet:!0,start:370457,logo:"ipfs://QmWkhZYhReYyaa5pQXj32hEGxoRcBqarFMcfQScELmjYQj"},6900:{key:"6900",name:"Animechain Testnet",shortName:"testnet",chainId:6900,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-testnet-i8yja6a1a0.t.conduit.xyz"},start:1666749,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi",testnet:!0},7332:{key:"7332",name:"Horizen EON",shortName:"EON",chainId:7332,network:"mainnet",multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:[],explorer:{url:"https://eon-explorer.horizenlabs.io"},start:85108,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},7341:{key:"7341",name:"Shyft",shortName:"Shyft",chainId:7341,network:"mainnet",multicall:"0xceb10e9133D771cA93c8002Be527A465E85381a2",rpc:["https://rpc.shyft.network"],explorer:{url:"https://bx.shyft.network"},start:3673983,logo:"ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"},7560:{key:"7560",name:"Cyber",shortName:"mainnet",chainId:7560,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://cyberscan.co"},start:1731707,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"},8217:{key:"8217",name:"Kaia Mainnet",shortName:"kaia-mainnet",chainId:8217,network:"mainnet",multicall:"0x5f5f0d1b9ff8b3dcace308e39b13b203354906e9",rpc:["https://archive-en.node.kaia.io"],ws:["wss://archive-en.node.kaia.io/ws"],explorer:{url:"https://kaiascan.com"},start:91582357,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},8453:{key:"8453",name:"Base",shortName:"mainnet",chainId:8453,network:"mainnet",multicall:"0xca11bde05977b3631167028862be2a173976ca11",rpc:[],explorer:{url:"https://basescan.org"},start:5022,logo:"ipfs://bafkreid4ek4gnj6ccxl3yubwj2wr3d5t6dqelvvh4hv5wo5eldkqs725ri"},9001:{key:"9001",name:"Evmos Network",shortName:"Evmos",chainId:9001,network:"mainnet",multicall:"0x37763d16f8dBf6F185368E0f256350cAb7E24b26",rpc:["https://eth.bd.evmos.org:8545"],ws:["wss://eth.bd.evmos.org:8546"],explorer:{url:"https://escan.live"},start:13959539,logo:"ipfs://bafkreif4obrdoiretpozdd56seziywc6clha7wwkbldng3ovry2bpzly34"},9990:{key:"9990",name:"Agung testnet",shortName:"testnet",chainId:9990,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://agung-testnet.subscan.io"},start:2031789,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm",testnet:!0},1e4:{key:"10000",name:"smartBCH",shortName:"BCH",chainId:1e4,network:"mainnet",multicall:"0x1b38EBAd553f218e2962Cb1C0539Abb5d6A37774",rpc:["https://smartbch.greyh.at/"],explorer:{url:"https://smartbch-explorer.web.app"},start:268248,logo:"ipfs://QmWG1p7om4hZ4Yi4uQvDpxg4si7qVYhtppGbcDGrhVFvMd"},10243:{key:"10243",name:"Arthera Testnet",shortName:"Arthera_",chainId:10243,network:"testnet",testnet:!0,multicall:"0x27c7FC597aD2E81C4c1cA1769972f79DaF042Da7",rpc:["https://rpc-test.arthera.net"],explorer:{url:"https://explorer-test.arthera.net"},start:10523,logo:"ipfs://QmYQp3e52KjkT4bYdAvB6ACEEpXs2D8DozsDitaADRY2Ak"},13337:{key:"13337",name:"Beam Testnet",shortName:"testnet",chainId:13337,network:"testnet",multicall:"0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E",rpc:[],explorer:{url:"https://subnets-test.avax.network/beam"},start:3,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",testnet:!0},13371:{key:"13371",name:"Immutable zkEVM",shortName:"mainnet",chainId:13371,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.immutable.com"},start:3680945,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"},13473:{key:"13473",name:"Immutable zkEVM Testnet",shortName:"testnet",chainId:13473,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.testnet.immutable.com"},start:5307209,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",testnet:!0},14800:{key:"14800",name:"Vana Moksha Testnet",shortName:"testnet",chainId:14800,network:"testnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://moksha.vanascan.io"},start:732283,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa",testnet:!0},16718:{key:"16718",name:"AirDAO",chainId:16718,network:"mainnet",multicall:"0x25e81aC81A8B03389D78CB45faB78353aB528574",rpc:["https://network-archive.ambrosus.io"],ws:["wss://network-archive.ambrosus.io/ws"],explorer:{url:"https://airdao.io/explorer"},start:22922566,logo:"ipfs://QmSxXjvWng3Diz4YwXDV2VqSPgMyzLYBNfkjJcr7rzkxom"},29548:{key:"29548",name:"MCH Verse",shortName:"mainnet",chainId:29548,network:"mainnet",multicall:"0x1d39652386488CE1fE4254E105F5A42a04d43dB2",rpc:[],explorer:{url:"https://explorer.oasys.mycryptoheroes.net"},start:27458402,logo:"ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"},33111:{key:"33111",name:"Curtis",shortName:"apechain",chainId:33111,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://curtis.apescan.io"},start:6661339,logo:"ipfs://bafkreicljxttjq2xkgfwwpii5xegirgq2ctrnsjnzelxudjj33qzq65apu",testnet:!0},33139:{key:"33139",name:"ApeChain",shortName:"mainnet",chainId:33139,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://apescan.io"},start:20889,logo:"ipfs://bafkreielbgcox2jsw3g6pqulqb7pyjgx7czjt6ahnibihaij6lozoy53w4"},42161:{key:"42161",name:"Arbitrum One",chainId:42161,network:"Arbitrum mainnet",multicall:"0x7A7443F8c577d537f1d8cD4a629d40a3148Dd7ee",rpc:["https://rpc.ankr.com/arbitrum","https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/arbitrum/mainnet","https://arb-mainnet.g.alchemy.com/v2/JDvtNGwnHhTltIwfnxQocKwKkCTKA1DL"],explorer:{url:"https://arbiscan.io"},start:256508,logo:"ipfs://QmWZ5SMRfvcK8tycsDqojQaSiKedgtVkS7CkZdxPgeCVsZ"},42170:{key:"42170",name:"Arbitrum Nova",chainId:42170,network:"Arbitrum Nova",multicall:"0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14",rpc:["https://nova.arbitrum.io/rpc","https://arbitrum-nova.public.blastapi.io"],explorer:{url:"https://nova.arbiscan.io"},start:6006607,logo:"ipfs://bafkreie5xsqt3mrrwu7v32qpmmctibhzhgxf4emfzzddsdhdlfsa7fmplu"},42220:{key:"42220",name:"Celo",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo.snapshot.org","https://forno.celo.org","https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:{url:"https://celoscan.io"},start:6599803,logo:"ipfs://bafkreidvcofeczigbjr7ddapgdugwso6v2l4iolfxys7qg6kfvu2uduyva"},43113:{key:"43113",name:"Avalanche FUJI Testnet",chainId:43113,network:"testnet",testnet:!0,multicall:"0x984476ea55e32e785A9D8FF14329f99D74E3d2A2",rpc:["https://api.avax-test.network/ext/bc/C/rpc"],explorer:{url:"https://testnet.snowtrace.io"},start:10528153,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://nd-784-543-849.p2pify.com/aa7b29fc5fed65b34f0ee6b8de33f8c0/ext/bc/C/rpc","https://rpc.ankr.com/avalanche","https://api.avax.network/ext/bc/C/rpc"],explorer:{url:"https://snowtrace.io"},start:536483,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},47805:{key:"47805",name:"REI Mainnet",chainId:47805,network:"mainnet",multicall:"0x9eE9904815B80C39C1a27294E69a8626EAa7952d",rpc:["https://rpc.rei.network"],explorer:{url:"https://scan.rei.network"},start:1715902,logo:"ipfs://QmTogMDLmDgJjDjUKDHDuc2KVTVDbXf8bXJLFiVe8PRxgo"},53935:{key:"53935",name:"DFK Chain",chainId:53935,network:"mainnet",multicall:"0x5b24224dC16508DAD755756639E420817DD4c99E",rpc:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"],explorer:{url:"https://subnets.avax.network/defi-kingdoms"},start:62,logo:"ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"},57054:{key:"57054",name:"Sonic Blaze Testnet",shortName:"testnet",chainId:57054,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://testnet.sonicscan.org"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44",testnet:!0},57073:{key:"57073",name:"Ink",shortName:"mainnet",chainId:57073,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.inkonchain.com"},start:6659154,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju"},59141:{key:"59141",name:"Linea Sepolia",shortName:"testnet",chainId:59141,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.lineascan.build"},start:227427,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",testnet:!0},59144:{key:"59144",name:"Linea",shortName:"linea",chainId:59144,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://lineascan.build"},start:42,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce"},69e3:{key:"69000",name:"Animechain",shortName:"mainnet",chainId:69e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-39xf6m45e3.t.conduit.xyz"},start:23482,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi"},80001:{key:"80001",name:"Polygon Mumbai",chainId:80001,network:"testnet",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:{url:"https://mumbai.polygonscan.com",apiUrl:"https://api-mumbai.polygonscan.com"},start:12011090,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},80002:{key:"80002",name:"Polygon Amoy Testnet",shortName:"testnet",chainId:80002,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://amoy.polygonscan.com"},start:3127388,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm",testnet:!0},81457:{key:"81457",name:"Blast",shortName:"mainnet",chainId:81457,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://blastscan.io"},start:88189,logo:"ipfs://bafkreicqhrimt2zyp2kvhmbpvffxlmxovkg5vw6zkissyzibcfy45kbvrm"},84532:{key:"84532",name:"Base Sepolia",shortName:"testnet",chainId:84532,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://base-sepolia.blockscout.com"},start:1059647,logo:"ipfs://bafkreid4ek4gnj6ccxl3yubwj2wr3d5t6dqelvvh4hv5wo5eldkqs725ri",testnet:!0},88811:{key:"88811",name:"Unit Zero",shortName:"mainnet",chainId:88811,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.unit0.dev"},start:9727,logo:"ipfs://bafkreihbmy3rqlammea35nniemipxrwcgitzkiahs6nlrfjunnvgfnakp4"},88817:{key:"88817",name:"Unit Zero testnet",shortName:"testnet",chainId:88817,network:"testnet",multicall:"0x017181efb3bDB325C17800799b33Ae80B395024c",rpc:[],explorer:{url:"https://explorer-testnet.unit0.dev"},start:3973744,logo:"ipfs://bafkreihbmy3rqlammea35nniemipxrwcgitzkiahs6nlrfjunnvgfnakp4",testnet:!0},314159:{key:"314159",name:"Filecoin Calibration Testnet",shortName:"testnet",chainId:314159,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://calibration.filscan.io/en"},start:1446201,logo:"ipfs://bafkreiffbopdjior7li3nlemzko7rjua6wd2hfh2vhdbenqbv4tfsbnzwu",testnet:!0},686868:{key:"686868",name:"Merlin Testnet",shortName:"merlin",chainId:686868,network:"testnet",multicall:"0x758BC6321b7c68F4986d62a4D46E83A2DCb58c80",rpc:[],explorer:{url:"https://testnet-scan.merlinchain.io"},start:3562021,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe",testnet:!0},713715:{key:"713715",name:"Sei EVM Devnet",shortName:"devnet",chainId:713715,network:"testnet",multicall:"0xEe8d287B844959ADe40d718Dc23077ba920e2f07",rpc:[],explorer:{url:"https://seitrace.com"},start:1463669,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},763373:{key:"763373",name:"Ink Sepolia",shortName:"testnet",chainId:763373,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-sepolia.inkonchain.com"},start:9701940,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju",testnet:!0},810180:{key:"810180",name:"zkLink Nova",shortName:"zlink",chainId:810180,network:"mainnet",multicall:"0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",rpc:[],explorer:{url:"https://explorer.zklink.io"},start:146055,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"},810181:{key:"810181",name:"zkLink Nova Sepolia",shortName:"testnet",chainId:810181,network:"testnet",multicall:"0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",rpc:[],explorer:{url:"https://sepolia.explorer.zklink.io"},start:43723,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",testnet:!0},11155111:{key:"11155111",name:"Sepolia testnet",shortName:"Sepolia",chainId:11155111,network:"sepolia",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://sepolia.infura.io/v3/d26b4fd748814fe994b05899fd89e667"],ensResolvers:["0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"],ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/CA5t8ep58QKXBdLrjJHaREETHpCsy63kro9Eem6zBQAD",explorer:{url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io"},start:751532,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},11155420:{key:"11155420",name:"OP Sepolia",shortName:"testnet",chainId:11155420,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia-optimism.etherscan.io"},start:1620204,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",testnet:!0},111557560:{key:"111557560",name:"Cyber Testnet",shortName:"testnet",chainId:111557560,network:"testnet",multicall:"0xffc391F0018269d4758AEA1a144772E8FB99545E",rpc:[],explorer:{url:"https://testnet.cyberscan.co"},start:304545,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",testnet:!0},168587773:{key:"168587773",name:"Blast Sepolia",shortName:"testnet",chainId:168587773,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.blastexplorer.io"},start:756690,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",testnet:!0},245022926:{key:"245022926",name:"Neon Devnet",shortName:"devnet",chainId:245022926,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://devnet.neonscan.org"},start:205206112,logo:"ipfs://QmecRPQGa4bU7tybg1sUQY48Md9rWnmhrT6WW5ueqvhg6P",testnet:!0},1313161554:{key:"1313161554",name:"Aurora",shortName:"Aurora",chainId:1313161554,network:"mainnet",multicall:"0x32b50c286DEFd2932a0247b8bb940b78c063F16c",rpc:["https://mainnet.aurora.dev"],explorer:{url:"https://explorer.mainnet.aurora.dev"},start:57190533,logo:"ipfs://QmeRhsR1UPRTQCizdhmgr2XxphXebVKU5di97uCV2UMFpa"},16666e5:{key:"1666600000",name:"Harmony",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:{url:"https://explorer.harmony.one"},start:10911984,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",testnet:!0,multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:{url:"https://explorer.pops.one"},start:7521509,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},"0x534e5f4d41494e":{key:"0x534e5f4d41494e",name:"Starknet",shortName:"Starknet",chainId:"0x534e5f4d41494e",network:"mainnet",starknet:!0,broviderId:"sn",multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://starkscan.co"},rpc:[],start:8446,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"},"0x534e5f5345504f4c4941":{key:"0x534e5f5345504f4c4941",name:"Starknet Sepolia",shortName:"testnet",chainId:"0x534e5f5345504f4c4941",network:"testnet",starknet:!0,broviderId:"sn-sep",testnet:!0,multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://sepolia.starkscan.co"},rpc:[],start:7,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"}};const wO=new Map,vO={evm:function(t,e){return new Am({url:`${e.broviderUrl}/${t}`,timeout:e.timeout,allowGzip:!0},Number(t))},starknet:function(t,e){return new $z({nodeUrl:`${e.broviderUrl}/${t}`})}};function bO(t,e={}){const r=function(t){const e=yO[t];if(!e)throw new Error(`Network '${t}' is not supported`);return e.broviderId||String(t)}(t),i=function(t={}){var e;return{broviderUrl:t.broviderUrl||"https://rpc.snapshot.org",timeout:null!==(e=t.timeout)&&void 0!==e?e:25e3}}(e),n=function(t,e){return`${t}:${e.broviderUrl}:${e.timeout}`}(r,i),o=wO.get(n);if(o)return o;const a=function(t){var e;return(null===(e=yO[t])||void 0===e?void 0:e.starknet)?"starknet":"evm"}(t),s=vO[a](r,i);return wO.set(n,s),s}function kO(t){return!!t.primaryType&&!!t.types.StarkNetDomain}var MO=Object.freeze({__proto__:null,isStarknetMessage:kO,getHash:function(t,e){const{domain:r,types:i,primaryType:n,message:o}=t;return KC.getMessageHash({types:i,primaryType:n,domain:r,message:o},e)},default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="0x534e5f4d41494e",n={}){try{const o=bO(i,n);return yield o.getClassAt(t),o.verifyMessageInStarknet(r,e,t)}catch(t){if(t.message.includes("Contract not found"))throw new Error("Contract not deployed");throw t}}))}});function _O(t){return He(Lr(t))}var EO=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ht.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191&lt,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));var AO=EO.BN;const jO=new vt("bignumber/5.6.2"),xO={},SO=9007199254740991;let NO=!1;class IO{constructor(t,e){t!==xO&&jO.throwError("cannot call constructor directly; use BigNumber.from",vt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return CO(zO(this).fromTwos(t))}toTwos(t){return CO(zO(this).toTwos(t))}abs(){return"-"===this._hex[0]?IO.from(this._hex.substring(1)):this}add(t){return CO(zO(this).add(zO(t)))}sub(t){return CO(zO(this).sub(zO(t)))}div(t){return IO.from(t).isZero()&&OO("division-by-zero","div"),CO(zO(this).div(zO(t)))}mul(t){return CO(zO(this).mul(zO(t)))}mod(t){const e=zO(t);return e.isNeg()&&OO("division-by-zero","mod"),CO(zO(this).umod(e))}pow(t){const e=zO(t);return e.isNeg()&&OO("negative-power","pow"),CO(zO(this).pow(e))}and(t){const e=zO(t);return(this.isNegative()||e.isNeg())&&OO("unbound-bitwise-result","and"),CO(zO(this).and(e))}or(t){const e=zO(t);return(this.isNegative()||e.isNeg())&&OO("unbound-bitwise-result","or"),CO(zO(this).or(e))}xor(t){const e=zO(t);return(this.isNegative()||e.isNeg())&&OO("unbound-bitwise-result","xor"),CO(zO(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&OO("negative-width","mask"),CO(zO(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&OO("negative-width","shl"),CO(zO(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&OO("negative-width","shr"),CO(zO(this).shrn(t))}eq(t){return zO(this).eq(zO(t))}lt(t){return zO(this).lt(zO(t))}lte(t){return zO(this).lte(zO(t))}gt(t){return zO(this).gt(zO(t))}gte(t){return zO(this).gte(zO(t))}isNegative(){return"-"===this._hex[0]}isZero(){return zO(this).isZero()}toNumber(){try{return zO(this).toNumber()}catch(t){OO("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return jO.throwError("this platform does not support BigInt",vt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?NO||(NO=!0,jO.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?jO.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",vt.errors.UNEXPECTED_ARGUMENT,{}):jO.throwError("BigNumber.toString does not accept parameters",vt.errors.UNEXPECTED_ARGUMENT,{})),zO(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof IO)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new IO(xO,TO(t)):t.match(/^-?[0-9]+$/)?new IO(xO,TO(new AO(t))):jO.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&OO("underflow","BigNumber.from",t),(t>=SO||t<=-SO)&&OO("overflow","BigNumber.from",t),IO.from(String(t));const e=t;if("bigint"==typeof e)return IO.from(e.toString());if(At(e))return IO.from(Tt(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return IO.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Nt(t)||"-"===t[0]&&Nt(t.substring(1))))return IO.from(t)}return jO.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function TO(t){if("string"!=typeof t)return TO(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&jO.throwArgumentError("invalid hex","value",t),"0x00"===(t=TO(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function CO(t){return IO.from(TO(t))}function zO(t){const e=IO.from(t).toHexString();return"-"===e[0]?new AO("-"+e.substring(3),16):new AO(e.substring(2),16)}function OO(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),jO.throwError(t,vt.errors.NUMERIC_FAULT,i)}var RO=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const PO=new vt("hash/5.6.1"),BO=new Uint8Array(32);BO.fill(0);const DO=IO.from(-1),$O=IO.from(0),LO=IO.from(1),UO=IO.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const FO=Pt(LO.toHexString(),32),qO=Pt($O.toHexString(),32),VO={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},HO=["name","version","chainId","verifyingContract","salt"];function GO(t){return function(e){return"string"!=typeof e&&PO.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const ZO={name:GO("name"),version:GO("version"),chainId:function(t){try{return IO.from(t).toString()}catch(t){}return PO.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return nr(t).toLowerCase()}catch(t){}return PO.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=jt(t);if(32!==e.length)throw new Error("bad length");return Tt(e)}catch(t){}return PO.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function KO(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&PO.throwArgumentError("invalid numeric width","type",t);const n=UO.mask(r?i-1:i),o=r?n.add(LO).mul(DO):$O;return function(e){const r=IO.from(e);return(r.lt(o)||r.gt(n))&&PO.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Pt(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&PO.throwArgumentError("invalid bytes width","type",t),function(e){return jt(e).length!==r&&PO.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=jt(t),r=e.length%32;return r?Ot([e,BO.slice(r)]):Tt(e)}(e)}}}switch(t){case"address":return function(t){return Pt(nr(t),32)};case"bool":return function(t){return t?FO:qO};case"bytes":return function(t){return He(t)};case"string":return function(t){return _O(t)}}return null}function JO(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class WO{constructor(t){Wt(this,"types",Object.freeze(ie(t))),Wt(this,"_encoderCache",{}),Wt(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&PO.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===i&&PO.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);KO(a)||(r[a]||PO.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),r[a].push(i),e[i][a]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?PO.throwArgumentError("missing primary type","types",t):n.length>1&&PO.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Wt(this,"primaryType",n[0]),function n(o,a){a[o]&&PO.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,a),Object.keys(a).forEach((e=>{i[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=JO(e,t[e])+r.map((e=>JO(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=KO(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&PO.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(He)),He(Ot(n))}}const r=this.types[t];if(r){const e=_O(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?He(i):i}));return i.unshift(e),Ot(i)}}return PO.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||PO.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return He(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(KO(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&PO.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):PO.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new WO(t)}static getPrimaryType(t){return WO.from(t).primaryType}static hashStruct(t,e,r){return WO.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=VO[r];i||PO.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>HO.indexOf(t.name)-HO.indexOf(e.name))),WO.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Ot(["0x1901",WO.hashDomain(t),WO.from(e).hash(r)])}static hash(t,e,r){return He(WO.encode(t,e,r))}static resolveNames(t,e,r,i){return RO(this,void 0,void 0,(function*(){t=Xt(t);const n={};t.verifyingContract&&!Nt(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=WO.from(e);o.visit(r,((t,e)=>("address"!==t||Nt(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){WO.hashDomain(t);const i={},n=[];HO.forEach((e=>{const r=t[e];null!=r&&(i[e]=ZO[e](r),n.push({name:e,type:VO[e]}))}));const o=WO.from(e),a=Xt(e);return a.EIP712Domain?PO.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=n,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return Tt(jt(e));if(t.match(/^u?int/))return IO.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&PO.throwArgumentError("invalid string","value",e),e}return PO.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new vt("wallet/5.6.2");function YO(t,e,r,i){return Ba(WO.hash(t,e,r),i)}const QO="6492649264926492649264926492649264926492649264926492649264926492";function XO(t,e){return t.toLowerCase()===e.toLowerCase()}function tR(t){const{domain:e,types:r,message:i}=t;return $u.hash(e,r,i)}function eR(t,e,i,n){return r(this,void 0,void 0,(function*(){let r;try{r=yield UP(n,["function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[jt(i),e]])}catch(t){if(t.message.startsWith("missing revert data in call exception"))return!1;throw t}return XO(r,"0x1626ba7e")}))}function rR(t,e,i,n){return r(this,void 0,void 0,(function*(){return XO(yield UP(n,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[jt(i),e]]),"0x20c13b0b")}))}var iR=Object.freeze({__proto__:null,getHash:tR,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){const{domain:o,types:a,message:s}=r;try{if(XO(t,YO(o,a,s,e)))return!0}catch(t){}const h=bO(i,n),u=tR(r);if(e.endsWith(QO))try{return"0x01"===(yield h.call({data:xt(["0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",(new ai).encode(["address","bytes32","bytes"],[t,jt(u),e])])}))}catch(t){return!1}return!!(yield eR(t,e,u,h))||(yield rR(t,e,u,h))}))}});var nR=["ipfs.snapshot.box","snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];class oR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"number"==typeof t&&void 0!==(null==e?void 0:e[t-1])}getValidVotes(){return this.votes.filter((t=>oR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>{const r=this.getValidVotes().filter((t=>t.choice===e+1));return r.reduce(((t,e)=>t+e.balance),0)}))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>{const r=this.strategies.map(((t,r)=>{const i=this.getValidVotes().filter((t=>t.choice===e+1));return i.reduce(((t,e)=>t+e.scores[r]),0)}));return r}))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices[this.selected-1]}}class aR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size}getValidVotes(){return this.votes.filter((t=>aR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.balance),0)))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.scores[r]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected?this.proposal.choices.filter(((t,e)=>this.selected.includes(e+1))).join(", "):""}}function sR(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function hR(t,e){return Math.sqrt(t*e)}function uR(t){return t*t}function lR(t,e){return t.map((t=>e*t))}class cR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>cR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>{const i=t.map((t=>hR(sR(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return uR(i)}));return lR(r.map(((t,e)=>sR(r[e],r))),e)}getScoresByStrategy(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.map((t=>hR(sR(t.choice[r+1],Object.values(t.choice)),t.scores[i]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[uR(t)]))));return r.map(((t,i)=>lR(this.strategies.map(((t,e)=>sR(r[i][e][0],r.flat(2)))),e)))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1]){const r=sR(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function dR(t,e){const r=[...new Set(t.map((t=>t[0])).flat())],i=Object.entries(t.reduce(((t,[e],r,i)=>{const n=i[r][1];t[e[0]][0]+=n;const o=i[r][2];return o.length>1?t[e[0]][1]=o.map(((r,i)=>r+t[e[0]][1][i]||r)):t[e[0]][1]=[t[e[0]][1].concat(o).reduce(((t,e)=>t+e),0)],t}),Object.assign({},...r.map((t=>({[t]:[0,[]]})))))),n=i.map((t=>[t[0],t[1][0]])),[o,a]=n.reduce((([t,e],[r,i])=>i>e?[r,i]:[t,e]),["?",-1/0]),[s,h]=n.reduce((([t,e],[r,i])=>i<e?[r,i]:[t,e]),["?",1/0]),u=i.sort(((t,e)=>e[1][0]-t[1][0])),l=t.map((t=>t[1])).reduce(((t,e)=>t+e),0);return e.push({round:e.length+1,sortedByHighest:u}),a>l/2||u.length<3?e:dR(t.map((t=>[t[0].filter((t=>t!=s)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function fR(t){const e=dR(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class mR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size&&t.length>0&&t.length===e.length}getValidVotes(){return this.votes.filter((t=>mR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=fR(t);return e.choices.map(((t,e)=>r.filter((t=>Number(t[0])===e+1)).reduce(((t,e)=>t+e[1][0]),0)))}(this.getValidVotes(),this.proposal)}getScoresByStrategy(){const t=fR(this.getValidVotes());return this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.filter((t=>Number(t[0])===r+1)).reduce(((t,e)=>t+(e[1][1][i]||0)),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>this.proposal.choices[t-1])).filter(Boolean).map(((t,e)=>`(${YP(e+1)}) ${t}`)).join(", ")}}class pR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return!(!Array.isArray(t)||0===t.length||t.length>e.length||new Set(t).size!==t.length)&&t.every((t=>Number.isInteger(t)&&t>=1&&t<=e.length))}getValidVotes(){return this.votes.filter((t=>pR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=Array.from({length:e},(()=>Array(e).fill(0))),i=this.getScoresTotal();for(const e of t)for(let t=0;t<e.choice.length;t++)for(let i=t+1;i<e.choice.length;i++){const n=e.choice[t]-1,o=e.choice[i]-1;r[n][o]+=e.balance,r[o][n]-=e.balance}const n=Array(e).fill(0);let o=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++)if(t!==i){const e=r[t][i];e>0?n[t]++:e<0?n[i]++:(n[t]+=.5,n[i]+=.5)}return o=n.reduce(((t,e)=>t+e),0),o>0?n.map((t=>t/o*i)):n.map((()=>i/e))}getScoresByStrategy(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=this.strategies.length,i=Array.from({length:e},(()=>Array.from({length:e},(()=>Array(r).fill(0))))),n=Array(r).fill(0);for(const e of t)for(let t=0;t<r;t++)n[t]+=e.scores[t];for(const e of t)for(let t=0;t<e.choice.length;t++)for(let n=t+1;n<e.choice.length;n++){const o=e.choice[t]-1,a=e.choice[n]-1;for(let t=0;t<r;t++)i[o][a][t]+=e.scores[t],i[a][o][t]-=e.scores[t]}const o=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<e;t++)for(let n=0;n<e;n++)if(t!==n)for(let e=0;e<r;e++){const r=i[t][n][e];r>0?o[t][e]++:r<0?o[n][e]++:(o[t][e]+=.5,o[n][e]+=.5)}const a=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<r;t++){let r=0;for(let i=0;i<e;i++)r+=o[i][t];if(r>0)for(let i=0;i<e;i++)a[i][t]=o[i][t]/r*n[t];else if(n[t]>0)for(let r=0;r<e;r++)a[r][t]=n[t]/e}return a}getScoresTotal(){return this.getValidVotes().reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>this.proposal.choices[t-1])).join(", ")}}function gR(t,e,r){const i=r.reduce(((t,e)=>t+e),0),n=e[t]/i*100;return isNaN(n)?0:n}function yR(t,e,r){return gR(t+1,e,Object.values(e))/100*r}class wR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>wR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>yR(e,t.choice,t.balance))).reduce(((t,e)=>t+e),0))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((e,r)=>gR(r,t,t))).map((t=>e/100*t))}getScoresByStrategy(){const t=this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().map((t=>yR(e,t.choice,t.scores[r]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[t])))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((r,i)=>this.strategies.map(((e,r)=>gR(0,t[i][r],t.flat(2)))).map((t=>[e/100*t])).flat()))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1])return`${Math.round(10*gR(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var vR={"single-choice":oR,approval:aR,quadratic:cR,"ranked-choice":mR,copeland:pR,weighted:wR,basic:oR};const bR={1:"https://subgrapher.snapshot.org/delegation/1",10:"https://subgrapher.snapshot.org/delegation/10",56:"https://subgrapher.snapshot.org/delegation/56",100:"https://subgrapher.snapshot.org/delegation/100",137:"https://subgrapher.snapshot.org/delegation/137",146:"https://subgrapher.snapshot.org/delegation/146",250:"https://subgrapher.snapshot.org/delegation/250",5e3:"https://subgrapher.snapshot.org/delegation/5000",8453:"https://subgrapher.snapshot.org/delegation/8453",42161:"https://subgrapher.snapshot.org/delegation/42161",59144:"https://subgrapher.snapshot.org/delegation/59144",81457:"https://subgrapher.snapshot.org/delegation/81457",84532:"https://subgrapher.snapshot.org/delegation/84532",11155111:"https://subgrapher.snapshot.org/delegation/11155111"},kR=1e3;function MR(t){return t.length===kR&&t[0].timestamp===t[t.length-1].timestamp}function _R(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function ER(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function AR(t){return r(this,arguments,void 0,(function*({url:t,spaces:e,pivot:r,snapshot:i}){const n={delegations:{__args:{where:{timestamp_gte:r},first:kR,skip:0,orderBy:"timestamp",orderDirection:"asc"},delegator:!0,space:!0,delegate:!0,timestamp:!0}};return"latest"!==i&&(n.delegations.__args.block={number:i}),null!==e&&(n.delegations.__args.where.space_in=e),(yield FP(t,n)).delegations||[]}))}const jR=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"];function xR(t,e){if(!e||!e.outputs||!Array.isArray(t)||0===t.length)return t;const r=e.outputs,i=[];let n=0;try{for(let e=0;e<r.length;e++){const o=r[e],a=t[n];switch(o.type){case"core::felt252":try{i.push(FN.decodeShortString(a))}catch(t){i.push(a)}n++;break;case"core::integer::u8":case"core::integer::u16":case"core::integer::u32":case"core::integer::u64":case"core::integer::i8":case"core::integer::i16":case"core::integer::i32":case"core::integer::i64":i.push(parseInt(a,16)),n++;break;case"core::integer::u128":case"core::integer::usize":case"core::integer::i128":i.push(BigInt(a).toString()),n++;break;case"core::integer::u256":i.push(Lz.uint256ToBN({low:a,high:t[n+1]||"0x0"})),n+=2;break;case"core::bool":i.push("0x1"===a||"0x01"===a),n++;break;default:i.push(a),n++}}return i}catch(e){return t}}const SR=t=>{if(0===t.length)return[];const[e,...r]=t,i=Number(uN.toBigInt(e)),n=r.slice(0,i),o=r.slice(i);return[n,...SR(o)]};var NR="__lodash_hash_undefined__",IR="[object Function]",TR="[object GeneratorFunction]",CR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zR=/^\w*$/,OR=/^\./,RR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PR=/\\(\\)?/g,BR=/^\[object .+?Constructor\]$/,DR=/^(?:0|[1-9]\d*)$/,$R="object"==typeof i&&i&&i.Object===Object&&i,LR="object"==typeof self&&self&&self.Object===Object&&self,UR=$R||LR||Function("return this")();var FR,qR=Array.prototype,VR=Function.prototype,HR=Object.prototype,GR=UR["__core-js_shared__"],ZR=(FR=/[^.]+$/.exec(GR&&GR.keys&&GR.keys.IE_PROTO||""))?"Symbol(src)_1."+FR:"",KR=VR.toString,JR=HR.hasOwnProperty,WR=HR.toString,YR=RegExp("^"+KR.call(JR).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),QR=UR.Symbol,XR=qR.splice,tP=dP(UR,"Map"),eP=dP(Object,"create"),rP=QR?QR.prototype:void 0,iP=rP?rP.toString:void 0;function nP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function oP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function aP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function sP(t,e,r){var i=t[e];JR.call(t,e)&&yP(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function hP(t,e){for(var r=t.length;r--;)if(yP(t[r][0],e))return r;return-1}function uP(t){if(!vP(t)||(e=t,ZR&&ZR in e))return!1;var e,r=function(t){var e=vP(t)?WR.call(t):"";return e==IR||e==TR}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?YR:BR;return r.test(function(t){if(null!=t){try{return KR.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function lP(t,e,r,i){if(!vP(t))return t;e=function(t,e){if(wP(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||bP(t))return!0;return zR.test(t)||!CR.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return wP(t)?t:mP(t)}(e);for(var n=-1,o=e.length,a=o-1,s=t;null!=s&&++n<o;){var h=pP(e[n]),u=r;if(n!=a){var l=s[h];void 0===(u=i?i(l,h,s):void 0)&&(u=vP(l)?l:fP(e[n+1])?[]:{})}sP(s,h,u),s=s[h]}return t}function cP(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function dP(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return uP(r)?r:void 0}function fP(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||DR.test(t))&&t>-1&&t%1==0&&t<e}nP.prototype.clear=function(){this.__data__=eP?eP(null):{}},nP.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},nP.prototype.get=function(t){var e=this.__data__;if(eP){var r=e[t];return r===NR?void 0:r}return JR.call(e,t)?e[t]:void 0},nP.prototype.has=function(t){var e=this.__data__;return eP?void 0!==e[t]:JR.call(e,t)},nP.prototype.set=function(t,e){return this.__data__[t]=eP&&void 0===e?NR:e,this},oP.prototype.clear=function(){this.__data__=[]},oP.prototype.delete=function(t){var e=this.__data__,r=hP(e,t);return!(r<0)&&(r==e.length-1?e.pop():XR.call(e,r,1),!0)},oP.prototype.get=function(t){var e=this.__data__,r=hP(e,t);return r<0?void 0:e[r][1]},oP.prototype.has=function(t){return hP(this.__data__,t)>-1},oP.prototype.set=function(t,e){var r=this.__data__,i=hP(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},aP.prototype.clear=function(){this.__data__={hash:new nP,map:new(tP||oP),string:new nP}},aP.prototype.delete=function(t){return cP(this,t).delete(t)},aP.prototype.get=function(t){return cP(this,t).get(t)},aP.prototype.has=function(t){return cP(this,t).has(t)},aP.prototype.set=function(t,e){return cP(this,t).set(t,e),this};var mP=gP((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(bP(t))return iP?iP.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return OR.test(t)&&r.push(""),t.replace(RR,(function(t,e,i,n){r.push(i?n.replace(PR,"$1"):e||t)})),r}));function pP(t){if("string"==typeof t||bP(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function gP(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var a=t.apply(this,i);return r.cache=o.set(n,a),a};return r.cache=new(gP.Cache||aP),r}function yP(t,e){return t===e||t!=t&&e!=e}gP.Cache=aP;var wP=Array.isArray;function vP(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function bP(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==WR.call(t)}var kP=function(t,e,r){return null==t?t:lP(t,e,r)};const MP={evm:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=new os(t,jR,e),s=new gi(r);try{const t=Math.ceil(i.length/n),e=[];Array.from(Array(t)).forEach(((t,r)=>{const h=i.slice(n*r,n*(r+1));e.push(a.aggregate(h.map((t=>[t[0].toLowerCase(),s.encodeFunctionData(t[1],t[2])])),o))}));let r=yield Promise.all(e);return r=r.reduce(((t,[,e])=>t.concat(e)),[]),r.map(((t,e)=>s.decodeFunctionResult(i[e][1],t)))}catch(t){return Promise.reject(t)}}))},starknet:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=i.map((t=>({contractAddress:t[0],entrypoint:t[1],calldata:t[2]||[]}))),s=[];for(let t=0;t<a.length;t+=n)s.push(a.slice(t,t+n));return(yield Promise.all(s.map((r=>{var i;return e.callContract({contractAddress:t,entrypoint:"aggregate",calldata:zC.fromCallsToExecuteCalldata(r)},null!==(i=o.blockTag)&&void 0!==i?i:"latest")})))).map((t=>{const[e,r,...i]=t;return SR(i)})).flat().map(((t,e)=>{const[,n]=i[e];return xR(t,r.find((t=>t.name===n)))}))}))}};function _P(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){var o;const a=(null==n?void 0:n.multicallAddress)||yO[t].multicall;if(!a)throw new Error("missing multicall address");const s=Object.assign({},n),h=(null==s?void 0:s.limit)||500;delete s.limit,delete s.multicallAddress;const u=(null===(o=yO[t])||void 0===o?void 0:o.starknet)?"starknet":"evm";return MP[u](a,e,r,i,h,s)}))}const EP=["response not found during CCIP fetch","UNSUPPORTED_OPERATION"],AP="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",jP=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],xP={146:{tlds:[".sonic"],registryContract:"0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4"}},SP=["function ownerOf(uint256 tokenId) view returns (address owner)"],NP=["1","11155111"],IP=["109","157"],TP="0x0000000000000000000000000000000000000000",CP={Accept:"application/json","Content-Type":"application/json"},zP="https://score.snapshot.org";function OP(t=zP,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const i=r.searchParams.get("apiKey");let n=Object.assign({},CP);return i&&(r.searchParams.delete("apiKey"),n=Object.assign(Object.assign({},CP),{"X-API-KEY":i})),{url:r.toString(),headers:n}}function RP(t){return r(this,void 0,void 0,(function*(){let e=yield t.text();try{e=JSON.parse(e)}catch(r){return Promise.reject({code:t.status||500,message:"Failed to parse response from score API",data:e})}return e.error?Promise.reject(e.error):e}))}const PP=new vd({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});_d(PP),Ad(PP),PP.addFormat("address",{validate:t=>{try{return t===nr(t)}catch(t){return!1}}}),PP.addFormat("evmAddress",{validate:t=>{try{return nr(t),!0}catch(t){return!1}}}),PP.addFormat("starknetAddress",{validate:t=>{try{return Vz(t).toLowerCase()===t.toLowerCase()}catch(t){return!1}}}),PP.addFormat("long",{validate:()=>!0}),PP.addFormat("lowercase",{validate:t=>t===t.toLowerCase()}),PP.addFormat("color",{validate:t=>!!t&&!!t.match(/^#[0-9A-F]{6}$/)}),PP.addFormat("ethValue",{validate:t=>{if(!t.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/))return!1;try{return function(t,e){if("string"!=typeof t&&ah.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=sh.indexOf(e);-1!==t&&(e=3*t)}Hs(t,null!=e?e:18)}(t,18),!0}catch(t){return!1}}});const BP=Object.keys(yO),DP=Object.keys(yO).filter((t=>!yO[t].testnet));function $P(t){const e=t.endsWith(".eth"),r=t.split(".");if(1===r.length)return"tld";if(2!==r.length||e){if(r.length>2)return"subdomain";if(e)return"ens";throw new Error("Invalid domain")}return"other-tld"}function LP(t){return r(this,void 0,void 0,(function*(){var e;const r=yield VP(`https://cloudflare-dns.com/dns-query?name=${t}&type=TXT`,{headers:{accept:"application/dns-json"}}),i=yield r.json();if(3===i.Status)return TP;if(0!==i.Status)throw new Error("Failed to fetch DNS Owner");const n=null===(e=i.Answer)||void 0===e?void 0:e.find((t=>t.data.includes("ENS1")));return n?nr(n.data.replace(new RegExp('"',"g"),"").split(" ").pop()):TP}))}function UP(t,e,i,n){return r(this,void 0,void 0,(function*(){const r=new os(i[0],e,t);try{const t=i[2]||[];return yield r[i[1]](...t,n||{})}catch(t){return Promise.reject(t)}}))}function FP(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i={query:Hu.jsonToGraphQLQuery({query:e})};r.variables&&(i.variables=r.variables);const n=yield VP(t,{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},null==r?void 0:r.headers),body:JSON.stringify(i)});let o=yield n.text();try{o=JSON.parse(o)}catch(e){throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${o.substring(0,400)}`)}if(o.errors)throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${JSON.stringify(o.errors).substring(0,400)}`);const{data:a}=o;return a||{}}))}function qP(t,e=nR[0]){const r=`https://${e}`;if(!t)return null;if(!(t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("https://")||t.startsWith("http://")))return`${r}/ipfs/${t}`;const i=t.split("://")[0];return"ipfs"===i?t.replace("ipfs://",`${r}/ipfs/`):"ipns"===i?t.replace("ipns://",`${r}/ipns/`):t}function VP(t){return r(this,arguments,void 0,(function*(t,r={}){const{timeout:i=3e4}=r,n=e(r,["timeout"]);if(i>0){const e=new AbortController,r=setTimeout((()=>e.abort()),i);try{return yield h(t,Object.assign(Object.assign({},n),{signal:e.signal}))}catch(t){if(t instanceof Error&&"AbortError"===t.name)throw new Error(`Request timeout after ${i}ms`);throw t}finally{clearTimeout(r)}}const o=e(n,["signal"]);return h(t,o)}))}function HP(t,i){return r(this,arguments,void 0,(function*(t,r,i="1",n={}){var o,a;const{ensResolvers:s=(null===(o=yO[i])||void 0===o?void 0:o.ensResolvers)||yO[1].ensResolvers,broviderUrl:h}=n,u=e(n,["ensResolvers","broviderUrl"]);let l;try{l=cu(lu(t))}catch(t){return null}const c=bO(i,{broviderUrl:h}),d=[[AP,"resolver",[l]],...s.map((t=>[t,"text",[l,r]]))],[[f],...m]=yield _P(i,c,jP,d,u),p=s.indexOf(f);return-1!==p?null===(a=m[p])||void 0===a?void 0:a[0]:null}))}function GP(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield HP(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function ZP(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){var i,n;if(!(null===(n=null===(i=yO[e])||void 0===i?void 0:i.ensResolvers)||void 0===n?void 0:n.length))throw new Error("Network not supported");const o=$P(t),a=bO(e,r),s=new os(AP,["function owner(bytes32) view returns (address)"],a);let h;try{h=cu(lu(t))}catch(t){return TP}const u=r.ensNameWrapper||yO[e].ensNameWrapper;let l=yield s.owner(h);if(l===u){const t=new os(u,["function ownerOf(uint256) view returns (address)"],a);l=yield t.ownerOf(h)}if(l===TP&&"other-tld"===o){(yield a.resolveName(t))&&(l=yield LP(t))}if(l===TP&&"subdomain"===o)try{l=yield a.resolveName(t)}catch(t){if(EP.every((e=>!t.message.includes(e))))throw t;l=TP}return l||TP}))}function KP(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i=yield GP(t,e,r);if(i){if(or(i))return nr(i);const t=i.split("/"),e=t.includes("testnet")?5:4,r=t[e];if(or(r))return nr(r)}return yield ZP(t,e,r)}))}function JP(t,e){return r(this,void 0,void 0,(function*(){if(!t.endsWith(".shib"))return TP;const r=yield VP("https://stamp.fyi",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"get_owner",params:t,network:e})});return(yield r.json()).result}))}function WP(t,e){return r(this,void 0,void 0,(function*(){var r;if(!((null===(r=xP[e])||void 0===r?void 0:r.tlds)||[]).some((e=>t.endsWith(e))))return Promise.resolve(TP);try{const r=cu(lu(t)),i=BigInt(r),n=bO(e);return yield UP(n,SP,[xP[e].registryContract,"ownerOf",[i]],{blockTag:"latest"})}catch(t){return TP}}))}function YP(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function QP(t){return!!yO[t]}function XP(t){return t!==TP&&(or(t)||eB(t))}function tB(t,e){return"latest"===t||"number"==typeof t&&t>=yO[e].start}function eB(t){if(!t)return!1;try{return Vz(t),!0}catch(t){return!1}}function rB(t){return or(t)}function iB(t,e){if("string"!=typeof t||!/^0[xX]/.test(t))throw new Error(`Invalid address: ${t}`);const r=null!=e?e:42===t.length?"evm":"starknet";if("evm"===r&&rB(t))return nr(t);if("starknet"===r&&eB(t))return Vz(t);throw new Error(`Invalid ${r} address: ${t}`)}function nB(t){return Promise.reject(new Error(t))}PP.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?DP.includes(e):BP.includes(e)},error:{message:"network not allowed"}}),PP.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))}),PP.addFormat("domain",{validate:t=>!!t&&!!t.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(\/)?$/)});var oB={call:UP,multicall:_P,fetch:VP,subgraphRequest:FP,ipfsGet:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="ipfs"){return VP(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:qP,getJSON:function(t){return r(this,arguments,void 0,(function*(t,e={}){const r=qP(t,e.gateways);return(yield VP(r,e)).json()}))},sendTransaction:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=t.getSigner(),s=new os(e,r,t).connect(a);return yield s[i](...n,o)}))},getScores:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n="latest",o=zP,a={}){if(!Array.isArray(i))return nB("addresses should be an array of addresses");if(0===i.length)return nB("addresses can not be empty");const s=i.find((t=>!XP(t)));if(s)return nB(`Invalid address: ${s}`);if(!QP(r))return nB(`Invalid network: ${r}`);const h=e.find((t=>t.network&&!QP(t.network)));if(h)return nB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!tB(n,r))return nB(`Snapshot (${n}) must be 'latest' or greater than network start block (${yO[r].start})`);new URL(o).pathname="/api/scores";const{url:u,headers:l}=OP(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:n,strategies:e,addresses:i},s=yield VP(u,{method:"POST",headers:l,body:JSON.stringify({params:o})}),h=yield RP(s);return"all"===a.returnValue?h.result:h.result[a.returnValue||"scores"]}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},getVp:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){const{url:r,headers:a}=OP(null==s?void 0:s.url);if(!XP(t))return nB(`Invalid voter address: ${t}`);if(!QP(e))return nB(`Invalid network: ${e}`);const h=i.find((t=>t.network&&!QP(t.network)));if(h)return nB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!tB(n,e))return nB(`Snapshot (${n}) must be 'latest' or greater than network start block (${yO[e].start})`);const u={method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",method:"get_vp",params:{address:t,network:e,strategies:i,snapshot:n,space:o}})};try{const t=yield VP(r,u);return(yield RP(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},validateSchema:function(t,e,r={snapshotEnv:"default",spaceType:"default"}){const i=PP.compile(t),n=i.call(r,e);return n||i.errors},getEnsTextRecord:HP,getSpaceUri:GP,getEnsOwner:ZP,getSpaceController:function(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){if(NP.includes(e))return KP(t,e,r);if(IP.includes(e))return JP(t,e);if(xP[String(e)])return WP(t,e);throw new Error(`Network not supported: ${e}`)}))},getDelegatesBySpace:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="latest",i={}){const n=i.subgraphUrl||bR[t];if(!n)return Promise.reject(`Delegation subgraph not available for network ${t}`);let o=0;const a=new Map,s=e?ER(e):null;for(;;){const t=yield AR({url:n,spaces:s,pivot:o,snapshot:r});if(MR(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{_R(a,t),o=t.timestamp})),t.length<kR)break}return[...a.values()]}))},clone:function(t){return JSON.parse(JSON.stringify(t))},sleep:function(t){return r(this,void 0,void 0,(function*(){return new Promise((e=>{setTimeout(e,t)}))}))},getNumberWithOrdinal:YP,voting:vR,getProvider:bO,signMessage:function(t,e,i){return r(this,void 0,void 0,(function*(){return e=Tt(new _(e,"utf8")),yield t.send("personal_sign",[e,i])}))},getBlockNumber:function(t){return r(this,void 0,void 0,(function*(){try{const e=yield t.getBlockNumber();return parseInt(e)}catch(t){return Promise.reject()}}))},Multicaller:class{constructor(t,e,r,i={}){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=i}call(t,e,r,i){return this.calls.push([e,r,i]),this.paths.push(t),this}execute(t){return r(this,void 0,void 0,(function*(){const e=t||{};return(yield _P(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>kP(e,this.paths[r],t.length>1?t:t[0]))),this.calls=[],this.paths=[],e}))}},getSnapshots:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){const o={};if(i.forEach((t=>o[t]="latest")),"latest"===e)return o;const a=`${t}-${e}-${i.join("-")}`,s=jd[a],h=Date.now();if(s&&xd>h)return s;xd<h&&(jd={},xd=h+36e5-h%36e5),o[t]=e;const u=Object.keys(o).filter((e=>t!==e));if(0===u.length)return o;const l={blocks:{__args:{where:{ts:(yield r.getBlock(e)).timestamp,network_in:u}},network:!0,number:!0}},c=n.blockFinderUrl||"https://blockfinder.snapshot.org";return(yield FP(c,l)).blocks.forEach((t=>o[t.network]=t.number)),jd[a]=o,o}))},getHash:function(t,e){return(kO(t)?MO:iR).getHash(t,e)},verify:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){if(!eB(t)&&!rB(t))throw new Error("Invalid address");const o=kO(r)?MO:iR;return yield o.default(t,e,r,i,n)}))},validate:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){if(!XP(e))return nB(`Invalid author: ${e}`);if(!QP(n))return nB(`Invalid network: ${n}`);if(!tB(o,n))return nB(`Snapshot (${o}) must be 'latest' or greater than network start block (${yO[n].start})`);s||(s={});const{url:r,headers:h}=OP(s.url),u={method:"POST",headers:h,body:JSON.stringify({jsonrpc:"2.0",method:"validate",params:{validation:t,author:e,space:i,network:n,snapshot:o,params:a}})};try{const t=yield VP(r,u);return(yield RP(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:eB,isEvmAddress:rB,getFormattedAddress:iB,SNAPSHOT_SUBGRAPH_URL:bR};const aB={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},sB={Proposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"privacy",type:"string"},{name:"app",type:"string"}]},hB={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"plugins",type:"string"},{name:"privacy",type:"string"}]},uB={FlagProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},lB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},cB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},dB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},fB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},mB={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},pB={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},gB={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},yB={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},wB={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},vB={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},bB={Statement:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"space",type:"string"},{name:"about",type:"string"},{name:"statement",type:"string"},{name:"discourse",type:"string"},{name:"status",type:"string"},{name:"network",type:"string"}]},kB={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},MB={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var _B={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},EB={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},AB={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const jB={name:"snapshot",version:"0.1.4"};class xB{constructor(t=_B.sequencer,e={}){t=(t=(t=t.replace(_B.hub,_B.sequencer)).replace(EB.hub,EB.sequencer)).replace(AB.hub,AB.sequencer),this.address=t,this.options=e}sign(t,e,i,n){return r(this,void 0,void 0,(function*(){var r;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,a=iB(e,"evm");i.from=i.from?iB(i.from):a,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const s=Object.assign({},jB);"undefined"!=typeof window&&(null===(r=window.ethereum)||void 0===r?void 0:r.isTrust)&&(s.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:s,types:n,message:i},u=yield o._signTypedData(s,h.types,i);return yield this.send({address:a,sig:u,data:h})}))}send(t){return r(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,i)=>{VP(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(i).catch(i);throw e})).catch(i)}))}))}space(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,aB)}))}proposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.labels||(i.labels=[]),i.discussion||(i.discussion=""),i.app||(i.app=""),i.privacy||(i.privacy=""),yield this.sign(t,e,i,sB)}))}updateProposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.privacy||(i.privacy=""),yield this.sign(t,e,i,hB)}))}flagProposal(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,uB)}))}cancelProposal(t,e,i){return r(this,void 0,void 0,(function*(){const r=i.proposal.startsWith("0x");return yield this.sign(t,e,i,r?cB:lB)}))}vote(t,e,i){return r(this,void 0,void 0,(function*(){const r="shutter"===(null==i?void 0:i.privacy);i.reason||(i.reason=""),i.app||(i.app=""),i.metadata||(i.metadata="{}");let n=dB;return["approval","ranked-choice"].includes(i.type)&&(n=fB),!r&&["quadratic","weighted"].includes(i.type)&&(n=mB,i.choice=JSON.stringify(i.choice)),r&&(n=mB),delete i.privacy,delete i.type,yield this.sign(t,e,i,n)}))}follow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,pB)}))}unfollow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,gB)}))}subscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,yB)}))}unsubscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,wB)}))}profile(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,vB)}))}statement(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,bB)}))}alias(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,kB)}))}deleteSpace(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,MB)}))}}var SB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","copeland","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24},privacy:{type:"string",enum:["","shutter"]}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},NB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"},privacy:{type:"string",enum:["","shutter"]}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},IB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:5e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},TB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},CB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},zB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},OB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}};return{Client:xB,Client712:xB,schemas:{space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},farcaster:{type:"string",title:"farcaster"},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1},symbol:{type:"string",title:"symbol",maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64,format:"domain"},discussions:{type:"string",format:"uri",title:"Discussions link",maxLength:256},discourseCategory:{type:"integer",minimum:1,title:"Discourse category"},strategies:{type:"array",minItems:1,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"},{const:"apechain-delegate-registry",title:"ApeChain Delegate Registry"}]},delegationContract:{type:"string",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},delegationNetwork:{type:"string",title:"Delegation network",description:"The network of your delegation contract",snapshotNetwork:!0},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:31622400,errorMessage:{maximum:"Delay must be less than a year"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter","any"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector","ai-agent","gaming","wallet","music","layer-2","defai","defi","rwa","depin","meme"]}},treasuries:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},network:{type:"string",title:"Network",snapshotNetwork:!0}},required:["name","address","network"],additionalProperties:!1}},labels:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{id:{type:"string",title:"Id",minLength:1,maxLength:8},name:{type:"string",title:"Name",minLength:1,maxLength:32},description:{type:"string",title:"Description",maxLength:100},color:{type:"string",title:"Color",format:"color"}},required:["id","name","color"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1},skinSettings:{type:"object",properties:{bg_color:{type:"string",format:"color"},link_color:{type:"string",format:"color"},text_color:{type:"string",format:"color"},content_color:{type:"string",format:"color"},border_color:{type:"string",format:"color"},heading_color:{type:"string",format:"color"},primary_color:{type:"string",format:"color"},header_color:{type:"string",format:"color"},theme:{type:"string",enum:["light","dark"]},logo:{type:"string",title:"logo",format:"customUrl",maxLength:256}},additionalProperties:!1}},required:["name","network","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:SB.definitions.Proposal,updateProposal:NB.definitions.UpdateProposal,vote:IB.definitions.Vote,profile:TB.definitions.Profile,statement:CB.definitions.Statement,zodiac:zB.definitions.Zodiac,alias:OB.definitions.Alias},utils:oB}}));