bringid 0.4.0-beta-rc.0 → 0.4.0-beta-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BringSDK=e():t.BringSDK=e()}(this,(function(){return function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{BringID:function(){return Oi}});var n={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let r;const i=new Uint8Array(16),s=[];for(let t=0;t<256;++t)s.push((t+256).toString(16).slice(1));function o(t,e,n){var o,a,c,u;const l=null!==(o=null!==(a=(t=t||{}).random)&&void 0!==a?a:null===(c=(u=t).rng)||void 0===c?void 0:c.call(u))&&void 0!==o?o:function(){if(!r){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(i)}();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=15&l[6]|64,l[8]=63&l[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError("UUID byte range ".concat(n,":").concat(n+15," is out of buffer bounds"));for(let t=0;t<16;++t)e[n+t]=l[t];return e}return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase()}(l)}var a=()=>{return!n.randomUUID||e||t?o(t,e,r):n.randomUUID();var t,e,r},c="zpka_52e44068bb9745f2be776b343e96cdab_1a60a93b",u="https://api.bringid.org";function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){f(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function f(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var p=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return fetch(t,{method:e,body:"GET"===e||"OPTIONS"===e?void 0:JSON.stringify(r),headers:h({},n)}).then((async t=>{if(!t.ok){const e=await t.json();throw new Error(e.error)}return t.json()}))},d=t=>p("".concat(u,"/v1/score/address/").concat(t),"GET",{Authorization:"Bearer ".concat(c),"content-type":"application/json"});const g=[{internalType:"uint256",name:"credentialGroupId",type:"uint256"},{internalType:"uint256",name:"appId",type:"uint256"},{components:[{internalType:"uint256",name:"merkleTreeDepth",type:"uint256"},{internalType:"uint256",name:"merkleTreeRoot",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"},{internalType:"uint256",name:"message",type:"uint256"},{internalType:"uint256",name:"scope",type:"uint256"},{internalType:"uint256[8]",name:"points",type:"uint256[8]"}],internalType:"struct ISemaphore.SemaphoreProof",name:"semaphoreProof",type:"tuple"}];var y=[{inputs:[{internalType:"uint256",name:"context_",type:"uint256"},{components:g,internalType:"struct ICredentialRegistry.CredentialGroupProof",name:"proof_",type:"tuple"}],name:"verifyProof",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"context_",type:"uint256"},{components:g,internalType:"struct ICredentialRegistry.CredentialGroupProof[]",name:"proofs_",type:"tuple[]"}],name:"verifyProofs",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"context_",type:"uint256"},{components:g,internalType:"struct ICredentialRegistry.CredentialGroupProof[]",name:"proofs_",type:"tuple[]"}],name:"getScore",outputs:[{internalType:"uint256",name:"_score",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"appId",type:"uint256"}],name:"apps",outputs:[{internalType:"enum ICredentialRegistry.AppStatus",name:"status",type:"uint8"},{internalType:"uint256",name:"recoveryTimelock",type:"uint256"},{internalType:"address",name:"admin",type:"address"},{internalType:"address",name:"scorer",type:"address"}],stateMutability:"view",type:"function"}],m=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3[]",name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}],b=[{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"getScore",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];function v(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Wrong positive integer: ".concat(t))}function w(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(t.length))throw new Error("Expected Uint8Array of length ".concat(n,", not of length=").concat(t.length))}function E(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const O=BigInt(2**32-1),P=BigInt(32);function N(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(t&O),l:Number(t>>P&O)}:{h:0|Number(t>>P&O),l:0|Number(t&O)}}function T(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=N(t[i],e);[n[i],r[i]]=[s,o]}return[n,r]}if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function k(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got ".concat(typeof t));return new Uint8Array((new TextEncoder).encode(t))}(t)),!(t instanceof Uint8Array))throw new Error("expected Uint8Array, got ".concat(typeof t));return t}class x{clone(){return this._cloneInto()}}const[R,A,_]=[[],[],[]],I=BigInt(0),U=BigInt(1),j=BigInt(2),S=BigInt(7),F=BigInt(256),C=BigInt(113);for(let t=0,e=U,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],R.push(2*(5*r+n)),A.push((t+1)*(t+2)/2%64);let i=I;for(let t=0;t<7;t++)e=(e<<U^(e>>S)*C)%F,e&j&&(i^=U<<(U<<BigInt(t))-U);_.push(i)}const[L,D]=T(_,!0),B=(t,e,n)=>n>32?((t,e,n)=>e<<n-32|t>>>64-n)(t,e,n):((t,e,n)=>t<<n|e>>>32-n)(t,e,n),M=(t,e,n)=>n>32?((t,e,n)=>t<<n-32|e>>>64-n)(t,e,n):((t,e,n)=>e<<n|t>>>32-n)(t,e,n);class G extends x{constructor(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,v(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,s=n[i],o=n[i+1],a=B(s,o,1)^n[r],c=M(s,o,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=c}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=A[n],s=B(e,i,r),o=M(e,i,r),a=R[n];e=t[a],i=t[a+1],t[a]=s,t[a+1]=o}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=L[r],t[1]^=D[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){E(this);const{blockLen:e,state:n}=this,r=(t=k(t)).length;for(let i=0;i<r;){const s=Math.min(e-this.pos,r-i);for(let e=0;e<s;e++)n[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,128&e&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){E(this,!1),w(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,i=t.length;r<i;){this.posOut>=n&&this.keccak();const s=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+s),r),this.posOut+=s,r+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return v(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(function(t,e){w(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least ".concat(n))}(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:s}=this;return t||(t=new G(e,n,r,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=s,t.destroyed=this.destroyed,t}}const V=((t,e,n)=>function(t){const e=e=>t().update(k(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}((()=>new G(e,t,n))))(1,136,32);function z(t,e,n){const r=e.split("|").map((t=>t.trim()));for(let n=0;n<r.length;n++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const i=new Error("invalid value for type ".concat(e));throw i.code="INVALID_ARGUMENT",i.argument="value.".concat(n),i.value=t,i}async function H(t){const e=Object.keys(t);return(await Promise.all(e.map((e=>Promise.resolve(t[e]))))).reduce(((t,n,r)=>(t[e[r]]=n,t)),{})}function J(t,e,n){for(let r in e){let i=e[r];const s=n?n[r]:null;s&&z(i,s,r),Object.defineProperty(t,r,{enumerable:!0,value:i,writable:!1})}}function K(t,e){if(null==t)return"null";if(null==e&&(e=new Set),"object"==typeof t){if(e.has(t))return"[Circular]";e.add(t)}if(Array.isArray(t))return"[ "+t.map((t=>K(t,e))).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[15&t[r]];return n}if("object"==typeof t&&"function"==typeof t.toJSON)return K(t.toJSON(),e);switch(typeof t){case"boolean":case"number":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const n=Object.keys(t);return n.sort(),"{ "+n.map((n=>"".concat(K(n,e),": ").concat(K(t[n],e)))).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function W(t,e){return t&&t.code===e}function q(t){return W(t,"CALL_EXCEPTION")}function $(t,e,n){let r,i=t;{const r=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error("value will overwrite populated values: ".concat(K(n)));for(const t in n){if("shortMessage"===t)continue;const e=n[t];r.push(t+"="+K(e))}}r.push("code=".concat(e)),r.push("version=".concat("6.16.0")),r.length&&(t+=" ("+r.join(", ")+")")}switch(e){case"INVALID_ARGUMENT":r=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(t);break;default:r=new Error(t)}return J(r,{code:e}),n&&Object.assign(r,n),null==r.shortMessage&&J(r,{shortMessage:i}),r}function X(t,e,n,r){if(!t)throw $(e,n,r)}function Y(t,e,n,r){X(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function Z(t,e,n){null==n&&(n=""),n&&(n=": "+n),X(t>=e,"missing argument"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),X(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const Q=["NFD","NFC","NFKD","NFKC"].reduce(((t,e)=>{try{if("test"!=="test".normalize(e))throw new Error("bad");if("NFD"===e){if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken")}t.push(e)}catch(t){}return t}),[]);function tt(t,e,n){if(null==n&&(n=""),t!==e){let t=n,e="new";n&&(t+=".",e+=" "+n),X(!1,"private constructor; use ".concat(t,"from* methods"),"UNSUPPORTED_OPERATION",{operation:e})}}function et(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if("string"==typeof t&&t.length%2==0&&t.match(/^0x[0-9a-f]*$/i)){const e=new Uint8Array((t.length-2)/2);let n=2;for(let r=0;r<e.length;r++)e[r]=parseInt(t.substring(n,n+2),16),n+=2;return e}Y(!1,"invalid BytesLike value",e||"value",t)}function nt(t,e){return et(t,e,!1)}function rt(t,e){return et(t,e,!0)}function it(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||"number"==typeof e&&t.length!==2+2*e||!0===e&&t.length%2!=0)}const st="0123456789abcdef";function ot(t){const e=nt(t);let n="0x";for(let t=0;t<e.length;t++){const r=e[t];n+=st[(240&r)>>4]+st[15&r]}return n}function at(t){return"0x"+t.map((t=>ot(t).substring(2))).join("")}function ct(t,e,n){const r=nt(t);return null!=n&&n>r.length&&X(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),ot(r.slice(null==e?0:e,null==n?r.length:n))}function ut(t,e,n){const r=nt(t);X(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),n?i.set(r,e-r.length):i.set(r,0),ot(i)}let lt=!1;const ht=function(t){return V(t)};let ft=ht;function pt(t){const e=nt(t,"data");return ot(ft(e))}function dt(t,e,n,r,i){if("BAD_PREFIX"===t||"UNEXPECTED_CONTINUE"===t){let t=0;for(let r=e+1;r<n.length&&n[r]>>6==2;r++)t++;return t}return"OVERRUN"===t?n.length-e-1:0}pt._=ht,pt.lock=function(){lt=!0},pt.register=function(t){if(lt)throw new TypeError("keccak256 is locked");ft=t},Object.freeze(pt);const gt=Object.freeze({error:function(t,e,n,r,i){Y(!1,"invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",n)},ignore:dt,replace:function(t,e,n,r,i){return"OVERLONG"===t?(Y("number"==typeof i,"invalid bad code point for replacement","badCodepoint",i),r.push(i),0):(r.push(65533),dt(t,e,n))}});function yt(t,e){Y("string"==typeof t,"invalid string value","str",t),null!=e&&(function(t){X(Q.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}(e),t=t.normalize(e));let n=[];for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);Y(e<t.length&&56320==(64512&i),"invalid surrogate pair","str",t);const s=65536+((1023&r)<<10)+(1023&i);n.push(s>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return new Uint8Array(n)}function mt(t,e){return function(t,e){null==e&&(e=gt.error);const n=nt(t,"bytes"),r=[];let i=0;for(;i<n.length;){const t=n[i++];if(!(t>>7)){r.push(t);continue}let s=null,o=null;if(192==(224&t))s=1,o=127;else if(224==(240&t))s=2,o=2047;else{if(240!=(248&t)){i+=e(128==(192&t)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",i-1,n,r);continue}s=3,o=65535}if(i-1+s>=n.length){i+=e("OVERRUN",i-1,n,r);continue}let a=t&(1<<8-s-1)-1;for(let t=0;t<s;t++){let t=n[i];if(128!=(192&t)){i+=e("MISSING_CONTINUE",i,n,r),a=null;break}a=a<<6|63&t,i++}null!==a&&(a>1114111?i+=e("OUT_OF_RANGE",i-1-s,n,r,a):a>=55296&&a<=57343?i+=e("UTF16_SURROGATE",i-1-s,n,r,a):a<=o?i+=e("OVERLONG",i-1-s,n,r,a):r.push(a))}return r}(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function bt(t){return pt(yt(t))}const vt=BigInt(0),wt=BigInt(1),Et=9007199254740991;function Ot(t,e){const n=Nt(t,"value"),r=BigInt(xt(e,"bits"));return n&(wt<<r)-wt}function Pt(t,e){switch(typeof t){case"bigint":return t;case"number":return Y(Number.isInteger(t),"underflow",e||"value",t),Y(t>=-Et&&t<=Et,"overflow",e||"value",t),BigInt(t);case"string":try{if(""===t)throw new Error("empty string");return"-"===t[0]&&"-"!==t[1]?-BigInt(t.substring(1)):BigInt(t)}catch(n){Y(!1,"invalid BigNumberish string: ".concat(n.message),e||"value",t)}}Y(!1,"invalid BigNumberish value",e||"value",t)}function Nt(t,e){const n=Pt(t,e);return X(n>=vt,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const Tt="0123456789abcdef";function kt(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=Tt[n>>4],e+=Tt[15&n];return BigInt(e)}return Pt(t)}function xt(t,e){switch(typeof t){case"bigint":return Y(t>=-Et&&t<=Et,"overflow",e||"value",t),Number(t);case"number":return Y(Number.isInteger(t),"underflow",e||"value",t),Y(t>=-Et&&t<=Et,"overflow",e||"value",t),t;case"string":try{if(""===t)throw new Error("empty string");return xt(BigInt(t),e)}catch(n){Y(!1,"invalid numeric string: ".concat(n.message),e||"value",t)}}Y(!1,"invalid numeric value",e||"value",t)}function Rt(t,e){const n=Nt(t,"value");let r=n.toString(16);if(null==e)r.length%2&&(r="0"+r);else{const i=xt(e,"width");if(0===i&&n===vt)return"0x";for(X(2*i>=r.length,"value exceeds width (".concat(i," bytes)"),"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<2*i;)r="0"+r}return"0x"+r}function At(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var _t=0;function It(t){return"__private_"+_t+++"_"+t}const Ut=32,jt=new Uint8Array(Ut),St=["then"],Ft={},Ct=new WeakMap;function Lt(t){return Ct.get(t)}function Dt(t,e){Ct.set(t,e)}function Bt(t,e){const n=new Error("deferred error during ABI decoding triggered accessing ".concat(t));throw n.error=e,n}function Mt(t,e,n){return t.indexOf(null)>=0?e.map(((t,e)=>t instanceof Vt?Mt(Lt(t),t,n):t)):t.reduce(((t,r,i)=>{let s=e.getValue(r);return r in t||(n&&s instanceof Vt&&(s=Mt(Lt(s),s,n)),t[r]=s),t}),{})}var Gt=It("names");class Vt extends Array{constructor(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];const r=e[0];let i=e[1],s=(e[2]||[]).slice(),o=!0;r!==Ft&&(i=e,s=[],o=!1),super(i.length),Object.defineProperty(this,Gt,{writable:!0,value:void 0}),i.forEach(((t,e)=>{this[e]=t}));const a=s.reduce(((t,e)=>("string"==typeof e&&t.set(e,(t.get(e)||0)+1),t)),new Map);if(Dt(this,Object.freeze(i.map(((t,e)=>{const n=s[e];return null!=n&&1===a.get(n)?n:null})))),At(this,Gt)[Gt]=[],null==At(this,Gt)[Gt]&&At(this,Gt)[Gt],!o)return;Object.freeze(this);const c=new Proxy(this,{get:(t,e,n)=>{if("string"==typeof e){if(e.match(/^[0-9]+$/)){const n=xt(e,"%index");if(n<0||n>=this.length)throw new RangeError("out of result range");const r=t[n];return r instanceof Error&&Bt("index ".concat(n),r),r}if(St.indexOf(e)>=0)return Reflect.get(t,e,n);const r=t[e];if(r instanceof Function)return function(){for(var e=arguments.length,i=new Array(e),s=0;s<e;s++)i[s]=arguments[s];return r.apply(this===n?t:this,i)};if(!(e in t))return t.getValue.apply(this===n?t:this,[e])}return Reflect.get(t,e,n)}});return Dt(c,Lt(this)),c}toArray(t){const e=[];return this.forEach(((n,r)=>{n instanceof Error&&Bt("index ".concat(r),n),t&&n instanceof Vt&&(n=n.toArray(t)),e.push(n)})),e}toObject(t){const e=Lt(this);return e.reduce(((n,r,i)=>(X(null!=r,"value at index ".concat(i," unnamed"),"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Mt(e,this,t))),{})}slice(t,e){null==t&&(t=0),t<0&&(t+=this.length)<0&&(t=0),null==e&&(e=this.length),e<0&&(e+=this.length)<0&&(e=0),e>this.length&&(e=this.length);const n=Lt(this),r=[],i=[];for(let s=t;s<e;s++)r.push(this[s]),i.push(n[s]);return new Vt(Ft,r,i)}filter(t,e){const n=Lt(this),r=[],i=[];for(let s=0;s<this.length;s++){const o=this[s];o instanceof Error&&Bt("index ".concat(s),o),t.call(e,o,s,this)&&(r.push(o),i.push(n[s]))}return new Vt(Ft,r,i)}map(t,e){const n=[];for(let r=0;r<this.length;r++){const i=this[r];i instanceof Error&&Bt("index ".concat(r),i),n.push(t.call(e,i,r,this))}return n}getValue(t){const e=Lt(this).indexOf(t);if(-1===e)return;const n=this[e];return n instanceof Error&&Bt("property ".concat(JSON.stringify(t)),n.error),n}static fromItems(t,e){return new Vt(Ft,t,e)}}function zt(t){let e=function(t,e){const n=Nt(t,"value");if(n===vt){const t=null!=e?xt(e,"width"):0;return new Uint8Array(t)}let r=n.toString(16);if(r.length%2&&(r="0"+r),null!=e){const n=xt(e,"width");for(;r.length<2*n;)r="00"+r;X(2*n===r.length,"value exceeds width (".concat(n," bytes)"),"NUMERIC_FAULT",{operation:"toBeArray",fault:"overflow",value:t})}const i=new Uint8Array(r.length/2);for(let t=0;t<i.length;t++){const e=2*t;i[t]=parseInt(r.substring(e,e+2),16)}return i}(t);return X(e.length<=Ut,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Ut,offset:e.length}),e.length!==Ut&&(e=rt(at([jt.slice(e.length%Ut),e]))),e}class Ht{constructor(t,e,n,r){this.name=void 0,this.type=void 0,this.localName=void 0,this.dynamic=void 0,J(this,{name:t,type:e,localName:n,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){Y(!1,t,this.localName,e)}}var Jt=It("data"),Kt=It("dataLength"),Wt=It("writeData");class qt{constructor(){Object.defineProperty(this,Wt,{value:$t}),Object.defineProperty(this,Jt,{writable:!0,value:void 0}),Object.defineProperty(this,Kt,{writable:!0,value:void 0}),At(this,Jt)[Jt]=[],At(this,Kt)[Kt]=0}get data(){return at(At(this,Jt)[Jt])}get length(){return At(this,Kt)[Kt]}appendWriter(t){return At(this,Wt)[Wt](rt(t.data))}writeBytes(t){let e=rt(t);const n=e.length%Ut;return n&&(e=rt(at([e,jt.slice(n)]))),At(this,Wt)[Wt](e)}writeValue(t){return At(this,Wt)[Wt](zt(t))}writeUpdatableValue(){const t=At(this,Jt)[Jt].length;return At(this,Jt)[Jt].push(jt),At(this,Kt)[Kt]+=Ut,e=>{At(this,Jt)[Jt][t]=zt(e)}}}function $t(t){return At(this,Jt)[Jt].push(t),At(this,Kt)[Kt]+=t.length,t.length}var Xt=It("data"),Yt=It("offset"),Zt=It("bytesRead"),Qt=It("parent"),te=It("maxInflation"),ee=It("incrementBytesRead"),ne=It("peekBytes");class re{constructor(t,e,n){Object.defineProperty(this,ne,{value:se}),Object.defineProperty(this,ee,{value:ie}),this.allowLoose=void 0,Object.defineProperty(this,Xt,{writable:!0,value:void 0}),Object.defineProperty(this,Yt,{writable:!0,value:void 0}),Object.defineProperty(this,Zt,{writable:!0,value:void 0}),Object.defineProperty(this,Qt,{writable:!0,value:void 0}),Object.defineProperty(this,te,{writable:!0,value:void 0}),J(this,{allowLoose:!!e}),At(this,Xt)[Xt]=rt(t),At(this,Zt)[Zt]=0,At(this,Qt)[Qt]=null,At(this,te)[te]=null!=n?n:1024,At(this,Yt)[Yt]=0}get data(){return ot(At(this,Xt)[Xt])}get dataLength(){return At(this,Xt)[Xt].length}get consumed(){return At(this,Yt)[Yt]}get bytes(){return new Uint8Array(At(this,Xt)[Xt])}subReader(t){const e=new re(At(this,Xt)[Xt].slice(At(this,Yt)[Yt]+t),this.allowLoose,At(this,te)[te]);return At(e,Qt)[Qt]=this,e}readBytes(t,e){let n=At(this,ne)[ne](0,t,!!e);return At(this,ee)[ee](t),At(this,Yt)[Yt]+=n.length,n.slice(0,t)}readValue(){return kt(this.readBytes(Ut))}readIndex(){return xt(kt(this.readBytes(Ut)))}}function ie(t){if(At(this,Qt)[Qt])return At(At(this,Qt)[Qt],ee)[ee](t);At(this,Zt)[Zt]+=t,X(At(this,te)[te]<1||At(this,Zt)[Zt]<=At(this,te)[te]*this.dataLength,"compressed ABI data exceeds inflation ratio of ".concat(At(this,te)[te]," ( see: https://github.com/ethers-io/ethers.js/issues/4537 )"),"BUFFER_OVERRUN",{buffer:rt(At(this,Xt)[Xt]),offset:At(this,Yt)[Yt],length:t,info:{bytesRead:At(this,Zt)[Zt],dataLength:this.dataLength}})}function se(t,e,n){let r=Math.ceil(e/Ut)*Ut;return At(this,Yt)[Yt]+r>At(this,Xt)[Xt].length&&(this.allowLoose&&n&&At(this,Yt)[Yt]+e<=At(this,Xt)[Xt].length?r=e:X(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:rt(At(this,Xt)[Xt]),length:At(this,Xt)[Xt].length,offset:At(this,Yt)[Yt]+r})),At(this,Xt)[Xt].slice(At(this,Yt)[Yt],At(this,Yt)[Yt]+r)}const oe=BigInt(0),ae=BigInt(36);function ce(t){const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=nt(pt(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const ue={};for(let t=0;t<10;t++)ue[String(t)]=String(t);for(let t=0;t<26;t++)ue[String.fromCharCode(65+t)]=String(10+t);const le=function(){const t={};for(let e=0;e<36;e++)t["0123456789abcdefghijklmnopqrstuvwxyz"[e]]=BigInt(e);return t}();function he(t){if(Y("string"==typeof t,"invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=ce(t);return Y(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){Y(t.substring(2,4)===function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>ue[t])).join("");for(;e.length>=15;){let t=e.substring(0,15);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t),"bad icap checksum","address",t);let e=function(t){t=t.toLowerCase();let e=oe;for(let n=0;n<t.length;n++)e=e*ae+le[t[n]];return e}(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return ce("0x"+e)}Y(!1,"invalid address","address",t)}function fe(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var pe=0;function de(t){return"__private_"+pe+++"_"+t}const ge={};function ye(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new we(ge,"".concat(n?"":"u","int").concat(e),t,{signed:n,width:e})}function me(t,e){return new we(ge,"bytes".concat(e||""),t,{size:e})}const be=Symbol.for("_ethers_typed");var ve=de("options");class we{constructor(t,e,n,r){this.type=void 0,this.value=void 0,Object.defineProperty(this,ve,{writable:!0,value:void 0}),this._typedSymbol=void 0,null==r&&(r=null),tt(ge,t,"Typed"),J(this,{_typedSymbol:be,type:e,value:n}),fe(this,ve)[ve]=r,this.format()}format(){if("array"===this.type)throw new Error("");if("dynamicArray"===this.type)throw new Error("");return"tuple"===this.type?"tuple(".concat(this.value.map((t=>t.format())).join(","),")"):this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return fe(this,ve)[ve]}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===fe(this,ve)[ve]?-1:!1===fe(this,ve)[ve]?this.value.length:null}static from(t,e){return new we(ge,t,e)}static uint8(t){return ye(t,8)}static uint16(t){return ye(t,16)}static uint24(t){return ye(t,24)}static uint32(t){return ye(t,32)}static uint40(t){return ye(t,40)}static uint48(t){return ye(t,48)}static uint56(t){return ye(t,56)}static uint64(t){return ye(t,64)}static uint72(t){return ye(t,72)}static uint80(t){return ye(t,80)}static uint88(t){return ye(t,88)}static uint96(t){return ye(t,96)}static uint104(t){return ye(t,104)}static uint112(t){return ye(t,112)}static uint120(t){return ye(t,120)}static uint128(t){return ye(t,128)}static uint136(t){return ye(t,136)}static uint144(t){return ye(t,144)}static uint152(t){return ye(t,152)}static uint160(t){return ye(t,160)}static uint168(t){return ye(t,168)}static uint176(t){return ye(t,176)}static uint184(t){return ye(t,184)}static uint192(t){return ye(t,192)}static uint200(t){return ye(t,200)}static uint208(t){return ye(t,208)}static uint216(t){return ye(t,216)}static uint224(t){return ye(t,224)}static uint232(t){return ye(t,232)}static uint240(t){return ye(t,240)}static uint248(t){return ye(t,248)}static uint256(t){return ye(t,256)}static uint(t){return ye(t,256)}static int8(t){return ye(t,-8)}static int16(t){return ye(t,-16)}static int24(t){return ye(t,-24)}static int32(t){return ye(t,-32)}static int40(t){return ye(t,-40)}static int48(t){return ye(t,-48)}static int56(t){return ye(t,-56)}static int64(t){return ye(t,-64)}static int72(t){return ye(t,-72)}static int80(t){return ye(t,-80)}static int88(t){return ye(t,-88)}static int96(t){return ye(t,-96)}static int104(t){return ye(t,-104)}static int112(t){return ye(t,-112)}static int120(t){return ye(t,-120)}static int128(t){return ye(t,-128)}static int136(t){return ye(t,-136)}static int144(t){return ye(t,-144)}static int152(t){return ye(t,-152)}static int160(t){return ye(t,-160)}static int168(t){return ye(t,-168)}static int176(t){return ye(t,-176)}static int184(t){return ye(t,-184)}static int192(t){return ye(t,-192)}static int200(t){return ye(t,-200)}static int208(t){return ye(t,-208)}static int216(t){return ye(t,-216)}static int224(t){return ye(t,-224)}static int232(t){return ye(t,-232)}static int240(t){return ye(t,-240)}static int248(t){return ye(t,-248)}static int256(t){return ye(t,-256)}static int(t){return ye(t,-256)}static bytes1(t){return me(t,1)}static bytes2(t){return me(t,2)}static bytes3(t){return me(t,3)}static bytes4(t){return me(t,4)}static bytes5(t){return me(t,5)}static bytes6(t){return me(t,6)}static bytes7(t){return me(t,7)}static bytes8(t){return me(t,8)}static bytes9(t){return me(t,9)}static bytes10(t){return me(t,10)}static bytes11(t){return me(t,11)}static bytes12(t){return me(t,12)}static bytes13(t){return me(t,13)}static bytes14(t){return me(t,14)}static bytes15(t){return me(t,15)}static bytes16(t){return me(t,16)}static bytes17(t){return me(t,17)}static bytes18(t){return me(t,18)}static bytes19(t){return me(t,19)}static bytes20(t){return me(t,20)}static bytes21(t){return me(t,21)}static bytes22(t){return me(t,22)}static bytes23(t){return me(t,23)}static bytes24(t){return me(t,24)}static bytes25(t){return me(t,25)}static bytes26(t){return me(t,26)}static bytes27(t){return me(t,27)}static bytes28(t){return me(t,28)}static bytes29(t){return me(t,29)}static bytes30(t){return me(t,30)}static bytes31(t){return me(t,31)}static bytes32(t){return me(t,32)}static address(t){return new we(ge,"address",t)}static bool(t){return new we(ge,"bool",!!t)}static bytes(t){return new we(ge,"bytes",t)}static string(t){return new we(ge,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new we(ge,"overrides",Object.assign({},t))}static isTyped(t){return t&&"object"==typeof t&&"_typedSymbol"in t&&t._typedSymbol===be}static dereference(t,e){if(we.isTyped(t)){if(t.type!==e)throw new Error("invalid type: expecetd ".concat(e,", got ").concat(t.type));return t.value}return t}}class Ee extends Ht{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let n=we.dereference(e,"string");try{n=he(n)}catch(t){return this._throwError(t.message,e)}return t.writeValue(n)}decode(t){return he(Rt(t.readValue(),20))}}class Oe extends Ht{constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=void 0,this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}function Pe(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return X(r,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:e},value:n}),X(!t[r],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:e},value:n}),t[r]=!0,n[r]}))}else Y(!1,"invalid tuple value","tuple",n);Y(e.length===r.length,"types/value length mismatch","tuple",n);let i=new qt,s=new qt,o=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=s.length;t.encode(s,n);let r=i.writeUpdatableValue();o.push((t=>{r(t+e)}))}else t.encode(i,n)})),o.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function Ne(t,e){let n=[],r=[],i=t.subReader(0);return e.forEach((e=>{let s=null;if(e.dynamic){let n=t.readIndex(),r=i.subReader(n);try{s=e.decode(r)}catch(t){if(W(t,"BUFFER_OVERRUN"))throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}}else try{s=e.decode(t)}catch(t){if(W(t,"BUFFER_OVERRUN"))throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}if(null==s)throw new Error("investigate");n.push(s),r.push(e.localName||null)})),Vt.fromItems(n,r)}class Te extends Ht{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=void 0,this.length=void 0,J(this,{coder:t,length:e})}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;n<this.length;n++)e.push(t);return e}encode(t,e){const n=we.dereference(e,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;-1===r&&(r=n.length,t.writeValue(n.length)),Z(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let i=[];for(let t=0;t<n.length;t++)i.push(this.coder);return Pe(t,i,n)}decode(t){let e=this.length;-1===e&&(e=t.readIndex(),X(e*Ut<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*Ut,length:t.dataLength}));let n=[];for(let t=0;t<e;t++)n.push(new Oe(this.coder));return Ne(t,n)}}class ke extends Ht{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){const n=we.dereference(e,"bool");return t.writeValue(n?1:0)}decode(t){return!!t.readValue()}}class xe extends Ht{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=rt(e);let n=t.writeValue(e.length);return n+=t.writeBytes(e),n}decode(t){return t.readBytes(t.readIndex(),!0)}}class Re extends xe{constructor(t){super("bytes",t)}decode(t){return ot(super.decode(t))}}class Ae extends Ht{constructor(t,e){let n="bytes"+String(t);super(n,n,e,!1),this.size=void 0,J(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let n=rt(we.dereference(e,this.type));return n.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(n)}decode(t){return ot(t.readBytes(this.size))}}const _e=new Uint8Array([]);class Ie extends Ht{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes(_e)}decode(t){return t.readBytes(0),null}}const Ue=BigInt(0),je=BigInt(1),Se=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Fe extends Ht{constructor(t,e,n){const r=(e?"int":"uint")+8*t;super(r,r,n,!1),this.size=void 0,this.signed=void 0,J(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let n=Pt(we.dereference(e,this.type)),r=Ot(Se,256);if(this.signed){let t=Ot(r,8*this.size-1);(n>t||n<-(t+je))&&this._throwError("value out-of-bounds",e),n=function(t){let e=Pt(t,"value");const n=BigInt(xt(256,"width")),r=wt<<n-wt;return e<vt?(e=-e,X(e<=r,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t}),(~e&(wt<<n)-wt)+wt):(X(e<r,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t}),e)}(n)}else(n<Ue||n>Ot(r,8*this.size))&&this._throwError("value out-of-bounds",e);return t.writeValue(n)}decode(t){let e=Ot(t.readValue(),8*this.size);return this.signed&&(e=function(t,e){const n=Nt(t,"value"),r=BigInt(xt(e,"width"));return X(n>>r===vt,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-wt?-((~n&(wt<<r)-wt)+wt):n}(e,8*this.size)),e}}class Ce extends xe{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,yt(we.dereference(e,"string")))}decode(t){return mt(super.decode(t))}}class Le extends Ht{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)})),super("tuple","tuple("+r.join(",")+")",e,n),this.coders=void 0,J(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){const n=we.dereference(e,"tuple");return Pe(t,this.coders,n)}decode(t){return Ne(t,this.coders)}}var De;function Be(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Me=0;function Ge(t){return"__private_"+Me+++"_"+t}function Ve(t){const e=new Set;return t.forEach((t=>e.add(t))),Object.freeze(e)}const ze=Ve("external public payable override".split(" ")),He="constant external internal payable private public pure view override",Je=Ve(He.split(" ")),Ke="constructor error event fallback function receive struct",We=Ve(Ke.split(" ")),qe="calldata memory storage payable indexed",$e=Ve(qe.split(" ")),Xe=Ve([Ke,qe,"tuple returns",He].join(" ").split(" ")),Ye={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Ze=new RegExp("^(\\s*)"),Qe=new RegExp("^([0-9]+)"),tn=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),en=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),nn=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var rn=Ge("offset"),sn=Ge("tokens"),on=Ge("subTokenString");class an{get offset(){return Be(this,rn)[rn]}get length(){return Be(this,sn)[sn].length-Be(this,rn)[rn]}constructor(t){Object.defineProperty(this,on,{value:cn}),Object.defineProperty(this,rn,{writable:!0,value:void 0}),Object.defineProperty(this,sn,{writable:!0,value:void 0}),Be(this,rn)[rn]=0,Be(this,sn)[sn]=t.slice()}clone(){return new an(Be(this,sn)[sn])}reset(){Be(this,rn)[rn]=0}popKeyword(t){const e=this.peek();if("KEYWORD"!==e.type||!t.has(e.text))throw new Error("expected keyword ".concat(e.text));return this.pop().text}popType(t){if(this.peek().type!==t){const e=this.peek();throw new Error("expected ".concat(t,"; got ").concat(e.type," ").concat(JSON.stringify(e.text)))}return this.pop().text}popParen(){const t=this.peek();if("OPEN_PAREN"!==t.type)throw new Error("bad start");const e=Be(this,on)[on](Be(this,rn)[rn]+1,t.match+1);return Be(this,rn)[rn]=t.match+1,e}popParams(){const t=this.peek();if("OPEN_PAREN"!==t.type)throw new Error("bad start");const e=[];for(;Be(this,rn)[rn]<t.match-1;){const t=this.peek().linkNext;e.push(Be(this,on)[on](Be(this,rn)[rn]+1,t)),Be(this,rn)[rn]=t}return Be(this,rn)[rn]=t.match+1,e}peek(){if(Be(this,rn)[rn]>=Be(this,sn)[sn].length)throw new Error("out-of-bounds");return Be(this,sn)[sn][Be(this,rn)[rn]]}peekKeyword(t){const e=this.peekType("KEYWORD");return null!=e&&t.has(e)?e:null}peekType(t){if(0===this.length)return null;const e=this.peek();return e.type===t?e.text:null}pop(){const t=this.peek();return Be(this,rn)[rn]++,t}toString(){const t=[];for(let e=Be(this,rn)[rn];e<Be(this,sn)[sn].length;e++){const n=Be(this,sn)[sn][e];t.push("".concat(n.type,":").concat(n.text))}return"<TokenString ".concat(t.join(" "),">")}}function cn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new De(Be(this,sn)[sn].slice(t,e).map((e=>Object.freeze(Object.assign({},e,{match:e.match-t,linkBack:e.linkBack-t,linkNext:e.linkNext-t})))))}function un(t){const e=[],n=e=>{const n=s<t.length?JSON.stringify(t[s]):"$EOI";throw new Error("invalid token ".concat(n," at ").concat(s,": ").concat(e))};let r=[],i=[],s=0;for(;s<t.length;){let o=t.substring(s),a=o.match(Ze);a&&(s+=a[1].length,o=t.substring(s));const c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};e.push(c);let u=Ye[o[0]]||"";if(u){if(c.type=u,c.text=o[0],s++,"OPEN_PAREN"===u)r.push(e.length-1),i.push(e.length-1);else if("CLOSE_PAREN"==u)0===r.length&&n("no matching open bracket"),c.match=r.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=i.pop(),e[c.linkBack].linkNext=e.length-1;else if("COMMA"===u)c.linkBack=i.pop(),e[c.linkBack].linkNext=e.length-1,i.push(e.length-1);else if("OPEN_BRACKET"===u)c.type="BRACKET";else if("CLOSE_BRACKET"===u){let t=e.pop().text;if(e.length>0&&"NUMBER"===e[e.length-1].type){const n=e.pop().text;t=n+t,e[e.length-1].value=xt(n)}if(0===e.length||"BRACKET"!==e[e.length-1].type)throw new Error("missing opening bracket");e[e.length-1].text+=t}}else if(a=o.match(tn),a){if(c.text=a[1],s+=c.text.length,Xe.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(nn)){c.type="TYPE";continue}c.type="ID"}else{if(a=o.match(Qe),!a)throw new Error("unexpected token ".concat(JSON.stringify(o[0])," at position ").concat(s));c.text=a[1],c.type="NUMBER",s+=c.text.length}}return new an(e.map((t=>Object.freeze(t))))}function ln(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error("conflicting types: ".concat(n.join(", ")))}function hn(t,e){if(e.peekKeyword(We)){const n=e.pop().text;if(n!==t)throw new Error("expected ".concat(t,", got ").concat(n))}return e.popType("ID")}function fn(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(null==r||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error("duplicate keywords: ".concat(JSON.stringify(r)));n.add(r)}return Object.freeze(n)}function pn(t){let e=fn(t,Je);return ln(e,Ve("constant payable nonpayable".split(" "))),ln(e,Ve("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function dn(t,e){return t.popParams().map((t=>An.from(t,e)))}function gn(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Pt(t.pop().text);throw new Error("invalid gas")}return null}function yn(t){if(t.length)throw new Error("unexpected tokens at offset ".concat(t.offset,": ").concat(t.toString()))}De=an;const mn=new RegExp(/^(.*)\[([0-9]*)\]$/);function bn(t){const e=t.match(nn);if(Y(e,"invalid type","type",t),"uint"===t)return"uint256";if("int"===t)return"int256";if(e[2]){const n=parseInt(e[2]);Y(0!==n&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);Y(0!==n&&n<=256&&n%8==0,"invalid numeric width","type",t)}return t}const vn={},wn=Symbol.for("_ethers_internal"),En="_ParamTypeInternal",On="_ErrorInternal",Pn="_EventInternal",Nn="_ConstructorInternal",Tn="_FallbackInternal",kn="_FunctionInternal",xn="_StructInternal";var Rn=Ge("walkAsync");class An{constructor(t,e,n,r,i,s,o,a){if(Object.defineProperty(this,Rn,{value:_n}),this.name=void 0,this.type=void 0,this.baseType=void 0,this.indexed=void 0,this.components=void 0,this.arrayLength=void 0,this.arrayChildren=void 0,tt(t,vn,"ParamType"),Object.defineProperty(this,wn,{value:En}),s&&(s=Object.freeze(s.slice())),"array"===r){if(null==o||null==a)throw new Error("")}else if(null!=o||null!=a)throw new Error("");if("tuple"===r){if(null==s)throw new Error("")}else if(null!=s)throw new Error("");J(this,{name:e,type:n,baseType:r,indexed:i,components:s,arrayLength:o,arrayChildren:a})}format(t){if(null==t&&(t="sighash"),"json"===t){const e=this.name||"";if(this.isArray()){const t=JSON.parse(this.arrayChildren.format("json"));return t.name=e,t.type+="[".concat(this.arrayLength<0?"":String(this.arrayLength),"]"),JSON.stringify(t)}const n={type:"tuple"===this.baseType?"tuple":this.type,name:e};return"boolean"==typeof this.indexed&&(n.indexed=this.indexed),this.isTuple()&&(n.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(n)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+="[".concat(this.arrayLength<0?"":String(this.arrayLength),"]")):this.isTuple()?e+="("+this.components.map((e=>e.format(t))).join("full"===t?", ":",")+")":e+=this.type,"sighash"!==t&&(!0===this.indexed&&(e+=" indexed"),"full"===t&&this.name&&(e+=" "+this.name)),e}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(-1!==this.arrayLength&&t.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return t.map((t=>n.arrayChildren.walk(t,e)))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");const n=this;return t.map(((t,r)=>n.components[r].walk(t,e)))}return e(this.type,t)}async walkAsync(t,e){const n=[],r=[t];return Be(this,Rn)[Rn](n,t,e,(t=>{r[0]=t})),n.length&&await Promise.all(n),r[0]}static from(t,e){if(An.isParamType(t))return t;if("string"==typeof t)try{return An.from(un(t),e)}catch(e){Y(!1,"invalid param type","obj",t)}else if(t instanceof an){let n="",r="",i=null;fn(t,Ve(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(r="tuple",i=t.popParams().map((t=>An.from(t))),n="tuple(".concat(i.map((t=>t.format())).join(","),")")):(n=bn(t.popType("TYPE")),r=n);let s=null,o=null;for(;t.length&&t.peekType("BRACKET");){const e=t.pop();s=new An(vn,"",n,r,null,i,o,s),o=e.value,n+=e.text,r="array",i=null}let a=null;if(fn(t,$e).has("indexed")){if(!e)throw new Error("");a=!0}const c=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new An(vn,c,n,r,a,i,o,s)}const n=t.name;Y(!n||"string"==typeof n&&n.match(en),"invalid name","obj.name",n);let r=t.indexed;null!=r&&(Y(e,"parameter cannot be indexed","obj.indexed",t.indexed),r=!!r);let i=t.type,s=i.match(mn);if(s){const e=parseInt(s[2]||"-1"),o=An.from({type:s[1],components:t.components});return new An(vn,n||"",i,"array",r,null,e,o)}if("tuple"===i||i.startsWith("tuple(")||i.startsWith("(")){const e=null!=t.components?t.components.map((t=>An.from(t))):null;return new An(vn,n||"",i,"tuple",r,e,null,null)}return i=bn(t.type),new An(vn,n||"",i,i,r,null,null,null)}static isParamType(t){return t&&t[wn]===En}}function _n(t,e,n,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const i=this.arrayChildren,s=e.slice();return s.forEach(((e,r)=>{Be(i,Rn)[Rn](t,e,n,(t=>{s[r]=t}))})),void r(s)}if(this.isTuple()){const i=this.components;let s;if(Array.isArray(e))s=e.slice();else{if(null==e||"object"!=typeof e)throw new Error("invalid tuple value");s=i.map((t=>{if(!t.name)throw new Error("cannot use object value with unnamed components");if(!(t.name in e))throw new Error("missing value for component ".concat(t.name));return e[t.name]}))}if(s.length!==this.components.length)throw new Error("array is wrong length");return s.forEach(((e,r)=>{Be(i[r],Rn)[Rn](t,e,n,(t=>{s[r]=t}))})),void r(s)}const i=n(this.type,e);i.then?t.push(async function(){r(await i)}()):r(i)}class In{constructor(t,e,n){this.type=void 0,this.inputs=void 0,tt(t,vn,"Fragment"),J(this,{type:e,inputs:n=Object.freeze(n.slice())})}static from(t){if("string"==typeof t){try{In.from(JSON.parse(t))}catch(t){}return In.from(un(t))}if(t instanceof an)switch(t.peekKeyword(We)){case"constructor":return Cn.from(t);case"error":return Sn.from(t);case"event":return Fn.from(t);case"fallback":case"receive":return Ln.from(t);case"function":return Dn.from(t);case"struct":return Bn.from(t)}else if("object"==typeof t){switch(t.type){case"constructor":return Cn.from(t);case"error":return Sn.from(t);case"event":return Fn.from(t);case"fallback":case"receive":return Ln.from(t);case"function":return Dn.from(t);case"struct":return Bn.from(t)}X(!1,"unsupported type: ".concat(t.type),"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}Y(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return Cn.isFragment(t)}static isError(t){return Sn.isFragment(t)}static isEvent(t){return Fn.isFragment(t)}static isFunction(t){return Dn.isFragment(t)}static isStruct(t){return Bn.isFragment(t)}}class Un extends In{constructor(t,e,n,r){super(t,e,r),this.name=void 0,Y("string"==typeof n&&n.match(en),"invalid identifier","name",n),r=Object.freeze(r.slice()),J(this,{name:n})}}function jn(t,e){return"("+e.map((e=>e.format(t))).join("full"===t?", ":",")+")"}class Sn extends Un{constructor(t,e,n){super(t,"error",e,n),Object.defineProperty(this,wn,{value:On})}get selector(){return bt(this.format("sighash")).substring(0,10)}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("error"),e.push(this.name+jn(t,this.inputs)),e.join(" ")}static from(t){if(Sn.isFragment(t))return t;if("string"==typeof t)return Sn.from(un(t));if(t instanceof an){const e=hn("error",t),n=dn(t);return yn(t),new Sn(vn,e,n)}return new Sn(vn,t.name,t.inputs?t.inputs.map(An.from):[])}static isFragment(t){return t&&t[wn]===On}}class Fn extends Un{constructor(t,e,n,r){super(t,"event",e,n),this.anonymous=void 0,Object.defineProperty(this,wn,{value:Pn}),J(this,{anonymous:r})}get topicHash(){return bt(this.format("sighash"))}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("event"),e.push(this.name+jn(t,this.inputs)),"sighash"!==t&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map((t=>An.from(t))),new Fn(vn,t,e,!1).topicHash}static from(t){if(Fn.isFragment(t))return t;if("string"==typeof t)try{return Fn.from(un(t))}catch(e){Y(!1,"invalid event fragment","obj",t)}else if(t instanceof an){const e=hn("event",t),n=dn(t,!0),r=!!fn(t,Ve(["anonymous"])).has("anonymous");return yn(t),new Fn(vn,e,n,r)}return new Fn(vn,t.name,t.inputs?t.inputs.map((t=>An.from(t,!0))):[],!!t.anonymous)}static isFragment(t){return t&&t[wn]===Pn}}class Cn extends In{constructor(t,e,n,r,i){super(t,e,n),this.payable=void 0,this.gas=void 0,Object.defineProperty(this,wn,{value:Nn}),J(this,{payable:r,gas:i})}format(t){if(X(null!=t&&"sighash"!==t,"cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),"json"===t)return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=["constructor".concat(jn(t,this.inputs))];return this.payable&&e.push("payable"),null!=this.gas&&e.push("@".concat(this.gas.toString())),e.join(" ")}static from(t){if(Cn.isFragment(t))return t;if("string"==typeof t)try{return Cn.from(un(t))}catch(e){Y(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof an){fn(t,Ve(["constructor"]));const e=dn(t),n=!!fn(t,ze).has("payable"),r=gn(t);return yn(t),new Cn(vn,"constructor",e,n,r)}return new Cn(vn,"constructor",t.inputs?t.inputs.map(An.from):[],!!t.payable,null!=t.gas?t.gas:null)}static isFragment(t){return t&&t[wn]===Nn}}class Ln extends In{constructor(t,e,n){super(t,"fallback",e),this.payable=void 0,Object.defineProperty(this,wn,{value:Tn}),J(this,{payable:n})}format(t){const e=0===this.inputs.length?"receive":"fallback";if("json"===t){const t=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:t})}return"".concat(e,"()").concat(this.payable?" payable":"")}static from(t){if(Ln.isFragment(t))return t;if("string"==typeof t)try{return Ln.from(un(t))}catch(e){Y(!1,"invalid fallback fragment","obj",t)}else if(t instanceof an){const e=t.toString();if(Y(t.peekKeyword(Ve(["fallback","receive"])),"type must be fallback or receive","obj",e),"receive"===t.popKeyword(Ve(["fallback","receive"]))){const e=dn(t);return Y(0===e.length,"receive cannot have arguments","obj.inputs",e),fn(t,Ve(["payable"])),yn(t),new Ln(vn,[],!0)}let n=dn(t);n.length?Y(1===n.length&&"bytes"===n[0].type,"invalid fallback inputs","obj.inputs",n.map((t=>t.format("minimal"))).join(", ")):n=[An.from("bytes")];const r=pn(t);if(Y("nonpayable"===r||"payable"===r,"fallback cannot be constants","obj.stateMutability",r),fn(t,Ve(["returns"])).has("returns")){const e=dn(t);Y(1===e.length&&"bytes"===e[0].type,"invalid fallback outputs","obj.outputs",e.map((t=>t.format("minimal"))).join(", "))}return yn(t),new Ln(vn,n,"payable"===r)}if("receive"===t.type)return new Ln(vn,[],!0);if("fallback"===t.type){const e=[An.from("bytes")],n="payable"===t.stateMutability;return new Ln(vn,e,n)}Y(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[wn]===Tn}}class Dn extends Un{constructor(t,e,n,r,i,s){super(t,"function",e,r),this.constant=void 0,this.outputs=void 0,this.stateMutability=void 0,this.payable=void 0,this.gas=void 0,Object.defineProperty(this,wn,{value:kn}),J(this,{constant:"view"===n||"pure"===n,gas:s,outputs:i=Object.freeze(i.slice()),payable:"payable"===n,stateMutability:n})}get selector(){return bt(this.format("sighash")).substring(0,10)}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("function"),e.push(this.name+jn(t,this.inputs)),"sighash"!==t&&("nonpayable"!==this.stateMutability&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(jn(t,this.outputs))),null!=this.gas&&e.push("@".concat(this.gas.toString()))),e.join(" ")}static getSelector(t,e){return e=(e||[]).map((t=>An.from(t))),new Dn(vn,t,"view",e,[],null).selector}static from(t){if(Dn.isFragment(t))return t;if("string"==typeof t)try{return Dn.from(un(t))}catch(e){Y(!1,"invalid function fragment","obj",t)}else if(t instanceof an){const e=hn("function",t),n=dn(t),r=pn(t);let i=[];fn(t,Ve(["returns"])).has("returns")&&(i=dn(t));const s=gn(t);return yn(t),new Dn(vn,e,r,n,i,s)}let e=t.stateMutability;return null==e&&(e="payable","boolean"==typeof t.constant?(e="view",t.constant||(e="payable","boolean"!=typeof t.payable||t.payable||(e="nonpayable"))):"boolean"!=typeof t.payable||t.payable||(e="nonpayable")),new Dn(vn,t.name,e,t.inputs?t.inputs.map(An.from):[],t.outputs?t.outputs.map(An.from):[],null!=t.gas?t.gas:null)}static isFragment(t){return t&&t[wn]===kn}}class Bn extends Un{constructor(t,e,n){super(t,"struct",e,n),Object.defineProperty(this,wn,{value:xn})}format(){throw new Error("@TODO")}static from(t){if("string"==typeof t)try{return Bn.from(un(t))}catch(e){Y(!1,"invalid struct fragment","obj",t)}else if(t instanceof an){const e=hn("struct",t),n=dn(t);return yn(t),new Bn(vn,e,n)}return new Bn(vn,t.name,t.inputs?t.inputs.map(An.from):[])}static isFragment(t){return t&&t[wn]===xn}}function Mn(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Gn=0;function Vn(t){return"__private_"+Gn+++"_"+t}const zn=new Map;zn.set(0,"GENERIC_PANIC"),zn.set(1,"ASSERT_FALSE"),zn.set(17,"OVERFLOW"),zn.set(18,"DIVIDE_BY_ZERO"),zn.set(33,"ENUM_RANGE_ERROR"),zn.set(34,"BAD_STORAGE_DATA"),zn.set(49,"STACK_UNDERFLOW"),zn.set(50,"ARRAY_RANGE_ERROR"),zn.set(65,"OUT_OF_MEMORY"),zn.set(81,"UNINITIALIZED_FUNCTION_CALL");const Hn=new RegExp(/^bytes([0-9]*)$/),Jn=new RegExp(/^(u?int)([0-9]*)$/);let Kn=null,Wn=1024;var qn=Vn("getCoder");class $n{constructor(){Object.defineProperty(this,qn,{value:Xn})}getDefaultValue(t){const e=t.map((t=>Mn(this,qn)[qn](An.from(t))));return new Le(e,"_").defaultValue()}encode(t,e){Z(e.length,t.length,"types/values length mismatch");const n=t.map((t=>Mn(this,qn)[qn](An.from(t)))),r=new Le(n,"_"),i=new qt;return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>Mn(this,qn)[qn](An.from(t))));return new Le(r,"_").decode(new re(e,n,Wn))}static _setDefaultMaxInflation(t){Y("number"==typeof t&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),Wn=t}static defaultAbiCoder(){return null==Kn&&(Kn=new $n),Kn}static getBuiltinCallException(t,e,n){return function(t,e,n,r){let i="missing revert data",s=null,o=null;if(n){i="execution reverted";const t=nt(n);if(n=ot(n),0===t.length)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(t.length%32!=4)i+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===ot(t.slice(0,4)))try{s=r.decode(["string"],t.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[s]},i+=": ".concat(JSON.stringify(s))}catch(t){i+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===ot(t.slice(0,4)))try{const e=Number(r.decode(["uint256"],t.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[e]},s="Panic due to ".concat(zn.get(e)||"UNKNOWN","(").concat(e,")"),i+=": ".concat(s)}catch(t){i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const a={to:e.to?he(e.to):null,data:e.data||"0x"};return e.from&&(a.from=he(e.from)),$(i,"CALL_EXCEPTION",{action:t,data:n,reason:s,transaction:a,invocation:null,revert:o})}(t,e,n,$n.defaultAbiCoder())}}function Xn(t){if(t.isArray())return new Te(Mn(this,qn)[qn](t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new Le(t.components.map((t=>Mn(this,qn)[qn](t))),t.name);switch(t.baseType){case"address":return new Ee(t.name);case"bool":return new ke(t.name);case"string":return new Ce(t.name);case"bytes":return new Re(t.name);case"":return new Ie(t.name)}let e=t.type.match(Jn);if(e){let n=parseInt(e[2]||"256");return Y(0!==n&&n<=256&&n%8==0,"invalid "+e[1]+" bit length","param",t),new Fe(n/8,"int"===e[1],t.name)}if(e=t.type.match(Hn),e){let n=parseInt(e[1]);return Y(0!==n&&n<=32,"invalid bytes length","param",t),new Ae(n,t.name)}Y(!1,"invalid type","type",t.type)}function Yn(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Zn=0;function Qn(t){return"__private_"+Zn+++"_"+t}class tr{constructor(t,e,n){this.fragment=void 0,this.name=void 0,this.signature=void 0,this.topic=void 0,this.args=void 0;const r=t.name,i=t.format();J(this,{fragment:t,name:r,signature:i,topic:e,args:n})}}class er{constructor(t,e,n,r){this.fragment=void 0,this.name=void 0,this.args=void 0,this.signature=void 0,this.selector=void 0,this.value=void 0;const i=t.name,s=t.format();J(this,{fragment:t,name:i,args:n,signature:s,selector:e,value:r})}}class nr{constructor(t,e,n){this.fragment=void 0,this.name=void 0,this.args=void 0,this.signature=void 0,this.selector=void 0;const r=t.name,i=t.format();J(this,{fragment:t,name:r,args:n,signature:i,selector:e})}}class rr{static isIndexed(t){return!(!t||!t._isIndexed)}constructor(t){this.hash=void 0,this._isIndexed=void 0,J(this,{hash:t,_isIndexed:!0})}}const ir={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},sr={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>"reverted with reason string ".concat(JSON.stringify(t))},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&ir[t.toString()]&&(e=ir[t.toString()]),"reverted with panic code 0x".concat(t.toString(16)," (").concat(e,")")}}};var or=Qn("errors"),ar=Qn("events"),cr=Qn("functions"),ur=Qn("abiCoder"),lr=Qn("getFunction"),hr=Qn("getEvent");class fr{constructor(t){Object.defineProperty(this,hr,{value:dr}),Object.defineProperty(this,lr,{value:pr}),this.fragments=void 0,this.deploy=void 0,this.fallback=void 0,this.receive=void 0,Object.defineProperty(this,or,{writable:!0,value:void 0}),Object.defineProperty(this,ar,{writable:!0,value:void 0}),Object.defineProperty(this,cr,{writable:!0,value:void 0}),Object.defineProperty(this,ur,{writable:!0,value:void 0});let e=[];e="string"==typeof t?JSON.parse(t):t,Yn(this,cr)[cr]=new Map,Yn(this,or)[or]=new Map,Yn(this,ar)[ar]=new Map;const n=[];for(const t of e)try{n.push(In.from(t))}catch(e){console.log("[Warning] Invalid Fragment ".concat(JSON.stringify(t),":"),e.message)}J(this,{fragments:Object.freeze(n)});let r=null,i=!1;Yn(this,ur)[ur]=this.getAbiCoder(),this.fragments.forEach(((t,e)=>{let n;switch(t.type){case"constructor":return this.deploy?void console.log("duplicate definition - constructor"):void J(this,{deploy:t});case"fallback":return void(0===t.inputs.length?i=!0:(Y(!r||t.payable!==r.payable,"conflicting fallback fragments","fragments[".concat(e,"]"),t),r=t,i=r.payable));case"function":n=Yn(this,cr)[cr];break;case"event":n=Yn(this,ar)[ar];break;case"error":n=Yn(this,or)[or];break;default:return}const s=t.format();n.has(s)||n.set(s,t)})),this.deploy||J(this,{deploy:Cn.from("constructor()")}),J(this,{fallback:r,receive:i})}format(t){const e=t?"minimal":"full";return this.fragments.map((t=>t.format(e)))}formatJson(){const t=this.fragments.map((t=>t.format("json")));return JSON.stringify(t.map((t=>JSON.parse(t))))}getAbiCoder(){return $n.defaultAbiCoder()}getFunctionName(t){const e=Yn(this,lr)[lr](t,null,!1);return Y(e,"no matching function","key",t),e.name}hasFunction(t){return!!Yn(this,lr)[lr](t,null,!1)}getFunction(t,e){return Yn(this,lr)[lr](t,e||null,!0)}forEachFunction(t){const e=Array.from(Yn(this,cr)[cr].keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(Yn(this,cr)[cr].get(r),n)}}getEventName(t){const e=Yn(this,hr)[hr](t,null,!1);return Y(e,"no matching event","key",t),e.name}hasEvent(t){return!!Yn(this,hr)[hr](t,null,!1)}getEvent(t,e){return Yn(this,hr)[hr](t,e||null,!0)}forEachEvent(t){const e=Array.from(Yn(this,ar)[ar].keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(Yn(this,ar)[ar].get(r),n)}}getError(t,e){if(it(t)){const e=t.toLowerCase();if(sr[e])return Sn.from(sr[e].signature);for(const t of Yn(this,or)[or].values())if(e===t.selector)return t;return null}if(-1===t.indexOf("(")){const e=[];for(const[n,r]of Yn(this,or)[or])n.split("(")[0]===t&&e.push(r);if(0===e.length)return"Error"===t?Sn.from("error Error(string)"):"Panic"===t?Sn.from("error Panic(uint256)"):null;if(e.length>1){const n=e.map((t=>JSON.stringify(t.format()))).join(", ");Y(!1,"ambiguous error description (i.e. ".concat(n,")"),"name",t)}return e[0]}if("Error(string)"===(t=Sn.from(t).format()))return Sn.from("error Error(string)");if("Panic(uint256)"===t)return Sn.from("error Panic(uint256)");return Yn(this,or)[or].get(t)||null}forEachError(t){const e=Array.from(Yn(this,or)[or].keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(Yn(this,or)[or].get(r),n)}}_decodeParams(t,e){return Yn(this,ur)[ur].decode(t,e)}_encodeParams(t,e){return Yn(this,ur)[ur].encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if("string"==typeof t){const e=this.getError(t);Y(e,"unknown error","fragment",t),t=e}return Y(ct(e,0,4)===t.selector,"data signature does not match error ".concat(t.name,"."),"data",e),this._decodeParams(t.inputs,ct(e,4))}encodeErrorResult(t,e){if("string"==typeof t){const e=this.getError(t);Y(e,"unknown error","fragment",t),t=e}return at([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if("string"==typeof t){const e=this.getFunction(t);Y(e,"unknown function","fragment",t),t=e}return Y(ct(e,0,4)===t.selector,"data signature does not match function ".concat(t.name,"."),"data",e),this._decodeParams(t.inputs,ct(e,4))}encodeFunctionData(t,e){if("string"==typeof t){const e=this.getFunction(t);Y(e,"unknown function","fragment",t),t=e}return at([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if("string"==typeof t){const e=this.getFunction(t);Y(e,"unknown function","fragment",t),t=e}let n="invalid length for result data";const r=rt(e);if(r.length%32==0)try{return Yn(this,ur)[ur].decode(t.outputs,r)}catch(t){n="could not decode result data"}X(!1,n,"BAD_DATA",{value:ot(r),info:{method:t.name,signature:t.format()}})}makeError(t,e){const n=nt(t,"data"),r=$n.getBuiltinCallException("call",e,n);if(r.message.startsWith("execution reverted (unknown custom error)")){const t=ot(n.slice(0,4)),e=this.getError(t);if(e)try{const t=Yn(this,ur)[ur].decode(e.inputs,n.slice(4));r.revert={name:e.name,signature:e.format(),args:t},r.reason=r.revert.signature,r.message="execution reverted: ".concat(r.reason)}catch(t){r.message="execution reverted (coult not decode custom error)"}}const i=this.parseTransaction(e);return i&&(r.invocation={method:i.name,signature:i.signature,args:i.args}),r}encodeFunctionResult(t,e){if("string"==typeof t){const e=this.getFunction(t);Y(e,"unknown function","fragment",t),t=e}return ot(Yn(this,ur)[ur].encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if("string"==typeof t){const e=this.getEvent(t);Y(e,"unknown event","eventFragment",t),t=e}X(e.length<=t.inputs.length,"too many arguments for ".concat(t.format()),"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});const n=[];t.anonymous||n.push(t.topicHash);const r=(t,e)=>"string"===t.type?bt(e):"bytes"===t.type?pt(ot(e)):("bool"===t.type&&"boolean"==typeof e?e=e?"0x01":"0x00":t.type.match(/^u?int/)?e=Rt(e):t.type.match(/^bytes/)?e=ut(e,32,!1):"address"===t.type&&Yn(this,ur)[ur].encode(["address"],[e]),ut(ot(e),32,!0));for(e.forEach(((e,i)=>{const s=t.inputs[i];s.indexed?null==e?n.push(null):"array"===s.baseType||"tuple"===s.baseType?Y(!1,"filtering with tuples or arrays not supported","contract."+s.name,e):Array.isArray(e)?n.push(e.map((t=>r(s,t)))):n.push(r(s,e)):Y(null==e,"cannot filter non-indexed parameters; must be null","contract."+s.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){if("string"==typeof t){const e=this.getEvent(t);Y(e,"unknown event","eventFragment",t),t=e}const n=[],r=[],i=[];return t.anonymous||n.push(t.topicHash),Y(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach(((t,s)=>{const o=e[s];if(t.indexed)if("string"===t.type)n.push(bt(o));else if("bytes"===t.type)n.push(pt(o));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(Yn(this,ur)[ur].encode([t.type],[o]))}else r.push(t),i.push(o)})),{data:Yn(this,ur)[ur].encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t){const e=this.getEvent(t);Y(e,"unknown event","eventFragment",t),t=e}if(null!=n&&!t.anonymous){const e=t.topicHash;Y(it(n[0],32)&&n[0].toLowerCase()===e,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const r=[],i=[],s=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(An.from({type:"bytes32",name:t.name})),s.push(!0)):(r.push(t),s.push(!1)):(i.push(t),s.push(!1))}));const o=null!=n?Yn(this,ur)[ur].decode(r,at(n)):null,a=Yn(this,ur)[ur].decode(i,e,!0),c=[],u=[];let l=0,h=0;return t.inputs.forEach(((t,e)=>{let n=null;if(t.indexed)if(null==o)n=new rr(null);else if(s[e])n=new rr(o[h++]);else try{n=o[h++]}catch(t){n=t}else try{n=a[l++]}catch(t){n=t}c.push(n),u.push(t.name||null)})),Vt.fromItems(c,u)}parseTransaction(t){const e=nt(t.data,"tx.data"),n=Pt(null!=t.value?t.value:0,"tx.value"),r=this.getFunction(ot(e.slice(0,4)));if(!r)return null;const i=Yn(this,ur)[ur].decode(r.inputs,e.slice(4));return new er(r,r.selector,i,n)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){const e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new tr(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){const e=ot(t),n=this.getError(ct(e,0,4));if(!n)return null;const r=Yn(this,ur)[ur].decode(n.inputs,ct(e,4));return new nr(n,n.selector,r)}static from(t){return t instanceof fr?t:"string"==typeof t?new fr(JSON.parse(t)):"function"==typeof t.formatJson?new fr(t.formatJson()):"function"==typeof t.format?new fr(t.format("json")):new fr(t)}}function pr(t,e,n){if(it(t)){const e=t.toLowerCase();for(const t of Yn(this,cr)[cr].values())if(e===t.selector)return t;return null}if(-1===t.indexOf("(")){const r=[];for(const[e,n]of Yn(this,cr)[cr])e.split("(")[0]===t&&r.push(n);if(e){const t=e.length>0?e[e.length-1]:null;let n=e.length,i=!0;we.isTyped(t)&&"overrides"===t.type&&(i=!1,n--);for(let t=r.length-1;t>=0;t--){const e=r[t].inputs.length;e===n||i&&e===n-1||r.splice(t,1)}for(let t=r.length-1;t>=0;t--){const n=r[t].inputs;for(let i=0;i<e.length;i++)if(we.isTyped(e[i])){if(i>=n.length){if("overrides"===e[i].type)continue;r.splice(t,1);break}if(e[i].type!==n[i].baseType){r.splice(t,1);break}}}}if(1===r.length&&e&&e.length!==r[0].inputs.length){const t=e[e.length-1];(null==t||Array.isArray(t)||"object"!=typeof t)&&r.splice(0,1)}if(0===r.length)return null;if(r.length>1&&n){const e=r.map((t=>JSON.stringify(t.format()))).join(", ");Y(!1,"ambiguous function description (i.e. matches ".concat(e,")"),"key",t)}return r[0]}return Yn(this,cr)[cr].get(Dn.from(t).format())||null}function dr(t,e,n){if(it(t)){const e=t.toLowerCase();for(const t of Yn(this,ar)[ar].values())if(e===t.topicHash)return t;return null}if(-1===t.indexOf("(")){const r=[];for(const[e,n]of Yn(this,ar)[ar])e.split("(")[0]===t&&r.push(n);if(e){for(let t=r.length-1;t>=0;t--)r[t].inputs.length<e.length&&r.splice(t,1);for(let t=r.length-1;t>=0;t--){const n=r[t].inputs;for(let i=0;i<e.length;i++)if(we.isTyped(e[i])&&e[i].type!==n[i].baseType){r.splice(t,1);break}}}if(0===r.length)return null;if(r.length>1&&n){const e=r.map((t=>JSON.stringify(t.format()))).join(", ");Y(!1,"ambiguous event description (i.e. matches ".concat(e,")"),"key",t)}return r[0]}return Yn(this,ar)[ar].get(Fn.from(t).format())||null}function gr(t){return t&&"function"==typeof t.getAddress}async function yr(t,e){const n=await e;return null!=n&&"0x0000000000000000000000000000000000000000"!==n||(X("string"!=typeof t,"unconfigured name","UNCONFIGURED_NAME",{value:t}),Y(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),he(n)}function mr(t,e){return"string"==typeof t?t.match(/^0x[0-9a-f]{40}$/i)?he(t):(X(null!=e,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),yr(t,e.resolveName(t))):gr(t)?yr(t,t.getAddress()):t&&"function"==typeof t.then?yr(t,t):void Y(!1,"unsupported addressable value","target",t)}function br(t,e){return{address:he(t),storageKeys:e.map(((t,e)=>(Y(it(t,32),"invalid slot","storageKeys[".concat(e,"]"),t),t.toLowerCase())))}}function vr(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var wr=0;function Er(t){return"__private_"+wr+++"_"+t}const Or=BigInt(0);function Pr(t){return null==t?null:t.toString()}Symbol.iterator;class Nr{constructor(t,e){this.provider=void 0,this.transactionHash=void 0,this.blockHash=void 0,this.blockNumber=void 0,this.removed=void 0,this.address=void 0,this.data=void 0,this.topics=void 0,this.index=void 0,this.transactionIndex=void 0,this.provider=e;const n=Object.freeze(t.topics.slice());J(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:n,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){const{address:t,blockHash:e,blockNumber:n,data:r,index:i,removed:s,topics:o,transactionHash:a,transactionIndex:c}=this;return{_type:"log",address:t,blockHash:e,blockNumber:n,data:r,index:i,removed:s,topics:o,transactionHash:a,transactionIndex:c}}async getBlock(){const t=await this.provider.getBlock(this.blockHash);return X(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){const t=await this.provider.getTransaction(this.transactionHash);return X(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){const t=await this.provider.getTransactionReceipt(this.transactionHash);return X(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return{orphan:"drop-log",log:{transactionHash:(t=this).transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}};var t}}var Tr=Er("logs");class kr{constructor(t,e){this.provider=void 0,this.to=void 0,this.from=void 0,this.contractAddress=void 0,this.hash=void 0,this.index=void 0,this.blockHash=void 0,this.blockNumber=void 0,this.logsBloom=void 0,this.gasUsed=void 0,this.blobGasUsed=void 0,this.cumulativeGasUsed=void 0,this.gasPrice=void 0,this.blobGasPrice=void 0,this.type=void 0,this.status=void 0,this.root=void 0,Object.defineProperty(this,Tr,{writable:!0,value:void 0}),vr(this,Tr)[Tr]=Object.freeze(t.logs.map((t=>new Nr(t,e))));let n=Or;null!=t.effectiveGasPrice?n=t.effectiveGasPrice:null!=t.gasPrice&&(n=t.gasPrice),J(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:n,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return vr(this,Tr)[Tr]}toJSON(){const{to:t,from:e,contractAddress:n,hash:r,index:i,blockHash:s,blockNumber:o,logsBloom:a,logs:c,status:u,root:l}=this;return{_type:"TransactionReceipt",blockHash:s,blockNumber:o,contractAddress:n,cumulativeGasUsed:Pr(this.cumulativeGasUsed),from:e,gasPrice:Pr(this.gasPrice),blobGasUsed:Pr(this.blobGasUsed),blobGasPrice:Pr(this.blobGasPrice),gasUsed:Pr(this.gasUsed),hash:r,index:i,logs:c,logsBloom:a,root:l,status:u,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const t=await this.provider.getBlock(this.blockHash);if(null==t)throw new Error("TODO");return t}async getTransaction(){const t=await this.provider.getTransaction(this.hash);if(null==t)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return _r(this)}reorderedEvent(t){return X(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Ar(this,t)}}var xr=Er("startBlock");class Rr{constructor(t,e){this.provider=void 0,this.blockNumber=void 0,this.blockHash=void 0,this.index=void 0,this.hash=void 0,this.type=void 0,this.to=void 0,this.from=void 0,this.nonce=void 0,this.gasLimit=void 0,this.gasPrice=void 0,this.maxPriorityFeePerGas=void 0,this.maxFeePerGas=void 0,this.maxFeePerBlobGas=void 0,this.data=void 0,this.value=void 0,this.chainId=void 0,this.signature=void 0,this.accessList=void 0,this.blobVersionedHashes=void 0,this.authorizationList=void 0,Object.defineProperty(this,xr,{writable:!0,value:void 0}),this.provider=e,this.blockNumber=null!=t.blockNumber?t.blockNumber:null,this.blockHash=null!=t.blockHash?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=null!=t.maxPriorityFeePerGas?t.maxPriorityFeePerGas:null,this.maxFeePerGas=null!=t.maxFeePerGas?t.maxFeePerGas:null,this.maxFeePerBlobGas=null!=t.maxFeePerBlobGas?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=null!=t.accessList?t.accessList:null,this.blobVersionedHashes=null!=t.blobVersionedHashes?t.blobVersionedHashes:null,this.authorizationList=null!=t.authorizationList?t.authorizationList:null,vr(this,xr)[xr]=-1}toJSON(){const{blockNumber:t,blockHash:e,index:n,hash:r,type:i,to:s,from:o,nonce:a,data:c,signature:u,accessList:l,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:l,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:Pr(this.chainId),data:c,from:o,gasLimit:Pr(this.gasLimit),gasPrice:Pr(this.gasPrice),hash:r,maxFeePerGas:Pr(this.maxFeePerGas),maxPriorityFeePerGas:Pr(this.maxPriorityFeePerGas),maxFeePerBlobGas:Pr(this.maxFeePerBlobGas),nonce:a,signature:u,to:s,index:n,type:i,value:Pr(this.value)}}async getBlock(){let t=this.blockNumber;if(null==t){const e=await this.getTransaction();e&&(t=e.blockNumber)}if(null==t)return null;const e=this.provider.getBlock(t);if(null==e)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(null==this.blockNumber){const{tx:t,blockNumber:e}=await H({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return null==t||null==t.blockNumber?0:e-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){const n=null==t?1:t,r=null==e?0:e;let i=vr(this,xr)[xr],s=-1,o=-1===i;const a=async()=>{if(o)return null;const{blockNumber:t,nonce:e}=await H({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(e<this.nonce)return void(i=t);if(o)return null;const r=await this.getTransaction();if(!r||null==r.blockNumber)for(-1===s&&(s=i-3,s<vr(this,xr)[xr]&&(s=vr(this,xr)[xr]));s<=t;){if(o)return null;const e=await this.provider.getBlock(s,!0);if(null==e)return;for(const t of e)if(t===this.hash)return;for(let r=0;r<e.length;r++){const s=await e.getTransaction(r);if(s.from===this.from&&s.nonce===this.nonce){if(o)return null;const e=await this.provider.getTransactionReceipt(s.hash);if(null==e)return;if(t-e.blockNumber+1<n)return;let r="replaced";s.data===this.data&&s.to===this.to&&s.value===this.value?r="repriced":"0x"===s.data&&s.from===s.to&&s.value===Or&&(r="cancelled"),X(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:"replaced"===r||"cancelled"===r,reason:r,replacement:s.replaceableTransaction(i),hash:s.hash,receipt:e})}}s++}},c=t=>{if(null==t||0!==t.status)return t;X(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:t.to,from:t.from,data:""},receipt:t})},u=await this.provider.getTransactionReceipt(this.hash);if(0===n)return c(u);if(u){if(1===n||await u.confirmations()>=n)return c(u)}else if(await a(),0===n)return null;const l=new Promise(((t,e)=>{const s=[],u=()=>{s.forEach((t=>t()))};if(s.push((()=>{o=!0})),r>0){const t=setTimeout((()=>{u(),e($("wait for transaction timeout","TIMEOUT"))}),r);s.push((()=>{clearTimeout(t)}))}const l=async r=>{if(await r.confirmations()>=n){u();try{t(c(r))}catch(t){e(t)}}};if(s.push((()=>{this.provider.off(this.hash,l)})),this.provider.on(this.hash,l),i>=0){const t=async()=>{try{await a()}catch(t){if(W(t,"TRANSACTION_REPLACED"))return u(),void e(t)}o||this.provider.once("block",t)};s.push((()=>{this.provider.off("block",t)})),this.provider.once("block",t)}}));return await l}isMined(){return null!=this.blockHash}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}removedEvent(){return X(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),_r(this)}reorderedEvent(t){return X(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),X(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Ar(this,t)}replaceableTransaction(t){Y(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);const e=new Rr(this,this.provider);return vr(e,xr)[xr]=t,e}}function Ar(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function _r(t){return{orphan:"drop-transaction",tx:t}}function Ir(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Ur=0;function jr(t){return"__private_"+Ur+++"_"+t}var Sr=jr("listener");class Fr{constructor(t,e,n){this.filter=void 0,this.emitter=void 0,Object.defineProperty(this,Sr,{writable:!0,value:void 0}),Ir(this,Sr)[Sr]=e,J(this,{emitter:t,filter:n})}async removeListener(){null!=Ir(this,Sr)[Sr]&&await this.emitter.off(this.filter,Ir(this,Sr)[Sr])}}function Cr(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Lr=0;function Dr(t){return"__private_"+Lr+++"_"+t}class Br extends Nr{constructor(t,e,n){super(t,t.provider),this.interface=void 0,this.fragment=void 0,this.args=void 0,J(this,{args:e.decodeEventLog(n,t.data,t.topics),fragment:n,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class Mr extends Nr{constructor(t,e){super(t,t.provider),this.error=void 0,J(this,{error:e})}}var Gr=Dr("iface");class Vr extends kr{constructor(t,e,n){super(n,e),Object.defineProperty(this,Gr,{writable:!0,value:void 0}),Cr(this,Gr)[Gr]=t}get logs(){return super.logs.map((t=>{const e=t.topics.length?Cr(this,Gr)[Gr].getEvent(t.topics[0]):null;if(e)try{return new Br(t,Cr(this,Gr)[Gr],e)}catch(e){return new Mr(t,e)}return t}))}}var zr=Dr("iface");class Hr extends Rr{constructor(t,e,n){super(n,e),Object.defineProperty(this,zr,{writable:!0,value:void 0}),Cr(this,zr)[zr]=t}async wait(t,e){const n=await super.wait(t,e);return null==n?null:new Vr(Cr(this,zr)[zr],this.provider,n)}}class Jr extends Fr{constructor(t,e,n,r){super(t,e,n),this.log=void 0,J(this,{log:r})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Kr extends Jr{constructor(t,e,n,r,i){super(t,e,n,new Br(i,t.interface,r)),J(this,{args:t.interface.decodeEventLog(r,this.log.data,this.log.topics),fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}function Wr(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var qr=0;function $r(t){return"__private_"+qr+++"_"+t}const Xr=BigInt(0);function Yr(t){return t&&"function"==typeof t.call}function Zr(t){return t&&"function"==typeof t.estimateGas}function Qr(t){return t&&"function"==typeof t.resolveName}function ti(t){return t&&"function"==typeof t.sendTransaction}function ei(t){if(null!=t){if(Qr(t))return t;if(t.provider)return t.provider}}var ni=$r("filter");class ri{constructor(t,e,n){if(Object.defineProperty(this,ni,{writable:!0,value:void 0}),this.fragment=void 0,J(this,{fragment:e}),e.inputs.length<n.length)throw new Error("too many arguments");const r=ii(t.runner,"resolveName"),i=Qr(r)?r:null;Wr(this,ni)[ni]=async function(){const r=await Promise.all(e.inputs.map(((t,e)=>null==n[e]?null:t.walkAsync(n[e],((t,e)=>"address"===t?Array.isArray(e)?Promise.all(e.map((t=>mr(t,i)))):mr(e,i):e)))));return t.interface.encodeFilterTopics(e,r)}()}getTopicFilter(){return Wr(this,ni)[ni]}}function ii(t,e){return null==t?null:"function"==typeof t[e]?t:t.provider&&"function"==typeof t.provider[e]?t.provider:null}function si(t){return null==t?null:t.provider||null}async function oi(t,e){const n=we.dereference(t,"overrides");Y("object"==typeof n,"invalid overrides parameter","overrides",t);const r=function(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=ot(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of n)r in t&&null!=t[r]&&(e[r]=Pt(t[r],"request.".concat(r)));const r="type,nonce".split(/,/);for(const n of r)n in t&&null!=t[n]&&(e[n]=xt(t[n],"request.".concat(n)));return t.accessList&&(e.accessList=function(t){if(Array.isArray(t))return t.map(((e,n)=>Array.isArray(e)?(Y(2===e.length,"invalid slot set","value[".concat(n,"]"),e),br(e[0],e[1])):(Y(null!=e&&"object"==typeof e,"invalid address-slot set","value",t),br(e.address,e.storageKeys))));Y(null!=t&&"object"==typeof t,"invalid access list","value",t);const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return br(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}(t.accessList)),t.authorizationList&&(e.authorizationList=t.authorizationList.slice()),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobWrapperVersion"in t&&(e.blobWrapperVersion=t.blobWrapperVersion),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map((t=>{return it(e=t,!0)||e instanceof Uint8Array?ot(t):Object.assign({},t);var e}))),e}(n);return Y(null==r.to||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),Y(null==r.data||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}function ai(t){const e=async function(e){const n=await oi(e,["data"]);n.to=await t.getAddress(),n.from&&(n.from=await mr(n.from,ei(t.runner)));const r=t.interface,i=Pt(n.value||Xr,"overrides.value")===Xr,s="0x"===(n.data||"0x");return!r.fallback||r.fallback.payable||!r.receive||s||i||Y(!1,"cannot send data to receive or send value to non-payable fallback","overrides",e),Y(r.fallback||s,"cannot send data to receive-only contract","overrides.data",n.data),Y(r.receive||r.fallback&&r.fallback.payable||i,"cannot send value to non-payable fallback","overrides.value",n.value),Y(r.fallback||s,"cannot send data to receive-only contract","overrides.data",n.data),n},n=async function(n){const r=t.runner;X(ti(r),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const i=await r.sendTransaction(await e(n)),s=si(t.runner);return new Hr(t.interface,s,i)},r=async t=>await n(t);return J(r,{_contract:t,estimateGas:async function(n){const r=ii(t.runner,"estimateGas");return X(Zr(r),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await r.estimateGas(await e(n))},populateTransaction:e,send:n,staticCall:async function(n){const r=ii(t.runner,"call");X(Yr(r),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const i=await e(n);try{return await r.call(i)}catch(e){if(q(e)&&e.data)throw t.interface.makeError(e.data,i);throw e}}}),r}const ci=Symbol.for("_ethersInternal_contract"),ui=new WeakMap;function li(t){return ui.get(t[ci])}async function hi(t,e){let n,r=null;if(Array.isArray(e)){const r=function(e){if(it(e,32))return e;const n=t.interface.getEvent(e);return Y(n,"unknown fragment","name",e),n.topicHash};n=e.map((t=>null==t?null:Array.isArray(t)?t.map(r):r(t)))}else"*"===e?n=[null]:"string"==typeof e?it(e,32)?n=[e]:(r=t.interface.getEvent(e),Y(r,"unknown fragment","event",e),n=[r.topicHash]):(i=e)&&"object"==typeof i&&"getTopicFilter"in i&&"function"==typeof i.getTopicFilter&&i.fragment?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):Y(!1,"unknown event name","event",e);var i;return n=n.map((t=>{if(null==t)return null;if(Array.isArray(t)){const e=Array.from(new Set(t.map((t=>t.toLowerCase()))).values());return 1===e.length?e[0]:(e.sort(),e)}return t.toLowerCase()})),{fragment:r,tag:n.map((t=>null==t?"null":Array.isArray(t)?t.join("|"):t)).join("&"),topics:n}}async function fi(t,e){const{subs:n}=li(t);return n.get((await hi(t,e)).tag)||null}async function pi(t,e,n){const r=si(t.runner);X(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:o}=await hi(t,n),{addr:a,subs:c}=li(t);let u=c.get(s);if(!u){const e={address:a||t,topics:o},l=e=>{let r=i;if(null==r)try{r=t.interface.getEvent(e.topics[0])}catch(t){}if(r){const s=r,o=i?t.interface.decodeEventLog(i,e.data,e.topics):[];gi(t,n,o,(r=>new Kr(t,r,n,s,e)))}else gi(t,n,[],(r=>new Jr(t,r,n,e)))};let h=[];u={tag:s,listeners:[],start:()=>{h.length||h.push(r.on(e,l))},stop:async()=>{if(0==h.length)return;let t=h;h=[],await Promise.all(t),r.off(e,l)}},c.set(s,u)}return u}let di=Promise.resolve();async function gi(t,e,n,r){try{await di}catch(t){}const i=async function(t,e,n,r){await di;const i=await fi(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter((e=>{let{listener:i,once:s}=e;const o=Array.from(n);r&&o.push(r(s?null:i));try{i.call(t,...o)}catch(t){}return!s})),0===i.listeners.length&&(i.stop(),li(t).subs.delete(i.tag)),s>0}(t,e,n,r);return di=i,await i}const yi=["then"];class mi{constructor(t,e,n,r){this.target=void 0,this.interface=void 0,this.runner=void 0,this.filters=void 0,this[ci]=void 0,this.fallback=void 0,Y("string"==typeof t||gr(t),"invalid value for Contract target","target",t),null==n&&(n=null);const i=fr.from(e);let s;J(this,{target:t,runner:n,interface:i}),Object.defineProperty(this,ci,{value:{}});let o=null,a=null;if(r){const t=si(n);a=new Hr(this.interface,t,r)}let c=new Map;if("string"==typeof t)if(it(t))o=t,s=Promise.resolve(t);else{const e=ii(n,"resolveName");if(!Qr(e))throw $("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});s=e.resolveName(t).then((e=>{if(null==e)throw $("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return li(this).addr=e,e}))}else s=t.getAddress().then((t=>{if(null==t)throw new Error("TODO");return li(this).addr=t,t}));var u;u={addrPromise:s,addr:o,deployTx:a,subs:c},ui.set(this[ci],u);const l=new Proxy({},{get:(t,e,n)=>{if("symbol"==typeof e||yi.indexOf(e)>=0)return Reflect.get(t,e,n);try{return this.getEvent(e)}catch(t){if(!W(t,"INVALID_ARGUMENT")||"key"!==t.argument)throw t}},has:(t,e)=>yi.indexOf(e)>=0?Reflect.has(t,e):Reflect.has(t,e)||this.interface.hasEvent(String(e))});return J(this,{filters:l}),J(this,{fallback:i.receive||i.fallback?ai(this):null}),new Proxy(this,{get:(t,e,n)=>{if("symbol"==typeof e||e in t||yi.indexOf(e)>=0)return Reflect.get(t,e,n);try{return t.getFunction(e)}catch(t){if(!W(t,"INVALID_ARGUMENT")||"key"!==t.argument)throw t}},has:(t,e)=>"symbol"==typeof e||e in t||yi.indexOf(e)>=0?Reflect.has(t,e):t.interface.hasFunction(e)})}connect(t){return new mi(this.target,this.interface,t)}attach(t){return new mi(t,this.interface,this.runner)}async getAddress(){return await li(this).addrPromise}async getDeployedCode(){const t=si(this.runner);X(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const e=await t.getCode(await this.getAddress());return"0x"===e?null:e}async waitForDeployment(){const t=this.deploymentTransaction();if(t)return await t.wait(),this;if(null!=await this.getDeployedCode())return this;const e=si(this.runner);return X(null!=e,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise(((t,n)=>{const r=async()=>{try{if(null!=await this.getDeployedCode())return t(this);e.once("block",r)}catch(t){n(t)}};r()}))}deploymentTransaction(){return li(this).deployTx}getFunction(t){return"string"!=typeof t&&(t=t.format()),function(t,e){const n=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const s=t.interface.getFunction(e,r);return X(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:r}}),s},r=async function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];const s=n(...r);let o={};if(s.inputs.length+1===r.length&&(o=await oi(r.pop()),o.from&&(o.from=await mr(o.from,ei(t.runner)))),s.inputs.length!==r.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const a=await async function(t,e,n){const r=ii(t,"resolveName"),i=Qr(r)?r:null;return await Promise.all(e.map(((t,e)=>t.walkAsync(n[e],((t,e)=>(e=we.dereference(e,t),"address"===t?mr(e,i):e))))))}(t.runner,s.inputs,r);return Object.assign({},o,await H({to:t.getAddress(),data:t.interface.encodeFunctionData(s,a)}))},i=async function(){const t=await o(...arguments);return 1===t.length?t[0]:t},s=async function(){const e=t.runner;X(ti(e),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const n=await e.sendTransaction(await r(...arguments)),i=si(t.runner);return new Hr(t.interface,i,n)},o=async function(){const e=ii(t.runner,"call");X(Yr(e),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const i=await r(...arguments);let s="0x";try{s=await e.call(i)}catch(e){if(q(e)&&e.data)throw t.interface.makeError(e.data,i);throw e}const o=n(...arguments);return t.interface.decodeFunctionResult(o,s)},a=async function(){return n(...arguments).constant?await i(...arguments):await s(...arguments)};return J(a,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:async function(){const e=ii(t.runner,"estimateGas");return X(Zr(e),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await e.estimateGas(await r(...arguments))},populateTransaction:r,send:s,staticCall:i,staticCallResult:o}),Object.defineProperty(a,"fragment",{configurable:!1,enumerable:!0,get:()=>{const n=t.interface.getFunction(e);return X(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),n}}),a}(this,t)}getEvent(t){return"string"!=typeof t&&(t=t.format()),function(t,e){const n=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const s=t.interface.getEvent(e,r);return X(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:r}}),s},r=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return new ri(t,n(...r),r)};return J(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const n=t.interface.getEvent(e);return X(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),n}}),r}(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,n){null==e&&(e=0),null==n&&(n="latest");const{addr:r,addrPromise:i}=li(this),s=r||await i,{fragment:o,topics:a}=await hi(this,t),c={address:s,topics:a,fromBlock:e,toBlock:n},u=si(this.runner);return X(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map((t=>{let e=o;if(null==e)try{e=this.interface.getEvent(t.topics[0])}catch(t){}if(e)try{return new Br(t,this.interface,e)}catch(e){return new Mr(t,e)}return new Nr(t,u)}))}async on(t,e){const n=await pi(this,"on",t);return n.listeners.push({listener:e,once:!1}),n.start(),this}async once(t,e){const n=await pi(this,"once",t);return n.listeners.push({listener:e,once:!0}),n.start(),this}async emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return await gi(this,t,n,null)}async listenerCount(t){if(t){const e=await fi(this,t);return e?e.listeners.length:0}const{subs:e}=li(this);let n=0;for(const{listeners:t}of e.values())n+=t.length;return n}async listeners(t){if(t){const e=await fi(this,t);return e?e.listeners.map((t=>{let{listener:e}=t;return e})):[]}const{subs:e}=li(this);let n=[];for(const{listeners:t}of e.values())n=n.concat(t.map((t=>{let{listener:e}=t;return e})));return n}async off(t,e){const n=await fi(this,t);if(!n)return this;if(e){const t=n.listeners.map((t=>{let{listener:e}=t;return e})).indexOf(e);t>=0&&n.listeners.splice(t,1)}return null!=e&&0!==n.listeners.length||(n.stop(),li(this).subs.delete(n.tag)),this}async removeAllListeners(t){if(t){const e=await fi(this,t);if(!e)return this;e.stop(),li(this).subs.delete(e.tag)}else{const{subs:t}=li(this);for(const{tag:e,stop:n}of t.values())n(),t.delete(e)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){return class extends mi{constructor(e){super(e,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)}}}static from(t,e,n){return null==n&&(n=null),new this(t,e,n)}}class bi extends(function(){return mi}()){}function vi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function wi(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vi(Object(n),!0).forEach((function(e){Ei(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vi(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ei(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Oi=class{constructor(t){var e=this;this.dialogWindowOrigin="",this.isDestroyed=!1,this.appId=void 0,this.mode="production",this.pendingRequests=new Map,this.getMode=()=>this.mode,this.getAppId=()=>this.appId,this.destroy=()=>{this.isDestroyed||(this.isDestroyed=!0,"undefined"!=typeof window&&window.removeEventListener("message",this.handleMessage),this.rejectAllPendingRequests("DESTROYED"))},this.handleMessage=t=>{if(t.origin!==this.dialogWindowOrigin)return;const e=t.data;if(!e.requestId)return;if("CLOSE_MODAL"===e.type)return void this.rejectAllPendingRequests("REJECTED");const n=this.pendingRequests.get(e.requestId);n&&n.requestType!==e.type&&(this.pendingRequests.delete(e.requestId),e.error?n.reject(e.error):n.resolve(e.payload))},this.verifyHumanity=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.minPoints||(t=wi(wi({},t),{},{minPoints:0})),e.request("PROOFS_REQUEST",t)},this.getAddressScore=async t=>{if(!t)throw new Error("`address` argument is required to get address score");const{score:e,message:n,signature:r}=await d(t);return{score:e,message:n,signature:r}},this.verifyProofs=async t=>{let{proofs:e,provider:n}=t;const r={verified:!1,score:{total:0,groups:[]}},i=await async function(t){try{const e="dev"===t?"dev-configs":"configs",n=await p("https://raw.githubusercontent.com/BringID/configs/main/".concat(e,".json"));return{REGISTRY:n.REGISTRY,CHAIN_ID:n.CHAIN_ID}}catch(t){return console.error(t),null}}(this.mode);if(!i)throw new Error("configs cannot be fetched");const s=new fr(y),o=new fr(m),a=new fr(b),c=e.map((t=>({credentialGroupId:t.credential_group_id,appId:t.app_id,semaphoreProof:{merkleTreeDepth:t.semaphore_proof.merkle_tree_depth,merkleTreeRoot:t.semaphore_proof.merkle_tree_root,nullifier:t.semaphore_proof.nullifier,message:t.semaphore_proof.message,scope:t.semaphore_proof.scope,points:t.semaphore_proof.points}}))).map((t=>{const e=s.encodeFunctionData("verifyProof",[0,t]);return{target:i.REGISTRY,allowFailure:!1,callData:e}})),u=(await new bi(i.REGISTRY,y,n).apps(this.appId)).scorer,l=[...c,...e.map((t=>{const e=a.encodeFunctionData("getScore",[t.credential_group_id]);return{target:u,allowFailure:!1,callData:e}}))],h=o.encodeFunctionData("aggregate3",[l]);try{const t=await n.call({to:"0xca11bde05977b3631167028862be2a173976ca11",data:h}),i=o.decodeFunctionResult("aggregate3",t)[0];if(!i.slice(0,e.length).every((t=>{const[e]=s.decodeFunctionResult("verifyProof",t.returnData);return e})))return r;const c=i.slice(e.length),u=e.map(((t,e)=>{const[n]=a.decodeFunctionResult("getScore",c[e].returnData);return{credential_group_id:t.credential_group_id,score:Number(n)}}));return{verified:!0,score:{total:u.reduce(((t,e)=>t+e.score),0),groups:u}}}catch(t){return console.error(t),r}},this.appId=t.appId,"undefined"!=typeof window&&(window.addEventListener("message",this.handleMessage),this.dialogWindowOrigin=window.location.origin),t.mode&&(this.mode=t.mode)}sendMessageToDialog(t){window.postMessage(t,this.dialogWindowOrigin)}request(t,e){return new Promise(((n,r)=>{const i=a();this.pendingRequests.set(i,{resolve:n,reject:r,requestType:t}),this.sendMessageToDialog({type:t,requestId:i,payload:e})}))}rejectAllPendingRequests(t){for(const{reject:e}of this.pendingRequests.values())e(t);this.pendingRequests.clear()}};return e}()}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BringSDK=e():t.BringSDK=e()}(this,(function(){return function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{BringID:function(){return yi}});var n="zpka_52e44068bb9745f2be776b343e96cdab_1a60a93b",r="https://api.bringid.org";function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){o(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return fetch(t,{method:e,body:"GET"===e||"OPTIONS"===e?void 0:JSON.stringify(r),headers:s({},n)}).then((async t=>{if(!t.ok){const e=await t.json();throw new Error(e.error)}return t.json()}))},c=t=>a("".concat(r,"/v1/score/address/").concat(t),"GET",{Authorization:"Bearer ".concat(n),"content-type":"application/json"});const u=[{internalType:"uint256",name:"credentialGroupId",type:"uint256"},{internalType:"uint256",name:"appId",type:"uint256"},{components:[{internalType:"uint256",name:"merkleTreeDepth",type:"uint256"},{internalType:"uint256",name:"merkleTreeRoot",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"},{internalType:"uint256",name:"message",type:"uint256"},{internalType:"uint256",name:"scope",type:"uint256"},{internalType:"uint256[8]",name:"points",type:"uint256[8]"}],internalType:"struct ISemaphore.SemaphoreProof",name:"semaphoreProof",type:"tuple"}];var l=[{inputs:[{internalType:"uint256",name:"context_",type:"uint256"},{components:u,internalType:"struct ICredentialRegistry.CredentialGroupProof",name:"proof_",type:"tuple"}],name:"verifyProof",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"context_",type:"uint256"},{components:u,internalType:"struct ICredentialRegistry.CredentialGroupProof[]",name:"proofs_",type:"tuple[]"}],name:"verifyProofs",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"context_",type:"uint256"},{components:u,internalType:"struct ICredentialRegistry.CredentialGroupProof[]",name:"proofs_",type:"tuple[]"}],name:"getScore",outputs:[{internalType:"uint256",name:"_score",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"appId",type:"uint256"}],name:"apps",outputs:[{internalType:"enum ICredentialRegistry.AppStatus",name:"status",type:"uint8"},{internalType:"uint256",name:"recoveryTimelock",type:"uint256"},{internalType:"address",name:"admin",type:"address"},{internalType:"address",name:"scorer",type:"address"}],stateMutability:"view",type:"function"}],h=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3[]",name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}],f=[{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"getScore",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];function p(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Wrong positive integer: ".concat(t))}function d(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(t.length))throw new Error("Expected Uint8Array of length ".concat(n,", not of length=").concat(t.length))}function g(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const y=BigInt(2**32-1),m=BigInt(32);function b(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(t&y),l:Number(t>>m&y)}:{h:0|Number(t>>m&y),l:0|Number(t&y)}}function v(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=b(t[i],e);[n[i],r[i]]=[s,o]}return[n,r]}if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function w(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got ".concat(typeof t));return new Uint8Array((new TextEncoder).encode(t))}(t)),!(t instanceof Uint8Array))throw new Error("expected Uint8Array, got ".concat(typeof t));return t}class E{clone(){return this._cloneInto()}}const[O,P,N]=[[],[],[]],T=BigInt(0),k=BigInt(1),x=BigInt(2),R=BigInt(7),A=BigInt(256),_=BigInt(113);for(let t=0,e=k,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],O.push(2*(5*r+n)),P.push((t+1)*(t+2)/2%64);let i=T;for(let t=0;t<7;t++)e=(e<<k^(e>>R)*_)%A,e&x&&(i^=k<<(k<<BigInt(t))-k);N.push(i)}const[I,j]=v(N,!0),U=(t,e,n)=>n>32?((t,e,n)=>e<<n-32|t>>>64-n)(t,e,n):((t,e,n)=>t<<n|e>>>32-n)(t,e,n),S=(t,e,n)=>n>32?((t,e,n)=>t<<n-32|e>>>64-n)(t,e,n):((t,e,n)=>e<<n|t>>>32-n)(t,e,n);class F extends E{constructor(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,p(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,i=(e+2)%10,s=n[i],o=n[i+1],a=U(s,o,1)^n[r],c=S(s,o,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=c}let e=t[2],i=t[3];for(let n=0;n<24;n++){const r=P[n],s=U(e,i,r),o=S(e,i,r),a=O[n];e=t[a],i=t[a+1],t[a]=s,t[a+1]=o}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=I[r],t[1]^=j[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){g(this);const{blockLen:e,state:n}=this,r=(t=w(t)).length;for(let i=0;i<r;){const s=Math.min(e-this.pos,r-i);for(let e=0;e<s;e++)n[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,128&e&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){g(this,!1),d(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,i=t.length;r<i;){this.posOut>=n&&this.keccak();const s=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+s),r),this.posOut+=s,r+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return p(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(function(t,e){d(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least ".concat(n))}(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:i,enableXOF:s}=this;return t||(t=new F(e,n,r,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=r,t.enableXOF=s,t.destroyed=this.destroyed,t}}const C=((t,e,n)=>function(t){const e=e=>t().update(w(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}((()=>new F(e,t,n))))(1,136,32);function L(t,e,n){const r=e.split("|").map((t=>t.trim()));for(let n=0;n<r.length;n++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const i=new Error("invalid value for type ".concat(e));throw i.code="INVALID_ARGUMENT",i.argument="value.".concat(n),i.value=t,i}async function D(t){const e=Object.keys(t);return(await Promise.all(e.map((e=>Promise.resolve(t[e]))))).reduce(((t,n,r)=>(t[e[r]]=n,t)),{})}function B(t,e,n){for(let r in e){let i=e[r];const s=n?n[r]:null;s&&L(i,s,r),Object.defineProperty(t,r,{enumerable:!0,value:i,writable:!1})}}function M(t,e){if(null==t)return"null";if(null==e&&(e=new Set),"object"==typeof t){if(e.has(t))return"[Circular]";e.add(t)}if(Array.isArray(t))return"[ "+t.map((t=>M(t,e))).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[15&t[r]];return n}if("object"==typeof t&&"function"==typeof t.toJSON)return M(t.toJSON(),e);switch(typeof t){case"boolean":case"number":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const n=Object.keys(t);return n.sort(),"{ "+n.map((n=>"".concat(M(n,e),": ").concat(M(t[n],e)))).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function G(t,e){return t&&t.code===e}function V(t){return G(t,"CALL_EXCEPTION")}function z(t,e,n){let r,i=t;{const r=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error("value will overwrite populated values: ".concat(M(n)));for(const t in n){if("shortMessage"===t)continue;const e=n[t];r.push(t+"="+M(e))}}r.push("code=".concat(e)),r.push("version=".concat("6.16.0")),r.length&&(t+=" ("+r.join(", ")+")")}switch(e){case"INVALID_ARGUMENT":r=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(t);break;default:r=new Error(t)}return B(r,{code:e}),n&&Object.assign(r,n),null==r.shortMessage&&B(r,{shortMessage:i}),r}function H(t,e,n,r){if(!t)throw z(e,n,r)}function J(t,e,n,r){H(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function K(t,e,n){null==n&&(n=""),n&&(n=": "+n),H(t>=e,"missing argument"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),H(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const W=["NFD","NFC","NFKD","NFKC"].reduce(((t,e)=>{try{if("test"!=="test".normalize(e))throw new Error("bad");if("NFD"===e){if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken")}t.push(e)}catch(t){}return t}),[]);function q(t,e,n){if(null==n&&(n=""),t!==e){let t=n,e="new";n&&(t+=".",e+=" "+n),H(!1,"private constructor; use ".concat(t,"from* methods"),"UNSUPPORTED_OPERATION",{operation:e})}}function $(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if("string"==typeof t&&t.length%2==0&&t.match(/^0x[0-9a-f]*$/i)){const e=new Uint8Array((t.length-2)/2);let n=2;for(let r=0;r<e.length;r++)e[r]=parseInt(t.substring(n,n+2),16),n+=2;return e}J(!1,"invalid BytesLike value",e||"value",t)}function X(t,e){return $(t,e,!1)}function Y(t,e){return $(t,e,!0)}function Z(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||"number"==typeof e&&t.length!==2+2*e||!0===e&&t.length%2!=0)}const Q="0123456789abcdef";function tt(t){const e=X(t);let n="0x";for(let t=0;t<e.length;t++){const r=e[t];n+=Q[(240&r)>>4]+Q[15&r]}return n}function et(t){return"0x"+t.map((t=>tt(t).substring(2))).join("")}function nt(t,e,n){const r=X(t);return null!=n&&n>r.length&&H(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),tt(r.slice(null==e?0:e,null==n?r.length:n))}function rt(t,e,n){const r=X(t);H(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),n?i.set(r,e-r.length):i.set(r,0),tt(i)}let it=!1;const st=function(t){return C(t)};let ot=st;function at(t){const e=X(t,"data");return tt(ot(e))}function ct(t,e,n,r,i){if("BAD_PREFIX"===t||"UNEXPECTED_CONTINUE"===t){let t=0;for(let r=e+1;r<n.length&&n[r]>>6==2;r++)t++;return t}return"OVERRUN"===t?n.length-e-1:0}at._=st,at.lock=function(){it=!0},at.register=function(t){if(it)throw new TypeError("keccak256 is locked");ot=t},Object.freeze(at);const ut=Object.freeze({error:function(t,e,n,r,i){J(!1,"invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",n)},ignore:ct,replace:function(t,e,n,r,i){return"OVERLONG"===t?(J("number"==typeof i,"invalid bad code point for replacement","badCodepoint",i),r.push(i),0):(r.push(65533),ct(t,e,n))}});function lt(t,e){J("string"==typeof t,"invalid string value","str",t),null!=e&&(function(t){H(W.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}(e),t=t.normalize(e));let n=[];for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);J(e<t.length&&56320==(64512&i),"invalid surrogate pair","str",t);const s=65536+((1023&r)<<10)+(1023&i);n.push(s>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return new Uint8Array(n)}function ht(t,e){return function(t,e){null==e&&(e=ut.error);const n=X(t,"bytes"),r=[];let i=0;for(;i<n.length;){const t=n[i++];if(!(t>>7)){r.push(t);continue}let s=null,o=null;if(192==(224&t))s=1,o=127;else if(224==(240&t))s=2,o=2047;else{if(240!=(248&t)){i+=e(128==(192&t)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",i-1,n,r);continue}s=3,o=65535}if(i-1+s>=n.length){i+=e("OVERRUN",i-1,n,r);continue}let a=t&(1<<8-s-1)-1;for(let t=0;t<s;t++){let t=n[i];if(128!=(192&t)){i+=e("MISSING_CONTINUE",i,n,r),a=null;break}a=a<<6|63&t,i++}null!==a&&(a>1114111?i+=e("OUT_OF_RANGE",i-1-s,n,r,a):a>=55296&&a<=57343?i+=e("UTF16_SURROGATE",i-1-s,n,r,a):a<=o?i+=e("OVERLONG",i-1-s,n,r,a):r.push(a))}return r}(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function ft(t){return at(lt(t))}const pt=BigInt(0),dt=BigInt(1),gt=9007199254740991;function yt(t,e){const n=bt(t,"value"),r=BigInt(Et(e,"bits"));return n&(dt<<r)-dt}function mt(t,e){switch(typeof t){case"bigint":return t;case"number":return J(Number.isInteger(t),"underflow",e||"value",t),J(t>=-gt&&t<=gt,"overflow",e||"value",t),BigInt(t);case"string":try{if(""===t)throw new Error("empty string");return"-"===t[0]&&"-"!==t[1]?-BigInt(t.substring(1)):BigInt(t)}catch(n){J(!1,"invalid BigNumberish string: ".concat(n.message),e||"value",t)}}J(!1,"invalid BigNumberish value",e||"value",t)}function bt(t,e){const n=mt(t,e);return H(n>=pt,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const vt="0123456789abcdef";function wt(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=vt[n>>4],e+=vt[15&n];return BigInt(e)}return mt(t)}function Et(t,e){switch(typeof t){case"bigint":return J(t>=-gt&&t<=gt,"overflow",e||"value",t),Number(t);case"number":return J(Number.isInteger(t),"underflow",e||"value",t),J(t>=-gt&&t<=gt,"overflow",e||"value",t),t;case"string":try{if(""===t)throw new Error("empty string");return Et(BigInt(t),e)}catch(n){J(!1,"invalid numeric string: ".concat(n.message),e||"value",t)}}J(!1,"invalid numeric value",e||"value",t)}function Ot(t,e){const n=bt(t,"value");let r=n.toString(16);if(null==e)r.length%2&&(r="0"+r);else{const i=Et(e,"width");if(0===i&&n===pt)return"0x";for(H(2*i>=r.length,"value exceeds width (".concat(i," bytes)"),"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<2*i;)r="0"+r}return"0x"+r}function Pt(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Nt=0;function Tt(t){return"__private_"+Nt+++"_"+t}const kt=32,xt=new Uint8Array(kt),Rt=["then"],At={},_t=new WeakMap;function It(t){return _t.get(t)}function jt(t,e){_t.set(t,e)}function Ut(t,e){const n=new Error("deferred error during ABI decoding triggered accessing ".concat(t));throw n.error=e,n}function St(t,e,n){return t.indexOf(null)>=0?e.map(((t,e)=>t instanceof Ct?St(It(t),t,n):t)):t.reduce(((t,r,i)=>{let s=e.getValue(r);return r in t||(n&&s instanceof Ct&&(s=St(It(s),s,n)),t[r]=s),t}),{})}var Ft=Tt("names");class Ct extends Array{constructor(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];const r=e[0];let i=e[1],s=(e[2]||[]).slice(),o=!0;r!==At&&(i=e,s=[],o=!1),super(i.length),Object.defineProperty(this,Ft,{writable:!0,value:void 0}),i.forEach(((t,e)=>{this[e]=t}));const a=s.reduce(((t,e)=>("string"==typeof e&&t.set(e,(t.get(e)||0)+1),t)),new Map);if(jt(this,Object.freeze(i.map(((t,e)=>{const n=s[e];return null!=n&&1===a.get(n)?n:null})))),Pt(this,Ft)[Ft]=[],null==Pt(this,Ft)[Ft]&&Pt(this,Ft)[Ft],!o)return;Object.freeze(this);const c=new Proxy(this,{get:(t,e,n)=>{if("string"==typeof e){if(e.match(/^[0-9]+$/)){const n=Et(e,"%index");if(n<0||n>=this.length)throw new RangeError("out of result range");const r=t[n];return r instanceof Error&&Ut("index ".concat(n),r),r}if(Rt.indexOf(e)>=0)return Reflect.get(t,e,n);const r=t[e];if(r instanceof Function)return function(){for(var e=arguments.length,i=new Array(e),s=0;s<e;s++)i[s]=arguments[s];return r.apply(this===n?t:this,i)};if(!(e in t))return t.getValue.apply(this===n?t:this,[e])}return Reflect.get(t,e,n)}});return jt(c,It(this)),c}toArray(t){const e=[];return this.forEach(((n,r)=>{n instanceof Error&&Ut("index ".concat(r),n),t&&n instanceof Ct&&(n=n.toArray(t)),e.push(n)})),e}toObject(t){const e=It(this);return e.reduce(((n,r,i)=>(H(null!=r,"value at index ".concat(i," unnamed"),"UNSUPPORTED_OPERATION",{operation:"toObject()"}),St(e,this,t))),{})}slice(t,e){null==t&&(t=0),t<0&&(t+=this.length)<0&&(t=0),null==e&&(e=this.length),e<0&&(e+=this.length)<0&&(e=0),e>this.length&&(e=this.length);const n=It(this),r=[],i=[];for(let s=t;s<e;s++)r.push(this[s]),i.push(n[s]);return new Ct(At,r,i)}filter(t,e){const n=It(this),r=[],i=[];for(let s=0;s<this.length;s++){const o=this[s];o instanceof Error&&Ut("index ".concat(s),o),t.call(e,o,s,this)&&(r.push(o),i.push(n[s]))}return new Ct(At,r,i)}map(t,e){const n=[];for(let r=0;r<this.length;r++){const i=this[r];i instanceof Error&&Ut("index ".concat(r),i),n.push(t.call(e,i,r,this))}return n}getValue(t){const e=It(this).indexOf(t);if(-1===e)return;const n=this[e];return n instanceof Error&&Ut("property ".concat(JSON.stringify(t)),n.error),n}static fromItems(t,e){return new Ct(At,t,e)}}function Lt(t){let e=function(t,e){const n=bt(t,"value");if(n===pt){const t=null!=e?Et(e,"width"):0;return new Uint8Array(t)}let r=n.toString(16);if(r.length%2&&(r="0"+r),null!=e){const n=Et(e,"width");for(;r.length<2*n;)r="00"+r;H(2*n===r.length,"value exceeds width (".concat(n," bytes)"),"NUMERIC_FAULT",{operation:"toBeArray",fault:"overflow",value:t})}const i=new Uint8Array(r.length/2);for(let t=0;t<i.length;t++){const e=2*t;i[t]=parseInt(r.substring(e,e+2),16)}return i}(t);return H(e.length<=kt,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:kt,offset:e.length}),e.length!==kt&&(e=Y(et([xt.slice(e.length%kt),e]))),e}class Dt{constructor(t,e,n,r){this.name=void 0,this.type=void 0,this.localName=void 0,this.dynamic=void 0,B(this,{name:t,type:e,localName:n,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){J(!1,t,this.localName,e)}}var Bt=Tt("data"),Mt=Tt("dataLength"),Gt=Tt("writeData");class Vt{constructor(){Object.defineProperty(this,Gt,{value:zt}),Object.defineProperty(this,Bt,{writable:!0,value:void 0}),Object.defineProperty(this,Mt,{writable:!0,value:void 0}),Pt(this,Bt)[Bt]=[],Pt(this,Mt)[Mt]=0}get data(){return et(Pt(this,Bt)[Bt])}get length(){return Pt(this,Mt)[Mt]}appendWriter(t){return Pt(this,Gt)[Gt](Y(t.data))}writeBytes(t){let e=Y(t);const n=e.length%kt;return n&&(e=Y(et([e,xt.slice(n)]))),Pt(this,Gt)[Gt](e)}writeValue(t){return Pt(this,Gt)[Gt](Lt(t))}writeUpdatableValue(){const t=Pt(this,Bt)[Bt].length;return Pt(this,Bt)[Bt].push(xt),Pt(this,Mt)[Mt]+=kt,e=>{Pt(this,Bt)[Bt][t]=Lt(e)}}}function zt(t){return Pt(this,Bt)[Bt].push(t),Pt(this,Mt)[Mt]+=t.length,t.length}var Ht=Tt("data"),Jt=Tt("offset"),Kt=Tt("bytesRead"),Wt=Tt("parent"),qt=Tt("maxInflation"),$t=Tt("incrementBytesRead"),Xt=Tt("peekBytes");class Yt{constructor(t,e,n){Object.defineProperty(this,Xt,{value:Qt}),Object.defineProperty(this,$t,{value:Zt}),this.allowLoose=void 0,Object.defineProperty(this,Ht,{writable:!0,value:void 0}),Object.defineProperty(this,Jt,{writable:!0,value:void 0}),Object.defineProperty(this,Kt,{writable:!0,value:void 0}),Object.defineProperty(this,Wt,{writable:!0,value:void 0}),Object.defineProperty(this,qt,{writable:!0,value:void 0}),B(this,{allowLoose:!!e}),Pt(this,Ht)[Ht]=Y(t),Pt(this,Kt)[Kt]=0,Pt(this,Wt)[Wt]=null,Pt(this,qt)[qt]=null!=n?n:1024,Pt(this,Jt)[Jt]=0}get data(){return tt(Pt(this,Ht)[Ht])}get dataLength(){return Pt(this,Ht)[Ht].length}get consumed(){return Pt(this,Jt)[Jt]}get bytes(){return new Uint8Array(Pt(this,Ht)[Ht])}subReader(t){const e=new Yt(Pt(this,Ht)[Ht].slice(Pt(this,Jt)[Jt]+t),this.allowLoose,Pt(this,qt)[qt]);return Pt(e,Wt)[Wt]=this,e}readBytes(t,e){let n=Pt(this,Xt)[Xt](0,t,!!e);return Pt(this,$t)[$t](t),Pt(this,Jt)[Jt]+=n.length,n.slice(0,t)}readValue(){return wt(this.readBytes(kt))}readIndex(){return Et(wt(this.readBytes(kt)))}}function Zt(t){if(Pt(this,Wt)[Wt])return Pt(Pt(this,Wt)[Wt],$t)[$t](t);Pt(this,Kt)[Kt]+=t,H(Pt(this,qt)[qt]<1||Pt(this,Kt)[Kt]<=Pt(this,qt)[qt]*this.dataLength,"compressed ABI data exceeds inflation ratio of ".concat(Pt(this,qt)[qt]," ( see: https://github.com/ethers-io/ethers.js/issues/4537 )"),"BUFFER_OVERRUN",{buffer:Y(Pt(this,Ht)[Ht]),offset:Pt(this,Jt)[Jt],length:t,info:{bytesRead:Pt(this,Kt)[Kt],dataLength:this.dataLength}})}function Qt(t,e,n){let r=Math.ceil(e/kt)*kt;return Pt(this,Jt)[Jt]+r>Pt(this,Ht)[Ht].length&&(this.allowLoose&&n&&Pt(this,Jt)[Jt]+e<=Pt(this,Ht)[Ht].length?r=e:H(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Y(Pt(this,Ht)[Ht]),length:Pt(this,Ht)[Ht].length,offset:Pt(this,Jt)[Jt]+r})),Pt(this,Ht)[Ht].slice(Pt(this,Jt)[Jt],Pt(this,Jt)[Jt]+r)}const te=BigInt(0),ee=BigInt(36);function ne(t){const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=X(at(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const re={};for(let t=0;t<10;t++)re[String(t)]=String(t);for(let t=0;t<26;t++)re[String.fromCharCode(65+t)]=String(10+t);const ie=function(){const t={};for(let e=0;e<36;e++)t["0123456789abcdefghijklmnopqrstuvwxyz"[e]]=BigInt(e);return t}();function se(t){if(J("string"==typeof t,"invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=ne(t);return J(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){J(t.substring(2,4)===function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>re[t])).join("");for(;e.length>=15;){let t=e.substring(0,15);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t),"bad icap checksum","address",t);let e=function(t){t=t.toLowerCase();let e=te;for(let n=0;n<t.length;n++)e=e*ee+ie[t[n]];return e}(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return ne("0x"+e)}J(!1,"invalid address","address",t)}function oe(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var ae=0;function ce(t){return"__private_"+ae+++"_"+t}const ue={};function le(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new de(ue,"".concat(n?"":"u","int").concat(e),t,{signed:n,width:e})}function he(t,e){return new de(ue,"bytes".concat(e||""),t,{size:e})}const fe=Symbol.for("_ethers_typed");var pe=ce("options");class de{constructor(t,e,n,r){this.type=void 0,this.value=void 0,Object.defineProperty(this,pe,{writable:!0,value:void 0}),this._typedSymbol=void 0,null==r&&(r=null),q(ue,t,"Typed"),B(this,{_typedSymbol:fe,type:e,value:n}),oe(this,pe)[pe]=r,this.format()}format(){if("array"===this.type)throw new Error("");if("dynamicArray"===this.type)throw new Error("");return"tuple"===this.type?"tuple(".concat(this.value.map((t=>t.format())).join(","),")"):this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return oe(this,pe)[pe]}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===oe(this,pe)[pe]?-1:!1===oe(this,pe)[pe]?this.value.length:null}static from(t,e){return new de(ue,t,e)}static uint8(t){return le(t,8)}static uint16(t){return le(t,16)}static uint24(t){return le(t,24)}static uint32(t){return le(t,32)}static uint40(t){return le(t,40)}static uint48(t){return le(t,48)}static uint56(t){return le(t,56)}static uint64(t){return le(t,64)}static uint72(t){return le(t,72)}static uint80(t){return le(t,80)}static uint88(t){return le(t,88)}static uint96(t){return le(t,96)}static uint104(t){return le(t,104)}static uint112(t){return le(t,112)}static uint120(t){return le(t,120)}static uint128(t){return le(t,128)}static uint136(t){return le(t,136)}static uint144(t){return le(t,144)}static uint152(t){return le(t,152)}static uint160(t){return le(t,160)}static uint168(t){return le(t,168)}static uint176(t){return le(t,176)}static uint184(t){return le(t,184)}static uint192(t){return le(t,192)}static uint200(t){return le(t,200)}static uint208(t){return le(t,208)}static uint216(t){return le(t,216)}static uint224(t){return le(t,224)}static uint232(t){return le(t,232)}static uint240(t){return le(t,240)}static uint248(t){return le(t,248)}static uint256(t){return le(t,256)}static uint(t){return le(t,256)}static int8(t){return le(t,-8)}static int16(t){return le(t,-16)}static int24(t){return le(t,-24)}static int32(t){return le(t,-32)}static int40(t){return le(t,-40)}static int48(t){return le(t,-48)}static int56(t){return le(t,-56)}static int64(t){return le(t,-64)}static int72(t){return le(t,-72)}static int80(t){return le(t,-80)}static int88(t){return le(t,-88)}static int96(t){return le(t,-96)}static int104(t){return le(t,-104)}static int112(t){return le(t,-112)}static int120(t){return le(t,-120)}static int128(t){return le(t,-128)}static int136(t){return le(t,-136)}static int144(t){return le(t,-144)}static int152(t){return le(t,-152)}static int160(t){return le(t,-160)}static int168(t){return le(t,-168)}static int176(t){return le(t,-176)}static int184(t){return le(t,-184)}static int192(t){return le(t,-192)}static int200(t){return le(t,-200)}static int208(t){return le(t,-208)}static int216(t){return le(t,-216)}static int224(t){return le(t,-224)}static int232(t){return le(t,-232)}static int240(t){return le(t,-240)}static int248(t){return le(t,-248)}static int256(t){return le(t,-256)}static int(t){return le(t,-256)}static bytes1(t){return he(t,1)}static bytes2(t){return he(t,2)}static bytes3(t){return he(t,3)}static bytes4(t){return he(t,4)}static bytes5(t){return he(t,5)}static bytes6(t){return he(t,6)}static bytes7(t){return he(t,7)}static bytes8(t){return he(t,8)}static bytes9(t){return he(t,9)}static bytes10(t){return he(t,10)}static bytes11(t){return he(t,11)}static bytes12(t){return he(t,12)}static bytes13(t){return he(t,13)}static bytes14(t){return he(t,14)}static bytes15(t){return he(t,15)}static bytes16(t){return he(t,16)}static bytes17(t){return he(t,17)}static bytes18(t){return he(t,18)}static bytes19(t){return he(t,19)}static bytes20(t){return he(t,20)}static bytes21(t){return he(t,21)}static bytes22(t){return he(t,22)}static bytes23(t){return he(t,23)}static bytes24(t){return he(t,24)}static bytes25(t){return he(t,25)}static bytes26(t){return he(t,26)}static bytes27(t){return he(t,27)}static bytes28(t){return he(t,28)}static bytes29(t){return he(t,29)}static bytes30(t){return he(t,30)}static bytes31(t){return he(t,31)}static bytes32(t){return he(t,32)}static address(t){return new de(ue,"address",t)}static bool(t){return new de(ue,"bool",!!t)}static bytes(t){return new de(ue,"bytes",t)}static string(t){return new de(ue,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new de(ue,"overrides",Object.assign({},t))}static isTyped(t){return t&&"object"==typeof t&&"_typedSymbol"in t&&t._typedSymbol===fe}static dereference(t,e){if(de.isTyped(t)){if(t.type!==e)throw new Error("invalid type: expecetd ".concat(e,", got ").concat(t.type));return t.value}return t}}class ge extends Dt{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let n=de.dereference(e,"string");try{n=se(n)}catch(t){return this._throwError(t.message,e)}return t.writeValue(n)}decode(t){return se(Ot(t.readValue(),20))}}class ye extends Dt{constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=void 0,this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}function me(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return H(r,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:e},value:n}),H(!t[r],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:e},value:n}),t[r]=!0,n[r]}))}else J(!1,"invalid tuple value","tuple",n);J(e.length===r.length,"types/value length mismatch","tuple",n);let i=new Vt,s=new Vt,o=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=s.length;t.encode(s,n);let r=i.writeUpdatableValue();o.push((t=>{r(t+e)}))}else t.encode(i,n)})),o.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function be(t,e){let n=[],r=[],i=t.subReader(0);return e.forEach((e=>{let s=null;if(e.dynamic){let n=t.readIndex(),r=i.subReader(n);try{s=e.decode(r)}catch(t){if(G(t,"BUFFER_OVERRUN"))throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}}else try{s=e.decode(t)}catch(t){if(G(t,"BUFFER_OVERRUN"))throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}if(null==s)throw new Error("investigate");n.push(s),r.push(e.localName||null)})),Ct.fromItems(n,r)}class ve extends Dt{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=void 0,this.length=void 0,B(this,{coder:t,length:e})}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;n<this.length;n++)e.push(t);return e}encode(t,e){const n=de.dereference(e,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;-1===r&&(r=n.length,t.writeValue(n.length)),K(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let i=[];for(let t=0;t<n.length;t++)i.push(this.coder);return me(t,i,n)}decode(t){let e=this.length;-1===e&&(e=t.readIndex(),H(e*kt<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*kt,length:t.dataLength}));let n=[];for(let t=0;t<e;t++)n.push(new ye(this.coder));return be(t,n)}}class we extends Dt{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){const n=de.dereference(e,"bool");return t.writeValue(n?1:0)}decode(t){return!!t.readValue()}}class Ee extends Dt{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=Y(e);let n=t.writeValue(e.length);return n+=t.writeBytes(e),n}decode(t){return t.readBytes(t.readIndex(),!0)}}class Oe extends Ee{constructor(t){super("bytes",t)}decode(t){return tt(super.decode(t))}}class Pe extends Dt{constructor(t,e){let n="bytes"+String(t);super(n,n,e,!1),this.size=void 0,B(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let n=Y(de.dereference(e,this.type));return n.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(n)}decode(t){return tt(t.readBytes(this.size))}}const Ne=new Uint8Array([]);class Te extends Dt{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes(Ne)}decode(t){return t.readBytes(0),null}}const ke=BigInt(0),xe=BigInt(1),Re=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Ae extends Dt{constructor(t,e,n){const r=(e?"int":"uint")+8*t;super(r,r,n,!1),this.size=void 0,this.signed=void 0,B(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let n=mt(de.dereference(e,this.type)),r=yt(Re,256);if(this.signed){let t=yt(r,8*this.size-1);(n>t||n<-(t+xe))&&this._throwError("value out-of-bounds",e),n=function(t){let e=mt(t,"value");const n=BigInt(Et(256,"width")),r=dt<<n-dt;return e<pt?(e=-e,H(e<=r,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t}),(~e&(dt<<n)-dt)+dt):(H(e<r,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t}),e)}(n)}else(n<ke||n>yt(r,8*this.size))&&this._throwError("value out-of-bounds",e);return t.writeValue(n)}decode(t){let e=yt(t.readValue(),8*this.size);return this.signed&&(e=function(t,e){const n=bt(t,"value"),r=BigInt(Et(e,"width"));return H(n>>r===pt,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-dt?-((~n&(dt<<r)-dt)+dt):n}(e,8*this.size)),e}}class _e extends Ee{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,lt(de.dereference(e,"string")))}decode(t){return ht(super.decode(t))}}class Ie extends Dt{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)})),super("tuple","tuple("+r.join(",")+")",e,n),this.coders=void 0,B(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){const n=de.dereference(e,"tuple");return me(t,this.coders,n)}decode(t){return be(t,this.coders)}}var je;function Ue(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Se=0;function Fe(t){return"__private_"+Se+++"_"+t}function Ce(t){const e=new Set;return t.forEach((t=>e.add(t))),Object.freeze(e)}const Le=Ce("external public payable override".split(" ")),De="constant external internal payable private public pure view override",Be=Ce(De.split(" ")),Me="constructor error event fallback function receive struct",Ge=Ce(Me.split(" ")),Ve="calldata memory storage payable indexed",ze=Ce(Ve.split(" ")),He=Ce([Me,Ve,"tuple returns",De].join(" ").split(" ")),Je={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Ke=new RegExp("^(\\s*)"),We=new RegExp("^([0-9]+)"),qe=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),$e=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),Xe=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Ye=Fe("offset"),Ze=Fe("tokens"),Qe=Fe("subTokenString");class tn{get offset(){return Ue(this,Ye)[Ye]}get length(){return Ue(this,Ze)[Ze].length-Ue(this,Ye)[Ye]}constructor(t){Object.defineProperty(this,Qe,{value:en}),Object.defineProperty(this,Ye,{writable:!0,value:void 0}),Object.defineProperty(this,Ze,{writable:!0,value:void 0}),Ue(this,Ye)[Ye]=0,Ue(this,Ze)[Ze]=t.slice()}clone(){return new tn(Ue(this,Ze)[Ze])}reset(){Ue(this,Ye)[Ye]=0}popKeyword(t){const e=this.peek();if("KEYWORD"!==e.type||!t.has(e.text))throw new Error("expected keyword ".concat(e.text));return this.pop().text}popType(t){if(this.peek().type!==t){const e=this.peek();throw new Error("expected ".concat(t,"; got ").concat(e.type," ").concat(JSON.stringify(e.text)))}return this.pop().text}popParen(){const t=this.peek();if("OPEN_PAREN"!==t.type)throw new Error("bad start");const e=Ue(this,Qe)[Qe](Ue(this,Ye)[Ye]+1,t.match+1);return Ue(this,Ye)[Ye]=t.match+1,e}popParams(){const t=this.peek();if("OPEN_PAREN"!==t.type)throw new Error("bad start");const e=[];for(;Ue(this,Ye)[Ye]<t.match-1;){const t=this.peek().linkNext;e.push(Ue(this,Qe)[Qe](Ue(this,Ye)[Ye]+1,t)),Ue(this,Ye)[Ye]=t}return Ue(this,Ye)[Ye]=t.match+1,e}peek(){if(Ue(this,Ye)[Ye]>=Ue(this,Ze)[Ze].length)throw new Error("out-of-bounds");return Ue(this,Ze)[Ze][Ue(this,Ye)[Ye]]}peekKeyword(t){const e=this.peekType("KEYWORD");return null!=e&&t.has(e)?e:null}peekType(t){if(0===this.length)return null;const e=this.peek();return e.type===t?e.text:null}pop(){const t=this.peek();return Ue(this,Ye)[Ye]++,t}toString(){const t=[];for(let e=Ue(this,Ye)[Ye];e<Ue(this,Ze)[Ze].length;e++){const n=Ue(this,Ze)[Ze][e];t.push("".concat(n.type,":").concat(n.text))}return"<TokenString ".concat(t.join(" "),">")}}function en(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new je(Ue(this,Ze)[Ze].slice(t,e).map((e=>Object.freeze(Object.assign({},e,{match:e.match-t,linkBack:e.linkBack-t,linkNext:e.linkNext-t})))))}function nn(t){const e=[],n=e=>{const n=s<t.length?JSON.stringify(t[s]):"$EOI";throw new Error("invalid token ".concat(n," at ").concat(s,": ").concat(e))};let r=[],i=[],s=0;for(;s<t.length;){let o=t.substring(s),a=o.match(Ke);a&&(s+=a[1].length,o=t.substring(s));const c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};e.push(c);let u=Je[o[0]]||"";if(u){if(c.type=u,c.text=o[0],s++,"OPEN_PAREN"===u)r.push(e.length-1),i.push(e.length-1);else if("CLOSE_PAREN"==u)0===r.length&&n("no matching open bracket"),c.match=r.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=i.pop(),e[c.linkBack].linkNext=e.length-1;else if("COMMA"===u)c.linkBack=i.pop(),e[c.linkBack].linkNext=e.length-1,i.push(e.length-1);else if("OPEN_BRACKET"===u)c.type="BRACKET";else if("CLOSE_BRACKET"===u){let t=e.pop().text;if(e.length>0&&"NUMBER"===e[e.length-1].type){const n=e.pop().text;t=n+t,e[e.length-1].value=Et(n)}if(0===e.length||"BRACKET"!==e[e.length-1].type)throw new Error("missing opening bracket");e[e.length-1].text+=t}}else if(a=o.match(qe),a){if(c.text=a[1],s+=c.text.length,He.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(Xe)){c.type="TYPE";continue}c.type="ID"}else{if(a=o.match(We),!a)throw new Error("unexpected token ".concat(JSON.stringify(o[0])," at position ").concat(s));c.text=a[1],c.type="NUMBER",s+=c.text.length}}return new tn(e.map((t=>Object.freeze(t))))}function rn(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error("conflicting types: ".concat(n.join(", ")))}function sn(t,e){if(e.peekKeyword(Ge)){const n=e.pop().text;if(n!==t)throw new Error("expected ".concat(t,", got ").concat(n))}return e.popType("ID")}function on(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(null==r||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error("duplicate keywords: ".concat(JSON.stringify(r)));n.add(r)}return Object.freeze(n)}function an(t){let e=on(t,Be);return rn(e,Ce("constant payable nonpayable".split(" "))),rn(e,Ce("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function cn(t,e){return t.popParams().map((t=>Pn.from(t,e)))}function un(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return mt(t.pop().text);throw new Error("invalid gas")}return null}function ln(t){if(t.length)throw new Error("unexpected tokens at offset ".concat(t.offset,": ").concat(t.toString()))}je=tn;const hn=new RegExp(/^(.*)\[([0-9]*)\]$/);function fn(t){const e=t.match(Xe);if(J(e,"invalid type","type",t),"uint"===t)return"uint256";if("int"===t)return"int256";if(e[2]){const n=parseInt(e[2]);J(0!==n&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);J(0!==n&&n<=256&&n%8==0,"invalid numeric width","type",t)}return t}const pn={},dn=Symbol.for("_ethers_internal"),gn="_ParamTypeInternal",yn="_ErrorInternal",mn="_EventInternal",bn="_ConstructorInternal",vn="_FallbackInternal",wn="_FunctionInternal",En="_StructInternal";var On=Fe("walkAsync");class Pn{constructor(t,e,n,r,i,s,o,a){if(Object.defineProperty(this,On,{value:Nn}),this.name=void 0,this.type=void 0,this.baseType=void 0,this.indexed=void 0,this.components=void 0,this.arrayLength=void 0,this.arrayChildren=void 0,q(t,pn,"ParamType"),Object.defineProperty(this,dn,{value:gn}),s&&(s=Object.freeze(s.slice())),"array"===r){if(null==o||null==a)throw new Error("")}else if(null!=o||null!=a)throw new Error("");if("tuple"===r){if(null==s)throw new Error("")}else if(null!=s)throw new Error("");B(this,{name:e,type:n,baseType:r,indexed:i,components:s,arrayLength:o,arrayChildren:a})}format(t){if(null==t&&(t="sighash"),"json"===t){const e=this.name||"";if(this.isArray()){const t=JSON.parse(this.arrayChildren.format("json"));return t.name=e,t.type+="[".concat(this.arrayLength<0?"":String(this.arrayLength),"]"),JSON.stringify(t)}const n={type:"tuple"===this.baseType?"tuple":this.type,name:e};return"boolean"==typeof this.indexed&&(n.indexed=this.indexed),this.isTuple()&&(n.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(n)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+="[".concat(this.arrayLength<0?"":String(this.arrayLength),"]")):this.isTuple()?e+="("+this.components.map((e=>e.format(t))).join("full"===t?", ":",")+")":e+=this.type,"sighash"!==t&&(!0===this.indexed&&(e+=" indexed"),"full"===t&&this.name&&(e+=" "+this.name)),e}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(-1!==this.arrayLength&&t.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return t.map((t=>n.arrayChildren.walk(t,e)))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");const n=this;return t.map(((t,r)=>n.components[r].walk(t,e)))}return e(this.type,t)}async walkAsync(t,e){const n=[],r=[t];return Ue(this,On)[On](n,t,e,(t=>{r[0]=t})),n.length&&await Promise.all(n),r[0]}static from(t,e){if(Pn.isParamType(t))return t;if("string"==typeof t)try{return Pn.from(nn(t),e)}catch(e){J(!1,"invalid param type","obj",t)}else if(t instanceof tn){let n="",r="",i=null;on(t,Ce(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(r="tuple",i=t.popParams().map((t=>Pn.from(t))),n="tuple(".concat(i.map((t=>t.format())).join(","),")")):(n=fn(t.popType("TYPE")),r=n);let s=null,o=null;for(;t.length&&t.peekType("BRACKET");){const e=t.pop();s=new Pn(pn,"",n,r,null,i,o,s),o=e.value,n+=e.text,r="array",i=null}let a=null;if(on(t,ze).has("indexed")){if(!e)throw new Error("");a=!0}const c=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new Pn(pn,c,n,r,a,i,o,s)}const n=t.name;J(!n||"string"==typeof n&&n.match($e),"invalid name","obj.name",n);let r=t.indexed;null!=r&&(J(e,"parameter cannot be indexed","obj.indexed",t.indexed),r=!!r);let i=t.type,s=i.match(hn);if(s){const e=parseInt(s[2]||"-1"),o=Pn.from({type:s[1],components:t.components});return new Pn(pn,n||"",i,"array",r,null,e,o)}if("tuple"===i||i.startsWith("tuple(")||i.startsWith("(")){const e=null!=t.components?t.components.map((t=>Pn.from(t))):null;return new Pn(pn,n||"",i,"tuple",r,e,null,null)}return i=fn(t.type),new Pn(pn,n||"",i,i,r,null,null,null)}static isParamType(t){return t&&t[dn]===gn}}function Nn(t,e,n,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const i=this.arrayChildren,s=e.slice();return s.forEach(((e,r)=>{Ue(i,On)[On](t,e,n,(t=>{s[r]=t}))})),void r(s)}if(this.isTuple()){const i=this.components;let s;if(Array.isArray(e))s=e.slice();else{if(null==e||"object"!=typeof e)throw new Error("invalid tuple value");s=i.map((t=>{if(!t.name)throw new Error("cannot use object value with unnamed components");if(!(t.name in e))throw new Error("missing value for component ".concat(t.name));return e[t.name]}))}if(s.length!==this.components.length)throw new Error("array is wrong length");return s.forEach(((e,r)=>{Ue(i[r],On)[On](t,e,n,(t=>{s[r]=t}))})),void r(s)}const i=n(this.type,e);i.then?t.push(async function(){r(await i)}()):r(i)}class Tn{constructor(t,e,n){this.type=void 0,this.inputs=void 0,q(t,pn,"Fragment"),B(this,{type:e,inputs:n=Object.freeze(n.slice())})}static from(t){if("string"==typeof t){try{Tn.from(JSON.parse(t))}catch(t){}return Tn.from(nn(t))}if(t instanceof tn)switch(t.peekKeyword(Ge)){case"constructor":return _n.from(t);case"error":return Rn.from(t);case"event":return An.from(t);case"fallback":case"receive":return In.from(t);case"function":return jn.from(t);case"struct":return Un.from(t)}else if("object"==typeof t){switch(t.type){case"constructor":return _n.from(t);case"error":return Rn.from(t);case"event":return An.from(t);case"fallback":case"receive":return In.from(t);case"function":return jn.from(t);case"struct":return Un.from(t)}H(!1,"unsupported type: ".concat(t.type),"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}J(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return _n.isFragment(t)}static isError(t){return Rn.isFragment(t)}static isEvent(t){return An.isFragment(t)}static isFunction(t){return jn.isFragment(t)}static isStruct(t){return Un.isFragment(t)}}class kn extends Tn{constructor(t,e,n,r){super(t,e,r),this.name=void 0,J("string"==typeof n&&n.match($e),"invalid identifier","name",n),r=Object.freeze(r.slice()),B(this,{name:n})}}function xn(t,e){return"("+e.map((e=>e.format(t))).join("full"===t?", ":",")+")"}class Rn extends kn{constructor(t,e,n){super(t,"error",e,n),Object.defineProperty(this,dn,{value:yn})}get selector(){return ft(this.format("sighash")).substring(0,10)}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("error"),e.push(this.name+xn(t,this.inputs)),e.join(" ")}static from(t){if(Rn.isFragment(t))return t;if("string"==typeof t)return Rn.from(nn(t));if(t instanceof tn){const e=sn("error",t),n=cn(t);return ln(t),new Rn(pn,e,n)}return new Rn(pn,t.name,t.inputs?t.inputs.map(Pn.from):[])}static isFragment(t){return t&&t[dn]===yn}}class An extends kn{constructor(t,e,n,r){super(t,"event",e,n),this.anonymous=void 0,Object.defineProperty(this,dn,{value:mn}),B(this,{anonymous:r})}get topicHash(){return ft(this.format("sighash"))}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("event"),e.push(this.name+xn(t,this.inputs)),"sighash"!==t&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map((t=>Pn.from(t))),new An(pn,t,e,!1).topicHash}static from(t){if(An.isFragment(t))return t;if("string"==typeof t)try{return An.from(nn(t))}catch(e){J(!1,"invalid event fragment","obj",t)}else if(t instanceof tn){const e=sn("event",t),n=cn(t,!0),r=!!on(t,Ce(["anonymous"])).has("anonymous");return ln(t),new An(pn,e,n,r)}return new An(pn,t.name,t.inputs?t.inputs.map((t=>Pn.from(t,!0))):[],!!t.anonymous)}static isFragment(t){return t&&t[dn]===mn}}class _n extends Tn{constructor(t,e,n,r,i){super(t,e,n),this.payable=void 0,this.gas=void 0,Object.defineProperty(this,dn,{value:bn}),B(this,{payable:r,gas:i})}format(t){if(H(null!=t&&"sighash"!==t,"cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),"json"===t)return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=["constructor".concat(xn(t,this.inputs))];return this.payable&&e.push("payable"),null!=this.gas&&e.push("@".concat(this.gas.toString())),e.join(" ")}static from(t){if(_n.isFragment(t))return t;if("string"==typeof t)try{return _n.from(nn(t))}catch(e){J(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof tn){on(t,Ce(["constructor"]));const e=cn(t),n=!!on(t,Le).has("payable"),r=un(t);return ln(t),new _n(pn,"constructor",e,n,r)}return new _n(pn,"constructor",t.inputs?t.inputs.map(Pn.from):[],!!t.payable,null!=t.gas?t.gas:null)}static isFragment(t){return t&&t[dn]===bn}}class In extends Tn{constructor(t,e,n){super(t,"fallback",e),this.payable=void 0,Object.defineProperty(this,dn,{value:vn}),B(this,{payable:n})}format(t){const e=0===this.inputs.length?"receive":"fallback";if("json"===t){const t=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:t})}return"".concat(e,"()").concat(this.payable?" payable":"")}static from(t){if(In.isFragment(t))return t;if("string"==typeof t)try{return In.from(nn(t))}catch(e){J(!1,"invalid fallback fragment","obj",t)}else if(t instanceof tn){const e=t.toString();if(J(t.peekKeyword(Ce(["fallback","receive"])),"type must be fallback or receive","obj",e),"receive"===t.popKeyword(Ce(["fallback","receive"]))){const e=cn(t);return J(0===e.length,"receive cannot have arguments","obj.inputs",e),on(t,Ce(["payable"])),ln(t),new In(pn,[],!0)}let n=cn(t);n.length?J(1===n.length&&"bytes"===n[0].type,"invalid fallback inputs","obj.inputs",n.map((t=>t.format("minimal"))).join(", ")):n=[Pn.from("bytes")];const r=an(t);if(J("nonpayable"===r||"payable"===r,"fallback cannot be constants","obj.stateMutability",r),on(t,Ce(["returns"])).has("returns")){const e=cn(t);J(1===e.length&&"bytes"===e[0].type,"invalid fallback outputs","obj.outputs",e.map((t=>t.format("minimal"))).join(", "))}return ln(t),new In(pn,n,"payable"===r)}if("receive"===t.type)return new In(pn,[],!0);if("fallback"===t.type){const e=[Pn.from("bytes")],n="payable"===t.stateMutability;return new In(pn,e,n)}J(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[dn]===vn}}class jn extends kn{constructor(t,e,n,r,i,s){super(t,"function",e,r),this.constant=void 0,this.outputs=void 0,this.stateMutability=void 0,this.payable=void 0,this.gas=void 0,Object.defineProperty(this,dn,{value:wn}),B(this,{constant:"view"===n||"pure"===n,gas:s,outputs:i=Object.freeze(i.slice()),payable:"payable"===n,stateMutability:n})}get selector(){return ft(this.format("sighash")).substring(0,10)}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("function"),e.push(this.name+xn(t,this.inputs)),"sighash"!==t&&("nonpayable"!==this.stateMutability&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(xn(t,this.outputs))),null!=this.gas&&e.push("@".concat(this.gas.toString()))),e.join(" ")}static getSelector(t,e){return e=(e||[]).map((t=>Pn.from(t))),new jn(pn,t,"view",e,[],null).selector}static from(t){if(jn.isFragment(t))return t;if("string"==typeof t)try{return jn.from(nn(t))}catch(e){J(!1,"invalid function fragment","obj",t)}else if(t instanceof tn){const e=sn("function",t),n=cn(t),r=an(t);let i=[];on(t,Ce(["returns"])).has("returns")&&(i=cn(t));const s=un(t);return ln(t),new jn(pn,e,r,n,i,s)}let e=t.stateMutability;return null==e&&(e="payable","boolean"==typeof t.constant?(e="view",t.constant||(e="payable","boolean"!=typeof t.payable||t.payable||(e="nonpayable"))):"boolean"!=typeof t.payable||t.payable||(e="nonpayable")),new jn(pn,t.name,e,t.inputs?t.inputs.map(Pn.from):[],t.outputs?t.outputs.map(Pn.from):[],null!=t.gas?t.gas:null)}static isFragment(t){return t&&t[dn]===wn}}class Un extends kn{constructor(t,e,n){super(t,"struct",e,n),Object.defineProperty(this,dn,{value:En})}format(){throw new Error("@TODO")}static from(t){if("string"==typeof t)try{return Un.from(nn(t))}catch(e){J(!1,"invalid struct fragment","obj",t)}else if(t instanceof tn){const e=sn("struct",t),n=cn(t);return ln(t),new Un(pn,e,n)}return new Un(pn,t.name,t.inputs?t.inputs.map(Pn.from):[])}static isFragment(t){return t&&t[dn]===En}}function Sn(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Fn=0;function Cn(t){return"__private_"+Fn+++"_"+t}const Ln=new Map;Ln.set(0,"GENERIC_PANIC"),Ln.set(1,"ASSERT_FALSE"),Ln.set(17,"OVERFLOW"),Ln.set(18,"DIVIDE_BY_ZERO"),Ln.set(33,"ENUM_RANGE_ERROR"),Ln.set(34,"BAD_STORAGE_DATA"),Ln.set(49,"STACK_UNDERFLOW"),Ln.set(50,"ARRAY_RANGE_ERROR"),Ln.set(65,"OUT_OF_MEMORY"),Ln.set(81,"UNINITIALIZED_FUNCTION_CALL");const Dn=new RegExp(/^bytes([0-9]*)$/),Bn=new RegExp(/^(u?int)([0-9]*)$/);let Mn=null,Gn=1024;var Vn=Cn("getCoder");class zn{constructor(){Object.defineProperty(this,Vn,{value:Hn})}getDefaultValue(t){const e=t.map((t=>Sn(this,Vn)[Vn](Pn.from(t))));return new Ie(e,"_").defaultValue()}encode(t,e){K(e.length,t.length,"types/values length mismatch");const n=t.map((t=>Sn(this,Vn)[Vn](Pn.from(t)))),r=new Ie(n,"_"),i=new Vt;return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>Sn(this,Vn)[Vn](Pn.from(t))));return new Ie(r,"_").decode(new Yt(e,n,Gn))}static _setDefaultMaxInflation(t){J("number"==typeof t&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),Gn=t}static defaultAbiCoder(){return null==Mn&&(Mn=new zn),Mn}static getBuiltinCallException(t,e,n){return function(t,e,n,r){let i="missing revert data",s=null,o=null;if(n){i="execution reverted";const t=X(n);if(n=tt(n),0===t.length)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(t.length%32!=4)i+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===tt(t.slice(0,4)))try{s=r.decode(["string"],t.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[s]},i+=": ".concat(JSON.stringify(s))}catch(t){i+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===tt(t.slice(0,4)))try{const e=Number(r.decode(["uint256"],t.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[e]},s="Panic due to ".concat(Ln.get(e)||"UNKNOWN","(").concat(e,")"),i+=": ".concat(s)}catch(t){i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const a={to:e.to?se(e.to):null,data:e.data||"0x"};return e.from&&(a.from=se(e.from)),z(i,"CALL_EXCEPTION",{action:t,data:n,reason:s,transaction:a,invocation:null,revert:o})}(t,e,n,zn.defaultAbiCoder())}}function Hn(t){if(t.isArray())return new ve(Sn(this,Vn)[Vn](t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new Ie(t.components.map((t=>Sn(this,Vn)[Vn](t))),t.name);switch(t.baseType){case"address":return new ge(t.name);case"bool":return new we(t.name);case"string":return new _e(t.name);case"bytes":return new Oe(t.name);case"":return new Te(t.name)}let e=t.type.match(Bn);if(e){let n=parseInt(e[2]||"256");return J(0!==n&&n<=256&&n%8==0,"invalid "+e[1]+" bit length","param",t),new Ae(n/8,"int"===e[1],t.name)}if(e=t.type.match(Dn),e){let n=parseInt(e[1]);return J(0!==n&&n<=32,"invalid bytes length","param",t),new Pe(n,t.name)}J(!1,"invalid type","type",t.type)}function Jn(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Kn=0;function Wn(t){return"__private_"+Kn+++"_"+t}class qn{constructor(t,e,n){this.fragment=void 0,this.name=void 0,this.signature=void 0,this.topic=void 0,this.args=void 0;const r=t.name,i=t.format();B(this,{fragment:t,name:r,signature:i,topic:e,args:n})}}class $n{constructor(t,e,n,r){this.fragment=void 0,this.name=void 0,this.args=void 0,this.signature=void 0,this.selector=void 0,this.value=void 0;const i=t.name,s=t.format();B(this,{fragment:t,name:i,args:n,signature:s,selector:e,value:r})}}class Xn{constructor(t,e,n){this.fragment=void 0,this.name=void 0,this.args=void 0,this.signature=void 0,this.selector=void 0;const r=t.name,i=t.format();B(this,{fragment:t,name:r,args:n,signature:i,selector:e})}}class Yn{static isIndexed(t){return!(!t||!t._isIndexed)}constructor(t){this.hash=void 0,this._isIndexed=void 0,B(this,{hash:t,_isIndexed:!0})}}const Zn={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Qn={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>"reverted with reason string ".concat(JSON.stringify(t))},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&Zn[t.toString()]&&(e=Zn[t.toString()]),"reverted with panic code 0x".concat(t.toString(16)," (").concat(e,")")}}};var tr=Wn("errors"),er=Wn("events"),nr=Wn("functions"),rr=Wn("abiCoder"),ir=Wn("getFunction"),sr=Wn("getEvent");class or{constructor(t){Object.defineProperty(this,sr,{value:cr}),Object.defineProperty(this,ir,{value:ar}),this.fragments=void 0,this.deploy=void 0,this.fallback=void 0,this.receive=void 0,Object.defineProperty(this,tr,{writable:!0,value:void 0}),Object.defineProperty(this,er,{writable:!0,value:void 0}),Object.defineProperty(this,nr,{writable:!0,value:void 0}),Object.defineProperty(this,rr,{writable:!0,value:void 0});let e=[];e="string"==typeof t?JSON.parse(t):t,Jn(this,nr)[nr]=new Map,Jn(this,tr)[tr]=new Map,Jn(this,er)[er]=new Map;const n=[];for(const t of e)try{n.push(Tn.from(t))}catch(e){console.log("[Warning] Invalid Fragment ".concat(JSON.stringify(t),":"),e.message)}B(this,{fragments:Object.freeze(n)});let r=null,i=!1;Jn(this,rr)[rr]=this.getAbiCoder(),this.fragments.forEach(((t,e)=>{let n;switch(t.type){case"constructor":return this.deploy?void console.log("duplicate definition - constructor"):void B(this,{deploy:t});case"fallback":return void(0===t.inputs.length?i=!0:(J(!r||t.payable!==r.payable,"conflicting fallback fragments","fragments[".concat(e,"]"),t),r=t,i=r.payable));case"function":n=Jn(this,nr)[nr];break;case"event":n=Jn(this,er)[er];break;case"error":n=Jn(this,tr)[tr];break;default:return}const s=t.format();n.has(s)||n.set(s,t)})),this.deploy||B(this,{deploy:_n.from("constructor()")}),B(this,{fallback:r,receive:i})}format(t){const e=t?"minimal":"full";return this.fragments.map((t=>t.format(e)))}formatJson(){const t=this.fragments.map((t=>t.format("json")));return JSON.stringify(t.map((t=>JSON.parse(t))))}getAbiCoder(){return zn.defaultAbiCoder()}getFunctionName(t){const e=Jn(this,ir)[ir](t,null,!1);return J(e,"no matching function","key",t),e.name}hasFunction(t){return!!Jn(this,ir)[ir](t,null,!1)}getFunction(t,e){return Jn(this,ir)[ir](t,e||null,!0)}forEachFunction(t){const e=Array.from(Jn(this,nr)[nr].keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(Jn(this,nr)[nr].get(r),n)}}getEventName(t){const e=Jn(this,sr)[sr](t,null,!1);return J(e,"no matching event","key",t),e.name}hasEvent(t){return!!Jn(this,sr)[sr](t,null,!1)}getEvent(t,e){return Jn(this,sr)[sr](t,e||null,!0)}forEachEvent(t){const e=Array.from(Jn(this,er)[er].keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(Jn(this,er)[er].get(r),n)}}getError(t,e){if(Z(t)){const e=t.toLowerCase();if(Qn[e])return Rn.from(Qn[e].signature);for(const t of Jn(this,tr)[tr].values())if(e===t.selector)return t;return null}if(-1===t.indexOf("(")){const e=[];for(const[n,r]of Jn(this,tr)[tr])n.split("(")[0]===t&&e.push(r);if(0===e.length)return"Error"===t?Rn.from("error Error(string)"):"Panic"===t?Rn.from("error Panic(uint256)"):null;if(e.length>1){const n=e.map((t=>JSON.stringify(t.format()))).join(", ");J(!1,"ambiguous error description (i.e. ".concat(n,")"),"name",t)}return e[0]}if("Error(string)"===(t=Rn.from(t).format()))return Rn.from("error Error(string)");if("Panic(uint256)"===t)return Rn.from("error Panic(uint256)");return Jn(this,tr)[tr].get(t)||null}forEachError(t){const e=Array.from(Jn(this,tr)[tr].keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(Jn(this,tr)[tr].get(r),n)}}_decodeParams(t,e){return Jn(this,rr)[rr].decode(t,e)}_encodeParams(t,e){return Jn(this,rr)[rr].encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if("string"==typeof t){const e=this.getError(t);J(e,"unknown error","fragment",t),t=e}return J(nt(e,0,4)===t.selector,"data signature does not match error ".concat(t.name,"."),"data",e),this._decodeParams(t.inputs,nt(e,4))}encodeErrorResult(t,e){if("string"==typeof t){const e=this.getError(t);J(e,"unknown error","fragment",t),t=e}return et([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if("string"==typeof t){const e=this.getFunction(t);J(e,"unknown function","fragment",t),t=e}return J(nt(e,0,4)===t.selector,"data signature does not match function ".concat(t.name,"."),"data",e),this._decodeParams(t.inputs,nt(e,4))}encodeFunctionData(t,e){if("string"==typeof t){const e=this.getFunction(t);J(e,"unknown function","fragment",t),t=e}return et([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if("string"==typeof t){const e=this.getFunction(t);J(e,"unknown function","fragment",t),t=e}let n="invalid length for result data";const r=Y(e);if(r.length%32==0)try{return Jn(this,rr)[rr].decode(t.outputs,r)}catch(t){n="could not decode result data"}H(!1,n,"BAD_DATA",{value:tt(r),info:{method:t.name,signature:t.format()}})}makeError(t,e){const n=X(t,"data"),r=zn.getBuiltinCallException("call",e,n);if(r.message.startsWith("execution reverted (unknown custom error)")){const t=tt(n.slice(0,4)),e=this.getError(t);if(e)try{const t=Jn(this,rr)[rr].decode(e.inputs,n.slice(4));r.revert={name:e.name,signature:e.format(),args:t},r.reason=r.revert.signature,r.message="execution reverted: ".concat(r.reason)}catch(t){r.message="execution reverted (coult not decode custom error)"}}const i=this.parseTransaction(e);return i&&(r.invocation={method:i.name,signature:i.signature,args:i.args}),r}encodeFunctionResult(t,e){if("string"==typeof t){const e=this.getFunction(t);J(e,"unknown function","fragment",t),t=e}return tt(Jn(this,rr)[rr].encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if("string"==typeof t){const e=this.getEvent(t);J(e,"unknown event","eventFragment",t),t=e}H(e.length<=t.inputs.length,"too many arguments for ".concat(t.format()),"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});const n=[];t.anonymous||n.push(t.topicHash);const r=(t,e)=>"string"===t.type?ft(e):"bytes"===t.type?at(tt(e)):("bool"===t.type&&"boolean"==typeof e?e=e?"0x01":"0x00":t.type.match(/^u?int/)?e=Ot(e):t.type.match(/^bytes/)?e=rt(e,32,!1):"address"===t.type&&Jn(this,rr)[rr].encode(["address"],[e]),rt(tt(e),32,!0));for(e.forEach(((e,i)=>{const s=t.inputs[i];s.indexed?null==e?n.push(null):"array"===s.baseType||"tuple"===s.baseType?J(!1,"filtering with tuples or arrays not supported","contract."+s.name,e):Array.isArray(e)?n.push(e.map((t=>r(s,t)))):n.push(r(s,e)):J(null==e,"cannot filter non-indexed parameters; must be null","contract."+s.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){if("string"==typeof t){const e=this.getEvent(t);J(e,"unknown event","eventFragment",t),t=e}const n=[],r=[],i=[];return t.anonymous||n.push(t.topicHash),J(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach(((t,s)=>{const o=e[s];if(t.indexed)if("string"===t.type)n.push(ft(o));else if("bytes"===t.type)n.push(at(o));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(Jn(this,rr)[rr].encode([t.type],[o]))}else r.push(t),i.push(o)})),{data:Jn(this,rr)[rr].encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t){const e=this.getEvent(t);J(e,"unknown event","eventFragment",t),t=e}if(null!=n&&!t.anonymous){const e=t.topicHash;J(Z(n[0],32)&&n[0].toLowerCase()===e,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const r=[],i=[],s=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(Pn.from({type:"bytes32",name:t.name})),s.push(!0)):(r.push(t),s.push(!1)):(i.push(t),s.push(!1))}));const o=null!=n?Jn(this,rr)[rr].decode(r,et(n)):null,a=Jn(this,rr)[rr].decode(i,e,!0),c=[],u=[];let l=0,h=0;return t.inputs.forEach(((t,e)=>{let n=null;if(t.indexed)if(null==o)n=new Yn(null);else if(s[e])n=new Yn(o[h++]);else try{n=o[h++]}catch(t){n=t}else try{n=a[l++]}catch(t){n=t}c.push(n),u.push(t.name||null)})),Ct.fromItems(c,u)}parseTransaction(t){const e=X(t.data,"tx.data"),n=mt(null!=t.value?t.value:0,"tx.value"),r=this.getFunction(tt(e.slice(0,4)));if(!r)return null;const i=Jn(this,rr)[rr].decode(r.inputs,e.slice(4));return new $n(r,r.selector,i,n)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){const e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new qn(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){const e=tt(t),n=this.getError(nt(e,0,4));if(!n)return null;const r=Jn(this,rr)[rr].decode(n.inputs,nt(e,4));return new Xn(n,n.selector,r)}static from(t){return t instanceof or?t:"string"==typeof t?new or(JSON.parse(t)):"function"==typeof t.formatJson?new or(t.formatJson()):"function"==typeof t.format?new or(t.format("json")):new or(t)}}function ar(t,e,n){if(Z(t)){const e=t.toLowerCase();for(const t of Jn(this,nr)[nr].values())if(e===t.selector)return t;return null}if(-1===t.indexOf("(")){const r=[];for(const[e,n]of Jn(this,nr)[nr])e.split("(")[0]===t&&r.push(n);if(e){const t=e.length>0?e[e.length-1]:null;let n=e.length,i=!0;de.isTyped(t)&&"overrides"===t.type&&(i=!1,n--);for(let t=r.length-1;t>=0;t--){const e=r[t].inputs.length;e===n||i&&e===n-1||r.splice(t,1)}for(let t=r.length-1;t>=0;t--){const n=r[t].inputs;for(let i=0;i<e.length;i++)if(de.isTyped(e[i])){if(i>=n.length){if("overrides"===e[i].type)continue;r.splice(t,1);break}if(e[i].type!==n[i].baseType){r.splice(t,1);break}}}}if(1===r.length&&e&&e.length!==r[0].inputs.length){const t=e[e.length-1];(null==t||Array.isArray(t)||"object"!=typeof t)&&r.splice(0,1)}if(0===r.length)return null;if(r.length>1&&n){const e=r.map((t=>JSON.stringify(t.format()))).join(", ");J(!1,"ambiguous function description (i.e. matches ".concat(e,")"),"key",t)}return r[0]}return Jn(this,nr)[nr].get(jn.from(t).format())||null}function cr(t,e,n){if(Z(t)){const e=t.toLowerCase();for(const t of Jn(this,er)[er].values())if(e===t.topicHash)return t;return null}if(-1===t.indexOf("(")){const r=[];for(const[e,n]of Jn(this,er)[er])e.split("(")[0]===t&&r.push(n);if(e){for(let t=r.length-1;t>=0;t--)r[t].inputs.length<e.length&&r.splice(t,1);for(let t=r.length-1;t>=0;t--){const n=r[t].inputs;for(let i=0;i<e.length;i++)if(de.isTyped(e[i])&&e[i].type!==n[i].baseType){r.splice(t,1);break}}}if(0===r.length)return null;if(r.length>1&&n){const e=r.map((t=>JSON.stringify(t.format()))).join(", ");J(!1,"ambiguous event description (i.e. matches ".concat(e,")"),"key",t)}return r[0]}return Jn(this,er)[er].get(An.from(t).format())||null}function ur(t){return t&&"function"==typeof t.getAddress}async function lr(t,e){const n=await e;return null!=n&&"0x0000000000000000000000000000000000000000"!==n||(H("string"!=typeof t,"unconfigured name","UNCONFIGURED_NAME",{value:t}),J(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),se(n)}function hr(t,e){return"string"==typeof t?t.match(/^0x[0-9a-f]{40}$/i)?se(t):(H(null!=e,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),lr(t,e.resolveName(t))):ur(t)?lr(t,t.getAddress()):t&&"function"==typeof t.then?lr(t,t):void J(!1,"unsupported addressable value","target",t)}function fr(t,e){return{address:se(t),storageKeys:e.map(((t,e)=>(J(Z(t,32),"invalid slot","storageKeys[".concat(e,"]"),t),t.toLowerCase())))}}function pr(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var dr=0;function gr(t){return"__private_"+dr+++"_"+t}const yr=BigInt(0);function mr(t){return null==t?null:t.toString()}Symbol.iterator;class br{constructor(t,e){this.provider=void 0,this.transactionHash=void 0,this.blockHash=void 0,this.blockNumber=void 0,this.removed=void 0,this.address=void 0,this.data=void 0,this.topics=void 0,this.index=void 0,this.transactionIndex=void 0,this.provider=e;const n=Object.freeze(t.topics.slice());B(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:n,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){const{address:t,blockHash:e,blockNumber:n,data:r,index:i,removed:s,topics:o,transactionHash:a,transactionIndex:c}=this;return{_type:"log",address:t,blockHash:e,blockNumber:n,data:r,index:i,removed:s,topics:o,transactionHash:a,transactionIndex:c}}async getBlock(){const t=await this.provider.getBlock(this.blockHash);return H(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){const t=await this.provider.getTransaction(this.transactionHash);return H(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){const t=await this.provider.getTransactionReceipt(this.transactionHash);return H(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return{orphan:"drop-log",log:{transactionHash:(t=this).transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}};var t}}var vr=gr("logs");class wr{constructor(t,e){this.provider=void 0,this.to=void 0,this.from=void 0,this.contractAddress=void 0,this.hash=void 0,this.index=void 0,this.blockHash=void 0,this.blockNumber=void 0,this.logsBloom=void 0,this.gasUsed=void 0,this.blobGasUsed=void 0,this.cumulativeGasUsed=void 0,this.gasPrice=void 0,this.blobGasPrice=void 0,this.type=void 0,this.status=void 0,this.root=void 0,Object.defineProperty(this,vr,{writable:!0,value:void 0}),pr(this,vr)[vr]=Object.freeze(t.logs.map((t=>new br(t,e))));let n=yr;null!=t.effectiveGasPrice?n=t.effectiveGasPrice:null!=t.gasPrice&&(n=t.gasPrice),B(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:n,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return pr(this,vr)[vr]}toJSON(){const{to:t,from:e,contractAddress:n,hash:r,index:i,blockHash:s,blockNumber:o,logsBloom:a,logs:c,status:u,root:l}=this;return{_type:"TransactionReceipt",blockHash:s,blockNumber:o,contractAddress:n,cumulativeGasUsed:mr(this.cumulativeGasUsed),from:e,gasPrice:mr(this.gasPrice),blobGasUsed:mr(this.blobGasUsed),blobGasPrice:mr(this.blobGasPrice),gasUsed:mr(this.gasUsed),hash:r,index:i,logs:c,logsBloom:a,root:l,status:u,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const t=await this.provider.getBlock(this.blockHash);if(null==t)throw new Error("TODO");return t}async getTransaction(){const t=await this.provider.getTransaction(this.hash);if(null==t)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return Nr(this)}reorderedEvent(t){return H(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Pr(this,t)}}var Er=gr("startBlock");class Or{constructor(t,e){this.provider=void 0,this.blockNumber=void 0,this.blockHash=void 0,this.index=void 0,this.hash=void 0,this.type=void 0,this.to=void 0,this.from=void 0,this.nonce=void 0,this.gasLimit=void 0,this.gasPrice=void 0,this.maxPriorityFeePerGas=void 0,this.maxFeePerGas=void 0,this.maxFeePerBlobGas=void 0,this.data=void 0,this.value=void 0,this.chainId=void 0,this.signature=void 0,this.accessList=void 0,this.blobVersionedHashes=void 0,this.authorizationList=void 0,Object.defineProperty(this,Er,{writable:!0,value:void 0}),this.provider=e,this.blockNumber=null!=t.blockNumber?t.blockNumber:null,this.blockHash=null!=t.blockHash?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=null!=t.maxPriorityFeePerGas?t.maxPriorityFeePerGas:null,this.maxFeePerGas=null!=t.maxFeePerGas?t.maxFeePerGas:null,this.maxFeePerBlobGas=null!=t.maxFeePerBlobGas?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=null!=t.accessList?t.accessList:null,this.blobVersionedHashes=null!=t.blobVersionedHashes?t.blobVersionedHashes:null,this.authorizationList=null!=t.authorizationList?t.authorizationList:null,pr(this,Er)[Er]=-1}toJSON(){const{blockNumber:t,blockHash:e,index:n,hash:r,type:i,to:s,from:o,nonce:a,data:c,signature:u,accessList:l,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:l,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:mr(this.chainId),data:c,from:o,gasLimit:mr(this.gasLimit),gasPrice:mr(this.gasPrice),hash:r,maxFeePerGas:mr(this.maxFeePerGas),maxPriorityFeePerGas:mr(this.maxPriorityFeePerGas),maxFeePerBlobGas:mr(this.maxFeePerBlobGas),nonce:a,signature:u,to:s,index:n,type:i,value:mr(this.value)}}async getBlock(){let t=this.blockNumber;if(null==t){const e=await this.getTransaction();e&&(t=e.blockNumber)}if(null==t)return null;const e=this.provider.getBlock(t);if(null==e)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(null==this.blockNumber){const{tx:t,blockNumber:e}=await D({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return null==t||null==t.blockNumber?0:e-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){const n=null==t?1:t,r=null==e?0:e;let i=pr(this,Er)[Er],s=-1,o=-1===i;const a=async()=>{if(o)return null;const{blockNumber:t,nonce:e}=await D({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(e<this.nonce)return void(i=t);if(o)return null;const r=await this.getTransaction();if(!r||null==r.blockNumber)for(-1===s&&(s=i-3,s<pr(this,Er)[Er]&&(s=pr(this,Er)[Er]));s<=t;){if(o)return null;const e=await this.provider.getBlock(s,!0);if(null==e)return;for(const t of e)if(t===this.hash)return;for(let r=0;r<e.length;r++){const s=await e.getTransaction(r);if(s.from===this.from&&s.nonce===this.nonce){if(o)return null;const e=await this.provider.getTransactionReceipt(s.hash);if(null==e)return;if(t-e.blockNumber+1<n)return;let r="replaced";s.data===this.data&&s.to===this.to&&s.value===this.value?r="repriced":"0x"===s.data&&s.from===s.to&&s.value===yr&&(r="cancelled"),H(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:"replaced"===r||"cancelled"===r,reason:r,replacement:s.replaceableTransaction(i),hash:s.hash,receipt:e})}}s++}},c=t=>{if(null==t||0!==t.status)return t;H(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:t.to,from:t.from,data:""},receipt:t})},u=await this.provider.getTransactionReceipt(this.hash);if(0===n)return c(u);if(u){if(1===n||await u.confirmations()>=n)return c(u)}else if(await a(),0===n)return null;const l=new Promise(((t,e)=>{const s=[],u=()=>{s.forEach((t=>t()))};if(s.push((()=>{o=!0})),r>0){const t=setTimeout((()=>{u(),e(z("wait for transaction timeout","TIMEOUT"))}),r);s.push((()=>{clearTimeout(t)}))}const l=async r=>{if(await r.confirmations()>=n){u();try{t(c(r))}catch(t){e(t)}}};if(s.push((()=>{this.provider.off(this.hash,l)})),this.provider.on(this.hash,l),i>=0){const t=async()=>{try{await a()}catch(t){if(G(t,"TRANSACTION_REPLACED"))return u(),void e(t)}o||this.provider.once("block",t)};s.push((()=>{this.provider.off("block",t)})),this.provider.once("block",t)}}));return await l}isMined(){return null!=this.blockHash}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}removedEvent(){return H(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Nr(this)}reorderedEvent(t){return H(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),H(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Pr(this,t)}replaceableTransaction(t){J(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);const e=new Or(this,this.provider);return pr(e,Er)[Er]=t,e}}function Pr(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function Nr(t){return{orphan:"drop-transaction",tx:t}}function Tr(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var kr=0;function xr(t){return"__private_"+kr+++"_"+t}var Rr=xr("listener");class Ar{constructor(t,e,n){this.filter=void 0,this.emitter=void 0,Object.defineProperty(this,Rr,{writable:!0,value:void 0}),Tr(this,Rr)[Rr]=e,B(this,{emitter:t,filter:n})}async removeListener(){null!=Tr(this,Rr)[Rr]&&await this.emitter.off(this.filter,Tr(this,Rr)[Rr])}}function _r(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Ir=0;function jr(t){return"__private_"+Ir+++"_"+t}class Ur extends br{constructor(t,e,n){super(t,t.provider),this.interface=void 0,this.fragment=void 0,this.args=void 0,B(this,{args:e.decodeEventLog(n,t.data,t.topics),fragment:n,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class Sr extends br{constructor(t,e){super(t,t.provider),this.error=void 0,B(this,{error:e})}}var Fr=jr("iface");class Cr extends wr{constructor(t,e,n){super(n,e),Object.defineProperty(this,Fr,{writable:!0,value:void 0}),_r(this,Fr)[Fr]=t}get logs(){return super.logs.map((t=>{const e=t.topics.length?_r(this,Fr)[Fr].getEvent(t.topics[0]):null;if(e)try{return new Ur(t,_r(this,Fr)[Fr],e)}catch(e){return new Sr(t,e)}return t}))}}var Lr=jr("iface");class Dr extends Or{constructor(t,e,n){super(n,e),Object.defineProperty(this,Lr,{writable:!0,value:void 0}),_r(this,Lr)[Lr]=t}async wait(t,e){const n=await super.wait(t,e);return null==n?null:new Cr(_r(this,Lr)[Lr],this.provider,n)}}class Br extends Ar{constructor(t,e,n,r){super(t,e,n),this.log=void 0,B(this,{log:r})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Mr extends Br{constructor(t,e,n,r,i){super(t,e,n,new Ur(i,t.interface,r)),B(this,{args:t.interface.decodeEventLog(r,this.log.data,this.log.topics),fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}function Gr(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Vr=0;function zr(t){return"__private_"+Vr+++"_"+t}const Hr=BigInt(0);function Jr(t){return t&&"function"==typeof t.call}function Kr(t){return t&&"function"==typeof t.estimateGas}function Wr(t){return t&&"function"==typeof t.resolveName}function qr(t){return t&&"function"==typeof t.sendTransaction}function $r(t){if(null!=t){if(Wr(t))return t;if(t.provider)return t.provider}}var Xr=zr("filter");class Yr{constructor(t,e,n){if(Object.defineProperty(this,Xr,{writable:!0,value:void 0}),this.fragment=void 0,B(this,{fragment:e}),e.inputs.length<n.length)throw new Error("too many arguments");const r=Zr(t.runner,"resolveName"),i=Wr(r)?r:null;Gr(this,Xr)[Xr]=async function(){const r=await Promise.all(e.inputs.map(((t,e)=>null==n[e]?null:t.walkAsync(n[e],((t,e)=>"address"===t?Array.isArray(e)?Promise.all(e.map((t=>hr(t,i)))):hr(e,i):e)))));return t.interface.encodeFilterTopics(e,r)}()}getTopicFilter(){return Gr(this,Xr)[Xr]}}function Zr(t,e){return null==t?null:"function"==typeof t[e]?t:t.provider&&"function"==typeof t.provider[e]?t.provider:null}function Qr(t){return null==t?null:t.provider||null}async function ti(t,e){const n=de.dereference(t,"overrides");J("object"==typeof n,"invalid overrides parameter","overrides",t);const r=function(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=tt(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of n)r in t&&null!=t[r]&&(e[r]=mt(t[r],"request.".concat(r)));const r="type,nonce".split(/,/);for(const n of r)n in t&&null!=t[n]&&(e[n]=Et(t[n],"request.".concat(n)));return t.accessList&&(e.accessList=function(t){if(Array.isArray(t))return t.map(((e,n)=>Array.isArray(e)?(J(2===e.length,"invalid slot set","value[".concat(n,"]"),e),fr(e[0],e[1])):(J(null!=e&&"object"==typeof e,"invalid address-slot set","value",t),fr(e.address,e.storageKeys))));J(null!=t&&"object"==typeof t,"invalid access list","value",t);const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return fr(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}(t.accessList)),t.authorizationList&&(e.authorizationList=t.authorizationList.slice()),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobWrapperVersion"in t&&(e.blobWrapperVersion=t.blobWrapperVersion),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map((t=>{return Z(e=t,!0)||e instanceof Uint8Array?tt(t):Object.assign({},t);var e}))),e}(n);return J(null==r.to||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),J(null==r.data||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}function ei(t){const e=async function(e){const n=await ti(e,["data"]);n.to=await t.getAddress(),n.from&&(n.from=await hr(n.from,$r(t.runner)));const r=t.interface,i=mt(n.value||Hr,"overrides.value")===Hr,s="0x"===(n.data||"0x");return!r.fallback||r.fallback.payable||!r.receive||s||i||J(!1,"cannot send data to receive or send value to non-payable fallback","overrides",e),J(r.fallback||s,"cannot send data to receive-only contract","overrides.data",n.data),J(r.receive||r.fallback&&r.fallback.payable||i,"cannot send value to non-payable fallback","overrides.value",n.value),J(r.fallback||s,"cannot send data to receive-only contract","overrides.data",n.data),n},n=async function(n){const r=t.runner;H(qr(r),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const i=await r.sendTransaction(await e(n)),s=Qr(t.runner);return new Dr(t.interface,s,i)},r=async t=>await n(t);return B(r,{_contract:t,estimateGas:async function(n){const r=Zr(t.runner,"estimateGas");return H(Kr(r),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await r.estimateGas(await e(n))},populateTransaction:e,send:n,staticCall:async function(n){const r=Zr(t.runner,"call");H(Jr(r),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const i=await e(n);try{return await r.call(i)}catch(e){if(V(e)&&e.data)throw t.interface.makeError(e.data,i);throw e}}}),r}const ni=Symbol.for("_ethersInternal_contract"),ri=new WeakMap;function ii(t){return ri.get(t[ni])}async function si(t,e){let n,r=null;if(Array.isArray(e)){const r=function(e){if(Z(e,32))return e;const n=t.interface.getEvent(e);return J(n,"unknown fragment","name",e),n.topicHash};n=e.map((t=>null==t?null:Array.isArray(t)?t.map(r):r(t)))}else"*"===e?n=[null]:"string"==typeof e?Z(e,32)?n=[e]:(r=t.interface.getEvent(e),J(r,"unknown fragment","event",e),n=[r.topicHash]):(i=e)&&"object"==typeof i&&"getTopicFilter"in i&&"function"==typeof i.getTopicFilter&&i.fragment?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):J(!1,"unknown event name","event",e);var i;return n=n.map((t=>{if(null==t)return null;if(Array.isArray(t)){const e=Array.from(new Set(t.map((t=>t.toLowerCase()))).values());return 1===e.length?e[0]:(e.sort(),e)}return t.toLowerCase()})),{fragment:r,tag:n.map((t=>null==t?"null":Array.isArray(t)?t.join("|"):t)).join("&"),topics:n}}async function oi(t,e){const{subs:n}=ii(t);return n.get((await si(t,e)).tag)||null}async function ai(t,e,n){const r=Qr(t.runner);H(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:o}=await si(t,n),{addr:a,subs:c}=ii(t);let u=c.get(s);if(!u){const e={address:a||t,topics:o},l=e=>{let r=i;if(null==r)try{r=t.interface.getEvent(e.topics[0])}catch(t){}if(r){const s=r,o=i?t.interface.decodeEventLog(i,e.data,e.topics):[];ui(t,n,o,(r=>new Mr(t,r,n,s,e)))}else ui(t,n,[],(r=>new Br(t,r,n,e)))};let h=[];u={tag:s,listeners:[],start:()=>{h.length||h.push(r.on(e,l))},stop:async()=>{if(0==h.length)return;let t=h;h=[],await Promise.all(t),r.off(e,l)}},c.set(s,u)}return u}let ci=Promise.resolve();async function ui(t,e,n,r){try{await ci}catch(t){}const i=async function(t,e,n,r){await ci;const i=await oi(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter((e=>{let{listener:i,once:s}=e;const o=Array.from(n);r&&o.push(r(s?null:i));try{i.call(t,...o)}catch(t){}return!s})),0===i.listeners.length&&(i.stop(),ii(t).subs.delete(i.tag)),s>0}(t,e,n,r);return ci=i,await i}const li=["then"];class hi{constructor(t,e,n,r){this.target=void 0,this.interface=void 0,this.runner=void 0,this.filters=void 0,this[ni]=void 0,this.fallback=void 0,J("string"==typeof t||ur(t),"invalid value for Contract target","target",t),null==n&&(n=null);const i=or.from(e);let s;B(this,{target:t,runner:n,interface:i}),Object.defineProperty(this,ni,{value:{}});let o=null,a=null;if(r){const t=Qr(n);a=new Dr(this.interface,t,r)}let c=new Map;if("string"==typeof t)if(Z(t))o=t,s=Promise.resolve(t);else{const e=Zr(n,"resolveName");if(!Wr(e))throw z("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});s=e.resolveName(t).then((e=>{if(null==e)throw z("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return ii(this).addr=e,e}))}else s=t.getAddress().then((t=>{if(null==t)throw new Error("TODO");return ii(this).addr=t,t}));var u;u={addrPromise:s,addr:o,deployTx:a,subs:c},ri.set(this[ni],u);const l=new Proxy({},{get:(t,e,n)=>{if("symbol"==typeof e||li.indexOf(e)>=0)return Reflect.get(t,e,n);try{return this.getEvent(e)}catch(t){if(!G(t,"INVALID_ARGUMENT")||"key"!==t.argument)throw t}},has:(t,e)=>li.indexOf(e)>=0?Reflect.has(t,e):Reflect.has(t,e)||this.interface.hasEvent(String(e))});return B(this,{filters:l}),B(this,{fallback:i.receive||i.fallback?ei(this):null}),new Proxy(this,{get:(t,e,n)=>{if("symbol"==typeof e||e in t||li.indexOf(e)>=0)return Reflect.get(t,e,n);try{return t.getFunction(e)}catch(t){if(!G(t,"INVALID_ARGUMENT")||"key"!==t.argument)throw t}},has:(t,e)=>"symbol"==typeof e||e in t||li.indexOf(e)>=0?Reflect.has(t,e):t.interface.hasFunction(e)})}connect(t){return new hi(this.target,this.interface,t)}attach(t){return new hi(t,this.interface,this.runner)}async getAddress(){return await ii(this).addrPromise}async getDeployedCode(){const t=Qr(this.runner);H(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const e=await t.getCode(await this.getAddress());return"0x"===e?null:e}async waitForDeployment(){const t=this.deploymentTransaction();if(t)return await t.wait(),this;if(null!=await this.getDeployedCode())return this;const e=Qr(this.runner);return H(null!=e,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise(((t,n)=>{const r=async()=>{try{if(null!=await this.getDeployedCode())return t(this);e.once("block",r)}catch(t){n(t)}};r()}))}deploymentTransaction(){return ii(this).deployTx}getFunction(t){return"string"!=typeof t&&(t=t.format()),function(t,e){const n=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const s=t.interface.getFunction(e,r);return H(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:r}}),s},r=async function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];const s=n(...r);let o={};if(s.inputs.length+1===r.length&&(o=await ti(r.pop()),o.from&&(o.from=await hr(o.from,$r(t.runner)))),s.inputs.length!==r.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const a=await async function(t,e,n){const r=Zr(t,"resolveName"),i=Wr(r)?r:null;return await Promise.all(e.map(((t,e)=>t.walkAsync(n[e],((t,e)=>(e=de.dereference(e,t),"address"===t?hr(e,i):e))))))}(t.runner,s.inputs,r);return Object.assign({},o,await D({to:t.getAddress(),data:t.interface.encodeFunctionData(s,a)}))},i=async function(){const t=await o(...arguments);return 1===t.length?t[0]:t},s=async function(){const e=t.runner;H(qr(e),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const n=await e.sendTransaction(await r(...arguments)),i=Qr(t.runner);return new Dr(t.interface,i,n)},o=async function(){const e=Zr(t.runner,"call");H(Jr(e),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const i=await r(...arguments);let s="0x";try{s=await e.call(i)}catch(e){if(V(e)&&e.data)throw t.interface.makeError(e.data,i);throw e}const o=n(...arguments);return t.interface.decodeFunctionResult(o,s)},a=async function(){return n(...arguments).constant?await i(...arguments):await s(...arguments)};return B(a,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:async function(){const e=Zr(t.runner,"estimateGas");return H(Kr(e),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await e.estimateGas(await r(...arguments))},populateTransaction:r,send:s,staticCall:i,staticCallResult:o}),Object.defineProperty(a,"fragment",{configurable:!1,enumerable:!0,get:()=>{const n=t.interface.getFunction(e);return H(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),n}}),a}(this,t)}getEvent(t){return"string"!=typeof t&&(t=t.format()),function(t,e){const n=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const s=t.interface.getEvent(e,r);return H(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:r}}),s},r=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return new Yr(t,n(...r),r)};return B(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const n=t.interface.getEvent(e);return H(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),n}}),r}(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,n){null==e&&(e=0),null==n&&(n="latest");const{addr:r,addrPromise:i}=ii(this),s=r||await i,{fragment:o,topics:a}=await si(this,t),c={address:s,topics:a,fromBlock:e,toBlock:n},u=Qr(this.runner);return H(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map((t=>{let e=o;if(null==e)try{e=this.interface.getEvent(t.topics[0])}catch(t){}if(e)try{return new Ur(t,this.interface,e)}catch(e){return new Sr(t,e)}return new br(t,u)}))}async on(t,e){const n=await ai(this,"on",t);return n.listeners.push({listener:e,once:!1}),n.start(),this}async once(t,e){const n=await ai(this,"once",t);return n.listeners.push({listener:e,once:!0}),n.start(),this}async emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return await ui(this,t,n,null)}async listenerCount(t){if(t){const e=await oi(this,t);return e?e.listeners.length:0}const{subs:e}=ii(this);let n=0;for(const{listeners:t}of e.values())n+=t.length;return n}async listeners(t){if(t){const e=await oi(this,t);return e?e.listeners.map((t=>{let{listener:e}=t;return e})):[]}const{subs:e}=ii(this);let n=[];for(const{listeners:t}of e.values())n=n.concat(t.map((t=>{let{listener:e}=t;return e})));return n}async off(t,e){const n=await oi(this,t);if(!n)return this;if(e){const t=n.listeners.map((t=>{let{listener:e}=t;return e})).indexOf(e);t>=0&&n.listeners.splice(t,1)}return null!=e&&0!==n.listeners.length||(n.stop(),ii(this).subs.delete(n.tag)),this}async removeAllListeners(t){if(t){const e=await oi(this,t);if(!e)return this;e.stop(),ii(this).subs.delete(e.tag)}else{const{subs:t}=ii(this);for(const{tag:e,stop:n}of t.values())n(),t.delete(e)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){return class extends hi{constructor(e){super(e,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)}}}static from(t,e,n){return null==n&&(n=null),new this(t,e,n)}}class fi extends(function(){return hi}()){}function pi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function di(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?pi(Object(n),!0).forEach((function(e){gi(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pi(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function gi(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var yi=class{constructor(t){var e=this;this.dialogWindowOrigin="",this.isDestroyed=!1,this.appId=void 0,this.mode="production",this.pendingRequest=null,this.getMode=()=>this.mode,this.setMode=t=>{this.mode=t},this.getAppId=()=>this.appId,this.setAppId=t=>{this.appId=t},this.destroy=()=>{this.isDestroyed||(this.isDestroyed=!0,"undefined"!=typeof window&&window.removeEventListener("message",this.handleMessage),this.rejectPendingRequest("DESTROYED"))},this.handleMessage=t=>{if(t.origin!==this.dialogWindowOrigin)return;const e=t.data;if("CLOSE_MODAL"!==e.type){if("PROOFS_RESPONSE"===e.type&&this.pendingRequest){const{resolve:t,reject:n}=this.pendingRequest;this.pendingRequest=null,e.error?n(e.error):t(e.payload)}}else this.rejectPendingRequest("REJECTED")},this.verifyHumanity=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.minPoints||(t=di(di({},t),{},{minPoints:0})),e.sendRequest("PROOFS_REQUEST",di(di({},t),{},{mode:e.mode,appId:e.appId}))},this.getAddressScore=async t=>{if(!t)throw new Error("`address` argument is required to get address score");const{score:e,message:n,signature:r}=await c(t);return{score:e,message:n,signature:r}},this.verifyProofs=async t=>{let{proofs:e,provider:n}=t;const r={verified:!1,score:{total:0,groups:[]}},i=await async function(t){try{const e="dev"===t?"dev-configs":"configs",n=await a("https://raw.githubusercontent.com/BringID/configs/main/".concat(e,".json"));return{REGISTRY:n.REGISTRY,CHAIN_ID:n.CHAIN_ID}}catch(t){return console.error(t),null}}(this.mode);if(!i)throw new Error("configs cannot be fetched");const s=new or(l),o=new or(h),c=new or(f),u=e.map((t=>({credentialGroupId:t.credential_group_id,appId:t.app_id,semaphoreProof:{merkleTreeDepth:t.semaphore_proof.merkle_tree_depth,merkleTreeRoot:t.semaphore_proof.merkle_tree_root,nullifier:t.semaphore_proof.nullifier,message:t.semaphore_proof.message,scope:t.semaphore_proof.scope,points:t.semaphore_proof.points}}))).map((t=>{const e=s.encodeFunctionData("verifyProof",[0,t]);return{target:i.REGISTRY,allowFailure:!1,callData:e}})),p=(await new fi(i.REGISTRY,l,n).apps(this.appId)).scorer,d=[...u,...e.map((t=>{const e=c.encodeFunctionData("getScore",[t.credential_group_id]);return{target:p,allowFailure:!1,callData:e}}))],g=o.encodeFunctionData("aggregate3",[d]);try{const t=await n.call({to:"0xca11bde05977b3631167028862be2a173976ca11",data:g}),i=o.decodeFunctionResult("aggregate3",t)[0];if(!i.slice(0,e.length).every((t=>{const[e]=s.decodeFunctionResult("verifyProof",t.returnData);return e})))return r;const a=i.slice(e.length),u=e.map(((t,e)=>{const[n]=c.decodeFunctionResult("getScore",a[e].returnData);return{credential_group_id:t.credential_group_id,score:Number(n)}}));return{verified:!0,score:{total:u.reduce(((t,e)=>t+e.score),0),groups:u}}}catch(t){return console.error(t),r}},this.appId=t.appId,"undefined"!=typeof window&&(window.addEventListener("message",this.handleMessage),this.dialogWindowOrigin=window.location.origin),t.mode&&(this.mode=t.mode)}sendMessageToDialog(t){window.postMessage(t,this.dialogWindowOrigin)}sendRequest(t,e){return this.rejectPendingRequest("REJECTED"),new Promise(((n,r)=>{this.pendingRequest={resolve:n,reject:r},this.sendMessageToDialog({type:t,payload:e})}))}rejectPendingRequest(t){this.pendingRequest&&(this.pendingRequest.reject(t),this.pendingRequest=null)}};return e}()}));
@@ -1,11 +1,9 @@
1
- import { TGenerateSignature, TMode } from "@/types";
1
+ import { TGenerateSignature } from "@/types";
2
2
  export type TProps = {
3
3
  address?: string;
4
- appId: string;
5
4
  generateSignature?: TGenerateSignature;
6
5
  connectUrl?: string;
7
6
  iframeOnLoad?: () => void;
8
- mode?: TMode;
9
7
  highlightColor?: string;
10
8
  theme?: 'light' | 'dark';
11
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/modules/bring-id-modal/component-types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEnD,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CACzB,CAAA"}
1
+ {"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/modules/bring-id-modal/component-types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CACzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/bring-id-modal/index.tsx"],"names":[],"mappings":"AAGA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa1C,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAmEzC,CAAA;AAID,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/bring-id-modal/index.tsx"],"names":[],"mappings":"AAGA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa1C,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAiEzC,CAAA;AAID,eAAe,YAAY,CAAA"}
@@ -5,17 +5,18 @@ export declare class BringID {
5
5
  private isDestroyed;
6
6
  private appId;
7
7
  private mode;
8
- private pendingRequests;
8
+ private pendingRequest;
9
9
  constructor(args: TConstructorArgs);
10
10
  getMode: () => TMode;
11
+ setMode: (mode: TMode) => void;
11
12
  getAppId: () => string;
13
+ setAppId: (appId: string) => void;
12
14
  destroy: TDestroy;
13
15
  /** POSTMESSAGE API */
14
16
  private sendMessageToDialog;
15
17
  private handleMessage;
16
- /** Helper to wrap messages as promises */
17
- private request;
18
- private rejectAllPendingRequests;
18
+ private sendRequest;
19
+ private rejectPendingRequest;
19
20
  /** PUBLIC METHODS */
20
21
  verifyHumanity: TVerifyHumanity;
21
22
  getAddressScore: TGetAddressScore;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/bring-id-sdk/index.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,EACN,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAMhB,qBAAa,OAAO;IAClB,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,IAAI,CAAsB;IAElC,OAAO,CAAC,eAAe,CAOnB;gBAEQ,IAAI,EAAE,gBAAgB;IAalC,OAAO,cAEN;IAED,QAAQ,eAEP;IAED,OAAO,EAAE,QAAQ,CAOhB;IAED,sBAAsB;IACtB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,aAAa,CAwBnB;IAEF,0CAA0C;IAC1C,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,wBAAwB;IAQhC,qBAAqB;IACrB,cAAc,EAAE,eAAe,CAK9B;IAED,eAAe,EAAE,gBAAgB,CAiBhC;IAGD,YAAY,EAAE,aAAa,CAqH1B;CAEF;AAED,eAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/bring-id-sdk/index.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,EACN,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAMhB,qBAAa,OAAO;IAClB,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,IAAI,CAAsB;IAElC,OAAO,CAAC,cAAc,CAGN;gBAEJ,IAAI,EAAE,gBAAgB;IAalC,OAAO,cAEN;IAED,OAAO,GAAI,MAAM,KAAK,UAErB;IAED,QAAQ,eAEP;IAED,QAAQ,GAAI,OAAO,MAAM,UAExB;IAED,OAAO,EAAE,QAAQ,CAOhB;IAED,sBAAsB;IACtB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,aAAa,CAiBnB;IAEF,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,oBAAoB;IAO5B,qBAAqB;IACrB,cAAc,EAAE,eAAe,CAS9B;IAED,eAAe,EAAE,gBAAgB,CAiBhC;IAGD,YAAY,EAAE,aAAa,CAqH1B;CAEF;AAED,eAAe,OAAO,CAAA"}
package/dist/react.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see react.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.BringSDK=t(require("react")):e.BringSDK=t(e.react)}(this,(function(e){return function(){var t={568:function(e,t){"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return t=n.ref,{$$typeof:r,type:e,key:o,ref:void 0!==t?t:null,props:n}}Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},74:function(e,t,r){"use strict";e.exports=r(568)},863:function(e){e.exports=function(e,t,r,n){var o=r?r.call(n,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var u=i[c];if(!a(u))return!1;var l=e[u],f=t[u];if(!1===(o=r?r.call(n,l,f,u):void 0)||void 0===o&&l!==f)return!1}return!0}},155:function(t){"use strict";t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var o={};return function(){"use strict";n.r(o),n.d(o,{BringIDModal:function(){return Cr}});var e=function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var r=n(155),i=n.n(r),s=n(863),a=n.n(s),c="-ms-",u="-moz-",l="-webkit-",f="comm",p="rule",d="decl",h="@keyframes",g=Math.abs,y=String.fromCharCode,m=Object.assign;function v(e){return e.trim()}function b(e,t){return(e=t.exec(e))?e[0]:e}function S(e,t,r){return e.replace(t,r)}function w(e,t,r){return e.indexOf(t,r)}function x(e,t){return 0|e.charCodeAt(t)}function C(e,t,r){return e.slice(t,r)}function j(e){return e.length}function I(e){return e.length}function k(e,t){return t.push(e),e}function E(e,t){return e.filter((function(e){return!b(e,t)}))}var O=1,A=1,P=0,R=0,_=0,N="";function B(e,t,r,n,o,i,s,a){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:O,column:A,length:s,return:"",siblings:a}}function $(e,t){return m(B("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function T(e){for(;e.root;)e=$(e.root,{children:[e]});k(e,e.siblings)}function D(){return _=R>0?x(N,--R):0,A--,10===_&&(A=1,O--),_}function z(){return _=R<P?x(N,R++):0,A++,10===_&&(A=1,O++),_}function F(){return x(N,R)}function L(){return R}function M(e,t){return C(N,e,t)}function G(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Y(e){return v(M(R-1,q(91===e?e+2:40===e?e+1:e)))}function W(e){for(;(_=F())&&_<33;)z();return G(e)>2||G(_)>3?"":" "}function U(e,t){for(;--t&&z()&&!(_<48||_>102||_>57&&_<65||_>70&&_<97););return M(e,L()+(t<6&&32==F()&&32==z()))}function q(e){for(;z();)switch(_){case e:return R;case 34:case 39:34!==e&&39!==e&&q(_);break;case 40:41===e&&q(e);break;case 92:z()}return R}function H(e,t){for(;z()&&e+_!==57&&(e+_!==84||47!==F()););return"/*"+M(t,R-1)+"*"+y(47===e?e:z())}function K(e){for(;!G(F());)z();return M(e,R)}function V(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Q(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case d:return e.return=e.return||e.value;case f:return"";case h:return e.return=e.value+"{"+V(e.children,n)+"}";case p:if(!j(e.value=e.props.join(",")))return""}return j(r=V(e.children,n))?e.return=e.value+"{"+r+"}":""}function Z(e,t,r){switch(function(e,t){return 45^x(e,0)?(((t<<2^x(e,0))<<2^x(e,1))<<2^x(e,2))<<2^x(e,3):0}(e,t)){case 5103:return l+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return l+e+e;case 4789:return u+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return l+e+u+e+c+e+e;case 5936:switch(x(e,t+11)){case 114:return l+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return l+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return l+e+c+S(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return l+e+c+e+e;case 6165:return l+e+c+"flex-"+e+e;case 5187:return l+e+S(e,/(\w+).+(:[^]+)/,l+"box-$1$2"+c+"flex-$1$2")+e;case 5443:return l+e+c+"flex-item-"+S(e,/flex-|-self/g,"")+(b(e,/flex-|baseline/)?"":c+"grid-row-"+S(e,/flex-|-self/g,""))+e;case 4675:return l+e+c+"flex-line-pack"+S(e,/align-content|flex-|-self/g,"")+e;case 5548:return l+e+c+S(e,"shrink","negative")+e;case 5292:return l+e+c+S(e,"basis","preferred-size")+e;case 6060:return l+"box-"+S(e,"-grow","")+l+e+c+S(e,"grow","positive")+e;case 4554:return l+S(e,/([^-])(transform)/g,"$1"+l+"$2")+e;case 6187:return S(S(S(e,/(zoom-|grab)/,l+"$1"),/(image-set)/,l+"$1"),e,"")+e;case 5495:case 3959:return S(e,/(image-set\([^]*)/,l+"$1$`$1");case 4968:return S(S(e,/(.+:)(flex-)?(.*)/,l+"box-pack:$3"+c+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+l+e+e;case 4200:if(!b(e,/flex-|baseline/))return c+"grid-column-align"+C(e,t)+e;break;case 2592:case 3360:return c+S(e,"template-","")+e;case 4384:case 3616:return r&&r.some((function(e,r){return t=r,b(e.props,/grid-\w+-end/)}))?~w(e+(r=r[t].value),"span",0)?e:c+S(e,"-start","")+e+c+"grid-row-span:"+(~w(r,"span",0)?b(r,/\d+/):+b(r,/\d+/)-+b(e,/\d+/))+";":c+S(e,"-start","")+e;case 4896:case 4128:return r&&r.some((function(e){return b(e.props,/grid-\w+-start/)}))?e:c+S(S(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return S(e,/(.+)-inline(.+)/,l+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(j(e)-1-t>6)switch(x(e,t+1)){case 109:if(45!==x(e,t+4))break;case 102:return S(e,/(.+:)(.+)-([^]+)/,"$1"+l+"$2-$3$1"+u+(108==x(e,t+3)?"$3":"$2-$3"))+e;case 115:return~w(e,"stretch",0)?Z(S(e,"stretch","fill-available"),t,r)+e:e}break;case 5152:case 5920:return S(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(t,r,n,o,i,s,a){return c+r+":"+n+a+(o?c+r+"-span:"+(i?s:+s-+n)+a:"")+e}));case 4949:if(121===x(e,t+6))return S(e,":",":"+l)+e;break;case 6444:switch(x(e,45===x(e,14)?18:11)){case 120:return S(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+l+(45===x(e,14)?"inline-":"")+"box$3$1"+l+"$2$3$1"+c+"$2box$3")+e;case 100:return S(e,":",":"+c)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return S(e,"scroll-","scroll-snap-")+e}return e}function J(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case d:return void(e.return=Z(e.value,e.length,r));case h:return V([$(e,{value:S(e.value,"@","@"+l)})],n);case p:if(e.length)return function(e,t){return e.map(t).join("")}(r=e.props,(function(t){switch(b(t,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":T($(e,{props:[S(t,/:(read-\w+)/,":-moz-$1")]})),T($(e,{props:[t]})),m(e,{props:E(r,n)});break;case"::placeholder":T($(e,{props:[S(t,/:(plac\w+)/,":"+l+"input-$1")]})),T($(e,{props:[S(t,/:(plac\w+)/,":-moz-$1")]})),T($(e,{props:[S(t,/:(plac\w+)/,c+"input-$1")]})),T($(e,{props:[t]})),m(e,{props:E(r,n)})}return""}))}}function X(e){return function(e){return N="",e}(ee("",null,null,null,[""],e=function(e){return O=A=1,P=j(N=e),R=0,[]}(e),0,[0],e))}function ee(e,t,r,n,o,i,s,a,c){for(var u=0,l=0,f=s,p=0,d=0,h=0,m=1,v=1,b=1,C=0,I="",E=o,O=i,A=n,P=I;v;)switch(h=C,C=z()){case 40:if(108!=h&&58==x(P,f-1)){-1!=w(P+=S(Y(C),"&","&\f"),"&\f",g(u?a[u-1]:0))&&(b=-1);break}case 34:case 39:case 91:P+=Y(C);break;case 9:case 10:case 13:case 32:P+=W(h);break;case 92:P+=U(L()-1,7);continue;case 47:switch(F()){case 42:case 47:k(re(H(z(),L()),t,r,c),c);break;default:P+="/"}break;case 123*m:a[u++]=j(P)*b;case 125*m:case 59:case 0:switch(C){case 0:case 125:v=0;case 59+l:-1==b&&(P=S(P,/\f/g,"")),d>0&&j(P)-f&&k(d>32?ne(P+";",n,r,f-1,c):ne(S(P," ","")+";",n,r,f-2,c),c);break;case 59:P+=";";default:if(k(A=te(P,t,r,u,l,o,a,I,E=[],O=[],f,i),i),123===C)if(0===l)ee(P,t,A,A,E,i,f,a,O);else switch(99===p&&110===x(P,3)?100:p){case 100:case 108:case 109:case 115:ee(e,A,A,n&&k(te(e,A,A,0,0,o,a,I,o,E=[],f,O),O),o,O,f,a,n?E:O);break;default:ee(P,A,A,A,[""],O,0,a,O)}}u=l=d=0,m=b=1,I=P="",f=s;break;case 58:f=1+j(P),d=h;default:if(m<1)if(123==C)--m;else if(125==C&&0==m++&&125==D())continue;switch(P+=y(C),C*m){case 38:b=l>0?1:(P+="\f",-1);break;case 44:a[u++]=(j(P)-1)*b,b=1;break;case 64:45===F()&&(P+=Y(z())),p=F(),l=f=j(I=P+=K(L())),C++;break;case 45:45===h&&2==j(P)&&(m=0)}}return i}function te(e,t,r,n,o,i,s,a,c,u,l,f){for(var d=o-1,h=0===o?i:[""],y=I(h),m=0,b=0,w=0;m<n;++m)for(var x=0,j=C(e,d+1,d=g(b=s[m])),k=e;x<y;++x)(k=v(b>0?h[x]+" "+j:S(j,/&\f/g,h[x])))&&(c[w++]=k);return B(e,t,r,0===o?p:a,c,u,l,f)}function re(e,t,r,n){return B(e,t,r,f,y(_),C(e,2,-2),0,n)}function ne(e,t,r,n,o){return B(e,t,r,d,C(e,0,n),C(e,n+1,-1),n,o)}var oe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ie="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",se="active",ae="data-styled-version",ce="6.1.19",ue="/*!sc*/\n",le="undefined"!=typeof window&&"undefined"!=typeof document,fe=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY&&"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY),pe=(new Set,Object.freeze([])),de=Object.freeze({});var he=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),ge=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,ye=/(^-|-$)/g;function me(e){return e.replace(ge,"-").replace(ye,"")}var ve=/(a)(d)/gi,be=function(e){return String.fromCharCode(e+(e>25?39:97))};function Se(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=be(t%52)+r;return(be(t%52)+r).replace(ve,"$1-$2")}var we,xe=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Ce=function(e){return xe(5381,e)};function je(e){return Se(Ce(e)>>>0)}function Ie(e){return"string"==typeof e&&!0}var ke="function"==typeof Symbol&&Symbol.for,Ee=ke?Symbol.for("react.memo"):60115,Oe=ke?Symbol.for("react.forward_ref"):60112,Ae={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Pe={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Re={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},_e=((we={})[Oe]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},we[Ee]=Re,we);function Ne(e){return("type"in(t=e)&&t.type.$$typeof)===Ee?Re:"$$typeof"in e?_e[e.$$typeof]:Ae;var t}var Be=Object.defineProperty,$e=Object.getOwnPropertyNames,Te=Object.getOwnPropertySymbols,De=Object.getOwnPropertyDescriptor,ze=Object.getPrototypeOf,Fe=Object.prototype;function Le(e,t,r){if("string"!=typeof t){if(Fe){var n=ze(t);n&&n!==Fe&&Le(e,n,r)}var o=$e(t);Te&&(o=o.concat(Te(t)));for(var i=Ne(e),s=Ne(t),a=0;a<o.length;++a){var c=o[a];if(!(c in Pe||r&&r[c]||s&&c in s||i&&c in i)){var u=De(t,c);try{Be(e,c,u)}catch(e){}}}}return e}function Me(e){return"function"==typeof e}function Ge(e){return"object"==typeof e&&"styledComponentId"in e}function Ye(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function We(e,t){if(0===e.length)return"";for(var r=e[0],n=1;n<e.length;n++)r+=t?t+e[n]:e[n];return r}function Ue(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function qe(e,t,r){if(void 0===r&&(r=!1),!r&&!Ue(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=qe(e[n],t[n]);else if(Ue(t))for(var n in t)e[n]=qe(e[n],t[n]);return e}function He(e,t){Object.defineProperty(e,"toString",{value:t})}function Ke(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var Ve=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,r=0;r<e;r++)t+=this.groupSizes[r];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var r=this.groupSizes,n=r.length,o=n;e>=o;)if((o<<=1)<0)throw Ke(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var i=n;i<o;i++)this.groupSizes[i]=0}for(var s=this.indexOfGroup(e+1),a=(i=0,t.length);i<a;i++)this.tag.insertRule(s,t[i])&&(this.groupSizes[e]++,s++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],r=this.indexOfGroup(e),n=r+t;this.groupSizes[e]=0;for(var o=r;o<n;o++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var r=this.groupSizes[e],n=this.indexOfGroup(e),o=n+r,i=n;i<o;i++)t+="".concat(this.tag.getRule(i)).concat(ue);return t},e}(),Qe=new Map,Ze=new Map,Je=1,Xe=function(e){if(Qe.has(e))return Qe.get(e);for(;Ze.has(Je);)Je++;var t=Je++;return Qe.set(e,t),Ze.set(t,e),t},et=function(e,t){Je=t+1,Qe.set(e,t),Ze.set(t,e)},tt="style[".concat(ie,"][").concat(ae,'="').concat(ce,'"]'),rt=new RegExp("^".concat(ie,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),nt=function(e,t,r){for(var n,o=r.split(","),i=0,s=o.length;i<s;i++)(n=o[i])&&e.registerName(t,n)},ot=function(e,t){for(var r,n=(null!==(r=t.textContent)&&void 0!==r?r:"").split(ue),o=[],i=0,s=n.length;i<s;i++){var a=n[i].trim();if(a){var c=a.match(rt);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(et(l,u),nt(e,l,c[3]),e.getTag().insertRules(u,o)),o.length=0}else o.push(a)}}},it=function(e){for(var t=document.querySelectorAll(tt),r=0,n=t.length;r<n;r++){var o=t[r];o&&o.getAttribute(ie)!==se&&(ot(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function st(){return n.nc}var at=function(e){var t=document.head,r=e||t,n=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(ie,"]")));return t[t.length-1]}(r),i=void 0!==o?o.nextSibling:null;n.setAttribute(ie,se),n.setAttribute(ae,ce);var s=st();return s&&n.setAttribute("nonce",s),r.insertBefore(n,i),n},ct=function(){function e(e){this.element=at(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,r=0,n=t.length;r<n;r++){var o=t[r];if(o.ownerNode===e)return o}throw Ke(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),ut=function(){function e(e){this.element=at(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var r=document.createTextNode(t);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),lt=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),ft=le,pt={isServer:!le,useCSSOMInjection:!fe},dt=function(){function t(t,r,n){void 0===t&&(t=de),void 0===r&&(r={});var o=this;this.options=e(e({},pt),t),this.gs=r,this.names=new Map(n),this.server=!!t.isServer,!this.server&&le&&ft&&(ft=!1,it(this)),He(this,(function(){return function(e){for(var t=e.getTag(),r=t.length,n="",o=function(r){var o=function(e){return Ze.get(e)}(r);if(void 0===o)return"continue";var i=e.names.get(o),s=t.getGroup(r);if(void 0===i||!i.size||0===s.length)return"continue";var a="".concat(ie,".g").concat(r,'[id="').concat(o,'"]'),c="";void 0!==i&&i.forEach((function(e){e.length>0&&(c+="".concat(e,","))})),n+="".concat(s).concat(a,'{content:"').concat(c,'"}').concat(ue)},i=0;i<r;i++)o(i);return n}(o)}))}return t.registerId=function(e){return Xe(e)},t.prototype.rehydrate=function(){!this.server&&le&&it(this)},t.prototype.reconstructWithOptions=function(r,n){return void 0===n&&(n=!0),new t(e(e({},this.options),r),this.gs,n&&this.names||void 0)},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,r=e.target;return e.isServer?new lt(r):t?new ct(r):new ut(r)}(this.options),new Ve(e)));var e},t.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.prototype.registerName=function(e,t){if(Xe(e),this.names.has(e))this.names.get(e).add(t);else{var r=new Set;r.add(t),this.names.set(e,r)}},t.prototype.insertRules=function(e,t,r){this.registerName(e,t),this.getTag().insertRules(Xe(e),r)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(Xe(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t}(),ht=/&/g,gt=/^\s*\/\/.*$/gm;function yt(e,t){return e.map((function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map((function(e){return"".concat(t," ").concat(e)}))),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=yt(e.children,t)),e}))}function mt(e){var t,r,n,o=void 0===e?de:e,i=o.options,s=void 0===i?de:i,a=o.plugins,c=void 0===a?pe:a,u=function(e,n,o){return o.startsWith(r)&&o.endsWith(r)&&o.replaceAll(r,"").length>0?".".concat(t):e},l=c.slice();l.push((function(e){e.type===p&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(ht,r).replace(n,u))})),s.prefix&&l.push(J),l.push(Q);var f=function(e,o,i,a){void 0===o&&(o=""),void 0===i&&(i=""),void 0===a&&(a="&"),t=a,r=o,n=new RegExp("\\".concat(r,"\\b"),"g");var c=e.replace(gt,""),u=X(i||o?"".concat(i," ").concat(o," { ").concat(c," }"):c);s.namespace&&(u=yt(u,s.namespace));var f,p,d,h=[];return V(u,(f=l.concat((d=function(e){return h.push(e)},function(e){e.root||(e=e.return)&&d(e)})),p=I(f),function(e,t,r,n){for(var o="",i=0;i<p;i++)o+=f[i](e,t,r,n)||"";return o})),h};return f.hash=c.length?c.reduce((function(e,t){return t.name||Ke(15),xe(e,t.name)}),5381).toString():"",f}var vt=new dt,bt=mt(),St=i().createContext({shouldForwardProp:void 0,styleSheet:vt,stylis:bt}),wt=(St.Consumer,i().createContext(void 0));function xt(){return(0,r.useContext)(St)}function Ct(e){var t=(0,r.useState)(e.stylisPlugins),n=t[0],o=t[1],s=xt().styleSheet,c=(0,r.useMemo)((function(){var t=s;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target,s]),u=(0,r.useMemo)((function(){return mt({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})}),[e.enableVendorPrefixes,e.namespace,n]);(0,r.useEffect)((function(){a()(n,e.stylisPlugins)||o(e.stylisPlugins)}),[e.stylisPlugins]);var l=(0,r.useMemo)((function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:c,stylis:u}}),[e.shouldForwardProp,c,u]);return i().createElement(St.Provider,{value:l},i().createElement(wt.Provider,{value:u},e.children))}var jt=function(){function e(e,t){var r=this;this.inject=function(e,t){void 0===t&&(t=bt);var n=r.name+t.hash;e.hasNameForId(r.id,n)||e.insertRules(r.id,n,t(r.rules,n,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,He(this,(function(){throw Ke(12,String(r.name))}))}return e.prototype.getName=function(e){return void 0===e&&(e=bt),this.name+e.hash},e}(),It=function(e){return e>="A"&&e<="Z"};function kt(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(1===r&&"-"===n&&"-"===e[0])return e;It(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var Et=function(e){return null==e||!1===e||""===e},Ot=function(e){var r,n,o=[];for(var i in e){var s=e[i];e.hasOwnProperty(i)&&!Et(s)&&(Array.isArray(s)&&s.isCss||Me(s)?o.push("".concat(kt(i),":"),s,";"):Ue(s)?o.push.apply(o,t(t(["".concat(i," {")],Ot(s),!1),["}"],!1)):o.push("".concat(kt(i),": ").concat((r=i,null==(n=s)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||r in oe||r.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return o};function At(e,t,r,n){return Et(e)?[]:Ge(e)?[".".concat(e.styledComponentId)]:Me(e)?!Me(o=e)||o.prototype&&o.prototype.isReactComponent||!t?[e]:At(e(t),t,r,n):e instanceof jt?r?(e.inject(r,n),[e.getName(n)]):[e]:Ue(e)?Ot(e):Array.isArray(e)?Array.prototype.concat.apply(pe,e.map((function(e){return At(e,t,r,n)}))):[e.toString()];var o}function Pt(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(Me(r)&&!Ge(r))return!1}return!0}var Rt=Ce(ce),_t=function(){function e(e,t,r){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===r||r.isStatic)&&Pt(e),this.componentId=t,this.baseHash=xe(Rt,t),this.baseStyle=r,dt.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,r){var n=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))n=Ye(n,this.staticRulesId);else{var o=We(At(this.rules,e,t,r)),i=Se(xe(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,i)){var s=r(o,".".concat(i),void 0,this.componentId);t.insertRules(this.componentId,i,s)}n=Ye(n,i),this.staticRulesId=i}else{for(var a=xe(this.baseHash,r.hash),c="",u=0;u<this.rules.length;u++){var l=this.rules[u];if("string"==typeof l)c+=l;else if(l){var f=We(At(l,e,t,r));a=xe(a,f+u),c+=f}}if(c){var p=Se(a>>>0);t.hasNameForId(this.componentId,p)||t.insertRules(this.componentId,p,r(c,".".concat(p),void 0,this.componentId)),n=Ye(n,p)}}return n},e}(),Nt=i().createContext(void 0);function Bt(t){var n=i().useContext(Nt),o=(0,r.useMemo)((function(){return function(t,r){if(!t)throw Ke(14);if(Me(t))return t(r);if(Array.isArray(t)||"object"!=typeof t)throw Ke(8);return r?e(e({},r),t):t}(t.theme,n)}),[t.theme,n]);return t.children?i().createElement(Nt.Provider,{value:o},t.children):null}Nt.Consumer;var $t={};function Tt(t,n,o){var s=Ge(t),a=t,c=!Ie(t),u=n.attrs,l=void 0===u?pe:u,f=n.componentId,p=void 0===f?function(e,t){var r="string"!=typeof e?"sc":me(e);$t[r]=($t[r]||0)+1;var n="".concat(r,"-").concat(je(ce+r+$t[r]));return t?"".concat(t,"-").concat(n):n}(n.displayName,n.parentComponentId):f,d=n.displayName,h=void 0===d?function(e){return Ie(e)?"styled.".concat(e):"Styled(".concat(function(e){return e.displayName||e.name||"Component"}(e),")")}(t):d,g=n.displayName&&n.componentId?"".concat(me(n.displayName),"-").concat(n.componentId):n.componentId||p,y=s&&a.attrs?a.attrs.concat(l).filter(Boolean):l,m=n.shouldForwardProp;if(s&&a.shouldForwardProp){var v=a.shouldForwardProp;if(n.shouldForwardProp){var b=n.shouldForwardProp;m=function(e,t){return v(e,t)&&b(e,t)}}else m=v}var S=new _t(o,g,s?a.componentStyle:void 0);function w(t,n){return function(t,n,o){var s=t.attrs,a=t.componentStyle,c=t.defaultProps,u=t.foldedComponentIds,l=t.styledComponentId,f=t.target,p=i().useContext(Nt),d=xt(),h=t.shouldForwardProp||d.shouldForwardProp,g=function(e,t,r){return void 0===r&&(r=de),e.theme!==r.theme&&e.theme||t||r.theme}(n,p,c)||de,y=function(t,r,n){for(var o,i=e(e({},r),{className:void 0,theme:n}),s=0;s<t.length;s+=1){var a=Me(o=t[s])?o(i):o;for(var c in a)i[c]="className"===c?Ye(i[c],a[c]):"style"===c?e(e({},i[c]),a[c]):a[c]}return r.className&&(i.className=Ye(i.className,r.className)),i}(s,n,g),m=y.as||f,v={};for(var b in y)void 0===y[b]||"$"===b[0]||"as"===b||"theme"===b&&y.theme===g||("forwardedAs"===b?v.as=y.forwardedAs:h&&!h(b,m)||(v[b]=y[b]));var S=function(e,t){var r=xt();return e.generateAndInjectStyles(t,r.styleSheet,r.stylis)}(a,y),w=Ye(u,l);return S&&(w+=" "+S),y.className&&(w+=" "+y.className),v[Ie(m)&&!he.has(m)?"class":"className"]=w,o&&(v.ref=o),(0,r.createElement)(m,v)}(x,t,n)}w.displayName=h;var x=i().forwardRef(w);return x.attrs=y,x.componentStyle=S,x.displayName=h,x.shouldForwardProp=m,x.foldedComponentIds=s?Ye(a.foldedComponentIds,a.styledComponentId):"",x.styledComponentId=g,x.target=s?a.target:t,Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=s?function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0,o=t;n<o.length;n++)qe(e,o[n],!0);return e}({},a.defaultProps,e):e}}),He(x,(function(){return".".concat(x.styledComponentId)})),c&&Le(x,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),x}function Dt(e,t){for(var r=[e[0]],n=0,o=t.length;n<o;n+=1)r.push(t[n],e[n+1]);return r}new Set;var zt=function(e){return Object.assign(e,{isCss:!0})};function Ft(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(Me(e)||Ue(e))return zt(At(Dt(pe,t([e],r,!0))));var o=e;return 0===r.length&&1===o.length&&"string"==typeof o[0]?At(o):zt(At(Dt(o,r)))}function Lt(r,n,o){if(void 0===o&&(o=de),!n)throw Ke(1,n);var i=function(e){for(var i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];return r(n,o,Ft.apply(void 0,t([e],i,!1)))};return i.attrs=function(t){return Lt(r,n,e(e({},o),{attrs:Array.prototype.concat(o.attrs,t).filter(Boolean)}))},i.withConfig=function(t){return Lt(r,n,e(e({},o),t))},i}var Mt=function(e){return Lt(Tt,e)},Gt=Mt;he.forEach((function(e){Gt[e]=Mt(e)})),function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Pt(e),dt.registerId(this.componentId+1)}e.prototype.createStyles=function(e,t,r,n){var o=n(We(At(this.rules,t,r,n)),""),i=this.componentId+e;r.insertRules(i,i,o)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,r,n){e>2&&dt.registerId(this.componentId+e),this.removeStyles(e,r),this.createStyles(e,t,r,n)}}(),function(){function t(){var t=this;this._emitSheetCSS=function(){var e=t.instance.toString();if(!e)return"";var r=st(),n=We([r&&'nonce="'.concat(r,'"'),"".concat(ie,'="true"'),"".concat(ae,'="').concat(ce,'"')].filter(Boolean)," ");return"<style ".concat(n,">").concat(e,"</style>")},this.getStyleTags=function(){if(t.sealed)throw Ke(2);return t._emitSheetCSS()},this.getStyleElement=function(){var r;if(t.sealed)throw Ke(2);var n=t.instance.toString();if(!n)return[];var o=((r={})[ie]="",r[ae]=ce,r.dangerouslySetInnerHTML={__html:n},r),s=st();return s&&(o.nonce=s),[i().createElement("style",e({},o,{key:"sc-0-0"}))]},this.seal=function(){t.sealed=!0},this.instance=new dt({isServer:!0}),this.sealed=!1}t.prototype.collectStyles=function(e){if(this.sealed)throw Ke(2);return i().createElement(Ct,{sheet:this.instance},e)},t.prototype.interleaveWithNodeStream=function(e){throw Ke(3)}}(),"__sc-".concat(ie,"__");var Yt={primaryTextColor:"rgb(3, 7, 18)",primaryBackgroundColor:"rgb(253, 254, 255)",secondaryBackgroundColor:"rgb(250, 250, 250)",mobileBreakpoint:"600px",primaryBorderColor:"rgb(229, 231, 235)",secondaryBorderColor:"rgb(229, 231, 235)",widgetBackgroundColor:"#FFF",backgroundColor:"rgb(255, 255, 255)",secondaryTextColor:"rgb(115, 115, 115)",blankColor:"rgb(245, 245, 245)",overlayBackgroundColor:"rgba(255, 255, 255, .9)",messageBackgroundColor:"rgba(244, 244, 245, 0.3)",highlightColor:"#000",additionalTextColor:"rgb(156, 163, 175)",buttonActionTextColor:"#FFF",successStatusBorderColor:"rgb(187, 247, 208)",successStatusBackgroundColor:"rgb(240, 253, 244)",successStatusTextColor:"rgb(22, 163, 74)",errorStatusBackgroundColor:"rgb(254, 242, 242)",errorStatusBorderColor:"rgb(254, 202, 202)",errorStatusTextColor:"rgb(153, 27, 27)",buttonDisabledBackgroundColor:"rgb(229, 231, 235)",warningStatusBackgroundColor:"rgb(254, 252, 232)",warningStatusBorderColor:"rgb(254, 240, 138)",warningStatusTextColor:"rgb(180, 83, 9)",infoStatusBorderColor:"rgb(191, 219, 254)",infoStatusBackgroundColor:"rgb(239, 246, 255)",infoStatusTextColor:"rgb(29, 78, 216)",defaultStatusBackgroundColor:"rgb(255, 255, 255)",defaultStatusBorderColor:"rgb(229, 231, 235)",pendingStatusBackgroundColor:"rgb(254, 252, 232)",pendingStatusBorderColor:"rgb(254, 240, 138)",buttonActionBackgroundColor:"#000",buttonActionBackgroundHoverColor:"#000",buttonActionBackgroundActiveColor:"#000",buttonActionBorderHoverColor:"transparent",buttonActionBorderActiveColor:"transparent",buttonActionBorderColor:"transparent"};function Wt(e){if("object"!=typeof e||null===e)return!1;const t=e;if("string"!=typeof t.credential_group_id)return!1;if("object"!=typeof t.semaphore_proof||null===t.semaphore_proof)return!1;const r=t.semaphore_proof;return"number"==typeof r.merkle_tree_depth&&"string"==typeof r.merkle_tree_root&&"string"==typeof r.nullifier&&"string"==typeof r.message&&"string"==typeof r.scope&&Array.isArray(r.points)&&r.points.every((e=>"string"==typeof e))}var Ut,qt=function(e,t,n,o,i){(0,r.useEffect)((()=>{if("undefined"==typeof window)return;const r=new URL(n).origin;async function s(s){const a=s.origin,c=s.data;if(a!==window.location.origin){if(a===r){if(!function(e){return function(e){if("object"!=typeof e||null===e)return!1;const t=e;return"GENERATE_USER_KEY"===t.type&&"object"==typeof t.payload&&null!==t.payload&&"string"==typeof t.payload.message&&t.payload.message.length>0}(e)||function(e){if("object"!=typeof e||null===e)return!1;const t=e;return"CLOSE_MODAL"===t.type&&(void 0===t.requestId||"string"==typeof t.requestId)}(e)||function(e){if("object"!=typeof e||null===e)return!1;const t=e;if("PROOFS_RESPONSE"!==t.type)return!1;if("string"!=typeof t.requestId)return!1;if(void 0!==t.error&&"string"!=typeof t.error)return!1;if(void 0!==t.payload){if("object"!=typeof t.payload||null===t.payload)return!1;const e=t.payload;if(!Array.isArray(e.proofs))return!1;if(!e.proofs.every(Wt))return!1;if("number"!=typeof e.points||!Number.isFinite(e.points))return!1}return!0}(e)}(c))return void console.error("Invalid inbound message structure from widget");const e=c;if("GENERATE_USER_KEY"===e.type){if(i){var u;const r=e.payload.message,o="BringID key";if(!r.includes(o))return void console.error("Invalid signature request: message must contain `BringID key`");const s=await i(r);return void(null===(u=t.current.contentWindow)||void 0===u||u.postMessage({type:"USER_KEY_READY",payload:{signature:s}},n))}return alert("generateSignature IS NOT AVAILABLE")}return"CLOSE_MODAL"!==e.type&&"PROOFS_RESPONSE"!==e.type||o(!1),void window.postMessage(e,window.location.origin)}}else{var l;if(!t.current)return;if(!function(e){return function(e){if("object"!=typeof e||null===e)return!1;const t=e;if("PROOFS_REQUEST"!==t.type)return!1;if("string"!=typeof t.requestId)return!1;if(void 0!==t.payload){if("object"!=typeof t.payload||null===t.payload)return!1;const e=t.payload;if(void 0!==e.minPoints&&"number"!=typeof e.minPoints)return!1}return!0}(e)||function(e){if("object"!=typeof e||null===e)return!1;const t=e;return"USER_KEY_READY"===t.type&&"object"==typeof t.payload&&null!==t.payload&&"string"==typeof t.payload.signature}(e)}(c))return;if("PROOFS_REQUEST"===c.type){if(!e)return alert("Modal window is not ready yet");o(!0)}null===(l=t.current.contentWindow)||void 0===l||l.postMessage(c,r)}}return window.addEventListener("message",s),()=>window.removeEventListener("message",s)}),[i,e,n,o,t])};const Ht=Gt.div(Ut||(Kt=["\n border-radius: 8px;\n width: 32px;\n height: 32px;\n background-color: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n"],Vt||(Vt=Kt.slice(0)),Ut=Object.freeze(Object.defineProperties(Kt,{raw:{value:Object.freeze(Vt)}}))),(e=>e.theme.secondaryBackgroundColor));var Kt,Vt,Qt,Zt,Jt,Xt,er,tr=n(74),rr=e=>{let{className:t}=e;return(0,tr.jsx)("svg",{className:t,width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,tr.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.144225 0.144225C0.336519 -0.048075 0.648289 -0.048075 0.840589 0.144225L5.00002 4.30363L9.15945 0.144225C9.35175 -0.048075 9.66348 -0.048075 9.85577 0.144225C10.0481 0.336519 10.0481 0.648289 9.85577 0.840589L5.69641 5.00002L9.85577 9.15945C10.0481 9.35175 10.0481 9.66348 9.85577 9.85577C9.66348 10.0481 9.35175 10.0481 9.15945 9.85577L5.00002 5.69641L0.840589 9.85577C0.648289 10.0481 0.336519 10.0481 0.144225 9.85577C-0.048075 9.66348 -0.048075 9.35175 0.144225 9.15945L4.30363 5.00002L0.144225 0.840589C-0.048075 0.648289 -0.048075 0.336519 0.144225 0.144225Z",fill:"#686869"})})};function nr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const or=Gt.div(Qt||(Qt=nr(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.3);\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n align-items: center;\n justify-content: center;\n backdrop-filter: blur(2px);\n box-sizing: border-box;\n"]))),ir=Gt.div(Zt||(Zt=nr(["\n max-width: 680px;\n position: relative;\n width: 100%;\n background: ",";\n border-radius: 20px;\n padding: 16px;\n\n @media (max-width: ",") {\n padding: 40px 25px;\n }\n"])),(e=>e.theme&&e.theme.widgetBackgroundColor),(e=>e.theme.mobileBreakpoint));Gt.h3(Jt||(Jt=nr(["\n margin: 0 0 20px;\n font-size: 32px;\n font-weight: 700;\n text-align: center;\n color: ",";\n"])),(e=>e.theme.primaryTextColor)),Gt.div(Xt||(Xt=nr(["\n margin: 0 auto 20px;\n display: flex;\n justify-content: center;\n"]))),Gt((e=>{let{className:t,onClick:r}=e;return(0,tr.jsx)(Ht,{className:t,onClick:r,children:(0,tr.jsx)(rr,{})})}))(er||(er=nr(["\n position: absolute;\n right: 20px;\n top: 20px;\n"])));var sr,ar,cr;function ur(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const lr=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=We(Ft.apply(void 0,t([e],r,!1))),i=je(o);return new jt(i,o)}(sr||(sr=ur(["\n 0% {\n transform: rotate(0deg)\n }\n 100% {\n transform: rotate(360deg)\n }\n"]))),fr=Gt.span(ar||(ar=ur(["\n width: 16px;\n height: 16px;\n\n ","\n border-radius: 50%;\n display: inline-block;\n border-top: 2px solid ",";\n border-right: 2px solid transparent;\n box-sizing: border-box;\n animation: "," 1s linear infinite;\n"])),(e=>"large"===e.size&&Ft(cr||(cr=ur(["\n width: 32px;\n height: 32px;\n "])))),(e=>e.theme.highlightColor),lr);var pr,dr,hr,gr,yr=e=>{let{className:t,size:r}=e;return(0,tr.jsx)(fr,{className:t,size:r})};function mr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const vr="DialogClassName",br=Gt((e=>{let{children:t,className:r,dialogClassName:n}=e;return(0,tr.jsx)(or,{className:r,children:(0,tr.jsx)(ir,{className:n,children:t})})}))(pr||(pr=mr(["\n ","\n\n ."," {\n max-width: 400px;\n width: 90%;\n padding: 0px;\n position: relative;\n overflow: hidden;\n }\n"])),(e=>!e.visible&&Ft(dr||(dr=mr(["\n opacity: 0;\n pointer-events: none;\n "])))),vr),Sr=Gt.iframe(hr||(hr=mr(["\n width: 100%;\n height: 550px;\n border: none;\n overflow: auto;\n"]))),wr=Gt.div(gr||(gr=mr(["\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n top: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n"])));var xr=["https://widget.bringid.org","https://staging.widget.bringid.org","https://dev.widget.bringid.org"],Cr=e=>{let{address:t,appId:n,generateSignature:o,iframeOnLoad:i,mode:s="production",highlightColor:a,theme:c="light",connectUrl:u="https://widget.bringid.org"}=e;if(!xr.includes(u))return console.error('BringID: Invalid connectUrl "'.concat(u,'". Must be one of: ').concat(xr.join(", "))),null;const l=(0,r.useRef)(null),[f,p]=(0,r.useState)(!1),[d,h]=(0,r.useState)(!1);if(qt(d,l,u,p,o),"undefined"==typeof window)return null;const g=(m={url:encodeURIComponent(window.location.href),address:t,appId:n,mode:s,theme:c,highlightColor:a?encodeURIComponent(a):void 0},Object.entries(m).reduce(((e,t)=>{let[r,n]=t;return n?""===e?"".concat(r,"=").concat(n):"".concat(e,"&").concat(r,"=").concat(n):e}),"")),y="undefined"==typeof window?"":"".concat(u,"?").concat(g);var m;return(0,tr.jsx)(Bt,{theme:Yt,children:(0,tr.jsxs)(br,{visible:f,onClose:()=>p(!1),dialogClassName:vr,children:[!d&&(0,tr.jsx)(wr,{children:(0,tr.jsx)(yr,{size:"large"})}),(0,tr.jsx)(Sr,{sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",ref:l,src:y,onLoad:()=>{i&&i(),h(!0)}})]})})}}(),o}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.BringSDK=t(require("react")):e.BringSDK=t(e.react)}(this,(function(e){return function(){var t={568:function(e,t){"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return t=n.ref,{$$typeof:r,type:e,key:o,ref:void 0!==t?t:null,props:n}}Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},74:function(e,t,r){"use strict";e.exports=r(568)},863:function(e){e.exports=function(e,t,r,n){var o=r?r.call(n,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var u=i[c];if(!a(u))return!1;var l=e[u],f=t[u];if(!1===(o=r?r.call(n,l,f,u):void 0)||void 0===o&&l!==f)return!1}return!0}},155:function(t){"use strict";t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var o={};return function(){"use strict";n.r(o),n.d(o,{BringIDModal:function(){return Cr}});var e=function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var r=n(155),i=n.n(r),s=n(863),a=n.n(s),c="-ms-",u="-moz-",l="-webkit-",f="comm",p="rule",d="decl",h="@keyframes",g=Math.abs,y=String.fromCharCode,m=Object.assign;function v(e){return e.trim()}function b(e,t){return(e=t.exec(e))?e[0]:e}function S(e,t,r){return e.replace(t,r)}function w(e,t,r){return e.indexOf(t,r)}function x(e,t){return 0|e.charCodeAt(t)}function C(e,t,r){return e.slice(t,r)}function j(e){return e.length}function k(e){return e.length}function E(e,t){return t.push(e),e}function O(e,t){return e.filter((function(e){return!b(e,t)}))}var A=1,P=1,I=0,R=0,_=0,N="";function B(e,t,r,n,o,i,s,a){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:A,column:P,length:s,return:"",siblings:a}}function $(e,t){return m(B("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function T(e){for(;e.root;)e=$(e.root,{children:[e]});E(e,e.siblings)}function D(){return _=R>0?x(N,--R):0,P--,10===_&&(P=1,A--),_}function z(){return _=R<I?x(N,R++):0,P++,10===_&&(P=1,A++),_}function F(){return x(N,R)}function L(){return R}function M(e,t){return C(N,e,t)}function G(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Y(e){return v(M(R-1,q(91===e?e+2:40===e?e+1:e)))}function W(e){for(;(_=F())&&_<33;)z();return G(e)>2||G(_)>3?"":" "}function U(e,t){for(;--t&&z()&&!(_<48||_>102||_>57&&_<65||_>70&&_<97););return M(e,L()+(t<6&&32==F()&&32==z()))}function q(e){for(;z();)switch(_){case e:return R;case 34:case 39:34!==e&&39!==e&&q(_);break;case 40:41===e&&q(e);break;case 92:z()}return R}function H(e,t){for(;z()&&e+_!==57&&(e+_!==84||47!==F()););return"/*"+M(t,R-1)+"*"+y(47===e?e:z())}function K(e){for(;!G(F());)z();return M(e,R)}function V(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Q(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case d:return e.return=e.return||e.value;case f:return"";case h:return e.return=e.value+"{"+V(e.children,n)+"}";case p:if(!j(e.value=e.props.join(",")))return""}return j(r=V(e.children,n))?e.return=e.value+"{"+r+"}":""}function Z(e,t,r){switch(function(e,t){return 45^x(e,0)?(((t<<2^x(e,0))<<2^x(e,1))<<2^x(e,2))<<2^x(e,3):0}(e,t)){case 5103:return l+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return l+e+e;case 4789:return u+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return l+e+u+e+c+e+e;case 5936:switch(x(e,t+11)){case 114:return l+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return l+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return l+e+c+S(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return l+e+c+e+e;case 6165:return l+e+c+"flex-"+e+e;case 5187:return l+e+S(e,/(\w+).+(:[^]+)/,l+"box-$1$2"+c+"flex-$1$2")+e;case 5443:return l+e+c+"flex-item-"+S(e,/flex-|-self/g,"")+(b(e,/flex-|baseline/)?"":c+"grid-row-"+S(e,/flex-|-self/g,""))+e;case 4675:return l+e+c+"flex-line-pack"+S(e,/align-content|flex-|-self/g,"")+e;case 5548:return l+e+c+S(e,"shrink","negative")+e;case 5292:return l+e+c+S(e,"basis","preferred-size")+e;case 6060:return l+"box-"+S(e,"-grow","")+l+e+c+S(e,"grow","positive")+e;case 4554:return l+S(e,/([^-])(transform)/g,"$1"+l+"$2")+e;case 6187:return S(S(S(e,/(zoom-|grab)/,l+"$1"),/(image-set)/,l+"$1"),e,"")+e;case 5495:case 3959:return S(e,/(image-set\([^]*)/,l+"$1$`$1");case 4968:return S(S(e,/(.+:)(flex-)?(.*)/,l+"box-pack:$3"+c+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+l+e+e;case 4200:if(!b(e,/flex-|baseline/))return c+"grid-column-align"+C(e,t)+e;break;case 2592:case 3360:return c+S(e,"template-","")+e;case 4384:case 3616:return r&&r.some((function(e,r){return t=r,b(e.props,/grid-\w+-end/)}))?~w(e+(r=r[t].value),"span",0)?e:c+S(e,"-start","")+e+c+"grid-row-span:"+(~w(r,"span",0)?b(r,/\d+/):+b(r,/\d+/)-+b(e,/\d+/))+";":c+S(e,"-start","")+e;case 4896:case 4128:return r&&r.some((function(e){return b(e.props,/grid-\w+-start/)}))?e:c+S(S(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return S(e,/(.+)-inline(.+)/,l+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(j(e)-1-t>6)switch(x(e,t+1)){case 109:if(45!==x(e,t+4))break;case 102:return S(e,/(.+:)(.+)-([^]+)/,"$1"+l+"$2-$3$1"+u+(108==x(e,t+3)?"$3":"$2-$3"))+e;case 115:return~w(e,"stretch",0)?Z(S(e,"stretch","fill-available"),t,r)+e:e}break;case 5152:case 5920:return S(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(t,r,n,o,i,s,a){return c+r+":"+n+a+(o?c+r+"-span:"+(i?s:+s-+n)+a:"")+e}));case 4949:if(121===x(e,t+6))return S(e,":",":"+l)+e;break;case 6444:switch(x(e,45===x(e,14)?18:11)){case 120:return S(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+l+(45===x(e,14)?"inline-":"")+"box$3$1"+l+"$2$3$1"+c+"$2box$3")+e;case 100:return S(e,":",":"+c)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return S(e,"scroll-","scroll-snap-")+e}return e}function J(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case d:return void(e.return=Z(e.value,e.length,r));case h:return V([$(e,{value:S(e.value,"@","@"+l)})],n);case p:if(e.length)return function(e,t){return e.map(t).join("")}(r=e.props,(function(t){switch(b(t,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":T($(e,{props:[S(t,/:(read-\w+)/,":-moz-$1")]})),T($(e,{props:[t]})),m(e,{props:O(r,n)});break;case"::placeholder":T($(e,{props:[S(t,/:(plac\w+)/,":"+l+"input-$1")]})),T($(e,{props:[S(t,/:(plac\w+)/,":-moz-$1")]})),T($(e,{props:[S(t,/:(plac\w+)/,c+"input-$1")]})),T($(e,{props:[t]})),m(e,{props:O(r,n)})}return""}))}}function X(e){return function(e){return N="",e}(ee("",null,null,null,[""],e=function(e){return A=P=1,I=j(N=e),R=0,[]}(e),0,[0],e))}function ee(e,t,r,n,o,i,s,a,c){for(var u=0,l=0,f=s,p=0,d=0,h=0,m=1,v=1,b=1,C=0,k="",O=o,A=i,P=n,I=k;v;)switch(h=C,C=z()){case 40:if(108!=h&&58==x(I,f-1)){-1!=w(I+=S(Y(C),"&","&\f"),"&\f",g(u?a[u-1]:0))&&(b=-1);break}case 34:case 39:case 91:I+=Y(C);break;case 9:case 10:case 13:case 32:I+=W(h);break;case 92:I+=U(L()-1,7);continue;case 47:switch(F()){case 42:case 47:E(re(H(z(),L()),t,r,c),c);break;default:I+="/"}break;case 123*m:a[u++]=j(I)*b;case 125*m:case 59:case 0:switch(C){case 0:case 125:v=0;case 59+l:-1==b&&(I=S(I,/\f/g,"")),d>0&&j(I)-f&&E(d>32?ne(I+";",n,r,f-1,c):ne(S(I," ","")+";",n,r,f-2,c),c);break;case 59:I+=";";default:if(E(P=te(I,t,r,u,l,o,a,k,O=[],A=[],f,i),i),123===C)if(0===l)ee(I,t,P,P,O,i,f,a,A);else switch(99===p&&110===x(I,3)?100:p){case 100:case 108:case 109:case 115:ee(e,P,P,n&&E(te(e,P,P,0,0,o,a,k,o,O=[],f,A),A),o,A,f,a,n?O:A);break;default:ee(I,P,P,P,[""],A,0,a,A)}}u=l=d=0,m=b=1,k=I="",f=s;break;case 58:f=1+j(I),d=h;default:if(m<1)if(123==C)--m;else if(125==C&&0==m++&&125==D())continue;switch(I+=y(C),C*m){case 38:b=l>0?1:(I+="\f",-1);break;case 44:a[u++]=(j(I)-1)*b,b=1;break;case 64:45===F()&&(I+=Y(z())),p=F(),l=f=j(k=I+=K(L())),C++;break;case 45:45===h&&2==j(I)&&(m=0)}}return i}function te(e,t,r,n,o,i,s,a,c,u,l,f){for(var d=o-1,h=0===o?i:[""],y=k(h),m=0,b=0,w=0;m<n;++m)for(var x=0,j=C(e,d+1,d=g(b=s[m])),E=e;x<y;++x)(E=v(b>0?h[x]+" "+j:S(j,/&\f/g,h[x])))&&(c[w++]=E);return B(e,t,r,0===o?p:a,c,u,l,f)}function re(e,t,r,n){return B(e,t,r,f,y(_),C(e,2,-2),0,n)}function ne(e,t,r,n,o){return B(e,t,r,d,C(e,0,n),C(e,n+1,-1),n,o)}var oe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ie="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",se="active",ae="data-styled-version",ce="6.1.19",ue="/*!sc*/\n",le="undefined"!=typeof window&&"undefined"!=typeof document,fe=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY&&"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY),pe=(new Set,Object.freeze([])),de=Object.freeze({});var he=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),ge=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,ye=/(^-|-$)/g;function me(e){return e.replace(ge,"-").replace(ye,"")}var ve=/(a)(d)/gi,be=function(e){return String.fromCharCode(e+(e>25?39:97))};function Se(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=be(t%52)+r;return(be(t%52)+r).replace(ve,"$1-$2")}var we,xe=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Ce=function(e){return xe(5381,e)};function je(e){return Se(Ce(e)>>>0)}function ke(e){return"string"==typeof e&&!0}var Ee="function"==typeof Symbol&&Symbol.for,Oe=Ee?Symbol.for("react.memo"):60115,Ae=Ee?Symbol.for("react.forward_ref"):60112,Pe={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Ie={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Re={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},_e=((we={})[Ae]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},we[Oe]=Re,we);function Ne(e){return("type"in(t=e)&&t.type.$$typeof)===Oe?Re:"$$typeof"in e?_e[e.$$typeof]:Pe;var t}var Be=Object.defineProperty,$e=Object.getOwnPropertyNames,Te=Object.getOwnPropertySymbols,De=Object.getOwnPropertyDescriptor,ze=Object.getPrototypeOf,Fe=Object.prototype;function Le(e,t,r){if("string"!=typeof t){if(Fe){var n=ze(t);n&&n!==Fe&&Le(e,n,r)}var o=$e(t);Te&&(o=o.concat(Te(t)));for(var i=Ne(e),s=Ne(t),a=0;a<o.length;++a){var c=o[a];if(!(c in Ie||r&&r[c]||s&&c in s||i&&c in i)){var u=De(t,c);try{Be(e,c,u)}catch(e){}}}}return e}function Me(e){return"function"==typeof e}function Ge(e){return"object"==typeof e&&"styledComponentId"in e}function Ye(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function We(e,t){if(0===e.length)return"";for(var r=e[0],n=1;n<e.length;n++)r+=t?t+e[n]:e[n];return r}function Ue(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function qe(e,t,r){if(void 0===r&&(r=!1),!r&&!Ue(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=qe(e[n],t[n]);else if(Ue(t))for(var n in t)e[n]=qe(e[n],t[n]);return e}function He(e,t){Object.defineProperty(e,"toString",{value:t})}function Ke(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var Ve=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,r=0;r<e;r++)t+=this.groupSizes[r];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var r=this.groupSizes,n=r.length,o=n;e>=o;)if((o<<=1)<0)throw Ke(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var i=n;i<o;i++)this.groupSizes[i]=0}for(var s=this.indexOfGroup(e+1),a=(i=0,t.length);i<a;i++)this.tag.insertRule(s,t[i])&&(this.groupSizes[e]++,s++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],r=this.indexOfGroup(e),n=r+t;this.groupSizes[e]=0;for(var o=r;o<n;o++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var r=this.groupSizes[e],n=this.indexOfGroup(e),o=n+r,i=n;i<o;i++)t+="".concat(this.tag.getRule(i)).concat(ue);return t},e}(),Qe=new Map,Ze=new Map,Je=1,Xe=function(e){if(Qe.has(e))return Qe.get(e);for(;Ze.has(Je);)Je++;var t=Je++;return Qe.set(e,t),Ze.set(t,e),t},et=function(e,t){Je=t+1,Qe.set(e,t),Ze.set(t,e)},tt="style[".concat(ie,"][").concat(ae,'="').concat(ce,'"]'),rt=new RegExp("^".concat(ie,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),nt=function(e,t,r){for(var n,o=r.split(","),i=0,s=o.length;i<s;i++)(n=o[i])&&e.registerName(t,n)},ot=function(e,t){for(var r,n=(null!==(r=t.textContent)&&void 0!==r?r:"").split(ue),o=[],i=0,s=n.length;i<s;i++){var a=n[i].trim();if(a){var c=a.match(rt);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(et(l,u),nt(e,l,c[3]),e.getTag().insertRules(u,o)),o.length=0}else o.push(a)}}},it=function(e){for(var t=document.querySelectorAll(tt),r=0,n=t.length;r<n;r++){var o=t[r];o&&o.getAttribute(ie)!==se&&(ot(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function st(){return n.nc}var at=function(e){var t=document.head,r=e||t,n=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(ie,"]")));return t[t.length-1]}(r),i=void 0!==o?o.nextSibling:null;n.setAttribute(ie,se),n.setAttribute(ae,ce);var s=st();return s&&n.setAttribute("nonce",s),r.insertBefore(n,i),n},ct=function(){function e(e){this.element=at(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,r=0,n=t.length;r<n;r++){var o=t[r];if(o.ownerNode===e)return o}throw Ke(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),ut=function(){function e(e){this.element=at(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var r=document.createTextNode(t);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),lt=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),ft=le,pt={isServer:!le,useCSSOMInjection:!fe},dt=function(){function t(t,r,n){void 0===t&&(t=de),void 0===r&&(r={});var o=this;this.options=e(e({},pt),t),this.gs=r,this.names=new Map(n),this.server=!!t.isServer,!this.server&&le&&ft&&(ft=!1,it(this)),He(this,(function(){return function(e){for(var t=e.getTag(),r=t.length,n="",o=function(r){var o=function(e){return Ze.get(e)}(r);if(void 0===o)return"continue";var i=e.names.get(o),s=t.getGroup(r);if(void 0===i||!i.size||0===s.length)return"continue";var a="".concat(ie,".g").concat(r,'[id="').concat(o,'"]'),c="";void 0!==i&&i.forEach((function(e){e.length>0&&(c+="".concat(e,","))})),n+="".concat(s).concat(a,'{content:"').concat(c,'"}').concat(ue)},i=0;i<r;i++)o(i);return n}(o)}))}return t.registerId=function(e){return Xe(e)},t.prototype.rehydrate=function(){!this.server&&le&&it(this)},t.prototype.reconstructWithOptions=function(r,n){return void 0===n&&(n=!0),new t(e(e({},this.options),r),this.gs,n&&this.names||void 0)},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,r=e.target;return e.isServer?new lt(r):t?new ct(r):new ut(r)}(this.options),new Ve(e)));var e},t.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.prototype.registerName=function(e,t){if(Xe(e),this.names.has(e))this.names.get(e).add(t);else{var r=new Set;r.add(t),this.names.set(e,r)}},t.prototype.insertRules=function(e,t,r){this.registerName(e,t),this.getTag().insertRules(Xe(e),r)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(Xe(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t}(),ht=/&/g,gt=/^\s*\/\/.*$/gm;function yt(e,t){return e.map((function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map((function(e){return"".concat(t," ").concat(e)}))),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=yt(e.children,t)),e}))}function mt(e){var t,r,n,o=void 0===e?de:e,i=o.options,s=void 0===i?de:i,a=o.plugins,c=void 0===a?pe:a,u=function(e,n,o){return o.startsWith(r)&&o.endsWith(r)&&o.replaceAll(r,"").length>0?".".concat(t):e},l=c.slice();l.push((function(e){e.type===p&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(ht,r).replace(n,u))})),s.prefix&&l.push(J),l.push(Q);var f=function(e,o,i,a){void 0===o&&(o=""),void 0===i&&(i=""),void 0===a&&(a="&"),t=a,r=o,n=new RegExp("\\".concat(r,"\\b"),"g");var c=e.replace(gt,""),u=X(i||o?"".concat(i," ").concat(o," { ").concat(c," }"):c);s.namespace&&(u=yt(u,s.namespace));var f,p,d,h=[];return V(u,(f=l.concat((d=function(e){return h.push(e)},function(e){e.root||(e=e.return)&&d(e)})),p=k(f),function(e,t,r,n){for(var o="",i=0;i<p;i++)o+=f[i](e,t,r,n)||"";return o})),h};return f.hash=c.length?c.reduce((function(e,t){return t.name||Ke(15),xe(e,t.name)}),5381).toString():"",f}var vt=new dt,bt=mt(),St=i().createContext({shouldForwardProp:void 0,styleSheet:vt,stylis:bt}),wt=(St.Consumer,i().createContext(void 0));function xt(){return(0,r.useContext)(St)}function Ct(e){var t=(0,r.useState)(e.stylisPlugins),n=t[0],o=t[1],s=xt().styleSheet,c=(0,r.useMemo)((function(){var t=s;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target,s]),u=(0,r.useMemo)((function(){return mt({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})}),[e.enableVendorPrefixes,e.namespace,n]);(0,r.useEffect)((function(){a()(n,e.stylisPlugins)||o(e.stylisPlugins)}),[e.stylisPlugins]);var l=(0,r.useMemo)((function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:c,stylis:u}}),[e.shouldForwardProp,c,u]);return i().createElement(St.Provider,{value:l},i().createElement(wt.Provider,{value:u},e.children))}var jt=function(){function e(e,t){var r=this;this.inject=function(e,t){void 0===t&&(t=bt);var n=r.name+t.hash;e.hasNameForId(r.id,n)||e.insertRules(r.id,n,t(r.rules,n,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,He(this,(function(){throw Ke(12,String(r.name))}))}return e.prototype.getName=function(e){return void 0===e&&(e=bt),this.name+e.hash},e}(),kt=function(e){return e>="A"&&e<="Z"};function Et(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(1===r&&"-"===n&&"-"===e[0])return e;kt(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var Ot=function(e){return null==e||!1===e||""===e},At=function(e){var r,n,o=[];for(var i in e){var s=e[i];e.hasOwnProperty(i)&&!Ot(s)&&(Array.isArray(s)&&s.isCss||Me(s)?o.push("".concat(Et(i),":"),s,";"):Ue(s)?o.push.apply(o,t(t(["".concat(i," {")],At(s),!1),["}"],!1)):o.push("".concat(Et(i),": ").concat((r=i,null==(n=s)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||r in oe||r.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return o};function Pt(e,t,r,n){return Ot(e)?[]:Ge(e)?[".".concat(e.styledComponentId)]:Me(e)?!Me(o=e)||o.prototype&&o.prototype.isReactComponent||!t?[e]:Pt(e(t),t,r,n):e instanceof jt?r?(e.inject(r,n),[e.getName(n)]):[e]:Ue(e)?At(e):Array.isArray(e)?Array.prototype.concat.apply(pe,e.map((function(e){return Pt(e,t,r,n)}))):[e.toString()];var o}function It(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(Me(r)&&!Ge(r))return!1}return!0}var Rt=Ce(ce),_t=function(){function e(e,t,r){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===r||r.isStatic)&&It(e),this.componentId=t,this.baseHash=xe(Rt,t),this.baseStyle=r,dt.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,r){var n=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))n=Ye(n,this.staticRulesId);else{var o=We(Pt(this.rules,e,t,r)),i=Se(xe(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,i)){var s=r(o,".".concat(i),void 0,this.componentId);t.insertRules(this.componentId,i,s)}n=Ye(n,i),this.staticRulesId=i}else{for(var a=xe(this.baseHash,r.hash),c="",u=0;u<this.rules.length;u++){var l=this.rules[u];if("string"==typeof l)c+=l;else if(l){var f=We(Pt(l,e,t,r));a=xe(a,f+u),c+=f}}if(c){var p=Se(a>>>0);t.hasNameForId(this.componentId,p)||t.insertRules(this.componentId,p,r(c,".".concat(p),void 0,this.componentId)),n=Ye(n,p)}}return n},e}(),Nt=i().createContext(void 0);function Bt(t){var n=i().useContext(Nt),o=(0,r.useMemo)((function(){return function(t,r){if(!t)throw Ke(14);if(Me(t))return t(r);if(Array.isArray(t)||"object"!=typeof t)throw Ke(8);return r?e(e({},r),t):t}(t.theme,n)}),[t.theme,n]);return t.children?i().createElement(Nt.Provider,{value:o},t.children):null}Nt.Consumer;var $t={};function Tt(t,n,o){var s=Ge(t),a=t,c=!ke(t),u=n.attrs,l=void 0===u?pe:u,f=n.componentId,p=void 0===f?function(e,t){var r="string"!=typeof e?"sc":me(e);$t[r]=($t[r]||0)+1;var n="".concat(r,"-").concat(je(ce+r+$t[r]));return t?"".concat(t,"-").concat(n):n}(n.displayName,n.parentComponentId):f,d=n.displayName,h=void 0===d?function(e){return ke(e)?"styled.".concat(e):"Styled(".concat(function(e){return e.displayName||e.name||"Component"}(e),")")}(t):d,g=n.displayName&&n.componentId?"".concat(me(n.displayName),"-").concat(n.componentId):n.componentId||p,y=s&&a.attrs?a.attrs.concat(l).filter(Boolean):l,m=n.shouldForwardProp;if(s&&a.shouldForwardProp){var v=a.shouldForwardProp;if(n.shouldForwardProp){var b=n.shouldForwardProp;m=function(e,t){return v(e,t)&&b(e,t)}}else m=v}var S=new _t(o,g,s?a.componentStyle:void 0);function w(t,n){return function(t,n,o){var s=t.attrs,a=t.componentStyle,c=t.defaultProps,u=t.foldedComponentIds,l=t.styledComponentId,f=t.target,p=i().useContext(Nt),d=xt(),h=t.shouldForwardProp||d.shouldForwardProp,g=function(e,t,r){return void 0===r&&(r=de),e.theme!==r.theme&&e.theme||t||r.theme}(n,p,c)||de,y=function(t,r,n){for(var o,i=e(e({},r),{className:void 0,theme:n}),s=0;s<t.length;s+=1){var a=Me(o=t[s])?o(i):o;for(var c in a)i[c]="className"===c?Ye(i[c],a[c]):"style"===c?e(e({},i[c]),a[c]):a[c]}return r.className&&(i.className=Ye(i.className,r.className)),i}(s,n,g),m=y.as||f,v={};for(var b in y)void 0===y[b]||"$"===b[0]||"as"===b||"theme"===b&&y.theme===g||("forwardedAs"===b?v.as=y.forwardedAs:h&&!h(b,m)||(v[b]=y[b]));var S=function(e,t){var r=xt();return e.generateAndInjectStyles(t,r.styleSheet,r.stylis)}(a,y),w=Ye(u,l);return S&&(w+=" "+S),y.className&&(w+=" "+y.className),v[ke(m)&&!he.has(m)?"class":"className"]=w,o&&(v.ref=o),(0,r.createElement)(m,v)}(x,t,n)}w.displayName=h;var x=i().forwardRef(w);return x.attrs=y,x.componentStyle=S,x.displayName=h,x.shouldForwardProp=m,x.foldedComponentIds=s?Ye(a.foldedComponentIds,a.styledComponentId):"",x.styledComponentId=g,x.target=s?a.target:t,Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=s?function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0,o=t;n<o.length;n++)qe(e,o[n],!0);return e}({},a.defaultProps,e):e}}),He(x,(function(){return".".concat(x.styledComponentId)})),c&&Le(x,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),x}function Dt(e,t){for(var r=[e[0]],n=0,o=t.length;n<o;n+=1)r.push(t[n],e[n+1]);return r}new Set;var zt=function(e){return Object.assign(e,{isCss:!0})};function Ft(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(Me(e)||Ue(e))return zt(Pt(Dt(pe,t([e],r,!0))));var o=e;return 0===r.length&&1===o.length&&"string"==typeof o[0]?Pt(o):zt(Pt(Dt(o,r)))}function Lt(r,n,o){if(void 0===o&&(o=de),!n)throw Ke(1,n);var i=function(e){for(var i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];return r(n,o,Ft.apply(void 0,t([e],i,!1)))};return i.attrs=function(t){return Lt(r,n,e(e({},o),{attrs:Array.prototype.concat(o.attrs,t).filter(Boolean)}))},i.withConfig=function(t){return Lt(r,n,e(e({},o),t))},i}var Mt=function(e){return Lt(Tt,e)},Gt=Mt;he.forEach((function(e){Gt[e]=Mt(e)})),function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=It(e),dt.registerId(this.componentId+1)}e.prototype.createStyles=function(e,t,r,n){var o=n(We(Pt(this.rules,t,r,n)),""),i=this.componentId+e;r.insertRules(i,i,o)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,r,n){e>2&&dt.registerId(this.componentId+e),this.removeStyles(e,r),this.createStyles(e,t,r,n)}}(),function(){function t(){var t=this;this._emitSheetCSS=function(){var e=t.instance.toString();if(!e)return"";var r=st(),n=We([r&&'nonce="'.concat(r,'"'),"".concat(ie,'="true"'),"".concat(ae,'="').concat(ce,'"')].filter(Boolean)," ");return"<style ".concat(n,">").concat(e,"</style>")},this.getStyleTags=function(){if(t.sealed)throw Ke(2);return t._emitSheetCSS()},this.getStyleElement=function(){var r;if(t.sealed)throw Ke(2);var n=t.instance.toString();if(!n)return[];var o=((r={})[ie]="",r[ae]=ce,r.dangerouslySetInnerHTML={__html:n},r),s=st();return s&&(o.nonce=s),[i().createElement("style",e({},o,{key:"sc-0-0"}))]},this.seal=function(){t.sealed=!0},this.instance=new dt({isServer:!0}),this.sealed=!1}t.prototype.collectStyles=function(e){if(this.sealed)throw Ke(2);return i().createElement(Ct,{sheet:this.instance},e)},t.prototype.interleaveWithNodeStream=function(e){throw Ke(3)}}(),"__sc-".concat(ie,"__");var Yt={primaryTextColor:"rgb(3, 7, 18)",primaryBackgroundColor:"rgb(253, 254, 255)",secondaryBackgroundColor:"rgb(250, 250, 250)",mobileBreakpoint:"600px",primaryBorderColor:"rgb(229, 231, 235)",secondaryBorderColor:"rgb(229, 231, 235)",widgetBackgroundColor:"#FFF",backgroundColor:"rgb(255, 255, 255)",secondaryTextColor:"rgb(115, 115, 115)",blankColor:"rgb(245, 245, 245)",overlayBackgroundColor:"rgba(255, 255, 255, .9)",messageBackgroundColor:"rgba(244, 244, 245, 0.3)",highlightColor:"#000",additionalTextColor:"rgb(156, 163, 175)",buttonActionTextColor:"#FFF",successStatusBorderColor:"rgb(187, 247, 208)",successStatusBackgroundColor:"rgb(240, 253, 244)",successStatusTextColor:"rgb(22, 163, 74)",errorStatusBackgroundColor:"rgb(254, 242, 242)",errorStatusBorderColor:"rgb(254, 202, 202)",errorStatusTextColor:"rgb(153, 27, 27)",buttonDisabledBackgroundColor:"rgb(229, 231, 235)",warningStatusBackgroundColor:"rgb(254, 252, 232)",warningStatusBorderColor:"rgb(254, 240, 138)",warningStatusTextColor:"rgb(180, 83, 9)",infoStatusBorderColor:"rgb(191, 219, 254)",infoStatusBackgroundColor:"rgb(239, 246, 255)",infoStatusTextColor:"rgb(29, 78, 216)",defaultStatusBackgroundColor:"rgb(255, 255, 255)",defaultStatusBorderColor:"rgb(229, 231, 235)",pendingStatusBackgroundColor:"rgb(254, 252, 232)",pendingStatusBorderColor:"rgb(254, 240, 138)",buttonActionBackgroundColor:"#000",buttonActionBackgroundHoverColor:"#000",buttonActionBackgroundActiveColor:"#000",buttonActionBorderHoverColor:"transparent",buttonActionBorderActiveColor:"transparent",buttonActionBorderColor:"transparent"};function Wt(e){if("object"!=typeof e||null===e)return!1;const t=e;if("string"!=typeof t.credential_group_id)return!1;if("object"!=typeof t.semaphore_proof||null===t.semaphore_proof)return!1;const r=t.semaphore_proof;return"number"==typeof r.merkle_tree_depth&&"string"==typeof r.merkle_tree_root&&"string"==typeof r.nullifier&&"string"==typeof r.message&&"string"==typeof r.scope&&Array.isArray(r.points)&&r.points.every((e=>"string"==typeof e))}var Ut,qt=function(e,t,n,o,i){(0,r.useEffect)((()=>{if("undefined"==typeof window)return;const r=new URL(n).origin;async function s(s){const a=s.origin,c=s.data;if(a!==window.location.origin){if(a===r){if(!function(e){return function(e){if("object"!=typeof e||null===e)return!1;const t=e;return"GENERATE_USER_KEY"===t.type&&"object"==typeof t.payload&&null!==t.payload&&"string"==typeof t.payload.message&&t.payload.message.length>0}(e)||function(e){return"object"==typeof e&&null!==e&&"CLOSE_MODAL"===e.type}(e)||function(e){if("object"!=typeof e||null===e)return!1;const t=e;if("PROOFS_RESPONSE"!==t.type)return!1;if(void 0!==t.error&&"string"!=typeof t.error)return!1;if(void 0!==t.payload){if("object"!=typeof t.payload||null===t.payload)return!1;const e=t.payload;if(!Array.isArray(e.proofs))return!1;if(!e.proofs.every(Wt))return!1;if("number"!=typeof e.points||!Number.isFinite(e.points))return!1}return!0}(e)}(c))return void console.error("Invalid inbound message structure from widget");const e=c;if("GENERATE_USER_KEY"===e.type){if(i){var u;const r=e.payload.message,o="BringID key";if(!r.includes(o))return void console.error("Invalid signature request: message must contain `BringID key`");const s=await i(r);return void(null===(u=t.current.contentWindow)||void 0===u||u.postMessage({type:"USER_KEY_READY",payload:{signature:s}},n))}return alert("generateSignature IS NOT AVAILABLE")}return"CLOSE_MODAL"!==e.type&&"PROOFS_RESPONSE"!==e.type||o(!1),void window.postMessage(e,window.location.origin)}}else{var l;if(!t.current)return;if(!function(e){return function(e){if("object"!=typeof e||null===e)return!1;const t=e;if("PROOFS_REQUEST"!==t.type)return!1;if(void 0!==t.payload){if("object"!=typeof t.payload||null===t.payload)return!1;const e=t.payload;if(void 0!==e.minPoints&&"number"!=typeof e.minPoints)return!1}return!0}(e)||function(e){if("object"!=typeof e||null===e)return!1;const t=e;return"USER_KEY_READY"===t.type&&"object"==typeof t.payload&&null!==t.payload&&"string"==typeof t.payload.signature}(e)}(c))return;if("PROOFS_REQUEST"===c.type){if(!e)return alert("Modal window is not ready yet");o(!0)}null===(l=t.current.contentWindow)||void 0===l||l.postMessage(c,r)}}return window.addEventListener("message",s),()=>window.removeEventListener("message",s)}),[i,e,n,o,t])};const Ht=Gt.div(Ut||(Kt=["\n border-radius: 8px;\n width: 32px;\n height: 32px;\n background-color: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n"],Vt||(Vt=Kt.slice(0)),Ut=Object.freeze(Object.defineProperties(Kt,{raw:{value:Object.freeze(Vt)}}))),(e=>e.theme.secondaryBackgroundColor));var Kt,Vt,Qt,Zt,Jt,Xt,er,tr=n(74),rr=e=>{let{className:t}=e;return(0,tr.jsx)("svg",{className:t,width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,tr.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.144225 0.144225C0.336519 -0.048075 0.648289 -0.048075 0.840589 0.144225L5.00002 4.30363L9.15945 0.144225C9.35175 -0.048075 9.66348 -0.048075 9.85577 0.144225C10.0481 0.336519 10.0481 0.648289 9.85577 0.840589L5.69641 5.00002L9.85577 9.15945C10.0481 9.35175 10.0481 9.66348 9.85577 9.85577C9.66348 10.0481 9.35175 10.0481 9.15945 9.85577L5.00002 5.69641L0.840589 9.85577C0.648289 10.0481 0.336519 10.0481 0.144225 9.85577C-0.048075 9.66348 -0.048075 9.35175 0.144225 9.15945L4.30363 5.00002L0.144225 0.840589C-0.048075 0.648289 -0.048075 0.336519 0.144225 0.144225Z",fill:"#686869"})})};function nr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const or=Gt.div(Qt||(Qt=nr(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.3);\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n align-items: center;\n justify-content: center;\n backdrop-filter: blur(2px);\n box-sizing: border-box;\n"]))),ir=Gt.div(Zt||(Zt=nr(["\n max-width: 680px;\n position: relative;\n width: 100%;\n background: ",";\n border-radius: 20px;\n padding: 16px;\n\n @media (max-width: ",") {\n padding: 40px 25px;\n }\n"])),(e=>e.theme&&e.theme.widgetBackgroundColor),(e=>e.theme.mobileBreakpoint));Gt.h3(Jt||(Jt=nr(["\n margin: 0 0 20px;\n font-size: 32px;\n font-weight: 700;\n text-align: center;\n color: ",";\n"])),(e=>e.theme.primaryTextColor)),Gt.div(Xt||(Xt=nr(["\n margin: 0 auto 20px;\n display: flex;\n justify-content: center;\n"]))),Gt((e=>{let{className:t,onClick:r}=e;return(0,tr.jsx)(Ht,{className:t,onClick:r,children:(0,tr.jsx)(rr,{})})}))(er||(er=nr(["\n position: absolute;\n right: 20px;\n top: 20px;\n"])));var sr,ar,cr;function ur(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const lr=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=We(Ft.apply(void 0,t([e],r,!1))),i=je(o);return new jt(i,o)}(sr||(sr=ur(["\n 0% {\n transform: rotate(0deg)\n }\n 100% {\n transform: rotate(360deg)\n }\n"]))),fr=Gt.span(ar||(ar=ur(["\n width: 16px;\n height: 16px;\n\n ","\n border-radius: 50%;\n display: inline-block;\n border-top: 2px solid ",";\n border-right: 2px solid transparent;\n box-sizing: border-box;\n animation: "," 1s linear infinite;\n"])),(e=>"large"===e.size&&Ft(cr||(cr=ur(["\n width: 32px;\n height: 32px;\n "])))),(e=>e.theme.highlightColor),lr);var pr,dr,hr,gr,yr=e=>{let{className:t,size:r}=e;return(0,tr.jsx)(fr,{className:t,size:r})};function mr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const vr="DialogClassName",br=Gt((e=>{let{children:t,className:r,dialogClassName:n}=e;return(0,tr.jsx)(or,{className:r,children:(0,tr.jsx)(ir,{className:n,children:t})})}))(pr||(pr=mr(["\n ","\n\n ."," {\n max-width: 400px;\n width: 90%;\n padding: 0px;\n position: relative;\n overflow: hidden;\n }\n"])),(e=>!e.visible&&Ft(dr||(dr=mr(["\n opacity: 0;\n pointer-events: none;\n "])))),vr),Sr=Gt.iframe(hr||(hr=mr(["\n width: 100%;\n height: 550px;\n border: none;\n overflow: auto;\n"]))),wr=Gt.div(gr||(gr=mr(["\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n top: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n"])));var xr=["https://widget.bringid.org","https://staging.widget.bringid.org","https://dev.widget.bringid.org"],Cr=e=>{let{address:t,generateSignature:n,iframeOnLoad:o,highlightColor:i,theme:s="light",connectUrl:a="https://widget.bringid.org"}=e;if(!xr.includes(a))return console.error('BringID: Invalid connectUrl "'.concat(a,'". Must be one of: ').concat(xr.join(", "))),null;const c=(0,r.useRef)(null),[u,l]=(0,r.useState)(!1),[f,p]=(0,r.useState)(!1);if(qt(f,c,a,l,n),"undefined"==typeof window)return null;const d=(h={url:encodeURIComponent(window.location.href),address:t,theme:s,highlightColor:i?encodeURIComponent(i):void 0},Object.entries(h).reduce(((e,t)=>{let[r,n]=t;return n?""===e?"".concat(r,"=").concat(n):"".concat(e,"&").concat(r,"=").concat(n):e}),""));var h;console.log({queryParams:d});const g="undefined"==typeof window?"":"".concat(a,"?").concat(d);return(0,tr.jsx)(Bt,{theme:Yt,children:(0,tr.jsxs)(br,{visible:u,onClose:()=>l(!1),dialogClassName:vr,children:[!f&&(0,tr.jsx)(wr,{children:(0,tr.jsx)(yr,{size:"large"})}),(0,tr.jsx)(Sr,{sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals",ref:c,src:g,onLoad:()=>{o&&o(),p(!0)}})]})})}}(),o}()}));
@@ -7,11 +7,9 @@ export type TGenerateUserKeyMessage = {
7
7
  };
8
8
  export type TCloseModalMessage = {
9
9
  type: 'CLOSE_MODAL';
10
- requestId?: string;
11
10
  };
12
11
  export type TProofsResponseMessage = {
13
12
  type: 'PROOFS_RESPONSE';
14
- requestId: string;
15
13
  payload?: {
16
14
  proofs: TSemaphoreProof[];
17
15
  points: number;
@@ -1 +1 @@
1
- {"version":3,"file":"inbound-message.d.ts","sourceRoot":"","sources":["../../src/types/inbound-message.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,mBAAmB,CAAA;IACzB,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACD,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,aAAa,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,iBAAiB,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,eAAe,EAAE,CAAA;QACzB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,uBAAuB,GAAG,kBAAkB,GAAG,sBAAsB,CAAA"}
1
+ {"version":3,"file":"inbound-message.d.ts","sourceRoot":"","sources":["../../src/types/inbound-message.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,mBAAmB,CAAA;IACzB,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACD,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,iBAAiB,CAAA;IACvB,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,eAAe,EAAE,CAAA;QACzB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,uBAAuB,GAAG,kBAAkB,GAAG,sBAAsB,CAAA"}
@@ -1,8 +1,9 @@
1
1
  export type TProofsRequestMessage = {
2
2
  type: 'PROOFS_REQUEST';
3
- requestId: string;
4
3
  payload: {
5
4
  minPoints?: number;
5
+ mode?: string;
6
+ appId?: string;
6
7
  };
7
8
  };
8
9
  export type TUserKeyReadyMessage = {
@@ -1 +1 @@
1
- {"version":3,"file":"outbound-message.d.ts","sourceRoot":"","sources":["../../src/types/outbound-message.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,gBAAgB,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,oBAAoB,CAAA"}
1
+ {"version":3,"file":"outbound-message.d.ts","sourceRoot":"","sources":["../../src/types/outbound-message.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,oBAAoB,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import TRequestType from "./request-type";
2
2
  type TRequest = {
3
3
  type: TRequestType;
4
- requestId: string;
5
4
  payload: any;
6
5
  };
7
6
  export default TRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/types/request.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,GAAG,CAAA;CACb,CAAA;AAED,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/types/request.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,GAAG,CAAA;CACb,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -2,7 +2,6 @@ import TRequestType from "./request-type";
2
2
  import TErrorType from "./error-type";
3
3
  type TRequest = {
4
4
  type: TRequestType;
5
- requestId: string;
6
5
  error?: TErrorType;
7
6
  payload?: any;
8
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/types/response.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;CACd,CAAA;AAED,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/types/response.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;CACd,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-inbound-message.d.ts","sourceRoot":"","sources":["../../src/utils/validate-inbound-message.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,SAAS,CAAA;AAgEhB,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CAMpF"}
1
+ {"version":3,"file":"validate-inbound-message.d.ts","sourceRoot":"","sources":["../../src/utils/validate-inbound-message.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,SAAS,CAAA;AA4DhB,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CAMpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-outbound-message.d.ts","sourceRoot":"","sources":["../../src/utils/validate-outbound-message.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AA8BhB,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAKtF"}
1
+ {"version":3,"file":"validate-outbound-message.d.ts","sourceRoot":"","sources":["../../src/utils/validate-outbound-message.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AA6BhB,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAKtF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bringid",
3
- "version": "0.4.0-beta-rc.0",
3
+ "version": "0.4.0-beta-rc.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [