@snapshot-labs/snapshot.js 0.14.9 → 0.14.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/snapshot.cjs.js +155 -57
- package/dist/snapshot.esm.js +155 -57
- package/dist/snapshot.min.js +1 -1
- package/dist/src/multicall/starknet.d.ts +1 -1
- package/dist/src/voting/rankedChoice.d.ts +64 -0
- package/package.json +1 -1
- package/src/multicall/starknet.ts +70 -58
- package/src/networks.json +2 -2
- package/src/voting/rankedChoice.spec.js +172 -4
- package/src/voting/rankedChoice.ts +87 -7
package/dist/snapshot.min.js
CHANGED
|
@@ -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]/,FA={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},UA=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=FA[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():UA)-(e.creation?e.creation.getTime():UA),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(UA):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 Fj(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 Uj(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 Fj(o,a,h):h;var l}return o.toughCookie=Oj,o}Uj.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},Cx={};Ix(Cx,{ADDR_BOUND:()=>yS,API_VERSION:()=>mS,BaseUrl:()=>MS,DEFAULT_GLOBAL_CONFIG:()=>RS,FeeMarginPercentage:()=>jS,HARDENING_4BYTES:()=>OS,HARDENING_BYTE:()=>zS,IS_BROWSER:()=>Jx,MASK_250:()=>dS,MASK_31:()=>fS,MAX_STORAGE_ITEM_SIZE:()=>gS,NetworkName:()=>_S,OutsideExecutionCallerAny:()=>IS,PRIME:()=>pS,RANGE_FELT:()=>vS,RANGE_I128:()=>bS,RANGE_U128:()=>kS,RPC_DEFAULT_VERSION:()=>SS,RPC_NODES:()=>NS,SNIP9_V1_INTERFACE_ID:()=>TS,SNIP9_V2_INTERFACE_ID:()=>CS,SYSTEM_MESSAGES:()=>PS,StarknetChainId:()=>ES,TEXT_TO_FELT_MAX_LEN:()=>lS,TRANSACTION_VERSION:()=>zx.ETransactionVersion,TransactionHashPrefix:()=>AS,UDC:()=>xS,ZERO:()=>cS});var zx={};Ix(zx,{JRPC:()=>Ox,RPCSPEC06:()=>Rx,RPCSPEC07:()=>qm});var Ox={},Rx={};Ix(Rx,{EBlockTag:()=>qx,EDAMode:()=>Hx,EDataAvailabilityMode:()=>Vx,ESimulationFlag:()=>$x,ETransactionExecutionStatus:()=>Ux,ETransactionFinalityStatus:()=>Fx,ETransactionStatus:()=>Lx,ETransactionType:()=>Dx,ETransactionVersion:()=>Gx,ETransactionVersion2:()=>Zx,ETransactionVersion3:()=>Kx,Errors:()=>Px,SPEC:()=>Bx});var Px={},Bx={},Dx={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},$x={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},Lx={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Fx={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Ux={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},qx={PENDING:"pending",LATEST:"latest"},Vx={L1:"L1",L2:"L2"},Hx={L1:0,L2:1},Gx={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},Zx={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},Kx={V3:"0x3",F3:"0x100000000000000000000000000000003"};((t,e,r)=>{Tx(t,e,"default"),r&&Tx(r,e,"default")})(zx,qm);Ix({},{IS_BROWSER:()=>Jx,addHexPrefix:()=>iS,arrayBufferToString:()=>Wx,atobUniversal:()=>Xx,btoaUniversal:()=>tS,buf2hex:()=>eS,calcByteLength:()=>oS,concatenateArrayBuffer:()=>uS,padLeft:()=>nS,pascalToSnake:()=>hS,removeHexPrefix:()=>rS,sanitizeBytes:()=>aS,sanitizeHex:()=>sS,stringToArrayBuffer:()=>Qx,utf8ToArray:()=>Yx});var Jx="undefined"!=typeof window;function Wx(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function Yx(t){return(new TextEncoder).encode(t)}function Qx(t){return Yx(t)}function Xx(t){return lp.decode(t)}function tS(t){return lp.encode(new Uint8Array(t))}function eS(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function rS(t){return t.replace(/^0x/i,"")}function iS(t){return`0x${rS(t)}`}function nS(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 oS(t,e=8){const{length:r}=t,i=r%e;return i?(r-i)/e*e+e:r}function aS(t,e=8,r="0"){return nS(t,oS(t,e),r)}function sS(t){const e=aS(rS(t),2);return e?iS(e):e}var hS=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function uS(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 lS=31,cS=0n,dS=2n**250n-1n,fS=2n**31n-1n,mS=cS,pS=2n**251n+17n*2n**192n+1n,gS=256n,yS=2n**251n-gS,wS=(t,e)=>({min:t,max:e}),vS=wS(cS,pS-1n),bS=wS(-(2n**127n),2n**127n-1n),kS=wS(cS,2n**128n-1n),MS=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_SEPOLIA="https://alpha-sepolia.starknet.io",t))(MS||{}),_S=(t=>(t.SN_MAIN="SN_MAIN",t.SN_SEPOLIA="SN_SEPOLIA",t))(_S||{}),ES=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_SEPOLIA="0x534e5f5345504f4c4941",t))(ES||{}),AS=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(AS||{}),jS=(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))(jS||{}),xS={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},SS="v0_7",NS={SN_MAIN:[`https://starknet-mainnet.public.blastapi.io/rpc/${SS}`,`https://free-rpc.nethermind.io/mainnet-juno/${SS}`],SN_SEPOLIA:[`https://starknet-sepolia.public.blastapi.io/rpc/${SS}`,`https://free-rpc.nethermind.io/sepolia-juno/${SS}`]},IS="0x414e595f43414c4c4552",TS="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",CS="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",zS=128,OS=2147483648n,RS={legacyMode:!1,logLevel:"INFO",accountTxVersion:zx.ETransactionVersion.V2},PS={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"},BS={};Ix(BS,{RpcChannel:()=>HC});Ix({},{parse:()=>$S,parseAlwaysAsBig:()=>LS,stringify:()=>FS,stringifyAlwaysAsBig:()=>US});var DS=t=>{if(!yp(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},$S=t=>zp(String(t),void 0,DS),LS=t=>zp(String(t),void 0,Ip),FS=(t,e,r,i)=>dg(t,e,r,i),US=FS,qS={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 VS=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)}},HS=class extends VS{},GS=class extends HS{constructor(t,e,r){super(`RPC: ${e} with params ${FS(r,null,2)}\n\n ${t.code}: ${t.message}: ${FS(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return qS[t]===this.code}};Ix({},{BlockStatus:()=>QS,BlockTag:()=>XS,ETH_ADDRESS:()=>iN,EntryPointType:()=>ZS,Literal:()=>rN,NON_ZERO_PREFIX:()=>nN,OutsideExecutionTypesV1:()=>oN,OutsideExecutionTypesV2:()=>aN,OutsideExecutionVersion:()=>sN,RPC:()=>zx,TransactionExecutionStatus:()=>YS,TransactionFinalityStatus:()=>WS,TransactionStatus:()=>JS,TransactionType:()=>KS,TypedDataRevision:()=>Fm,Uint:()=>eN,ValidateType:()=>tN});var ZS={EXTERNAL:"EXTERNAL",L1_HANDLER:"L1_HANDLER",CONSTRUCTOR:"CONSTRUCTOR"},KS={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE_FUNCTION"},JS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",REJECTED:"REJECTED",REVERTED:"REVERTED"},WS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},YS={REJECTED:"REJECTED",REVERTED:"REVERTED",SUCCEEDED:"SUCCEEDED"},QS={PENDING:"PENDING",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",REJECTED:"REJECTED"},XS={PENDING:"pending",LATEST:"latest"},tN={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},eN={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"},rN={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>"},iN="core::starknet::eth_address::EthAddress",nN="core::zeroable::NonZero::",oN={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*"}]},aN={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*"}]},sN=(t=>(t.UNSUPPORTED="0",t.V1="1",t.V2="2",t))(sN||{}),hN=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:FS(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 uN(t,e){if(!t)throw new Error(e||"Assertion failure")}var lN={};Ix(lN,{addPercent:()=>ON,assertInRange:()=>AN,bigNumberishArrayToDecimalStringArray:()=>jN,bigNumberishArrayToHexadecimalStringArray:()=>xN,cleanHex:()=>EN,getDecimalString:()=>NN,getHexString:()=>IN,getHexStringArray:()=>TN,hexToBytes:()=>zN,hexToDecimalString:()=>_N,isBigNumberish:()=>PN,isHex:()=>yN,isStringWholeNumber:()=>SN,stringToSha256ToArrayBuff4:()=>RN,toBigInt:()=>wN,toCairoBool:()=>CN,toHex:()=>vN,toHex64:()=>MN,toHexString:()=>bN,toStorageKey:()=>kN});var cN=t=>void 0===t||void 0===t;function dN(t){return"number"==typeof t}function fN(t){return"boolean"==typeof t}function mN(t){return"bigint"==typeof t}function pN(t){return"string"==typeof t}function gN(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function yN(t){return/^0x[0-9a-f]*$/i.test(t)}function wN(t){return BigInt(t)}function vN(t){return iS(wN(t).toString(16))}var bN=vN;function kN(t){return iS(wN(t).toString(16).padStart(64,"0"))}function MN(t){const e=iS(wN(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function _N(t){return BigInt(iS(t)).toString(10)}function EN(t){return t.toLowerCase().replace(/^(0x)0+/,"$1")}function AN(t,e,r,i=""){const n=""===i?"invalid length":`invalid ${i} length`,o=BigInt(t),a=BigInt(e),s=BigInt(r);uN(o>=a&&o<=s,`Message not signable, ${n}.`)}function jN(t){return t.map((t=>wN(t).toString(10)))}function xN(t){return t.map((t=>vN(t)))}function SN(t){return/^\d+$/.test(t)}function NN(t){if(yN(t))return _N(t);if(SN(t))return t;throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function IN(t){if(yN(t))return t;if(SN(t))return bN(t);throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function TN(t){return t.map(IN)}function CN(t){return(+t).toString()}function zN(t){if(!yN(t))throw new Error(`${t} needs to be a hex-string`);let e=rS(t);return e.length%2!=0&&(e=`0${e}`),Ig(e)}function ON(t,e){const r=BigInt(t);return r+r*BigInt(e)/100n}function RN(t){var e;return zN(vN((e=BigInt(iS(eS(py(t)))),Number(e&fS))))}function PN(t){return dN(t)||mN(t)||pN(t)&&(yN(t)||SN(t))}function BN(t){const e=rS(vN(BigInt(t))),r=e.length%2==0?e:`0${e}`;return iS(_v(zN(iS(r))).toString(16))}function DN(t){const e=BigInt(function(t){return iS(_v(Yx(t)).toString(16))}(t));return e&dS}function $N(t){return vN(DN(t))}function LN(t){return dN(t)||mN(t)?vN(t):yN(t)?t:SN(t)?vN(t):$N(t)}function FN(t){const e=iS(t.reduce(((t,e)=>t+rS(vN(e)).padStart(64,"0")),""));return iS(bg(Yv(zN(e))))}function UN(t,e,r,i,n){return FN([t,e,n,r,i.length,...i])}Ix({},{getL2MessageHash:()=>UN,getSelector:()=>LN,getSelectorFromName:()=>$N,keccakBn:()=>BN,solidityUint256PackedKeccak256:()=>FN,starknetKeccak:()=>DN});var qN={};function VN(t){return/^[\x00-\x7F]*$/.test(t)}function HN(t){return t.length<=lS}function GN(t){return/^[0-9]*$/i.test(t)}function ZN(t){return pN(t)&&!yN(t)&&!SN(t)}Ix(qN,{decodeShortString:()=>QN,encodeShortString:()=>YN,isASCII:()=>VN,isDecimalString:()=>GN,isLongText:()=>JN,isShortString:()=>HN,isShortText:()=>KN,isText:()=>ZN,splitLongString:()=>WN});var KN=t=>ZN(t)&&HN(t),JN=t=>ZN(t)&&!HN(t);function WN(t){const e=RegExp(`[^]{1,${lS}}`,"g");return t.match(e)||[]}function YN(t){if(!VN(t))throw new Error(`${t} is not an ASCII string`);if(!HN(t))throw new Error(`${t} is too long`);return iS(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function QN(t){if(!VN(t))throw new Error(`${t} is not an ASCII string`);if(yN(t))return rS(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(GN(t))return QN("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}function XN(t){const e=0n===BigInt(t.pending_word)?"":QN(vN(t.pending_word));return t.data.reduce(((t,e)=>t+(0n===BigInt(e)?"":QN(vN(e)))),"")+e}function tI(t){const e=WN(t),r=e[e.length-1],i=e.map(YN),[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:()=>tI,stringFromByteArray:()=>XN});var eI={};function rI(t){if(mN(t)||Number.isInteger(t))return t.toString();if(pN(t)){if(yN(t))return BigInt(t).toString();if(ZN(t)){if(!HN(t))throw new Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(YN(t)).toString()}if(SN(t))return t}if(fN(t))return""+ +t;throw new Error(`${t} can't be computed by felt()`)}Ix(eI,{felt:()=>UI,getAbiContractVersion:()=>DI,getArrayType:()=>RI,isCairo1Abi:()=>PI,isCairo1Type:()=>OI,isLen:()=>pI,isTypeArray:()=>yI,isTypeBool:()=>xI,isTypeByteArray:()=>TI,isTypeBytes31:()=>II,isTypeContractAddress:()=>SI,isTypeEnum:()=>kI,isTypeEthAddress:()=>NI,isTypeFelt:()=>gI,isTypeLiteral:()=>jI,isTypeNamedTuple:()=>vI,isTypeNonZero:()=>BI,isTypeOption:()=>MI,isTypeResult:()=>_I,isTypeSecp256k1Point:()=>zI,isTypeStruct:()=>bI,isTypeTuple:()=>wI,isTypeU96:()=>CI,isTypeUint:()=>EI,isTypeUint256:()=>AI,tuple:()=>FI,uint256:()=>$I,uint512:()=>LI});var iI=(1n<<128n)-1n,nI=(1n<<256n)-1n,oI=0n,aI=340282366920938463463374607431768211455n,sI=340282366920938463463374607431768211455n,hI=0n,uI=0n,lI=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&iI,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<oI)throw Error("bigNumberish is smaller than UINT_256_MIN");if(e>nI)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<hI||r>aI)throw new Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX");if(i<uI||i>sI)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:iS(this.low.toString(16)),high:iS(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[rI(this.low),rI(this.high)]}},cI=(1n<<512n)-1n,dI=0n,fI=0n,mI=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&iI,this.limb1=(r&iI<<128n)>>128n,this.limb2=(r&iI<<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<dI)throw Error("bigNumberish is smaller than UINT_512_MIN.");if(e>cI)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<fI||t>iI)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:iS(this.limb0.toString(16)),limb1:iS(this.limb1.toString(16)),limb2:iS(this.limb2.toString(16)),limb3:iS(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[rI(this.limb0),rI(this.limb1),rI(this.limb2),rI(this.limb3)]}},pI=t=>/_len$/.test(t),gI=t=>"felt"===t||"core::felt252"===t,yI=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),wI=t=>/^\(.*\)$/i.test(t),vI=t=>/\(.*\)/i.test(t)&&t.includes(":"),bI=(t,e)=>t in e,kI=(t,e)=>t in e,MI=t=>t.startsWith("core::option::Option::"),_I=t=>t.startsWith("core::result::Result::"),EI=t=>Object.values(eN).includes(t),AI=t=>lI.isAbiType(t),jI=t=>Object.values(rN).includes(t),xI=t=>"core::bool"===t,SI=t=>t===rN.ContractAddress,NI=t=>t===iN,II=t=>"core::bytes_31::bytes31"===t,TI=t=>"core::byte_array::ByteArray"===t,CI=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,zI=t=>t===rN.Secp256k1Point,OI=t=>t.includes("::"),RI=t=>OI(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function PI(t){const{cairo:e}=DI(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function BI(t){return t.startsWith(nN)}function DI(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 OI(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var $I=t=>new lI(t).toUint256DecimalString(),LI=t=>new mI(t).toUint512DecimalString(),FI=(...t)=>({...t});function UI(t){return rI(t)}var qI=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=>!cN(t))).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find((t=>!cN(t)))}activeVariant(){const t=Object.entries(this.variant).find((t=>!cN(t[1])));return cN(t)?"":t[0]}},VI={Some:0,None:1},HI=class{Some;None;constructor(t,e){if(!(t in Object.values(VI)))throw new Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===VI.Some){if(cN(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!cN(this.Some)}isNone(){return!0===this.None}},GI={Ok:0,Err:1},ZI=class{Ok;Err;constructor(t,e){if(!(t in Object.values(GI)))throw new Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===GI.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!cN(this.Ok))return this.Ok;if(!cN(this.Err))return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!cN(this.Ok)}isErr(){return!cN(this.Err)}},KI=(t,e,r)=>{if(!mN(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]}`)},JI=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function WI(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=WI(t[n],t[n].map((t=>a)));return i[n]=Object.values(e).join(""),i}return KI(t,e,n),i[n]=QN(o),i}if("number"===a)return KI(t,e,n),i[n]=Number(o),i;if("function"==typeof a)return i[n]=a(o),i;if(Array.isArray(a)){const e=WI(t[n],a,a[0]);return i[n]=Object.values(e),i}return gN(a)?(i[n]=WI(t[n],a),i):(JI(t,e,n),i)}),{})}function YI(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:PI(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)=>pI(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 QI(t,e,r){return"constructor"===t&&!r&&!e.length}function XI(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 tT(t){return OI(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+XI(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+XI(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 vI(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 eT=class t{content;arrayType;constructor(e,r){uN(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].`)}uN(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 rT(t,e,r,i){const n=(t,e)=>{if(eT.isTypeFixedArray(e))return function(t,e){const r=eT.getFixedArrayType(e),i=eT.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(yI(e))return function(t,e){const r=RI(e);if(pN(t))return t;return t.map((t=>n(t,r)))}(t,e);if(kI(e,i)){const r=i[e];return a(t,r)}if(wI(e))return function(t,e){const r=tT(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(NI(e))return t;if(BI(e))return t;if(TI(e))return t;if(CI(e))return t;if(zI(e))return t;if(lI.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(mI.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(bI(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]&&(OI(r.type)||!pI(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(_I(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 ZI(GI.Ok,n(t.unwrap(),i)):new ZI(GI.Err,n(t.unwrap(),o))}if(MI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new HI(VI.Some,n(r.unwrap(),i)):new HI(VI.None,{})}const r=t,i=Object.entries(r.variant).map((t=>{if(cN(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 qI(Object.fromEntries(i))};return e.reduce(((e,r)=>{return pI(r.name)&&!OI(r.type)||(i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i})),e;var i}),{})}function iT(t,e){switch(!0){case lI.isAbiType(t):return new lI(e).toApiRequest();case mI.isAbiType(t):return new mI(e).toApiRequest();case II(t):return YN(e.toString());case zI(t):{const t=rS(vN(e)).padStart(128,"0"),r=$I(iS(t.slice(-64))),i=$I(iS(t.slice(0,-64)));return[UI(i.low),UI(i.high),UI(r.low),UI(r.high)]}default:return UI(e)}}function nT(t,e,r,i){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(eT.isTypeFixedArray(e)){const n=eT.getFixedArrayType(e);let o=[];if(Array.isArray(t)){o=new eT(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),uN(o.length===eT.getFixedArraySize(e),`ABI type ${e}: object provided do not includes ${eT.getFixedArraySize(e)} items. ${o.length} items provided.`)}return o.reduce(((t,e)=>t.concat(nT(e,n,r,i))),[])}if(Array.isArray(t)){const n=[];n.push(UI(t.length));const o=RI(e);return t.reduce(((t,e)=>t.concat(nT(e,o,r,i))),n)}if(r[e]&&r[e].members.length){if(lI.isAbiType(e))return new lI(t).toApiRequest();if(mI.isAbiType(e))return new mI(t).toApiRequest();if(NI(e))return iT(e,t);if(TI(e))return function(t){const e=tI(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(nT(o[e.name],e.type,r,i))),[])}if(wI(e)){const n=function(t,e){const r=tT(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=nT(e.element,e.type,r,i);return t.concat(n)}),[])}if(lI.isAbiType(e))return new lI(t).toApiRequest();if(mI.isAbiType(e))return new mI(t).toApiRequest();if(kI(e,i)){const{variants:n}=i[e];if(MI(e)){const e=t;if(e.isSome()){const t=n.find((t=>"Some"===t.name));if(cN(t))throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return VI.Some.toString();const a=nT(e.unwrap(),o,r,i);return Array.isArray(a)?[VI.Some.toString(),...a]:[VI.Some.toString(),a]}return VI.None.toString()}if(_I(e)){const e=t;if(e.isOk()){const t=n.find((t=>"Ok"===t.name));if(cN(t))throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return GI.Ok.toString();const a=nT(e.unwrap(),o,r,i);return Array.isArray(a)?[GI.Ok.toString(),...a]:[GI.Ok.toString(),a]}const o=n.find((t=>"Err"===t.name));if(cN(o))throw Error("Error in abi : Result has no 'Err' variant.");const a=o.type;if("()"===a)return GI.Err.toString();const s=nT(e.unwrap(),a,r,i);return Array.isArray(s)?[GI.Err.toString(),...s]:[GI.Err.toString(),s]}const o=t,a=o.activeVariant(),s=n.find((t=>t.name===a));if(cN(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=nT(o.unwrap(),h,r,i);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if(BI(e))return iT(RI(e),t);if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return iT(e,t)}function oT(t,e){let r;switch(!0){case xI(t):return r=e.next().value,Boolean(BigInt(r));case lI.isAbiType(t):const i=e.next().value,n=e.next().value;return new lI(i,n).toBigInt();case mI.isAbiType(t):const o=e.next().value,a=e.next().value,s=e.next().value,h=e.next().value;return new mI(o,a,s,h).toBigInt();case NI(t):return r=e.next().value,BigInt(r);case II(t):return r=e.next().value,QN(r);case zI(t):const u=rS(e.next().value).padStart(32,"0"),l=rS(e.next().value).padStart(32,"0"),c=rS(e.next().value).padStart(32,"0"),d=rS(e.next().value).padStart(32,"0");return BigInt(iS(l+u+d+c));default:return r=e.next().value,BigInt(r)}}function aT(t,e,r,i){if("()"===e.type)return{};if(lI.isAbiType(e.type)){const e=t.next().value,r=t.next().value;return new lI(e,r).toBigInt()}if(mI.isAbiType(e.type)){const e=t.next().value,r=t.next().value,i=t.next().value,n=t.next().value;return new mI(e,r,i,n).toBigInt()}if(TI(e.type)){const e=[],r=BigInt(t.next().value);for(;e.length<r;)e.push(vN(t.next().value));return XN({data:e,pending_word:vN(t.next().value),pending_word_len:BigInt(t.next().value)})}if(eT.isTypeFixedArray(e.type)){const n=[],o={name:"",type:eT.getFixedArrayType(e.type)},a=eT.getFixedArraySize(e.type);for(;n.length<a;)n.push(aT(t,o,r,i));return n}if(yI(e.type)){const n=[],o={name:"",type:RI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(aT(t,o,r,i));return n}if(BI(e.type)){const n={name:"",type:RI(e.type)};return aT(t,n,r,i)}if(r&&e.type in r&&r[e.type])return NI(e.type)?oT(e.type,t):r[e.type].members.reduce(((e,n)=>(e[n.name]=aT(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]=aT(t,{name:"",type:o.type},r,i),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=n===VI.Some?o.Some:void 0;return new HI(n,t)}if(e.type.startsWith("core::result::Result")){let t;return t=n===GI.Ok?o.Ok:o.Err,new ZI(n,t)}return new qI(o)}if(wI(e.type)){return tT(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]=aT(t,s,r,i),e}),{})}if(yI(e.type)){const n=[],o={name:"",type:RI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(aT(t,o,r,i));return n}return oT(e.type,t)}function sT(t,e,r,i,n){const{name:o,type:a}=e;let s;switch(!0){case pI(o):return s=t.next().value,BigInt(s);case r&&a in r||wI(a):case i&&kI(a,i):case eT.isTypeFixedArray(a):return aT(t,e,r,i);case yI(a):if(OI(a))return aT(t,e,r,i);const h=[];if(n&&n[`${o}_len`]){const a=n[`${o}_len`];for(;h.length<a;)h.push(aT(t,{name:o,type:e.type.replace("*","")},r,i))}return h;case BI(a):return aT(t,e,r,i);default:return oT(a,t)}}var hT=(t,e)=>{if(uN(pN(t)||dN(t)||mN(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),pN(t)&&!yN(t))return;const r=BigInt(t.toString(10));uN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},uT=(t,e)=>{let r;switch(dN(t)&&uN(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),uN(pN(t)||dN(t)||mN(t)||gN(t)&&"low"in t&&"high"in t||gN(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 eN.u256:r=new lI(t).toBigInt();break;case eN.u512:r=new mI(t).toBigInt();break;default:r=wN(t)}switch(e.type){case eN.u8:uN(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case eN.u16:uN(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case eN.u32:uN(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case eN.u64:uN(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case eN.u128:uN(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case eN.u256:uN(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case eN.u512:uN(mI.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case rN.ClassHash:case rN.ContractAddress:uN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case rN.Secp256k1Point:uN(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case rN.U96:uN(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},lT=(t,e)=>{uN(fN(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},cT=(t,e,r)=>{if(e.type!==eN.u256&&e.type!==eN.u512)if(NI(e.type)){uN(!gN(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);const r=BigInt(t.toString(10));uN(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else uN(gN(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})=>{uN(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else uT(t,e)},dT=(t,e)=>{uN(gN(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(!(MI(e.type)&&i.includes("isSome")&&i.includes("isNone")||_I(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.`)},fT=(t,e)=>{uN(gN(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},mT=(t,e,r,i)=>{const n=yI(e.type),o=n?RI(e.type):eT.getFixedArrayType(e.type);if(n&&gI(o)&&JN(t))return;let a=[];if(n)uN(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 gI(o):a.forEach((t=>hT(t,e)));break;case wI(o):a.forEach((t=>fT(t,{name:e.name,type:o})));break;case yI(o):a.forEach((t=>mT(t,{name:"",type:o},r,i)));break;case bI(o,r):a.forEach((t=>cT(t,{name:e.name,type:o},r)));break;case kI(o,i):a.forEach((t=>dT(t,{name:e.name,type:o})));break;case EI(o)||jI(o):a.forEach((t=>uT(t,{name:"",type:o})));break;case xI(o):a.forEach((t=>lT(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${a}`)}};function pT(t,e,r,i){t.inputs.reduce(((t,n)=>{const o=e[t];switch(!0){case pI(n.name):return t;case gI(n.type):hT(o,n);break;case II(n.type):((t,e)=>{uN(pN(t),`Validate: arg ${e.name} should be a string.`),uN(t.length<32,`Validate: arg ${e.name} cairo typed ${e.type} should be a string of less than 32 characters.`)})(o,n);break;case EI(n.type)||jI(n.type):uT(o,n);break;case xI(n.type):lT(o,n);break;case TI(n.type):((t,e)=>{uN(pN(t),`Validate: arg ${e.name} should be a string.`)})(o,n);break;case yI(n.type)||eT.isTypeFixedArray(n.type):mT(o,n,r,i);break;case bI(n.type,r):cT(o,n,r);break;case kI(n.type,i):dT(o,n);break;case wI(n.type):fT(o,n);break;case BI(n.type):((t,e)=>{const r=RI(e.type);switch(uN(EI(r)&&r!==mI.abiSelector||gI(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case gI(r):hT(t,e),uN(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case EI(r):uT(t,{name:"",type:r}),r===eN.u256?uN(new lI(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):uN(wN(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 gT=class t{abi;parser;structs;enums;constructor(e){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=YI(e),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if(t!==tN.DEPLOY){uN(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return t===tN.INVOKE?!r:r})).map((t=>t.name)).includes(e),(t===tN.INVOKE?"invocable":"viewable")+" method not found in abi")}const i=this.abi.find((r=>t===tN.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(QI(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}`);pT(i,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(QI(t,e,r))return[];let i;if(Array.isArray(e))i=e;else{const t=rT(e,r.inputs,this.structs,this.enums);i=Object.values(t),pT(r,i,this.structs,this.enums)}const n=i[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>pI(e.name)&&!OI(e.type)?t:t.concat(function(t,e,r,i){const{name:n,type:o}=e;let{value:a}=t.next();switch(!0){case eT.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 nT(a,e.type,r,i);case yI(o):if(!Array.isArray(a)&&!ZN(a))throw Error(`ABI expected parameter ${n} to be array or long string, got ${a}`);return pN(a)&&(a=WN(a)),nT(a,e.type,r,i);case BI(o):return iT(RI(o),a);case NI(o):return iT(o,a);case bI(o,r)||wI(o)||lI.isAbiType(o):case kI(o,i):return nT(a,o,r,i);default:return iT(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=$N(o):JN(o)&&(o=tI(o));const a=Array.isArray(i)&&"0"===t?"$$len":t;if(mN(o))return[[`${r}${a}`,UI(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()?VI.Some:VI.None;return t.isSome()?e({0:i,1:t.unwrap()},`${r}${a}.`):[[`${r}${a}`,UI(i)]]}if(i.includes("isOk")&&i.includes("isErr")){const t=o,i=t.isOk()?GI.Ok:GI.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}`,UI(n)]]:e({0:n,1:t.unwrap()},`${r}${a}.`)}return e(o,`${r}${a}.`)}return[[`${r}${a}`,UI(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]=sT(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 WI(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=>vN(t)))}decodeParameters(t,e){const r=Array.isArray(t)?t:[t],i=e.flat()[Symbol.iterator](),n=r.map((t=>sT(i,{name:"",type:t},this.structs,this.enums)));return 1===n.length?n[0]:n}};Ix({},{calculateContractAddressFromHash:()=>HT,calculateDeclareTransactionHash:()=>DT,calculateDeployAccountTransactionHash:()=>$T,calculateInvokeTransactionHash:()=>BT,calculateL2MessageTxHash:()=>MT,computeCompiledClassHash:()=>QT,computeContractClassHash:()=>eC,computeHashOnElements:()=>UT,computeHintedClassHash:()=>KT,computeLegacyContractClassHash:()=>JT,computePedersenHash:()=>LT,computePedersenHashOnElements:()=>qT,computePoseidonHash:()=>FT,computePoseidonHashOnElements:()=>VT,computeSierraContractClassHash:()=>tC,formatSpaces:()=>ZT,getL2MessageHash:()=>UN,getSelector:()=>LN,getSelectorFromName:()=>$N,hashByteCodeSegments:()=>YT,keccakBn:()=>BN,poseidon:()=>kw,solidityUint256PackedKeccak256:()=>FN,starknetKeccak:()=>DN});Ix({},{calculateDeclareTransactionHash:()=>vT,calculateDeployAccountTransactionHash:()=>bT,calculateL2MessageTxHash:()=>MT,calculateTransactionHash:()=>kT,calculateTransactionHashCommon:()=>wT,computeHashOnElements:()=>yT});function yT(t){return[...t,t.length].reduce(((t,e)=>kv(wN(t),wN(e))),0).toString()}function wT(t,e,r,i,n,o,a,s=[]){const h=yT(n);return yT([t,e,r,i,h,o,a,...s])}function vT(t,e,r,i,n,o,a){return wT("0x6465636c617265",r,e,0,[t],i,n,[o,...a?[a]:[]])}function bT(t,e,r,i,n,o,a,s){return wT("0x6465706c6f795f6163636f756e74",n,t,0,[e,i,...r],o,a,[s])}function kT(t,e,r,i,n,o){return wT("0x696e766f6b65",e,t,0,r,i,n,[o])}function MT(t,e,r,i,n,o){const a=[t,...i];return wT("0x6c315f68616e646c6572",0,e,LN(r),a,0,n,[o])}Ix({},{starkCurve:()=>Cv,weierstrass:()=>Vw});Ix({},{calculateDeclareTransactionHash:()=>RT,calculateDeployAccountTransactionHash:()=>OT,calculateInvokeTransactionHash:()=>PT,calculateTransactionHashCommon:()=>zT,encodeResourceBoundsL1:()=>IT,encodeResourceBoundsL2:()=>TT,hashDAMode:()=>NT,hashFeeField:()=>CT});var _T=t=>t.map((t=>BigInt(t))),ET=32n,AT=128n,jT=64n+AT,xT=BigInt(YN("L1_GAS")),ST=BigInt(YN("L2_GAS"));function NT(t,e){return(BigInt(t)<<ET)+BigInt(e)}function IT(t){return(xT<<jT)+(BigInt(t.l1_gas.max_amount)<<AT)+BigInt(t.l1_gas.max_price_per_unit)}function TT(t){return(ST<<jT)+(BigInt(t.l2_gas.max_amount)<<AT)+BigInt(t.l2_gas.max_price_per_unit)}function CT(t,e){const r=IT(e),i=TT(e);return Tv([BigInt(t),r,i])}function zT(t,e,r,i,n,o,a,s,h,u,l=[]){const c=CT(o,u),d=NT(s,h),f=_T([t,e,r,c,Tv(_T(a)),i,n,d,..._T(l)]);return vN(Tv(f))}function OT(t,e,r,i,n,o,a,s,h,u,l,c){return zT("0x6465706c6f795f6163636f756e74",n,t,o,a,l,c,s,h,u,[Tv(_T(r)),e,i])}function RT(t,e,r,i,n,o,a,s,h,u,l,c){return zT("0x6465636c617265",i,r,n,o,l,_T(c),s,h,u,[Tv(_T(a)),t,e])}function PT(t,e,r,i,n,o,a,s,h,u,l){return zT("0x696e766f6b65",e,t,i,n,u,l,a,s,h,[Tv(_T(o)),Tv(_T(r))])}function BT(t){return function(t){return[zx.ETransactionVersion.V3,zx.ETransactionVersion.F3].includes(t.version)}(t)?PT(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):kT(t.senderAddress,t.version,t.compiledCalldata,t.maxFee,t.chainId,t.nonce)}function DT(t){return function(t){return[zx.ETransactionVersion.V3,zx.ETransactionVersion.F3].includes(t.version)}(t)?RT(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):vT(t.classHash,t.senderAddress,t.version,t.maxFee,t.chainId,t.nonce,t.compiledClassHash)}function $T(t){return function(t){return[zx.ETransactionVersion.V3,zx.ETransactionVersion.F3].includes(t.version)}(t)?OT(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):bT(t.contractAddress,t.classHash,t.constructorCalldata,t.salt,t.version,t.maxFee,t.chainId,t.nonce)}function LT(t,e){return kv(BigInt(t),BigInt(e))}function FT(t,e){return vN(Iv(BigInt(t),BigInt(e)))}function UT(t){return[...t,t.length].reduce(((t,e)=>kv(BigInt(t),BigInt(e))),0).toString()}var qT=UT;function VT(t){return vN(Tv(t.map((t=>BigInt(t)))))}function HT(t,e,r,i){const n=UT(gT.compile(r)),o=UT([UI("0x535441524b4e45545f434f4e54524143545f41444452455353"),i,t,e,n]);return vN(BigInt(o)%yS)}function GT(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 ZT(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 KT(t){const{abi:e,program:r}=t,i=ZT(FS({abi:e,program:r},GT));return iS(_v(Yx(i)).toString(16))}function JT(t){const e=pN(t)?$S(t):t,r=vN(mS),i=UT(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),n=UT(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=UT(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),a=UT(e.program.builtins.map((t=>YN(t)))),s=KT(e),h=UT(e.program.data);return UT([r,i,n,o,a,s,h])}function WT(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,Tv(e.flatMap((t=>BigInt(YN(t))))))];var e}));return Tv(e)}function YT(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 QT(t){const e=BigInt(YN("COMPILED_CLASS_V1")),r=WT(t.entry_points_by_type.EXTERNAL),i=WT(t.entry_points_by_type.L1_HANDLER),n=WT(t.entry_points_by_type.CONSTRUCTOR),o=t.bytecode_segment_lengths?YT(t):Tv(t.bytecode.map((t=>BigInt(t))));return vN(Tv([e,r,i,n,o]))}function XT(t){return Tv(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function tC(t){const e=BigInt(YN("CONTRACT_CLASS_V0.1.0")),r=XT(t.entry_points_by_type.EXTERNAL),i=XT(t.entry_points_by_type.L1_HANDLER),n=XT(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=ZT(FS(t.abi,null));return BigInt(iS(_v(Yx(e)).toString(16)))}(t),a=Tv(t.sierra_program.map((t=>BigInt(t))));return vN(Tv([e,r,i,n,o,a]))}function eC(t){const e=pN(t)?$S(t):t;return"sierra_program"in e?tC(e):JT(e)}function rC(t){const e=pN(t)?t:FS(t);return tS(b_(e))}function iC(t){if(Array.isArray(t))return t;const e=Wx(k_(Xx(t)));return $S(e)}function nC(){return fv(uv.randomPrivateKey())}function oC(t){return iS(t).toLowerCase()}function aC(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>vN(t)));try{const{r:e,s:r}=t;return[vN(e),vN(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function sC(t){return jN(aC(t))}function hC(t){return xN(aC(t))}function uC(t,e=50){return ON(t,e)}function lC(t,e=50,r=50){if(mN(t))return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:"0x0",max_price_per_unit:"0x0"}};if(cN(t.gas_consumed)||cN(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?vN(ON(BigInt(t.overall_fee)/BigInt(t.gas_price),e)):vN(ON(t.gas_consumed,e)),max_price_per_unit:vN(ON(t.gas_price,r))}}}function cC(t){if(t===zx.EDataAvailabilityMode.L1)return zx.EDAMode.L1;if(t===zx.EDataAvailabilityMode.L2)return zx.EDAMode.L2;throw Error("EDAM conversion")}function dC(t,e){const r=e?vN(e):void 0,i=vN(t);if(e&&!Object.values(zx.ETransactionVersion).includes(r))throw Error(`providedVersion ${e} is not ETransactionVersion`);if(!Object.values(zx.ETransactionVersion).includes(i))throw Error(`defaultVersion ${t} is not ETransactionVersion`);return e?r:i}function fC(t){if(!t)return;const e=vN(t);if(e===zx.ETransactionVersion.V0)return zx.ETransactionVersion.F0;if(e===zx.ETransactionVersion.V1)return zx.ETransactionVersion.F1;if(e===zx.ETransactionVersion.V2)return zx.ETransactionVersion.F2;if(e===zx.ETransactionVersion.V3)return zx.ETransactionVersion.F3;throw Error(`toFeeVersion: ${e} is not supported`)}function mC(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||zx.EDataAvailabilityMode.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||zx.EDataAvailabilityMode.L1,resourceBounds:t.resourceBounds??lC(cS)}}function pC(t){return t===zx.ETransactionVersion.F2?zx.ETransactionVersion.F1:t===zx.ETransactionVersion.V2?zx.ETransactionVersion.V1:t}function gC(t){return iS(eS(rv(vN(t),!1)))}function yC(t){return"sierra_program"in(pN(t)?$S(t):t)}Ix({},{compressProgram:()=>rC,decompressProgram:()=>iC,estimateFeeToBounds:()=>lC,estimatedFeeToMaxFee:()=>uC,formatSignature:()=>aC,getFullPublicKey:()=>gC,intDAM:()=>cC,makeAddress:()=>oC,randomAddress:()=>nC,reduceV2:()=>pC,signatureToDecimalArray:()=>sC,signatureToHexArray:()=>hC,toFeeVersion:()=>fC,toTransactionVersion:()=>dC,v3Details:()=>mC});function wC(){return sS(eS(S_.utils.randomPrivateKey()))}function vC(t){AN(t,cS,2n**160n-1n,"Ethereum Address ");const e=iS(rS(vN(t)).padStart(40,"0"));return uN(Boolean(e.match(/^(0x)?[0-9a-f]{40}$/)),"Invalid Ethereum Address Format"),e}Ix({},{ethRandomPrivateKey:()=>wC,validateAndParseEthAddress:()=>vC});var bC=Jx&&window.fetch.bind(window)||!cN(t)&&Uj(t.fetch)||fx;Ix({},{Block:()=>NC,createSierraContractClass:()=>AC,getDefaultNodeUrl:()=>xC,isPendingBlock:()=>CC,isPendingStateUpdate:()=>OC,isPendingTransaction:()=>zC,isV3Tx:()=>IC,isVersion:()=>TC,parseContract:()=>jC,validBlockTags:()=>SC,wait:()=>EC});var kC=class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...RS}}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(),MC={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},_C=class t{static instance;config;constructor(){this.config=kC}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<=MC[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(MC[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(MC).filter((t=>this.shouldLog(MC[t])&&"OFF"!==t))}}.getInstance();function EC(t){return new Promise((e=>{setTimeout(e,t)}))}function AC(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=ZT(FS(t.abi)),e.sierra_program=ZT(FS(t.sierra_program)),e.sierra_program=rC(e.sierra_program),e}function jC(t){const e=pN(t)?$S(t):t;return yC(t)?AC(e):{...e,..."program"in e&&{program:rC(e.program)}}}var xC=(t,e=!1)=>{e||_C.info("Using default public node url, please provide nodeUrl in provider options!");const r=NS[t??"SN_SEPOLIA"];return r[Math.floor(Math.random()*r.length)]},SC=Object.values(XS),NC=class{hash=null;number=null;tag=null;setIdentifier(t){if(pN(t))if(GN(t))this.number=parseInt(t,10);else if(yN(t))this.hash=t;else{if(!SC.includes(t))throw TypeError(`Block identifier unmanaged: ${t}`);this.tag=t}else mN(t)?this.hash=vN(t):dN(t)?this.number=t:this.tag=XS.PENDING;if(dN(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 IC(t){const e=t.version?vN(t.version):zx.ETransactionVersion.V3;return e===zx.ETransactionVersion.V3||e===zx.ETransactionVersion.F3}function TC(t,e){const[r,i]=t.split("."),[n,o]=e.split(".");return r===n&&i===o}function CC(t){return"PENDING"===t.status}function zC(t){return!("block_hash"in t)}function OC(t){return!("block_hash"in t)}var RC={};Ix(RC,{buildUDCCall:()=>UC,fromCallsToExecuteCalldata:()=>BC,fromCallsToExecuteCalldataWithNonce:()=>DC,fromCallsToExecuteCalldata_cairo1:()=>LC,getExecuteCalldata:()=>FC,getVersionsByType:()=>qC,transformCallsToMulticallArrays:()=>PC,transformCallsToMulticallArrays_cairo1:()=>$C});var PC=t=>{const e=[],r=[];return t.forEach((t=>{const i=gT.compile(t.calldata||[]);e.push({to:wN(t.contractAddress).toString(10),selector:wN($N(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:i.length.toString()}),r.push(...i)})),{callArray:e,calldata:gT.compile({calldata:r})}},BC=t=>{const{callArray:e,calldata:r}=PC(t);return[...gT.compile({callArray:e}),...r]},DC=(t,e)=>[...BC(t),wN(e).toString()],$C=t=>{const e=t.map((t=>({to:wN(t.contractAddress).toString(10),selector:wN($N(t.entrypoint)).toString(10),calldata:gT.compile(t.calldata||[])})));return e},LC=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:gT.compile(t.calldata)})));return gT.compile({orderCalls:e})},FC=(t,e="0")=>"1"===e?LC(t):BC(t);function UC(t,e){const r=[].concat(t).map((t=>{const{classHash:r,salt:i,unique:n=!0,constructorCalldata:o=[]}=t,a=gT.compile(o),s=i??nC();return{call:{contractAddress:xS.ADDRESS,entrypoint:xS.ENTRYPOINT,calldata:[r,s,CN(n),a.length,...a]},address:HT(n?kv(e,s):s,r,a,n?xS.ADDRESS:0)}}));return{calls:r.map((t=>t.call)),addresses:r.map((t=>t.address))}}function qC(t){return"fee"===t?{v1:zx.ETransactionVersion.F1,v2:zx.ETransactionVersion.F2,v3:zx.ETransactionVersion.F3}:{v1:zx.ETransactionVersion.V1,v2:zx.ETransactionVersion.V2,v3:zx.ETransactionVersion.V3}}var VC={headers:{"Content-Type":"application/json"},blockIdentifier:XS.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(_S).includes(a)?this.nodeUrl=xC(a,t?.default):this.nodeUrl=a||xC(void 0,t?.default),this.baseFetch=e??bC,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 hN({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:FS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new GS(r,t,e);if(i instanceof HS)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=vN(t),i=new NC(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 NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new NC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=vN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=vN(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 NC(r).identifier,a=[];return i&&a.push(Rx.ESimulationFlag.SKIP_VALIDATE),n&&a.push(Rx.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=vN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Rx.ETransactionStatus.REJECTED],h=e?.successStates??[Rx.ETransactionExecutionStatus.SUCCEEDED,Rx.ETransactionStatus.ACCEPTED_ON_L2,Rx.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!n;){await EC(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 EC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=vN(t),n=kN(e),o=new NC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(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 NC(e).identifier;let n={};return TC("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Rx.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 IC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Rx.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:Rx.ETransactionVersion.V3,signature:hC(t.signature),nonce:vN(e.nonce),resource_bounds:e.resourceBounds,tip:vN(e.tip),paymaster_data:e.paymasterData.map((t=>vN(t))),account_deployment_data:e.accountDeploymentData.map((t=>vN(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:gT.toHex(t.calldata),type:Rx.ETransactionType.INVOKE,max_fee:vN(e.maxFee||0),version:Rx.ETransactionVersion.V1,signature:hC(t.signature),nonce:vN(e.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V1,type:Rx.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(yC(t)||IC(n))if(yC(t)&&!IC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Rx.ETransactionType.DECLARE,contract_class:{sierra_program:iC(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:Rx.ETransactionVersion.V2,max_fee:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V2,type:Rx.ETransactionType.DECLARE});else{if(!yC(t)||!IC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Rx.ETransactionType.DECLARE,sender_address:r,compiled_class_hash:i||"",version:Rx.ETransactionVersion.V3,signature:hC(e),nonce:vN(n.nonce),contract_class:{sierra_program:iC(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:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),account_deployment_data:n.accountDeploymentData.map((t=>vN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Rx.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:Rx.ETransactionVersion.V1,max_fee:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V1,type:Rx.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 IC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Rx.ETransactionType.DEPLOY_ACCOUNT,version:Rx.ETransactionVersion.V3,signature:hC(i),nonce:vN(n.nonce),contract_address_salt:vN(r||0),constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),resource_bounds:n.resourceBounds,tip:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),contract_address_salt:vN(r||0),type:Rx.ETransactionType.DEPLOY_ACCOUNT,max_fee:vN(n.maxFee||0),version:Rx.ETransactionVersion.V1,signature:hC(i),nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V1,type:Rx.ETransactionType.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new NC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:$N(t.entrypoint),calldata:gT.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:vC(r),to_address:vN(i),entry_point_selector:LN(n),payload:TN(o)},s=new NC(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=qC(e);let i;if(IC(t)?i={signature:hC(t.signature),nonce:vN(t.nonce),resource_bounds:t.resourceBounds,tip:vN(t.tip),paymaster_data:t.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>vN(t)))}:(i={signature:hC(t.signature),nonce:vN(t.nonce),max_fee:vN(t.maxFee||0)},_C.warn(PS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===KS.INVOKE)return{type:Rx.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:vN(t.version||r.v3),...i};if(t.type===KS.DECLARE)return yC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:iC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:vN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:vN(t.version||r.v1),...i};if(t.type===KS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:gT.toHex(t.constructorCalldata||[]),class_hash:vN(t.classHash),contract_address_salt:vN(t.addressSalt||0),version:vN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}};Ix({},{RpcChannel:()=>ZC});var GC={headers:{"Content-Type":"application/json"},blockIdentifier:XS.PENDING,retries:200},ZC=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(_S).includes(a)?this.nodeUrl=xC(a,t?.default):this.nodeUrl=a||xC(void 0,t?.default),this.baseFetch=e??bC,this.blockIdentifier=i??GC.blockIdentifier,this.chainId=n,this.headers={...GC.headers,...o},this.retries=s??GC.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new hN({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:FS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new GS(r,t,e);if(i instanceof HS)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=vN(t),i=new NC(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 NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new NC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=vN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=vN(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 NC(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=vN(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 EC(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 EC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=vN(t),n=kN(e),o=new NC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(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 NC(e).identifier;let n={};return TC("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 IC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:Pm.V3,signature:hC(t.signature),nonce:vN(e.nonce),resource_bounds:e.resourceBounds,tip:vN(e.tip),paymaster_data:e.paymasterData.map((t=>vN(t))),account_deployment_data:e.accountDeploymentData.map((t=>vN(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:gT.toHex(t.calldata),type:Sm.INVOKE,max_fee:vN(e.maxFee||0),version:Pm.V1,signature:hC(t.signature),nonce:vN(e.nonce)}}),_C.warn(PS.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(yC(t)||IC(n))if(yC(t)&&!IC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,contract_class:{sierra_program:iC(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:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Pm.V2,type:Sm.DECLARE});else{if(!yC(t)||!IC(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:hC(e),nonce:vN(n.nonce),contract_class:{sierra_program:iC(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:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),account_deployment_data:n.accountDeploymentData.map((t=>vN(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:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.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 IC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Sm.DEPLOY_ACCOUNT,version:Pm.V3,signature:hC(i),nonce:vN(n.nonce),contract_address_salt:vN(r||0),constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),resource_bounds:n.resourceBounds,tip:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),contract_address_salt:vN(r||0),type:Sm.DEPLOY_ACCOUNT,max_fee:vN(n.maxFee||0),version:Pm.V1,signature:hC(i),nonce:vN(n.nonce)}}),_C.warn(PS.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 NC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:$N(t.entrypoint),calldata:gT.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:vC(r),to_address:vN(i),entry_point_selector:LN(n),payload:TN(o)},s=new NC(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=qC(e);let i;if(IC(t)?i={signature:hC(t.signature),nonce:vN(t.nonce),resource_bounds:t.resourceBounds,tip:vN(t.tip),paymaster_data:t.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>vN(t)))}:(i={signature:hC(t.signature),nonce:vN(t.nonce),max_fee:vN(t.maxFee||0)},_C.warn(PS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===KS.INVOKE)return{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:vN(t.version||r.v3),...i};if(t.type===KS.DECLARE)return yC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:iC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:vN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:vN(t.version||r.v1),...i};if(t.type===KS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:gT.toHex(t.constructorCalldata||[]),class_hash:vN(t.classHash),contract_address_salt:vN(t.addressSalt||0),version:vN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}},KC=class{margin;constructor(t){this.margin=t}estimatedFeeToMaxFee(t){return uC(t,this.margin?.maxFee)}estimateFeeToBounds(t){return lC(t,this.margin?.l1BoundMaxAmount,this.margin?.l1BoundMaxPricePerUnit)}parseGetBlockResponse(t){return{status:"PENDING",...t}}parseTransactionReceipt(t){return"actual_fee"in t&&pN(t.actual_fee)?{...t,actual_fee:{amount:t.actual_fee,unit:"FRI"}}:t}parseFeeEstimateResponse(t){const e=t[0];return{overall_fee:wN(e.overall_fee),gas_consumed:wN(e.gas_consumed),gas_price:wN(e.gas_price),unit:e.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(e.overall_fee),resourceBounds:this.estimateFeeToBounds(e),data_gas_consumed:e.data_gas_consumed?wN(e.data_gas_consumed):0n,data_gas_price:e.data_gas_price?wN(e.data_gas_price):0n}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:wN(t.overall_fee),gas_consumed:wN(t.gas_consumed),gas_price:wN(t.gas_price),unit:t.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(t.overall_fee),resourceBounds:this.estimateFeeToBounds(t),data_gas_consumed:t.data_gas_consumed?wN(t.data_gas_consumed):0n,data_gas_price:t.data_gas_price?wN(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:pN(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}},JC=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===YS.SUCCEEDED}static isReverted(t){return t.execution_status===YS.REVERTED}static isRejected(t){return t.status===YS.REJECTED}},WC={};Ix(WC,{TypedDataRevision:()=>Fm,encodeData:()=>cz,encodeType:()=>hz,encodeValue:()=>lz,getDependencies:()=>sz,getMessageHash:()=>fz,getStructHash:()=>dz,getTypeHash:()=>uz,isMerkleTreeType:()=>az,prepareSelector:()=>oz,validateTypedData:()=>nz,verifyMessage:()=>mz});Ix({},{MerkleTree:()=>YC,proofMerklePath:()=>QC});var YC=class t{leaves;branches=[];root;hashMethod;constructor(t,e=LT){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=LT){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 QC(t,e,r,i=LT){if(0===r.length)return t===e;const[n,...o]=r;return QC(t,YC.hash(e,n,i),o,i)}var XC={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" }]')},tz={[Fm.ACTIVE]:{domain:"StarknetDomain",hashMethod:VT,hashMerkleMethod:FT,escapeTypeString:t=>`"${t}"`,presetTypes:XC},[Fm.LEGACY]:{domain:"StarkNetDomain",hashMethod:qT,hashMerkleMethod:LT,escapeTypeString:t=>t,presetTypes:{}}};function ez(t,e,{min:r,max:i}){const n=BigInt(t);uN(n>=r&&n<=i,`${n} (${e}) is out of bounds [${r}, ${i}]`)}function rz({types:t,domain:e}){return tz[Fm.ACTIVE].domain in t&&e.revision===Fm.ACTIVE?Fm.ACTIVE:tz[Fm.LEGACY].domain in t&&(e.revision??Fm.LEGACY)===Fm.LEGACY?Fm.LEGACY:void 0}function iz(t){try{return vN(t)}catch(e){if(pN(t))return vN(YN(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function nz(t){const e=t;return Boolean(e.message&&e.primaryType&&e.types&&rz(e))}function oz(t){return yN(t)?t:$N(t)}function az(t){return"merkletree"===t.type}function sz(t,e,r=[],i="",n=Fm.LEGACY){let o=[e];return"*"===e[e.length-1]?o=[e.slice(0,-1)]:n===Fm.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,...sz(t,r.type,e,r.contains,n).filter((t=>!e.includes(t)))]),[])].filter((t=>!e.includes(t)))]),[])}function hz(t,e,r=Fm.LEGACY){const i=r===Fm.ACTIVE?{...t,...tz[r].presetTypes}:t,[n,...o]=sz(i,e,void 0,void 0,r),a=n?[n,...o.sort()]:[],s=tz[r].escapeTypeString;return a.map((t=>{const e=i[t].map((t=>{const e="enum"===t.type&&r===Fm.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 uz(t,e,r=Fm.LEGACY){return $N(hz(t,e,r))}function lz(t,e,r,i={},n=Fm.LEGACY){if(t[e])return[e,dz(t,e,r,n)];if(tz[n].presetTypes[e])return[e,dz(tz[n].presetTypes,e,r,n)];if(e.endsWith("*")){const i=r.map((r=>lz(t,e.slice(0,-1),r,void 0,n)[1]));return[e,tz[n].hashMethod(i)]}switch(e){case"enum":if(n===Fm.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 lz(t,e,i,void 0,n)[1]}));return[e,tz[n].hashMethod([l,...c])]}return[e,iz(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(!az(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=>lz(t,e,r,void 0,n)[1])),{root:a}=new YC(o,tz[n].hashMerkleMethod);return["felt",a]}case"selector":return["felt",oz(r)];case"string":if(n===Fm.ACTIVE){const t=tI(r),i=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,tz[n].hashMethod(i)]}return[e,iz(r)];case"i128":if(n===Fm.ACTIVE){const t=BigInt(r);return ez(t,e,bS),[e,iz(t<0n?pS+t:t)]}return[e,iz(r)];case"timestamp":case"u128":return n===Fm.ACTIVE&&ez(r,e,kS),[e,iz(r)];case"felt":case"shortstring":return n===Fm.ACTIVE&&ez(iz(r),e,vS),[e,iz(r)];case"ClassHash":case"ContractAddress":return n===Fm.ACTIVE&&ez(r,e,vS),[e,iz(r)];case"bool":return n===Fm.ACTIVE&&uN(fN(r),`Type mismatch for ${e} ${r}`),[e,iz(r)];default:if(n===Fm.ACTIVE)throw new Error(`Unsupported type: ${e}`);return[e,iz(r)]}}function cz(t,e,r,i=Fm.LEGACY){const n=t[e]??tz[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]=lz(t,a.type,s,h,i);return[[...n,u],[...o,l]]}),[["felt"],[uz(t,e,i)]]);return[o,a]}function dz(t,e,r,i=Fm.LEGACY){return tz[i].hashMethod(cz(t,e,r,i)[1])}function fz(t,e){if(!nz(t))throw new Error("Typed data does not match JSON schema");const r=rz(t),{domain:i,hashMethod:n}=tz[r];return n([YN("StarkNet Message"),dz(t.types,i,t.domain,r),e,dz(t.types,t.primaryType,t.message,r)])}function mz(t,e,r,i){const n=nz(t);if(!PN(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&&!PN(i))throw new Error("accountAddress shall be a BigNumberish");const o=n?fz(t,i):vN(t);return ov(Array.isArray(e)?new hv(BigInt(e[0]),BigInt(e[1])):e,o,vN(r))}var pz=class{responseParser;channel;constructor(t){t&&"channel"in t?(this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new KC):(this.channel=new ZC({...t,waitMode:!1}),this.responseParser=new KC(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===XS.LATEST)return;const r=await this.getBlockNumber(),i=t===XS.PENDING?r+1:Number(vN(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 EC(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);uN("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 FN([r[0],i,o,n,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){if(this.channel instanceof BS.RpcChannel)throw new HS("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(XS.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 JC(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 JC(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(yC(n)){if(i){return{cairo:"1",compiler:DI(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:KS.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeclareEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:KS.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeployAccountEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:KS.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=nz(t);if(!PN(t)&&!o)throw new Error("message has a wrong format.");if(!PN(r))throw new Error("accountAddress shall be a BigNumberish");const a=o?fz(t,r):vN(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:vN(r),entrypoint:t,calldata:gT.compile({hash:wN(a).toString(),signature:aC(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(yC(t.contract)&&(!t.compiledClassHash&&t.casm&&(e.compiledClassHash=QT(t.casm)),!e.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(e.classHash=t.classHash??eC(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 HS)return!1;throw t}}async prepareInvocations(t){const e=[];for(const r of t)if(r.type===KS.DECLARE){await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r)}else e.push(r);return e}};Ix({},{StarknetIdContract:()=>Az,StarknetIdIdentityContract:()=>xz,StarknetIdMulticallContract:()=>Nz,StarknetIdPfpContract:()=>zz,StarknetIdPopContract:()=>Rz,StarknetIdVerifierContract:()=>Tz,dynamicCallData:()=>$z,dynamicFelt:()=>Dz,execution:()=>Bz,getStarknetIdContract:()=>jz,getStarknetIdIdentityContract:()=>Sz,getStarknetIdMulticallContract:()=>Iz,getStarknetIdPfpContract:()=>Oz,getStarknetIdPopContract:()=>Pz,getStarknetIdVerifierContract:()=>Cz,isStarkDomain:()=>Lz,useDecoded:()=>_z,useEncoded:()=>Ez});var gz="abcdefghijklmnopqrstuvwxyz0123456789-",yz=BigInt(gz.length+1),wz="这来",vz=BigInt(gz.length),bz=BigInt(wz.length),kz=BigInt(wz.length+1);function Mz(t){let e=0;for(;t.endsWith(wz[wz.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function _z(t){let e="";return t.forEach((t=>{for(;t!==cS;){const r=t%yz;if(t/=yz,r===BigInt(gz.length)){const r=t/kz;if(r===cS){const i=t%kz;t=r,e+=i===cS?gz[0]:wz[Number(i)-1]}else{e+=wz[Number(t%bz)],t/=bz}}else e+=gz[Number(r)]}const[r,i]=Mz(e);i&&(e=r+(i%2==0?wz[wz.length-1].repeat(i/2-1)+wz[0]+gz[1]:wz[wz.length-1].repeat((i-1)/2+1))),e+="."})),e?e.concat("stark"):e}function Ez(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(wz[0]+gz[1])){const[e,r]=Mz(t.substring(0,t.length-2));t=e+wz[wz.length-1].repeat(2*(r+1))}else{const[e,r]=Mz(t);r&&(t=e+wz[wz.length-1].repeat(1+2*(r-1)))}for(let i=0;i<t.length;i+=1){const n=t[i],o=gz.indexOf(n),a=BigInt(gz.indexOf(n));if(-1!==o)i===t.length-1&&t[i]===gz[0]?(e+=r*vz,r*=yz,r*=yz):(e+=r*a,r*=yz);else if(-1!==wz.indexOf(n)){e+=r*vz,r*=yz;const o=(i===t.length-1?1:0)+wz.indexOf(n);e+=r*BigInt(o),r*=bz}}return e}var Az={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function jz(t){switch(t){case"0x534e5f4d41494e":return Az.MAINNET;case"0x534e5f5345504f4c4941":return Az.TESTNET_SEPOLIA;default:throw new Error("Starknet.id is not yet deployed on this network")}}var xz={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function Sz(t){switch(t){case"0x534e5f4d41494e":return xz.MAINNET;case"0x534e5f5345504f4c4941":return xz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var Nz="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function Iz(t){switch(t){case"0x534e5f4d41494e":case"0x534e5f5345504f4c4941":return Nz;default:throw new Error("Starknet.id multicall contract is not yet deployed on this network")}}var Tz={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function Cz(t){switch(t){case"0x534e5f4d41494e":return Tz.MAINNET;case"0x534e5f5345504f4c4941":return Tz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var zz={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function Oz(t){switch(t){case"0x534e5f4d41494e":return zz.MAINNET;case"0x534e5f5345504f4c4941":return zz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var Rz={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function Pz(t){switch(t){case"0x534e5f4d41494e":return Rz.MAINNET;case"0x534e5f5345504f4c4941":return Rz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function Bz(t,e,r){return new qI({Static:t,IfEqual:e?FI(e[0],e[1],e[2]):void 0,IfNotEqual:r?FI(r[0],r[1],r[2]):void 0})}function Dz(t,e){return new qI({Hardcoded:t,Reference:e?FI(e[0],e[1]):void 0})}function $z(t,e,r){return new qI({Hardcoded:t,Reference:e?FI(e[0],e[1]):void 0,ArrayReference:r?FI(r[0],r[1]):void 0})}function Lz(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var Fz=class extends(Ex(pz,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??jz(i);try{const r=await t.callContract({contractAddress:n,entrypoint:"address_to_domain",calldata:gT.compile({address:e,hint:[]})}),i=_z(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(!Lz(i))throw new Error("Invalid domain, must be a valid .stark domain");const n=await t.getChainId(),o=r??jz(n);try{const e=i.replace(".stark","").split(".").map((t=>Ez(t).toString(10)));return(await t.callContract({contractAddress:o,entrypoint:"domain_to_address",calldata:gT.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??jz(h),l=i??Sz(h),c=n??Cz(h),d=o??Oz(h),f=a??Pz(h),m=s??Iz(h);try{const r=[{execution:Bz({}),to:$z(u),selector:$z($N("address_to_domain")),calldata:[$z(e),$z("0")]},{execution:Bz({}),to:Dz(u),selector:Dz($N("domain_to_id")),calldata:[$z(void 0,void 0,[0,0])]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("twitter")),$z(c),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("github")),$z(c),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("discord")),$z(c),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("proof_of_personhood")),$z(f),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("nft_pp_contract")),$z(d),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_extended_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("nft_pp_id")),$z("2"),$z(d),$z("0")]},{execution:Bz(void 0,void 0,[6,0,0]),to:Dz(void 0,[6,0]),selector:Dz($N("tokenURI")),calldata:[$z(void 0,[7,1]),$z(void 0,[7,2])]}],i=await t.callContract({contractAddress:m,entrypoint:"aggregate",calldata:gT.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=_z(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=>QN(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")}}})){},Uz=new pz({default:!0}),qz={};function Vz(t){return new lI(t).toBigInt()}function Hz(t){return lI.is(t)}function Gz(t){return new lI(t).toUint256HexString()}function Zz(t){const e=function(t){const e=vN(iS(t.toString()));return iS(rS(e).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return AN(e,cS,yS-1n,"Starknet Address"),e}Ix(qz,{UINT_128_MAX:()=>iI,UINT_256_MAX:()=>nI,bnToUint256:()=>Gz,isUint256:()=>Hz,uint256ToBN:()=>Vz});function Kz(t){return"event"===t.type}function Jz(t){const e=t.filter((t=>Kz(t)&&"struct"===t.kind)),r=t.filter((t=>Kz(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(cN(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={[iS(_v(Yx(s)).toString(16))]:e};for(;i.length>0;)h={[iS(_v(Yx(i.pop())).toString(16))]:h};return h={...h},Yz(t,h)}),{});return i}function Wz(t){return PI(t)?Jz(t):function(t){return t.filter((t=>"event"===t.type)).reduce(((t,e)=>{const r=e.name,i={...e};return i.name=r,{...t,[iS(_v(Yx(r)).toString(16))]:i}}),{})}(t)}function Yz(t,e){const r={...t};return gN(t)&&gN(e)&&Object.keys(e).forEach((i=>{gN(e[i])?i in t?r[i]=Yz(t[i],e[i]):Object.assign(r,{[i]:e[i]}):Object.assign(r,{[i]:e[i]})})),r}function Qz(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();uN(!!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]=sT(s,t,r,i,a[o.name])})),l.forEach((t=>{a[o.name][t.name]=sT(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 Xz(t){if(!t.events?.length)throw new Error("UDC emitted event is empty");const e=t.events.find((t=>EN(t.from_address)===EN(xS.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:()=>Wz,isAbiEvent:()=>Kz,parseEvents:()=>Qz,parseUDCEvent:()=>Xz});function tO(t){const e=t.calldata??[],r=Array.isArray(e)?e:gT.compile(e);return{to:t.contractAddress,selector:$N(t.entrypoint),calldata:r}}function eO(t,e){const r=tO(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function rO(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function iO(t,e,r,i,n){return"1"===n?{types:oN,primaryType:"OutsideExecution",domain:rO(t,n),message:{...e,nonce:r,calls_len:i.length,calls:i.map((t=>eO(t,n)))}}:{types:aN,primaryType:"OutsideExecution",domain:rO(t,n),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:i.map((t=>eO(t,n)))}}}function nO(t){const e=t.outsideExecution,r=aC(t.signature);return gT.compile({outside_execution:e,signature:r})}function oO(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:vN(t.signerAddress),entrypoint:e,calldata:nO(t)}}))}Ix({},{buildExecuteFromOutsideCall:()=>oO,buildExecuteFromOutsideCallData:()=>nO,getOutsideCall:()=>tO,getTypedData:()=>iO});async function aO(t,e,r){const i={contractAddress:vN(e),entrypoint:"supports_interface",calldata:[vN(r)]};try{const e=await t.callContract(i);return 0n!==BigInt(e[0])}catch{return!1}}Ix({},{supportsInterface:()=>aO});function sO(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function hO(t){return t.request({type:"wallet_getPermissions"})}function uO(t,e){return t.request({type:"wallet_watchAsset",params:e})}function lO(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function cO(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function dO(t){return t.request({type:"wallet_requestChainId"})}function fO(t){return t.request({type:"wallet_deploymentData"})}function mO(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function pO(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function gO(t,e){return t.request({type:"wallet_signTypedData",params:e})}function yO(t){return t.request({type:"wallet_supportedSpecs"})}function wO(t,e){t.on("accountsChanged",e)}function vO(t,e){t.on("networkChanged",e)}Ix({},{addDeclareTransaction:()=>pO,addInvokeTransaction:()=>mO,addStarknetChain:()=>lO,deploymentData:()=>fO,getPermissions:()=>hO,onAccountChange:()=>wO,onNetworkChanged:()=>vO,requestAccounts:()=>sO,requestChainId:()=>dO,signMessage:()=>gO,supportedSpecs:()=>yO,switchStarknetChain:()=>cO,watchAsset:()=>uO});var bO=t=>{const e=t[t.length-1];return"object"==typeof e&&["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"].some((t=>t in e))?{args:t,options:t.pop()}:{args:t}};function kO(t,e){return async function(...r){const i=bO(r);return t.call(e.name,i.args,{parseRequest:!0,parseResponse:!0,...i.options})}}function MO(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?kO(t,e):function(t,e){return async function(...r){const i=bO(r);return t.invoke(e.name,i.args,{parseRequest:!0,...i.options})}}(t,e)}function _O(t,e){return function(...r){return t.estimate(e.name,r)}}function EO(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}var AO=class{abi;address;providerOrAccount;deployTransactionHash;structs;events;functions;callStatic;populateTransaction;estimateFee;callData;constructor(t,e,r=Uz){this.address=e&&e.toLowerCase(),this.providerOrAccount=r,this.callData=new gT(t),this.structs=gT.getAbiStruct(t),this.events=Wz(t);const i=YI(t);this.abi=i.getLegacyFormat();const n={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach((t=>{if("function"!==t.type)return;const e=t.name;var r,i;this[e]||Object.defineProperty(this,e,{...n,value:MO(this,t)}),this.functions[e]||Object.defineProperty(this.functions,e,{...n,value:MO(this,t)}),this.callStatic[e]||Object.defineProperty(this.callStatic,e,{...n,value:kO(this,t)}),this.populateTransaction[e]||Object.defineProperty(this.populateTransaction,e,{...n,value:(r=this,i=t,function(...t){return r.populate(i.name,t)})}),this.estimateFee[e]||Object.defineProperty(this.estimateFee,e,{...n,value:_O(this,t)})}))}attach(t){this.address=t}connect(t){this.providerOrAccount=t}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(t,e=[],{parseRequest:r=!0,parseResponse:i=!0,formatResponse:n,blockIdentifier:o}={}){uN(null!==this.address,"contract is not connected to an address");const a=EO(e,(()=>r?(this.callData.validate(tN.CALL,t,e),this.callData.compile(t,e)):(_C.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e)));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:a,entrypoint:t},o).then((e=>i?n?this.callData.format(t,e,n):this.callData.parse(t,e):e))}invoke(t,e=[],{parseRequest:r=!0,maxFee:i,nonce:n,signature:o}={}){uN(null!==this.address,"contract is not connected to an address");const a=EO(e,(()=>r?(this.callData.validate(tN.INVOKE,t,e),this.callData.compile(t,e)):(_C.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e))),s={contractAddress:this.address,calldata:a,entrypoint:t};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(s,void 0,{maxFee:i,nonce:n});if(!n)throw new Error("Nonce is required when invoking a function without an account");return _C.warn(`Invoking ${t} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...s,signature:o},{nonce:n})}async estimate(t,e=[]){uN(null!==this.address,"contract is not connected to an address"),EO(e,(()=>!1))||this.callData.validate(tN.INVOKE,t,e);const r=this.populate(t,e);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(r);throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){const r=EO(e,(()=>this.callData.compile(t,e)));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){let e;return t.match({success:t=>{const r=t.events?.map((e=>({block_hash:t.block_hash,block_number:t.block_number,transaction_hash:t.transaction_hash,...e}))).filter((t=>EN(t.from_address)===EN(this.address)),[])||[];e=Qz(r,this.events,this.structs,gT.getAbiEnum(this.abi))},_:()=>{throw Error("This transaction was not successful.")}}),e}isCairo1(){return eI.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typedv2(t){return this}},jO={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"},2192:{key:"2192",name:"SnaxChain",shortName:"mainnet",chainId:2192,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.snaxchain.io"},start:1554893,logo:"ipfs://bafkreibzz757piho2llzkbiszpvalf5k5hpmxcwhvrmgp7vpz2vp4vj7ly"},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://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"},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://explorer.celo.org"},start:6599803,logo:"ipfs://QmS2tVJ7rdJRe1NHXAi2L86yCbUwVVrmB2mHQeNdJxvQti"},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://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",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/DmMXLtMZnGbQXASJ7p1jfzLUbBYnYUD9zNBTxpkjHYXV",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:["https://starknet-mainnet.public.blastapi.io"],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:["https://starknet-sepolia.public.blastapi.io"],start:7,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"}};const xO=new Map,SO={evm:function(t,e){return new Am({url:`${e.broviderUrl}/${t}`,timeout:e.timeout,allowGzip:!0},Number(t))},starknet:function(t,e){return new Fz({nodeUrl:`${e.broviderUrl}/${t}`})}};function NO(t,e={}){const r=function(t){const e=jO[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=xO.get(n);if(o)return o;const a=function(t){var e;return(null===(e=jO[t])||void 0===e?void 0:e.starknet)?"starknet":"evm"}(t),s=SO[a](r,i);return xO.set(n,s),s}var IO,TO,CO,zO;const OO={SN_MAIN:null===(TO=null===(IO=jO[Cx.StarknetChainId.SN_MAIN])||void 0===IO?void 0:IO.rpc)||void 0===TO?void 0:TO[0],SN_SEPOLIA:null===(zO=null===(CO=jO[Cx.StarknetChainId.SN_SEPOLIA])||void 0===CO?void 0:CO.rpc)||void 0===zO?void 0:zO[0]},RO=[{name:"argent::common::account::IAccount",type:"interface",items:[{name:"is_valid_signature",type:"function",inputs:[{name:"hash",type:"core::felt252"},{name:"signature",type:"core::array::Array::<core::felt252>"}],outputs:[{type:"core::felt252"}],state_mutability:"view"}]}];function PO(t,e){var r;if(!OO[t])throw new Error("Invalid network");return new Fz({nodeUrl:null!==(r=null==e?void 0:e.broviderUrl)&&void 0!==r?r:OO[t]})}function BO(t){return!!t.primaryType&&!!t.types.StarkNetDomain}function DO(t,e){const{domain:r,types:i,primaryType:n,message:o}=t;return WC.getMessageHash({types:i,primaryType:n,domain:r,message:o},e)}var $O=Object.freeze({__proto__:null,isStarknetMessage:BO,getHash:DO,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="SN_MAIN",n={}){try{const o=new AO(RO,t,PO(i,n));if(e.length<2)throw new Error("Invalid signature format");const a=yield o.is_valid_signature(DO(r,t),e.slice(-2));return Cs.from(a).eq(Cs.from("370462705988"))}catch(t){if(t.message.includes("Contract not found"))throw new Error("Contract not deployed");throw t}}))}});function LO(t){return He(Lr(t))}var FO=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],F=8191&L,U=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<,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,F))|0)+((8191&(n=(n=Math.imul(c,U))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,U))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,F),n=(n=Math.imul(m,U))+Math.imul(p,F)|0,o=Math.imul(p,U);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,F),n=(n=Math.imul(y,U))+Math.imul(w,F)|0,o=Math.imul(w,U),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,F),n=(n=Math.imul(b,U))+Math.imul(k,F)|0,o=Math.imul(k,U),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(_,F),n=(n=Math.imul(_,U))+Math.imul(E,F)|0,o=Math.imul(E,U),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,F),n=(n=Math.imul(j,U))+Math.imul(x,F)|0,o=Math.imul(x,U),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,F),n=(n=Math.imul(N,U))+Math.imul(I,F)|0,o=Math.imul(I,U),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,F),n=(n=Math.imul(C,U))+Math.imul(z,F)|0,o=Math.imul(z,U),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,F),n=(n=Math.imul(R,U))+Math.imul(P,F)|0,o=Math.imul(P,U),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,F),n=(n=Math.imul(D,U))+Math.imul($,F)|0,o=Math.imul($,U),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 UO=FO.BN;const qO=new vt("bignumber/5.6.2"),VO={},HO=9007199254740991;let GO=!1;class ZO{constructor(t,e){t!==VO&&qO.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 JO(WO(this).fromTwos(t))}toTwos(t){return JO(WO(this).toTwos(t))}abs(){return"-"===this._hex[0]?ZO.from(this._hex.substring(1)):this}add(t){return JO(WO(this).add(WO(t)))}sub(t){return JO(WO(this).sub(WO(t)))}div(t){return ZO.from(t).isZero()&&YO("division-by-zero","div"),JO(WO(this).div(WO(t)))}mul(t){return JO(WO(this).mul(WO(t)))}mod(t){const e=WO(t);return e.isNeg()&&YO("division-by-zero","mod"),JO(WO(this).umod(e))}pow(t){const e=WO(t);return e.isNeg()&&YO("negative-power","pow"),JO(WO(this).pow(e))}and(t){const e=WO(t);return(this.isNegative()||e.isNeg())&&YO("unbound-bitwise-result","and"),JO(WO(this).and(e))}or(t){const e=WO(t);return(this.isNegative()||e.isNeg())&&YO("unbound-bitwise-result","or"),JO(WO(this).or(e))}xor(t){const e=WO(t);return(this.isNegative()||e.isNeg())&&YO("unbound-bitwise-result","xor"),JO(WO(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&YO("negative-width","mask"),JO(WO(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&YO("negative-width","shl"),JO(WO(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&YO("negative-width","shr"),JO(WO(this).shrn(t))}eq(t){return WO(this).eq(WO(t))}lt(t){return WO(this).lt(WO(t))}lte(t){return WO(this).lte(WO(t))}gt(t){return WO(this).gt(WO(t))}gte(t){return WO(this).gte(WO(t))}isNegative(){return"-"===this._hex[0]}isZero(){return WO(this).isZero()}toNumber(){try{return WO(this).toNumber()}catch(t){YO("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return qO.throwError("this platform does not support BigInt",vt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?GO||(GO=!0,qO.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?qO.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",vt.errors.UNEXPECTED_ARGUMENT,{}):qO.throwError("BigNumber.toString does not accept parameters",vt.errors.UNEXPECTED_ARGUMENT,{})),WO(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof ZO)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new ZO(VO,KO(t)):t.match(/^-?[0-9]+$/)?new ZO(VO,KO(new UO(t))):qO.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&YO("underflow","BigNumber.from",t),(t>=HO||t<=-HO)&&YO("overflow","BigNumber.from",t),ZO.from(String(t));const e=t;if("bigint"==typeof e)return ZO.from(e.toString());if(At(e))return ZO.from(Tt(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return ZO.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 ZO.from(t)}return qO.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function KO(t){if("string"!=typeof t)return KO(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&qO.throwArgumentError("invalid hex","value",t),"0x00"===(t=KO(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 JO(t){return ZO.from(KO(t))}function WO(t){const e=ZO.from(t).toHexString();return"-"===e[0]?new UO("-"+e.substring(3),16):new UO(e.substring(2),16)}function YO(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),qO.throwError(t,vt.errors.NUMERIC_FAULT,i)}var QO=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 XO=new vt("hash/5.6.1"),tR=new Uint8Array(32);tR.fill(0);const eR=ZO.from(-1),rR=ZO.from(0),iR=ZO.from(1),nR=ZO.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const oR=Pt(iR.toHexString(),32),aR=Pt(rR.toHexString(),32),sR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},hR=["name","version","chainId","verifyingContract","salt"];function uR(t){return function(e){return"string"!=typeof e&&XO.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const lR={name:uR("name"),version:uR("version"),chainId:function(t){try{return ZO.from(t).toString()}catch(t){}return XO.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return nr(t).toLowerCase()}catch(t){}return XO.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 XO.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function cR(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))&&XO.throwArgumentError("invalid numeric width","type",t);const n=nR.mask(r?i-1:i),o=r?n.add(iR).mul(eR):rR;return function(e){const r=ZO.from(e);return(r.lt(o)||r.gt(n))&&XO.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))&&XO.throwArgumentError("invalid bytes width","type",t),function(e){return jt(e).length!==r&&XO.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=jt(t),r=e.length%32;return r?Ot([e,tR.slice(r)]):Tt(e)}(e)}}}switch(t){case"address":return function(t){return Pt(nr(t),32)};case"bool":return function(t){return t?oR:aR};case"bytes":return function(t){return He(t)};case"string":return function(t){return LO(t)}}return null}function dR(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class fR{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]&&XO.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&&XO.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);cR(a)||(r[a]||XO.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?XO.throwArgumentError("missing primary type","types",t):n.length>1&&XO.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]&&XO.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]=dR(e,t[e])+r.map((e=>dR(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=cR(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&&XO.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=LO(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 XO.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||XO.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(cR(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&&XO.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)),{}):XO.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new fR(t)}static getPrimaryType(t){return fR.from(t).primaryType}static hashStruct(t,e,r){return fR.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=sR[r];i||XO.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>hR.indexOf(t.name)-hR.indexOf(e.name))),fR.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Ot(["0x1901",fR.hashDomain(t),fR.from(e).hash(r)])}static hash(t,e,r){return He(fR.encode(t,e,r))}static resolveNames(t,e,r,i){return QO(this,void 0,void 0,(function*(){t=Xt(t);const n={};t.verifyingContract&&!Nt(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=fR.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){fR.hashDomain(t);const i={},n=[];hR.forEach((e=>{const r=t[e];null!=r&&(i[e]=lR[e](r),n.push({name:e,type:sR[e]}))}));const o=fR.from(e),a=Xt(e);return a.EIP712Domain?XO.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 ZO.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&XO.throwArgumentError("invalid string","value",e),e}return XO.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new vt("wallet/5.6.2");function mR(t,e,r,i){return Ba(fR.hash(t,e,r),i)}const pR="6492649264926492649264926492649264926492649264926492649264926492";function gR(t,e){return t.toLowerCase()===e.toLowerCase()}function yR(t){const{domain:e,types:r,message:i}=t;return $u.hash(e,r,i)}function wR(t,e,i,n){return r(this,void 0,void 0,(function*(){let r;try{r=yield nB(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 gR(r,"0x1626ba7e")}))}function vR(t,e,i,n){return r(this,void 0,void 0,(function*(){return gR(yield nB(n,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[jt(i),e]]),"0x20c13b0b")}))}var bR=Object.freeze({__proto__:null,getHash:yR,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(gR(t,mR(o,a,s,e)))return!0}catch(t){}const h=NO(i,n),u=yR(r);if(e.endsWith(pR))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 wR(t,e,u,h))||(yield vR(t,e,u,h))}))}});var kR=["ipfs.snapshot.box","snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];class MR{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=>MR.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 _R{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=>_R.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 ER(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function AR(t,e){return Math.sqrt(t*e)}function jR(t){return t*t}function xR(t,e){return t.map((t=>e*t))}class SR{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=>SR.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=>AR(ER(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return jR(i)}));return xR(r.map(((t,e)=>ER(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=>AR(ER(t.choice[r+1],Object.values(t.choice)),t.scores[i]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[jR(t)]))));return r.map(((t,i)=>xR(this.strategies.map(((t,e)=>ER(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=ER(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function NR(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:NR(t.map((t=>[t[0].filter((t=>t!=s)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function IR(t){const e=NR(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class TR{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=>TR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=IR(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=IR(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=>{if(this.proposal.choices[t-1])return this.proposal.choices[t-1]})).map(((t,e)=>`(${mB(e+1)}) ${t}`)).join(", ")}}class CR{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=>CR.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 zR(t,e,r){const i=r.reduce(((t,e)=>t+e),0),n=e[t]/i*100;return isNaN(n)?0:n}function OR(t,e,r){return zR(t+1,e,Object.values(e))/100*r}class RR{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=>RR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>OR(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)=>zR(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=>OR(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)=>zR(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*zR(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var PR={"single-choice":MR,approval:_R,quadratic:SR,"ranked-choice":TR,copeland:CR,weighted:RR,basic:MR};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"},DR=1e3;function $R(t){return t.length===DR&&t[0].timestamp===t[t.length-1].timestamp}function LR(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function FR(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function UR(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:DR,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 oB(t,n)).delegations||[]}))}const qR=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"];function VR(t,e){if(!e||!e.outputs||!Array.isArray(t)||0===t.length)return t;const r=e.outputs[0],i=t[0];try{switch(r.type){case"core::felt252":try{return qN.decodeShortString(i)}catch(t){return i}case"core::integer::u8":case"core::integer::u16":case"core::integer::u32":case"core::integer::u64":return parseInt(i,16);case"core::integer::u128":case"core::integer::usize":return BigInt(i).toString();case"core::integer::u256":return qz.uint256ToBN({low:i,high:t[1]||"0x0"});case"core::integer::i8":case"core::integer::i16":case"core::integer::i32":case"core::integer::i64":return parseInt(i,16);case"core::integer::i128":return BigInt(i).toString();case"core::bool":return"0x1"===i||"0x01"===i;default:return i}}catch(e){return t}}const HR=t=>{if(0===t.length)return[];const[e,...r]=t,i=Number(lN.toBigInt(e)),n=r.slice(0,i),o=r.slice(i);return[n,...HR(o)]};var GR="__lodash_hash_undefined__",ZR="[object Function]",KR="[object GeneratorFunction]",JR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,WR=/^\w*$/,YR=/^\./,QR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,XR=/\\(\\)?/g,tP=/^\[object .+?Constructor\]$/,eP=/^(?:0|[1-9]\d*)$/,rP="object"==typeof i&&i&&i.Object===Object&&i,iP="object"==typeof self&&self&&self.Object===Object&&self,nP=rP||iP||Function("return this")();var oP,aP=Array.prototype,sP=Function.prototype,hP=Object.prototype,uP=nP["__core-js_shared__"],lP=(oP=/[^.]+$/.exec(uP&&uP.keys&&uP.keys.IE_PROTO||""))?"Symbol(src)_1."+oP:"",cP=sP.toString,dP=hP.hasOwnProperty,fP=hP.toString,mP=RegExp("^"+cP.call(dP).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pP=nP.Symbol,gP=aP.splice,yP=NP(nP,"Map"),wP=NP(Object,"create"),vP=pP?pP.prototype:void 0,bP=vP?vP.toString:void 0;function kP(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 MP(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 _P(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 EP(t,e,r){var i=t[e];dP.call(t,e)&&OP(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function AP(t,e){for(var r=t.length;r--;)if(OP(t[r][0],e))return r;return-1}function jP(t){if(!PP(t)||(e=t,lP&&lP in e))return!1;var e,r=function(t){var e=PP(t)?fP.call(t):"";return e==ZR||e==KR}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?mP:tP;return r.test(function(t){if(null!=t){try{return cP.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function xP(t,e,r,i){if(!PP(t))return t;e=function(t,e){if(RP(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||BP(t))return!0;return WR.test(t)||!JR.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return RP(t)?t:TP(t)}(e);for(var n=-1,o=e.length,a=o-1,s=t;null!=s&&++n<o;){var h=CP(e[n]),u=r;if(n!=a){var l=s[h];void 0===(u=i?i(l,h,s):void 0)&&(u=PP(l)?l:IP(e[n+1])?[]:{})}EP(s,h,u),s=s[h]}return t}function SP(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 NP(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return jP(r)?r:void 0}function IP(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||eP.test(t))&&t>-1&&t%1==0&&t<e}kP.prototype.clear=function(){this.__data__=wP?wP(null):{}},kP.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},kP.prototype.get=function(t){var e=this.__data__;if(wP){var r=e[t];return r===GR?void 0:r}return dP.call(e,t)?e[t]:void 0},kP.prototype.has=function(t){var e=this.__data__;return wP?void 0!==e[t]:dP.call(e,t)},kP.prototype.set=function(t,e){return this.__data__[t]=wP&&void 0===e?GR:e,this},MP.prototype.clear=function(){this.__data__=[]},MP.prototype.delete=function(t){var e=this.__data__,r=AP(e,t);return!(r<0)&&(r==e.length-1?e.pop():gP.call(e,r,1),!0)},MP.prototype.get=function(t){var e=this.__data__,r=AP(e,t);return r<0?void 0:e[r][1]},MP.prototype.has=function(t){return AP(this.__data__,t)>-1},MP.prototype.set=function(t,e){var r=this.__data__,i=AP(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},_P.prototype.clear=function(){this.__data__={hash:new kP,map:new(yP||MP),string:new kP}},_P.prototype.delete=function(t){return SP(this,t).delete(t)},_P.prototype.get=function(t){return SP(this,t).get(t)},_P.prototype.has=function(t){return SP(this,t).has(t)},_P.prototype.set=function(t,e){return SP(this,t).set(t,e),this};var TP=zP((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(BP(t))return bP?bP.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return YR.test(t)&&r.push(""),t.replace(QR,(function(t,e,i,n){r.push(i?n.replace(XR,"$1"):e||t)})),r}));function CP(t){if("string"==typeof t||BP(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function zP(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(zP.Cache||_P),r}function OP(t,e){return t===e||t!=t&&e!=e}zP.Cache=_P;var RP=Array.isArray;function PP(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]"==fP.call(t)}var DP=function(t,e,r){return null==t?t:xP(t,e,r)};const $P={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,qR,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));const h=yield Promise.all(s.map((r=>{var i;return e.callContract({contractAddress:t,entrypoint:"aggregate",calldata:RC.fromCallsToExecuteCalldata(r)},null!==(i=o.blockTag)&&void 0!==i?i:"latest")})));return h.map((t=>{const[e,r,...i]=t;return HR(i)})).flat().map(((t,e)=>{const[,n]=i[e];return[VR(t,r.find((t=>t.name===n)))]}))}))}};function LP(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)||jO[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=jO[t])||void 0===o?void 0:o.starknet)?"starknet":"evm";return $P[u](a,e,r,i,h,s)}))}const FP=["response not found during CCIP fetch","UNSUPPORTED_OPERATION"],UP="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",qP=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],VP={146:{tlds:[".sonic"],registryContract:"0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4"}},HP=["function ownerOf(uint256 tokenId) view returns (address owner)"],GP=["1","11155111"],ZP=["109","157"],KP="0x0000000000000000000000000000000000000000",JP={Accept:"application/json","Content-Type":"application/json"},WP="https://score.snapshot.org";function YP(t=WP,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const i=r.searchParams.get("apiKey");let n=Object.assign({},JP);return i&&(r.searchParams.delete("apiKey"),n=Object.assign(Object.assign({},JP),{"X-API-KEY":i})),{url:r.toString(),headers:n}}function QP(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 XP=new vd({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});_d(XP),Ad(XP),XP.addFormat("address",{validate:t=>{try{return t===nr(t)}catch(t){return!1}}}),XP.addFormat("evmAddress",{validate:t=>{try{return nr(t),!0}catch(t){return!1}}}),XP.addFormat("starknetAddress",{validate:t=>{try{return Zz(t).toLowerCase()===t.toLowerCase()}catch(t){return!1}}}),XP.addFormat("long",{validate:()=>!0}),XP.addFormat("lowercase",{validate:t=>t===t.toLowerCase()}),XP.addFormat("color",{validate:t=>!!t&&!!t.match(/^#[0-9A-F]{6}$/)}),XP.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 tB=Object.keys(jO),eB=Object.keys(jO).filter((t=>!jO[t].testnet));function rB(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 iB(t){return r(this,void 0,void 0,(function*(){var e;const r=yield sB(`https://cloudflare-dns.com/dns-query?name=${t}&type=TXT`,{headers:{accept:"application/dns-json"}}),i=yield r.json();if(3===i.Status)return KP;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()):KP}))}function nB(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 oB(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 sB(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 aB(t,e=kR[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 sB(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 hB(t,i){return r(this,arguments,void 0,(function*(t,r,i="1",n={}){var o,a;const{ensResolvers:s=(null===(o=jO[i])||void 0===o?void 0:o.ensResolvers)||jO[1].ensResolvers,broviderUrl:h}=n,u=e(n,["ensResolvers","broviderUrl"]);let l;try{l=cu(lu(t))}catch(t){return null}const c=NO(i,{broviderUrl:h}),d=[[UP,"resolver",[l]],...s.map((t=>[t,"text",[l,r]]))],[[f],...m]=yield LP(i,c,qP,d,u),p=s.indexOf(f);return-1!==p?null===(a=m[p])||void 0===a?void 0:a[0]:null}))}function uB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield hB(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function lB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){var i,n;if(!(null===(n=null===(i=jO[e])||void 0===i?void 0:i.ensResolvers)||void 0===n?void 0:n.length))throw new Error("Network not supported");const o=rB(t),a=NO(e,r),s=new os(UP,["function owner(bytes32) view returns (address)"],a);let h;try{h=cu(lu(t))}catch(t){return KP}const u=r.ensNameWrapper||jO[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===KP&&"other-tld"===o){(yield a.resolveName(t))&&(l=yield iB(t))}if(l===KP&&"subdomain"===o)try{l=yield a.resolveName(t)}catch(t){if(FP.every((e=>!t.message.includes(e))))throw t;l=KP}return l||KP}))}function cB(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i=yield uB(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 lB(t,e,r)}))}function dB(t,e){return r(this,void 0,void 0,(function*(){if(!t.endsWith(".shib"))return KP;const r=yield sB("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 fB(t,e){return r(this,void 0,void 0,(function*(){var r;if(!((null===(r=VP[e])||void 0===r?void 0:r.tlds)||[]).some((e=>t.endsWith(e))))return Promise.resolve(KP);try{const r=cu(lu(t)),i=BigInt(r),n=NO(e);return yield nB(n,HP,[VP[e].registryContract,"ownerOf",[i]],{blockTag:"latest"})}catch(t){return KP}}))}function mB(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function pB(t){return!!jO[t]}function gB(t){return t!==KP&&(or(t)||wB(t))}function yB(t,e){return"latest"===t||"number"==typeof t&&t>=jO[e].start}function wB(t){if(!t)return!1;try{return Zz(t),!0}catch(t){return!1}}function vB(t){return or(t)}function bB(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&&vB(t))return nr(t);if("starknet"===r&&wB(t))return Zz(t);throw new Error(`Invalid ${r} address: ${t}`)}function kB(t){return Promise.reject(new Error(t))}XP.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?eB.includes(e):tB.includes(e)},error:{message:"network not allowed"}}),XP.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))}),XP.addFormat("domain",{validate:t=>!!t&&!!t.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(\/)?$/)});var MB={call:nB,multicall:LP,fetch:sB,subgraphRequest:oB,ipfsGet:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="ipfs"){return sB(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:aB,getJSON:function(t){return r(this,arguments,void 0,(function*(t,e={}){const r=aB(t,e.gateways);return(yield sB(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=WP,a={}){if(!Array.isArray(i))return kB("addresses should be an array of addresses");if(0===i.length)return kB("addresses can not be empty");const s=i.find((t=>!gB(t)));if(s)return kB(`Invalid address: ${s}`);if(!pB(r))return kB(`Invalid network: ${r}`);const h=e.find((t=>t.network&&!pB(t.network)));if(h)return kB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!yB(n,r))return kB(`Snapshot (${n}) must be 'latest' or greater than network start block (${jO[r].start})`);new URL(o).pathname="/api/scores";const{url:u,headers:l}=YP(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:n,strategies:e,addresses:i},s=yield sB(u,{method:"POST",headers:l,body:JSON.stringify({params:o})}),h=yield QP(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}=YP(null==s?void 0:s.url);if(!gB(t))return kB(`Invalid voter address: ${t}`);if(!pB(e))return kB(`Invalid network: ${e}`);const h=i.find((t=>t.network&&!pB(t.network)));if(h)return kB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!yB(n,e))return kB(`Snapshot (${n}) must be 'latest' or greater than network start block (${jO[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 sB(r,u);return(yield QP(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=XP.compile(t),n=i.call(r,e);return n||i.errors},getEnsTextRecord:hB,getSpaceUri:uB,getEnsOwner:lB,getSpaceController:function(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){if(GP.includes(e))return cB(t,e,r);if(ZP.includes(e))return dB(t,e);if(VP[String(e)])return fB(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?FR(e):null;for(;;){const t=yield UR({url:n,spaces:s,pivot:o,snapshot:r});if($R(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{LR(a,t),o=t.timestamp})),t.length<DR)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:mB,voting:PR,getProvider:NO,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 LP(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>DP(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 oB(c,l)).blocks.forEach((t=>o[t.network]=t.number)),jd[a]=o,o}))},getHash:function(t,e){return(BO(t)?$O:bR).getHash(t,e)},verify:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){if(!wB(t)&&!vB(t))throw new Error("Invalid address");const o=BO(r)?$O:bR;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(!gB(e))return kB(`Invalid author: ${e}`);if(!pB(n))return kB(`Invalid network: ${n}`);if(!yB(o,n))return kB(`Snapshot (${o}) must be 'latest' or greater than network start block (${jO[n].start})`);s||(s={});const{url:r,headers:h}=YP(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 sB(r,u);return(yield QP(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:wB,isEvmAddress:vB,getFormattedAddress:bB,SNAPSHOT_SUBGRAPH_URL:BR};const _B={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},EB={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"}]},AB={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"}]},jB={FlagProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},xB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},SB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},NB={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"}]},IB={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"}]},TB={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"}]},CB={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"}]},zB={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"}]},OB={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"}]},RB={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},PB={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"}]},DB={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},$B={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},LB={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"}]},FB={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},UB={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var qB={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},VB={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},HB={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const GB={name:"snapshot",version:"0.1.4"};class ZB{constructor(t=qB.sequencer,e={}){t=(t=(t=t.replace(qB.hub,qB.sequencer)).replace(VB.hub,VB.sequencer)).replace(HB.hub,HB.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=bB(e,"evm");i.from=i.from?bB(i.from):a,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const s=Object.assign({},GB);"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)=>{sB(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,_B)}))}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,EB)}))}updateProposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.privacy||(i.privacy=""),yield this.sign(t,e,i,AB)}))}flagProposal(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,jB)}))}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?SB:xB)}))}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?CB:NB;return["approval","ranked-choice"].includes(i.type)&&(o=n?zB:IB),!r&&["quadratic","weighted"].includes(i.type)&&(o=n?OB:TB,i.choice=JSON.stringify(i.choice)),r&&(o=n?OB:TB),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,RB)}))}unfollow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,PB)}))}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,DB)}))}profile(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,$B)}))}statement(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,LB)}))}alias(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,FB)}))}deleteSpace(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,UB)}))}}var KB={$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}}},JB={$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}}},WB={$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}}},YB={$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}}},QB={$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}}},XB={$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}}}},tD={$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:ZB,Client712:ZB,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:KB.definitions.Proposal,updateProposal:JB.definitions.UpdateProposal,vote:WB.definitions.Vote,profile:YB.definitions.Profile,statement:QB.definitions.Statement,zodiac:XB.definitions.Zodiac,alias:tD.definitions.Alias},utils:MB}}));
|
|
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]/,FA={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},UA=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=FA[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():UA)-(e.creation?e.creation.getTime():UA),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(UA):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 Fj(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 Uj(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 Fj(o,a,h):h;var l}return o.toughCookie=Oj,o}Uj.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},Cx={};Ix(Cx,{ADDR_BOUND:()=>yS,API_VERSION:()=>mS,BaseUrl:()=>MS,DEFAULT_GLOBAL_CONFIG:()=>RS,FeeMarginPercentage:()=>jS,HARDENING_4BYTES:()=>OS,HARDENING_BYTE:()=>zS,IS_BROWSER:()=>Jx,MASK_250:()=>dS,MASK_31:()=>fS,MAX_STORAGE_ITEM_SIZE:()=>gS,NetworkName:()=>_S,OutsideExecutionCallerAny:()=>IS,PRIME:()=>pS,RANGE_FELT:()=>vS,RANGE_I128:()=>bS,RANGE_U128:()=>kS,RPC_DEFAULT_VERSION:()=>SS,RPC_NODES:()=>NS,SNIP9_V1_INTERFACE_ID:()=>TS,SNIP9_V2_INTERFACE_ID:()=>CS,SYSTEM_MESSAGES:()=>PS,StarknetChainId:()=>ES,TEXT_TO_FELT_MAX_LEN:()=>lS,TRANSACTION_VERSION:()=>zx.ETransactionVersion,TransactionHashPrefix:()=>AS,UDC:()=>xS,ZERO:()=>cS});var zx={};Ix(zx,{JRPC:()=>Ox,RPCSPEC06:()=>Rx,RPCSPEC07:()=>qm});var Ox={},Rx={};Ix(Rx,{EBlockTag:()=>qx,EDAMode:()=>Hx,EDataAvailabilityMode:()=>Vx,ESimulationFlag:()=>$x,ETransactionExecutionStatus:()=>Ux,ETransactionFinalityStatus:()=>Fx,ETransactionStatus:()=>Lx,ETransactionType:()=>Dx,ETransactionVersion:()=>Gx,ETransactionVersion2:()=>Zx,ETransactionVersion3:()=>Kx,Errors:()=>Px,SPEC:()=>Bx});var Px={},Bx={},Dx={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},$x={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},Lx={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Fx={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},Ux={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},qx={PENDING:"pending",LATEST:"latest"},Vx={L1:"L1",L2:"L2"},Hx={L1:0,L2:1},Gx={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},Zx={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},Kx={V3:"0x3",F3:"0x100000000000000000000000000000003"};((t,e,r)=>{Tx(t,e,"default"),r&&Tx(r,e,"default")})(zx,qm);Ix({},{IS_BROWSER:()=>Jx,addHexPrefix:()=>iS,arrayBufferToString:()=>Wx,atobUniversal:()=>Xx,btoaUniversal:()=>tS,buf2hex:()=>eS,calcByteLength:()=>oS,concatenateArrayBuffer:()=>uS,padLeft:()=>nS,pascalToSnake:()=>hS,removeHexPrefix:()=>rS,sanitizeBytes:()=>aS,sanitizeHex:()=>sS,stringToArrayBuffer:()=>Qx,utf8ToArray:()=>Yx});var Jx="undefined"!=typeof window;function Wx(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function Yx(t){return(new TextEncoder).encode(t)}function Qx(t){return Yx(t)}function Xx(t){return lp.decode(t)}function tS(t){return lp.encode(new Uint8Array(t))}function eS(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function rS(t){return t.replace(/^0x/i,"")}function iS(t){return`0x${rS(t)}`}function nS(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 oS(t,e=8){const{length:r}=t,i=r%e;return i?(r-i)/e*e+e:r}function aS(t,e=8,r="0"){return nS(t,oS(t,e),r)}function sS(t){const e=aS(rS(t),2);return e?iS(e):e}var hS=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function uS(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 lS=31,cS=0n,dS=2n**250n-1n,fS=2n**31n-1n,mS=cS,pS=2n**251n+17n*2n**192n+1n,gS=256n,yS=2n**251n-gS,wS=(t,e)=>({min:t,max:e}),vS=wS(cS,pS-1n),bS=wS(-(2n**127n),2n**127n-1n),kS=wS(cS,2n**128n-1n),MS=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_SEPOLIA="https://alpha-sepolia.starknet.io",t))(MS||{}),_S=(t=>(t.SN_MAIN="SN_MAIN",t.SN_SEPOLIA="SN_SEPOLIA",t))(_S||{}),ES=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_SEPOLIA="0x534e5f5345504f4c4941",t))(ES||{}),AS=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(AS||{}),jS=(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))(jS||{}),xS={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},SS="v0_7",NS={SN_MAIN:[`https://starknet-mainnet.public.blastapi.io/rpc/${SS}`,`https://free-rpc.nethermind.io/mainnet-juno/${SS}`],SN_SEPOLIA:[`https://starknet-sepolia.public.blastapi.io/rpc/${SS}`,`https://free-rpc.nethermind.io/sepolia-juno/${SS}`]},IS="0x414e595f43414c4c4552",TS="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",CS="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",zS=128,OS=2147483648n,RS={legacyMode:!1,logLevel:"INFO",accountTxVersion:zx.ETransactionVersion.V2},PS={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"},BS={};Ix(BS,{RpcChannel:()=>HC});Ix({},{parse:()=>$S,parseAlwaysAsBig:()=>LS,stringify:()=>FS,stringifyAlwaysAsBig:()=>US});var DS=t=>{if(!yp(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},$S=t=>zp(String(t),void 0,DS),LS=t=>zp(String(t),void 0,Ip),FS=(t,e,r,i)=>dg(t,e,r,i),US=FS,qS={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 VS=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)}},HS=class extends VS{},GS=class extends HS{constructor(t,e,r){super(`RPC: ${e} with params ${FS(r,null,2)}\n\n ${t.code}: ${t.message}: ${FS(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return qS[t]===this.code}};Ix({},{BlockStatus:()=>QS,BlockTag:()=>XS,ETH_ADDRESS:()=>iN,EntryPointType:()=>ZS,Literal:()=>rN,NON_ZERO_PREFIX:()=>nN,OutsideExecutionTypesV1:()=>oN,OutsideExecutionTypesV2:()=>aN,OutsideExecutionVersion:()=>sN,RPC:()=>zx,TransactionExecutionStatus:()=>YS,TransactionFinalityStatus:()=>WS,TransactionStatus:()=>JS,TransactionType:()=>KS,TypedDataRevision:()=>Fm,Uint:()=>eN,ValidateType:()=>tN});var ZS={EXTERNAL:"EXTERNAL",L1_HANDLER:"L1_HANDLER",CONSTRUCTOR:"CONSTRUCTOR"},KS={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE_FUNCTION"},JS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",REJECTED:"REJECTED",REVERTED:"REVERTED"},WS={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},YS={REJECTED:"REJECTED",REVERTED:"REVERTED",SUCCEEDED:"SUCCEEDED"},QS={PENDING:"PENDING",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",REJECTED:"REJECTED"},XS={PENDING:"pending",LATEST:"latest"},tN={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},eN={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"},rN={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>"},iN="core::starknet::eth_address::EthAddress",nN="core::zeroable::NonZero::",oN={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*"}]},aN={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*"}]},sN=(t=>(t.UNSUPPORTED="0",t.V1="1",t.V2="2",t))(sN||{}),hN=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:FS(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 uN(t,e){if(!t)throw new Error(e||"Assertion failure")}var lN={};Ix(lN,{addPercent:()=>ON,assertInRange:()=>AN,bigNumberishArrayToDecimalStringArray:()=>jN,bigNumberishArrayToHexadecimalStringArray:()=>xN,cleanHex:()=>EN,getDecimalString:()=>NN,getHexString:()=>IN,getHexStringArray:()=>TN,hexToBytes:()=>zN,hexToDecimalString:()=>_N,isBigNumberish:()=>PN,isHex:()=>yN,isStringWholeNumber:()=>SN,stringToSha256ToArrayBuff4:()=>RN,toBigInt:()=>wN,toCairoBool:()=>CN,toHex:()=>vN,toHex64:()=>MN,toHexString:()=>bN,toStorageKey:()=>kN});var cN=t=>void 0===t||void 0===t;function dN(t){return"number"==typeof t}function fN(t){return"boolean"==typeof t}function mN(t){return"bigint"==typeof t}function pN(t){return"string"==typeof t}function gN(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function yN(t){return/^0x[0-9a-f]*$/i.test(t)}function wN(t){return BigInt(t)}function vN(t){return iS(wN(t).toString(16))}var bN=vN;function kN(t){return iS(wN(t).toString(16).padStart(64,"0"))}function MN(t){const e=iS(wN(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function _N(t){return BigInt(iS(t)).toString(10)}function EN(t){return t.toLowerCase().replace(/^(0x)0+/,"$1")}function AN(t,e,r,i=""){const n=""===i?"invalid length":`invalid ${i} length`,o=BigInt(t),a=BigInt(e),s=BigInt(r);uN(o>=a&&o<=s,`Message not signable, ${n}.`)}function jN(t){return t.map((t=>wN(t).toString(10)))}function xN(t){return t.map((t=>vN(t)))}function SN(t){return/^\d+$/.test(t)}function NN(t){if(yN(t))return _N(t);if(SN(t))return t;throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function IN(t){if(yN(t))return t;if(SN(t))return bN(t);throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function TN(t){return t.map(IN)}function CN(t){return(+t).toString()}function zN(t){if(!yN(t))throw new Error(`${t} needs to be a hex-string`);let e=rS(t);return e.length%2!=0&&(e=`0${e}`),Ig(e)}function ON(t,e){const r=BigInt(t);return r+r*BigInt(e)/100n}function RN(t){var e;return zN(vN((e=BigInt(iS(eS(py(t)))),Number(e&fS))))}function PN(t){return dN(t)||mN(t)||pN(t)&&(yN(t)||SN(t))}function BN(t){const e=rS(vN(BigInt(t))),r=e.length%2==0?e:`0${e}`;return iS(_v(zN(iS(r))).toString(16))}function DN(t){const e=BigInt(function(t){return iS(_v(Yx(t)).toString(16))}(t));return e&dS}function $N(t){return vN(DN(t))}function LN(t){return dN(t)||mN(t)?vN(t):yN(t)?t:SN(t)?vN(t):$N(t)}function FN(t){const e=iS(t.reduce(((t,e)=>t+rS(vN(e)).padStart(64,"0")),""));return iS(bg(Yv(zN(e))))}function UN(t,e,r,i,n){return FN([t,e,n,r,i.length,...i])}Ix({},{getL2MessageHash:()=>UN,getSelector:()=>LN,getSelectorFromName:()=>$N,keccakBn:()=>BN,solidityUint256PackedKeccak256:()=>FN,starknetKeccak:()=>DN});var qN={};function VN(t){return/^[\x00-\x7F]*$/.test(t)}function HN(t){return t.length<=lS}function GN(t){return/^[0-9]*$/i.test(t)}function ZN(t){return pN(t)&&!yN(t)&&!SN(t)}Ix(qN,{decodeShortString:()=>QN,encodeShortString:()=>YN,isASCII:()=>VN,isDecimalString:()=>GN,isLongText:()=>JN,isShortString:()=>HN,isShortText:()=>KN,isText:()=>ZN,splitLongString:()=>WN});var KN=t=>ZN(t)&&HN(t),JN=t=>ZN(t)&&!HN(t);function WN(t){const e=RegExp(`[^]{1,${lS}}`,"g");return t.match(e)||[]}function YN(t){if(!VN(t))throw new Error(`${t} is not an ASCII string`);if(!HN(t))throw new Error(`${t} is too long`);return iS(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function QN(t){if(!VN(t))throw new Error(`${t} is not an ASCII string`);if(yN(t))return rS(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(GN(t))return QN("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}function XN(t){const e=0n===BigInt(t.pending_word)?"":QN(vN(t.pending_word));return t.data.reduce(((t,e)=>t+(0n===BigInt(e)?"":QN(vN(e)))),"")+e}function tI(t){const e=WN(t),r=e[e.length-1],i=e.map(YN),[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:()=>tI,stringFromByteArray:()=>XN});var eI={};function rI(t){if(mN(t)||Number.isInteger(t))return t.toString();if(pN(t)){if(yN(t))return BigInt(t).toString();if(ZN(t)){if(!HN(t))throw new Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(YN(t)).toString()}if(SN(t))return t}if(fN(t))return""+ +t;throw new Error(`${t} can't be computed by felt()`)}Ix(eI,{felt:()=>UI,getAbiContractVersion:()=>DI,getArrayType:()=>RI,isCairo1Abi:()=>PI,isCairo1Type:()=>OI,isLen:()=>pI,isTypeArray:()=>yI,isTypeBool:()=>xI,isTypeByteArray:()=>TI,isTypeBytes31:()=>II,isTypeContractAddress:()=>SI,isTypeEnum:()=>kI,isTypeEthAddress:()=>NI,isTypeFelt:()=>gI,isTypeLiteral:()=>jI,isTypeNamedTuple:()=>vI,isTypeNonZero:()=>BI,isTypeOption:()=>MI,isTypeResult:()=>_I,isTypeSecp256k1Point:()=>zI,isTypeStruct:()=>bI,isTypeTuple:()=>wI,isTypeU96:()=>CI,isTypeUint:()=>EI,isTypeUint256:()=>AI,tuple:()=>FI,uint256:()=>$I,uint512:()=>LI});var iI=(1n<<128n)-1n,nI=(1n<<256n)-1n,oI=0n,aI=340282366920938463463374607431768211455n,sI=340282366920938463463374607431768211455n,hI=0n,uI=0n,lI=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&iI,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<oI)throw Error("bigNumberish is smaller than UINT_256_MIN");if(e>nI)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<hI||r>aI)throw new Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX");if(i<uI||i>sI)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:iS(this.low.toString(16)),high:iS(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[rI(this.low),rI(this.high)]}},cI=(1n<<512n)-1n,dI=0n,fI=0n,mI=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&iI,this.limb1=(r&iI<<128n)>>128n,this.limb2=(r&iI<<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<dI)throw Error("bigNumberish is smaller than UINT_512_MIN.");if(e>cI)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<fI||t>iI)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:iS(this.limb0.toString(16)),limb1:iS(this.limb1.toString(16)),limb2:iS(this.limb2.toString(16)),limb3:iS(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[rI(this.limb0),rI(this.limb1),rI(this.limb2),rI(this.limb3)]}},pI=t=>/_len$/.test(t),gI=t=>"felt"===t||"core::felt252"===t,yI=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),wI=t=>/^\(.*\)$/i.test(t),vI=t=>/\(.*\)/i.test(t)&&t.includes(":"),bI=(t,e)=>t in e,kI=(t,e)=>t in e,MI=t=>t.startsWith("core::option::Option::"),_I=t=>t.startsWith("core::result::Result::"),EI=t=>Object.values(eN).includes(t),AI=t=>lI.isAbiType(t),jI=t=>Object.values(rN).includes(t),xI=t=>"core::bool"===t,SI=t=>t===rN.ContractAddress,NI=t=>t===iN,II=t=>"core::bytes_31::bytes31"===t,TI=t=>"core::byte_array::ByteArray"===t,CI=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,zI=t=>t===rN.Secp256k1Point,OI=t=>t.includes("::"),RI=t=>OI(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function PI(t){const{cairo:e}=DI(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function BI(t){return t.startsWith(nN)}function DI(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 OI(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var $I=t=>new lI(t).toUint256DecimalString(),LI=t=>new mI(t).toUint512DecimalString(),FI=(...t)=>({...t});function UI(t){return rI(t)}var qI=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=>!cN(t))).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find((t=>!cN(t)))}activeVariant(){const t=Object.entries(this.variant).find((t=>!cN(t[1])));return cN(t)?"":t[0]}},VI={Some:0,None:1},HI=class{Some;None;constructor(t,e){if(!(t in Object.values(VI)))throw new Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===VI.Some){if(cN(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!cN(this.Some)}isNone(){return!0===this.None}},GI={Ok:0,Err:1},ZI=class{Ok;Err;constructor(t,e){if(!(t in Object.values(GI)))throw new Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===GI.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!cN(this.Ok))return this.Ok;if(!cN(this.Err))return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!cN(this.Ok)}isErr(){return!cN(this.Err)}},KI=(t,e,r)=>{if(!mN(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]}`)},JI=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function WI(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=WI(t[n],t[n].map((t=>a)));return i[n]=Object.values(e).join(""),i}return KI(t,e,n),i[n]=QN(o),i}if("number"===a)return KI(t,e,n),i[n]=Number(o),i;if("function"==typeof a)return i[n]=a(o),i;if(Array.isArray(a)){const e=WI(t[n],a,a[0]);return i[n]=Object.values(e),i}return gN(a)?(i[n]=WI(t[n],a),i):(JI(t,e,n),i)}),{})}function YI(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:PI(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)=>pI(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 QI(t,e,r){return"constructor"===t&&!r&&!e.length}function XI(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 tT(t){return OI(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+XI(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+XI(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 vI(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 eT=class t{content;arrayType;constructor(e,r){uN(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].`)}uN(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 rT(t,e,r,i){const n=(t,e)=>{if(eT.isTypeFixedArray(e))return function(t,e){const r=eT.getFixedArrayType(e),i=eT.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(yI(e))return function(t,e){const r=RI(e);if(pN(t))return t;return t.map((t=>n(t,r)))}(t,e);if(kI(e,i)){const r=i[e];return a(t,r)}if(wI(e))return function(t,e){const r=tT(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(NI(e))return t;if(BI(e))return t;if(TI(e))return t;if(CI(e))return t;if(zI(e))return t;if(lI.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(mI.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(bI(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]&&(OI(r.type)||!pI(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(_I(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 ZI(GI.Ok,n(t.unwrap(),i)):new ZI(GI.Err,n(t.unwrap(),o))}if(MI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new HI(VI.Some,n(r.unwrap(),i)):new HI(VI.None,{})}const r=t,i=Object.entries(r.variant).map((t=>{if(cN(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 qI(Object.fromEntries(i))};return e.reduce(((e,r)=>{return pI(r.name)&&!OI(r.type)||(i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i})),e;var i}),{})}function iT(t,e){switch(!0){case lI.isAbiType(t):return new lI(e).toApiRequest();case mI.isAbiType(t):return new mI(e).toApiRequest();case II(t):return YN(e.toString());case zI(t):{const t=rS(vN(e)).padStart(128,"0"),r=$I(iS(t.slice(-64))),i=$I(iS(t.slice(0,-64)));return[UI(i.low),UI(i.high),UI(r.low),UI(r.high)]}default:return UI(e)}}function nT(t,e,r,i){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(eT.isTypeFixedArray(e)){const n=eT.getFixedArrayType(e);let o=[];if(Array.isArray(t)){o=new eT(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),uN(o.length===eT.getFixedArraySize(e),`ABI type ${e}: object provided do not includes ${eT.getFixedArraySize(e)} items. ${o.length} items provided.`)}return o.reduce(((t,e)=>t.concat(nT(e,n,r,i))),[])}if(Array.isArray(t)){const n=[];n.push(UI(t.length));const o=RI(e);return t.reduce(((t,e)=>t.concat(nT(e,o,r,i))),n)}if(r[e]&&r[e].members.length){if(lI.isAbiType(e))return new lI(t).toApiRequest();if(mI.isAbiType(e))return new mI(t).toApiRequest();if(NI(e))return iT(e,t);if(TI(e))return function(t){const e=tI(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(nT(o[e.name],e.type,r,i))),[])}if(wI(e)){const n=function(t,e){const r=tT(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=nT(e.element,e.type,r,i);return t.concat(n)}),[])}if(lI.isAbiType(e))return new lI(t).toApiRequest();if(mI.isAbiType(e))return new mI(t).toApiRequest();if(kI(e,i)){const{variants:n}=i[e];if(MI(e)){const e=t;if(e.isSome()){const t=n.find((t=>"Some"===t.name));if(cN(t))throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return VI.Some.toString();const a=nT(e.unwrap(),o,r,i);return Array.isArray(a)?[VI.Some.toString(),...a]:[VI.Some.toString(),a]}return VI.None.toString()}if(_I(e)){const e=t;if(e.isOk()){const t=n.find((t=>"Ok"===t.name));if(cN(t))throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return GI.Ok.toString();const a=nT(e.unwrap(),o,r,i);return Array.isArray(a)?[GI.Ok.toString(),...a]:[GI.Ok.toString(),a]}const o=n.find((t=>"Err"===t.name));if(cN(o))throw Error("Error in abi : Result has no 'Err' variant.");const a=o.type;if("()"===a)return GI.Err.toString();const s=nT(e.unwrap(),a,r,i);return Array.isArray(s)?[GI.Err.toString(),...s]:[GI.Err.toString(),s]}const o=t,a=o.activeVariant(),s=n.find((t=>t.name===a));if(cN(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=nT(o.unwrap(),h,r,i);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if(BI(e))return iT(RI(e),t);if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return iT(e,t)}function oT(t,e){let r;switch(!0){case xI(t):return r=e.next().value,Boolean(BigInt(r));case lI.isAbiType(t):const i=e.next().value,n=e.next().value;return new lI(i,n).toBigInt();case mI.isAbiType(t):const o=e.next().value,a=e.next().value,s=e.next().value,h=e.next().value;return new mI(o,a,s,h).toBigInt();case NI(t):return r=e.next().value,BigInt(r);case II(t):return r=e.next().value,QN(r);case zI(t):const u=rS(e.next().value).padStart(32,"0"),l=rS(e.next().value).padStart(32,"0"),c=rS(e.next().value).padStart(32,"0"),d=rS(e.next().value).padStart(32,"0");return BigInt(iS(l+u+d+c));default:return r=e.next().value,BigInt(r)}}function aT(t,e,r,i){if("()"===e.type)return{};if(lI.isAbiType(e.type)){const e=t.next().value,r=t.next().value;return new lI(e,r).toBigInt()}if(mI.isAbiType(e.type)){const e=t.next().value,r=t.next().value,i=t.next().value,n=t.next().value;return new mI(e,r,i,n).toBigInt()}if(TI(e.type)){const e=[],r=BigInt(t.next().value);for(;e.length<r;)e.push(vN(t.next().value));return XN({data:e,pending_word:vN(t.next().value),pending_word_len:BigInt(t.next().value)})}if(eT.isTypeFixedArray(e.type)){const n=[],o={name:"",type:eT.getFixedArrayType(e.type)},a=eT.getFixedArraySize(e.type);for(;n.length<a;)n.push(aT(t,o,r,i));return n}if(yI(e.type)){const n=[],o={name:"",type:RI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(aT(t,o,r,i));return n}if(BI(e.type)){const n={name:"",type:RI(e.type)};return aT(t,n,r,i)}if(r&&e.type in r&&r[e.type])return NI(e.type)?oT(e.type,t):r[e.type].members.reduce(((e,n)=>(e[n.name]=aT(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]=aT(t,{name:"",type:o.type},r,i),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=n===VI.Some?o.Some:void 0;return new HI(n,t)}if(e.type.startsWith("core::result::Result")){let t;return t=n===GI.Ok?o.Ok:o.Err,new ZI(n,t)}return new qI(o)}if(wI(e.type)){return tT(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]=aT(t,s,r,i),e}),{})}if(yI(e.type)){const n=[],o={name:"",type:RI(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(aT(t,o,r,i));return n}return oT(e.type,t)}function sT(t,e,r,i,n){const{name:o,type:a}=e;let s;switch(!0){case pI(o):return s=t.next().value,BigInt(s);case r&&a in r||wI(a):case i&&kI(a,i):case eT.isTypeFixedArray(a):return aT(t,e,r,i);case yI(a):if(OI(a))return aT(t,e,r,i);const h=[];if(n&&n[`${o}_len`]){const a=n[`${o}_len`];for(;h.length<a;)h.push(aT(t,{name:o,type:e.type.replace("*","")},r,i))}return h;case BI(a):return aT(t,e,r,i);default:return oT(a,t)}}var hT=(t,e)=>{if(uN(pN(t)||dN(t)||mN(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),pN(t)&&!yN(t))return;const r=BigInt(t.toString(10));uN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},uT=(t,e)=>{let r;switch(dN(t)&&uN(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),uN(pN(t)||dN(t)||mN(t)||gN(t)&&"low"in t&&"high"in t||gN(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 eN.u256:r=new lI(t).toBigInt();break;case eN.u512:r=new mI(t).toBigInt();break;default:r=wN(t)}switch(e.type){case eN.u8:uN(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case eN.u16:uN(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case eN.u32:uN(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case eN.u64:uN(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case eN.u128:uN(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case eN.u256:uN(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case eN.u512:uN(mI.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case rN.ClassHash:case rN.ContractAddress:uN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case rN.Secp256k1Point:uN(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case rN.U96:uN(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},lT=(t,e)=>{uN(fN(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},cT=(t,e,r)=>{if(e.type!==eN.u256&&e.type!==eN.u512)if(NI(e.type)){uN(!gN(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);const r=BigInt(t.toString(10));uN(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else uN(gN(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})=>{uN(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else uT(t,e)},dT=(t,e)=>{uN(gN(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(!(MI(e.type)&&i.includes("isSome")&&i.includes("isNone")||_I(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.`)},fT=(t,e)=>{uN(gN(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},mT=(t,e,r,i)=>{const n=yI(e.type),o=n?RI(e.type):eT.getFixedArrayType(e.type);if(n&&gI(o)&&JN(t))return;let a=[];if(n)uN(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 gI(o):a.forEach((t=>hT(t,e)));break;case wI(o):a.forEach((t=>fT(t,{name:e.name,type:o})));break;case yI(o):a.forEach((t=>mT(t,{name:"",type:o},r,i)));break;case bI(o,r):a.forEach((t=>cT(t,{name:e.name,type:o},r)));break;case kI(o,i):a.forEach((t=>dT(t,{name:e.name,type:o})));break;case EI(o)||jI(o):a.forEach((t=>uT(t,{name:"",type:o})));break;case xI(o):a.forEach((t=>lT(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${a}`)}};function pT(t,e,r,i){t.inputs.reduce(((t,n)=>{const o=e[t];switch(!0){case pI(n.name):return t;case gI(n.type):hT(o,n);break;case II(n.type):((t,e)=>{uN(pN(t),`Validate: arg ${e.name} should be a string.`),uN(t.length<32,`Validate: arg ${e.name} cairo typed ${e.type} should be a string of less than 32 characters.`)})(o,n);break;case EI(n.type)||jI(n.type):uT(o,n);break;case xI(n.type):lT(o,n);break;case TI(n.type):((t,e)=>{uN(pN(t),`Validate: arg ${e.name} should be a string.`)})(o,n);break;case yI(n.type)||eT.isTypeFixedArray(n.type):mT(o,n,r,i);break;case bI(n.type,r):cT(o,n,r);break;case kI(n.type,i):dT(o,n);break;case wI(n.type):fT(o,n);break;case BI(n.type):((t,e)=>{const r=RI(e.type);switch(uN(EI(r)&&r!==mI.abiSelector||gI(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case gI(r):hT(t,e),uN(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case EI(r):uT(t,{name:"",type:r}),r===eN.u256?uN(new lI(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):uN(wN(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 gT=class t{abi;parser;structs;enums;constructor(e){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=YI(e),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if(t!==tN.DEPLOY){uN(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return t===tN.INVOKE?!r:r})).map((t=>t.name)).includes(e),(t===tN.INVOKE?"invocable":"viewable")+" method not found in abi")}const i=this.abi.find((r=>t===tN.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(QI(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}`);pT(i,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(QI(t,e,r))return[];let i;if(Array.isArray(e))i=e;else{const t=rT(e,r.inputs,this.structs,this.enums);i=Object.values(t),pT(r,i,this.structs,this.enums)}const n=i[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>pI(e.name)&&!OI(e.type)?t:t.concat(function(t,e,r,i){const{name:n,type:o}=e;let{value:a}=t.next();switch(!0){case eT.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 nT(a,e.type,r,i);case yI(o):if(!Array.isArray(a)&&!ZN(a))throw Error(`ABI expected parameter ${n} to be array or long string, got ${a}`);return pN(a)&&(a=WN(a)),nT(a,e.type,r,i);case BI(o):return iT(RI(o),a);case NI(o):return iT(o,a);case bI(o,r)||wI(o)||lI.isAbiType(o):case kI(o,i):return nT(a,o,r,i);default:return iT(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=$N(o):JN(o)&&(o=tI(o));const a=Array.isArray(i)&&"0"===t?"$$len":t;if(mN(o))return[[`${r}${a}`,UI(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()?VI.Some:VI.None;return t.isSome()?e({0:i,1:t.unwrap()},`${r}${a}.`):[[`${r}${a}`,UI(i)]]}if(i.includes("isOk")&&i.includes("isErr")){const t=o,i=t.isOk()?GI.Ok:GI.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}`,UI(n)]]:e({0:n,1:t.unwrap()},`${r}${a}.`)}return e(o,`${r}${a}.`)}return[[`${r}${a}`,UI(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]=sT(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 WI(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=>vN(t)))}decodeParameters(t,e){const r=Array.isArray(t)?t:[t],i=e.flat()[Symbol.iterator](),n=r.map((t=>sT(i,{name:"",type:t},this.structs,this.enums)));return 1===n.length?n[0]:n}};Ix({},{calculateContractAddressFromHash:()=>HT,calculateDeclareTransactionHash:()=>DT,calculateDeployAccountTransactionHash:()=>$T,calculateInvokeTransactionHash:()=>BT,calculateL2MessageTxHash:()=>MT,computeCompiledClassHash:()=>QT,computeContractClassHash:()=>eC,computeHashOnElements:()=>UT,computeHintedClassHash:()=>KT,computeLegacyContractClassHash:()=>JT,computePedersenHash:()=>LT,computePedersenHashOnElements:()=>qT,computePoseidonHash:()=>FT,computePoseidonHashOnElements:()=>VT,computeSierraContractClassHash:()=>tC,formatSpaces:()=>ZT,getL2MessageHash:()=>UN,getSelector:()=>LN,getSelectorFromName:()=>$N,hashByteCodeSegments:()=>YT,keccakBn:()=>BN,poseidon:()=>kw,solidityUint256PackedKeccak256:()=>FN,starknetKeccak:()=>DN});Ix({},{calculateDeclareTransactionHash:()=>vT,calculateDeployAccountTransactionHash:()=>bT,calculateL2MessageTxHash:()=>MT,calculateTransactionHash:()=>kT,calculateTransactionHashCommon:()=>wT,computeHashOnElements:()=>yT});function yT(t){return[...t,t.length].reduce(((t,e)=>kv(wN(t),wN(e))),0).toString()}function wT(t,e,r,i,n,o,a,s=[]){const h=yT(n);return yT([t,e,r,i,h,o,a,...s])}function vT(t,e,r,i,n,o,a){return wT("0x6465636c617265",r,e,0,[t],i,n,[o,...a?[a]:[]])}function bT(t,e,r,i,n,o,a,s){return wT("0x6465706c6f795f6163636f756e74",n,t,0,[e,i,...r],o,a,[s])}function kT(t,e,r,i,n,o){return wT("0x696e766f6b65",e,t,0,r,i,n,[o])}function MT(t,e,r,i,n,o){const a=[t,...i];return wT("0x6c315f68616e646c6572",0,e,LN(r),a,0,n,[o])}Ix({},{starkCurve:()=>Cv,weierstrass:()=>Vw});Ix({},{calculateDeclareTransactionHash:()=>RT,calculateDeployAccountTransactionHash:()=>OT,calculateInvokeTransactionHash:()=>PT,calculateTransactionHashCommon:()=>zT,encodeResourceBoundsL1:()=>IT,encodeResourceBoundsL2:()=>TT,hashDAMode:()=>NT,hashFeeField:()=>CT});var _T=t=>t.map((t=>BigInt(t))),ET=32n,AT=128n,jT=64n+AT,xT=BigInt(YN("L1_GAS")),ST=BigInt(YN("L2_GAS"));function NT(t,e){return(BigInt(t)<<ET)+BigInt(e)}function IT(t){return(xT<<jT)+(BigInt(t.l1_gas.max_amount)<<AT)+BigInt(t.l1_gas.max_price_per_unit)}function TT(t){return(ST<<jT)+(BigInt(t.l2_gas.max_amount)<<AT)+BigInt(t.l2_gas.max_price_per_unit)}function CT(t,e){const r=IT(e),i=TT(e);return Tv([BigInt(t),r,i])}function zT(t,e,r,i,n,o,a,s,h,u,l=[]){const c=CT(o,u),d=NT(s,h),f=_T([t,e,r,c,Tv(_T(a)),i,n,d,..._T(l)]);return vN(Tv(f))}function OT(t,e,r,i,n,o,a,s,h,u,l,c){return zT("0x6465706c6f795f6163636f756e74",n,t,o,a,l,c,s,h,u,[Tv(_T(r)),e,i])}function RT(t,e,r,i,n,o,a,s,h,u,l,c){return zT("0x6465636c617265",i,r,n,o,l,_T(c),s,h,u,[Tv(_T(a)),t,e])}function PT(t,e,r,i,n,o,a,s,h,u,l){return zT("0x696e766f6b65",e,t,i,n,u,l,a,s,h,[Tv(_T(o)),Tv(_T(r))])}function BT(t){return function(t){return[zx.ETransactionVersion.V3,zx.ETransactionVersion.F3].includes(t.version)}(t)?PT(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):kT(t.senderAddress,t.version,t.compiledCalldata,t.maxFee,t.chainId,t.nonce)}function DT(t){return function(t){return[zx.ETransactionVersion.V3,zx.ETransactionVersion.F3].includes(t.version)}(t)?RT(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):vT(t.classHash,t.senderAddress,t.version,t.maxFee,t.chainId,t.nonce,t.compiledClassHash)}function $T(t){return function(t){return[zx.ETransactionVersion.V3,zx.ETransactionVersion.F3].includes(t.version)}(t)?OT(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):bT(t.contractAddress,t.classHash,t.constructorCalldata,t.salt,t.version,t.maxFee,t.chainId,t.nonce)}function LT(t,e){return kv(BigInt(t),BigInt(e))}function FT(t,e){return vN(Iv(BigInt(t),BigInt(e)))}function UT(t){return[...t,t.length].reduce(((t,e)=>kv(BigInt(t),BigInt(e))),0).toString()}var qT=UT;function VT(t){return vN(Tv(t.map((t=>BigInt(t)))))}function HT(t,e,r,i){const n=UT(gT.compile(r)),o=UT([UI("0x535441524b4e45545f434f4e54524143545f41444452455353"),i,t,e,n]);return vN(BigInt(o)%yS)}function GT(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 ZT(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 KT(t){const{abi:e,program:r}=t,i=ZT(FS({abi:e,program:r},GT));return iS(_v(Yx(i)).toString(16))}function JT(t){const e=pN(t)?$S(t):t,r=vN(mS),i=UT(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),n=UT(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=UT(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),a=UT(e.program.builtins.map((t=>YN(t)))),s=KT(e),h=UT(e.program.data);return UT([r,i,n,o,a,s,h])}function WT(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,Tv(e.flatMap((t=>BigInt(YN(t))))))];var e}));return Tv(e)}function YT(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 QT(t){const e=BigInt(YN("COMPILED_CLASS_V1")),r=WT(t.entry_points_by_type.EXTERNAL),i=WT(t.entry_points_by_type.L1_HANDLER),n=WT(t.entry_points_by_type.CONSTRUCTOR),o=t.bytecode_segment_lengths?YT(t):Tv(t.bytecode.map((t=>BigInt(t))));return vN(Tv([e,r,i,n,o]))}function XT(t){return Tv(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function tC(t){const e=BigInt(YN("CONTRACT_CLASS_V0.1.0")),r=XT(t.entry_points_by_type.EXTERNAL),i=XT(t.entry_points_by_type.L1_HANDLER),n=XT(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=ZT(FS(t.abi,null));return BigInt(iS(_v(Yx(e)).toString(16)))}(t),a=Tv(t.sierra_program.map((t=>BigInt(t))));return vN(Tv([e,r,i,n,o,a]))}function eC(t){const e=pN(t)?$S(t):t;return"sierra_program"in e?tC(e):JT(e)}function rC(t){const e=pN(t)?t:FS(t);return tS(b_(e))}function iC(t){if(Array.isArray(t))return t;const e=Wx(k_(Xx(t)));return $S(e)}function nC(){return fv(uv.randomPrivateKey())}function oC(t){return iS(t).toLowerCase()}function aC(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>vN(t)));try{const{r:e,s:r}=t;return[vN(e),vN(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function sC(t){return jN(aC(t))}function hC(t){return xN(aC(t))}function uC(t,e=50){return ON(t,e)}function lC(t,e=50,r=50){if(mN(t))return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:"0x0",max_price_per_unit:"0x0"}};if(cN(t.gas_consumed)||cN(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?vN(ON(BigInt(t.overall_fee)/BigInt(t.gas_price),e)):vN(ON(t.gas_consumed,e)),max_price_per_unit:vN(ON(t.gas_price,r))}}}function cC(t){if(t===zx.EDataAvailabilityMode.L1)return zx.EDAMode.L1;if(t===zx.EDataAvailabilityMode.L2)return zx.EDAMode.L2;throw Error("EDAM conversion")}function dC(t,e){const r=e?vN(e):void 0,i=vN(t);if(e&&!Object.values(zx.ETransactionVersion).includes(r))throw Error(`providedVersion ${e} is not ETransactionVersion`);if(!Object.values(zx.ETransactionVersion).includes(i))throw Error(`defaultVersion ${t} is not ETransactionVersion`);return e?r:i}function fC(t){if(!t)return;const e=vN(t);if(e===zx.ETransactionVersion.V0)return zx.ETransactionVersion.F0;if(e===zx.ETransactionVersion.V1)return zx.ETransactionVersion.F1;if(e===zx.ETransactionVersion.V2)return zx.ETransactionVersion.F2;if(e===zx.ETransactionVersion.V3)return zx.ETransactionVersion.F3;throw Error(`toFeeVersion: ${e} is not supported`)}function mC(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||zx.EDataAvailabilityMode.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||zx.EDataAvailabilityMode.L1,resourceBounds:t.resourceBounds??lC(cS)}}function pC(t){return t===zx.ETransactionVersion.F2?zx.ETransactionVersion.F1:t===zx.ETransactionVersion.V2?zx.ETransactionVersion.V1:t}function gC(t){return iS(eS(rv(vN(t),!1)))}function yC(t){return"sierra_program"in(pN(t)?$S(t):t)}Ix({},{compressProgram:()=>rC,decompressProgram:()=>iC,estimateFeeToBounds:()=>lC,estimatedFeeToMaxFee:()=>uC,formatSignature:()=>aC,getFullPublicKey:()=>gC,intDAM:()=>cC,makeAddress:()=>oC,randomAddress:()=>nC,reduceV2:()=>pC,signatureToDecimalArray:()=>sC,signatureToHexArray:()=>hC,toFeeVersion:()=>fC,toTransactionVersion:()=>dC,v3Details:()=>mC});function wC(){return sS(eS(S_.utils.randomPrivateKey()))}function vC(t){AN(t,cS,2n**160n-1n,"Ethereum Address ");const e=iS(rS(vN(t)).padStart(40,"0"));return uN(Boolean(e.match(/^(0x)?[0-9a-f]{40}$/)),"Invalid Ethereum Address Format"),e}Ix({},{ethRandomPrivateKey:()=>wC,validateAndParseEthAddress:()=>vC});var bC=Jx&&window.fetch.bind(window)||!cN(t)&&Uj(t.fetch)||fx;Ix({},{Block:()=>NC,createSierraContractClass:()=>AC,getDefaultNodeUrl:()=>xC,isPendingBlock:()=>CC,isPendingStateUpdate:()=>OC,isPendingTransaction:()=>zC,isV3Tx:()=>IC,isVersion:()=>TC,parseContract:()=>jC,validBlockTags:()=>SC,wait:()=>EC});var kC=class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...RS}}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(),MC={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},_C=class t{static instance;config;constructor(){this.config=kC}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<=MC[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(MC[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(MC).filter((t=>this.shouldLog(MC[t])&&"OFF"!==t))}}.getInstance();function EC(t){return new Promise((e=>{setTimeout(e,t)}))}function AC(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=ZT(FS(t.abi)),e.sierra_program=ZT(FS(t.sierra_program)),e.sierra_program=rC(e.sierra_program),e}function jC(t){const e=pN(t)?$S(t):t;return yC(t)?AC(e):{...e,..."program"in e&&{program:rC(e.program)}}}var xC=(t,e=!1)=>{e||_C.info("Using default public node url, please provide nodeUrl in provider options!");const r=NS[t??"SN_SEPOLIA"];return r[Math.floor(Math.random()*r.length)]},SC=Object.values(XS),NC=class{hash=null;number=null;tag=null;setIdentifier(t){if(pN(t))if(GN(t))this.number=parseInt(t,10);else if(yN(t))this.hash=t;else{if(!SC.includes(t))throw TypeError(`Block identifier unmanaged: ${t}`);this.tag=t}else mN(t)?this.hash=vN(t):dN(t)?this.number=t:this.tag=XS.PENDING;if(dN(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 IC(t){const e=t.version?vN(t.version):zx.ETransactionVersion.V3;return e===zx.ETransactionVersion.V3||e===zx.ETransactionVersion.F3}function TC(t,e){const[r,i]=t.split("."),[n,o]=e.split(".");return r===n&&i===o}function CC(t){return"PENDING"===t.status}function zC(t){return!("block_hash"in t)}function OC(t){return!("block_hash"in t)}var RC={};Ix(RC,{buildUDCCall:()=>UC,fromCallsToExecuteCalldata:()=>BC,fromCallsToExecuteCalldataWithNonce:()=>DC,fromCallsToExecuteCalldata_cairo1:()=>LC,getExecuteCalldata:()=>FC,getVersionsByType:()=>qC,transformCallsToMulticallArrays:()=>PC,transformCallsToMulticallArrays_cairo1:()=>$C});var PC=t=>{const e=[],r=[];return t.forEach((t=>{const i=gT.compile(t.calldata||[]);e.push({to:wN(t.contractAddress).toString(10),selector:wN($N(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:i.length.toString()}),r.push(...i)})),{callArray:e,calldata:gT.compile({calldata:r})}},BC=t=>{const{callArray:e,calldata:r}=PC(t);return[...gT.compile({callArray:e}),...r]},DC=(t,e)=>[...BC(t),wN(e).toString()],$C=t=>{const e=t.map((t=>({to:wN(t.contractAddress).toString(10),selector:wN($N(t.entrypoint)).toString(10),calldata:gT.compile(t.calldata||[])})));return e},LC=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:gT.compile(t.calldata)})));return gT.compile({orderCalls:e})},FC=(t,e="0")=>"1"===e?LC(t):BC(t);function UC(t,e){const r=[].concat(t).map((t=>{const{classHash:r,salt:i,unique:n=!0,constructorCalldata:o=[]}=t,a=gT.compile(o),s=i??nC();return{call:{contractAddress:xS.ADDRESS,entrypoint:xS.ENTRYPOINT,calldata:[r,s,CN(n),a.length,...a]},address:HT(n?kv(e,s):s,r,a,n?xS.ADDRESS:0)}}));return{calls:r.map((t=>t.call)),addresses:r.map((t=>t.address))}}function qC(t){return"fee"===t?{v1:zx.ETransactionVersion.F1,v2:zx.ETransactionVersion.F2,v3:zx.ETransactionVersion.F3}:{v1:zx.ETransactionVersion.V1,v2:zx.ETransactionVersion.V2,v3:zx.ETransactionVersion.V3}}var VC={headers:{"Content-Type":"application/json"},blockIdentifier:XS.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(_S).includes(a)?this.nodeUrl=xC(a,t?.default):this.nodeUrl=a||xC(void 0,t?.default),this.baseFetch=e??bC,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 hN({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:FS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new GS(r,t,e);if(i instanceof HS)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=vN(t),i=new NC(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 NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new NC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=vN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=vN(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 NC(r).identifier,a=[];return i&&a.push(Rx.ESimulationFlag.SKIP_VALIDATE),n&&a.push(Rx.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=vN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Rx.ETransactionStatus.REJECTED],h=e?.successStates??[Rx.ETransactionExecutionStatus.SUCCEEDED,Rx.ETransactionStatus.ACCEPTED_ON_L2,Rx.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!n;){await EC(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 EC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=vN(t),n=kN(e),o=new NC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(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 NC(e).identifier;let n={};return TC("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Rx.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 IC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Rx.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:Rx.ETransactionVersion.V3,signature:hC(t.signature),nonce:vN(e.nonce),resource_bounds:e.resourceBounds,tip:vN(e.tip),paymaster_data:e.paymasterData.map((t=>vN(t))),account_deployment_data:e.accountDeploymentData.map((t=>vN(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:gT.toHex(t.calldata),type:Rx.ETransactionType.INVOKE,max_fee:vN(e.maxFee||0),version:Rx.ETransactionVersion.V1,signature:hC(t.signature),nonce:vN(e.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V1,type:Rx.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(yC(t)||IC(n))if(yC(t)&&!IC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Rx.ETransactionType.DECLARE,contract_class:{sierra_program:iC(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:Rx.ETransactionVersion.V2,max_fee:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V2,type:Rx.ETransactionType.DECLARE});else{if(!yC(t)||!IC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Rx.ETransactionType.DECLARE,sender_address:r,compiled_class_hash:i||"",version:Rx.ETransactionVersion.V3,signature:hC(e),nonce:vN(n.nonce),contract_class:{sierra_program:iC(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:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),account_deployment_data:n.accountDeploymentData.map((t=>vN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Rx.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:Rx.ETransactionVersion.V1,max_fee:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V1,type:Rx.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 IC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Rx.ETransactionType.DEPLOY_ACCOUNT,version:Rx.ETransactionVersion.V3,signature:hC(i),nonce:vN(n.nonce),contract_address_salt:vN(r||0),constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),resource_bounds:n.resourceBounds,tip:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),contract_address_salt:vN(r||0),type:Rx.ETransactionType.DEPLOY_ACCOUNT,max_fee:vN(n.maxFee||0),version:Rx.ETransactionVersion.V1,signature:hC(i),nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Rx.ETransactionVersion.V1,type:Rx.ETransactionType.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new NC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:$N(t.entrypoint),calldata:gT.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:vC(r),to_address:vN(i),entry_point_selector:LN(n),payload:TN(o)},s=new NC(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=qC(e);let i;if(IC(t)?i={signature:hC(t.signature),nonce:vN(t.nonce),resource_bounds:t.resourceBounds,tip:vN(t.tip),paymaster_data:t.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>vN(t)))}:(i={signature:hC(t.signature),nonce:vN(t.nonce),max_fee:vN(t.maxFee||0)},_C.warn(PS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===KS.INVOKE)return{type:Rx.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:vN(t.version||r.v3),...i};if(t.type===KS.DECLARE)return yC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:iC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:vN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:vN(t.version||r.v1),...i};if(t.type===KS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:gT.toHex(t.constructorCalldata||[]),class_hash:vN(t.classHash),contract_address_salt:vN(t.addressSalt||0),version:vN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}};Ix({},{RpcChannel:()=>ZC});var GC={headers:{"Content-Type":"application/json"},blockIdentifier:XS.PENDING,retries:200},ZC=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(_S).includes(a)?this.nodeUrl=xC(a,t?.default):this.nodeUrl=a||xC(void 0,t?.default),this.baseFetch=e??bC,this.blockIdentifier=i??GC.blockIdentifier,this.chainId=n,this.headers={...GC.headers,...o},this.retries=s??GC.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new hN({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:FS(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new GS(r,t,e);if(i instanceof HS)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=vN(t),i=new NC(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 NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new NC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new NC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=vN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=vN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=vN(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 NC(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=vN(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 EC(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 EC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=vN(t),n=kN(e),o=new NC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=vN(t),i=new NC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=vN(t),i=new NC(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 NC(e).identifier;let n={};return TC("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 IC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:Pm.V3,signature:hC(t.signature),nonce:vN(e.nonce),resource_bounds:e.resourceBounds,tip:vN(e.tip),paymaster_data:e.paymasterData.map((t=>vN(t))),account_deployment_data:e.accountDeploymentData.map((t=>vN(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:gT.toHex(t.calldata),type:Sm.INVOKE,max_fee:vN(e.maxFee||0),version:Pm.V1,signature:hC(t.signature),nonce:vN(e.nonce)}}),_C.warn(PS.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(yC(t)||IC(n))if(yC(t)&&!IC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Sm.DECLARE,contract_class:{sierra_program:iC(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:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.legacyTxWarningMessage,{version:Pm.V2,type:Sm.DECLARE});else{if(!yC(t)||!IC(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:hC(e),nonce:vN(n.nonce),contract_class:{sierra_program:iC(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:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),account_deployment_data:n.accountDeploymentData.map((t=>vN(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:vN(n.maxFee||0),signature:hC(e),sender_address:r,nonce:vN(n.nonce)}}),_C.warn(PS.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 IC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Sm.DEPLOY_ACCOUNT,version:Pm.V3,signature:hC(i),nonce:vN(n.nonce),contract_address_salt:vN(r||0),constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),resource_bounds:n.resourceBounds,tip:vN(n.tip),paymaster_data:n.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:gT.toHex(e||[]),class_hash:vN(t),contract_address_salt:vN(r||0),type:Sm.DEPLOY_ACCOUNT,max_fee:vN(n.maxFee||0),version:Pm.V1,signature:hC(i),nonce:vN(n.nonce)}}),_C.warn(PS.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 NC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:$N(t.entrypoint),calldata:gT.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:vC(r),to_address:vN(i),entry_point_selector:LN(n),payload:TN(o)},s=new NC(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=qC(e);let i;if(IC(t)?i={signature:hC(t.signature),nonce:vN(t.nonce),resource_bounds:t.resourceBounds,tip:vN(t.tip),paymaster_data:t.paymasterData.map((t=>vN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>vN(t)))}:(i={signature:hC(t.signature),nonce:vN(t.nonce),max_fee:vN(t.maxFee||0)},_C.warn(PS.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===KS.INVOKE)return{type:Sm.INVOKE,sender_address:t.contractAddress,calldata:gT.toHex(t.calldata),version:vN(t.version||r.v3),...i};if(t.type===KS.DECLARE)return yC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:iC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:vN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:vN(t.version||r.v1),...i};if(t.type===KS.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:gT.toHex(t.constructorCalldata||[]),class_hash:vN(t.classHash),contract_address_salt:vN(t.addressSalt||0),version:vN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}},KC=class{margin;constructor(t){this.margin=t}estimatedFeeToMaxFee(t){return uC(t,this.margin?.maxFee)}estimateFeeToBounds(t){return lC(t,this.margin?.l1BoundMaxAmount,this.margin?.l1BoundMaxPricePerUnit)}parseGetBlockResponse(t){return{status:"PENDING",...t}}parseTransactionReceipt(t){return"actual_fee"in t&&pN(t.actual_fee)?{...t,actual_fee:{amount:t.actual_fee,unit:"FRI"}}:t}parseFeeEstimateResponse(t){const e=t[0];return{overall_fee:wN(e.overall_fee),gas_consumed:wN(e.gas_consumed),gas_price:wN(e.gas_price),unit:e.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(e.overall_fee),resourceBounds:this.estimateFeeToBounds(e),data_gas_consumed:e.data_gas_consumed?wN(e.data_gas_consumed):0n,data_gas_price:e.data_gas_price?wN(e.data_gas_price):0n}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:wN(t.overall_fee),gas_consumed:wN(t.gas_consumed),gas_price:wN(t.gas_price),unit:t.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(t.overall_fee),resourceBounds:this.estimateFeeToBounds(t),data_gas_consumed:t.data_gas_consumed?wN(t.data_gas_consumed):0n,data_gas_price:t.data_gas_price?wN(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:pN(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}},JC=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===YS.SUCCEEDED}static isReverted(t){return t.execution_status===YS.REVERTED}static isRejected(t){return t.status===YS.REJECTED}},WC={};Ix(WC,{TypedDataRevision:()=>Fm,encodeData:()=>cz,encodeType:()=>hz,encodeValue:()=>lz,getDependencies:()=>sz,getMessageHash:()=>fz,getStructHash:()=>dz,getTypeHash:()=>uz,isMerkleTreeType:()=>az,prepareSelector:()=>oz,validateTypedData:()=>nz,verifyMessage:()=>mz});Ix({},{MerkleTree:()=>YC,proofMerklePath:()=>QC});var YC=class t{leaves;branches=[];root;hashMethod;constructor(t,e=LT){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=LT){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 QC(t,e,r,i=LT){if(0===r.length)return t===e;const[n,...o]=r;return QC(t,YC.hash(e,n,i),o,i)}var XC={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" }]')},tz={[Fm.ACTIVE]:{domain:"StarknetDomain",hashMethod:VT,hashMerkleMethod:FT,escapeTypeString:t=>`"${t}"`,presetTypes:XC},[Fm.LEGACY]:{domain:"StarkNetDomain",hashMethod:qT,hashMerkleMethod:LT,escapeTypeString:t=>t,presetTypes:{}}};function ez(t,e,{min:r,max:i}){const n=BigInt(t);uN(n>=r&&n<=i,`${n} (${e}) is out of bounds [${r}, ${i}]`)}function rz({types:t,domain:e}){return tz[Fm.ACTIVE].domain in t&&e.revision===Fm.ACTIVE?Fm.ACTIVE:tz[Fm.LEGACY].domain in t&&(e.revision??Fm.LEGACY)===Fm.LEGACY?Fm.LEGACY:void 0}function iz(t){try{return vN(t)}catch(e){if(pN(t))return vN(YN(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function nz(t){const e=t;return Boolean(e.message&&e.primaryType&&e.types&&rz(e))}function oz(t){return yN(t)?t:$N(t)}function az(t){return"merkletree"===t.type}function sz(t,e,r=[],i="",n=Fm.LEGACY){let o=[e];return"*"===e[e.length-1]?o=[e.slice(0,-1)]:n===Fm.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,...sz(t,r.type,e,r.contains,n).filter((t=>!e.includes(t)))]),[])].filter((t=>!e.includes(t)))]),[])}function hz(t,e,r=Fm.LEGACY){const i=r===Fm.ACTIVE?{...t,...tz[r].presetTypes}:t,[n,...o]=sz(i,e,void 0,void 0,r),a=n?[n,...o.sort()]:[],s=tz[r].escapeTypeString;return a.map((t=>{const e=i[t].map((t=>{const e="enum"===t.type&&r===Fm.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 uz(t,e,r=Fm.LEGACY){return $N(hz(t,e,r))}function lz(t,e,r,i={},n=Fm.LEGACY){if(t[e])return[e,dz(t,e,r,n)];if(tz[n].presetTypes[e])return[e,dz(tz[n].presetTypes,e,r,n)];if(e.endsWith("*")){const i=r.map((r=>lz(t,e.slice(0,-1),r,void 0,n)[1]));return[e,tz[n].hashMethod(i)]}switch(e){case"enum":if(n===Fm.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 lz(t,e,i,void 0,n)[1]}));return[e,tz[n].hashMethod([l,...c])]}return[e,iz(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(!az(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=>lz(t,e,r,void 0,n)[1])),{root:a}=new YC(o,tz[n].hashMerkleMethod);return["felt",a]}case"selector":return["felt",oz(r)];case"string":if(n===Fm.ACTIVE){const t=tI(r),i=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,tz[n].hashMethod(i)]}return[e,iz(r)];case"i128":if(n===Fm.ACTIVE){const t=BigInt(r);return ez(t,e,bS),[e,iz(t<0n?pS+t:t)]}return[e,iz(r)];case"timestamp":case"u128":return n===Fm.ACTIVE&&ez(r,e,kS),[e,iz(r)];case"felt":case"shortstring":return n===Fm.ACTIVE&&ez(iz(r),e,vS),[e,iz(r)];case"ClassHash":case"ContractAddress":return n===Fm.ACTIVE&&ez(r,e,vS),[e,iz(r)];case"bool":return n===Fm.ACTIVE&&uN(fN(r),`Type mismatch for ${e} ${r}`),[e,iz(r)];default:if(n===Fm.ACTIVE)throw new Error(`Unsupported type: ${e}`);return[e,iz(r)]}}function cz(t,e,r,i=Fm.LEGACY){const n=t[e]??tz[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]=lz(t,a.type,s,h,i);return[[...n,u],[...o,l]]}),[["felt"],[uz(t,e,i)]]);return[o,a]}function dz(t,e,r,i=Fm.LEGACY){return tz[i].hashMethod(cz(t,e,r,i)[1])}function fz(t,e){if(!nz(t))throw new Error("Typed data does not match JSON schema");const r=rz(t),{domain:i,hashMethod:n}=tz[r];return n([YN("StarkNet Message"),dz(t.types,i,t.domain,r),e,dz(t.types,t.primaryType,t.message,r)])}function mz(t,e,r,i){const n=nz(t);if(!PN(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&&!PN(i))throw new Error("accountAddress shall be a BigNumberish");const o=n?fz(t,i):vN(t);return ov(Array.isArray(e)?new hv(BigInt(e[0]),BigInt(e[1])):e,o,vN(r))}var pz=class{responseParser;channel;constructor(t){t&&"channel"in t?(this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new KC):(this.channel=new ZC({...t,waitMode:!1}),this.responseParser=new KC(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===XS.LATEST)return;const r=await this.getBlockNumber(),i=t===XS.PENDING?r+1:Number(vN(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 EC(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);uN("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 FN([r[0],i,o,n,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){if(this.channel instanceof BS.RpcChannel)throw new HS("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(XS.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 JC(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 JC(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(yC(n)){if(i){return{cairo:"1",compiler:DI(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:KS.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeclareEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:KS.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeployAccountEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:KS.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=nz(t);if(!PN(t)&&!o)throw new Error("message has a wrong format.");if(!PN(r))throw new Error("accountAddress shall be a BigNumberish");const a=o?fz(t,r):vN(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:vN(r),entrypoint:t,calldata:gT.compile({hash:wN(a).toString(),signature:aC(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(yC(t.contract)&&(!t.compiledClassHash&&t.casm&&(e.compiledClassHash=QT(t.casm)),!e.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(e.classHash=t.classHash??eC(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 HS)return!1;throw t}}async prepareInvocations(t){const e=[];for(const r of t)if(r.type===KS.DECLARE){await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r)}else e.push(r);return e}};Ix({},{StarknetIdContract:()=>Az,StarknetIdIdentityContract:()=>xz,StarknetIdMulticallContract:()=>Nz,StarknetIdPfpContract:()=>zz,StarknetIdPopContract:()=>Rz,StarknetIdVerifierContract:()=>Tz,dynamicCallData:()=>$z,dynamicFelt:()=>Dz,execution:()=>Bz,getStarknetIdContract:()=>jz,getStarknetIdIdentityContract:()=>Sz,getStarknetIdMulticallContract:()=>Iz,getStarknetIdPfpContract:()=>Oz,getStarknetIdPopContract:()=>Pz,getStarknetIdVerifierContract:()=>Cz,isStarkDomain:()=>Lz,useDecoded:()=>_z,useEncoded:()=>Ez});var gz="abcdefghijklmnopqrstuvwxyz0123456789-",yz=BigInt(gz.length+1),wz="这来",vz=BigInt(gz.length),bz=BigInt(wz.length),kz=BigInt(wz.length+1);function Mz(t){let e=0;for(;t.endsWith(wz[wz.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function _z(t){let e="";return t.forEach((t=>{for(;t!==cS;){const r=t%yz;if(t/=yz,r===BigInt(gz.length)){const r=t/kz;if(r===cS){const i=t%kz;t=r,e+=i===cS?gz[0]:wz[Number(i)-1]}else{e+=wz[Number(t%bz)],t/=bz}}else e+=gz[Number(r)]}const[r,i]=Mz(e);i&&(e=r+(i%2==0?wz[wz.length-1].repeat(i/2-1)+wz[0]+gz[1]:wz[wz.length-1].repeat((i-1)/2+1))),e+="."})),e?e.concat("stark"):e}function Ez(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(wz[0]+gz[1])){const[e,r]=Mz(t.substring(0,t.length-2));t=e+wz[wz.length-1].repeat(2*(r+1))}else{const[e,r]=Mz(t);r&&(t=e+wz[wz.length-1].repeat(1+2*(r-1)))}for(let i=0;i<t.length;i+=1){const n=t[i],o=gz.indexOf(n),a=BigInt(gz.indexOf(n));if(-1!==o)i===t.length-1&&t[i]===gz[0]?(e+=r*vz,r*=yz,r*=yz):(e+=r*a,r*=yz);else if(-1!==wz.indexOf(n)){e+=r*vz,r*=yz;const o=(i===t.length-1?1:0)+wz.indexOf(n);e+=r*BigInt(o),r*=bz}}return e}var Az={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function jz(t){switch(t){case"0x534e5f4d41494e":return Az.MAINNET;case"0x534e5f5345504f4c4941":return Az.TESTNET_SEPOLIA;default:throw new Error("Starknet.id is not yet deployed on this network")}}var xz={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function Sz(t){switch(t){case"0x534e5f4d41494e":return xz.MAINNET;case"0x534e5f5345504f4c4941":return xz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var Nz="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function Iz(t){switch(t){case"0x534e5f4d41494e":case"0x534e5f5345504f4c4941":return Nz;default:throw new Error("Starknet.id multicall contract is not yet deployed on this network")}}var Tz={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function Cz(t){switch(t){case"0x534e5f4d41494e":return Tz.MAINNET;case"0x534e5f5345504f4c4941":return Tz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var zz={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function Oz(t){switch(t){case"0x534e5f4d41494e":return zz.MAINNET;case"0x534e5f5345504f4c4941":return zz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var Rz={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function Pz(t){switch(t){case"0x534e5f4d41494e":return Rz.MAINNET;case"0x534e5f5345504f4c4941":return Rz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function Bz(t,e,r){return new qI({Static:t,IfEqual:e?FI(e[0],e[1],e[2]):void 0,IfNotEqual:r?FI(r[0],r[1],r[2]):void 0})}function Dz(t,e){return new qI({Hardcoded:t,Reference:e?FI(e[0],e[1]):void 0})}function $z(t,e,r){return new qI({Hardcoded:t,Reference:e?FI(e[0],e[1]):void 0,ArrayReference:r?FI(r[0],r[1]):void 0})}function Lz(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var Fz=class extends(Ex(pz,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??jz(i);try{const r=await t.callContract({contractAddress:n,entrypoint:"address_to_domain",calldata:gT.compile({address:e,hint:[]})}),i=_z(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(!Lz(i))throw new Error("Invalid domain, must be a valid .stark domain");const n=await t.getChainId(),o=r??jz(n);try{const e=i.replace(".stark","").split(".").map((t=>Ez(t).toString(10)));return(await t.callContract({contractAddress:o,entrypoint:"domain_to_address",calldata:gT.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??jz(h),l=i??Sz(h),c=n??Cz(h),d=o??Oz(h),f=a??Pz(h),m=s??Iz(h);try{const r=[{execution:Bz({}),to:$z(u),selector:$z($N("address_to_domain")),calldata:[$z(e),$z("0")]},{execution:Bz({}),to:Dz(u),selector:Dz($N("domain_to_id")),calldata:[$z(void 0,void 0,[0,0])]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("twitter")),$z(c),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("github")),$z(c),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("discord")),$z(c),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("proof_of_personhood")),$z(f),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("nft_pp_contract")),$z(d),$z("0")]},{execution:Bz({}),to:Dz(l),selector:Dz($N("get_extended_verifier_data")),calldata:[$z(void 0,[1,0]),$z(YN("nft_pp_id")),$z("2"),$z(d),$z("0")]},{execution:Bz(void 0,void 0,[6,0,0]),to:Dz(void 0,[6,0]),selector:Dz($N("tokenURI")),calldata:[$z(void 0,[7,1]),$z(void 0,[7,2])]}],i=await t.callContract({contractAddress:m,entrypoint:"aggregate",calldata:gT.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=_z(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=>QN(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")}}})){},Uz=new pz({default:!0}),qz={};function Vz(t){return new lI(t).toBigInt()}function Hz(t){return lI.is(t)}function Gz(t){return new lI(t).toUint256HexString()}function Zz(t){const e=function(t){const e=vN(iS(t.toString()));return iS(rS(e).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return AN(e,cS,yS-1n,"Starknet Address"),e}Ix(qz,{UINT_128_MAX:()=>iI,UINT_256_MAX:()=>nI,bnToUint256:()=>Gz,isUint256:()=>Hz,uint256ToBN:()=>Vz});function Kz(t){return"event"===t.type}function Jz(t){const e=t.filter((t=>Kz(t)&&"struct"===t.kind)),r=t.filter((t=>Kz(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(cN(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={[iS(_v(Yx(s)).toString(16))]:e};for(;i.length>0;)h={[iS(_v(Yx(i.pop())).toString(16))]:h};return h={...h},Yz(t,h)}),{});return i}function Wz(t){return PI(t)?Jz(t):function(t){return t.filter((t=>"event"===t.type)).reduce(((t,e)=>{const r=e.name,i={...e};return i.name=r,{...t,[iS(_v(Yx(r)).toString(16))]:i}}),{})}(t)}function Yz(t,e){const r={...t};return gN(t)&&gN(e)&&Object.keys(e).forEach((i=>{gN(e[i])?i in t?r[i]=Yz(t[i],e[i]):Object.assign(r,{[i]:e[i]}):Object.assign(r,{[i]:e[i]})})),r}function Qz(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();uN(!!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]=sT(s,t,r,i,a[o.name])})),l.forEach((t=>{a[o.name][t.name]=sT(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 Xz(t){if(!t.events?.length)throw new Error("UDC emitted event is empty");const e=t.events.find((t=>EN(t.from_address)===EN(xS.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:()=>Wz,isAbiEvent:()=>Kz,parseEvents:()=>Qz,parseUDCEvent:()=>Xz});function tO(t){const e=t.calldata??[],r=Array.isArray(e)?e:gT.compile(e);return{to:t.contractAddress,selector:$N(t.entrypoint),calldata:r}}function eO(t,e){const r=tO(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function rO(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function iO(t,e,r,i,n){return"1"===n?{types:oN,primaryType:"OutsideExecution",domain:rO(t,n),message:{...e,nonce:r,calls_len:i.length,calls:i.map((t=>eO(t,n)))}}:{types:aN,primaryType:"OutsideExecution",domain:rO(t,n),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:i.map((t=>eO(t,n)))}}}function nO(t){const e=t.outsideExecution,r=aC(t.signature);return gT.compile({outside_execution:e,signature:r})}function oO(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:vN(t.signerAddress),entrypoint:e,calldata:nO(t)}}))}Ix({},{buildExecuteFromOutsideCall:()=>oO,buildExecuteFromOutsideCallData:()=>nO,getOutsideCall:()=>tO,getTypedData:()=>iO});async function aO(t,e,r){const i={contractAddress:vN(e),entrypoint:"supports_interface",calldata:[vN(r)]};try{const e=await t.callContract(i);return 0n!==BigInt(e[0])}catch{return!1}}Ix({},{supportsInterface:()=>aO});function sO(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function hO(t){return t.request({type:"wallet_getPermissions"})}function uO(t,e){return t.request({type:"wallet_watchAsset",params:e})}function lO(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function cO(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function dO(t){return t.request({type:"wallet_requestChainId"})}function fO(t){return t.request({type:"wallet_deploymentData"})}function mO(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function pO(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function gO(t,e){return t.request({type:"wallet_signTypedData",params:e})}function yO(t){return t.request({type:"wallet_supportedSpecs"})}function wO(t,e){t.on("accountsChanged",e)}function vO(t,e){t.on("networkChanged",e)}Ix({},{addDeclareTransaction:()=>pO,addInvokeTransaction:()=>mO,addStarknetChain:()=>lO,deploymentData:()=>fO,getPermissions:()=>hO,onAccountChange:()=>wO,onNetworkChanged:()=>vO,requestAccounts:()=>sO,requestChainId:()=>dO,signMessage:()=>gO,supportedSpecs:()=>yO,switchStarknetChain:()=>cO,watchAsset:()=>uO});var bO=t=>{const e=t[t.length-1];return"object"==typeof e&&["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"].some((t=>t in e))?{args:t,options:t.pop()}:{args:t}};function kO(t,e){return async function(...r){const i=bO(r);return t.call(e.name,i.args,{parseRequest:!0,parseResponse:!0,...i.options})}}function MO(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?kO(t,e):function(t,e){return async function(...r){const i=bO(r);return t.invoke(e.name,i.args,{parseRequest:!0,...i.options})}}(t,e)}function _O(t,e){return function(...r){return t.estimate(e.name,r)}}function EO(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}var AO=class{abi;address;providerOrAccount;deployTransactionHash;structs;events;functions;callStatic;populateTransaction;estimateFee;callData;constructor(t,e,r=Uz){this.address=e&&e.toLowerCase(),this.providerOrAccount=r,this.callData=new gT(t),this.structs=gT.getAbiStruct(t),this.events=Wz(t);const i=YI(t);this.abi=i.getLegacyFormat();const n={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach((t=>{if("function"!==t.type)return;const e=t.name;var r,i;this[e]||Object.defineProperty(this,e,{...n,value:MO(this,t)}),this.functions[e]||Object.defineProperty(this.functions,e,{...n,value:MO(this,t)}),this.callStatic[e]||Object.defineProperty(this.callStatic,e,{...n,value:kO(this,t)}),this.populateTransaction[e]||Object.defineProperty(this.populateTransaction,e,{...n,value:(r=this,i=t,function(...t){return r.populate(i.name,t)})}),this.estimateFee[e]||Object.defineProperty(this.estimateFee,e,{...n,value:_O(this,t)})}))}attach(t){this.address=t}connect(t){this.providerOrAccount=t}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(t,e=[],{parseRequest:r=!0,parseResponse:i=!0,formatResponse:n,blockIdentifier:o}={}){uN(null!==this.address,"contract is not connected to an address");const a=EO(e,(()=>r?(this.callData.validate(tN.CALL,t,e),this.callData.compile(t,e)):(_C.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e)));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:a,entrypoint:t},o).then((e=>i?n?this.callData.format(t,e,n):this.callData.parse(t,e):e))}invoke(t,e=[],{parseRequest:r=!0,maxFee:i,nonce:n,signature:o}={}){uN(null!==this.address,"contract is not connected to an address");const a=EO(e,(()=>r?(this.callData.validate(tN.INVOKE,t,e),this.callData.compile(t,e)):(_C.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e))),s={contractAddress:this.address,calldata:a,entrypoint:t};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(s,void 0,{maxFee:i,nonce:n});if(!n)throw new Error("Nonce is required when invoking a function without an account");return _C.warn(`Invoking ${t} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...s,signature:o},{nonce:n})}async estimate(t,e=[]){uN(null!==this.address,"contract is not connected to an address"),EO(e,(()=>!1))||this.callData.validate(tN.INVOKE,t,e);const r=this.populate(t,e);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(r);throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){const r=EO(e,(()=>this.callData.compile(t,e)));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){let e;return t.match({success:t=>{const r=t.events?.map((e=>({block_hash:t.block_hash,block_number:t.block_number,transaction_hash:t.transaction_hash,...e}))).filter((t=>EN(t.from_address)===EN(this.address)),[])||[];e=Qz(r,this.events,this.structs,gT.getAbiEnum(this.abi))},_:()=>{throw Error("This transaction was not successful.")}}),e}isCairo1(){return eI.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typedv2(t){return this}},jO={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"},2192:{key:"2192",name:"SnaxChain",shortName:"mainnet",chainId:2192,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.snaxchain.io"},start:1554893,logo:"ipfs://bafkreibzz757piho2llzkbiszpvalf5k5hpmxcwhvrmgp7vpz2vp4vj7ly"},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://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"},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://explorer.celo.org"},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://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",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/DmMXLtMZnGbQXASJ7p1jfzLUbBYnYUD9zNBTxpkjHYXV",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:["https://starknet-mainnet.public.blastapi.io"],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:["https://starknet-sepolia.public.blastapi.io"],start:7,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"}};const xO=new Map,SO={evm:function(t,e){return new Am({url:`${e.broviderUrl}/${t}`,timeout:e.timeout,allowGzip:!0},Number(t))},starknet:function(t,e){return new Fz({nodeUrl:`${e.broviderUrl}/${t}`})}};function NO(t,e={}){const r=function(t){const e=jO[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=xO.get(n);if(o)return o;const a=function(t){var e;return(null===(e=jO[t])||void 0===e?void 0:e.starknet)?"starknet":"evm"}(t),s=SO[a](r,i);return xO.set(n,s),s}var IO,TO,CO,zO;const OO={SN_MAIN:null===(TO=null===(IO=jO[Cx.StarknetChainId.SN_MAIN])||void 0===IO?void 0:IO.rpc)||void 0===TO?void 0:TO[0],SN_SEPOLIA:null===(zO=null===(CO=jO[Cx.StarknetChainId.SN_SEPOLIA])||void 0===CO?void 0:CO.rpc)||void 0===zO?void 0:zO[0]},RO=[{name:"argent::common::account::IAccount",type:"interface",items:[{name:"is_valid_signature",type:"function",inputs:[{name:"hash",type:"core::felt252"},{name:"signature",type:"core::array::Array::<core::felt252>"}],outputs:[{type:"core::felt252"}],state_mutability:"view"}]}];function PO(t,e){var r;if(!OO[t])throw new Error("Invalid network");return new Fz({nodeUrl:null!==(r=null==e?void 0:e.broviderUrl)&&void 0!==r?r:OO[t]})}function BO(t){return!!t.primaryType&&!!t.types.StarkNetDomain}function DO(t,e){const{domain:r,types:i,primaryType:n,message:o}=t;return WC.getMessageHash({types:i,primaryType:n,domain:r,message:o},e)}var $O=Object.freeze({__proto__:null,isStarknetMessage:BO,getHash:DO,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="SN_MAIN",n={}){try{const o=new AO(RO,t,PO(i,n));if(e.length<2)throw new Error("Invalid signature format");const a=yield o.is_valid_signature(DO(r,t),e.slice(-2));return Cs.from(a).eq(Cs.from("370462705988"))}catch(t){if(t.message.includes("Contract not found"))throw new Error("Contract not deployed");throw t}}))}});function LO(t){return He(Lr(t))}var FO=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],F=8191&L,U=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<,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,F))|0)+((8191&(n=(n=Math.imul(c,U))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,U))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,F),n=(n=Math.imul(m,U))+Math.imul(p,F)|0,o=Math.imul(p,U);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,F),n=(n=Math.imul(y,U))+Math.imul(w,F)|0,o=Math.imul(w,U),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,F),n=(n=Math.imul(b,U))+Math.imul(k,F)|0,o=Math.imul(k,U),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(_,F),n=(n=Math.imul(_,U))+Math.imul(E,F)|0,o=Math.imul(E,U),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,F),n=(n=Math.imul(j,U))+Math.imul(x,F)|0,o=Math.imul(x,U),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,F),n=(n=Math.imul(N,U))+Math.imul(I,F)|0,o=Math.imul(I,U),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,F),n=(n=Math.imul(C,U))+Math.imul(z,F)|0,o=Math.imul(z,U),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,F),n=(n=Math.imul(R,U))+Math.imul(P,F)|0,o=Math.imul(P,U),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,F),n=(n=Math.imul(D,U))+Math.imul($,F)|0,o=Math.imul($,U),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 UO=FO.BN;const qO=new vt("bignumber/5.6.2"),VO={},HO=9007199254740991;let GO=!1;class ZO{constructor(t,e){t!==VO&&qO.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 JO(WO(this).fromTwos(t))}toTwos(t){return JO(WO(this).toTwos(t))}abs(){return"-"===this._hex[0]?ZO.from(this._hex.substring(1)):this}add(t){return JO(WO(this).add(WO(t)))}sub(t){return JO(WO(this).sub(WO(t)))}div(t){return ZO.from(t).isZero()&&YO("division-by-zero","div"),JO(WO(this).div(WO(t)))}mul(t){return JO(WO(this).mul(WO(t)))}mod(t){const e=WO(t);return e.isNeg()&&YO("division-by-zero","mod"),JO(WO(this).umod(e))}pow(t){const e=WO(t);return e.isNeg()&&YO("negative-power","pow"),JO(WO(this).pow(e))}and(t){const e=WO(t);return(this.isNegative()||e.isNeg())&&YO("unbound-bitwise-result","and"),JO(WO(this).and(e))}or(t){const e=WO(t);return(this.isNegative()||e.isNeg())&&YO("unbound-bitwise-result","or"),JO(WO(this).or(e))}xor(t){const e=WO(t);return(this.isNegative()||e.isNeg())&&YO("unbound-bitwise-result","xor"),JO(WO(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&YO("negative-width","mask"),JO(WO(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&YO("negative-width","shl"),JO(WO(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&YO("negative-width","shr"),JO(WO(this).shrn(t))}eq(t){return WO(this).eq(WO(t))}lt(t){return WO(this).lt(WO(t))}lte(t){return WO(this).lte(WO(t))}gt(t){return WO(this).gt(WO(t))}gte(t){return WO(this).gte(WO(t))}isNegative(){return"-"===this._hex[0]}isZero(){return WO(this).isZero()}toNumber(){try{return WO(this).toNumber()}catch(t){YO("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return qO.throwError("this platform does not support BigInt",vt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?GO||(GO=!0,qO.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?qO.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",vt.errors.UNEXPECTED_ARGUMENT,{}):qO.throwError("BigNumber.toString does not accept parameters",vt.errors.UNEXPECTED_ARGUMENT,{})),WO(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof ZO)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new ZO(VO,KO(t)):t.match(/^-?[0-9]+$/)?new ZO(VO,KO(new UO(t))):qO.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&YO("underflow","BigNumber.from",t),(t>=HO||t<=-HO)&&YO("overflow","BigNumber.from",t),ZO.from(String(t));const e=t;if("bigint"==typeof e)return ZO.from(e.toString());if(At(e))return ZO.from(Tt(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return ZO.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 ZO.from(t)}return qO.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function KO(t){if("string"!=typeof t)return KO(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&qO.throwArgumentError("invalid hex","value",t),"0x00"===(t=KO(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 JO(t){return ZO.from(KO(t))}function WO(t){const e=ZO.from(t).toHexString();return"-"===e[0]?new UO("-"+e.substring(3),16):new UO(e.substring(2),16)}function YO(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),qO.throwError(t,vt.errors.NUMERIC_FAULT,i)}var QO=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 XO=new vt("hash/5.6.1"),tR=new Uint8Array(32);tR.fill(0);const eR=ZO.from(-1),rR=ZO.from(0),iR=ZO.from(1),nR=ZO.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const oR=Pt(iR.toHexString(),32),aR=Pt(rR.toHexString(),32),sR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},hR=["name","version","chainId","verifyingContract","salt"];function uR(t){return function(e){return"string"!=typeof e&&XO.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const lR={name:uR("name"),version:uR("version"),chainId:function(t){try{return ZO.from(t).toString()}catch(t){}return XO.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return nr(t).toLowerCase()}catch(t){}return XO.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 XO.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function cR(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))&&XO.throwArgumentError("invalid numeric width","type",t);const n=nR.mask(r?i-1:i),o=r?n.add(iR).mul(eR):rR;return function(e){const r=ZO.from(e);return(r.lt(o)||r.gt(n))&&XO.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))&&XO.throwArgumentError("invalid bytes width","type",t),function(e){return jt(e).length!==r&&XO.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=jt(t),r=e.length%32;return r?Ot([e,tR.slice(r)]):Tt(e)}(e)}}}switch(t){case"address":return function(t){return Pt(nr(t),32)};case"bool":return function(t){return t?oR:aR};case"bytes":return function(t){return He(t)};case"string":return function(t){return LO(t)}}return null}function dR(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class fR{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]&&XO.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&&XO.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);cR(a)||(r[a]||XO.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?XO.throwArgumentError("missing primary type","types",t):n.length>1&&XO.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]&&XO.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]=dR(e,t[e])+r.map((e=>dR(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=cR(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&&XO.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=LO(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 XO.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||XO.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(cR(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&&XO.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)),{}):XO.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new fR(t)}static getPrimaryType(t){return fR.from(t).primaryType}static hashStruct(t,e,r){return fR.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=sR[r];i||XO.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>hR.indexOf(t.name)-hR.indexOf(e.name))),fR.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Ot(["0x1901",fR.hashDomain(t),fR.from(e).hash(r)])}static hash(t,e,r){return He(fR.encode(t,e,r))}static resolveNames(t,e,r,i){return QO(this,void 0,void 0,(function*(){t=Xt(t);const n={};t.verifyingContract&&!Nt(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=fR.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){fR.hashDomain(t);const i={},n=[];hR.forEach((e=>{const r=t[e];null!=r&&(i[e]=lR[e](r),n.push({name:e,type:sR[e]}))}));const o=fR.from(e),a=Xt(e);return a.EIP712Domain?XO.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 ZO.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&XO.throwArgumentError("invalid string","value",e),e}return XO.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new vt("wallet/5.6.2");function mR(t,e,r,i){return Ba(fR.hash(t,e,r),i)}const pR="6492649264926492649264926492649264926492649264926492649264926492";function gR(t,e){return t.toLowerCase()===e.toLowerCase()}function yR(t){const{domain:e,types:r,message:i}=t;return $u.hash(e,r,i)}function wR(t,e,i,n){return r(this,void 0,void 0,(function*(){let r;try{r=yield nB(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 gR(r,"0x1626ba7e")}))}function vR(t,e,i,n){return r(this,void 0,void 0,(function*(){return gR(yield nB(n,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[jt(i),e]]),"0x20c13b0b")}))}var bR=Object.freeze({__proto__:null,getHash:yR,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(gR(t,mR(o,a,s,e)))return!0}catch(t){}const h=NO(i,n),u=yR(r);if(e.endsWith(pR))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 wR(t,e,u,h))||(yield vR(t,e,u,h))}))}});var kR=["ipfs.snapshot.box","snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];class MR{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=>MR.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 _R{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=>_R.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 ER(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function AR(t,e){return Math.sqrt(t*e)}function jR(t){return t*t}function xR(t,e){return t.map((t=>e*t))}class SR{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=>SR.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=>AR(ER(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return jR(i)}));return xR(r.map(((t,e)=>ER(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=>AR(ER(t.choice[r+1],Object.values(t.choice)),t.scores[i]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[jR(t)]))));return r.map(((t,i)=>xR(this.strategies.map(((t,e)=>ER(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=ER(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function NR(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:NR(t.map((t=>[t[0].filter((t=>t!=s)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function IR(t){const e=NR(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class TR{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=>TR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=IR(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=IR(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)=>`(${mB(e+1)}) ${t}`)).join(", ")}}class CR{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=>CR.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 zR(t,e,r){const i=r.reduce(((t,e)=>t+e),0),n=e[t]/i*100;return isNaN(n)?0:n}function OR(t,e,r){return zR(t+1,e,Object.values(e))/100*r}class RR{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=>RR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>OR(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)=>zR(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=>OR(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)=>zR(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*zR(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var PR={"single-choice":MR,approval:_R,quadratic:SR,"ranked-choice":TR,copeland:CR,weighted:RR,basic:MR};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"},DR=1e3;function $R(t){return t.length===DR&&t[0].timestamp===t[t.length-1].timestamp}function LR(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function FR(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function UR(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:DR,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 oB(t,n)).delegations||[]}))}const qR=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"];function VR(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(qN.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(qz.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 HR=t=>{if(0===t.length)return[];const[e,...r]=t,i=Number(lN.toBigInt(e)),n=r.slice(0,i),o=r.slice(i);return[n,...HR(o)]};var GR="__lodash_hash_undefined__",ZR="[object Function]",KR="[object GeneratorFunction]",JR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,WR=/^\w*$/,YR=/^\./,QR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,XR=/\\(\\)?/g,tP=/^\[object .+?Constructor\]$/,eP=/^(?:0|[1-9]\d*)$/,rP="object"==typeof i&&i&&i.Object===Object&&i,iP="object"==typeof self&&self&&self.Object===Object&&self,nP=rP||iP||Function("return this")();var oP,aP=Array.prototype,sP=Function.prototype,hP=Object.prototype,uP=nP["__core-js_shared__"],lP=(oP=/[^.]+$/.exec(uP&&uP.keys&&uP.keys.IE_PROTO||""))?"Symbol(src)_1."+oP:"",cP=sP.toString,dP=hP.hasOwnProperty,fP=hP.toString,mP=RegExp("^"+cP.call(dP).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pP=nP.Symbol,gP=aP.splice,yP=NP(nP,"Map"),wP=NP(Object,"create"),vP=pP?pP.prototype:void 0,bP=vP?vP.toString:void 0;function kP(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 MP(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 _P(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 EP(t,e,r){var i=t[e];dP.call(t,e)&&OP(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function AP(t,e){for(var r=t.length;r--;)if(OP(t[r][0],e))return r;return-1}function jP(t){if(!PP(t)||(e=t,lP&&lP in e))return!1;var e,r=function(t){var e=PP(t)?fP.call(t):"";return e==ZR||e==KR}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?mP:tP;return r.test(function(t){if(null!=t){try{return cP.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function xP(t,e,r,i){if(!PP(t))return t;e=function(t,e){if(RP(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||BP(t))return!0;return WR.test(t)||!JR.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return RP(t)?t:TP(t)}(e);for(var n=-1,o=e.length,a=o-1,s=t;null!=s&&++n<o;){var h=CP(e[n]),u=r;if(n!=a){var l=s[h];void 0===(u=i?i(l,h,s):void 0)&&(u=PP(l)?l:IP(e[n+1])?[]:{})}EP(s,h,u),s=s[h]}return t}function SP(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 NP(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return jP(r)?r:void 0}function IP(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||eP.test(t))&&t>-1&&t%1==0&&t<e}kP.prototype.clear=function(){this.__data__=wP?wP(null):{}},kP.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},kP.prototype.get=function(t){var e=this.__data__;if(wP){var r=e[t];return r===GR?void 0:r}return dP.call(e,t)?e[t]:void 0},kP.prototype.has=function(t){var e=this.__data__;return wP?void 0!==e[t]:dP.call(e,t)},kP.prototype.set=function(t,e){return this.__data__[t]=wP&&void 0===e?GR:e,this},MP.prototype.clear=function(){this.__data__=[]},MP.prototype.delete=function(t){var e=this.__data__,r=AP(e,t);return!(r<0)&&(r==e.length-1?e.pop():gP.call(e,r,1),!0)},MP.prototype.get=function(t){var e=this.__data__,r=AP(e,t);return r<0?void 0:e[r][1]},MP.prototype.has=function(t){return AP(this.__data__,t)>-1},MP.prototype.set=function(t,e){var r=this.__data__,i=AP(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},_P.prototype.clear=function(){this.__data__={hash:new kP,map:new(yP||MP),string:new kP}},_P.prototype.delete=function(t){return SP(this,t).delete(t)},_P.prototype.get=function(t){return SP(this,t).get(t)},_P.prototype.has=function(t){return SP(this,t).has(t)},_P.prototype.set=function(t,e){return SP(this,t).set(t,e),this};var TP=zP((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(BP(t))return bP?bP.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return YR.test(t)&&r.push(""),t.replace(QR,(function(t,e,i,n){r.push(i?n.replace(XR,"$1"):e||t)})),r}));function CP(t){if("string"==typeof t||BP(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function zP(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(zP.Cache||_P),r}function OP(t,e){return t===e||t!=t&&e!=e}zP.Cache=_P;var RP=Array.isArray;function PP(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]"==fP.call(t)}var DP=function(t,e,r){return null==t?t:xP(t,e,r)};const $P={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,qR,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));const h=yield Promise.all(s.map((r=>{var i;return e.callContract({contractAddress:t,entrypoint:"aggregate",calldata:RC.fromCallsToExecuteCalldata(r)},null!==(i=o.blockTag)&&void 0!==i?i:"latest")})));return h.map((t=>{const[e,r,...i]=t;return HR(i)})).flat().map(((t,e)=>{const[,n]=i[e];return VR(t,r.find((t=>t.name===n)))}))}))}};function LP(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)||jO[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=jO[t])||void 0===o?void 0:o.starknet)?"starknet":"evm";return $P[u](a,e,r,i,h,s)}))}const FP=["response not found during CCIP fetch","UNSUPPORTED_OPERATION"],UP="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",qP=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],VP={146:{tlds:[".sonic"],registryContract:"0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4"}},HP=["function ownerOf(uint256 tokenId) view returns (address owner)"],GP=["1","11155111"],ZP=["109","157"],KP="0x0000000000000000000000000000000000000000",JP={Accept:"application/json","Content-Type":"application/json"},WP="https://score.snapshot.org";function YP(t=WP,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const i=r.searchParams.get("apiKey");let n=Object.assign({},JP);return i&&(r.searchParams.delete("apiKey"),n=Object.assign(Object.assign({},JP),{"X-API-KEY":i})),{url:r.toString(),headers:n}}function QP(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 XP=new vd({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});_d(XP),Ad(XP),XP.addFormat("address",{validate:t=>{try{return t===nr(t)}catch(t){return!1}}}),XP.addFormat("evmAddress",{validate:t=>{try{return nr(t),!0}catch(t){return!1}}}),XP.addFormat("starknetAddress",{validate:t=>{try{return Zz(t).toLowerCase()===t.toLowerCase()}catch(t){return!1}}}),XP.addFormat("long",{validate:()=>!0}),XP.addFormat("lowercase",{validate:t=>t===t.toLowerCase()}),XP.addFormat("color",{validate:t=>!!t&&!!t.match(/^#[0-9A-F]{6}$/)}),XP.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 tB=Object.keys(jO),eB=Object.keys(jO).filter((t=>!jO[t].testnet));function rB(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 iB(t){return r(this,void 0,void 0,(function*(){var e;const r=yield sB(`https://cloudflare-dns.com/dns-query?name=${t}&type=TXT`,{headers:{accept:"application/dns-json"}}),i=yield r.json();if(3===i.Status)return KP;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()):KP}))}function nB(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 oB(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 sB(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 aB(t,e=kR[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 sB(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 hB(t,i){return r(this,arguments,void 0,(function*(t,r,i="1",n={}){var o,a;const{ensResolvers:s=(null===(o=jO[i])||void 0===o?void 0:o.ensResolvers)||jO[1].ensResolvers,broviderUrl:h}=n,u=e(n,["ensResolvers","broviderUrl"]);let l;try{l=cu(lu(t))}catch(t){return null}const c=NO(i,{broviderUrl:h}),d=[[UP,"resolver",[l]],...s.map((t=>[t,"text",[l,r]]))],[[f],...m]=yield LP(i,c,qP,d,u),p=s.indexOf(f);return-1!==p?null===(a=m[p])||void 0===a?void 0:a[0]:null}))}function uB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield hB(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function lB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){var i,n;if(!(null===(n=null===(i=jO[e])||void 0===i?void 0:i.ensResolvers)||void 0===n?void 0:n.length))throw new Error("Network not supported");const o=rB(t),a=NO(e,r),s=new os(UP,["function owner(bytes32) view returns (address)"],a);let h;try{h=cu(lu(t))}catch(t){return KP}const u=r.ensNameWrapper||jO[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===KP&&"other-tld"===o){(yield a.resolveName(t))&&(l=yield iB(t))}if(l===KP&&"subdomain"===o)try{l=yield a.resolveName(t)}catch(t){if(FP.every((e=>!t.message.includes(e))))throw t;l=KP}return l||KP}))}function cB(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i=yield uB(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 lB(t,e,r)}))}function dB(t,e){return r(this,void 0,void 0,(function*(){if(!t.endsWith(".shib"))return KP;const r=yield sB("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 fB(t,e){return r(this,void 0,void 0,(function*(){var r;if(!((null===(r=VP[e])||void 0===r?void 0:r.tlds)||[]).some((e=>t.endsWith(e))))return Promise.resolve(KP);try{const r=cu(lu(t)),i=BigInt(r),n=NO(e);return yield nB(n,HP,[VP[e].registryContract,"ownerOf",[i]],{blockTag:"latest"})}catch(t){return KP}}))}function mB(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function pB(t){return!!jO[t]}function gB(t){return t!==KP&&(or(t)||wB(t))}function yB(t,e){return"latest"===t||"number"==typeof t&&t>=jO[e].start}function wB(t){if(!t)return!1;try{return Zz(t),!0}catch(t){return!1}}function vB(t){return or(t)}function bB(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&&vB(t))return nr(t);if("starknet"===r&&wB(t))return Zz(t);throw new Error(`Invalid ${r} address: ${t}`)}function kB(t){return Promise.reject(new Error(t))}XP.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?eB.includes(e):tB.includes(e)},error:{message:"network not allowed"}}),XP.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))}),XP.addFormat("domain",{validate:t=>!!t&&!!t.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(\/)?$/)});var MB={call:nB,multicall:LP,fetch:sB,subgraphRequest:oB,ipfsGet:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="ipfs"){return sB(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:aB,getJSON:function(t){return r(this,arguments,void 0,(function*(t,e={}){const r=aB(t,e.gateways);return(yield sB(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=WP,a={}){if(!Array.isArray(i))return kB("addresses should be an array of addresses");if(0===i.length)return kB("addresses can not be empty");const s=i.find((t=>!gB(t)));if(s)return kB(`Invalid address: ${s}`);if(!pB(r))return kB(`Invalid network: ${r}`);const h=e.find((t=>t.network&&!pB(t.network)));if(h)return kB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!yB(n,r))return kB(`Snapshot (${n}) must be 'latest' or greater than network start block (${jO[r].start})`);new URL(o).pathname="/api/scores";const{url:u,headers:l}=YP(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:n,strategies:e,addresses:i},s=yield sB(u,{method:"POST",headers:l,body:JSON.stringify({params:o})}),h=yield QP(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}=YP(null==s?void 0:s.url);if(!gB(t))return kB(`Invalid voter address: ${t}`);if(!pB(e))return kB(`Invalid network: ${e}`);const h=i.find((t=>t.network&&!pB(t.network)));if(h)return kB(`Invalid network (${h.network}) in strategy ${h.name}`);if(!yB(n,e))return kB(`Snapshot (${n}) must be 'latest' or greater than network start block (${jO[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 sB(r,u);return(yield QP(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=XP.compile(t),n=i.call(r,e);return n||i.errors},getEnsTextRecord:hB,getSpaceUri:uB,getEnsOwner:lB,getSpaceController:function(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){if(GP.includes(e))return cB(t,e,r);if(ZP.includes(e))return dB(t,e);if(VP[String(e)])return fB(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?FR(e):null;for(;;){const t=yield UR({url:n,spaces:s,pivot:o,snapshot:r});if($R(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{LR(a,t),o=t.timestamp})),t.length<DR)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:mB,voting:PR,getProvider:NO,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 LP(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>DP(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 oB(c,l)).blocks.forEach((t=>o[t.network]=t.number)),jd[a]=o,o}))},getHash:function(t,e){return(BO(t)?$O:bR).getHash(t,e)},verify:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){if(!wB(t)&&!vB(t))throw new Error("Invalid address");const o=BO(r)?$O:bR;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(!gB(e))return kB(`Invalid author: ${e}`);if(!pB(n))return kB(`Invalid network: ${n}`);if(!yB(o,n))return kB(`Snapshot (${o}) must be 'latest' or greater than network start block (${jO[n].start})`);s||(s={});const{url:r,headers:h}=YP(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 sB(r,u);return(yield QP(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:wB,isEvmAddress:vB,getFormattedAddress:bB,SNAPSHOT_SUBGRAPH_URL:BR};const _B={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},EB={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"}]},AB={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"}]},jB={FlagProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},xB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},SB={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},NB={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"}]},IB={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"}]},TB={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"}]},CB={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"}]},zB={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"}]},OB={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"}]},RB={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},PB={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"}]},DB={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},$B={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},LB={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"}]},FB={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},UB={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var qB={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},VB={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},HB={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const GB={name:"snapshot",version:"0.1.4"};class ZB{constructor(t=qB.sequencer,e={}){t=(t=(t=t.replace(qB.hub,qB.sequencer)).replace(VB.hub,VB.sequencer)).replace(HB.hub,HB.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=bB(e,"evm");i.from=i.from?bB(i.from):a,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const s=Object.assign({},GB);"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)=>{sB(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,_B)}))}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,EB)}))}updateProposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.privacy||(i.privacy=""),yield this.sign(t,e,i,AB)}))}flagProposal(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,jB)}))}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?SB:xB)}))}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?CB:NB;return["approval","ranked-choice"].includes(i.type)&&(o=n?zB:IB),!r&&["quadratic","weighted"].includes(i.type)&&(o=n?OB:TB,i.choice=JSON.stringify(i.choice)),r&&(o=n?OB:TB),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,RB)}))}unfollow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,PB)}))}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,DB)}))}profile(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,$B)}))}statement(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,LB)}))}alias(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,FB)}))}deleteSpace(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,UB)}))}}var KB={$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}}},JB={$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}}},WB={$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}}},YB={$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}}},QB={$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}}},XB={$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}}}},tD={$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:ZB,Client712:ZB,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:KB.definitions.Proposal,updateProposal:JB.definitions.UpdateProposal,vote:WB.definitions.Vote,profile:YB.definitions.Profile,statement:QB.definitions.Statement,zodiac:XB.definitions.Zodiac,alias:tD.definitions.Alias},utils:MB}}));
|