(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[510],{9416:function(e,t,r){"use strict";let n,i;r.d(t,{SZ:function(){return rN}});class o extends Error{constructor(e,t={}){super(e,t.cause?{cause:t.cause}:void 0),this.name="BaseError",this.cause=t.cause}}class s extends o{constructor(){super("Invalid domain manifest"),this.name="AddMiniApp.InvalidDomainManifest"}}class a extends o{constructor(){super("Add frame rejected by user"),this.name="AddMiniApp.RejectedByUser"}}class u extends o{constructor(){super("Sign in rejected by user"),this.name="SignIn.RejectedByUser"}}(tf=tg||(tg={})).assertEqual=e=>e,tf.assertIs=function(e){},tf.assertNever=function(e){throw Error()},tf.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},tf.getValidEnumValues=e=>{let t=tf.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return tf.objectValues(r)},tf.objectValues=e=>tf.objectKeys(e).map(function(t){return e[t]}),tf.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},tf.find=(e,t)=>{for(let r of e)if(t(r))return r},tf.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,tf.joinValues=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" | ";return e.map(e=>"string"==typeof e?"'".concat(e,"'"):e).join(t)},tf.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ty||(ty={})).mergeShapes=(e,t)=>({...e,...t});let l=tg.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),h=e=>{switch(typeof e){case"undefined":return l.undefined;case"string":return l.string;case"number":return isNaN(e)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":if(Array.isArray(e))return l.array;if(null===e)return l.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return l.promise;if("undefined"!=typeof Map&&e instanceof Map)return l.map;if("undefined"!=typeof Set&&e instanceof Set)return l.set;if("undefined"!=typeof Date&&e instanceof Date)return l.date;return l.object;default:return l.unknown}},c=tg.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class d extends Error{get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n0&&void 0!==arguments[0]?arguments[0]:e=>e.message,t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}constructor(e){var t;super(),t=this,this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.issues=[...t.issues,...e]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}}d.create=e=>new d(e);let f=(e,t)=>{let r;switch(e.code){case c.invalid_type:r=e.received===l.undefined?"Required":"Expected ".concat(e.expected,", received ").concat(e.received);break;case c.invalid_literal:r="Invalid literal value, expected ".concat(JSON.stringify(e.expected,tg.jsonStringifyReplacer));break;case c.unrecognized_keys:r="Unrecognized key(s) in object: ".concat(tg.joinValues(e.keys,", "));break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r="Invalid discriminator value. Expected ".concat(tg.joinValues(e.options));break;case c.invalid_enum_value:r="Invalid enum value. Expected ".concat(tg.joinValues(e.options),", received '").concat(e.received,"'");break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r='Invalid input: must include "'.concat(e.validation.includes,'"'),"number"==typeof e.validation.position&&(r="".concat(r," at one or more positions greater than or equal to ").concat(e.validation.position))):"startsWith"in e.validation?r='Invalid input: must start with "'.concat(e.validation.startsWith,'"'):"endsWith"in e.validation?r='Invalid input: must end with "'.concat(e.validation.endsWith,'"'):tg.assertNever(e.validation):r="regex"!==e.validation?"Invalid ".concat(e.validation):"Invalid";break;case c.too_small:r="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"more than"," ").concat(e.minimum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"over"," ").concat(e.minimum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(e.minimum):"date"===e.type?"Date must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(e.minimum))):"Invalid input";break;case c.too_big:r="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"less than"," ").concat(e.maximum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"under"," ").concat(e.maximum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"bigint"===e.type?"BigInt must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"date"===e.type?"Date must be ".concat(e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(e.maximum))):"Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r="Number must be a multiple of ".concat(e.multipleOf);break;case c.not_finite:r="Number must be finite";break;default:r=t.defaultError,tg.assertNever(e)}return{message:r}},p=f;function m(){return p}let g=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(void 0!==i.message)return{...i,path:o,message:i.message};let a="";for(let e of n.filter(e=>!!e).slice().reverse())a=e(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}};function y(e,t){let r=m(),n=g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===f?void 0:f].filter(e=>!!e)});e.common.issues.push(n)}class b{dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return w;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return b.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return w;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}constructor(){this.value="valid"}}let w=Object.freeze({status:"aborted"}),_=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),E=e=>"aborted"===e.status,M=e=>"dirty"===e.status,A=e=>"valid"===e.status,k=e=>"undefined"!=typeof Promise&&e instanceof Promise;function O(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function S(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(tp=tv||(tv={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},tp.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class I{get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}}let B=(e,t)=>{if(A(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new d(e.common.issues);return this._error=t,this._error}}};function R(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var o,s;let{message:a}=e;return"invalid_enum_value"===t.code?{message:null!=a?a:i.defaultError}:void 0===i.data?{message:null!==(o=null!=a?a:n)&&void 0!==o?o:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(s=null!=a?a:r)&&void 0!==s?s:i.defaultError}},description:i}}class P{get description(){return this._def.description}_getType(e){return h(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:h(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:h(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(k(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)},i=this._parseSync({data:e,path:n.path,parent:n});return B(n,i)}"~validate"(e){var t,r;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:n});return A(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>A(e)?{value:e.value}:{issues:n.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)},n=this._parse({data:e,path:r.path,parent:r});return B(r,await (k(n)?n:Promise.resolve(n)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{let i=e(t),o=()=>n.addIssue({code:c.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(o(),!1)):!!i||(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new ek({schema:this,typeName:t_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return eO.create(this,this._def)}nullable(){return eS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return el.create(this)}promise(){return eA.create(this,this._def)}or(e){return ec.create([this,e],this._def)}and(e){return ep.create(this,e,this._def)}transform(e){return new ek({...R(this._def),schema:this,typeName:t_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eI({...R(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:t_.ZodDefault})}brand(){return new eT({typeName:t_.ZodBranded,type:this,...R(this._def)})}catch(e){return new eB({...R(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:t_.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eC.create(this,e)}readonly(){return ej.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}}let T=/^c[^\s-]{8,}$/i,C=/^[0-9a-z]+$/,j=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,N=/^[a-z0-9_-]{21}$/i,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Z=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,D=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,V=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,H=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,K="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",G=new RegExp("^".concat(K,"$"));function Q(e){let t="[0-5]\\d";e.precision?t="".concat(t,"\\.\\d{").concat(e.precision,"}"):null==e.precision&&(t="".concat(t,"(\\.\\d+)?"));let r=e.precision?"+":"?";return"([01]\\d|2[0-3]):[0-5]\\d(:".concat(t,")").concat(r)}function $(e){let t="".concat(K,"T").concat(Q(e)),r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t="".concat(t,"(").concat(r.join("|"),")"),new RegExp("^".concat(t,"$"))}class Y extends P{_parse(e){var t,r,i,o;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.string,received:t.parsedType}),w}let a=new b;for(let u of this._def.checks)if("min"===u.kind)e.data.lengthu.value&&(y(s=this._getOrReturnCtx(e,s),{code:c.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),a.dirty());else if("length"===u.kind){let t=e.data.length>u.value,r=e.data.lengthe.test(t),{validation:t,code:c.invalid_string,...tv.errToObj(r)})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tv.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tv.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tv.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tv.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tv.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tv.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tv.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tv.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tv.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tv.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tv.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tv.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tv.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...tv.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...tv.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tv.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tv.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tv.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tv.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tv.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tv.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tv.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tv.errToObj(t)})}nonempty(e){return this.min(1,tv.errToObj(e))}trim(){return new Y({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Y({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Y({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Y({checks:[],typeName:t_.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...R(e)})};class J extends P{_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.number,received:t.parsedType}),w}let r=new b;for(let n of this._def.checks)"int"===n.kind?tg.isInteger(e.data)||(y(t=this._getOrReturnCtx(e,t),{code:c.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.datan.value:e.data>=n.value)&&(y(t=this._getOrReturnCtx(e,t),{code:c.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(y(t=this._getOrReturnCtx(e,t),{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(y(t=this._getOrReturnCtx(e,t),{code:c.not_finite,message:n.message}),r.dirty()):tg.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tv.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tv.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tv.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tv.toString(t))}setLimit(e,t,r,n){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tv.toString(n)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tv.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tv.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tv.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tv.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tv.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tv.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tv.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tv.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tv.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&tg.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.valuenew J({checks:[],typeName:t_.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});class X extends P{_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==l.bigint)return this._getInvalidInput(e);let r=new b;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.datan.value:e.data>=n.value)&&(y(t=this._getOrReturnCtx(e,t),{code:c.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(y(t=this._getOrReturnCtx(e,t),{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):tg.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,tv.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tv.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tv.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tv.toString(t))}setLimit(e,t,r,n){return new X({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tv.toString(n)}]})}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tv.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tv.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tv.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tv.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tv.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new X({checks:[],typeName:t_.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...R(e)})};class ee extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.boolean,received:t.parsedType}),w}return x(e.data)}}ee.create=e=>new ee({typeName:t_.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});class et extends P{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.date,received:t.parsedType}),w}if(isNaN(e.data.getTime()))return y(this._getOrReturnCtx(e),{code:c.invalid_date}),w;let r=new b;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()n.value&&(y(t=this._getOrReturnCtx(e,t),{code:c.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):tg.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new et({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tv.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tv.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew et({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:t_.ZodDate,...R(e)});class er extends P{_parse(e){if(this._getType(e)!==l.symbol){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.symbol,received:t.parsedType}),w}return x(e.data)}}er.create=e=>new er({typeName:t_.ZodSymbol,...R(e)});class en extends P{_parse(e){if(this._getType(e)!==l.undefined){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.undefined,received:t.parsedType}),w}return x(e.data)}}en.create=e=>new en({typeName:t_.ZodUndefined,...R(e)});class ei extends P{_parse(e){if(this._getType(e)!==l.null){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.null,received:t.parsedType}),w}return x(e.data)}}ei.create=e=>new ei({typeName:t_.ZodNull,...R(e)});class eo extends P{_parse(e){return x(e.data)}constructor(){super(...arguments),this._any=!0}}eo.create=e=>new eo({typeName:t_.ZodAny,...R(e)});class es extends P{_parse(e){return x(e.data)}constructor(){super(...arguments),this._unknown=!0}}es.create=e=>new es({typeName:t_.ZodUnknown,...R(e)});class ea extends P{_parse(e){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.never,received:t.parsedType}),w}}ea.create=e=>new ea({typeName:t_.ZodNever,...R(e)});class eu extends P{_parse(e){if(this._getType(e)!==l.undefined){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.void,received:t.parsedType}),w}return x(e.data)}}eu.create=e=>new eu({typeName:t_.ZodVoid,...R(e)});class el extends P{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return y(t,{code:c.invalid_type,expected:l.array,received:t.parsedType}),w;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.lengthn.maxLength.value&&(y(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new I(t,e,t.path,r)))).then(e=>b.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new I(t,e,t.path,r)));return b.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new el({...this._def,minLength:{value:e,message:tv.toString(t)}})}max(e,t){return new el({...this._def,maxLength:{value:e,message:tv.toString(t)}})}length(e,t){return new el({...this._def,exactLength:{value:e,message:tv.toString(t)}})}nonempty(e){return this.min(1,e)}}el.create=(e,t)=>new el({type:e,minLength:null,maxLength:null,exactLength:null,typeName:t_.ZodArray,...R(t)});class eh extends P{_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=tg.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==l.object){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.object,received:t.parsedType}),w}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ea&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||o.push(e);let s=[];for(let e of i){let t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new I(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ea){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of o)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)o.length>0&&(y(r,{code:c.unrecognized_keys,keys:o}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of o){let n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new I(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>b.mergeObjectSync(t,e)):b.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return tv.errToObj,new eh({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,o,s;let a=null!==(o=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==o?o:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=tv.errToObj(e).message)&&void 0!==s?s:a}:{message:a}}}:{}})}strip(){return new eh({...this._def,unknownKeys:"strip"})}passthrough(){return new eh({...this._def,unknownKeys:"passthrough"})}extend(e){return new eh({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new eh({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:t_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new eh({...this._def,catchall:e})}pick(e){let t={};return tg.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new eh({...this._def,shape:()=>t})}omit(e){let t={};return tg.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new eh({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof eh){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=eO.create(e(i))}return new eh({...t._def,shape:()=>r})}return t instanceof el?new el({...t._def,type:e(t.element)}):t instanceof eO?eO.create(e(t.unwrap())):t instanceof eS?eS.create(e(t.unwrap())):t instanceof em?em.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return tg.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new eh({...this._def,shape:()=>t})}required(e){let t={};return tg.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eO;)e=e._def.innerType;t[r]=e}}),new eh({...this._def,shape:()=>t})}keyof(){return ex(tg.objectKeys(this.shape))}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}}eh.create=(e,t)=>new eh({shape:()=>e,unknownKeys:"strip",catchall:ea.create(),typeName:t_.ZodObject,...R(t)}),eh.strictCreate=(e,t)=>new eh({shape:()=>e,unknownKeys:"strict",catchall:ea.create(),typeName:t_.ZodObject,...R(t)}),eh.lazycreate=(e,t)=>new eh({shape:e,unknownKeys:"strip",catchall:ea.create(),typeName:t_.ZodObject,...R(t)});class ec extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new d(e.ctx.common.issues));return y(t,{code:c.invalid_union,unionErrors:r}),w});{let e;let n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new d(e));return y(t,{code:c.invalid_union,unionErrors:i}),w}}get options(){return this._def.options}}ec.create=(e,t)=>new ec({options:e,typeName:t_.ZodUnion,...R(t)});let ed=e=>{if(e instanceof ew)return ed(e.schema);if(e instanceof ek)return ed(e.innerType());if(e instanceof e_)return[e.value];if(e instanceof eE)return e.options;if(e instanceof eM)return tg.objectValues(e.enum);if(e instanceof eI)return ed(e._def.innerType);if(e instanceof en)return[void 0];else if(e instanceof ei)return[null];else if(e instanceof eO)return[void 0,...ed(e.unwrap())];else if(e instanceof eS)return[null,...ed(e.unwrap())];else if(e instanceof eT)return ed(e.unwrap());else if(e instanceof ej)return ed(e.unwrap());else if(e instanceof eB)return ed(e._def.innerType);else return[]};class ef extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.object)return y(t,{code:c.invalid_type,expected:l.object,received:t.parsedType}),w;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=ed(r.shape[e]);if(!t.length)throw Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let i of t){if(n.has(i))throw Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(i)));n.set(i,r)}}return new ef({typeName:t_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...R(r)})}}class ep extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(E(e)||E(n))return w;let i=function e(t,r){let n=h(t),i=h(r);if(t===r)return{valid:!0,data:t};if(n===l.object&&i===l.object){let n=tg.objectKeys(r),i=tg.objectKeys(t).filter(e=>-1!==n.indexOf(e)),o={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};o[n]=i.data}return{valid:!0,data:o}}if(n===l.array&&i===l.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i{let[t,r]=e;return n(t,r)}):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ep.create=(e,t,r)=>new ep({left:e,right:t,typeName:t_.ZodIntersection,...R(r)});class em extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.array)return y(r,{code:c.invalid_type,expected:l.array,received:r.parsedType}),w;if(r.data.lengththis._def.items.length&&(y(r,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new I(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>b.mergeArray(t,e)):b.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new em({...this._def,rest:e})}}em.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new em({items:e,typeName:t_.ZodTuple,rest:null,...R(t)})};class eg extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.object)return y(r,{code:c.invalid_type,expected:l.object,received:r.parsedType}),w;let n=[],i=this._def.keyType,o=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new I(r,e,r.path,e)),value:o._parse(new I(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new eg(t instanceof P?{keyType:e,valueType:t,typeName:t_.ZodRecord,...R(r)}:{keyType:Y.create(),valueType:e,typeName:t_.ZodRecord,...R(t)})}}class ey extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.map)return y(r,{code:c.invalid_type,expected:l.map,received:r.parsedType}),w;let n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map((e,t)=>{let[o,s]=e;return{key:n._parse(new I(r,o,r.path,[t,"key"])),value:i._parse(new I(r,s,r.path,[t,"value"]))}});if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of o){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return w;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of o){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return w;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}ey.create=(e,t,r)=>new ey({valueType:t,keyType:e,typeName:t_.ZodMap,...R(r)});class ev extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.set)return y(r,{code:c.invalid_type,expected:l.set,received:r.parsedType}),w;let n=this._def;null!==n.minSize&&r.data.sizen.maxSize.value&&(y(r,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function o(e){let r=new Set;for(let n of e){if("aborted"===n.status)return w;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>i._parse(new I(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>o(e)):o(s)}min(e,t){return new ev({...this._def,minSize:{value:e,message:tv.toString(t)}})}max(e,t){return new ev({...this._def,maxSize:{value:e,message:tv.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ev.create=(e,t)=>new ev({valueType:e,minSize:null,maxSize:null,typeName:t_.ZodSet,...R(t)});class eb extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.function)return y(t,{code:c.invalid_type,expected:l.function,received:t.parsedType}),w;function r(e,r){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),f].filter(e=>!!e),issueData:{code:c.invalid_arguments,argumentsError:r}})}function n(e,r){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),f].filter(e=>!!e),issueData:{code:c.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof eA){let e=this;return x(async function(){for(var t=arguments.length,s=Array(t),a=0;a{throw u.addIssue(r(s,e)),u}),h=await Reflect.apply(o,this,l);return await e._def.returns._def.type.parseAsync(h,i).catch(e=>{throw u.addIssue(n(h,e)),u})})}{let e=this;return x(function(){for(var t=arguments.length,s=Array(t),a=0;anew ew({getter:e,typeName:t_.ZodLazy,...R(t)});class e_ extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ex(e,t){return new eE({values:e,typeName:t_.ZodEnum,...R(t)})}e_.create=(e,t)=>new e_({value:e,typeName:t_.ZodLiteral,...R(t)});class eE extends P{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return y(t,{expected:tg.joinValues(r),received:t.parsedType,code:c.invalid_type}),w}if(O(this,tb,"f")||S(this,tb,new Set(this._def.values),"f"),!O(this,tb,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return y(t,{received:t.data,code:c.invalid_enum_value,options:r}),w}return x(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._def;return eE.create(e,{...this._def,...t})}exclude(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._def;return eE.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}constructor(){super(...arguments),tb.set(this,void 0)}}tb=new WeakMap,eE.create=ex;class eM extends P{_parse(e){let t=tg.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==l.string&&r.parsedType!==l.number){let e=tg.objectValues(t);return y(r,{expected:tg.joinValues(e),received:r.parsedType,code:c.invalid_type}),w}if(O(this,tw,"f")||S(this,tw,new Set(tg.getValidEnumValues(this._def.values)),"f"),!O(this,tw,"f").has(e.data)){let e=tg.objectValues(t);return y(r,{received:r.data,code:c.invalid_enum_value,options:e}),w}return x(e.data)}get enum(){return this._def.values}constructor(){super(...arguments),tw.set(this,void 0)}}tw=new WeakMap,eM.create=(e,t)=>new eM({values:e,typeName:t_.ZodNativeEnum,...R(t)});class eA extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==l.promise&&!1===t.common.async?(y(t,{code:c.invalid_type,expected:l.promise,received:t.parsedType}),w):x((t.parsedType===l.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eA.create=(e,t)=>new eA({type:e,typeName:t_.ZodPromise,...R(t)});class ek extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===t_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{y(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return w;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?w:"dirty"===n.status||"dirty"===t.value?_(n.value):n});{if("aborted"===t.value)return w;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?w:"dirty"===n.status||"dirty"===t.value?_(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?w:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?w:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>A(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!A(e))return e;let o=n.transform(e.value,i);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}}tg.assertNever(n)}}ek.create=(e,t,r)=>new ek({schema:e,typeName:t_.ZodEffects,effect:t,...R(r)}),ek.createWithPreprocess=(e,t,r)=>new ek({schema:t,effect:{type:"preprocess",transform:e},typeName:t_.ZodEffects,...R(r)});class eO extends P{_parse(e){return this._getType(e)===l.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eO.create=(e,t)=>new eO({innerType:e,typeName:t_.ZodOptional,...R(t)});class eS extends P{_parse(e){return this._getType(e)===l.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eS.create=(e,t)=>new eS({innerType:e,typeName:t_.ZodNullable,...R(t)});class eI extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===l.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eI.create=(e,t)=>new eI({innerType:e,typeName:t_.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...R(t)});class eB extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return k(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new d(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eB.create=(e,t)=>new eB({innerType:e,typeName:t_.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...R(t)});class eR extends P{_parse(e){if(this._getType(e)!==l.nan){let t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:l.nan,received:t.parsedType}),w}return{status:"valid",value:e.data}}}eR.create=e=>new eR({typeName:t_.ZodNaN,...R(e)});let eP=Symbol("zod_brand");class eT extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eC extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?w:"dirty"===e.status?(t.dirty(),_(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?w:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eC({in:e,out:t,typeName:t_.ZodPipeline})}}class ej extends P{_parse(e){let t=this._def.innerType._parse(e),r=e=>(A(e)&&(e.value=Object.freeze(e.value)),e);return k(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function eU(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function eN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return e?eo.create().superRefine((n,i)=>{var o,s;let a=e(n);if(a instanceof Promise)return a.then(e=>{var o,s;if(!e){let e=eU(t,n),a=null===(s=null!==(o=e.fatal)&&void 0!==o?o:r)||void 0===s||s;i.addIssue({code:"custom",...e,fatal:a})}});if(!a){let e=eU(t,n),a=null===(s=null!==(o=e.fatal)&&void 0!==o?o:r)||void 0===s||s;i.addIssue({code:"custom",...e,fatal:a})}}):eo.create()}ej.create=(e,t)=>new ej({innerType:e,typeName:t_.ZodReadonly,...R(t)});let eL={object:eh.lazycreate};(tm=t_||(t_={})).ZodString="ZodString",tm.ZodNumber="ZodNumber",tm.ZodNaN="ZodNaN",tm.ZodBigInt="ZodBigInt",tm.ZodBoolean="ZodBoolean",tm.ZodDate="ZodDate",tm.ZodSymbol="ZodSymbol",tm.ZodUndefined="ZodUndefined",tm.ZodNull="ZodNull",tm.ZodAny="ZodAny",tm.ZodUnknown="ZodUnknown",tm.ZodNever="ZodNever",tm.ZodVoid="ZodVoid",tm.ZodArray="ZodArray",tm.ZodObject="ZodObject",tm.ZodUnion="ZodUnion",tm.ZodDiscriminatedUnion="ZodDiscriminatedUnion",tm.ZodIntersection="ZodIntersection",tm.ZodTuple="ZodTuple",tm.ZodRecord="ZodRecord",tm.ZodMap="ZodMap",tm.ZodSet="ZodSet",tm.ZodFunction="ZodFunction",tm.ZodLazy="ZodLazy",tm.ZodLiteral="ZodLiteral",tm.ZodEnum="ZodEnum",tm.ZodEffects="ZodEffects",tm.ZodNativeEnum="ZodNativeEnum",tm.ZodOptional="ZodOptional",tm.ZodNullable="ZodNullable",tm.ZodDefault="ZodDefault",tm.ZodCatch="ZodCatch",tm.ZodPromise="ZodPromise",tm.ZodBranded="ZodBranded",tm.ZodPipeline="ZodPipeline",tm.ZodReadonly="ZodReadonly";let eZ=Y.create,eF=J.create,ez=eR.create,eq=X.create,eD=ee.create,eV=et.create,eH=er.create,eW=en.create,eK=ei.create,eG=eo.create,eQ=es.create,e$=ea.create,eY=eu.create,eJ=el.create,eX=eh.create,e0=eh.strictCreate,e1=ec.create,e2=ef.create,e6=ep.create,e3=em.create,e8=eg.create,e4=ey.create,e5=ev.create,e9=eb.create,e7=ew.create,te=e_.create,tt=eE.create,tr=eM.create,tn=eA.create,ti=ek.create,to=eO.create,ts=eS.create,ta=ek.createWithPreprocess,tu=eC.create;var tl,th,tc,td,tf,tp,tm,tg,ty,tv,tb,tw,t_,tx=Object.freeze({__proto__:null,defaultErrorMap:f,setErrorMap:function(e){p=e},getErrorMap:m,makeIssue:g,EMPTY_PATH:[],addIssueToContext:y,ParseStatus:b,INVALID:w,DIRTY:_,OK:x,isAborted:E,isDirty:M,isValid:A,isAsync:k,get util(){return tg},get objectUtil(){return ty},ZodParsedType:l,getParsedType:h,ZodType:P,datetimeRegex:$,ZodString:Y,ZodNumber:J,ZodBigInt:X,ZodBoolean:ee,ZodDate:et,ZodSymbol:er,ZodUndefined:en,ZodNull:ei,ZodAny:eo,ZodUnknown:es,ZodNever:ea,ZodVoid:eu,ZodArray:el,ZodObject:eh,ZodUnion:ec,ZodDiscriminatedUnion:ef,ZodIntersection:ep,ZodTuple:em,ZodRecord:eg,ZodMap:ey,ZodSet:ev,ZodFunction:eb,ZodLazy:ew,ZodLiteral:e_,ZodEnum:eE,ZodNativeEnum:eM,ZodPromise:eA,ZodEffects:ek,ZodTransformer:ek,ZodOptional:eO,ZodNullable:eS,ZodDefault:eI,ZodCatch:eB,ZodNaN:eR,BRAND:eP,ZodBranded:eT,ZodPipeline:eC,ZodReadonly:ej,custom:eN,Schema:P,ZodSchema:P,late:eL,get ZodFirstPartyTypeKind(){return t_},coerce:{string:e=>Y.create({...e,coerce:!0}),number:e=>J.create({...e,coerce:!0}),boolean:e=>ee.create({...e,coerce:!0}),bigint:e=>X.create({...e,coerce:!0}),date:e=>et.create({...e,coerce:!0})},any:eG,array:eJ,bigint:eq,boolean:eD,date:eV,discriminatedUnion:e2,effect:ti,enum:tt,function:e9,instanceof:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{message:"Input not instance of ".concat(e.name)};return eN(t=>t instanceof e,t)},intersection:e6,lazy:e7,literal:te,map:e4,nan:ez,nativeEnum:tr,never:e$,null:eK,nullable:ts,number:eF,object:eX,oboolean:()=>eD().optional(),onumber:()=>eF().optional(),optional:to,ostring:()=>eZ().optional(),pipeline:tu,preprocess:ta,promise:tn,record:e8,set:e5,strictObject:e0,string:eZ,symbol:eH,transformer:ti,tuple:e3,undefined:eW,union:e1,unknown:eQ,void:eY,NEVER:w,ZodIssueCode:c,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:d});let tE=/[@#$%^&*+=\/\\|~«»]/,tM=/(!{2,}|\?{2,}|-{2,})/,tA=/[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u,tk=function(){let{max:e,noSpaces:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(t?tx.string().max(null!=e?e:Number.POSITIVE_INFINITY).regex(/^\S*$/,"Spaces are not allowed"):tx.string().max(null!=e?e:Number.POSITIVE_INFINITY)).refine(e=>!tA.test(e),{message:"Emojis and symbols are not allowed"}).refine(e=>!tE.test(e),{message:"Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, \xab, \xbb) are not allowed"}).refine(e=>!tM.test(e),{message:"Repeated punctuations (!!, ??, --) are not allowed"})},tO=tx.string().url().startsWith("https://",{message:"Must be an https url"}).max(1024),tS=tx.string().max(32),tI=tx.string().max(32),tB=tx.string().regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/,{message:"Invalid CAIP-19 asset ID"}),tR=tx.string().regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i,{message:"Invalid hex color code. It should be in the format #RRGGBB or #RGB."}),tP=tx.union([tx.literal("1:1"),tx.literal("3:2")]),tT=tx.object({header:tx.string(),payload:tx.string(),signature:tx.string()});tx.object({fid:tx.number(),type:tx.literal("app_key"),key:tx.string().startsWith("0x")});let tC=tx.object({type:tx.literal("launch_frame"),name:tS,url:tO.optional(),splashImageUrl:tO.optional(),splashBackgroundColor:tR.optional()}),tj=tx.object({type:tx.literal("view_token"),token:tB}),tU=tx.discriminatedUnion("type",[tC,tj]),tN=tx.object({title:tI,action:tU});tx.object({version:tx.literal("next"),imageUrl:tO,aspectRatio:tP.optional(),button:tN});let tL=tx.object({url:tx.string(),token:tx.string()});tx.object({notificationId:tx.string().max(128),title:tx.string().max(32),body:tx.string().max(128),targetUrl:tO,tokens:tx.string().array().max(100)}),tx.object({result:tx.object({successfulTokens:tx.array(tx.string()),invalidTokens:tx.array(tx.string()),rateLimitedTokens:tx.array(tx.string())})});let tZ=tx.object({event:tx.literal("frame_added"),notificationDetails:tL.optional()}),tF=tx.object({event:tx.literal("frame_removed")}),tz=tx.object({event:tx.literal("notifications_enabled"),notificationDetails:tL.required()}),tq=tx.object({event:tx.literal("notifications_disabled")});tx.discriminatedUnion("event",[tZ,tF,tz,tq]);let tD=tx.enum(["games","social","finance","utility","productivity","health-fitness","news-media","music","shopping","education","developer-tools","entertainment","art-creativity"]),tV=tx.object({version:tx.union([tx.literal("0.0.0"),tx.literal("0.0.1"),tx.literal("1"),tx.literal("next")]),name:tS,iconUrl:tO,homeUrl:tO,imageUrl:tO.optional(),buttonTitle:tI.optional(),splashImageUrl:tO.optional(),splashBackgroundColor:tR.optional(),webhookUrl:tO.optional(),subtitle:tk({max:30}).optional(),description:tk({max:170}).optional(),screenshotUrls:tx.array(tO).max(3).optional(),primaryCategory:tD.optional(),tags:tx.array(tk({max:20,noSpaces:!0})).max(5).optional(),heroImageUrl:tO.optional(),tagline:tk({max:30}).optional(),ogTitle:tk({max:30}).optional(),ogDescription:tk({max:100}).optional(),ogImageUrl:tO.optional(),noindex:tx.boolean().optional()});tx.object({accountAssociation:tT,frame:tV.optional()});var tH=r(5265),tW=r(3663).Buffer;function tK(e){return tW.from(e.serialize({verifySignatures:!1})).toString("base64")}var tG=r(2942);class tQ extends Error{walk(e){return function e(t,r){return(null==r?void 0:r(t))?t:t&&"object"==typeof t&&"cause"in t&&t.cause?e(t.cause,r):r?null:t}(this,e)}constructor(e,t={}){let r=(()=>{var e;if(t.cause instanceof tQ){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return(null===(e=t.cause)||void 0===e?void 0:e.message)?t.cause.message:t.details})(),n=t.cause instanceof tQ&&t.cause.docsPath||t.docsPath,i="".concat("https://oxlib.sh").concat(null!=n?n:"");super([e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...r||n?["",r?"Details: ".concat(r):void 0,n?"See: ".concat(i):void 0]:[]].filter(e=>"string"==typeof e).join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"ox@".concat("0.1.1")}),this.cause=t.cause,this.details=r,this.docs=i,this.docsPath=n,this.shortMessage=e}}function t$(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{raw:r=!1}=t;if(r)return e;if(e.error){let{code:t}=e.error;throw new(t===t9.code?t9:t===tJ.code?tJ:t===t5.code?t5:t===t8.code?t8:t===t6.code?t6:t===t4.code?t4:t===t2.code?t2:t===t7.code?t7:t===tX.code?tX:t===t0.code?t0:t===t1.code?t1:t===t3.code?t3:tY)(e.error)}return e.result}class tY extends Error{constructor(e){let{code:t,message:r,data:n}=e;super(r),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.BaseError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t,this.data=n}}class tJ extends tY{constructor(e={}){super({message:"Missing or invalid parameters.",...e,code:tJ.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidInputError"})}}Object.defineProperty(tJ,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class tX extends tY{constructor(e={}){super({message:"Requested resource not found.",...e,code:tX.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ResourceNotFoundError"})}}Object.defineProperty(tX,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class t0 extends tY{constructor(e={}){super({message:"Requested resource not available.",...e,code:t0.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ResourceUnavailableError"})}}Object.defineProperty(t0,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class t1 extends tY{constructor(e={}){super({message:"Transaction creation failed.",...e,code:t1.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.TransactionRejectedError"})}}Object.defineProperty(t1,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class t2 extends tY{constructor(e={}){super({message:"Method is not implemented.",...e,code:t2.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.MethodNotSupportedError"})}}Object.defineProperty(t2,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class t6 extends tY{constructor(e={}){super({message:"Rate limit exceeded.",...e,code:t6.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.LimitExceededError"})}}Object.defineProperty(t6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class t3 extends tY{constructor(e={}){super({message:"JSON-RPC version not supported.",...e,code:t3.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.VersionNotSupportedError"})}}Object.defineProperty(t3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class t8 extends tY{constructor(e={}){super({message:"Input is not a valid JSON-RPC request.",...e,code:t8.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidRequestError"})}}Object.defineProperty(t8,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class t4 extends tY{constructor(e={}){super({message:"Method does not exist.",...e,code:t4.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.MethodNotFoundError"})}}Object.defineProperty(t4,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class t5 extends tY{constructor(e={}){super({message:"Invalid method parameters.",...e,code:t5.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidParamsError"})}}Object.defineProperty(t5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class t9 extends tY{constructor(e={}){super({message:"Internal JSON-RPC error.",...e,code:t9.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InternalErrorError"})}}Object.defineProperty(t9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class t7 extends tY{constructor(e={}){super({message:"Failed to parse JSON-RPC response.",...e,code:t7.code}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ParseError"})}}Object.defineProperty(t7,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class re extends Error{constructor(e,t){super(t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=e,this.details=t}}class rt extends re{constructor({message:e="The user rejected the request."}={}){super(4001,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UserRejectedRequestError"})}}Object.defineProperty(rt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class rr extends re{constructor({message:e="The requested method and/or account has not been authorized by the user."}={}){super(4100,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnauthorizedError"})}}Object.defineProperty(rr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class rn extends re{constructor({message:e="The provider does not support the requested method."}={}){super(4200,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnsupportedMethodError"})}}Object.defineProperty(rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ri extends re{constructor({message:e="The provider is disconnected from all chains."}={}){super(4900,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.DisconnectedError"})}}Object.defineProperty(ri,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ro extends re{constructor({message:e="The provider is not connected to the requested chain."}={}){super(4901,e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.ChainDisconnectedError"})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class rs extends tQ{constructor(){super("`provider` is undefined."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.IsUndefinedError"})}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */let ra=Symbol("Comlink.proxy"),ru=Symbol("Comlink.endpoint"),rl=Symbol("Comlink.releaseProxy"),rh=Symbol("Comlink.finalizer"),rc=Symbol("Comlink.thrown"),rd=e=>"object"==typeof e&&null!==e||"function"==typeof e,rf=new Map([["proxy",{canHandle:e=>rd(e)&&e[ra],serialize(e){let{port1:t,port2:r}=new MessageChannel;return function e(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:globalThis,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["*"];r.addEventListener("message",function i(o){let s;if(!o||!o.data)return;if(!function(e,t){for(let r of e)if(t===r||"*"===r||r instanceof RegExp&&r.test(t))return!0;return!1}(n,o.origin)){console.warn("Invalid origin '".concat(o.origin,"' for comlink proxy"));return}let{id:a,type:u,path:l}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(rE);try{var c,d;let r=l.slice(0,-1).reduce((e,t)=>e[t],t),n=l.reduce((e,t)=>e[t],t);switch(u){case"GET":s=n;break;case"SET":r[l.slice(-1)[0]]=rE(o.data.value),s=!0;break;case"APPLY":s=n.apply(r,h);break;case"CONSTRUCT":c=new n(...h),s=Object.assign(c,{[ra]:!0});break;case"ENDPOINT":{let{port1:r,port2:n}=new MessageChannel;e(t,n),d=[r],r_.set(r,d),s=r}break;case"RELEASE":s=void 0;break;default:return}}catch(e){s={value:e,[rc]:0}}Promise.resolve(s).catch(e=>({value:e,[rc]:0})).then(e=>{let[n,o]=rx(e);r.postMessage(Object.assign(Object.assign({},n),{id:a}),o),"RELEASE"===u&&(r.removeEventListener("message",i),rp(r),rh in t&&"function"==typeof t[rh]&&t[rh]())}).catch(e=>{let[t,n]=rx({value:TypeError("Unserializable return value"),[rc]:0});r.postMessage(Object.assign(Object.assign({},t),{id:a}),n)})}),r.start&&r.start()}(e,t),[r,[r]]},deserialize:e=>(e.start(),rm(e))}],["throw",{canHandle:e=>rd(e)&&rc in e,serialize(e){let{value:t}=e;return[t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[]]},deserialize(e){if(e.isError)throw Object.assign(Error(e.value.message),e.value);throw e.value}}]]);function rp(e){"MessagePort"===e.constructor.name&&e.close()}function rm(e,t){let r=new Map;return e.addEventListener("message",function(e){let{data:t}=e;if(!t||!t.id)return;let n=r.get(t.id);if(n)try{n(t)}finally{r.delete(t.id)}}),function e(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=!1,s=new Proxy(i,{get(i,a){if(rg(o),a===rl)return()=>{rb&&rb.unregister(s),ry(t),r.clear(),o=!0};if("then"===a){if(0===n.length)return{then:()=>s};let e=rM(t,r,{type:"GET",path:n.map(e=>e.toString())}).then(rE);return e.then.bind(e)}return e(t,r,[...n,a])},set(e,i,s){rg(o);let[a,u]=rx(s);return rM(t,r,{type:"SET",path:[...n,i].map(e=>e.toString()),value:a},u).then(rE)},apply(i,s,a){rg(o);let u=n[n.length-1];if(u===ru)return rM(t,r,{type:"ENDPOINT"}).then(rE);if("bind"===u)return e(t,r,n.slice(0,-1));let[l,h]=rw(a);return rM(t,r,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:l},h).then(rE)},construct(e,i){rg(o);let[s,a]=rw(i);return rM(t,r,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:s},a).then(rE)}});return function(e,t){let r=(rv.get(t)||0)+1;rv.set(t,r),rb&&rb.register(e,t,e)}(s,t),s}(e,r,[],t)}function rg(e){if(e)throw Error("Proxy has been released and is not useable")}function ry(e){return rM(e,new Map,{type:"RELEASE"}).then(()=>{rp(e)})}let rv=new WeakMap,rb="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{let t=(rv.get(e)||0)-1;rv.set(e,t),0===t&&ry(e)});function rw(e){var t;let r=e.map(rx);return[r.map(e=>e[0]),(t=r.map(e=>e[1]),Array.prototype.concat.apply([],t))]}let r_=new WeakMap;function rx(e){for(let[t,r]of rf)if(r.canHandle(e)){let[n,i]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:e},r_.get(e)||[]]}function rE(e){switch(e.type){case"HANDLER":return rf.get(e.name).deserialize(e.value);case"RAW":return e.value}}function rM(e,t,r,n){return new Promise(i=>{let o=[,,,,].fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(o,i),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),n)})}let rA=rm((null===(tl=window)||void 0===tl?void 0:tl.ReactNativeWebView)?{postMessage:e=>{console.debug("[webview:req]",e),window.ReactNativeWebView.postMessage(JSON.stringify(e))},addEventListener:function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),i=2;i{document.removeEventListener("FarcasterFrameCallback",t)}}:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:globalThis,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"*";return{postMessage:(t,n)=>e.postMessage(t,r,n),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}(null!==(tc=null===(th=window)||void 0===th?void 0:th.parent)&&void 0!==tc?tc:window)),rk=function(){let e=new tG.v;return{get eventNames(){return e.eventNames.bind(e)},get listenerCount(){return e.listenerCount.bind(e)},get listeners(){return e.listeners.bind(e)},addListener:e.addListener.bind(e),emit:e.emit.bind(e),off:e.off.bind(e),on:e.on.bind(e),once:e.once.bind(e),removeAllListeners:e.removeAllListeners.bind(e),removeListener:e.removeListener.bind(e)}}(),rO=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(e=t.id)&&void 0!==e?e:0;return{prepare:e=>({...{id:r++,...e},jsonrpc:"2.0"}),get id(){return r}}}(),rS=function(e){var t,r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{includeEvents:i=!0}=n;if(!e)throw new rs;return{...i?{on:null===(t=e.on)||void 0===t?void 0:t.bind(e),removeListener:null===(r=e.removeListener)||void 0===r?void 0:r.bind(e)}:{},async request(t){let r=await e.request(t);return r&&"object"==typeof r&&"jsonrpc"in r?t$(r):r}}}({...rk,async request(e){let t=rO.prepare(e);try{let e=await rA.ethProviderRequestV2(t).then(e=>t$(e,{request:t,raw:!0}));if(e.error)throw function(e){let{code:t,details:r}=e;switch(t){case 4001:return new rt;case 4100:return new rr;case 4200:return new rn;case 4900:return new ri;case 4901:return new ro;default:return new re(t,null!=r?r:"Unknown provider RPC error")}}(e.error);return e.result}catch(e){if(e instanceof Error&&e.message.match(/cannot read property 'apply'/i))return await rA.ethProviderRequest(t);if(e instanceof re||e instanceof tY)throw e;throw new t9({message:e instanceof Error?e.message:void 0})}}});async function rI(){try{if(!(await rA.getCapabilities()).includes("wallet.getEvmProvider"))return;return rS}catch(e){return rS}}function rB(e){let t=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(e)});window.dispatchEvent(t);let r=()=>window.dispatchEvent(t);return window.addEventListener("eip6963:requestProvider",r),()=>window.removeEventListener("eip6963:requestProvider",r)}"undefined"!=typeof document&&(document.addEventListener("eip6963:requestProvider",()=>{rA.eip6963RequestProvider()}),document.addEventListener("FarcasterFrameEthProviderEvent",e=>{if(e instanceof MessageEvent){let t=e.data;rk.emit(t.event,...t.params)}}),document.addEventListener("FarcasterFrameEvent",e=>{if(e instanceof MessageEvent){let t=e.data;"eip6963:announceProvider"===t.event&&rB({info:t.info,provider:rS})}})),window.addEventListener("eip6963:requestProvider",()=>{rA.eip6963RequestProvider()}),window.addEventListener("message",e=>{if(e instanceof MessageEvent&&"frameEthProviderEvent"===e.data.type){let t=e.data;rk.emit(t.event,...t.params)}}),window.addEventListener("message",e=>{if(e instanceof MessageEvent&&"frameEvent"===e.data.type){let t=e.data.event;"eip6963:announceProvider"===t.event&&rB({info:t.info,provider:rS})}});let{solanaProviderRequest:rR}=rA;async function rP(){let e;try{e=await rA.getCapabilities()}catch(e){}if(null==e?void 0:e.includes("wallet.getSolanaProvider"))return i}rR&&(i={request:td=async e=>{if("connect"===e.method||"signMessage"===e.method)return await rR(e);if("signAndSendTransaction"===e.method){let{transaction:t,options:r}=e.params,n={transaction:tK(t)};return await rR({method:"signAndSendTransaction",params:n})}if("signTransaction"===e.method){let{transaction:t}=e.params,r={transaction:tK(t)},{signedTransaction:n}=await rR({method:"signTransaction",params:r});return{signedTransaction:function(e){let t=Uint8Array.from(tW.from(e,"base64"));return(128&t[0])!=0?tH.GS.deserialize(t):tH.YW.from(t)}(n)}}},signMessage:e=>td({method:"signMessage",params:{message:e}}),signTransaction:e=>td({method:"signTransaction",params:{transaction:e}}),signAndSendTransaction:e=>td({method:"signAndSendTransaction",params:e})});let rT=function(){let e=new tG.v;return{get eventNames(){return e.eventNames.bind(e)},get listenerCount(){return e.listenerCount.bind(e)},get listeners(){return e.listeners.bind(e)},addListener:e.addListener.bind(e),emit:e.emit.bind(e),off:e.off.bind(e),on:e.on.bind(e),once:e.once.bind(e),removeAllListeners:e.removeAllListeners.bind(e),removeListener:e.removeListener.bind(e)}}(),rC=null;async function rj(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;if(!0===rC)return!0;if(!window.ReactNativeWebView&&window===window.parent)return!1;let t=await Promise.race([rA.context.then(e=>!!e),new Promise(t=>{setTimeout(()=>t(!1),e)})]).catch(()=>!1);return t&&(rC=!0),t}let rU=async()=>{let e=await rA.addFrame();if(e.result)return e.result;if("invalid_domain_manifest"===e.error.type)throw new s;if("rejected_by_user"===e.error.type)throw new a;throw Error("Unreachable")},rN={...rT,getCapabilities:rA.getCapabilities,isInMiniApp:rj,context:rA.context,actions:{setPrimaryButton:rA.setPrimaryButton.bind(rA),ready:rA.ready.bind(rA),close:rA.close.bind(rA),viewProfile:rA.viewProfile.bind(rA),signIn:async e=>{let t=await rA.signIn(e);if(t.result)return t.result;if("rejected_by_user"===t.error.type)throw new u;throw Error("Unreachable")},openUrl:e=>{let t="string"==typeof e?e:e.url;return rA.openUrl(t.trim())},addFrame:rU,addMiniApp:rU,composeCast(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return rA.composeCast(e)},viewToken:rA.viewToken.bind(rA),sendToken:rA.sendToken.bind(rA),swapToken:rA.swapToken.bind(rA)},experimental:{getSolanaProvider:rP},wallet:{ethProvider:rS,getEvmProvider:rI}};"undefined"!=typeof document&&document.addEventListener("FarcasterFrameEvent",e=>{if(e instanceof MessageEvent){let t=e.data;"primary_button_clicked"===t.event?rT.emit("primaryButtonClicked"):"frame_added"===t.event?rT.emit("frameAdded",{notificationDetails:t.notificationDetails}):"frame_add_rejected"===t.event?rT.emit("frameAddRejected",{reason:t.reason}):"frame_removed"===t.event?rT.emit("frameRemoved"):"notifications_enabled"===t.event?rT.emit("notificationsEnabled",{notificationDetails:t.notificationDetails}):"notifications_disabled"===t.event&&rT.emit("notificationsDisabled")}}),window.addEventListener("message",e=>{if(e instanceof MessageEvent&&"frameEvent"===e.data.type){let t=e.data.event;"primary_button_clicked"===t.event?rT.emit("primaryButtonClicked"):"frame_added"===t.event?rT.emit("frameAdded",{notificationDetails:t.notificationDetails}):"frame_add_rejected"===t.event?rT.emit("frameAddRejected",{reason:t.reason}):"frame_removed"===t.event?rT.emit("frameRemoved"):"notifications_enabled"===t.event?rT.emit("notificationsEnabled",{notificationDetails:t.notificationDetails}):"notifications_disabled"===t.event&&rT.emit("notificationsDisabled")}})},2109:function(e,t,r){"use strict";t._O=t.Jq=t.KB=t.u8=t.cv=void 0,t.Ik=t.A9=t.n_=t.gM=void 0;let n=r(3663);function i(e){if(!(e instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function o(e){return i(e),n.Buffer.from(e.buffer,e.byteOffset,e.length)}class s{makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}constructor(e,t){if(!Number.isInteger(e))throw TypeError("span must be an integer");this.span=e,this.property=t}}function a(e,t){return t.property?e+"["+t.property+"]":e}class u extends s{isCount(){throw Error("ExternalLayout is abstract")}}class l extends u{isCount(){return this.layout instanceof h||this.layout instanceof c}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.decode(e,t+this.offset)}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.layout.encode(e,t,r+this.offset)}constructor(e,t=0,r){if(!(e instanceof s))throw TypeError("layout must be a Layout");if(!Number.isInteger(t))throw TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}}class h extends s{decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(e).readUIntLE(t,this.span)}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(t).writeUIntLE(e,r,this.span),this.span}constructor(e,t){if(super(e,t),61&&void 0!==arguments[1]?arguments[1]:0;return o(e).readUIntBE(t,this.span)}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(t).writeUIntBE(e,r,this.span),this.span}constructor(e,t){if(super(e,t),61&&void 0!==arguments[1]?arguments[1]:0,r=o(e),n=r.readUInt32LE(t);return f(r.readUInt32LE(t+4),n)}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=d(e),i=o(t);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}constructor(e){super(8,e)}}class m extends s{decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=o(e),n=r.readUInt32LE(t);return f(r.readInt32LE(t+4),n)}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=d(e),i=o(t);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}constructor(e){super(8,e)}}class g extends s{getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof u&&(n=n.decode(e,t)),01&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0,i=this.count;for(i instanceof u&&(i=i.decode(e,t));n2&&void 0!==arguments[2]?arguments[2]:0,n=this.elementLayout,i=e.reduce((e,i)=>e+n.encode(i,t,r+e),0);return this.count instanceof u&&this.count.encode(e.length,t,r),i}constructor(e,t,r){if(!(e instanceof s))throw TypeError("elementLayout must be a Layout");if(!(t instanceof u&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;t instanceof u||!(01&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{let i=n.getSpan(e,t);return t+=i,r+i},0)}catch(e){throw RangeError("indeterminate span")}return r}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(e);let r=this.makeDestinationObject();for(let n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=r,i=0,o=0;for(let n of this.fields){let s=n.span;if(o=0s&&(s=n.getSpan(t,r)))}i=r,r+=s}return i+o-n}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0r.span?t=-1:0<=t&&(t+=r.span)}}constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((e,t)=>e&&t instanceof s,!0)))throw TypeError("fields must be array of Layout instances");for(let n of("boolean"==typeof t&&void 0===r&&(r=t,t=void 0),e))if(0>n.span&&void 0===n.property)throw Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}}class b{decode(e,t){throw Error("UnionDiscriminator is abstract")}encode(e,t,r){throw Error("UnionDiscriminator is abstract")}constructor(e){this.property=e}}class w extends b{decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}constructor(e,t){if(!(e instanceof u&&e.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}}class _ extends s{getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw Error("unable to infer src variant")}decode(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator,i=n.decode(e,r),o=this.registry[i];if(void 0===o){let o=this.defaultLayout,s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),(t=this.makeDestinationObject())[n.property]=i,t[o.property]=o.decode(e,r+s)}else t=o.decode(e,r);return t}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.getSourceVariant(e);if(void 0===n){let n=this.discriminator,i=this.defaultLayout,o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(e[n.property],t,r),o+i.encode(e[i.property],t,r+o)}return n.encode(e,t,r)}addVariant(e,t,r){let n=new x(this,e,t,r);return this.registry[e]=n,n}getVariant(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=e instanceof Uint8Array?this.discriminator.decode(e,r):e,this.registry[t]}constructor(e,t,r){let n;if(e instanceof h||e instanceof c)n=new w(new l(e));else if(e instanceof u&&e.isCount())n=new w(e);else if(e instanceof b)n=e;else throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof s))throw TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&0<=(i=t.span)&&(e instanceof h||e instanceof c)&&(i+=n.layout.span),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=e instanceof h||e instanceof c,this.defaultLayout=t,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return o(e)},this.configGetSourceVariant=function(e){o=e.bind(this)}}}class x extends s{getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(e,t+r)),r+n}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let i=n;if(this.layout&&(this.layout.encode(e[this.property],t,r+n),i+=this.layout.getSpan(t,r+n),0<=this.union.span&&i>this.union.span))throw Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}constructor(e,t,r,n){if(!(e instanceof _))throw TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof s))throw TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=r.span&&r.span>e.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof n)throw TypeError("variant must have a String property")}let i=e.span;0>e.span&&0<=(i=r?r.span:0)&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span),super(i,n),this.union=e,this.variant=t,this.layout=r||null}}function E(e){return 0>e&&(e+=4294967296),e}class M extends s{decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.makeDestinationObject(),n=this.word.decode(e,t);for(let t of(this._packedSetValue(n),this.fields))void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.word.decode(t,r);for(let t of(this._packedSetValue(n),this.fields))if(void 0!==t.property){let r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new A(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new k(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}constructor(e,t,r){if(!(e instanceof h||e instanceof c))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==E(e&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=E(e<=t)throw TypeError("bits must be positive integer");let n=8*e.span,i=e.fields.reduce((e,t)=>e+t.bits,0);if(t+i>n)throw Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=e,this.bits=t,this.valueMask=(1<r&&(r=this.length.decode(e,t)),r}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.span;return 0>r&&(r=this.length.decode(e,t)),o(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof u&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw RangeError("encoding overruns Uint8Array");let i=o(e);return o(t).write(i.toString("hex"),r,n,"hex"),this.length instanceof u&&this.length.encode(n,t,r),n}constructor(e,t){if(!(e instanceof u&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof u||(r=e),super(r,t),this.length=e}}t.cv=(e,t,r)=>new l(e,t,r),t.u8=e=>new h(1,e),t.KB=e=>new h(2,e),t.Jq=e=>new h(4,e),t._O=e=>new p(e),t.gM=e=>new m(e),t.n_=(e,t,r)=>new y(e,t,r),t.A9=(e,t,r)=>new g(e,t,r),t.Ik=(e,t)=>new O(e,t)},4762:function(e,t,r){"use strict";var n=r(7226).Buffer;e.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(s);r255)return;var d=t[c];if(255===d)return;for(var f=0,p=s-1;(0!==d||f>>0,h[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw Error("Non-zero carry");o=f,r++}for(var m=s-o;m!==s&&0===h[m];)m++;var g=n.allocUnsafe(i+(s-m));g.fill(0,0,i);for(var y=i;m!==s;)g[y++]=h[m++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,s=t.length;o!==s&&0===t[o];)o++,r++;for(var l=(s-o)*h+1>>>0,c=new Uint8Array(l);o!==s;){for(var d=t[o],f=0,p=l-1;(0!==d||f>>0,c[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw Error("Non-zero carry");i=f,o++}for(var m=l-i;m!==l&&0===c[m];)m++;for(var g=u.repeat(r);m0?s-4:s;for(r=0;r>16&255,l[h++]=t>>8&255,l[h++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[h++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[h++]=t>>8&255,l[h++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,s,s+16383>a?a:s+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},4108:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{c=void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function u(e,t,r,i){for(var o=0,s=0,a=Math.min(e.length,r),u=t;u=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s0?e:t},o.min=function(e,t){return 0>e.cmp(t)?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;s-=3)o=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[i]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===r)for(s=0,i=0;s>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var n,i=0;i=t;i-=2)n=a(e,t,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,l=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?""}var c,d=["","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"],f=[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],p=[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];function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var l=1;l>>26,c=67108863&u,d=Math.min(l,t.length-1),f=Math.max(0,l-e.length+1);f<=d;f++){var p=l-f|0;h+=(s=(i=0|e.words[p])*(o=0|t.words[f])+c)/67108864|0,c=67108863&s}r.words[l]=0|c,u=0|h}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}o.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var r,i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],h=p[e];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var m=c.modrn(h).toString(e);r=(c=c.idivn(h)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},c&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=e.allocUnsafe?e.allocUnsafe(o):new e(o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var t,r,n,i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,n=this.iadd(e);return e.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(t=this,r=e):(t=e,r=this);for(var o=0,s=0;s>26,this.words[s]=67108863&n;for(;0!==o&&s>26,this.words[s]=67108863&n;if(0===o&&s>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,b=g>>>13,w=0|s[3],_=8191&w,x=w>>>13,E=0|s[4],M=8191&E,A=E>>>13,k=0|s[5],O=8191&k,S=k>>>13,I=0|s[6],B=8191&I,R=I>>>13,P=0|s[7],T=8191&P,C=P>>>13,j=0|s[8],U=8191&j,N=j>>>13,L=0|s[9],Z=8191&L,F=L>>>13,z=0|a[0],q=8191&z,D=z>>>13,V=0|a[1],H=8191&V,W=V>>>13,K=0|a[2],G=8191&K,Q=K>>>13,$=0|a[3],Y=8191&$,J=$>>>13,X=0|a[4],ee=8191&X,et=X>>>13,er=0|a[5],en=8191&er,ei=er>>>13,eo=0|a[6],es=8191&eo,ea=eo>>>13,eu=0|a[7],el=8191&eu,eh=eu>>>13,ec=0|a[8],ed=8191&ec,ef=ec>>>13,ep=0|a[9],em=8191&ep,eg=ep>>>13;r.negative=e.negative^t.negative,r.length=19;var ey=(l+(n=Math.imul(c,q))|0)+((8191&(i=(i=Math.imul(c,D))+Math.imul(d,q)|0))<<13)|0;l=((o=Math.imul(d,D))+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,D))+Math.imul(m,q)|0,o=Math.imul(m,D);var ev=(l+(n=n+Math.imul(c,H)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,H)|0))<<13)|0;l=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,D))+Math.imul(b,q)|0,o=Math.imul(b,D),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,W)|0;var eb=(l+(n=n+Math.imul(c,G)|0)|0)+((8191&(i=(i=i+Math.imul(c,Q)|0)+Math.imul(d,G)|0))<<13)|0;l=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,D))+Math.imul(x,q)|0,o=Math.imul(x,D),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,Q)|0;var ew=(l+(n=n+Math.imul(c,Y)|0)|0)+((8191&(i=(i=i+Math.imul(c,J)|0)+Math.imul(d,Y)|0))<<13)|0;l=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,D))+Math.imul(A,q)|0,o=Math.imul(A,D),n=n+Math.imul(_,H)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Q)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var e_=(l+(n=n+Math.imul(c,ee)|0)|0)+((8191&(i=(i=i+Math.imul(c,et)|0)+Math.imul(d,ee)|0))<<13)|0;l=((o=o+Math.imul(d,et)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,n=Math.imul(O,q),i=(i=Math.imul(O,D))+Math.imul(S,q)|0,o=Math.imul(S,D),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,Q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,Q)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,ee)|0,i=(i=i+Math.imul(p,et)|0)+Math.imul(m,ee)|0,o=o+Math.imul(m,et)|0;var ex=(l+(n=n+Math.imul(c,en)|0)|0)+((8191&(i=(i=i+Math.imul(c,ei)|0)+Math.imul(d,en)|0))<<13)|0;l=((o=o+Math.imul(d,ei)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,D))+Math.imul(R,q)|0,o=Math.imul(R,D),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,W)|0,n=n+Math.imul(M,G)|0,i=(i=i+Math.imul(M,Q)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Q)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(y,ee)|0,i=(i=i+Math.imul(y,et)|0)+Math.imul(b,ee)|0,o=o+Math.imul(b,et)|0,n=n+Math.imul(p,en)|0,i=(i=i+Math.imul(p,ei)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,ei)|0;var eE=(l+(n=n+Math.imul(c,es)|0)|0)+((8191&(i=(i=i+Math.imul(c,ea)|0)+Math.imul(d,es)|0))<<13)|0;l=((o=o+Math.imul(d,ea)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,D))+Math.imul(C,q)|0,o=Math.imul(C,D),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,W)|0,n=n+Math.imul(O,G)|0,i=(i=i+Math.imul(O,Q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,Q)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(_,ee)|0,i=(i=i+Math.imul(_,et)|0)+Math.imul(x,ee)|0,o=o+Math.imul(x,et)|0,n=n+Math.imul(y,en)|0,i=(i=i+Math.imul(y,ei)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,ei)|0,n=n+Math.imul(p,es)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,es)|0,o=o+Math.imul(m,ea)|0;var eM=(l+(n=n+Math.imul(c,el)|0)|0)+((8191&(i=(i=i+Math.imul(c,eh)|0)+Math.imul(d,el)|0))<<13)|0;l=((o=o+Math.imul(d,eh)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,D))+Math.imul(N,q)|0,o=Math.imul(N,D),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,Q)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Q)|0,n=n+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(M,ee)|0,i=(i=i+Math.imul(M,et)|0)+Math.imul(A,ee)|0,o=o+Math.imul(A,et)|0,n=n+Math.imul(_,en)|0,i=(i=i+Math.imul(_,ei)|0)+Math.imul(x,en)|0,o=o+Math.imul(x,ei)|0,n=n+Math.imul(y,es)|0,i=(i=i+Math.imul(y,ea)|0)+Math.imul(b,es)|0,o=o+Math.imul(b,ea)|0,n=n+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eh)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eh)|0;var eA=(l+(n=n+Math.imul(c,ed)|0)|0)+((8191&(i=(i=i+Math.imul(c,ef)|0)+Math.imul(d,ed)|0))<<13)|0;l=((o=o+Math.imul(d,ef)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,n=Math.imul(Z,q),i=(i=Math.imul(Z,D))+Math.imul(F,q)|0,o=Math.imul(F,D),n=n+Math.imul(U,H)|0,i=(i=i+Math.imul(U,W)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,W)|0,n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,Q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(O,ee)|0,i=(i=i+Math.imul(O,et)|0)+Math.imul(S,ee)|0,o=o+Math.imul(S,et)|0,n=n+Math.imul(M,en)|0,i=(i=i+Math.imul(M,ei)|0)+Math.imul(A,en)|0,o=o+Math.imul(A,ei)|0,n=n+Math.imul(_,es)|0,i=(i=i+Math.imul(_,ea)|0)+Math.imul(x,es)|0,o=o+Math.imul(x,ea)|0,n=n+Math.imul(y,el)|0,i=(i=i+Math.imul(y,eh)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eh)|0,n=n+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(l+(n=n+Math.imul(c,em)|0)|0)+((8191&(i=(i=i+Math.imul(c,eg)|0)+Math.imul(d,em)|0))<<13)|0;l=((o=o+Math.imul(d,eg)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,n=Math.imul(Z,H),i=(i=Math.imul(Z,W))+Math.imul(F,H)|0,o=Math.imul(F,W),n=n+Math.imul(U,G)|0,i=(i=i+Math.imul(U,Q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Q)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,n=n+Math.imul(B,ee)|0,i=(i=i+Math.imul(B,et)|0)+Math.imul(R,ee)|0,o=o+Math.imul(R,et)|0,n=n+Math.imul(O,en)|0,i=(i=i+Math.imul(O,ei)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,ei)|0,n=n+Math.imul(M,es)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(A,es)|0,o=o+Math.imul(A,ea)|0,n=n+Math.imul(_,el)|0,i=(i=i+Math.imul(_,eh)|0)+Math.imul(x,el)|0,o=o+Math.imul(x,eh)|0,n=n+Math.imul(y,ed)|0,i=(i=i+Math.imul(y,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eO=(l+(n=n+Math.imul(p,em)|0)|0)+((8191&(i=(i=i+Math.imul(p,eg)|0)+Math.imul(m,em)|0))<<13)|0;l=((o=o+Math.imul(m,eg)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,n=Math.imul(Z,G),i=(i=Math.imul(Z,Q))+Math.imul(F,G)|0,o=Math.imul(F,Q),n=n+Math.imul(U,Y)|0,i=(i=i+Math.imul(U,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(T,ee)|0,i=(i=i+Math.imul(T,et)|0)+Math.imul(C,ee)|0,o=o+Math.imul(C,et)|0,n=n+Math.imul(B,en)|0,i=(i=i+Math.imul(B,ei)|0)+Math.imul(R,en)|0,o=o+Math.imul(R,ei)|0,n=n+Math.imul(O,es)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(S,es)|0,o=o+Math.imul(S,ea)|0,n=n+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eh)|0)+Math.imul(A,el)|0,o=o+Math.imul(A,eh)|0,n=n+Math.imul(_,ed)|0,i=(i=i+Math.imul(_,ef)|0)+Math.imul(x,ed)|0,o=o+Math.imul(x,ef)|0;var eS=(l+(n=n+Math.imul(y,em)|0)|0)+((8191&(i=(i=i+Math.imul(y,eg)|0)+Math.imul(b,em)|0))<<13)|0;l=((o=o+Math.imul(b,eg)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,n=Math.imul(Z,Y),i=(i=Math.imul(Z,J))+Math.imul(F,Y)|0,o=Math.imul(F,J),n=n+Math.imul(U,ee)|0,i=(i=i+Math.imul(U,et)|0)+Math.imul(N,ee)|0,o=o+Math.imul(N,et)|0,n=n+Math.imul(T,en)|0,i=(i=i+Math.imul(T,ei)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,ei)|0,n=n+Math.imul(B,es)|0,i=(i=i+Math.imul(B,ea)|0)+Math.imul(R,es)|0,o=o+Math.imul(R,ea)|0,n=n+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eh)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eh)|0,n=n+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(A,ed)|0,o=o+Math.imul(A,ef)|0;var eI=(l+(n=n+Math.imul(_,em)|0)|0)+((8191&(i=(i=i+Math.imul(_,eg)|0)+Math.imul(x,em)|0))<<13)|0;l=((o=o+Math.imul(x,eg)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,n=Math.imul(Z,ee),i=(i=Math.imul(Z,et))+Math.imul(F,ee)|0,o=Math.imul(F,et),n=n+Math.imul(U,en)|0,i=(i=i+Math.imul(U,ei)|0)+Math.imul(N,en)|0,o=o+Math.imul(N,ei)|0,n=n+Math.imul(T,es)|0,i=(i=i+Math.imul(T,ea)|0)+Math.imul(C,es)|0,o=o+Math.imul(C,ea)|0,n=n+Math.imul(B,el)|0,i=(i=i+Math.imul(B,eh)|0)+Math.imul(R,el)|0,o=o+Math.imul(R,eh)|0,n=n+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var eB=(l+(n=n+Math.imul(M,em)|0)|0)+((8191&(i=(i=i+Math.imul(M,eg)|0)+Math.imul(A,em)|0))<<13)|0;l=((o=o+Math.imul(A,eg)|0)+(i>>>13)|0)+(eB>>>26)|0,eB&=67108863,n=Math.imul(Z,en),i=(i=Math.imul(Z,ei))+Math.imul(F,en)|0,o=Math.imul(F,ei),n=n+Math.imul(U,es)|0,i=(i=i+Math.imul(U,ea)|0)+Math.imul(N,es)|0,o=o+Math.imul(N,ea)|0,n=n+Math.imul(T,el)|0,i=(i=i+Math.imul(T,eh)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eh)|0,n=n+Math.imul(B,ed)|0,i=(i=i+Math.imul(B,ef)|0)+Math.imul(R,ed)|0,o=o+Math.imul(R,ef)|0;var eR=(l+(n=n+Math.imul(O,em)|0)|0)+((8191&(i=(i=i+Math.imul(O,eg)|0)+Math.imul(S,em)|0))<<13)|0;l=((o=o+Math.imul(S,eg)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,n=Math.imul(Z,es),i=(i=Math.imul(Z,ea))+Math.imul(F,es)|0,o=Math.imul(F,ea),n=n+Math.imul(U,el)|0,i=(i=i+Math.imul(U,eh)|0)+Math.imul(N,el)|0,o=o+Math.imul(N,eh)|0,n=n+Math.imul(T,ed)|0,i=(i=i+Math.imul(T,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eP=(l+(n=n+Math.imul(B,em)|0)|0)+((8191&(i=(i=i+Math.imul(B,eg)|0)+Math.imul(R,em)|0))<<13)|0;l=((o=o+Math.imul(R,eg)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863,n=Math.imul(Z,el),i=(i=Math.imul(Z,eh))+Math.imul(F,el)|0,o=Math.imul(F,eh),n=n+Math.imul(U,ed)|0,i=(i=i+Math.imul(U,ef)|0)+Math.imul(N,ed)|0,o=o+Math.imul(N,ef)|0;var eT=(l+(n=n+Math.imul(T,em)|0)|0)+((8191&(i=(i=i+Math.imul(T,eg)|0)+Math.imul(C,em)|0))<<13)|0;l=((o=o+Math.imul(C,eg)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,n=Math.imul(Z,ed),i=(i=Math.imul(Z,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eC=(l+(n=n+Math.imul(U,em)|0)|0)+((8191&(i=(i=i+Math.imul(U,eg)|0)+Math.imul(N,em)|0))<<13)|0;l=((o=o+Math.imul(N,eg)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863;var ej=(l+(n=Math.imul(Z,em))|0)+((8191&(i=(i=Math.imul(Z,eg))+Math.imul(F,em)|0))<<13)|0;return l=((o=Math.imul(F,eg))+(i>>>13)|0)+(ej>>>26)|0,ej&=67108863,u[0]=ey,u[1]=ev,u[2]=eb,u[3]=ew,u[4]=e_,u[5]=ex,u[6]=eE,u[7]=eM,u[8]=eA,u[9]=ek,u[10]=eO,u[11]=eS,u[12]=eI,u[13]=eB,u[14]=eR,u[15]=eP,u[16]=eT,u[17]=eC,u[18]=ej,0!==l&&(u[19]=l,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):n<63?m(this,e,t):y(this,e,t)},b.prototype.makeRBT=function(e){for(var t=Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,r+=(o/67108864|0)+(s>>>26),this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var h=0|this.words[u];this.words[u]=l<<26-o|h>>>o,l=h&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r,n=this.length-e.length,i=this.clone(),s=e,a=0|s.words[s.length-1];0!=(n=26-this._countBits(a))&&(s=s.ushln(n),i.iushln(n),a=0|s.words[s.length-1]);var u=i.length-s.length;if("mod"!==t){(r=new o(null)).length=u+1,r.words=Array(r.length);for(var l=0;l=0;c--){var d=(0|i.words[s.length+c])*67108864+(0|i.words[s.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(s,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,c),i.isZero()||(i.negative^=1);r&&(r.words[c]=d)}return r&&r._strip(),i._strip(),"div"!==t&&0!==n&&i.iushrn(n),{div:r||null,mod:i}},o.prototype.divmod=function(e,t,r){var i,s,a;return(n(!e.isZero()),this.isZero())?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):(this.negative&e.negative)!=0?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||0>this.cmp(e)?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=67108864%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),c=t.clone();!t.isZero();){for(var d=0,f=1;(t.words[0]&f)==0&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;(r.words[0]&m)==0&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(u)):(r.isub(t),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(l)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t,r=this,i=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var s=new o(1),a=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var l=0,h=1;(r.words[0]&h)==0&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,d=1;(i.words[0]&d)==0&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(a)):(i.isub(r),a.isub(s))}return 0>(t=0===r.cmpn(1)?s:a).cmpn(0)&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return(1&this.words[0])==0},o.prototype.isOdd=function(){return(1&this.words[0])==1},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return -1===this.cmpn(e)},o.prototype.lt=function(e){return -1===this.cmp(e)},o.prototype.lten=function(e){return 0>=this.cmpn(e)},o.prototype.lte=function(e){return 0>=this.cmp(e)},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new k(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function x(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var e=new o(null);return e.words=Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(x,_),x.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},x.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){var t;if(w[e])return w[e];if("k256"===e)t=new x;else if("p224"===e)t=new E;else if("p192"===e)t=new M;else if("p25519"===e)t=new A;else throw Error("Unknown prime "+e);return w[e]=t,t},k.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){n((e.negative|t.negative)==0,"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,l).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var l=t.words[n],h=u-1;h>=0;h--){var c=l>>h&1;if(i!==r[0]&&(i=this.sqr(i)),0===c&&0===s){a=0;continue}s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)}u=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,k),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):0>i.cmpn(0)&&(s=i.iadd(this.m)),s._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},4072:function(e,t,r){"use strict";var n=r(3663).Buffer,i=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]},o=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},s=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},a=function(e){return e&&e.__esModule?e:{default:e}};t.XG=t.vB=t.qC=void 0;let u=a(r(4108)),l=(a(r(8430)),function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&i(t,e,r);return o(t,e),t}(r(6908))),h=new("function"!=typeof TextDecoder?l.TextDecoder:TextDecoder)("utf-8",{fatal:!0});class c extends Error{addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}}class d{maybeResize(){this.buf.length<16+this.length&&(this.buf=n.concat([this.buf,n.alloc(1024)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(n.from(new u.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(n.from(new u.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(n.from(new u.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(n.from(new u.default(e).toArray("le",64)))}writeBuffer(e){this.buf=n.concat([n.from(this.buf.subarray(0,this.length)),e,n.alloc(1024)]),this.length+=e.length}writeString(e){this.maybeResize();let t=n.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(n.from(e))}writeArray(e,t){for(let r of(this.maybeResize(),this.writeU32(e.length),e))this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}constructor(){this.buf=n.alloc(1024),this.length=0}}function f(e,t,r){let n=r.value;r.value=function(){for(var e=arguments.length,t=Array(e),r=0;r=0)throw new c("Reached the end of buffer when deserializing");throw e}}}class p{readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new u.default(e,"le")}readU128(){let e=this.readBuffer(16);return new u.default(e,"le")}readU256(){let e=this.readBuffer(32);return new u.default(e,"le")}readU512(){let e=this.readBuffer(64);return new u.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new c("Expected buffer length ".concat(e," isn't within bounds"));let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return h.decode(t)}catch(e){throw new c("Error decoding UTF-8 string: ".concat(e))}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=[];for(let n=0;n{g(e,t,r,n[0],i)})}else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),g(e,t,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,o)=>{g(e,t,o,n.key,i),g(e,t,r,n.value,i)});break;default:throw new c("FieldType ".concat(n," unrecognized"))}else y(e,r,i)}catch(e){throw e instanceof c&&e.addToFieldPath(t),e}}function y(e,t,r){if("function"==typeof t.borshSerialize){t.borshSerialize(r);return}let n=e.get(t.constructor);if(!n)throw new c("Class ".concat(t.constructor.name," is missing in schema"));if("struct"===n.kind)n.fields.map(n=>{let[i,o]=n;g(e,i,t[i],o,r)});else if("enum"===n.kind){let i=t[n.field];for(let o=0;ob(e,t,r[0],n));{let t=[];for(let i=0;i=n.values.length)throw new c("Enum index: ".concat(i," is out of range"));let[o,s]=n.values[i],a=b(e,o,s,r);return new t({[o]:a})}throw new c("Unexpected schema kind: ".concat(n.kind," for ").concat(t.constructor.name))}s([f],p.prototype,"readU8",null),s([f],p.prototype,"readU16",null),s([f],p.prototype,"readU32",null),s([f],p.prototype,"readU64",null),s([f],p.prototype,"readU128",null),s([f],p.prototype,"readU256",null),s([f],p.prototype,"readU512",null),s([f],p.prototype,"readString",null),s([f],p.prototype,"readFixedArray",null),s([f],p.prototype,"readArray",null),t.qC=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,n=new r;return y(e,t,n),n.toArray()},t.vB=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:p,i=new n(r),o=w(e,t,i);if(i.offset3&&void 0!==arguments[3]?arguments[3]:p;return w(e,t,new n(r))}},8430:function(e,t,r){"use strict";var n=r(4762);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},3663:function(e,t,r){"use strict";/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */let n=r(6033),i=r(1531),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!a.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=0|p(e,t),n=s(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(L(e,Uint8Array)){let t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(L(e,ArrayBuffer)||e&&L(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(L(e,SharedArrayBuffer)||e&&L(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);let i=function(e){var t;if(a.isBuffer(e)){let t=0|f(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?s(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),s(e<0?0:0|f(e))}function c(e){let t=e.length<0?0:0|f(e.length),r=s(t);for(let n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||L(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:j(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(o=r=+r)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,a/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:(192&(r=e[i+1]))==128&&(u=(31&t)<<6|63&r)>127&&(o=u);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(u=(15&t)<<12|(63&r)<<6|63&n)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nr)throw RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,o){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function E(e,t,r,n,i){R(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function M(e,t,r,n,i){R(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function A(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,o){return t=+t,r>>>=0,o||A(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,o){return t=+t,r>>>=0,o||A(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,a.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(l(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return h(e)},a.allocUnsafeSlow=function(e){return h(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(L(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),L(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);in.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(a.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(L(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let o=i-n,s=r-t,u=Math.min(o,s),l=this.slice(n,i),h=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let f=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;let s=t.length;for(n>s/2&&(n=s/2),i=0;i>8,i.push(r%256),i.push(n);return i}(e,this.length-h),this,h,c);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||_(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||_(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=F(function(e){P(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&T(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+16777216*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+16777216*r;return BigInt(n)+(BigInt(i)<>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&T(e,this.length-8);let n=16777216*t+65536*this[++e]+256*this[++e]+this[++e],i=16777216*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||_(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return(e>>>=0,t||_(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=F(function(e){P(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&T(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&T(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<>>=0,t||_(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;x(this,e,t,r,n,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;x(this,e,t,r,n,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return E(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);x(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);x(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return E(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function R(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?">= 0".concat(i," and < 2").concat(i," ** ").concat((o+1)*8).concat(i):">= -(2".concat(i," ** ").concat((o+1)*8-1).concat(i,") and < 2 ** ")+"".concat((o+1)*8-1).concat(i):">= ".concat(t).concat(i," and <= ").concat(r).concat(i),new S.ERR_OUT_OF_RANGE("value",n,e)}P(i,"offset"),(void 0===n[i]||void 0===n[i+o])&&T(i,n.length-(o+1))}function P(e,t){if("number"!=typeof e)throw new S.ERR_INVALID_ARG_TYPE(t,"number",e)}function T(e,t,r){if(Math.floor(e)!==e)throw P(e,r),new S.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new S.ERR_BUFFER_OUT_OF_BOUNDS;throw new S.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}I("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),I("ERR_INVALID_ARG_TYPE",function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)},TypeError),I("ERR_OUT_OF_RANGE",function(e,t,r){let n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?i=B(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),n+=" It must be ".concat(t,". Received ").concat(i)},RangeError);let C=/[^+/0-9A-Za-z-_]/g;function j(e,t){let r;t=t||1/0;let n=e.length,i=null,o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319||s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,r,n){let i;for(i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function L(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let Z=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function F(e){return"undefined"==typeof BigInt?z:e}function z(){throw Error("BigInt not supported")}},2614:function(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw TypeError("The listener must be a function");var a=new i(n,o||e,s),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=Array(o);i */t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,d=r?-1:1,f=e[t+c];for(c+=d,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+c],c+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+e[t+c],c+=d,h-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=l}return(f?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,l=8*o-i-1,h=(1<>1,d=23===i?5960464477539062e-23:0,f=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+c>=1?t+=d/u:t+=d*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;e[r+f]=255&s,f+=p,s/=256,l-=8);e[r+f-p]|=128*m}},4967:function(e,t,r){"use strict";let n=r(7932).v4,i=r(1856),o=function(e,t){if(!(this instanceof o))return new o(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return n()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};e.exports=o,o.prototype.request=function(e,t,r,n){let o;let s=this,a=null,u=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&u)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!u&&e&&"object"==typeof e&&"function"==typeof t;if(u||l)n=t,a=e;else{"function"==typeof r&&(n=r,r=void 0);let o="function"==typeof n;try{a=i(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(o)return n(e);throw e}if(!o)return a}try{o=JSON.stringify(a,this.options.replacer)}catch(e){return n(e)}return this.callServer(o,function(e,t){s._parseResponse(e,t,n)}),a},o.prototype._parseResponse=function(e,t,r){let n;if(e){r(e);return}if(!t)return r();try{n=JSON.parse(t,this.options.reviver)}catch(e){return r(e)}if(3===r.length){if(!Array.isArray(n))return r(null,n.error,n.result);{let e=function(e){return void 0!==e.error};return r(null,n.filter(e),n.filter(function(t){return!e(t)}))}}r(null,n)}},1856:function(e,t,r){"use strict";let n=r(7932).v4;e.exports=function(e,t,r,i){if("string"!=typeof e)throw TypeError(e+" must be a string");let o="number"==typeof(i=i||{}).version?i.version:2;if(1!==o&&2!==o)throw TypeError(o+" must be 1 or 2");let s={method:e};if(2===o&&(s.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw TypeError(t+" must be an object, array or omitted");s.params=t}if(void 0===r){let e="function"==typeof i.generator?i.generator:function(){return n()};s.id=e(s,i)}else 2===o&&null===r?i.notificationIdNull&&(s.id=null):s.id=r;return s}},7226:function(e,t,r){"use strict";/*! safe-buffer. MIT License. Feross Aboukhadijeh */var n=r(3663),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},6908:function(e,t){"use strict";function r(e,t,r){return t<=e&&e<=r}function n(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function i(e){this.tokens=[].slice.call(e)}function o(e,t){if(e)throw TypeError("Decoder error");return t||65533}i.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.push(e.shift());else this.tokens.push(e)}};var s="utf-8";function a(e,t){if(!(this instanceof a))return new a(e,t);if((e=void 0!==e?String(e).toLowerCase():s)!==s)throw Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function u(e,t){if(!(this instanceof u))return new u(e,t);if((e=void 0!==e?String(e).toLowerCase():s)!==s)throw Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(e){var t=e.fatal,n=0,i=0,s=0,a=128,u=191;this.handler=function(e,l){if(-1===l&&0!==s)return s=0,o(t);if(-1===l)return -1;if(0===s){if(r(l,0,127))return l;if(r(l,194,223))s=1,n=l-192;else if(r(l,224,239))224===l&&(a=160),237===l&&(u=159),s=2,n=l-224;else{if(!r(l,240,244))return o(t);240===l&&(a=144),244===l&&(u=143),s=3,n=l-240}return n<<=6*s,null}if(!r(l,a,u))return n=s=i=0,a=128,u=191,e.prepend(l),o(t);if(a=128,u=191,i+=1,n+=l-128<<6*(s-i),i!==s)return null;var h=n;return n=s=i=0,h}}function h(e){e.fatal,this.handler=function(e,t){if(-1===t)return -1;if(r(t,0,127))return t;r(t,128,2047)?(n=1,i=192):r(t,2048,65535)?(n=2,i=224):r(t,65536,1114111)&&(n=3,i=240);for(var n,i,o=[(t>>6*n)+i];n>0;){var s=t>>6*(n-1);o.push(128|63&s),n-=1}return o}}a.prototype={decode:function(e,t){r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=n(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var r,o,s=new i(r),a=[];!s.endOfStream()&&-1!==(o=this._decoder.handler(s,s.read()));)null!==o&&(Array.isArray(o)?a.push.apply(a,o):a.push(o));if(!this._streaming){do{if(-1===(o=this._decoder.handler(s,s.read())))break;if(null===o)continue;Array.isArray(o)?a.push.apply(a,o):a.push(o)}while(!s.endOfStream());this._decoder=null}return!a.length||-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===a[0]?(this._BOMseen=!0,a.shift()):this._BOMseen=!0),function(e){for(var t="",r=0;r>10)+55296,(1023&n)+56320))}return t}(a)}},u.prototype={encode:function(e,t){e=e?String(e):"",t=n(t),this._streaming||(this._encoder=new h(this._options)),this._streaming=!!t.stream;for(var r,o=[],s=new i(function(e){for(var t=String(e),r=t.length,n=0,i=[];n57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319){if(n===r-1)i.push(65533);else{var s=e.charCodeAt(n+1);if(56320<=s&&s<=57343){var a=1023&o,u=1023&s;i.push(65536+(a<<10)+u),n+=1}else i.push(65533)}}n+=1}return i}(e));!s.endOfStream()&&-1!==(r=this._encoder.handler(s,s.read()));)Array.isArray(r)?o.push.apply(o,r):o.push(r);if(!this._streaming){for(;-1!==(r=this._encoder.handler(s,s.read()));)Array.isArray(r)?o.push.apply(o,r):o.push(r);this._encoder=null}return new Uint8Array(o)}},t.TextEncoder=u,t.TextDecoder=a},7932:function(e,t,r){"use strict";r.d(t,{v4:function(){return l}});for(var n,i=new Uint8Array(16),o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=[],a=0;a<256;++a)s.push((a+256).toString(16).substr(1));var u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase();if(!("string"==typeof r&&o.test(r)))throw TypeError("Stringified UUID is invalid");return r},l=function(e,t,r){var o=(e=e||{}).random||(e.rng||function(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)})();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(var s=0;s<16;++s)t[r+s]=o[s];return t}return u(o)}},2875:function(e,t,r){"use strict";r.d(t,{D1:function(){return m},Kd:function(){return g},Mx:function(){return p}});var n=r(2401),i=r(7642);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let o=BigInt(0),s=BigInt(1);function a(e,t){let r=t.negate();return e?r:t}function u(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function l(e,t){u(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),o=2**e;return{windows:r,windowSize:n,mask:(0,i.dQ)(e),maxNumber:o,shiftBy:BigInt(e)}}function h(e,t,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:a}=r,u=Number(e&i),l=e>>a;u>n&&(u-=o,l+=s);let h=t*n,c=h+Math.abs(u)-1;return{nextN:l,offset:c,isZero:0===u,isNeg:u<0,isNegF:t%2!=0,offsetF:h}}let c=new WeakMap,d=new WeakMap;function f(e){return d.get(e)||1}function p(e,t){return{constTimeNegate:a,hasPrecomputes:e=>1!==f(e),unsafeLadder(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.ZERO,i=t;for(;r>o;)r&s&&(n=n.add(i)),i=i.double(),r>>=s;return n},precomputeWindow(e,r){let{windows:n,windowSize:i}=l(r,t),o=[],s=e,a=s;for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:e.ZERO,a=l(r,t);for(let e=0;e{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(n,t);let o=r.length,s=n.length;if(o!==s)throw Error("arrays of points and scalars must have equal length");let a=e.ZERO,u=(0,i.Dd)(BigInt(o)),l=1;u>12?l=u-3:u>4?l=u-2:u>0&&(l=2);let h=(0,i.dQ)(l),c=Array(Number(h)+1).fill(a),d=Math.floor((t.BITS-1)/l)*l,f=a;for(let e=d;e>=0;e-=l){c.fill(a);for(let t=0;t>BigInt(e)&h);c[i]=c[i].add(r[t])}let t=a;for(let e=c.length-1,r=a;e>0;e--)r=r.add(c[e]),t=t.add(r);if(f=f.add(t),0!==e)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(t<=o)throw Error("invalid field: expected ORDER > 0, got "+t);let{nBitLength:b,nByteLength:w}=E(t,r);if(w>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let M=Object.freeze({ORDER:t,isLE:f,BITS:b,BYTES:w,MASK:(0,i.dQ)(b),ZERO:o,ONE:s,create:e=>d(e,t),isValid:e=>{if("bigint"!=typeof e)throw Error("invalid field element: expected bigint, got "+typeof e);return o<=e&&ee===o,isOdd:e=>(e&s)===s,neg:e=>d(-e,t),eql:(e,t)=>e===t,sqr:e=>d(e*e,t),add:(e,r)=>d(e+r,t),sub:(e,r)=>d(e-r,t),mul:(e,r)=>d(e*r,t),pow:(e,t)=>(function(e,t,r){if(ro;)r&s&&(n=e.mul(n,i)),i=e.sqr(i),r>>=s;return n})(M,e,t),div:(e,r)=>d(e*p(r,t),t),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:e=>p(e,t),sqrt:y.sqrt||(r=>(!n&&(n=t%l===u?m:t%c===h?g:function(t){if(t1e3)throw Error("Cannot find square root: probably non-prime P");if(1===n)return m;let l=u.pow(i,r),h=(r+s)/a;return function(e,t){if(e.is0(t))return t;if(1!==x(e,t))throw Error("Cannot find square root");let i=n,o=e.mul(e.ONE,l),a=e.pow(t,r),u=e.pow(t,h);for(;!e.eql(a,e.ONE);){if(e.is0(a))return e.ZERO;let t=1,r=e.sqr(a);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw Error("Cannot find square root");let n=s<f?(0,i.S5)(e,w):(0,i.tL)(e,w),fromBytes:e=>{if(e.length!==w)throw Error("Field.fromBytes: expected "+w+" bytes, got "+e.length);return f?(0,i.ty)(e):(0,i.Hv)(e)},invertBatch:e=>_(M,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(M)}},kK:function(){return E},oA:function(){return f},wQ:function(){return d}});var n=r(1176),i=r(7642);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let o=BigInt(0),s=BigInt(1),a=BigInt(2),u=BigInt(3),l=BigInt(4),h=BigInt(5),c=BigInt(8);function d(e,t){let r=e%t;return r>=o?r:t+r}function f(e,t,r){let n=e;for(;t-- >o;)n*=n,n%=r;return n}function p(e,t){if(e===o)throw Error("invert: expected non-zero number");if(t<=o)throw Error("invert: expected positive modulus, got "+t);let r=d(e,t),n=t,i=o,a=s,u=s,l=o;for(;r!==o;){let e=n/r,t=n%r,o=i-u*e,s=a-l*e;n=r,r=t,i=u,a=l,u=o,l=s}if(n!==s)throw Error("invert: does not exist");return d(i,t)}function m(e,t){let r=(e.ORDER+s)/l,n=e.pow(t,r);if(!e.eql(e.sqr(n),t))throw Error("Cannot find square root");return n}function g(e,t){let r=(e.ORDER-h)/c,n=e.mul(t,a),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,a),i),u=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(u),t))throw Error("Cannot find square root");return u}let y=(e,t)=>(d(e,t)&s)===s,b=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function w(e){let t=b.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,i.FF)(e,t)}function _(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),o=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),o),n}function x(e,t){let r=(e.ORDER-s)/a,n=e.pow(t,r),i=e.eql(n,e.ONE),o=e.eql(n,e.ZERO),u=e.eql(n,e.neg(e.ONE));if(!i&&!o&&!u)throw Error("invalid Legendre symbol result");return i?1:o?0:-1}function E(e,t){void 0!==t&&(0,n.k8)(t);let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function M(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function A(e){let t=M(e);return t+Math.ceil(t/2)}function k(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.length,o=M(t),a=A(t);if(n<16||n1024)throw Error("expected "+a+"-1024 bytes of input, got "+n);let u=d(r?(0,i.ty)(e):(0,i.Hv)(e),t-s)+s;return r?(0,i.S5)(u,o):(0,i.tL)(u,o)}},7642:function(e,t,r){"use strict";r.d(t,{Dd:function(){return k},FF:function(){return P},Fy:function(){return A},H9:function(){return T},Hv:function(){return g},S5:function(){return w},Z2:function(){return M},_t:function(){return o},ci:function(){return d},dQ:function(){return O},eV:function(){return x},n$:function(){return B},nr:function(){return m},ql:function(){return _},tL:function(){return b},ty:function(){return y},uw:function(){return a},uz:function(){return u}});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let n=BigInt(0),i=BigInt(1);function o(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function s(e){if(!o(e))throw Error("Uint8Array expected")}function a(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}function u(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function l(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?n:BigInt("0x"+e)}let h="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,c=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function d(e){if(s(e),h)return e.toHex();let t="";for(let r=0;r=f._0&&e<=f._9?e-f._0:e>=f.A&&e<=f.F?e-(f.A-10):e>=f.a&&e<=f.f?e-(f.a-10):void 0}function m(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(h)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t"bigint"==typeof e&&n<=e;function M(e,t,r){return E(e)&&E(t)&&E(r)&&t<=e&&en;e>>=i,t+=1);return t}let O=e=>(i<new Uint8Array(e),I=e=>Uint8Array.from(e);function B(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=S(e),i=S(e),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=function(){for(var e=arguments.length,t=Array(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:S(0);i=a(I([0]),e),n=a(),0!==e.length&&(i=a(I([1]),e),n=a())},l=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e{let r;for(s(),u(e);!(r=t(l()));)u();return s(),r}}let R={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||o(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function P(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=(t,r,n)=>{let i=R[r];if("function"!=typeof i)throw Error("invalid validator function");let o=e[t];if((!n||void 0!==o)&&!i(o,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+o)};for(let[e,r]of Object.entries(t))n(e,r,!1);for(let[e,t]of Object.entries(r))n(e,t,!0);return e}function T(e){let t=new WeakMap;return function(r){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:u}}}),x=t.adjustScalarBytes||(e=>e),E=t.domain||((e,t,r)=>{if((0,a.uw)("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function M(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=r?l:u;(0,a.Fy)("coordinate "+e,t,n,y)}function A(e){if(!(e instanceof S))throw Error("ExtendedPoint expected")}let k=(0,a.H9)((e,t)=>{let{ex:n,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?c:r.inv(o));let a=b(n*t),h=b(i*t),d=b(o*t);if(s)return{x:u,y:l};if(d!==l)throw Error("invZ was invalid");return{x:a,y:h}}),O=(0,a.H9)(e=>{let{a:r,d:n}=t;if(e.is0())throw Error("bad point: ZERO");let{ex:i,ey:o,ez:s,et:a}=e,u=b(i*i),l=b(o*o),h=b(s*s),c=b(h*h),d=b(u*r);if(b(h*b(d+l))!==b(c+b(n*b(u*l))))throw Error("bad point: equation left != right (1)");if(b(i*o)!==b(s*a))throw Error("bad point: equation left != right (2)");return!0});class S{get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof S)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return M("x",t),M("y",r),new S(t,r,l,b(t*r))}static normalizeZ(e){let t=(0,s.Eg)(r,e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(S.fromAffine)}static msm(e,t){return(0,o.D1)(S,w,e,t)}_setWindowSize(e){R.setWindowSize(this,e)}assertValidity(){O(this)}equals(e){A(e);let{ex:t,ey:r,ez:n}=this,{ex:i,ey:o,ez:s}=e,a=b(t*s),u=b(i*n),l=b(r*s),h=b(o*n);return a===u&&l===h}is0(){return this.equals(S.ZERO)}negate(){return new S(b(-this.ex),this.ey,this.ez,b(-this.et))}double(){let{a:e}=t,{ex:r,ey:n,ez:i}=this,o=b(r*r),s=b(n*n),a=b(h*b(i*i)),u=b(e*o),l=r+n,c=b(b(l*l)-o-s),d=u+s,f=d-a,p=u-s,m=b(c*f),g=b(d*p),y=b(c*p);return new S(m,g,b(f*d),y)}add(e){A(e);let{a:r,d:n}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:l,ez:h,et:c}=e,d=b(i*u),f=b(o*l),p=b(a*n*c),m=b(s*h),g=b((i+o)*(u+l)-d-f),y=m-p,w=m+p,_=b(f-r*d),x=b(g*y),E=b(w*_),M=b(g*_);return new S(x,E,b(y*w),M)}subtract(e){return this.add(e.negate())}wNAF(e){return R.wNAFCached(this,e,S.normalizeZ)}multiply(e){(0,a.Fy)("scalar",e,l,n);let{p:t,f:r}=this.wNAF(e);return S.normalizeZ([t,r])[0]}multiplyUnsafe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S.ZERO;return((0,a.Fy)("scalar",e,u,n),e===u)?B:this.is0()||e===l?this:R.wNAFCachedUnsafe(this,e,S.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(g).is0()}isTorsionFree(){return R.unsafeLadder(this,n).is0()}toAffine(e){return k(this,e)}clearCofactor(){let{h:e}=t;return e===l?this:this.multiplyUnsafe(e)}static fromHex(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{d:i,a:o}=t,s=r.BYTES;e=(0,a.ql)("pointHex",e,s),(0,a.uw)("zip215",n);let h=e.slice(),c=e[s-1];h[s-1]=-129&c;let d=(0,a.ty)(h),f=n?y:r.ORDER;(0,a.Fy)("pointHex.y",d,u,f);let p=b(d*d),{isValid:m,value:g}=_(b(p-l),b(i*p-o));if(!m)throw Error("Point.fromHex: invalid y coordinate");let w=(g&l)===l,x=(128&c)!=0;if(!n&&g===u&&x)throw Error("Point.fromHex: x=0 and x_0=1");return x!==w&&(g=b(-g)),S.fromAffine({x:g,y:d})}static fromPrivateKey(e){let{scalar:t}=T(e);return I.multiply(t)}toRawBytes(){let{x:e,y:t}=this.toAffine(),n=(0,a.S5)(t,r.BYTES);return n[n.length-1]|=e&l?128:0,n}toHex(){return(0,a.ci)(this.toRawBytes())}constructor(e,t,r,n){M("x",e),M("y",t),M("z",r,!0),M("t",n),this.ex=e,this.ey=t,this.ez=r,this.et=n,Object.freeze(this)}}S.BASE=new S(t.Gx,t.Gy,l,b(t.Gx*t.Gy)),S.ZERO=new S(u,l,l,u);let{BASE:I,ZERO:B}=S,R=(0,o.Mx)(S,8*m);function P(e){var t;return t=(0,a.ty)(e),(0,s.wQ)(t,n)}function T(e){let t=r.BYTES;e=(0,a.ql)("private key",e,t);let n=(0,a.ql)("hashed private key",f(e),2*t),i=x(n.slice(0,t)),o=n.slice(t,2*t),s=P(i);return{head:i,prefix:o,scalar:s}}function C(e){let{head:t,prefix:r,scalar:n}=T(e),i=I.multiply(n),o=i.toRawBytes();return{head:t,prefix:r,scalar:n,point:i,pointBytes:o}}function j(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Uint8Array.of();for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n2&&void 0!==arguments[2]?arguments[2]:{};e=(0,a.ql)("message",e),i&&(e=i(e));let{prefix:h,scalar:c,pointBytes:d}=C(t),f=j(l.context,h,e),p=I.multiply(f).toRawBytes(),m=(o=f+j(l.context,p,d,e)*c,(0,s.wQ)(o,n));(0,a.Fy)("signature.s",m,u,n);let g=(0,a.eV)(p,(0,a.S5)(m,r.BYTES));return(0,a.ql)("result",g,2*r.BYTES)},verify:function(e,t,n){let o,s,u,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d,{context:h,zip215:c}=l,f=r.BYTES;e=(0,a.ql)("signature",e,2*f),t=(0,a.ql)("message",t),n=(0,a.ql)("publicKey",n,f),void 0!==c&&(0,a.uw)("zip215",c),i&&(t=i(t));let p=(0,a.ty)(e.slice(f,2*f));try{o=S.fromHex(n,c),s=S.fromHex(e.slice(0,f),c),u=I.multiplyUnsafe(p)}catch(e){return!1}if(!c&&o.isSmallOrder())return!1;let m=j(h,s.toRawBytes(),o.toRawBytes(),t);return s.add(o.multiplyUnsafe(m)).subtract(u).clearCofactor().equals(S.ZERO)},ExtendedPoint:S,utils:{getExtendedPublicKey:C,randomPrivateKey:()=>p(r.BYTES),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}}}}({a:x.create(BigInt(-1)),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:x,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:w,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:n.o,randomBytes:i.O6,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:_});function M(e){if(!(e instanceof S))throw Error("RistrettoPoint expected")}let A=e=>_(g,e),k=e=>E.CURVE.Fp.create(null&bytesToNumberLE(e));function O(e){let{d:t}=E.CURVE,r=E.CURVE.Fp.ORDER,n=E.CURVE.Fp.create,i=n(null*e*e),o=n((i+g)*null),s=BigInt(-1),a=n((s-t*i)*n(i+t)),{isValid:u,value:l}=_(o,a),h=n(l*e);isNegativeLE(h,r)||(h=n(-h)),u||(l=h),u||(s=i);let c=n(s*(i-g)*null-a),d=l*l,f=n((l+l)*a),p=n(null*c),m=n(g-d),y=n(g+d);return new E.ExtendedPoint(n(f*y),n(m*p),n(p*y),n(f*m))}class S{static fromAffine(e){return new S(E.ExtendedPoint.fromAffine(e))}static hashToCurve(e){let t=O(k((e=ensureBytes("ristrettoHash",e,64)).slice(0,32))),r=O(k(e.slice(32,64)));return new S(t.add(r))}static fromHex(e){e=ensureBytes("ristrettoHex",e,32);let{a:t,d:r}=E.CURVE,n=E.CURVE.Fp.ORDER,i=E.CURVE.Fp.create,o="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",s=k(e);if(!equalBytes(numberToBytesLE(s,32),e)||isNegativeLE(s,n))throw Error(o);let a=i(s*s),u=i(g+t*a),l=i(g-t*a),h=i(u*u),c=i(l*l),d=i(t*r*h-c),{isValid:f,value:p}=A(i(d*c)),y=i(p*l),b=i(p*y*d),w=i((s+s)*y);isNegativeLE(w,n)&&(w=i(-w));let _=i(u*b),x=i(w*_);if(!f||isNegativeLE(x,n)||_===m)throw Error(o);return new S(new E.ExtendedPoint(w,_,g,x))}static msm(e,t){let r=Field(E.CURVE.n,E.CURVE.nBitLength);return pippenger(S,r,e,t)}toRawBytes(){let e,{ex:t,ey:r,ez:n,et:i}=this.ep,o=E.CURVE.Fp.ORDER,s=E.CURVE.Fp.create,a=s(s(n+r)*s(n-r)),u=s(t*r),l=s(u*u),{value:h}=A(s(a*l)),c=s(h*a),d=s(h*u),f=s(c*d*i);if(isNegativeLE(i*f,o)){let n=s(null*r),i=s(null*t);t=n,r=i,e=s(null*c)}else e=d;isNegativeLE(t*f,o)&&(r=s(-r));let p=s((n-r)*e);return isNegativeLE(p,o)&&(p=s(-p)),numberToBytesLE(p,32)}toHex(){return bytesToHex(this.toRawBytes())}toString(){return this.toHex()}equals(e){M(e);let{ex:t,ey:r}=this.ep,{ex:n,ey:i}=e.ep,o=E.CURVE.Fp.create,s=o(t*i)===o(r*n),a=o(r*i)===o(t*n);return s||a}add(e){return M(e),new S(this.ep.add(e.ep))}subtract(e){return M(e),new S(this.ep.subtract(e.ep))}multiply(e){return new S(this.ep.multiply(e))}multiplyUnsafe(e){return new S(this.ep.multiplyUnsafe(e))}double(){return new S(this.ep.double())}negate(){return new S(this.ep.negate())}constructor(e){this.ep=e}}},8923:function(e,t,r){"use strict";r.d(t,{kA:function(){return k}});var n=r(471),i=r(1176);class o extends i.kb{update(e){return(0,i.$h)(this),this.iHash.update(e),this}digestInto(e){(0,i.$h)(this),(0,i.gk)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,i.z3)(e);let r=(0,i.O0)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?e.create().update(r).digest():r);for(let e=0;enew o(e,t).update(r).digest();s.create=(e,t)=>new o(e,t);var a=r(2875),u=r(2401),l=r(7642);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function h(e){void 0!==e.lowS&&(0,l.uw)("lowS",e.lowS),void 0!==e.prehash&&(0,l.uw)("prehash",e.prehash)}class c extends Error{constructor(e=""){super(e)}}let d={Err:c,_tlv:{encode:(e,t)=>{let{Err:r}=d;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=(0,l.uz)(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?(0,l.uz)(i.length/2|128):"";return(0,l.uz)(e)+o+i+t},decode(e,t){let{Err:r}=d,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],o=0;if(128&i){let e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let s=t.subarray(n,n+e);if(s.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of s)o=o<<8|e;if(n+=e,o<128)throw new r("tlv.decode(long): not minimal encoding")}else o=i;let s=t.subarray(n,n+o);if(s.length!==o)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(n+o)}}},_int:{encode(e){let{Err:t}=d;if(e(e+t/E)/t,A=(0,u.gN)(b,void 0,void 0,{sqrt:function(e){let t=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),l=e*e*e%b,h=l*l*e%b,c=(0,u.oA)(h,t,b)*h%b,d=(0,u.oA)(c,t,b)*h%b,f=(0,u.oA)(d,E,b)*l%b,p=(0,u.oA)(f,n,b)*f%b,m=(0,u.oA)(p,i,b)*p%b,g=(0,u.oA)(m,s,b)*m%b,y=(0,u.oA)(g,a,b)*g%b,w=(0,u.oA)(y,s,b)*m%b,_=(0,u.oA)(w,t,b)*h%b,x=(0,u.oA)(_,o,b)*p%b,M=(0,u.oA)(x,r,b)*l%b,k=(0,u.oA)(M,E,b);if(!A.eql(A.sqr(k),e))throw Error("Cannot find square root");return k}}),k=function(e,t){let r=t=>(function(e){let t=function(e){let t=(0,a.Kd)(e);return(0,l.FF)(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n,nByteLength:i,nBitLength:o}=t,s=r.BYTES+1,c=2*r.BYTES+1;function b(e){return(0,u.wQ)(e,n)}function w(e){return(0,u.U_)(e,n)}let{ProjectivePoint:_,normPrivateKeyToScalar:x,weierstrassEquation:E,isWithinCurveOrder:M}=function(e){let t=function(e){let t=(0,a.Kd)(e);(0,l.FF)(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw Error("invalid endo: CURVE.a must be 0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}(e),{Fp:r}=t,n=(0,u.gN)(t.n,t.nBitLength),i=t.toBytes||((e,t,n)=>{let i=t.toAffine();return(0,l.eV)(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),o=t.fromBytes||(e=>{let t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function s(e){let{a:n,b:i}=t,o=r.sqr(e),s=r.mul(o,e);return r.add(r.add(s,r.mul(e,n)),i)}function h(e,t){let n=r.sqr(t),i=s(e);return r.eql(n,i)}if(!h(t.Gx,t.Gy))throw Error("bad curve params: generator point");let c=r.mul(r.pow(t.a,g),y),d=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(c,d)))throw Error("bad curve params: a or b");function f(e){let r;let{allowedPrivateKeyLengths:n,nByteLength:i,wrapPrivateKey:o,n:s}=t;if(n&&"bigint"!=typeof e){if((0,l._t)(e)&&(e=(0,l.ci)(e)),"string"!=typeof e||!n.includes(e.length))throw Error("invalid private key");e=e.padStart(2*i,"0")}try{r="bigint"==typeof e?e:(0,l.Hv)((0,l.ql)("private key",e,i))}catch(t){throw Error("invalid private key, expected hex or "+i+" bytes, got "+typeof e)}return o&&(r=(0,u.wQ)(r,s)),(0,l.Fy)("private key",r,m,s),r}function b(e){if(!(e instanceof x))throw Error("ProjectivePoint expected")}let w=(0,l.H9)((e,t)=>{let{px:n,py:i,pz:o}=e;if(r.eql(o,r.ONE))return{x:n,y:i};let s=e.is0();null==t&&(t=s?r.ONE:r.inv(o));let a=r.mul(n,t),u=r.mul(i,t),l=r.mul(o,t);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw Error("invZ was invalid");return{x:a,y:u}}),_=(0,l.H9)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.py))return;throw Error("bad point: ZERO")}let{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw Error("bad point: x or y not FE");if(!h(n,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class x{static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw Error("invalid affine point");if(e instanceof x)throw Error("projective point not allowed");let i=e=>r.eql(e,r.ZERO);return i(t)&&i(n)?x.ZERO:new x(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=(0,u.Eg)(r,e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(x.fromAffine)}static fromHex(e){let t=x.fromAffine(o((0,l.ql)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return x.BASE.multiply(f(e))}static msm(e,t){return(0,a.D1)(x,n,e,t)}_setWindowSize(e){A.setWindowSize(this,e)}assertValidity(){_(this)}hasEvenY(){let{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){b(e);let{px:t,py:n,pz:i}=this,{px:o,py:s,pz:a}=e,u=r.eql(r.mul(t,a),r.mul(o,i)),l=r.eql(r.mul(n,a),r.mul(s,i));return u&&l}negate(){return new x(this.px,r.neg(this.py),this.pz)}double(){let{a:e,b:n}=t,i=r.mul(n,g),{px:o,py:s,pz:a}=this,u=r.ZERO,l=r.ZERO,h=r.ZERO,c=r.mul(o,o),d=r.mul(s,s),f=r.mul(a,a),p=r.mul(o,s);return p=r.add(p,p),h=r.mul(o,a),h=r.add(h,h),u=r.mul(e,h),l=r.mul(i,f),l=r.add(u,l),u=r.sub(d,l),l=r.add(d,l),l=r.mul(u,l),u=r.mul(p,u),h=r.mul(i,h),f=r.mul(e,f),p=r.sub(c,f),p=r.mul(e,p),p=r.add(p,h),h=r.add(c,c),c=r.add(h,c),c=r.add(c,f),c=r.mul(c,p),l=r.add(l,c),f=r.mul(s,a),f=r.add(f,f),c=r.mul(f,p),u=r.sub(u,c),h=r.mul(f,d),h=r.add(h,h),new x(u,l,h=r.add(h,h))}add(e){b(e);let{px:n,py:i,pz:o}=this,{px:s,py:a,pz:u}=e,l=r.ZERO,h=r.ZERO,c=r.ZERO,d=t.a,f=r.mul(t.b,g),p=r.mul(n,s),m=r.mul(i,a),y=r.mul(o,u),w=r.add(n,i),_=r.add(s,a);w=r.mul(w,_),_=r.add(p,m),w=r.sub(w,_),_=r.add(n,o);let E=r.add(s,u);return _=r.mul(_,E),E=r.add(p,y),_=r.sub(_,E),E=r.add(i,o),l=r.add(a,u),E=r.mul(E,l),l=r.add(m,y),E=r.sub(E,l),c=r.mul(d,_),l=r.mul(f,y),c=r.add(l,c),l=r.sub(m,c),c=r.add(m,c),h=r.mul(l,c),m=r.add(p,p),m=r.add(m,p),y=r.mul(d,y),_=r.mul(f,_),m=r.add(m,y),y=r.sub(p,y),y=r.mul(d,y),_=r.add(_,y),p=r.mul(m,_),h=r.add(h,p),p=r.mul(E,_),l=r.mul(w,l),l=r.sub(l,p),p=r.mul(w,m),c=r.mul(E,c),new x(l,h,c=r.add(c,p))}subtract(e){return this.add(e.negate())}is0(){return this.equals(x.ZERO)}wNAF(e){return A.wNAFCached(this,e,x.normalizeZ)}multiplyUnsafe(e){let{endo:n,n:i}=t;(0,l.Fy)("scalar",e,p,i);let o=x.ZERO;if(e===p)return o;if(this.is0()||e===m)return this;if(!n||A.hasPrecomputes(this))return A.wNAFCachedUnsafe(this,e,x.normalizeZ);let{k1neg:s,k1:a,k2neg:u,k2:h}=n.splitScalar(e),c=o,d=o,f=this;for(;a>p||h>p;)a&m&&(c=c.add(f)),h&m&&(d=d.add(f)),f=f.double(),a>>=m,h>>=m;return s&&(c=c.negate()),u&&(d=d.negate()),d=new x(r.mul(d.px,n.beta),d.py,d.pz),c.add(d)}multiply(e){let n,i;let{endo:o,n:s}=t;if((0,l.Fy)("scalar",e,m,s),o){let{k1neg:t,k1:s,k2neg:a,k2:u}=o.splitScalar(e),{p:l,f:h}=this.wNAF(s),{p:c,f:d}=this.wNAF(u);l=A.constTimeNegate(t,l),c=A.constTimeNegate(a,c),c=new x(r.mul(c.px,o.beta),c.py,c.pz),n=l.add(c),i=h.add(d)}else{let{p:t,f:r}=this.wNAF(e);n=t,i=r}return x.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){let n=x.BASE,i=(e,t)=>t!==p&&t!==m&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){return w(this,e)}isTorsionFree(){let{h:e,isTorsionFree:r}=t;if(e===m)return!0;if(r)return r(x,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:r}=t;return e===m?this:r?r(x,this):this.multiplyUnsafe(t.h)}toRawBytes(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return(0,l.uw)("isCompressed",e),this.assertValidity(),i(x,this,e)}toHex(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return(0,l.uw)("isCompressed",e),(0,l.ci)(this.toRawBytes(e))}constructor(e,t,n){if(null==e||!r.isValid(e))throw Error("x required");if(null==t||!r.isValid(t)||r.is0(t))throw Error("y required");if(null==n||!r.isValid(n))throw Error("z required");this.px=e,this.py=t,this.pz=n,Object.freeze(this)}}x.BASE=new x(t.Gx,t.Gy,r.ONE),x.ZERO=new x(r.ZERO,r.ONE,r.ZERO);let{endo:E,nBitLength:M}=t,A=(0,a.Mx)(x,E?Math.ceil(M/2):M);return{CURVE:t,ProjectivePoint:x,normPrivateKeyToScalar:f,weierstrassEquation:s,isWithinCurveOrder:function(e){return(0,l.Z2)(e,m,t.n)}}}({...t,toBytes(e,t,n){let i=t.toAffine(),o=r.toBytes(i.x),s=l.eV;return((0,l.uw)("isCompressed",n),n)?s(Uint8Array.from([t.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){let t=e.length,n=e[0],i=e.subarray(1);if(t===s&&(2===n||3===n)){let e;let t=(0,l.Hv)(i);if(!(0,l.Z2)(t,m,r.ORDER))throw Error("Point is not on curve");let o=E(t);try{e=r.sqrt(o)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&n)==1!=((e&m)===m)&&(e=r.neg(e)),{x:t,y:e}}if(t===c&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+s+", or uncompressed "+c+", got "+t)}}),A=(e,t,r)=>(0,l.Hv)(e.slice(t,r));class k{static fromCompact(e){return new k(A(e=(0,l.ql)("compactSignature",e,2*i),0,i),A(e,i,2*i))}static fromDER(e){let{r:t,s:r}=d.toSig((0,l.ql)("DER",e));return new k(t,r)}assertValidity(){}addRecoveryBit(e){return new k(this.r,this.s,e)}recoverPublicKey(e){let{r:n,s:i,recovery:o}=this,s=I((0,l.ql)("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw Error("recovery id invalid");let a=2===o||3===o?n+t.n:n;if(a>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let u=(1&o)==0?"02":"03",h=_.fromHex(u+f(a,r.BYTES)),c=w(a),d=b(-s*c),p=b(i*c),m=_.BASE.multiplyAndAddUnsafe(h,d,p);if(!m)throw Error("point at infinify");return m.assertValidity(),m}hasHighS(){return this.s>n>>m}normalizeS(){return this.hasHighS()?new k(this.r,b(-this.s),this.recovery):this}toDERRawBytes(){return(0,l.nr)(this.toDERHex())}toDERHex(){return d.hexFromSig(this)}toCompactRawBytes(){return(0,l.nr)(this.toCompactHex())}toCompactHex(){return f(this.r,i)+f(this.s,i)}constructor(e,t,r){(0,l.Fy)("r",e,m,n),(0,l.Fy)("s",t,m,n),this.r=e,this.s=t,null!=r&&(this.recovery=r),Object.freeze(this)}}function O(e){if("bigint"==typeof e)return!1;if(e instanceof _)return!0;let n=(0,l.ql)("key",e).length,o=r.BYTES,s=o+1;if(!t.allowedPrivateKeyLengths&&i!==s)return n===s||n===2*o+1}let S=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=(0,l.Hv)(e),r=8*e.length-o;return r>0?t>>BigInt(r):t},I=t.bits2int_modN||function(e){return b(S(e))},B=(0,l.dQ)(o);function R(e){return(0,l.Fy)("num < 2^"+o,e,p,B),(0,l.tL)(e,i)}let P={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};return _.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return _.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!0===O(e))throw Error("first arg must be private key");if(!1===O(t))throw Error("second arg must be public key");return _.fromHex(t).multiply(x(e)).toRawBytes(r)},sign:function(e,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P,{seed:s,k2sig:a}=function(e,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P;if(["recovered","canonical"].some(e=>e in o))throw Error("sign() legacy options not supported");let{hash:s,randomBytes:a}=t,{lowS:u,prehash:c,extraEntropy:d}=o;null==u&&(u=!0),e=(0,l.ql)("msgHash",e),h(o),c&&(e=(0,l.ql)("prehashed msgHash",s(e)));let f=I(e),g=x(i),y=[R(g),R(f)];if(null!=d&&!1!==d){let e=!0===d?a(r.BYTES):d;y.push((0,l.ql)("extraEntropy",e))}return{seed:(0,l.eV)(...y),k2sig:function(e){let t=S(e);if(!M(t))return;let r=w(t),i=_.BASE.multiply(t).toAffine(),o=b(i.x);if(o===p)return;let s=b(r*b(f+o*g));if(s===p)return;let a=(i.x===o?0:2)|Number(i.y&m),l=s;if(u&&s>n>>m)l=s>n>>m?b(-s):s,a^=1;return new k(o,l,a)}}}(e,i,o);return(0,l.n$)(t.hash.outputLen,t.nByteLength,t.hmac)(s,a)},verify:function(e,r,n){var i;let o;let s,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:T;r=(0,l.ql)("msgHash",r),n=(0,l.ql)("publicKey",n);let{lowS:u,prehash:c,format:f}=a;if(h(a),"strict"in a)throw Error("options.strict was renamed to lowS");if(void 0!==f&&"compact"!==f&&"der"!==f)throw Error("format must be compact or der");let p="string"==typeof e||(0,l._t)(e),m=!p&&!f&&"object"==typeof e&&null!==e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!p&&!m)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(m&&(o=new k(e.r,e.s)),p){try{"compact"!==f&&(o=k.fromDER(e))}catch(e){if(!(e instanceof d.Err))throw e}o||"der"===f||(o=k.fromCompact(e))}s=_.fromHex(n)}catch(e){return!1}if(!o||u&&o.hasHighS())return!1;c&&(r=t.hash(r));let{r:g,s:y}=o,x=I(r),E=w(y),M=b(x*E),A=b(g*E),O=null===(i=_.BASE.multiplyAndAddUnsafe(s,M,A))||void 0===i?void 0:i.toAffine();return!!O&&b(O.x)===g},ProjectivePoint:_,Signature:k,utils:{isValidPrivateKey(e){try{return x(e),!0}catch(e){return!1}},normPrivateKeyToScalar:x,randomPrivateKey:()=>{let e=(0,u.PS)(t.n);return(0,u.Us)(t.randomBytes(e),t.n)},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}}}})({...e,hash:t,hmac:function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o{let t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-x*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),o=M(t*e,w),s=M(-r*e,w),a=(0,u.wQ)(e-o*t-s*n,w),l=(0,u.wQ)(-o*r-s*t,w),h=a>i,c=l>i;if(h&&(a=w-a),c&&(l=w-l),a>i||l>i)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:a,k2neg:c,k2:l}}}},n.JQ)},4248:function(e,t,r){"use strict";r.d(t,{$p:function(){return c},EP:function(){return d},FL:function(){return h},Fn:function(){return b},IH:function(){return g},Iq:function(){return a},NI:function(){return s},Ou:function(){return l},SD:function(){return p},Vl:function(){return o},Xb:function(){return w},ac:function(){return y},gm:function(){return f},m_:function(){return u},mk:function(){return m},pp:function(){return E},u8:function(){return _},zP:function(){return x}});let n=BigInt(4294967296-1),i=BigInt(32);function o(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.length,o=new Uint32Array(r),s=new Uint32Array(r);for(let a=0;a1&&void 0!==arguments[1]&&arguments[1];return t?{h:Number(e&n),l:Number(e>>i&n)}:{h:0|Number(e>>i&n),l:0|Number(e&n)}}(e[a],t);[o[a],s[a]]=[r,u]}return[o,s]}let s=(e,t,r)=>e>>>r,a=(e,t,r)=>e<<32-r|t>>>r,u=(e,t,r)=>e>>>r|t<<32-r,l=(e,t,r)=>e<<32-r|t>>>r,h=(e,t,r)=>e<<64-r|t>>>r-32,c=(e,t,r)=>e>>>r-32|t<<64-r,d=(e,t,r)=>e<>>32-r,f=(e,t,r)=>t<>>32-r,p=(e,t,r)=>t<>>64-r,m=(e,t,r)=>e<>>64-r;function g(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}}let y=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),b=(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,w=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),_=(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,x=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),E=(e,t,r,n,i,o)=>t+r+n+i+o+(e/4294967296|0)|0},471:function(e,t,r){"use strict";r.d(t,{JQ:function(){return y},o:function(){return b}});var n=r(1176);class i extends n.kb{update(e){(0,n.$h)(this),e=(0,n.O0)(e),(0,n.gk)(e);let{view:t,buffer:r,blockLen:i}=this,o=e.length;for(let s=0;si-s&&(this.process(r,0),s=0);for(let e=s;e>i&o),a=Number(r&o),u=n?4:0,l=n?0:4;e.setUint32(t+u,s,n),e.setUint32(t+l,a,n)}(r,i-8,BigInt(8*this.length),o),this.process(r,0);let a=(0,n.GL)(e),u=this.outputLen;if(u%4)throw Error("_sha2: outputLen should be aligned to 32bit");let l=u/4,h=this.get();if(l>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e>>3,o=(0,n.np)(r,17)^(0,n.np)(r,19)^r>>>10;l[e]=o+l[e-7]+i+l[e-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:h,G:c,H:d}=this;for(let e=0;e<64;e++){var f,p,m,g;let t=d+((0,n.np)(a,6)^(0,n.np)(a,11)^(0,n.np)(a,25))+((f=a)&h^~f&c)+u[e]+l[e]|0,y=((0,n.np)(r,2)^(0,n.np)(r,13)^(0,n.np)(r,22))+((p=r)&(m=i)^p&(g=o)^m&g)|0;d=c,c=h,h=a,a=s+t|0,s=o,o=i,i=r,r=t+y|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,h=h+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,i,o,s,a,h,c,d)}roundClean(){(0,n.ru)(l)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.ru)(this.buffer)}constructor(e=32){super(64,e,8,!1),this.A=0|o[0],this.B=0|o[1],this.C=0|o[2],this.D=0|o[3],this.E=0|o[4],this.F=0|o[5],this.G=0|o[6],this.H=0|o[7]}}let c=a.Vl(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),d=c[0],f=c[1],p=new Uint32Array(80),m=new Uint32Array(80);class g extends i{get(){let{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:l,Fh:h,Fl:c,Gh:d,Gl:f,Hh:p,Hl:m}=this;return[e,t,r,n,i,o,s,a,u,l,h,c,d,f,p,m]}set(e,t,r,n,i,o,s,a,u,l,h,c,d,f,p,m){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|l,this.Fh=0|h,this.Fl=0|c,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(e,t){for(let r=0;r<16;r++,t+=4)p[r]=e.getUint32(t),m[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|p[e-15],r=0|m[e-15],n=a.m_(t,r,1)^a.m_(t,r,8)^a.NI(t,r,7),i=a.Ou(t,r,1)^a.Ou(t,r,8)^a.Iq(t,r,7),o=0|p[e-2],s=0|m[e-2],u=a.m_(o,s,19)^a.FL(o,s,61)^a.NI(o,s,6),l=a.Ou(o,s,19)^a.$p(o,s,61)^a.Iq(o,s,6),h=a.Xb(i,l,m[e-7],m[e-16]),c=a.u8(h,n,u,p[e-7],p[e-16]);p[e]=0|c,m[e]=0|h}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:u,Dh:l,Dl:h,Eh:c,El:g,Fh:y,Fl:b,Gh:w,Gl:_,Hh:x,Hl:E}=this;for(let e=0;e<80;e++){let t=a.m_(c,g,14)^a.m_(c,g,18)^a.FL(c,g,41),M=a.Ou(c,g,14)^a.Ou(c,g,18)^a.$p(c,g,41),A=c&y^~c&w,k=g&b^~g&_,O=a.zP(E,M,k,f[e],m[e]),S=a.pp(O,x,t,A,d[e],p[e]),I=0|O,B=a.m_(r,n,28)^a.FL(r,n,34)^a.FL(r,n,39),R=a.Ou(r,n,28)^a.$p(r,n,34)^a.$p(r,n,39),P=r&i^r&s^i&s,T=n&o^n&u^o&u;x=0|w,E=0|_,w=0|y,_=0|b,y=0|c,b=0|g,({h:c,l:g}=a.IH(0|l,0|h,0|S,0|I)),l=0|s,h=0|u,s=0|i,u=0|o,i=0|r,o=0|n;let C=a.ac(I,R,T);r=a.Fn(C,S,B,P),n=0|C}({h:r,l:n}=a.IH(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=a.IH(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:u}=a.IH(0|this.Ch,0|this.Cl,0|s,0|u)),({h:l,l:h}=a.IH(0|this.Dh,0|this.Dl,0|l,0|h)),({h:c,l:g}=a.IH(0|this.Eh,0|this.El,0|c,0|g)),({h:y,l:b}=a.IH(0|this.Fh,0|this.Fl,0|y,0|b)),({h:w,l:_}=a.IH(0|this.Gh,0|this.Gl,0|w,0|_)),({h:x,l:E}=a.IH(0|this.Hh,0|this.Hl,0|x,0|E)),this.set(r,n,i,o,s,u,l,h,c,g,y,b,w,_,x,E)}roundClean(){(0,n.ru)(p,m)}destroy(){(0,n.ru)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}constructor(e=64){super(128,e,16,!1),this.Ah=0|s[0],this.Al=0|s[1],this.Bh=0|s[2],this.Bl=0|s[3],this.Ch=0|s[4],this.Cl=0|s[5],this.Dh=0|s[6],this.Dl=0|s[7],this.Eh=0|s[8],this.El=0|s[9],this.Fh=0|s[10],this.Fl=0|s[11],this.Gh=0|s[12],this.Gl=0|s[13],this.Hh=0|s[14],this.Hl=0|s[15]}}let y=(0,n.V1)(()=>new h),b=(0,n.V1)(()=>new g)},3940:function(e,t,r){"use strict";r.d(t,{JQ:function(){return n}});let n=r(471).JQ},9400:function(e,t,r){"use strict";r.d(t,{fr:function(){return _}});var n=r(4248),i=r(1176);let o=BigInt(0),s=BigInt(1),a=BigInt(2),u=BigInt(7),l=BigInt(256),h=BigInt(113),c=[],d=[],f=[];for(let e=0,t=s,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],c.push(2*(5*n+r)),d.push((e+1)*(e+2)/2%64);let i=o;for(let e=0;e<7;e++)(t=(t<>u)*h)%l)&a&&(i^=s<<(s<r>32?(0,n.SD)(e,t,r):(0,n.EP)(e,t,r),b=(e,t,r)=>r>32?(0,n.mk)(e,t,r):(0,n.gm)(e,t,r);class w extends i.kb{clone(){return this._cloneInto()}keccak(){(0,i.Ux)(this.state32),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=y(o,s,1)^r[n],u=b(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=u}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=d[r],o=y(t,i,n),s=b(t,i,n),a=c[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=m[n],e[1]^=g[n]}(0,i.ru)(r)}(this.state32,this.rounds),(0,i.Ux)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.$h)(this),e=(0,i.O0)(e),(0,i.gk)(e);let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i=r&&this.keccak();let o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.eB)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.ru)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new w(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}constructor(e,t,r,n=!1,o=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=o,(0,i.k8)(r),!(0new w(136,1,32))},1176:function(e,t,r){"use strict";r.d(t,{kb:function(){return g},gk:function(){return o},$h:function(){return a},z3:function(){return s},k8:function(){return i},eB:function(){return u},ru:function(){return h},eV:function(){return m},V1:function(){return y},GL:function(){return c},O6:function(){return b},np:function(){return d},Ux:function(){return f},O0:function(){return p},Jq:function(){return l}});let n="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function o(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n0&&!r.includes(e.length))throw Error("Uint8Array expected of length "+r+", got length="+e.length)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.createHasher");i(e.outputLen),i(e.blockLen)}function a(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function u(e,t){o(e);let r=t.outputLen;if(e.length>>t}let f=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]?e=>e:function(e){for(let r=0;r>>8&65280|t>>>24&255}return e};function p(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),o(e),e}function m(){for(var e=arguments.length,t=Array(e),r=0;re().update(p(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function b(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(n&&"function"==typeof n.getRandomValues)return n.getRandomValues(new Uint8Array(e));if(n&&"function"==typeof n.randomBytes)return Uint8Array.from(n.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}},9401:function(e,t,r){"use strict";function n(e){let[t,r]=e;return"".concat(t,"=").concat(function e(t){return Array.isArray(t)?"%5B"+t.map(e).join("%2C%20")+"%5D":"bigint"==typeof t?"".concat(t,"n"):encodeURIComponent(String(null!=t&&null===Object.getPrototypeOf(t)?{...t}:t))}(r))}r.d(t,{GH:function(){return c},bP:function(){return l}});var i,o=class extends Error{constructor(...[e,t]){let r,i;if(t){let{cause:e,...n}=t;e&&(i={cause:e}),Object.keys(n).length>0&&(r=n)}super(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};{let r="Solana error #".concat(e,"; Decode this error by running `npx @solana/errors decode -- ").concat(e);return Object.keys(t).length&&(r+=" '".concat(btoa(Object.entries(t).map(n).join("&")),"'")),"".concat(r,"`")}}(e,r),i),this.cause=this.cause,this.context={__code:e,...r},this.name="SolanaError"}};function s(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}var a=((i=a||{})[i.Little=0]="Little",i[i.Big=1]="Big",i);function u(e){return(null==e?void 0:e.endian)!==1}var l=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.freeze({...t={fixedSize:(e={config:r,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}).size,write(t,r,n){e.range&&function(e,t,r,n){if(nr)throw new o(8078011,{codecDescription:e,max:r,min:t,value:n})}(e.name,e.range[0],e.range[1],t);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,u(e.config)),r.set(new Uint8Array(i),n),n+e.size}},encode:e=>{let r=new Uint8Array("fixedSize"in t?t.fixedSize:t.getSizeFromValue(e));return t.write(e,r,0),r}})},h=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.freeze({...t={fixedSize:(e={config:r,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}).size,read(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.length-r<=0)throw new o(8078e3,{codecDescription:e})}(e.name,t,r),function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=r.length-n;if(i1&&void 0!==arguments[1]?arguments[1]:0;return t.read(e,r)[0]}})},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e,t){if(s(e)!==s(t))throw new o(8078004);if(s(e)&&s(t)&&e.fixedSize!==t.fixedSize)throw new o(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!s(e)&&!s(t)&&e.maxSize!==t.maxSize)throw new o(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}(l(e),h(e))}},1640:function(e,t,r){"use strict";r.d(t,{S:function(){return T}});var n,i,o,s,a,u,l,h,c,d,f,p,m=r(3288),g=r(8146),y=r(5577),b=r(7354);function w(e,t){var r=(0,b.J)(e,t,"update");return function(e,t){if(t.set){if(!t.get)throw TypeError("attempted to read set only private field");return"__destrWrapper"in t||(t.__destrWrapper={set value(v){t.set.call(e,v)},get value(){return t.get.call(e)}}),t.__destrWrapper}if(!t.writable)throw TypeError("attempted to set read only private field");return t}(e,r)}var _=r(6063),x=r(4668),E=r(5139),M=r(4614),A=(n=new WeakMap,class extends M.l{build(e,t,r){var n;let i=t.queryKey,o=null!==(n=t.queryHash)&&void 0!==n?n:(0,_.Rm)(i,t),s=this.get(o);return s||(s=new x.A({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){(0,m._)(this,n).has(e.queryHash)||((0,m._)(this,n).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=(0,m._)(this,n).get(e.queryHash);t&&(e.destroy(),t===e&&(0,m._)(this,n).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){E.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return(0,m._)(this,n).get(e)}getAll(){return[...(0,m._)(this,n).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,_._x)(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,_._x)(e,t)):t}notify(e){E.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){E.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){E.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}constructor(e={}){super(),(0,g._)(this,n,{writable:!0,value:void 0}),this.config=e,(0,y._)(this,n,new Map)}}),k=r(1793),O=(i=new WeakMap,o=new WeakMap,s=new WeakMap,class extends M.l{build(e,t,r){let n=new k.m({mutationCache:this,mutationId:++w(this,s).value,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){(0,m._)(this,i).add(e);let t=S(e);if("string"==typeof t){let r=(0,m._)(this,o).get(t);r?r.push(e):(0,m._)(this,o).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if((0,m._)(this,i).delete(e)){let t=S(e);if("string"==typeof t){let r=(0,m._)(this,o).get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&(0,m._)(this,o).delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=S(e);if("string"!=typeof t)return!0;{let r=(0,m._)(this,o).get(t),n=null==r?void 0:r.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=S(e);if("string"!=typeof t)return Promise.resolve();{var r,n;let i=null===(r=(0,m._)(this,o).get(t))||void 0===r?void 0:r.find(t=>t!==e&&t.state.isPaused);return null!==(n=null==i?void 0:i.continue())&&void 0!==n?n:Promise.resolve()}}clear(){E.Vr.batch(()=>{(0,m._)(this,i).forEach(e=>{this.notify({type:"removed",mutation:e})}),(0,m._)(this,i).clear(),(0,m._)(this,o).clear()})}getAll(){return Array.from((0,m._)(this,i))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,_.X7)(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(t=>(0,_.X7)(e,t))}notify(e){E.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return E.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(_.ZT))))}constructor(e={}){super(),(0,g._)(this,i,{writable:!0,value:void 0}),(0,g._)(this,o,{writable:!0,value:void 0}),(0,g._)(this,s,{writable:!0,value:void 0}),this.config=e,(0,y._)(this,i,new Set),(0,y._)(this,o,new Map),(0,y._)(this,s,0)}});function S(e){var t;return null===(t=e.options.scope)||void 0===t?void 0:t.id}var I=r(9555),B=r(7211);function R(e){return{onFetch:(t,r)=>{var n,i,o,s,a;let u=t.options,l=null===(o=t.fetchOptions)||void 0===o?void 0:null===(i=o.meta)||void 0===i?void 0:null===(n=i.fetchMore)||void 0===n?void 0:n.direction,h=(null===(s=t.state.data)||void 0===s?void 0:s.pages)||[],c=(null===(a=t.state.data)||void 0===a?void 0:a.pageParams)||[],d={pages:[],pageParams:[]},f=0,p=async()=>{let r=!1,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},i=(0,_.cG)(t.options,t.fetchOptions),o=async(e,o,s)=>{if(r)return Promise.reject();if(null==o&&e.pages.length)return Promise.resolve(e);let a={client:t.client,queryKey:t.queryKey,pageParam:o,direction:s?"backward":"forward",meta:t.options.meta};n(a);let u=await i(a),{maxPages:l}=t.options,h=s?_.Ht:_.VX;return{pages:h(e.pages,u,l),pageParams:h(e.pageParams,o,l)}};if(l&&h.length){let e="backward"===l,t={pages:h,pageParams:c},r=(e?function(e,t){var r;let{pages:n,pageParams:i}=t;return n.length>0?null===(r=e.getPreviousPageParam)||void 0===r?void 0:r.call(e,n[0],n,i[0],i):void 0}:P)(u,t);d=await o(t,r,e)}else{let t=null!=e?e:h.length;do{var s;let e=0===f?null!==(s=c[0])&&void 0!==s?s:u.initialPageParam:P(u,d);if(f>0&&null==e)break;d=await o(d,e),f++}while(f{var e,n;return null===(e=(n=t.options).persister)||void 0===e?void 0:e.call(n,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=p}}}function P(e,t){let{pages:r,pageParams:n}=t,i=r.length-1;return r.length>0?e.getNextPageParam(r[i],r,n[i],n):void 0}var T=(a=new WeakMap,u=new WeakMap,l=new WeakMap,h=new WeakMap,c=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,class{mount(){w(this,d).value++,1===(0,m._)(this,d)&&((0,y._)(this,f,I.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),(0,m._)(this,a).onFocus())})),(0,y._)(this,p,B.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),(0,m._)(this,a).onOnline())})))}unmount(){var e,t;w(this,d).value--,0===(0,m._)(this,d)&&(null===(e=(0,m._)(this,f))||void 0===e||e.call(this),(0,y._)(this,f,void 0),null===(t=(0,m._)(this,p))||void 0===t||t.call(this),(0,y._)(this,p,void 0))}isFetching(e){return(0,m._)(this,a).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return(0,m._)(this,u).findAll({...e,status:"pending"}).length}getQueryData(e){var t;let r=this.defaultQueryOptions({queryKey:e});return null===(t=(0,m._)(this,a).get(r.queryHash))||void 0===t?void 0:t.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=(0,m._)(this,a).build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,_.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return(0,m._)(this,a).findAll(e).map(e=>{let{queryKey:t,state:r}=e;return[t,r.data]})}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=(0,m._)(this,a).get(n.queryHash),o=null==i?void 0:i.state.data,s=(0,_.SE)(t,o);if(void 0!==s)return(0,m._)(this,a).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return E.Vr.batch(()=>(0,m._)(this,a).findAll(e).map(e=>{let{queryKey:n}=e;return[n,this.setQueryData(n,t,r)]}))}getQueryState(e){var t;let r=this.defaultQueryOptions({queryKey:e});return null===(t=(0,m._)(this,a).get(r.queryHash))||void 0===t?void 0:t.state}removeQueries(e){let t=(0,m._)(this,a);E.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=(0,m._)(this,a);return E.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={revert:!0,...t};return Promise.all(E.Vr.batch(()=>(0,m._)(this,a).findAll(e).map(e=>e.cancel(r)))).then(_.ZT).catch(_.ZT)}invalidateQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return E.Vr.batch(()=>{var r,n;return((0,m._)(this,a).findAll(e).forEach(e=>{e.invalidate()}),(null==e?void 0:e.refetchType)==="none")?Promise.resolve():this.refetchQueries({...e,type:null!==(n=null!==(r=null==e?void 0:e.refetchType)&&void 0!==r?r:null==e?void 0:e.type)&&void 0!==n?n:"active"},t)})}refetchQueries(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...r,cancelRefetch:null===(t=r.cancelRefetch)||void 0===t||t};return Promise.all(E.Vr.batch(()=>(0,m._)(this,a).findAll(e).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(_.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=(0,m._)(this,a).build(this,t);return r.isStaleByTime((0,_.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_.ZT).catch(_.ZT)}fetchInfiniteQuery(e){return e.behavior=R(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_.ZT).catch(_.ZT)}ensureInfiniteQueryData(e){return e.behavior=R(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return B.N.isOnline()?(0,m._)(this,u).resumePausedMutations():Promise.resolve()}getQueryCache(){return(0,m._)(this,a)}getMutationCache(){return(0,m._)(this,u)}getDefaultOptions(){return(0,m._)(this,l)}setDefaultOptions(e){(0,y._)(this,l,e)}setQueryDefaults(e,t){(0,m._)(this,h).set((0,_.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...(0,m._)(this,h).values()],r={};return t.forEach(t=>{(0,_.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){(0,m._)(this,c).set((0,_.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...(0,m._)(this,c).values()],r={};return t.forEach(t=>{(0,_.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...(0,m._)(this,l).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,_.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===_.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return(null==e?void 0:e._defaulted)?e:{...(0,m._)(this,l).mutations,...(null==e?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){(0,m._)(this,a).clear(),(0,m._)(this,u).clear()}constructor(e={}){(0,g._)(this,a,{writable:!0,value:void 0}),(0,g._)(this,u,{writable:!0,value:void 0}),(0,g._)(this,l,{writable:!0,value:void 0}),(0,g._)(this,h,{writable:!0,value:void 0}),(0,g._)(this,c,{writable:!0,value:void 0}),(0,g._)(this,d,{writable:!0,value:void 0}),(0,g._)(this,f,{writable:!0,value:void 0}),(0,g._)(this,p,{writable:!0,value:void 0}),(0,y._)(this,a,e.queryCache||new A),(0,y._)(this,u,e.mutationCache||new O),(0,y._)(this,l,e.defaultOptions||{}),(0,y._)(this,h,new Map),(0,y._)(this,c,new Map),(0,y._)(this,d,0)}})},6150:function(e,t,r){"use strict";r.d(t,{L:function(){return h}});var n=r(5036),i=r(4473),o=r(1595),s=r(2179),a=r(5578),u=r(2731),l=r(4497);function h(){let e,t,r,f,p=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{shimDisconnect:m=!0,unstable_shimAsyncInject:g}=p;function y(){var e;let t=p.target;if("function"==typeof t){let e=t();if(e)return e}return"object"==typeof t?t:"string"==typeof t?{...null!==(e=c[t])&&void 0!==e?e:{id:t,name:"".concat(t[0].toUpperCase()).concat(t.slice(1)),provider:"is".concat(t[0].toUpperCase()).concat(t.slice(1))}}:{id:"injected",name:"Injected",provider:e=>null==e?void 0:e.ethereum}}return c=>({get icon(){return y().icon},get id(){return y().id},get name(){return y().name},get supportsSimulation(){return!0},type:h.type,async setup(){let t=await this.getProvider();(null==t?void 0:t.on)&&p.target&&(r||(r=this.onConnect.bind(this),t.on("connect",r)),e||(e=this.onAccountsChanged.bind(this),t.on("accountsChanged",e)))},async connect(){var o,s,a,u,h,d,g;let{chainId:y,isReconnecting:b}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},w=await this.getProvider();if(!w)throw new l.M;let _=[];if(b)_=await this.getAccounts().catch(()=>[]);else if(m)try{let e=await w.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});(_=null===(u=e[0])||void 0===u?void 0:null===(a=u.caveats)||void 0===a?void 0:null===(s=a[0])||void 0===s?void 0:null===(o=s.value)||void 0===o?void 0:o.map(e=>(0,n.K)(e))).length>0&&(_=await this.getAccounts())}catch(e){if(e.code===i.ab.code)throw new i.ab(e);if(e.code===i.pT.code)throw e}try{(null==_?void 0:_.length)||b||(_=(await w.request({method:"eth_requestAccounts"})).map(e=>(0,n.K)(e))),r&&(w.removeListener("connect",r),r=void 0),e||(e=this.onAccountsChanged.bind(this),w.on("accountsChanged",e)),t||(t=this.onChainChanged.bind(this),w.on("chainChanged",t)),f||(f=this.onDisconnect.bind(this),w.on("disconnect",f));let o=await this.getChainId();if(y&&o!==y){let e=await this.switchChain({chainId:y}).catch(e=>{if(e.code===i.ab.code)throw e;return{id:o}});o=null!==(g=null==e?void 0:e.id)&&void 0!==g?g:o}return m&&await (null===(h=c.storage)||void 0===h?void 0:h.removeItem("".concat(this.id,".disconnected"))),p.target||await (null===(d=c.storage)||void 0===d?void 0:d.setItem("injected.connected",!0)),{accounts:_,chainId:o}}catch(e){if(e.code===i.ab.code)throw new i.ab(e);if(e.code===i.pT.code)throw new i.pT(e);throw e}},async disconnect(){var e,n;let i=await this.getProvider();if(!i)throw new l.M;t&&(i.removeListener("chainChanged",t),t=void 0),f&&(i.removeListener("disconnect",f),f=void 0),r||(r=this.onConnect.bind(this),i.on("connect",r));try{await (0,o.F)(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch(e){}m&&await (null===(n=c.storage)||void 0===n?void 0:n.setItem("".concat(this.id,".disconnected"),!0)),p.target||await (null===(e=c.storage)||void 0===e?void 0:e.removeItem("injected.connected"))},async getAccounts(){let e=await this.getProvider();if(!e)throw new l.M;return(await e.request({method:"eth_accounts"})).map(e=>(0,n.K)(e))},async getChainId(){let e=await this.getProvider();if(!e)throw new l.M;return Number(await e.request({method:"eth_chainId"}))},async getProvider(){let e;let t=y();return(e="function"==typeof t.provider?t.provider(window):"string"==typeof t.provider?d(window,t.provider):t.provider)&&!e.removeListener&&("off"in e&&"function"==typeof e.off?e.removeListener=e.off:e.removeListener=()=>{}),e},async isAuthorized(){try{var e,t;if(m&&await (null===(e=c.storage)||void 0===e?void 0:e.getItem("".concat(this.id,".disconnected")))||!p.target&&!await (null===(t=c.storage)||void 0===t?void 0:t.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(void 0!==g&&!1!==g){let e=async()=>(window.removeEventListener("ethereum#initialized",e),!!await this.getProvider()),t="number"==typeof g?g:1e3;if(await Promise.race([new Promise(t=>window.addEventListener("ethereum#initialized",()=>t(e()),{once:!0})),new Promise(r=>setTimeout(()=>r(e()),t))]))return!0}throw new l.M}return!!(await (0,s.J)(()=>this.getAccounts())).length}catch(e){return!1}},async switchChain(e){let{addEthereumChainParameter:t,chainId:r}=e,n=await this.getProvider();if(!n)throw new l.M;let o=c.chains.find(e=>e.id===r);if(!o)throw new i.x3(new u.X4);let s=new Promise(e=>{let t=n=>{"chainId"in n&&n.chainId===r&&(c.emitter.off("change",t),e())};c.emitter.on("change",t)});try{return await Promise.all([n.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,a.eC)(r)}]}).then(async()=>{await this.getChainId()===r&&c.emitter.emit("change",{chainId:r})}),s]),o}catch(e){var h,d,f,p,m,g,y,b;if(4902===e.code||(null==e?void 0:null===(d=e.data)||void 0===d?void 0:null===(h=d.originalError)||void 0===h?void 0:h.code)===4902)try{let e,u;let{default:l,...h}=null!==(m=o.blockExplorers)&&void 0!==m?m:{};(null==t?void 0:t.blockExplorerUrls)?e=t.blockExplorerUrls:l&&(e=[l.url,...Object.values(h).map(e=>e.url)]),u=(null==t?void 0:null===(f=t.rpcUrls)||void 0===f?void 0:f.length)?t.rpcUrls:[null!==(g=null===(p=o.rpcUrls.default)||void 0===p?void 0:p.http[0])&&void 0!==g?g:""];let d={blockExplorerUrls:e,chainId:(0,a.eC)(r),chainName:null!==(y=null==t?void 0:t.chainName)&&void 0!==y?y:o.name,iconUrls:null==t?void 0:t.iconUrls,nativeCurrency:null!==(b=null==t?void 0:t.nativeCurrency)&&void 0!==b?b:o.nativeCurrency,rpcUrls:u};return await Promise.all([n.request({method:"wallet_addEthereumChain",params:[d]}).then(async()=>{if(await this.getChainId()===r)c.emitter.emit("change",{chainId:r});else throw new i.ab(Error("User rejected switch after adding network."))}),s]),o}catch(e){throw new i.ab(e)}if(e.code===i.ab.code)throw new i.ab(e);throw new i.x3(e)}},async onAccountsChanged(e){if(0===e.length)this.onDisconnect();else if(c.emitter.listenerCount("connect")){var t;let e=(await this.getChainId()).toString();this.onConnect({chainId:e}),m&&await (null===(t=c.storage)||void 0===t?void 0:t.removeItem("".concat(this.id,".disconnected")))}else c.emitter.emit("change",{accounts:e.map(e=>(0,n.K)(e))})},onChainChanged(e){let t=Number(e);c.emitter.emit("change",{chainId:t})},async onConnect(n){let i=await this.getAccounts();if(0===i.length)return;let o=Number(n.chainId);c.emitter.emit("connect",{accounts:i,chainId:o});let s=await this.getProvider();s&&(r&&(s.removeListener("connect",r),r=void 0),e||(e=this.onAccountsChanged.bind(this),s.on("accountsChanged",e)),t||(t=this.onChainChanged.bind(this),s.on("chainChanged",t)),f||(f=this.onDisconnect.bind(this),s.on("disconnect",f)))},async onDisconnect(e){let n=await this.getProvider();e&&1013===e.code&&n&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),n&&(t&&(n.removeListener("chainChanged",t),t=void 0),f&&(n.removeListener("disconnect",f),f=void 0),r||(r=this.onConnect.bind(this),n.on("connect",r))))}})}h.type="injected";let c={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider:e=>(null==e?void 0:e.coinbaseWalletExtension)?e.coinbaseWalletExtension:d(e,"isCoinbaseWallet")},metaMask:{id:"metaMask",name:"MetaMask",provider:e=>d(e,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;for(let t of["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"])if(e[t])return!1;return!0})},phantom:{id:"phantom",name:"Phantom",provider(e){var t,r;return(null==e?void 0:null===(t=e.phantom)||void 0===t?void 0:t.ethereum)?null===(r=e.phantom)||void 0===r?void 0:r.ethereum:d(e,"isPhantom")}}};function d(e,t){function r(e){return"function"==typeof t?t(e):"string"!=typeof t||e[t]}let n=e.ethereum;return(null==n?void 0:n.providers)?n.providers.find(e=>r(e)):n&&r(n)?n:void 0}},9725:function(e,t,r){"use strict";let n;r.d(t,{_:function(){return x}});var i=r(9187);let o=e=>(t,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let o=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,s=e(n.getState());o=r=>{let n=e(r);if(!i(s,n)){let e=s;t(s=n,e)}},(null==r?void 0:r.fireImmediately)&&t(s,s)}return i(o)},e(t,r,n)},s=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>s(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>s(t)(e)}}},a=(e,t)=>(r,n,i)=>{let o,a={storage:function(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let i=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(n=r.getItem(e))?n:null;return o instanceof Promise?o.then(i):i(o)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)}}(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},u=!1,l=new Set,h=new Set,c=a.storage;if(!c)return e(function(){for(var e=arguments.length,t=Array(e),n=0;n{let e=a.partialize({...n()});return c.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>{f(e,t),d()};let p=e(function(){for(var e=arguments.length,t=Array(e),n=0;np;let m=()=>{var e,t;if(!c)return;u=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let i=(null==(t=a.onRehydrateStorage)?void 0:t.call(a,null!=(e=n())?e:p))||void 0;return s(c.getItem.bind(c))(a.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===a.version)return[!1,e.state];if(a.migrate)return[!0,a.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;let[i,s]=e;if(r(o=a.merge(s,null!=(t=n())?t:p),!0),i)return d()}).then(()=>{null==i||i(o,void 0),o=n(),u=!0,h.forEach(e=>e(o))}).catch(e=>{null==i||i(void 0,e)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>u,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(h.add(e),()=>{h.delete(e)})},a.skipHydration||m(),o||p},u=e=>{let t;let r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>s,subscribe:e=>(r.add(e),()=>r.delete(e))},s=t=e(n,i,o);return o},l=e=>e?u(e):u;var h=r(6150),c=r(2942);class d{on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n{var n;let i=r;return(null==i?void 0:i.__type)==="bigint"&&(i=BigInt(i.value)),(null==i?void 0:i.__type)==="Map"&&(i=new Map(i.value)),null!==(n=null==t?void 0:t(e,i))&&void 0!==n?n:i})}function p(e,t){return e.slice(0,t).join(".")||"."}function m(e,t){let{length:r}=e;for(let n=0;n{var n;let i=r;return"bigint"==typeof i&&(i={__type:"bigint",value:r.toString()}),i instanceof Map&&(i={__type:"Map",value:Array.from(r.entries())}),null!==(n=null==t?void 0:t(e,i))&&void 0!==n?n:i},n),null!=r?r:void 0)}let y={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};var b=r(2731);let w=256;var _=r(3816);function x(e){var t;let r;let{multiInjectedProviderDiscovery:s=!0,storage:u=function(e){let{deserialize:t=f,key:r="wagmi",serialize:n=g,storage:i=y}=e;function o(e){return e instanceof Promise?e.then(e=>e).catch(()=>null):e}return{...i,key:r,async getItem(e,n){var s;let a=i.getItem("".concat(r,".").concat(e)),u=await o(a);return u?null!==(s=t(u))&&void 0!==s?s:null:null!=n?n:null},async setItem(e,t){let s="".concat(r,".").concat(e);null===t?await o(i.removeItem(s)):await o(i.setItem(s,n(t)))},async removeItem(e){await o(i.removeItem("".concat(r,".").concat(e)))}}}({storage:function(){let e=window.localStorage?window.localStorage:y;return{getItem:t=>e.getItem(t),removeItem(t){e.removeItem(t)},setItem(t,r){try{e.setItem(t,r)}catch(e){}}}}()}),syncConnectedChain:c=!0,ssr:p=!1,...m}=e,x=s?function(){let e=new Set,t=[],r=()=>(function(e){let t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)})(r=>{t.some(e=>{let{info:t}=e;return t.uuid===r.info.uuid})||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))}),n=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),null==n||n()},findProvider(e){let{rdns:r}=e;return t.find(e=>e.info.rdns===r)},getProviders:()=>t,reset(){this.clear(),null==n||n(),n=r()},subscribe(r){let{emitImmediately:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.add(r),n&&r(t,{added:t}),()=>e.delete(r)}}}():void 0,E=l(()=>m.chains),M=l(()=>{var e;let t=[],r=new Set;for(let n of null!==(e=m.connectors)&&void 0!==e?e:[]){let e=A(n);if(t.push(e),!p&&e.rdns)for(let t of"string"==typeof e.rdns?[e.rdns]:e.rdns)r.add(t)}if(!p&&x)for(let e of x.getProviders())r.has(e.info.rdns)||t.push(A(k(e)));return t});function A(e){var t;let r=new d(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:11;if(!n||w+e>512){n="",w=0;for(let e=0;e<256;e++)n+=(256+256*Math.random()|0).toString(16).substring(1)}return n.substring(w,w+++e)}()),i={...e({emitter:r,chains:E.getState(),storage:u,transports:m.transports}),emitter:r,uid:r.uid};return r.on("connect",T),null===(t=i.setup)||void 0===t||t.call(i),i}function k(e){let{info:t}=e,r=e.provider;return(0,h.L)({target:{...t,id:t.rdns,provider:r}})}let O=new Map;function S(){return{chainId:E.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let I="0.0.0-canary-";r=_.i.startsWith(I)?Number.parseInt(_.i.replace(I,"")):Number.parseInt(null!==(t=_.i.split(".")[0])&&void 0!==t?t:"0");let B=l(o(u?a(S,{migrate(e,t){if(t===r)return e;let n=S(),i=R(e,n.chainId);return{...n,chainId:i}},name:"store",partialize:e=>({connections:{__type:"Map",value:Array.from(e.connections.entries()).map(e=>{let[t,r]=e,{id:n,name:i,type:o,uid:s}=r.connector;return[t,{...r,connector:{id:n,name:i,type:o,uid:s}}]})},chainId:e.chainId,current:e.current}),merge(e,t){"object"==typeof e&&e&&"status"in e&&delete e.status;let r=R(e,t.chainId);return{...t,...e,chainId:r}},skipHydration:p,storage:u,version:r}):S));function R(e,t){return e&&"object"==typeof e&&"chainId"in e&&"number"==typeof e.chainId&&E.getState().some(t=>t.id===e.chainId)?e.chainId:t}function P(e){B.setState(t=>{var r,n;let i=t.connections.get(e.uid);return i?{...t,connections:new Map(t.connections).set(e.uid,{accounts:null!==(r=e.accounts)&&void 0!==r?r:i.accounts,chainId:null!==(n=e.chainId)&&void 0!==n?n:i.chainId,connector:i.connector})}:t})}function T(e){"connecting"!==B.getState().status&&"reconnecting"!==B.getState().status&&B.setState(t=>{let r=M.getState().find(t=>t.uid===e.uid);return r?(r.emitter.listenerCount("connect")&&r.emitter.off("connect",P),r.emitter.listenerCount("change")||r.emitter.on("change",P),r.emitter.listenerCount("disconnect")||r.emitter.on("disconnect",C),{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts,chainId:e.chainId,connector:r}),current:e.uid,status:"connected"}):t})}function C(e){B.setState(t=>{let r=t.connections.get(e.uid);if(r){let e=r.connector;e.emitter.listenerCount("change")&&r.connector.emitter.off("change",P),e.emitter.listenerCount("disconnect")&&r.connector.emitter.off("disconnect",C),e.emitter.listenerCount("connect")||r.connector.emitter.on("connect",T)}if(t.connections.delete(e.uid),0===t.connections.size)return{...t,connections:new Map,current:null,status:"disconnected"};let n=t.connections.values().next().value;return{...t,connections:new Map(t.connections),current:n.connector.uid}})}return B.setState(S()),c&&B.subscribe(e=>{var t;let{connections:r,current:n}=e;return n?null===(t=r.get(n))||void 0===t?void 0:t.chainId:void 0},e=>{if(E.getState().some(t=>t.id===e))return B.setState(t=>({...t,chainId:null!=e?e:t.chainId}))}),null==x||x.subscribe(e=>{let t=new Set,r=new Set;for(let e of M.getState())if(t.add(e.id),e.rdns)for(let t of"string"==typeof e.rdns?[e.rdns]:e.rdns)r.add(t);let n=[];for(let i of e){if(r.has(i.info.rdns))continue;let e=A(k(i));t.has(e.id)||n.push(e)}(!u||B.persist.hasHydrated())&&M.setState(e=>[...e,...n],!0)}),{get chains(){return E.getState()},get connectors(){return M.getState()},storage:u,getClient:function(){var e,t;let r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=null!==(e=n.chainId)&&void 0!==e?e:B.getState().chainId,s=E.getState().find(e=>e.id===o);if(n.chainId&&!s)throw new b.X4;{let e=O.get(B.getState().chainId);if(e&&!s)return e;if(!s)throw new b.X4}{let e=O.get(o);if(e)return e}if(m.client)r=m.client({chain:s});else{let e=s.id,n=E.getState().map(e=>e.id),o={};for(let[t,r]of Object.entries(m))if("chains"!==t&&"client"!==t&&"connectors"!==t&&"transports"!==t){if("object"==typeof r){if(e in r)o[t]=r[e];else{if(n.some(e=>e in r))continue;o[t]=r}}else o[t]=r}r=(0,i.e)({...o,chain:s,batch:null!==(t=o.batch)&&void 0!==t?t:{multicall:!0},transport:t=>m.transports[e]({...t,connectors:M})})}return O.set(o,r),r},get state(){return B.getState()},setState(e){let t;t="function"==typeof e?e(B.getState()):e;let r=S();"object"!=typeof t&&(t=r),Object.keys(r).some(e=>!(e in t))&&(t=r),B.setState(t,!0)},subscribe:(e,t,r)=>B.subscribe(e,t,r?{...r,fireImmediately:r.emitImmediately}:void 0),_internal:{mipd:x,store:B,ssr:!!p,syncConnectedChain:c,transports:m.transports,chains:{setState(e){let t="function"==typeof e?e(E.getState()):e;if(0!==t.length)return E.setState(t,!0)},subscribe:e=>E.subscribe(e)},connectors:{providerDetailToConnector:k,setup:A,setState:e=>M.setState("function"==typeof e?e(M.getState()):e,!0),subscribe:e=>M.subscribe(e)},events:{change:P,connect:T,disconnect:C}}}}},2942:function(e,t,r){"use strict";r.d(t,{v:function(){return n}});var n=r(2614)},9787:function(e,t,r){"use strict";r(3663),r(2942)},1544:function(e,t,r){"use strict";r.d(t,{AG:function(){return b},G0:function(){return k},IM:function(){return x},IX:function(){return p},O7:function(){return m},Rx:function(){return w},Ue:function(){return h},Yj:function(){return f},Z_:function(){return E},_4:function(){return O},bc:function(){return M},dt:function(){return A},eE:function(){return g},i0:function(){return y},jt:function(){return _},oQ:function(){return S}});class n extends TypeError{constructor(e,t){let r;let{message:n,explanation:i,...o}=e,{path:s}=e,a=0===s.length?n:"At path: ".concat(s.join(".")," -- ").concat(n);super(null!=i?i:a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>null!=r?r:r=[e,...t()]}}function i(e){return"object"==typeof e&&null!=e}function o(e){return i(e)&&!Array.isArray(e)}function s(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):"".concat(e)}function*a(e,t,r,n){var o;for(let a of(i(o=e)&&"function"==typeof o[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:o}=t,{type:a}=r,{refinement:u,message:l="Expected a value of type `".concat(a,"`").concat(u?" with refinement `".concat(u,"`"):"",", but received: `").concat(s(n),"`")}=e;return{value:n,type:a,refinement:u,key:i[i.length-1],path:i,branch:o,...e,message:l}}(a,t,r,n);e&&(yield e)}}function*u(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{path:n=[],branch:o=[e],coerce:s=!1,mask:a=!1}=r,l={path:n,branch:o,mask:a};s&&(e=t.coercer(e,l));let h="valid";for(let n of t.validator(e,l))n.explanation=r.message,h="not_valid",yield[n,void 0];for(let[c,d,f]of t.entries(e,l))for(let t of u(d,f,{path:void 0===c?n:[...n,c],branch:void 0===c?o:[...o,d],coerce:s,mask:a,message:r.message}))t[0]?(h=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):s&&(d=t[1],void 0===c?e=d:e instanceof Map?e.set(c,d):e instanceof Set?e.add(d):i(e)&&(void 0!==d||c in e)&&(e[c]=d));if("not_valid"!==h)for(let n of t.refiner(e,l))n.explanation=r.message,h="not_refined",yield[n,void 0];"valid"===h&&(yield[void 0,e])}class l{assert(e,t){return function(e,t,r){let n=c(e,t,{message:r});if(n[0])throw n[0]}(e,this,t)}create(e,t){return h(e,this,t)}is(e){return!c(e,this)[0]}mask(e,t){return function(e,t,r){let n=c(e,t,{coerce:!0,mask:!0,message:r});if(!n[0])return n[1];throw n[0]}(e,this,t)}validate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(e,this,t)}constructor(e){let{type:t,schema:r,validator:n,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=o,n?this.validator=(e,t)=>a(n(e,t),t,this,e):this.validator=()=>[],i?this.refiner=(e,t)=>a(i(e,t),t,this,e):this.refiner=()=>[]}}function h(e,t,r){let n=c(e,t,{coerce:!0,message:r});if(!n[0])return n[1];throw n[0]}function c(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=u(e,t,r),o=function(e){let{done:t,value:r}=e.next();return t?void 0:r}(i);return o[0]?[new n(o[0],function*(){for(let e of i)e[0]&&(yield e[0])}),void 0]:[void 0,o[1]]}function d(e,t){return new l({type:e,schema:null,validator:t})}function f(){return d("any",()=>!0)}function p(e){return new l({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: ".concat(s(e))})}function m(){return d("boolean",e=>"boolean"==typeof e)}function g(e){return d("instance",t=>t instanceof e||"Expected a `".concat(e.name,"` instance, but received: ").concat(s(t)))}function y(e){let t=s(e),r=typeof e;return new l({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||"Expected the literal `".concat(t,"`, but received: ").concat(s(r))})}function b(e){return new l({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function w(){return d("number",e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: ".concat(s(e)))}function _(e){return new l({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function x(e,t){return new l({type:"record",schema:null,*entries(r){if(i(r))for(let n in r){let i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>o(e)||"Expected an object, but received: ".concat(s(e)),coercer:e=>o(e)?{...e}:e})}function E(){return d("string",e=>"string"==typeof e||"Expected a string, but received: ".concat(s(e)))}function M(e){let t=d("never",()=>!1);return new l({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let n=Math.max(e.length,r.length);for(let i=0;iArray.isArray(e)||"Expected an array, but received: ".concat(s(e)),coercer:e=>Array.isArray(e)?e.slice():e})}function A(e){let t=Object.keys(e);return new l({type:"type",schema:e,*entries(r){if(i(r))for(let n of t)yield[n,r[n],e[n]]},validator:e=>o(e)||"Expected an object, but received: ".concat(s(e)),coercer:e=>o(e)?{...e}:e})}function k(e){let t=e.map(e=>e.type).join(" | ");return new l({type:"union",schema:null,coercer(t,r){for(let n of e){let[e,i]=n.validate(t,{coerce:!0,mask:r.mask});if(!e)return i}return t},validator(r,n){let i=[];for(let t of e){let[...e]=u(r,t,n),[o]=e;if(!o[0])return[];for(let[t]of e)t&&i.push(t)}return["Expected the value to satisfy a union of `".concat(t,"`, but received: ").concat(s(r)),...i]}})}function O(){return d("unknown",()=>!0)}function S(e,t,r){return new l({...e,coercer:(n,i)=>c(n,t)[0]?e.coercer(n,i):e.coercer(r(n,i),i)})}},7868:function(e,t,r){"use strict";r.d(t,{d:function(){return c}});var n=r(7825),i=r(1273);class o extends i.G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}var s=r(5493),a=r(1595),u=r(2791);let l={current:0,take(){return this.current++},reset(){this.current=0}};var h=r(2191);function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{batch:r,fetchOptions:i,key:c="http",methods:d,name:f="HTTP JSON-RPC",onFetchRequest:p,onFetchResponse:m,retryDelay:g,raw:y}=t;return b=>{var w,_;let{chain:x,retryCount:E,timeout:M}=b,{batchSize:A=1e3,wait:k=0}="object"==typeof r?r:{},O=null!==(w=t.retryCount)&&void 0!==w?w:E,S=null!==(_=null!=M?M:t.timeout)&&void 0!==_?_:1e4,I=e||(null==x?void 0:x.rpcUrls.default.http[0]);if(!I)throw new o;let B=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{async request(r){var i,o,s,h;let{body:c,onRequest:d=t.onRequest,onResponse:f=t.onResponse,timeout:p=null!==(i=t.timeout)&&void 0!==i?i:1e4}=r,m={...null!==(o=t.fetchOptions)&&void 0!==o?o:{},...null!==(s=r.fetchOptions)&&void 0!==s?s:{}},{headers:g,method:y,signal:b}=m;try{let t;let r=await (0,a.F)(async t=>{var r,n,i;let{signal:o}=t,s={...m,body:Array.isArray(c)?(0,u.P)(c.map(e=>{var t;return{jsonrpc:"2.0",id:null!==(t=e.id)&&void 0!==t?t:l.take(),...e}})):(0,u.P)({jsonrpc:"2.0",id:null!==(r=c.id)&&void 0!==r?r:l.take(),...c}),headers:{"Content-Type":"application/json",...g},method:y||"POST",signal:b||(p>0?o:null)},a=new Request(e,s),h=null!==(n=await (null==d?void 0:d(a,s)))&&void 0!==n?n:{...s,url:e};return await fetch(null!==(i=h.url)&&void 0!==i?i:e,h)},{errorInstance:new n.W5({body:c,url:e}),timeout:p,signal:!0});if(f&&await f(r),null===(h=r.headers.get("Content-Type"))||void 0===h?void 0:h.startsWith("application/json"))t=await r.json();else{t=await r.text();try{t=JSON.parse(t||"{}")}catch(e){if(r.ok)throw e;t={error:t}}}if(!r.ok)throw new n.Gg({body:c,details:(0,u.P)(t.error)||r.statusText,headers:r.headers,status:r.status,url:e});return t}catch(t){if(t instanceof n.Gg||t instanceof n.W5)throw t;throw new n.Gg({body:c,cause:t,url:e})}}}}(I,{fetchOptions:i,onRequest:p,onResponse:m,timeout:S});return(0,h.q)({key:c,methods:d,name:f,async request(e){let{method:t,params:i}=e,o={method:t,params:i},{schedule:a}=(0,s.S)({id:I,wait:k,shouldSplitBatch:e=>e.length>A,fn:e=>B.request({body:e}),sort:(e,t)=>e.id-t.id}),u=async e=>r?a(e):[await B.request({body:e})],[{error:l,result:h}]=await u(o);if(y)return{error:l,result:h};if(l)throw new n.bs({body:o,error:l,url:I});return h},retryCount:O,retryDelay:g,timeout:S,type:"http"},{fetchOptions:i,url:I})}}},1595:function(e,t,r){"use strict";function n(e,t){let{errorInstance:r=Error("timed out"),timeout:n,signal:i}=t;return new Promise((t,o)=>{(async()=>{let s;try{let a=new AbortController;n>0&&(s=setTimeout(()=>{i?a.abort():o(r)},n)),t(await e({signal:(null==a?void 0:a.signal)||null}))}catch(e){(null==e?void 0:e.name)==="AbortError"&&o(r),o(e)}finally{clearTimeout(s)}})()})}r.d(t,{F:function(){return n}})}}]);