"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5702],{33490:function(e,t,r){r.d(t,{i:function(){return n}});let n="abi/5.7.0"},59280:function(e,t,r){r.d(t,{R:function(){return x},$:function(){return j}});var n=r(22154),i=r(60803),s=r(45394),a=r(33490),o=r(64160),l=r(2479);class u extends o.XI{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=(0,l.Kn)(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return(0,l.Kn)((0,n.$m)(e.readValue().toHexString(),20))}}class c extends o.XI{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}let h=new s.Yd(a.i);function d(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let e={};n=t.map(t=>{let n=t.localName;return n||h.throwError("cannot encode object for signature with missing names",s.Yd.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&h.throwError("cannot encode object for signature with duplicate names",s.Yd.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]})}else h.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&h.throwArgumentError("types/value length mismatch","tuple",r);let i=new o.QV(e.wordSize),a=new o.QV(e.wordSize),l=[];return t.forEach((e,t)=>{let r=n[t];if(e.dynamic){let t=a.length;e.encode(a,r);let n=i.writeUpdatableValue();l.push(e=>{n(e+t)})}else e.encode(i,r)}),l.forEach(e=>{e(i.length)}),e.appendWriter(i)+e.appendWriter(a)}function p(e,t){let r=[],n=e.subReader(0);t.forEach(t=>{let i=null;if(t.dynamic){let r=e.readValue(),a=n.subReader(r.toNumber());try{i=t.decode(a)}catch(e){if(e.code===s.Yd.errors.BUFFER_OVERRUN)throw e;(i=e).baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===s.Yd.errors.BUFFER_OVERRUN)throw e;(i=e).baseType=t.name,i.name=t.localName,i.type=t.type}void 0!=i&&r.push(i)});let i=t.reduce((e,t)=>{let r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e},{});t.forEach((e,t)=>{let n=e.localName;if(!n||1!==i[n]||("length"===n&&(n="_length"),null!=r[n]))return;let s=r[t];s instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw s}}):r[n]=s});for(let e=0;e<r.length;e++){let t=r[e];t instanceof Error&&Object.defineProperty(r,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(r)}class m extends o.XI{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){let e=this.coder.defaultValue(),t=[];for(let r=0;r<this.length;r++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),h.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let e=0;e<t.length;e++)n.push(this.coder);return d(e,n,t)}decode(e){let t=this.length;-1===t&&32*(t=e.readValue().toNumber())>e._data.length&&h.throwError("insufficient data length",s.Yd.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});let r=[];for(let e=0;e<t;e++)r.push(new c(this.coder));return e.coerce(this.name,p(e,r))}}class g extends o.XI{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class f extends o.XI{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){return t=(0,n.lE)(t),e.writeValue(t.length)+e.writeBytes(t)}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class y extends f{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,(0,n.Dv)(super.decode(e)))}}class v extends o.XI{constructor(e,t){let r="bytes"+String(e);super(r,r,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let r=(0,n.lE)(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}decode(e){return e.coerce(this.name,(0,n.Dv)(e.readBytes(this.size)))}}class E extends o.XI{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}var w=r(35901),b=r(16342);class _ extends o.XI{constructor(e,t,r){let n=(t?"int":"uint")+8*e;super(n,n,r,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let r=w.O$.from(t),n=b.Bz.mask(8*e.wordSize);if(this.signed){let e=n.mask(8*this.size-1);(r.gt(e)||r.lt(e.add(b.fh).mul(b.tL)))&&this._throwError("value out-of-bounds",t)}else(r.lt(b._Y)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}var O=r(70388);class R extends f{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,(0,O.Y0)(t))}decode(e){return(0,O.ZN)(super.decode(e))}}class A extends o.XI{constructor(e,t){let r=!1,n=[];e.forEach(e=>{e.dynamic&&(r=!0),n.push(e.type)}),super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){let e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});let t=this.coders.reduce((e,t)=>{let r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e},{});return this.coders.forEach((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))}),Object.freeze(e)}encode(e,t){return d(e,this.coders,t)}decode(e){return e.coerce(this.name,p(e,this.coders))}}var S=r(14164);let T=new s.Yd(a.i),P=new RegExp(/^bytes([0-9]*)$/),N=new RegExp(/^(u?int)([0-9]*)$/);class x{constructor(e){(0,i.defineReadOnly)(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new u(e.name);case"bool":return new g(e.name);case"string":return new R(e.name);case"bytes":return new y(e.name);case"array":return new m(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new A((e.components||[]).map(e=>this._getCoder(e)),e.name);case"":return new E(e.name)}let t=e.type.match(N);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&T.throwArgumentError("invalid "+t[1]+" bit length","param",e),new _(r/8,"int"===t[1],e.name)}if(t=e.type.match(P)){let r=parseInt(t[1]);return(0===r||r>32)&&T.throwArgumentError("invalid bytes length","param",e),new v(r,e.name)}return T.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new o.Ej(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new o.QV(this._getWordSize())}getDefaultValue(e){return new A(e.map(e=>this._getCoder(S._R.from(e))),"_").defaultValue()}encode(e,t){e.length!==t.length&&T.throwError("types/values length mismatch",s.Yd.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});let r=new A(e.map(e=>this._getCoder(S._R.from(e))),"_"),n=this._getWriter();return r.encode(n,t),n.data}decode(e,t,r){return new A(e.map(e=>this._getCoder(S._R.from(e))),"_").decode(this._getReader((0,n.lE)(t),r))}}let j=new x},64160:function(e,t,r){r.d(t,{BR:function(){return u},Ej:function(){return d},QV:function(){return h},XI:function(){return c}});var n=r(22154),i=r(35901),s=r(60803),a=r(45394),o=r(33490);let l=new a.Yd(o.i);function u(e){let t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){let s=e.slice();s.push(i);try{r(s,n[i])}catch(e){t.push({path:s,error:e})}}};return r([],e),t}class c{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){l.throwArgumentError(e,this.localName,t)}}class h{constructor(e){(0,s.defineReadOnly)(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return(0,n.xs)(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData((0,n.zo)(e._data))}writeBytes(e){let t=(0,n.lE)(e),r=t.length%this.wordSize;return r&&(t=(0,n.zo)([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=(0,n.lE)(i.O$.from(e));return t.length>this.wordSize&&l.throwError("value out-of-bounds",a.Yd.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=(0,n.zo)([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class d{constructor(e,t,r,i){(0,s.defineReadOnly)(this,"_data",(0,n.lE)(e)),(0,s.defineReadOnly)(this,"wordSize",t||32),(0,s.defineReadOnly)(this,"_coerceFunc",r),(0,s.defineReadOnly)(this,"allowLoose",i),this._offset=0}get data(){return(0,n.Dv)(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&48>=parseInt(r[1])&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):d.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:l.throwError("data out-of-bounds",a.Yd.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new d(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return i.O$.from(this.readBytes(this.wordSize))}}},14164:function(e,t,r){r.d(t,{HY:function(){return y},IC:function(){return A},QV:function(){return v},Xg:function(){return _},YW:function(){return O},_R:function(){return g},pc:function(){return p}});var n=r(35901),i=r(60803),s=r(45394),a=r(33490);let o=new s.Yd(a.i),l={},u={calldata:!0,memory:!0,storage:!0},c={calldata:!0,memory:!0};function h(e,t){if("bytes"===e||"string"===e){if(u[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&c[t])return!0;return(u[t]||"payable"===t)&&o.throwArgumentError("invalid modifier","name",t),!1}function d(e,t){for(let r in t)(0,i.defineReadOnly)(e,r,t[r])}let p=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),m=new RegExp(/^(.*)\[([0-9]*)\]$/);class g{constructor(e,t){e!==l&&o.throwError("use fromString",s.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),d(this,t);let r=this.type.match(m);r?d(this,{arrayLength:parseInt(r[2]||"-1"),arrayChildren:g.fromObject({type:r[1],components:this.components}),baseType:"array"}):d(this,{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=p.sighash),p[e]||o.throwArgumentError("invalid format type","format",e),e===p.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(t)}let t="";return"array"===this.baseType?t+=this.arrayChildren.format(e)+"["+(this.arrayLength<0?"":String(this.arrayLength))+"]":"tuple"===this.baseType?(e!==p.sighash&&(t+=this.type),t+="("+this.components.map(t=>t.format(e)).join(e===p.full?", ":",")+")"):t+=this.type,e!==p.sighash&&(!0===this.indexed&&(t+=" indexed"),e===p.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?g.fromString(e,t):g.fromObject(e)}static fromObject(e){return g.isParamType(e)?e:new g(l,{name:e.name||null,type:S(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(g.fromObject):null})}static fromString(e,t){var r;return r=function(e,t){let r=e;function n(t){o.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},a=s;for(let r=0;r<e.length;r++){let s=e[r];switch(s){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||n(r),a.state.allowType=!1,a.type=S(a.type),a.components=[i(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||n(r),a.indexed=!0,a.name=""),h(a.type,a.name)&&(a.name=""),a.type=S(a.type);let o=a;(a=a.parent)||n(r),delete o.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||n(r),a.indexed=!0,a.name=""),h(a.type,a.name)&&(a.name=""),a.type=S(a.type);let l=i(a.parent);a.parent.components.push(l),delete a.parent,a=l;break;case" ":a.state.allowType&&""!==a.type&&(a.type=S(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||n(r),a.indexed&&n(r),a.indexed=!0,a.name=""):h(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||n(r),a.type+=s,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||n(r),a.type+=s,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=s,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=s,delete a.state.allowArray):a.state.readArray?a.type+=s:n(r)}}return a.parent&&o.throwArgumentError("unexpected eof","param",e),delete s.state,"indexed"===a.name?(t||n(r.length-7),a.indexed&&n(r.length-7),a.indexed=!0,a.name=""):h(a.type,a.name)&&(a.name=""),s.type=S(s.type),s}(e,!!t),g.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components})}static isParamType(e){return!!(null!=e&&e._isParamType)}}function f(e,t){return(function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let s=e[i];","===s&&0===n?(t.push(r),r=""):(r+=s,"("===s?n++:")"===s&&-1==--n&&o.throwArgumentError("unbalanced parenthesis","value",e))}return r&&t.push(r),t})(e).map(e=>g.fromString(e,t))}class y{constructor(e,t){e!==l&&o.throwError("use a static from method",s.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),d(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return y.isFragment(e)?e:"string"==typeof e?y.fromString(e):y.fromObject(e)}static fromObject(e){if(y.isFragment(e))return e;switch(e.type){case"function":return O.fromObject(e);case"event":return v.fromObject(e);case"constructor":return _.fromObject(e);case"error":return A.fromObject(e);case"fallback":case"receive":return null}return o.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?v.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?O.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?_.fromString(e.trim()):"error"===e.split(" ")[0]?A.fromString(e.substring(5).trim()):o.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class v extends y{format(e){if(e||(e=p.sighash),p[e]||o.throwArgumentError("invalid format type","format",e),e===p.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==p.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===p.full?", ":",")+") ",e!==p.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?v.fromString(e):v.fromObject(e)}static fromObject(e){return v.isEventFragment(e)?e:("event"!==e.type&&o.throwArgumentError("invalid event object","value",e),new v(l,{name:P(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(g.fromObject):[],type:"event"}))}static fromString(e){let t=e.match(N);t||o.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:o.warn("unknown modifier: "+e)}}),v.fromObject({name:t[1].trim(),anonymous:r,inputs:f(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function E(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&o.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||o.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=n.O$.from(r[1]),r[0]):e}function w(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach(e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}})}function b(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&o.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&o.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||o.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&o.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&o.throwArgumentError("unable to determine stateMutability","value",e),t}class _ extends y{format(e){if(e||(e=p.sighash),p[e]||o.throwArgumentError("invalid format type","format",e),e===p.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});e===p.sighash&&o.throwError("cannot format a constructor for sighash",s.Yd.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(t=>t.format(e)).join(e===p.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?_.fromString(e):_.fromObject(e)}static fromObject(e){if(_.isConstructorFragment(e))return e;"constructor"!==e.type&&o.throwArgumentError("invalid constructor object","value",e);let t=b(e);return t.constant&&o.throwArgumentError("constructor cannot be constant","value",e),new _(l,{name:null,type:e.type,inputs:e.inputs?e.inputs.map(g.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.O$.from(e.gas):null})}static fromString(e){let t={type:"constructor"},r=(e=E(e,t)).match(N);return r&&"constructor"===r[1].trim()||o.throwArgumentError("invalid constructor string","value",e),t.inputs=f(r[2].trim(),!1),w(r[3].trim(),t),_.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class O extends _{format(e){if(e||(e=p.sighash),p[e]||o.throwArgumentError("invalid format type","format",e),e===p.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(t=>JSON.parse(t.format(e))),outputs:this.outputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==p.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===p.full?", ":",")+") ",e!==p.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(t=>t.format(e)).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?O.fromString(e):O.fromObject(e)}static fromObject(e){if(O.isFunctionFragment(e))return e;"function"!==e.type&&o.throwArgumentError("invalid function object","value",e);let t=b(e);return new O(l,{type:e.type,name:P(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(g.fromObject):[],outputs:e.outputs?e.outputs.map(g.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.O$.from(e.gas):null})}static fromString(e){let t={type:"function"},r=(e=E(e,t)).split(" returns ");r.length>2&&o.throwArgumentError("invalid function string","value",e);let n=r[0].match(N);if(n||o.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&P(t.name),t.inputs=f(n[2],!1),w(n[3].trim(),t),r.length>1){let n=r[1].match(N);(""!=n[1].trim()||""!=n[3].trim())&&o.throwArgumentError("unexpected tokens","value",e),t.outputs=f(n[2],!1)}else t.outputs=[];return O.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function R(e){let t=e.format();return("Error(string)"===t||"Panic(uint256)"===t)&&o.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class A extends y{format(e){if(e||(e=p.sighash),p[e]||o.throwArgumentError("invalid format type","format",e),e===p.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==p.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===p.full?", ":",")+") ").trim()}static from(e){return"string"==typeof e?A.fromString(e):A.fromObject(e)}static fromObject(e){return A.isErrorFragment(e)?e:("error"!==e.type&&o.throwArgumentError("invalid error object","value",e),R(new A(l,{type:e.type,name:P(e.name),inputs:e.inputs?e.inputs.map(g.fromObject):[]})))}static fromString(e){let t={type:"error"},r=e.match(N);return r||o.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&P(t.name),t.inputs=f(r[2],!1),R(A.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function S(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}let T=RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function P(e){return e&&e.match(T)||o.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}let N=RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$")},51672:function(e,t,r){r.d(t,{CC:function(){return m},Hk:function(){return y},vU:function(){return w},vk:function(){return g}});var n=r(2479),i=r(35901),s=r(22154),a=r(15878),o=r(69418),l=r(60803),u=r(59280),c=r(14164),h=r(45394),d=r(33490);let p=new h.Yd(d.i);class m extends l.Description{}class g extends l.Description{}class f extends l.Description{}class y extends l.Description{static isIndexed(e){return!!(e&&e._isIndexed)}}let v={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function E(e,t){let r=Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class w{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,(0,l.defineReadOnly)(this,"fragments",t.map(e=>c.HY.from(e)).filter(e=>null!=e)),(0,l.defineReadOnly)(this,"_abiCoder",(0,l.getStatic)(new.target,"getAbiCoder")()),(0,l.defineReadOnly)(this,"functions",{}),(0,l.defineReadOnly)(this,"errors",{}),(0,l.defineReadOnly)(this,"events",{}),(0,l.defineReadOnly)(this,"structs",{}),this.fragments.forEach(e=>{let t=null;switch(e.type){case"constructor":if(this.deploy){p.warn("duplicate definition - constructor");return}(0,l.defineReadOnly)(this,"deploy",e);return;case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();if(t[r]){p.warn("duplicate definition - "+r);return}t[r]=e}),this.deploy||(0,l.defineReadOnly)(this,"deploy",c.Xg.from({payable:!1,type:"constructor"})),(0,l.defineReadOnly)(this,"_isInterface",!0)}format(e){e||(e=c.pc.full),e===c.pc.sighash&&p.throwArgumentError("interface does not support formatting sighash","format",e);let t=this.fragments.map(t=>t.format(e));return e===c.pc.json?JSON.stringify(t.map(e=>JSON.parse(e))):t}static getAbiCoder(){return u.$}static getAddress(e){return(0,n.Kn)(e)}static getSighash(e){return(0,s.p3)((0,a.id)(e.format()),0,4)}static getEventTopic(e){return(0,a.id)(e.format())}getFunction(e){if((0,s.A7)(e)){for(let t in this.functions)if(e===this.getSighash(t))return this.functions[t];p.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){let t=e.trim(),r=Object.keys(this.functions).filter(e=>e.split("(")[0]===t);return 0===r.length?p.throwArgumentError("no matching function","name",t):r.length>1&&p.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}let t=this.functions[c.YW.fromString(e).format()];return t||p.throwArgumentError("no matching function","signature",e),t}getEvent(e){if((0,s.A7)(e)){let t=e.toLowerCase();for(let e in this.events)if(t===this.getEventTopic(e))return this.events[e];p.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){let t=e.trim(),r=Object.keys(this.events).filter(e=>e.split("(")[0]===t);return 0===r.length?p.throwArgumentError("no matching event","name",t):r.length>1&&p.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}let t=this.events[c.QV.fromString(e).format()];return t||p.throwArgumentError("no matching event","signature",e),t}getError(e){if((0,s.A7)(e)){let t=(0,l.getStatic)(this.constructor,"getSighash");for(let r in this.errors)if(e===t(this.errors[r]))return this.errors[r];p.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){let t=e.trim(),r=Object.keys(this.errors).filter(e=>e.split("(")[0]===t);return 0===r.length?p.throwArgumentError("no matching error","name",t):r.length>1&&p.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}let t=this.errors[c.YW.fromString(e).format()];return t||p.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return(0,l.getStatic)(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),(0,l.getStatic)(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));let r=(0,s.lE)(t);return(0,s.Dv)(r.slice(0,4))!==this.getSighash(e)&&p.throwArgumentError(`data signature does not match error ${e.name}.`,"data",(0,s.Dv)(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),(0,s.Dv)((0,s.zo)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=(0,s.lE)(t);return(0,s.Dv)(r.slice(0,4))!==this.getSighash(e)&&p.throwArgumentError(`data signature does not match function ${e.name}.`,"data",(0,s.Dv)(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),(0,s.Dv)((0,s.zo)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=(0,s.lE)(t),n=null,i="",a=null,o=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{let e=(0,s.Dv)(r.slice(0,4)),t=v[e];if(t)a=this._abiCoder.decode(t.inputs,r.slice(4)),o=t.name,l=t.signature,t.reason&&(n=a[0]),"Error"===o?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(a[0])}`:"Panic"===o&&(i=`; VM Exception while processing transaction: reverted with panic code ${a[0]}`);else try{let t=this.getError(e);a=this._abiCoder.decode(t.inputs,r.slice(4)),o=t.name,l=t.format()}catch(e){}}}return p.throwError("call revert exception"+i,h.Yd.errors.CALL_EXCEPTION,{method:e.format(),data:(0,s.Dv)(t),errorArgs:a,errorName:o,errorSignature:l,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),(0,s.Dv)(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&p.throwError("too many arguments for "+e.format(),h.Yd.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));let n=(e,t)=>"string"===e.type?(0,a.id)(t):"bytes"===e.type?(0,o.w)((0,s.Dv)(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=i.O$.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),(0,s.$m)((0,s.Dv)(t),32));for(t.forEach((t,i)=>{let s=e.inputs[i];if(!s.indexed){null!=t&&p.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,t);return}null==t?r.push(null):"array"===s.baseType||"tuple"===s.baseType?p.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,t):Array.isArray(t)?r.push(t.map(e=>n(s,e))):r.push(n(s,t))});r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));let r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&p.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((e,s)=>{let l=t[s];if(e.indexed){if("string"===e.type)r.push((0,a.id)(l));else if("bytes"===e.type)r.push((0,o.w)(l));else if("tuple"===e.baseType||"array"===e.baseType)throw Error("not implemented");else r.push(this._abiCoder.encode([e.type],[l]))}else n.push(e),i.push(l)}),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);(0,s.A7)(r[0],32)&&r[0].toLowerCase()===t||p.throwError("fragment/topic mismatch",h.Yd.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],a=[];e.inputs.forEach((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(c._R.fromObject({type:"bytes32",name:e.name})),a.push(!0)):(n.push(e),a.push(!1)):(i.push(e),a.push(!1))});let o=null!=r?this._abiCoder.decode(n,(0,s.zo)(r)):null,l=this._abiCoder.decode(i,t,!0),u=[],d=0,m=0;e.inputs.forEach((e,t)=>{if(e.indexed){if(null==o)u[t]=new y({_isIndexed:!0,hash:null});else if(a[t])u[t]=new y({_isIndexed:!0,hash:o[m++]});else try{u[t]=o[m++]}catch(e){u[t]=e}}else try{u[t]=l[d++]}catch(e){u[t]=e}if(e.name&&null==u[e.name]){let r=u[t];r instanceof Error?Object.defineProperty(u,e.name,{enumerable:!0,get:()=>{throw E(`property ${JSON.stringify(e.name)}`,r)}}):u[e.name]=r}});for(let e=0;e<u.length;e++){let t=u[e];t instanceof Error&&Object.defineProperty(u,e,{enumerable:!0,get:()=>{throw E(`index ${e}`,t)}})}return Object.freeze(u)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new g({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:i.O$.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new m({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){let t=(0,s.Dv)(e),r=this.getError(t.substring(0,10).toLowerCase());return r?new f({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}},15702:function(e,t,r){r.d(t,{VZ:function(){return T},CH:function(){return P},lV:function(){return N}});var n=r(64160),i=r(51672),s=r(28049),a=r(53423),o=r(2479),l=r(35901),u=r(22154),c=r(60803),h=r(40032),d=r(45394),p=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})};let m=new d.Yd("contracts/5.7.0"),g={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function f(e,t){return p(this,void 0,void 0,function*(){let r=yield t;"string"!=typeof r&&m.throwArgumentError("invalid address or ENS name","name",r);try{return(0,o.Kn)(r)}catch(e){}e||m.throwError("a provider or signer is needed to resolve ENS names",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});let n=yield e.resolveName(r);return null==n&&m.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function y(e,t,r){return p(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((r,n)=>y(e,Array.isArray(t)?t[n]:t[r.name],r))):"address"===r.type?yield f(e,t):"tuple"===r.type?yield y(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map(t=>y(e,t,r.arrayChildren))):Promise.reject(m.makeError("invalid value for array",d.Yd.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t})}function v(e,t,r){return p(this,void 0,void 0,function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=(0,c.shallowCopy)(r.pop())),m.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=(0,c.resolveProperties)({override:f(e.signer,n.from),signer:e.signer.getAddress()}).then(e=>p(this,void 0,void 0,function*(){return(0,o.Kn)(e.signer)!==e.override&&m.throwError("Contract with a Signer cannot override from",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})):n.from=e.signer.getAddress():n.from&&(n.from=f(e.provider,n.from));let i=yield(0,c.resolveProperties)({args:y(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:(0,c.resolveProperties)(n)||{}}),s=e.interface.encodeFunctionData(t,i.args),a={data:s,to:i.address},g=i.overrides;if(null!=g.nonce&&(a.nonce=l.O$.from(g.nonce).toNumber()),null!=g.gasLimit&&(a.gasLimit=l.O$.from(g.gasLimit)),null!=g.gasPrice&&(a.gasPrice=l.O$.from(g.gasPrice)),null!=g.maxFeePerGas&&(a.maxFeePerGas=l.O$.from(g.maxFeePerGas)),null!=g.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=l.O$.from(g.maxPriorityFeePerGas)),null!=g.from&&(a.from=g.from),null!=g.type&&(a.type=g.type),null!=g.accessList&&(a.accessList=(0,h.z7)(g.accessList)),null==a.gasLimit&&null!=t.gas){let e=21e3,r=(0,u.lE)(s);for(let t=0;t<r.length;t++)e+=4,r[t]&&(e+=64);a.gasLimit=l.O$.from(t.gas).add(e)}if(g.value){let e=l.O$.from(g.value);e.isZero()||t.payable||m.throwError("non-payable method cannot override value",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),a.value=e}g.customData&&(a.customData=(0,c.shallowCopy)(g.customData)),g.ccipReadEnabled&&(a.ccipReadEnabled=!!g.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;let v=Object.keys(n).filter(e=>null!=n[e]);return v.length&&m.throwError(`cannot override ${v.map(e=>JSON.stringify(e)).join(",")}`,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:v}),a})}function E(e,t){let r=t.wait.bind(t);t.wait=t=>r(t).then(t=>(t.events=t.logs.map(r=>{let n=(0,c.deepCopy)(r),i=null;try{i=e.interface.parseLog(r)}catch(e){}return i&&(n.args=i.args,n.decode=(t,r)=>e.interface.decodeEventLog(i.eventFragment,t,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n}),t))}function w(e,t,r){let n=e.signer||e.provider;return function(...i){return p(this,void 0,void 0,function*(){let s;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){let e=(0,c.shallowCopy)(i.pop());null!=e.blockTag&&(s=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(s));let a=yield v(e,t,i),o=yield n.call(a,s);try{let n=e.interface.decodeFunctionResult(t,o);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===d.Yd.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=a),t}})}}function b(e,t,r){return t.constant?w(e,t,r):function(...r){return p(this,void 0,void 0,function*(){e.signer||m.throwError("sending a transaction requires a signer",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());let n=yield v(e,t,r),i=yield e.signer.sendTransaction(n);return E(e,i),i})}}function _(e){return e.address&&(null==e.topics||0===e.topics.length)?"*":(e.address||"*")+"@"+(e.topics?e.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class O{constructor(e,t){(0,c.defineReadOnly)(this,"tag",e),(0,c.defineReadOnly)(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>!!t||r.listener!==e||(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){let t=this.listenerCount();return this._listeners=this._listeners.filter(t=>{let r=e.slice();return setTimeout(()=>{t.listener.apply(this,r)},0),!t.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class R extends O{constructor(){super("error",null)}}class A extends O{constructor(e,t,r,n){let i={address:e},s=t.getEventTopic(r);n?(s!==n[0]&&m.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[s],super(_(i),i),(0,c.defineReadOnly)(this,"address",e),(0,c.defineReadOnly)(this,"interface",t),(0,c.defineReadOnly)(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){let t=(0,n.BR)(e.args);if(t.length)throw t[0].error;let r=(e.args||[]).slice();return r.push(e),r}}class S extends O{constructor(e,t){super("*",{address:e}),(0,c.defineReadOnly)(this,"address",e),(0,c.defineReadOnly)(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{let t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class T{constructor(e,t,r){(0,c.defineReadOnly)(this,"interface",(0,c.getStatic)(new.target,"getInterface")(t)),null==r?((0,c.defineReadOnly)(this,"provider",null),(0,c.defineReadOnly)(this,"signer",null)):a.E.isSigner(r)?((0,c.defineReadOnly)(this,"provider",r.provider||null),(0,c.defineReadOnly)(this,"signer",r)):s.zt.isProvider(r)?((0,c.defineReadOnly)(this,"provider",r),(0,c.defineReadOnly)(this,"signer",null)):m.throwArgumentError("invalid signer or provider","signerOrProvider",r),(0,c.defineReadOnly)(this,"callStatic",{}),(0,c.defineReadOnly)(this,"estimateGas",{}),(0,c.defineReadOnly)(this,"functions",{}),(0,c.defineReadOnly)(this,"populateTransaction",{}),(0,c.defineReadOnly)(this,"filters",{});{let e={};Object.keys(this.interface.events).forEach(t=>{let r=this.interface.events[t];(0,c.defineReadOnly)(this.filters,t,(...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)})),e[r.name]||(e[r.name]=[]),e[r.name].push(t)}),Object.keys(e).forEach(t=>{let r=e[t];1===r.length?(0,c.defineReadOnly)(this.filters,t,this.filters[r[0]]):m.warn(`Duplicate definition of ${t} (${r.join(", ")})`)})}if((0,c.defineReadOnly)(this,"_runningEvents",{}),(0,c.defineReadOnly)(this,"_wrappedEmits",{}),null==e&&m.throwArgumentError("invalid contract address or ENS name","addressOrName",e),(0,c.defineReadOnly)(this,"address",e),this.provider)(0,c.defineReadOnly)(this,"resolvedAddress",f(this.provider,e));else try{(0,c.defineReadOnly)(this,"resolvedAddress",Promise.resolve((0,o.Kn)(e)))}catch(e){m.throwError("provider is required to use ENS name as contract address",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(e=>{});let n={},i={};Object.keys(this.interface.functions).forEach(e=>{let t=this.interface.functions[e];if(i[e]){m.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);return}i[e]=!0;{let r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}if(null==this[e]&&(0,c.defineReadOnly)(this,e,b(this,t,!0)),null==this.functions[e]&&(0,c.defineReadOnly)(this.functions,e,b(this,t,!1)),null==this.callStatic[e]&&(0,c.defineReadOnly)(this.callStatic,e,w(this,t,!0)),null==this.populateTransaction[e]){var r;(0,c.defineReadOnly)(this.populateTransaction,e,(r=this,function(...e){return v(r,t,e)}))}null==this.estimateGas[e]&&(0,c.defineReadOnly)(this.estimateGas,e,function(e,t){let r=e.signer||e.provider;return function(...n){return p(this,void 0,void 0,function*(){r||m.throwError("estimate require a provider or signer",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});let i=yield v(e,t,n);return yield r.estimateGas(i)})}}(this,t))}),Object.keys(n).forEach(e=>{let t=n[e];if(t.length>1)return;e=e.substring(1);let r=t[0];try{null==this[e]&&(0,c.defineReadOnly)(this,e,this[r])}catch(e){}null==this.functions[e]&&(0,c.defineReadOnly)(this.functions,e,this.functions[r]),null==this.callStatic[e]&&(0,c.defineReadOnly)(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&(0,c.defineReadOnly)(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&(0,c.defineReadOnly)(this.estimateGas,e,this.estimateGas[r])})}static getContractAddress(e){return(0,o.CR)(e)}static getInterface(e){return i.vU.isInterface(e)?e:new i.vU(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(e=>("0x"===e&&m.throwError("contract not deployed",d.Yd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||m.throwError("sending a transactions require a signer",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});let t=(0,c.shallowCopy)(e||{});return["from","to"].forEach(function(e){null!=t[e]&&m.throwError("cannot override "+e,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:e})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){"string"==typeof e&&(e=new a.b(e,this.provider));let t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&(0,c.defineReadOnly)(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return i.Hk.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new R);if("event"===e)return this._normalizeRunningEvent(new O("event",null));if("*"===e)return this._normalizeRunningEvent(new S(this.address,this.interface));let t=this.interface.getEvent(e);return this._normalizeRunningEvent(new A(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{let t=e.topics[0];if("string"!=typeof t)throw Error("invalid topic");let r=this.interface.getEvent(t);return this._normalizeRunningEvent(new A(this.address,this.interface,r,e.topics))}catch(e){}let t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new O(_(t),t))}return this._normalizeRunningEvent(new S(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];let t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){let n=(0,c.deepCopy)(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||m.throwError("events require a provider or a signer with a provider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){let r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{let t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){let n=this._getRunningEvent(e),i=(0,c.shallowCopy)(n.filter);return"string"==typeof t&&(0,u.A7)(t,32)?(null!=r&&m.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then(e=>e.map(e=>this._wrapEvent(n,e,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;let r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce((e,t)=>e+this._runningEvents[t].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){let e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach(t=>{e.push(t)});return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(let e in this._runningEvents){let t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}let t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;let r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class P extends T{}class N{constructor(e,t,r){let n=null;"0x"!==(n="string"==typeof t?t:(0,u._t)(t)?(0,u.Dv)(t):t&&"string"==typeof t.object?t.object:"!").substring(0,2)&&(n="0x"+n),(!(0,u.A7)(n)||n.length%2)&&m.throwArgumentError("invalid bytecode","bytecode",t),r&&!a.E.isSigner(r)&&m.throwArgumentError("invalid signer","signer",r),(0,c.defineReadOnly)(this,"bytecode",n),(0,c.defineReadOnly)(this,"interface",(0,c.getStatic)(new.target,"getInterface")(e)),(0,c.defineReadOnly)(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){for(let r in t=(0,c.shallowCopy)(e.pop()))if(!g[r])throw Error("unknown transaction override "+r)}return["data","from","to"].forEach(e=>{null!=t[e]&&m.throwError("cannot override "+e,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:e})}),!t.value||l.O$.from(t.value).isZero()||this.interface.deploy.payable||m.throwError("non-payable constructor cannot override value",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value}),m.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=(0,u.Dv)((0,u.zo)([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return p(this,void 0,void 0,function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),m.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");let r=yield y(this.signer,e,this.interface.deploy.inputs);r.push(t);let n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),s=(0,c.getStatic)(this.constructor,"getContractAddress")(i),a=(0,c.getStatic)(this.constructor,"getContract")(s,this.interface,this.signer);return E(a,i),(0,c.defineReadOnly)(a,"deployTransaction",i),a})}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,t){null==e&&m.throwError("missing compiler output",d.Yd.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof e&&(e=JSON.parse(e));let r=e.abi,n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(r,n,t)}static getInterface(e){return P.getInterface(e)}static getContractAddress(e){return(0,o.CR)(e)}static getContract(e,t,r){return new P(e,t,r)}}}}]);