@zama-fhe/relayer-sdk 0.4.0-alpha.1 → 0.4.0-alpha.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/bin/commands/config.js +13 -0
- package/bin/commands/handle.js +22 -0
- package/bin/commands/input-proof.js +75 -0
- package/bin/commands/pubkey-clear.js +18 -0
- package/bin/commands/pubkey-fetch.js +9 -0
- package/bin/commands/pubkey-info.js +44 -0
- package/bin/commands/public-decrypt.js +64 -0
- package/bin/commands/test-fhecounter-getcount.js +49 -0
- package/bin/commands/zkproof-generate.js +68 -0
- package/bin/instance.js +15 -0
- package/bin/pubkeyCache.js +126 -0
- package/bin/relayer.js +132 -59
- package/bin/utils.js +345 -8
- package/bundle/relayer-sdk-js.js +5902 -5206
- package/bundle/relayer-sdk-js.umd.cjs +5 -5
- package/lib/internal.js +6138 -0
- package/lib/node.cjs +1061 -215
- package/lib/node.d.ts +8 -1
- package/lib/node.js +1061 -215
- package/lib/web.d.ts +8 -1
- package/lib/web.js +1060 -214
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(Rt,yt){typeof exports=="object"&&typeof module<"u"?yt(exports):typeof define=="function"&&define.amd?define(["exports"],yt):(Rt=typeof globalThis<"u"?globalThis:Rt||self,yt(Rt.relayerSDK={}))})(this,function(Rt){"use strict";var k0=Object.defineProperty;var I0=(Rt,yt,Wr)=>yt in Rt?k0(Rt,yt,{enumerable:!0,configurable:!0,writable:!0,value:Wr}):Rt[yt]=Wr;var Oi=(Rt,yt,Wr)=>I0(Rt,typeof yt!="symbol"?yt+"":yt,Wr);var yt=typeof document<"u"?document.currentScript:null;const Wr=globalThis||void 0||self,Zh="6.15.0";function Yh(n,t,e){const r=t.split("|").map(o=>o.trim());for(let o=0;o<r.length;o++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===t)return}const i=new Error(`invalid value for type ${t}`);throw i.code="INVALID_ARGUMENT",i.argument=`value.${e}`,i.value=n,i}async function Tt(n){const t=Object.keys(n);return(await Promise.all(t.map(r=>Promise.resolve(n[r])))).reduce((r,i,o)=>(r[t[o]]=i,r),{})}function H(n,t,e){for(let r in t){let i=t[r];const o=e?e[r]:null;o&&Yh(i,o,r),Object.defineProperty(n,r,{enumerable:!0,value:i,writable:!1})}}function ni(n,t){if(n==null)return"null";if(t==null&&(t=new Set),typeof n=="object"){if(t.has(n))return"[Circular]";t.add(n)}if(Array.isArray(n))return"[ "+n.map(e=>ni(e,t)).join(", ")+" ]";if(n instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let i=0;i<n.length;i++)r+=e[n[i]>>4],r+=e[n[i]&15];return r}if(typeof n=="object"&&typeof n.toJSON=="function")return ni(n.toJSON(),t);switch(typeof n){case"boolean":case"number":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{ "+e.map(r=>`${ni(r,t)}: ${ni(n[r],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function kt(n,t){return n&&n.code===t}function po(n){return kt(n,"CALL_EXCEPTION")}function lt(n,t,e){let r=n;{const o=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${ni(e)}`);for(const c in e){if(c==="shortMessage")continue;const _=e[c];o.push(c+"="+ni(_))}}o.push(`code=${t}`),o.push(`version=${Zh}`),o.length&&(n+=" ("+o.join(", ")+")")}let i;switch(t){case"INVALID_ARGUMENT":i=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(n);break;default:i=new Error(n)}return H(i,{code:t}),e&&Object.assign(i,e),i.shortMessage==null&&H(i,{shortMessage:r}),i}function v(n,t,e,r){if(!n)throw lt(t,e,r)}function g(n,t,e,r){v(n,t,"INVALID_ARGUMENT",{argument:e,value:r})}function Ka(n,t,e){e==null&&(e=""),e&&(e=": "+e),v(n>=t,"missing argument"+e,"MISSING_ARGUMENT",{count:n,expectedCount:t}),v(n<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:t})}["NFD","NFC","NFKD","NFKC"].reduce((n,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(t)}catch{}return n},[]);function bs(n,t,e){if(e==null&&(e=""),n!==t){let r=e,i="new";e&&(r+=".",i+=" "+e),v(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function Qa(n,t,e){if(n instanceof Uint8Array)return e?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((n.length-2)/2);let i=2;for(let o=0;o<r.length;o++)r[o]=parseInt(n.substring(i,i+2),16),i+=2;return r}g(!1,"invalid BytesLike value",t||"value",n)}function V(n,t){return Qa(n,t,!1)}function Bt(n,t){return Qa(n,t,!0)}function st(n,t){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&n.length!==2+2*t||t===!0&&n.length%2!==0)}function wo(n){return st(n,!0)||n instanceof Uint8Array}const Ja="0123456789abcdef";function O(n){const t=V(n);let e="0x";for(let r=0;r<t.length;r++){const i=t[r];e+=Ja[(i&240)>>4]+Ja[i&15]}return e}function ct(n){return"0x"+n.map(t=>O(t).substring(2)).join("")}function vn(n){return st(n,!0)?(n.length-2)/2:V(n).length}function pt(n,t,e){const r=V(n);return e!=null&&e>r.length&&v(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:e}),O(r.slice(t??0,e??r.length))}function $a(n,t,e){const r=V(n);v(t>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:t,offset:t+1});const i=new Uint8Array(t);return i.fill(0),e?i.set(r,t-r.length):i.set(r,0),O(i)}function Wt(n,t){return $a(n,t,!0)}function Wa(n,t){return $a(n,t,!1)}const ms=BigInt(0),ne=BigInt(1),ii=9007199254740991;function Xh(n,t){const e=As(n,"value"),r=BigInt(Z(t,"width"));if(v(e>>r===ms,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),e>>r-ne){const i=(ne<<r)-ne;return-((~e&i)+ne)}return e}function go(n,t){let e=L(n,"value");const r=BigInt(Z(t,"width")),i=ne<<r-ne;if(e<ms){e=-e,v(e<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const o=(ne<<r)-ne;return(~e&o)+ne}else v(e<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return e}function Ni(n,t){const e=As(n,"value"),r=BigInt(Z(t,"bits"));return e&(ne<<r)-ne}function L(n,t){switch(typeof n){case"bigint":return n;case"number":return g(Number.isInteger(n),"underflow",t||"value",n),g(n>=-ii&&n<=ii,"overflow",t||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(e){g(!1,`invalid BigNumberish string: ${e.message}`,t||"value",n)}}g(!1,"invalid BigNumberish value",t||"value",n)}function As(n,t){const e=L(n,t);return v(e>=ms,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),e}const qa="0123456789abcdef";function yo(n){if(n instanceof Uint8Array){let t="0x0";for(const e of n)t+=qa[e>>4],t+=qa[e&15];return BigInt(t)}return L(n)}function Z(n,t){switch(typeof n){case"bigint":return g(n>=-ii&&n<=ii,"overflow",t||"value",n),Number(n);case"number":return g(Number.isInteger(n),"underflow",t||"value",n),g(n>=-ii&&n<=ii,"overflow",t||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return Z(BigInt(n),t)}catch(e){g(!1,`invalid numeric string: ${e.message}`,t||"value",n)}}g(!1,"invalid numeric value",t||"value",n)}function tp(n){return Z(yo(n))}function cn(n,t){let r=As(n,"value").toString(16);if(t==null)r.length%2&&(r="0"+r);else{const i=Z(t,"width");for(v(i*2>=r.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<i*2;)r="0"+r}return"0x"+r}function At(n){const t=As(n,"value");if(t===ms)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);const r=new Uint8Array(e.length/2);for(let i=0;i<r.length;i++){const o=i*2;r[i]=parseInt(e.substring(o,o+2),16)}return r}function ie(n){let t=O(wo(n)?n:At(n)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return t===""&&(t="0"),"0x"+t}const Za="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const Ya=BigInt(58);function ep(n){const t=V(n);let e=yo(t),r="";for(;e;)r=Za[Number(e%Ya)]+r,e/=Ya;for(let i=0;i<t.length&&!t[i];i++)r=Za[0]+r;return r}function rp(n){n=atob(n);const t=new Uint8Array(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return V(t)}function np(n){const t=V(n);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}class Xa{filter;emitter;#t;constructor(t,e,r){this.#t=e,H(this,{emitter:t,filter:r})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}}function ip(n,t,e,r,i){g(!1,`invalid codepoint at offset ${t}; ${n}`,"bytes",e)}function tc(n,t,e,r,i){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let o=0;for(let c=t+1;c<e.length&&e[c]>>6===2;c++)o++;return o}return n==="OVERRUN"?e.length-t-1:0}function sp(n,t,e,r,i){return n==="OVERLONG"?(g(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),r.push(i),0):(r.push(65533),tc(n,t,e))}const op=Object.freeze({error:ip,ignore:tc,replace:sp});function ap(n,t){t==null&&(t=op.error);const e=V(n,"bytes"),r=[];let i=0;for(;i<e.length;){const o=e[i++];if(o>>7===0){r.push(o);continue}let c=null,_=null;if((o&224)===192)c=1,_=127;else if((o&240)===224)c=2,_=2047;else if((o&248)===240)c=3,_=65535;else{(o&192)===128?i+=t("UNEXPECTED_CONTINUE",i-1,e,r):i+=t("BAD_PREFIX",i-1,e,r);continue}if(i-1+c>=e.length){i+=t("OVERRUN",i-1,e,r);continue}let l=o&(1<<8-c-1)-1;for(let u=0;u<c;u++){let p=e[i];if((p&192)!=128){i+=t("MISSING_CONTINUE",i,e,r),l=null;break}l=l<<6|p&63,i++}if(l!==null){if(l>1114111){i+=t("OUT_OF_RANGE",i-1-c,e,r,l);continue}if(l>=55296&&l<=57343){i+=t("UTF16_SURROGATE",i-1-c,e,r,l);continue}if(l<=_){i+=t("OVERLONG",i-1-c,e,r,l);continue}r.push(l)}}return r}function Lr(n,t){g(typeof n=="string","invalid string value","str",n);let e=[];for(let r=0;r<n.length;r++){const i=n.charCodeAt(r);if(i<128)e.push(i);else if(i<2048)e.push(i>>6|192),e.push(i&63|128);else if((i&64512)==55296){r++;const o=n.charCodeAt(r);g(r<n.length&&(o&64512)===56320,"invalid surrogate pair","str",n);const c=65536+((i&1023)<<10)+(o&1023);e.push(c>>18|240),e.push(c>>12&63|128),e.push(c>>6&63|128),e.push(c&63|128)}else e.push(i>>12|224),e.push(i>>6&63|128),e.push(i&63|128)}return new Uint8Array(e)}function cp(n){return n.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function Es(n,t){return cp(ap(n,t))}function ec(n){async function t(e,r){v(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const i=e.url.split(":")[0].toLowerCase();v(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),v(i==="https"||!e.credentials||e.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let o=null;const c=new AbortController,_=setTimeout(()=>{o=lt("request timeout","TIMEOUT"),c.abort()},e.timeout);r&&r.addListener(()=>{o=lt("request cancelled","CANCELLED"),c.abort()});const l=Object.assign({},n,{method:e.method,headers:new Headers(Array.from(e)),body:e.body||void 0,signal:c.signal});let u;try{u=await fetch(e.url,l)}catch(b){throw clearTimeout(_),o||b}clearTimeout(_);const p={};u.headers.forEach((b,x)=>{p[x.toLowerCase()]=b});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:p,body:d}}return t}const _p=12,lp=250;let rc=ec();const up=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),fp=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let bo=!1;async function nc(n,t){try{const e=n.match(up);if(!e)throw new Error("invalid data");return new _n(200,"OK",{"content-type":e[1]||"text/plain"},e[2]?rp(e[3]):pp(e[3]))}catch{return new _n(599,"BAD REQUEST (invalid data: URI)",{},null,new Mr(n))}}function ic(n){async function t(e,r){try{const i=e.match(fp);if(!i)throw new Error("invalid link");return new Mr(`${n}${i[2]}`)}catch{return new _n(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Mr(e))}}return t}const xs={data:nc,ipfs:ic("https://gateway.ipfs.io/ipfs/")},sc=new WeakMap;class hp{#t;#e;constructor(t){this.#t=[],this.#e=!1,sc.set(t,()=>{if(!this.#e){this.#e=!0;for(const e of this.#t)setTimeout(()=>{e()},0);this.#t=[]}})}addListener(t){v(!this.#e,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#t.push(t)}get cancelled(){return this.#e}checkSignal(){v(!this.cancelled,"cancelled","CANCELLED",{})}}function Rs(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}class Mr{#t;#e;#r;#n;#i;#o;#s;#a;#h;#_;#p;#d;#c;#l;#u;get url(){return this.#o}set url(t){this.#o=String(t)}get body(){return this.#s==null?null:new Uint8Array(this.#s)}set body(t){if(t==null)this.#s=void 0,this.#a=void 0;else if(typeof t=="string")this.#s=Lr(t),this.#a="text/plain";else if(t instanceof Uint8Array)this.#s=t,this.#a="application/octet-stream";else if(typeof t=="object")this.#s=Lr(JSON.stringify(t)),this.#a="application/json";else throw new Error("invalid body")}hasBody(){return this.#s!=null}get method(){return this.#n?this.#n:this.hasBody()?"POST":"GET"}set method(t){t==null&&(t=""),this.#n=String(t).toUpperCase()}get headers(){const t=Object.assign({},this.#r);return this.#h&&(t.authorization=`Basic ${np(Lr(this.#h))}`),this.allowGzip&&(t["accept-encoding"]="gzip"),t["content-type"]==null&&this.#a&&(t["content-type"]=this.#a),this.body&&(t["content-length"]=String(this.body.length)),t}getHeader(t){return this.headers[t.toLowerCase()]}setHeader(t,e){this.#r[String(t).toLowerCase()]=String(e)}clearHeaders(){this.#r={}}[Symbol.iterator](){const t=this.headers,e=Object.keys(t);let r=0;return{next:()=>{if(r<e.length){const i=e[r++];return{value:[i,t[i]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#h||null}setCredentials(t,e){g(!t.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#h=`${t}:${e}`}get allowGzip(){return this.#e}set allowGzip(t){this.#e=!!t}get allowInsecureAuthentication(){return!!this.#t}set allowInsecureAuthentication(t){this.#t=!!t}get timeout(){return this.#i}set timeout(t){g(t>=0,"timeout must be non-zero","timeout",t),this.#i=t}get preflightFunc(){return this.#_||null}set preflightFunc(t){this.#_=t}get processFunc(){return this.#p||null}set processFunc(t){this.#p=t}get retryFunc(){return this.#d||null}set retryFunc(t){this.#d=t}get getUrlFunc(){return this.#u||rc}set getUrlFunc(t){this.#u=t}constructor(t){this.#o=String(t),this.#t=!1,this.#e=!0,this.#r={},this.#n="",this.#i=3e5,this.#l={slotInterval:lp,maxAttempts:_p},this.#u=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#s?O(this.#s):"null"}>`}setThrottleParams(t){t.slotInterval!=null&&(this.#l.slotInterval=t.slotInterval),t.maxAttempts!=null&&(this.#l.maxAttempts=t.maxAttempts)}async#f(t,e,r,i,o){if(t>=this.#l.maxAttempts)return o.makeServerError("exceeded maximum retry limit");v(oc()<=e,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),r>0&&await dp(r);let c=this.clone();const _=(c.url.split(":")[0]||"").toLowerCase();if(_ in xs){const p=await xs[_](c.url,Rs(i.#c));if(p instanceof _n){let f=p;if(this.processFunc){Rs(i.#c);try{f=await this.processFunc(c,f)}catch(d){(d.throttle==null||typeof d.stall!="number")&&f.makeServerError("error in post-processing function",d).assertOk()}}return f}c=p}this.preflightFunc&&(c=await this.preflightFunc(c));const l=await this.getUrlFunc(c,Rs(i.#c));let u=new _n(l.statusCode,l.statusMessage,l.headers,l.body,i);if(u.statusCode===301||u.statusCode===302){try{const p=u.headers.location||"";return c.redirect(p).#f(t+1,e,0,i,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(c,u,t))){const p=u.headers["retry-after"];let f=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,t));return typeof p=="string"&&p.match(/^[1-9][0-9]*$/)&&(f=parseInt(p)),c.clone().#f(t+1,e,f,i,u)}if(this.processFunc){Rs(i.#c);try{u=await this.processFunc(c,u)}catch(p){(p.throttle==null||typeof p.stall!="number")&&u.makeServerError("error in post-processing function",p).assertOk();let f=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,t));return p.stall>=0&&(f=p.stall),c.clone().#f(t+1,e,f,i,u)}}return u}send(){return v(this.#c==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#c=new hp(this),this.#f(0,oc()+this.timeout,0,this,new _n(0,"",{},null,this))}cancel(){v(this.#c!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const t=sc.get(this);if(!t)throw new Error("missing signal; should not happen");t()}redirect(t){const e=this.url.split(":")[0].toLowerCase(),r=t.split(":")[0].toLowerCase();v(this.method==="GET"&&(e!=="https"||r!=="http")&&t.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(t)})`});const i=new Mr(t);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,i.#r=Object.assign({},this.#r),this.#s&&(i.#s=new Uint8Array(this.#s)),i.#a=this.#a,i}clone(){const t=new Mr(this.url);return t.#n=this.#n,this.#s&&(t.#s=this.#s),t.#a=this.#a,t.#r=Object.assign({},this.#r),t.#h=this.#h,this.allowGzip&&(t.allowGzip=!0),t.timeout=this.timeout,this.allowInsecureAuthentication&&(t.allowInsecureAuthentication=!0),t.#_=this.#_,t.#p=this.#p,t.#d=this.#d,t.#l=Object.assign({},this.#l),t.#u=this.#u,t}static lockConfig(){bo=!0}static getGateway(t){return xs[t.toLowerCase()]||null}static registerGateway(t,e){if(t=t.toLowerCase(),t==="http"||t==="https")throw new Error(`cannot intercept ${t}; use registerGetUrl`);if(bo)throw new Error("gateways locked");xs[t]=e}static registerGetUrl(t){if(bo)throw new Error("gateways locked");rc=t}static createGetUrlFunc(t){return ec(t)}static createDataGateway(){return nc}static createIpfsGatewayFunc(t){return ic(t)}}class _n{#t;#e;#r;#n;#i;#o;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#n?O(this.#n):"null"}>`}get statusCode(){return this.#t}get statusMessage(){return this.#e}get headers(){return Object.assign({},this.#r)}get body(){return this.#n==null?null:new Uint8Array(this.#n)}get bodyText(){try{return this.#n==null?"":Es(this.#n)}catch{v(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{v(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const t=this.headers,e=Object.keys(t);let r=0;return{next:()=>{if(r<e.length){const i=e[r++];return{value:[i,t[i]],done:!1}}return{value:void 0,done:!0}}}}constructor(t,e,r,i,o){this.#t=t,this.#e=e,this.#r=Object.keys(r).reduce((c,_)=>(c[_.toLowerCase()]=String(r[_]),c),{}),this.#n=i==null?null:new Uint8Array(i),this.#i=o||null,this.#o={message:""}}makeServerError(t,e){let r;t?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${t})`:(t=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${t})`);const i=new _n(599,r,this.headers,this.body,this.#i||void 0);return i.#o={message:t,error:e},i}throwThrottleError(t,e){e==null?e=-1:g(Number.isInteger(e)&&e>=0,"invalid stall timeout","stall",e);const r=new Error(t||"throttling requests");throw H(r,{stall:e,throttle:!0}),r}getHeader(t){return this.headers[t.toLowerCase()]}hasBody(){return this.#n!=null}get request(){return this.#i}ok(){return this.#o.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:t,error:e}=this.#o;t===""&&(t=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let i=null;try{this.#n&&(i=Es(this.#n))}catch{}v(!1,t,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:e,info:{requestUrl:r,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function oc(){return new Date().getTime()}function pp(n){return Lr(n.replace(/%([0-9a-f][0-9a-f])/gi,(t,e)=>String.fromCharCode(parseInt(e,16))))}function dp(n){return new Promise(t=>setTimeout(t,n))}function wp(n){let t=n.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function ac(n,t,e){let r=0;for(let i=0;i<e;i++)r=r*256+n[t+i];return r}function cc(n,t,e,r){const i=[];for(;e<t+1+r;){const o=_c(n,e);i.push(o.result),e+=o.consumed,v(e<=t+1+r,"child data too short","BUFFER_OVERRUN",{buffer:n,length:r,offset:t})}return{consumed:1+r,result:i}}function _c(n,t){v(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const e=r=>{v(r<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r})};if(n[t]>=248){const r=n[t]-247;e(t+1+r);const i=ac(n,t+1,r);return e(t+1+r+i),cc(n,t,t+1+r,r+i)}else if(n[t]>=192){const r=n[t]-192;return e(t+1+r),cc(n,t,t+1,r)}else if(n[t]>=184){const r=n[t]-183;e(t+1+r);const i=ac(n,t+1,r);e(t+1+r+i);const o=O(n.slice(t+1+r,t+1+r+i));return{consumed:1+r+i,result:o}}else if(n[t]>=128){const r=n[t]-128;e(t+1+r);const i=O(n.slice(t+1,t+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:wp(n[t])}}function Fi(n){const t=V(n,"data"),e=_c(t,0);return g(e.consumed===t.length,"unexpected junk after rlp payload","data",n),e.result}function lc(n){const t=[];for(;n;)t.unshift(n&255),n>>=8;return t}function uc(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(o){r=r.concat(uc(o))}),r.length<=55)return r.unshift(192+r.length),r;const i=lc(r.length);return i.unshift(247+i.length),i.concat(r)}const t=Array.prototype.slice.call(V(n,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const e=lc(t.length);return e.unshift(183+e.length),e.concat(t)}const fc="0123456789abcdef";function ln(n){let t="0x";for(const e of uc(n))t+=fc[e>>4],t+=fc[e&15];return t}const Ct=32,mo=new Uint8Array(Ct),gp=["then"],zs={},hc=new WeakMap;function kn(n){return hc.get(n)}function pc(n,t){hc.set(n,t)}function Di(n,t){const e=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw e.error=t,e}function Ao(n,t,e){return n.indexOf(null)>=0?t.map((r,i)=>r instanceof qr?Ao(kn(r),r,e):r):n.reduce((r,i,o)=>{let c=t.getValue(i);return i in r||(e&&c instanceof qr&&(c=Ao(kn(c),c,e)),r[i]=c),r},{})}class qr extends Array{#t;constructor(...t){const e=t[0];let r=t[1],i=(t[2]||[]).slice(),o=!0;e!==zs&&(r=t,i=[],o=!1),super(r.length),r.forEach((l,u)=>{this[u]=l});const c=i.reduce((l,u)=>(typeof u=="string"&&l.set(u,(l.get(u)||0)+1),l),new Map);if(pc(this,Object.freeze(r.map((l,u)=>{const p=i[u];return p!=null&&c.get(p)===1?p:null}))),this.#t=[],this.#t==null&&this.#t,!o)return;Object.freeze(this);const _=new Proxy(this,{get:(l,u,p)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const d=Z(u,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const b=l[d];return b instanceof Error&&Di(`index ${d}`,b),b}if(gp.indexOf(u)>=0)return Reflect.get(l,u,p);const f=l[u];if(f instanceof Function)return function(...d){return f.apply(this===p?l:this,d)};if(!(u in l))return l.getValue.apply(this===p?l:this,[u])}return Reflect.get(l,u,p)}});return pc(_,kn(this)),_}toArray(t){const e=[];return this.forEach((r,i)=>{r instanceof Error&&Di(`index ${i}`,r),t&&r instanceof qr&&(r=r.toArray(t)),e.push(r)}),e}toObject(t){const e=kn(this);return e.reduce((r,i,o)=>(v(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Ao(e,this,t)),{})}slice(t,e){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),e==null&&(e=this.length),e<0&&(e+=this.length,e<0&&(e=0)),e>this.length&&(e=this.length);const r=kn(this),i=[],o=[];for(let c=t;c<e;c++)i.push(this[c]),o.push(r[c]);return new qr(zs,i,o)}filter(t,e){const r=kn(this),i=[],o=[];for(let c=0;c<this.length;c++){const _=this[c];_ instanceof Error&&Di(`index ${c}`,_),t.call(e,_,c,this)&&(i.push(_),o.push(r[c]))}return new qr(zs,i,o)}map(t,e){const r=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&Di(`index ${i}`,o),r.push(t.call(e,o,i,this))}return r}getValue(t){const e=kn(this).indexOf(t);if(e===-1)return;const r=this[e];return r instanceof Error&&Di(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,e){return new qr(zs,t,e)}}function dc(n){let t=At(n);return v(t.length<=Ct,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:Ct,offset:t.length}),t.length!==Ct&&(t=Bt(ct([mo.slice(t.length%Ct),t]))),t}class Zr{name;type;localName;dynamic;constructor(t,e,r,i){H(this,{name:t,type:e,localName:r,dynamic:i},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){g(!1,t,this.localName,e)}}class Eo{#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return ct(this.#t)}get length(){return this.#e}#r(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#r(Bt(t.data))}writeBytes(t){let e=Bt(t);const r=e.length%Ct;return r&&(e=Bt(ct([e,mo.slice(r)]))),this.#r(e)}writeValue(t){return this.#r(dc(t))}writeUpdatableValue(){const t=this.#t.length;return this.#t.push(mo),this.#e+=Ct,e=>{this.#t[t]=dc(e)}}}class xo{allowLoose;#t;#e;#r;#n;#i;constructor(t,e,r){H(this,{allowLoose:!!e}),this.#t=Bt(t),this.#r=0,this.#n=null,this.#i=r??1024,this.#e=0}get data(){return O(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#o(t){if(this.#n)return this.#n.#o(t);this.#r+=t,v(this.#i<1||this.#r<=this.#i*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#i} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Bt(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#s(t,e,r){let i=Math.ceil(e/Ct)*Ct;return this.#e+i>this.#t.length&&(this.allowLoose&&r&&this.#e+e<=this.#t.length?i=e:v(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Bt(this.#t),length:this.#t.length,offset:this.#e+i})),this.#t.slice(this.#e,this.#e+i)}subReader(t){const e=new xo(this.#t.slice(this.#e+t),this.allowLoose,this.#i);return e.#n=this,e}readBytes(t,e){let r=this.#s(0,t,!!e);return this.#o(t),this.#e+=r.length,r.slice(0,t)}readValue(){return yo(this.readBytes(Ct))}readIndex(){return tp(this.readBytes(Ct))}}function Ps(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function Ro(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function yp(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ps(n.outputLen),Ps(n.blockLen)}function si(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function wc(n,t){Ro(n);const e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}const zo=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gc=n=>n instanceof Uint8Array,bp=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),Po=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),jr=(n,t)=>n<<32-t|n>>>t;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function mp(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function vs(n){if(typeof n=="string"&&(n=mp(n)),!gc(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Ap(...n){const t=new Uint8Array(n.reduce((r,i)=>r+i.length,0));let e=0;return n.forEach(r=>{if(!gc(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}class vo{clone(){return this._cloneInto()}}function ko(n){const t=r=>n().update(vs(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Ep(n=32){if(zo&&typeof zo.getRandomValues=="function")return zo.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}class yc extends vo{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,yp(t);const r=vs(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?t.create().update(r).digest():r);for(let c=0;c<o.length;c++)o[c]^=54;this.iHash.update(o),this.oHash=t.create();for(let c=0;c<o.length;c++)o[c]^=106;this.oHash.update(o),o.fill(0)}update(t){return si(this),this.iHash.update(t),this}digestInto(t){si(this),Ro(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:i,destroyed:o,blockLen:c,outputLen:_}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=c,t.outputLen=_,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const bc=(n,t,e)=>new yc(n,t).update(e).digest();bc.create=(n,t)=>new yc(n,t);function xp(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),o=BigInt(4294967295),c=Number(e>>i&o),_=Number(e&o),l=r?4:0,u=r?0:4;n.setUint32(t+l,c,r),n.setUint32(t+u,_,r)}class mc extends vo{constructor(t,e,r,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Po(this.buffer)}update(t){si(this);const{view:e,buffer:r,blockLen:i}=this;t=vs(t);const o=t.length;for(let c=0;c<o;){const _=Math.min(i-this.pos,o-c);if(_===i){const l=Po(t);for(;i<=o-c;c+=i)this.process(l,c);continue}r.set(t.subarray(c,c+_),this.pos),this.pos+=_,c+=_,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){si(this),wc(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:o}=this;let{pos:c}=this;e[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>i-c&&(this.process(r,0),c=0);for(let f=c;f<i;f++)e[f]=0;xp(r,i-8,BigInt(this.length*8),o),this.process(r,0);const _=Po(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,p=this.get();if(u>p.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)_.setUint32(4*f,p[f],o)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:o,destroyed:c,pos:_}=this;return t.length=i,t.pos=_,t.finished=o,t.destroyed=c,i%e&&t.buffer.set(r),t}}const Rp=(n,t,e)=>n&t^~n&e,zp=(n,t,e)=>n&t^n&e^t&e,Pp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),un=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fn=new Uint32Array(64);class vp extends mc{constructor(){super(64,32,8,!1),this.A=un[0]|0,this.B=un[1]|0,this.C=un[2]|0,this.D=un[3]|0,this.E=un[4]|0,this.F=un[5]|0,this.G=un[6]|0,this.H=un[7]|0}get(){const{A:t,B:e,C:r,D:i,E:o,F:c,G:_,H:l}=this;return[t,e,r,i,o,c,_,l]}set(t,e,r,i,o,c,_,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=c|0,this.G=_|0,this.H=l|0}process(t,e){for(let f=0;f<16;f++,e+=4)fn[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){const d=fn[f-15],b=fn[f-2],x=jr(d,7)^jr(d,18)^d>>>3,E=jr(b,17)^jr(b,19)^b>>>10;fn[f]=E+fn[f-7]+x+fn[f-16]|0}let{A:r,B:i,C:o,D:c,E:_,F:l,G:u,H:p}=this;for(let f=0;f<64;f++){const d=jr(_,6)^jr(_,11)^jr(_,25),b=p+d+Rp(_,l,u)+Pp[f]+fn[f]|0,E=(jr(r,2)^jr(r,13)^jr(r,22))+zp(r,i,o)|0;p=u,u=l,l=_,_=c+b|0,c=o,o=i,i=r,r=b+E|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,_=_+this.E|0,l=l+this.F|0,u=u+this.G|0,p=p+this.H|0,this.set(r,i,o,c,_,l,u,p)}roundClean(){fn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Ac=ko(()=>new vp),ks=BigInt(2**32-1),Io=BigInt(32);function Ec(n,t=!1){return t?{h:Number(n&ks),l:Number(n>>Io&ks)}:{h:Number(n>>Io&ks)|0,l:Number(n&ks)|0}}function xc(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let i=0;i<n.length;i++){const{h:o,l:c}=Ec(n[i],t);[e[i],r[i]]=[o,c]}return[e,r]}const kp=(n,t)=>BigInt(n>>>0)<<Io|BigInt(t>>>0),Ip=(n,t,e)=>n>>>e,Sp=(n,t,e)=>n<<32-e|t>>>e,Tp=(n,t,e)=>n>>>e|t<<32-e,Bp=(n,t,e)=>n<<32-e|t>>>e,Cp=(n,t,e)=>n<<64-e|t>>>e-32,Op=(n,t,e)=>n>>>e-32|t<<64-e,Np=(n,t)=>t,Fp=(n,t)=>n,Rc=(n,t,e)=>n<<e|t>>>32-e,zc=(n,t,e)=>t<<e|n>>>32-e,Pc=(n,t,e)=>t<<e-32|n>>>64-e,vc=(n,t,e)=>n<<e-32|t>>>64-e;function Dp(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const $={fromBig:Ec,split:xc,toBig:kp,shrSH:Ip,shrSL:Sp,rotrSH:Tp,rotrSL:Bp,rotrBH:Cp,rotrBL:Op,rotr32H:Np,rotr32L:Fp,rotlSH:Rc,rotlSL:zc,rotlBH:Pc,rotlBL:vc,add:Dp,add3L:(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),add3H:(n,t,e,r)=>t+e+r+(n/2**32|0)|0,add4L:(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),add4H:(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,add5H:(n,t,e,r,i,o)=>t+e+r+i+o+(n/2**32|0)|0,add5L:(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0)},[Up,Lp]=$.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),hn=new Uint32Array(80),pn=new Uint32Array(80);class Mp extends mc{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:o,Cl:c,Dh:_,Dl:l,Eh:u,El:p,Fh:f,Fl:d,Gh:b,Gl:x,Hh:E,Hl:z}=this;return[t,e,r,i,o,c,_,l,u,p,f,d,b,x,E,z]}set(t,e,r,i,o,c,_,l,u,p,f,d,b,x,E,z){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=c|0,this.Dh=_|0,this.Dl=l|0,this.Eh=u|0,this.El=p|0,this.Fh=f|0,this.Fl=d|0,this.Gh=b|0,this.Gl=x|0,this.Hh=E|0,this.Hl=z|0}process(t,e){for(let B=0;B<16;B++,e+=4)hn[B]=t.getUint32(e),pn[B]=t.getUint32(e+=4);for(let B=16;B<80;B++){const M=hn[B-15]|0,D=pn[B-15]|0,C=$.rotrSH(M,D,1)^$.rotrSH(M,D,8)^$.shrSH(M,D,7),j=$.rotrSL(M,D,1)^$.rotrSL(M,D,8)^$.shrSL(M,D,7),N=hn[B-2]|0,q=pn[B-2]|0,Q=$.rotrSH(N,q,19)^$.rotrBH(N,q,61)^$.shrSH(N,q,6),K=$.rotrSL(N,q,19)^$.rotrBL(N,q,61)^$.shrSL(N,q,6),ht=$.add4L(j,K,pn[B-7],pn[B-16]),Et=$.add4H(ht,C,Q,hn[B-7],hn[B-16]);hn[B]=Et|0,pn[B]=ht|0}let{Ah:r,Al:i,Bh:o,Bl:c,Ch:_,Cl:l,Dh:u,Dl:p,Eh:f,El:d,Fh:b,Fl:x,Gh:E,Gl:z,Hh:P,Hl:T}=this;for(let B=0;B<80;B++){const M=$.rotrSH(f,d,14)^$.rotrSH(f,d,18)^$.rotrBH(f,d,41),D=$.rotrSL(f,d,14)^$.rotrSL(f,d,18)^$.rotrBL(f,d,41),C=f&b^~f&E,j=d&x^~d&z,N=$.add5L(T,D,j,Lp[B],pn[B]),q=$.add5H(N,P,M,C,Up[B],hn[B]),Q=N|0,K=$.rotrSH(r,i,28)^$.rotrBH(r,i,34)^$.rotrBH(r,i,39),ht=$.rotrSL(r,i,28)^$.rotrBL(r,i,34)^$.rotrBL(r,i,39),Et=r&o^r&_^o&_,G=i&c^i&l^c&l;P=E|0,T=z|0,E=b|0,z=x|0,b=f|0,x=d|0,{h:f,l:d}=$.add(u|0,p|0,q|0,Q|0),u=_|0,p=l|0,_=o|0,l=c|0,o=r|0,c=i|0;const S=$.add3L(Q,ht,G);r=$.add3H(S,q,K,Et),i=S|0}({h:r,l:i}=$.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:c}=$.add(this.Bh|0,this.Bl|0,o|0,c|0),{h:_,l}=$.add(this.Ch|0,this.Cl|0,_|0,l|0),{h:u,l:p}=$.add(this.Dh|0,this.Dl|0,u|0,p|0),{h:f,l:d}=$.add(this.Eh|0,this.El|0,f|0,d|0),{h:b,l:x}=$.add(this.Fh|0,this.Fl|0,b|0,x|0),{h:E,l:z}=$.add(this.Gh|0,this.Gl|0,E|0,z|0),{h:P,l:T}=$.add(this.Hh|0,this.Hl|0,P|0,T|0),this.set(r,i,o,c,_,l,u,p,f,d,b,x,E,z,P,T)}roundClean(){hn.fill(0),pn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const jp=ko(()=>new Mp);function Gp(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof Wr<"u")return Wr;throw new Error("unable to locate global object")}const kc=Gp();kc.crypto||kc.msCrypto;function Hp(n){switch(n){case"sha256":return Ac.create();case"sha512":return jp.create()}g(!1,"invalid hashing algorithm name","algorithm",n)}const[Ic,Sc,Tc]=[[],[],[]],Vp=BigInt(0),Ui=BigInt(1),Kp=BigInt(2),Qp=BigInt(7),Jp=BigInt(256),$p=BigInt(113);for(let n=0,t=Ui,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Ic.push(2*(5*r+e)),Sc.push((n+1)*(n+2)/2%64);let i=Vp;for(let o=0;o<7;o++)t=(t<<Ui^(t>>Qp)*$p)%Jp,t&Kp&&(i^=Ui<<(Ui<<BigInt(o))-Ui);Tc.push(i)}const[Wp,qp]=xc(Tc,!0),Bc=(n,t,e)=>e>32?Pc(n,t,e):Rc(n,t,e),Cc=(n,t,e)=>e>32?vc(n,t,e):zc(n,t,e);function Zp(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let c=0;c<10;c++)e[c]=n[c]^n[c+10]^n[c+20]^n[c+30]^n[c+40];for(let c=0;c<10;c+=2){const _=(c+8)%10,l=(c+2)%10,u=e[l],p=e[l+1],f=Bc(u,p,1)^e[_],d=Cc(u,p,1)^e[_+1];for(let b=0;b<50;b+=10)n[c+b]^=f,n[c+b+1]^=d}let i=n[2],o=n[3];for(let c=0;c<24;c++){const _=Sc[c],l=Bc(i,o,_),u=Cc(i,o,_),p=Ic[c];i=n[p],o=n[p+1],n[p]=l,n[p+1]=u}for(let c=0;c<50;c+=10){for(let _=0;_<10;_++)e[_]=n[c+_];for(let _=0;_<10;_++)n[c+_]^=~e[(_+2)%10]&e[(_+4)%10]}n[0]^=Wp[r],n[1]^=qp[r]}e.fill(0)}class So extends vo{constructor(t,e,r,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Ps(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=bp(this.state)}keccak(){Zp(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){si(this);const{blockLen:e,state:r}=this;t=vs(t);const i=t.length;for(let o=0;o<i;){const c=Math.min(e-this.pos,i-o);for(let _=0;_<c;_++)r[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:i}=this;t[r]^=e,(e&128)!==0&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){si(this,!1),Ro(t),this.finish();const e=this.state,{blockLen:r}=this;for(let i=0,o=t.length;i<o;){this.posOut>=r&&this.keccak();const c=Math.min(r-this.posOut,o-i);t.set(e.subarray(this.posOut,this.posOut+c),i),this.posOut+=c,i+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Ps(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(wc(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:r,outputLen:i,rounds:o,enableXOF:c}=this;return t||(t=new So(e,r,i,c,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=c,t.destroyed=this.destroyed,t}}const Yp=((n,t,e)=>ko(()=>new So(t,n,e)))(1,136,256/8);let Oc=!1;const Nc=function(n){return Yp(n)};let Fc=Nc;function dt(n){const t=V(n,"data");return O(Fc(t))}dt._=Nc,dt.lock=function(){Oc=!0},dt.register=function(n){if(Oc)throw new TypeError("keccak256 is locked");Fc=n},Object.freeze(dt);const Dc=function(n){return Hp("sha256").update(n).digest()};let Uc=Dc,Lc=!1;function oi(n){const t=V(n,"data");return O(Uc(t))}oi._=Dc,oi.lock=function(){Lc=!0},oi.register=function(n){if(Lc)throw new Error("sha256 is locked");Uc=n},Object.freeze(oi),Object.freeze(oi);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mc=BigInt(0),Is=BigInt(1),Xp=BigInt(2),Ss=n=>n instanceof Uint8Array,td=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function ai(n){if(!Ss(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=td[n[e]];return t}function jc(n){const t=n.toString(16);return t.length&1?`0${t}`:t}function To(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function ci(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const t=n.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const e=new Uint8Array(t/2);for(let r=0;r<e.length;r++){const i=r*2,o=n.slice(i,i+2),c=Number.parseInt(o,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[r]=c}return e}function In(n){return To(ai(n))}function Bo(n){if(!Ss(n))throw new Error("Uint8Array expected");return To(ai(Uint8Array.from(n).reverse()))}function _i(n,t){return ci(n.toString(16).padStart(t*2,"0"))}function Co(n,t){return _i(n,t).reverse()}function ed(n){return ci(jc(n))}function se(n,t,e){let r;if(typeof t=="string")try{r=ci(t)}catch(o){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${o}`)}else if(Ss(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);const i=r.length;if(typeof e=="number"&&i!==e)throw new Error(`${n} expected ${e} bytes, got ${i}`);return r}function Li(...n){const t=new Uint8Array(n.reduce((r,i)=>r+i.length,0));let e=0;return n.forEach(r=>{if(!Ss(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}function rd(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function nd(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function id(n){let t;for(t=0;n>Mc;n>>=Is,t+=1);return t}function sd(n,t){return n>>BigInt(t)&Is}const od=(n,t,e)=>n|(e?Is:Mc)<<BigInt(t),Oo=n=>(Xp<<BigInt(n-1))-Is,No=n=>new Uint8Array(n),Gc=n=>Uint8Array.from(n);function Hc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=No(n),i=No(n),o=0;const c=()=>{r.fill(1),i.fill(0),o=0},_=(...f)=>e(i,r,...f),l=(f=No())=>{i=_(Gc([0]),f),r=_(),f.length!==0&&(i=_(Gc([1]),f),r=_())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<t;){r=_();const b=r.slice();d.push(b),f+=r.length}return Li(...d)};return(f,d)=>{c(),l(f);let b;for(;!(b=d(u()));)l();return c(),b}}const ad={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Mi(n,t,e={}){const r=(i,o,c)=>{const _=ad[o];if(typeof _!="function")throw new Error(`Invalid validator "${o}", expected function`);const l=n[i];if(!(c&&l===void 0)&&!_(l,n))throw new Error(`Invalid param ${String(i)}=${l} (${typeof l}), expected ${o}`)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(e))r(i,o,!0);return n}const cd=Object.freeze(Object.defineProperty({__proto__:null,bitGet:sd,bitLen:id,bitMask:Oo,bitSet:od,bytesToHex:ai,bytesToNumberBE:In,bytesToNumberLE:Bo,concatBytes:Li,createHmacDrbg:Hc,ensureBytes:se,equalBytes:rd,hexToBytes:ci,hexToNumber:To,numberToBytesBE:_i,numberToBytesLE:Co,numberToHexUnpadded:jc,numberToVarBytesBE:ed,utf8ToBytes:nd,validateObject:Mi},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pt=BigInt(0),bt=BigInt(1),Sn=BigInt(2),_d=BigInt(3),Fo=BigInt(4),Vc=BigInt(5),Kc=BigInt(8);BigInt(9),BigInt(16);function Ut(n,t){const e=n%t;return e>=Pt?e:t+e}function ld(n,t,e){if(e<=Pt||t<Pt)throw new Error("Expected power/modulo > 0");if(e===bt)return Pt;let r=bt;for(;t>Pt;)t&bt&&(r=r*n%e),n=n*n%e,t>>=bt;return r}function qt(n,t,e){let r=n;for(;t-- >Pt;)r*=r,r%=e;return r}function Do(n,t){if(n===Pt||t<=Pt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=Ut(n,t),r=t,i=Pt,o=bt;for(;e!==Pt;){const _=r/e,l=r%e,u=i-o*_;r=e,e=l,i=o,o=u}if(r!==bt)throw new Error("invert: does not exist");return Ut(i,t)}function ud(n){const t=(n-bt)/Sn;let e,r,i;for(e=n-bt,r=0;e%Sn===Pt;e/=Sn,r++);for(i=Sn;i<n&&ld(i,t,n)!==n-bt;i++);if(r===1){const c=(n+bt)/Fo;return function(l,u){const p=l.pow(u,c);if(!l.eql(l.sqr(p),u))throw new Error("Cannot find square root");return p}}const o=(e+bt)/Sn;return function(_,l){if(_.pow(l,t)===_.neg(_.ONE))throw new Error("Cannot find square root");let u=r,p=_.pow(_.mul(_.ONE,i),e),f=_.pow(l,o),d=_.pow(l,e);for(;!_.eql(d,_.ONE);){if(_.eql(d,_.ZERO))return _.ZERO;let b=1;for(let E=_.sqr(d);b<u&&!_.eql(E,_.ONE);b++)E=_.sqr(E);const x=_.pow(p,bt<<BigInt(u-b-1));p=_.sqr(x),f=_.mul(f,x),d=_.mul(d,p),u=b}return f}}function fd(n){if(n%Fo===_d){const t=(n+bt)/Fo;return function(r,i){const o=r.pow(i,t);if(!r.eql(r.sqr(o),i))throw new Error("Cannot find square root");return o}}if(n%Kc===Vc){const t=(n-Vc)/Kc;return function(r,i){const o=r.mul(i,Sn),c=r.pow(o,t),_=r.mul(i,c),l=r.mul(r.mul(_,Sn),c),u=r.mul(_,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return ud(n)}const hd=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pd(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=hd.reduce((r,i)=>(r[i]="function",r),t);return Mi(n,e)}function dd(n,t,e){if(e<Pt)throw new Error("Expected power > 0");if(e===Pt)return n.ONE;if(e===bt)return t;let r=n.ONE,i=t;for(;e>Pt;)e&bt&&(r=n.mul(r,i)),i=n.sqr(i),e>>=bt;return r}function wd(n,t){const e=new Array(t.length),r=t.reduce((o,c,_)=>n.is0(c)?o:(e[_]=o,n.mul(o,c)),n.ONE),i=n.inv(r);return t.reduceRight((o,c,_)=>n.is0(c)?o:(e[_]=n.mul(o,e[_]),n.mul(o,c)),i),e}function Qc(n,t){const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function gd(n,t,e=!1,r={}){if(n<=Pt)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:i,nByteLength:o}=Qc(n,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=fd(n),_=Object.freeze({ORDER:n,BITS:i,BYTES:o,MASK:Oo(i),ZERO:Pt,ONE:bt,create:l=>Ut(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return Pt<=l&&l<n},is0:l=>l===Pt,isOdd:l=>(l&bt)===bt,neg:l=>Ut(-l,n),eql:(l,u)=>l===u,sqr:l=>Ut(l*l,n),add:(l,u)=>Ut(l+u,n),sub:(l,u)=>Ut(l-u,n),mul:(l,u)=>Ut(l*u,n),pow:(l,u)=>dd(_,l,u),div:(l,u)=>Ut(l*Do(u,n),n),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Do(l,n),sqrt:r.sqrt||(l=>c(_,l)),invertBatch:l=>wd(_,l),cmov:(l,u,p)=>p?u:l,toBytes:l=>e?Co(l,o):_i(l,o),fromBytes:l=>{if(l.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${l.length}`);return e?Bo(l):In(l)}});return Object.freeze(_)}function Jc(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function $c(n){const t=Jc(n);return t+Math.ceil(t/2)}function yd(n,t,e=!1){const r=n.length,i=Jc(t),o=$c(t);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const c=e?In(n):Bo(n),_=Ut(c,t-bt)+bt;return e?Co(_,i):_i(_,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const bd=BigInt(0),Uo=BigInt(1);function md(n,t){const e=(i,o)=>{const c=o.negate();return i?c:o},r=i=>{const o=Math.ceil(t/i)+1,c=2**(i-1);return{windows:o,windowSize:c}};return{constTimeNegate:e,unsafeLadder(i,o){let c=n.ZERO,_=i;for(;o>bd;)o&Uo&&(c=c.add(_)),_=_.double(),o>>=Uo;return c},precomputeWindow(i,o){const{windows:c,windowSize:_}=r(o),l=[];let u=i,p=u;for(let f=0;f<c;f++){p=u,l.push(p);for(let d=1;d<_;d++)p=p.add(u),l.push(p);u=p.double()}return l},wNAF(i,o,c){const{windows:_,windowSize:l}=r(i);let u=n.ZERO,p=n.BASE;const f=BigInt(2**i-1),d=2**i,b=BigInt(i);for(let x=0;x<_;x++){const E=x*l;let z=Number(c&f);c>>=b,z>l&&(z-=d,c+=Uo);const P=E,T=E+Math.abs(z)-1,B=x%2!==0,M=z<0;z===0?p=p.add(e(B,o[P])):u=u.add(e(M,o[T]))}return{p:u,f:p}},wNAFCached(i,o,c,_){const l=i._WINDOW_SIZE||1;let u=o.get(i);return u||(u=this.precomputeWindow(i,l),l!==1&&o.set(i,_(u))),this.wNAF(l,u,c)}}}function Wc(n){return pd(n.Fp),Mi(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Qc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ad(n){const t=Wc(n);Mi(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:e,Fp:r,a:i}=t;if(e){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Ed,hexToBytes:xd}=cd,Tn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){const{Err:t}=Tn;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");const e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Ed(r),l:n.subarray(e+2)}},toSig(n){const{Err:t}=Tn,e=typeof n=="string"?xd(n):n;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=Tn._parseInt(e.subarray(2)),{d:c,l:_}=Tn._parseInt(o);if(_.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:c}},hexFromSig(n){const t=u=>Number.parseInt(u[0],16)&8?"00"+u:u,e=u=>{const p=u.toString(16);return p.length&1?`0${p}`:p},r=t(e(n.s)),i=t(e(n.r)),o=r.length/2,c=i.length/2,_=e(o),l=e(c);return`30${e(c+o+4)}02${l}${i}02${_}${r}`}},Yr=BigInt(0),Zt=BigInt(1);BigInt(2);const qc=BigInt(3);BigInt(4);function Rd(n){const t=Ad(n),{Fp:e}=t,r=t.toBytes||((x,E,z)=>{const P=E.toAffine();return Li(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),i=t.fromBytes||(x=>{const E=x.subarray(1),z=e.fromBytes(E.subarray(0,e.BYTES)),P=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x:z,y:P}});function o(x){const{a:E,b:z}=t,P=e.sqr(x),T=e.mul(P,x);return e.add(e.add(T,e.mul(x,E)),z)}if(!e.eql(e.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function c(x){return typeof x=="bigint"&&Yr<x&&x<t.n}function _(x){if(!c(x))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(x){const{allowedPrivateKeyLengths:E,nByteLength:z,wrapPrivateKey:P,n:T}=t;if(E&&typeof x!="bigint"){if(x instanceof Uint8Array&&(x=ai(x)),typeof x!="string"||!E.includes(x.length))throw new Error("Invalid key");x=x.padStart(z*2,"0")}let B;try{B=typeof x=="bigint"?x:In(se("private key",x,z))}catch{throw new Error(`private key must be ${z} bytes, hex or bigint, not ${typeof x}`)}return P&&(B=Ut(B,T)),_(B),B}const u=new Map;function p(x){if(!(x instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(E,z,P){if(this.px=E,this.py=z,this.pz=P,E==null||!e.isValid(E))throw new Error("x required");if(z==null||!e.isValid(z))throw new Error("y required");if(P==null||!e.isValid(P))throw new Error("z required")}static fromAffine(E){const{x:z,y:P}=E||{};if(!E||!e.isValid(z)||!e.isValid(P))throw new Error("invalid affine point");if(E instanceof f)throw new Error("projective point not allowed");const T=B=>e.eql(B,e.ZERO);return T(z)&&T(P)?f.ZERO:new f(z,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){const z=e.invertBatch(E.map(P=>P.pz));return E.map((P,T)=>P.toAffine(z[T])).map(f.fromAffine)}static fromHex(E){const z=f.fromAffine(i(se("pointHex",E)));return z.assertValidity(),z}static fromPrivateKey(E){return f.BASE.multiply(l(E))}_setWindowSize(E){this._WINDOW_SIZE=E,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:E,y:z}=this.toAffine();if(!e.isValid(E)||!e.isValid(z))throw new Error("bad point: x or y not FE");const P=e.sqr(z),T=o(E);if(!e.eql(P,T))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:E}=this.toAffine();if(e.isOdd)return!e.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){p(E);const{px:z,py:P,pz:T}=this,{px:B,py:M,pz:D}=E,C=e.eql(e.mul(z,D),e.mul(B,T)),j=e.eql(e.mul(P,D),e.mul(M,T));return C&&j}negate(){return new f(this.px,e.neg(this.py),this.pz)}double(){const{a:E,b:z}=t,P=e.mul(z,qc),{px:T,py:B,pz:M}=this;let D=e.ZERO,C=e.ZERO,j=e.ZERO,N=e.mul(T,T),q=e.mul(B,B),Q=e.mul(M,M),K=e.mul(T,B);return K=e.add(K,K),j=e.mul(T,M),j=e.add(j,j),D=e.mul(E,j),C=e.mul(P,Q),C=e.add(D,C),D=e.sub(q,C),C=e.add(q,C),C=e.mul(D,C),D=e.mul(K,D),j=e.mul(P,j),Q=e.mul(E,Q),K=e.sub(N,Q),K=e.mul(E,K),K=e.add(K,j),j=e.add(N,N),N=e.add(j,N),N=e.add(N,Q),N=e.mul(N,K),C=e.add(C,N),Q=e.mul(B,M),Q=e.add(Q,Q),N=e.mul(Q,K),D=e.sub(D,N),j=e.mul(Q,q),j=e.add(j,j),j=e.add(j,j),new f(D,C,j)}add(E){p(E);const{px:z,py:P,pz:T}=this,{px:B,py:M,pz:D}=E;let C=e.ZERO,j=e.ZERO,N=e.ZERO;const q=t.a,Q=e.mul(t.b,qc);let K=e.mul(z,B),ht=e.mul(P,M),Et=e.mul(T,D),G=e.add(z,P),S=e.add(B,M);G=e.mul(G,S),S=e.add(K,ht),G=e.sub(G,S),S=e.add(z,T);let U=e.add(B,D);return S=e.mul(S,U),U=e.add(K,Et),S=e.sub(S,U),U=e.add(P,T),C=e.add(M,D),U=e.mul(U,C),C=e.add(ht,Et),U=e.sub(U,C),N=e.mul(q,S),C=e.mul(Q,Et),N=e.add(C,N),C=e.sub(ht,N),N=e.add(ht,N),j=e.mul(C,N),ht=e.add(K,K),ht=e.add(ht,K),Et=e.mul(q,Et),S=e.mul(Q,S),ht=e.add(ht,Et),Et=e.sub(K,Et),Et=e.mul(q,Et),S=e.add(S,Et),K=e.mul(ht,S),j=e.add(j,K),K=e.mul(U,S),C=e.mul(G,C),C=e.sub(C,K),K=e.mul(G,ht),N=e.mul(U,N),N=e.add(N,K),new f(C,j,N)}subtract(E){return this.add(E.negate())}is0(){return this.equals(f.ZERO)}wNAF(E){return b.wNAFCached(this,u,E,z=>{const P=e.invertBatch(z.map(T=>T.pz));return z.map((T,B)=>T.toAffine(P[B])).map(f.fromAffine)})}multiplyUnsafe(E){const z=f.ZERO;if(E===Yr)return z;if(_(E),E===Zt)return this;const{endo:P}=t;if(!P)return b.unsafeLadder(this,E);let{k1neg:T,k1:B,k2neg:M,k2:D}=P.splitScalar(E),C=z,j=z,N=this;for(;B>Yr||D>Yr;)B&Zt&&(C=C.add(N)),D&Zt&&(j=j.add(N)),N=N.double(),B>>=Zt,D>>=Zt;return T&&(C=C.negate()),M&&(j=j.negate()),j=new f(e.mul(j.px,P.beta),j.py,j.pz),C.add(j)}multiply(E){_(E);let z=E,P,T;const{endo:B}=t;if(B){const{k1neg:M,k1:D,k2neg:C,k2:j}=B.splitScalar(z);let{p:N,f:q}=this.wNAF(D),{p:Q,f:K}=this.wNAF(j);N=b.constTimeNegate(M,N),Q=b.constTimeNegate(C,Q),Q=new f(e.mul(Q.px,B.beta),Q.py,Q.pz),P=N.add(Q),T=q.add(K)}else{const{p:M,f:D}=this.wNAF(z);P=M,T=D}return f.normalizeZ([P,T])[0]}multiplyAndAddUnsafe(E,z,P){const T=f.BASE,B=(D,C)=>C===Yr||C===Zt||!D.equals(T)?D.multiplyUnsafe(C):D.multiply(C),M=B(this,z).add(B(E,P));return M.is0()?void 0:M}toAffine(E){const{px:z,py:P,pz:T}=this,B=this.is0();E==null&&(E=B?e.ONE:e.inv(T));const M=e.mul(z,E),D=e.mul(P,E),C=e.mul(T,E);if(B)return{x:e.ZERO,y:e.ZERO};if(!e.eql(C,e.ONE))throw new Error("invZ was invalid");return{x:M,y:D}}isTorsionFree(){const{h:E,isTorsionFree:z}=t;if(E===Zt)return!0;if(z)return z(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:E,clearCofactor:z}=t;return E===Zt?this:z?z(f,this):this.multiplyUnsafe(t.h)}toRawBytes(E=!0){return this.assertValidity(),r(f,this,E)}toHex(E=!0){return ai(this.toRawBytes(E))}}f.BASE=new f(t.Gx,t.Gy,e.ONE),f.ZERO=new f(e.ZERO,e.ONE,e.ZERO);const d=t.nBitLength,b=md(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:c}}function zd(n){const t=Wc(n);return Mi(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Pd(n){const t=zd(n),{Fp:e,n:r}=t,i=e.BYTES+1,o=2*e.BYTES+1;function c(S){return Yr<S&&S<e.ORDER}function _(S){return Ut(S,r)}function l(S){return Do(S,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:d}=Rd({...t,toBytes(S,U,J){const nt=U.toAffine(),rt=e.toBytes(nt.x),xt=Li;return J?xt(Uint8Array.from([U.hasEvenY()?2:3]),rt):xt(Uint8Array.from([4]),rt,e.toBytes(nt.y))},fromBytes(S){const U=S.length,J=S[0],nt=S.subarray(1);if(U===i&&(J===2||J===3)){const rt=In(nt);if(!c(rt))throw new Error("Point is not on curve");const xt=f(rt);let Gt=e.sqrt(xt);const zt=(Gt&Zt)===Zt;return(J&1)===1!==zt&&(Gt=e.neg(Gt)),{x:rt,y:Gt}}else if(U===o&&J===4){const rt=e.fromBytes(nt.subarray(0,e.BYTES)),xt=e.fromBytes(nt.subarray(e.BYTES,2*e.BYTES));return{x:rt,y:xt}}else throw new Error(`Point of length ${U} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),b=S=>ai(_i(S,t.nByteLength));function x(S){const U=r>>Zt;return S>U}function E(S){return x(S)?_(-S):S}const z=(S,U,J)=>In(S.slice(U,J));class P{constructor(U,J,nt){this.r=U,this.s=J,this.recovery=nt,this.assertValidity()}static fromCompact(U){const J=t.nByteLength;return U=se("compactSignature",U,J*2),new P(z(U,0,J),z(U,J,2*J))}static fromDER(U){const{r:J,s:nt}=Tn.toSig(se("DER",U));return new P(J,nt)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(U){return new P(this.r,this.s,U)}recoverPublicKey(U){const{r:J,s:nt,recovery:rt}=this,xt=j(se("msgHash",U));if(rt==null||![0,1,2,3].includes(rt))throw new Error("recovery id invalid");const Gt=rt===2||rt===3?J+t.n:J;if(Gt>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const zt=(rt&1)===0?"02":"03",Rn=u.fromHex(zt+b(Gt)),zn=l(Gt),Ti=_(-xt*zn),ys=_(nt*zn),Pn=u.BASE.multiplyAndAddUnsafe(Rn,Ti,ys);if(!Pn)throw new Error("point at infinify");return Pn.assertValidity(),Pn}hasHighS(){return x(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,_(-this.s),this.recovery):this}toDERRawBytes(){return ci(this.toDERHex())}toDERHex(){return Tn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ci(this.toCompactHex())}toCompactHex(){return b(this.r)+b(this.s)}}const T={isValidPrivateKey(S){try{return p(S),!0}catch{return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{const S=$c(t.n);return yd(t.randomBytes(S),t.n)},precompute(S=8,U=u.BASE){return U._setWindowSize(S),U.multiply(BigInt(3)),U}};function B(S,U=!0){return u.fromPrivateKey(S).toRawBytes(U)}function M(S){const U=S instanceof Uint8Array,J=typeof S=="string",nt=(U||J)&&S.length;return U?nt===i||nt===o:J?nt===2*i||nt===2*o:S instanceof u}function D(S,U,J=!0){if(M(S))throw new Error("first arg must be private key");if(!M(U))throw new Error("second arg must be public key");return u.fromHex(U).multiply(p(S)).toRawBytes(J)}const C=t.bits2int||function(S){const U=In(S),J=S.length*8-t.nBitLength;return J>0?U>>BigInt(J):U},j=t.bits2int_modN||function(S){return _(C(S))},N=Oo(t.nBitLength);function q(S){if(typeof S!="bigint")throw new Error("bigint expected");if(!(Yr<=S&&S<N))throw new Error(`bigint expected < 2^${t.nBitLength}`);return _i(S,t.nByteLength)}function Q(S,U,J=K){if(["recovered","canonical"].some(ri=>ri in J))throw new Error("sign() legacy options not supported");const{hash:nt,randomBytes:rt}=t;let{lowS:xt,prehash:Gt,extraEntropy:zt}=J;xt==null&&(xt=!0),S=se("msgHash",S),Gt&&(S=se("prehashed msgHash",nt(S)));const Rn=j(S),zn=p(U),Ti=[q(zn),q(Rn)];if(zt!=null){const ri=zt===!0?rt(e.BYTES):zt;Ti.push(se("extraEntropy",ri))}const ys=Li(...Ti),Pn=Rn;function Va(ri){const Bi=C(ri);if(!d(Bi))return;const $h=l(Bi),$r=u.BASE.multiply(Bi).toAffine(),Ci=_($r.x);if(Ci===Yr)return;const ho=_($h*_(Pn+Ci*zn));if(ho===Yr)return;let Wh=($r.x===Ci?0:2)|Number($r.y&Zt),qh=ho;return xt&&x(ho)&&(qh=E(ho),Wh^=1),new P(Ci,qh,Wh)}return{seed:ys,k2sig:Va}}const K={lowS:t.lowS,prehash:!1},ht={lowS:t.lowS,prehash:!1};function Et(S,U,J=K){const{seed:nt,k2sig:rt}=Q(S,U,J),xt=t;return Hc(xt.hash.outputLen,xt.nByteLength,xt.hmac)(nt,rt)}u.BASE._setWindowSize(8);function G(S,U,J,nt=ht){const rt=S;if(U=se("msgHash",U),J=se("publicKey",J),"strict"in nt)throw new Error("options.strict was renamed to lowS");const{lowS:xt,prehash:Gt}=nt;let zt,Rn;try{if(typeof rt=="string"||rt instanceof Uint8Array)try{zt=P.fromDER(rt)}catch($r){if(!($r instanceof Tn.Err))throw $r;zt=P.fromCompact(rt)}else if(typeof rt=="object"&&typeof rt.r=="bigint"&&typeof rt.s=="bigint"){const{r:$r,s:Ci}=rt;zt=new P($r,Ci)}else throw new Error("PARSE");Rn=u.fromHex(J)}catch($r){if($r.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xt&&zt.hasHighS())return!1;Gt&&(U=t.hash(U));const{r:zn,s:Ti}=zt,ys=j(U),Pn=l(Ti),Va=_(ys*Pn),ri=_(zn*Pn),Bi=u.BASE.multiplyAndAddUnsafe(Rn,Va,ri)?.toAffine();return Bi?_(Bi.x)===zn:!1}return{CURVE:t,getPublicKey:B,getSharedSecret:D,sign:Et,verify:G,ProjectivePoint:u,Signature:P,utils:T}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function vd(n){return{hash:n,hmac:(t,...e)=>bc(n,t,Ap(...e)),randomBytes:Ep}}function kd(n,t){const e=r=>Pd({...n,...vd(r)});return Object.freeze({...e(t),create:e})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Yc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Id=BigInt(1),Lo=BigInt(2),Xc=(n,t)=>(n+t/Lo)/t;function Sd(n){const t=Zc,e=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),c=BigInt(23),_=BigInt(44),l=BigInt(88),u=n*n*n%t,p=u*u*n%t,f=qt(p,e,t)*p%t,d=qt(f,e,t)*p%t,b=qt(d,Lo,t)*u%t,x=qt(b,i,t)*b%t,E=qt(x,o,t)*x%t,z=qt(E,_,t)*E%t,P=qt(z,l,t)*z%t,T=qt(P,_,t)*E%t,B=qt(T,e,t)*p%t,M=qt(B,c,t)*x%t,D=qt(M,r,t)*u%t,C=qt(D,Lo,t);if(!Mo.eql(Mo.sqr(C),n))throw new Error("Cannot find square root");return C}const Mo=gd(Zc,void 0,void 0,{sqrt:Sd}),dn=kd({a:BigInt(0),b:BigInt(7),Fp:Mo,n:Yc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const t=Yc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Id*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=e,c=BigInt("0x100000000000000000000000000000000"),_=Xc(o*n,t),l=Xc(-r*n,t);let u=Ut(n-_*e-l*i,t),p=Ut(-_*r-l*o,t);const f=u>c,d=p>c;if(f&&(u=t-u),d&&(p=t-p),u>c||p>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:f,k1:u,k2neg:d,k2:p}}}},Ac);BigInt(0),dn.ProjectivePoint;const ji="0x0000000000000000000000000000000000000000",t_="0x0000000000000000000000000000000000000000000000000000000000000000",e_=BigInt(0),r_=BigInt(1),n_=BigInt(2),i_=BigInt(27),s_=BigInt(28),Ts=BigInt(35),li={};function o_(n){return Wt(At(n),32)}class wt{#t;#e;#r;#n;get r(){return this.#t}set r(t){g(vn(t)===32,"invalid r","value",t),this.#t=O(t)}get s(){return g(parseInt(this.#e.substring(0,3))<8,"non-canonical s; use ._s","s",this.#e),this.#e}set s(t){g(vn(t)===32,"invalid s","value",t),this.#e=O(t)}get _s(){return this.#e}isValid(){return parseInt(this.#e.substring(0,3))<8}get v(){return this.#r}set v(t){const e=Z(t,"value");g(e===27||e===28,"invalid v","v",t),this.#r=e}get networkV(){return this.#n}get legacyChainId(){const t=this.networkV;return t==null?null:wt.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){const t=V(this.s);return this.yParity&&(t[0]|=128),O(t)}get compactSerialized(){return ct([this.r,this.yParityAndS])}get serialized(){return ct([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,r,i){bs(t,li,"Signature"),this.#t=e,this.#e=r,this.#r=i,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const t=new wt(li,this.r,this._s,this.v);return this.networkV&&(t.#n=this.networkV),t}toJSON(){const t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(t){const e=L(t,"v");return e==i_||e==s_?e_:(g(e>=Ts,"invalid EIP-155 v","v",t),(e-Ts)/n_)}static getChainIdV(t,e){return L(t)*n_+BigInt(35+e-27)}static getNormalizedV(t){const e=L(t);return e===e_||e===i_?27:e===r_||e===s_?28:(g(e>=Ts,"invalid v","v",t),e&r_?27:28)}static from(t){function e(u,p){g(u,p,"signature",t)}if(t==null)return new wt(li,t_,t_,27);if(typeof t=="string"){const u=V(t,"signature");if(u.length===64){const p=O(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new wt(li,p,O(f),d)}if(u.length===65){const p=O(u.slice(0,32)),f=O(u.slice(32,64)),d=wt.getNormalizedV(u[64]);return new wt(li,p,f,d)}e(!1,"invalid raw signature length")}if(t instanceof wt)return t.clone();const r=t.r;e(r!=null,"missing r");const i=o_(r),o=function(u,p){if(u!=null)return o_(u);if(p!=null){e(st(p,32),"invalid yParityAndS");const f=V(p);return f[0]&=127,O(f)}e(!1,"missing s")}(t.s,t.yParityAndS),{networkV:c,v:_}=function(u,p,f){if(u!=null){const d=L(u);return{networkV:d>=Ts?d:void 0,v:wt.getNormalizedV(d)}}if(p!=null)return e(st(p,32),"invalid yParityAndS"),{v:V(p)[0]&128?28:27};if(f!=null){switch(Z(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),l=new wt(li,i,o,_);return c&&(l.#n=c),e(t.yParity==null||Z(t.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}}class Xr{#t;constructor(t){g(vn(t)===32,"invalid private key","privateKey","[REDACTED]"),this.#t=O(t)}get privateKey(){return this.#t}get publicKey(){return Xr.computePublicKey(this.#t)}get compressedPublicKey(){return Xr.computePublicKey(this.#t,!0)}sign(t){g(vn(t)===32,"invalid digest length","digest",t);const e=dn.sign(Bt(t),Bt(this.#t),{lowS:!0});return wt.from({r:cn(e.r,32),s:cn(e.s,32),v:e.recovery?28:27})}computeSharedSecret(t){const e=Xr.computePublicKey(t);return O(dn.getSharedSecret(Bt(this.#t),V(e),!1))}static computePublicKey(t,e){let r=V(t,"key");if(r.length===32){const o=dn.getPublicKey(r,!!e);return O(o)}if(r.length===64){const o=new Uint8Array(65);o[0]=4,o.set(r,1),r=o}const i=dn.ProjectivePoint.fromHex(r);return O(i.toRawBytes(e))}static recoverPublicKey(t,e){g(vn(t)===32,"invalid digest length","digest",t);const r=wt.from(e);let i=dn.Signature.fromCompact(Bt(ct([r.r,r.s])));i=i.addRecoveryBit(r.yParity);const o=i.recoverPublicKey(Bt(t));return g(o!=null,"invalid signature for digest","signature",e),"0x"+o.toHex(!1)}static addPoints(t,e,r){const i=dn.ProjectivePoint.fromHex(Xr.computePublicKey(t).substring(2)),o=dn.ProjectivePoint.fromHex(Xr.computePublicKey(e).substring(2));return"0x"+i.add(o).toHex(!!r)}}const Td=BigInt(0),Bd=BigInt(36);function a_(n){n=n.toLowerCase();const t=n.substring(2).split(""),e=new Uint8Array(40);for(let i=0;i<40;i++)e[i]=t[i].charCodeAt(0);const r=V(dt(e));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(r[i>>1]&15)>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}const jo={};for(let n=0;n<10;n++)jo[String(n)]=String(n);for(let n=0;n<26;n++)jo[String.fromCharCode(65+n)]=String(10+n);const c_=15;function Cd(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let t=n.split("").map(r=>jo[r]).join("");for(;t.length>=c_;){let r=t.substring(0,c_);t=parseInt(r,10)%97+t.substring(r.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}const Od=function(){const n={};for(let t=0;t<36;t++){const e="0123456789abcdefghijklmnopqrstuvwxyz"[t];n[e]=BigInt(t)}return n}();function Nd(n){n=n.toLowerCase();let t=Td;for(let e=0;e<n.length;e++)t=t*Bd+Od[n[e]];return t}function Y(n){if(g(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const t=a_(n);return g(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===n,"bad address checksum","address",n),t}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){g(n.substring(2,4)===Cd(n),"bad icap checksum","address",n);let t=Nd(n.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return a_("0x"+t)}g(!1,"invalid address","address",n)}function Fd(n){const t=Y(n.from);let r=L(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,Y(pt(dt(ln([t,r])),12))}function __(n){return n&&typeof n.getAddress=="function"}function tn(n){try{return Y(n),!0}catch{}return!1}async function Go(n,t){const e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(v(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),g(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),Y(e)}function Ot(n,t){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?Y(n):(v(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Go(n,t.resolveName(n)));if(__(n))return Go(n,n.getAddress());if(n&&typeof n.then=="function")return Go(n,n);g(!1,"unsupported addressable value","target",n)}const en={};function F(n,t){let e=!1;return t<0&&(e=!0,t*=-1),new gt(en,`${e?"":"u"}int${t}`,n,{signed:e,width:t})}function et(n,t){return new gt(en,`bytes${t||""}`,n,{size:t})}const l_=Symbol.for("_ethers_typed");class gt{type;value;#t;_typedSymbol;constructor(t,e,r,i){i==null&&(i=null),bs(en,t,"Typed"),H(this,{_typedSymbol:l_,type:e,value:r}),this.#t=i,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${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 this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#t}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#t===!0?-1:this.#t===!1?this.value.length:null}static from(t,e){return new gt(en,t,e)}static uint8(t){return F(t,8)}static uint16(t){return F(t,16)}static uint24(t){return F(t,24)}static uint32(t){return F(t,32)}static uint40(t){return F(t,40)}static uint48(t){return F(t,48)}static uint56(t){return F(t,56)}static uint64(t){return F(t,64)}static uint72(t){return F(t,72)}static uint80(t){return F(t,80)}static uint88(t){return F(t,88)}static uint96(t){return F(t,96)}static uint104(t){return F(t,104)}static uint112(t){return F(t,112)}static uint120(t){return F(t,120)}static uint128(t){return F(t,128)}static uint136(t){return F(t,136)}static uint144(t){return F(t,144)}static uint152(t){return F(t,152)}static uint160(t){return F(t,160)}static uint168(t){return F(t,168)}static uint176(t){return F(t,176)}static uint184(t){return F(t,184)}static uint192(t){return F(t,192)}static uint200(t){return F(t,200)}static uint208(t){return F(t,208)}static uint216(t){return F(t,216)}static uint224(t){return F(t,224)}static uint232(t){return F(t,232)}static uint240(t){return F(t,240)}static uint248(t){return F(t,248)}static uint256(t){return F(t,256)}static uint(t){return F(t,256)}static int8(t){return F(t,-8)}static int16(t){return F(t,-16)}static int24(t){return F(t,-24)}static int32(t){return F(t,-32)}static int40(t){return F(t,-40)}static int48(t){return F(t,-48)}static int56(t){return F(t,-56)}static int64(t){return F(t,-64)}static int72(t){return F(t,-72)}static int80(t){return F(t,-80)}static int88(t){return F(t,-88)}static int96(t){return F(t,-96)}static int104(t){return F(t,-104)}static int112(t){return F(t,-112)}static int120(t){return F(t,-120)}static int128(t){return F(t,-128)}static int136(t){return F(t,-136)}static int144(t){return F(t,-144)}static int152(t){return F(t,-152)}static int160(t){return F(t,-160)}static int168(t){return F(t,-168)}static int176(t){return F(t,-176)}static int184(t){return F(t,-184)}static int192(t){return F(t,-192)}static int200(t){return F(t,-200)}static int208(t){return F(t,-208)}static int216(t){return F(t,-216)}static int224(t){return F(t,-224)}static int232(t){return F(t,-232)}static int240(t){return F(t,-240)}static int248(t){return F(t,-248)}static int256(t){return F(t,-256)}static int(t){return F(t,-256)}static bytes1(t){return et(t,1)}static bytes2(t){return et(t,2)}static bytes3(t){return et(t,3)}static bytes4(t){return et(t,4)}static bytes5(t){return et(t,5)}static bytes6(t){return et(t,6)}static bytes7(t){return et(t,7)}static bytes8(t){return et(t,8)}static bytes9(t){return et(t,9)}static bytes10(t){return et(t,10)}static bytes11(t){return et(t,11)}static bytes12(t){return et(t,12)}static bytes13(t){return et(t,13)}static bytes14(t){return et(t,14)}static bytes15(t){return et(t,15)}static bytes16(t){return et(t,16)}static bytes17(t){return et(t,17)}static bytes18(t){return et(t,18)}static bytes19(t){return et(t,19)}static bytes20(t){return et(t,20)}static bytes21(t){return et(t,21)}static bytes22(t){return et(t,22)}static bytes23(t){return et(t,23)}static bytes24(t){return et(t,24)}static bytes25(t){return et(t,25)}static bytes26(t){return et(t,26)}static bytes27(t){return et(t,27)}static bytes28(t){return et(t,28)}static bytes29(t){return et(t,29)}static bytes30(t){return et(t,30)}static bytes31(t){return et(t,31)}static bytes32(t){return et(t,32)}static address(t){return new gt(en,"address",t)}static bool(t){return new gt(en,"bool",!!t)}static bytes(t){return new gt(en,"bytes",t)}static string(t){return new gt(en,"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 gt(en,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===l_}static dereference(t,e){if(gt.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}}class Dd extends Zr{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let r=gt.dereference(e,"string");try{r=Y(r)}catch(i){return this._throwError(i.message,e)}return t.writeValue(r)}decode(t){return Y(cn(t.readValue(),20))}}class Ud extends Zr{coder;constructor(t){super(t.name,t.type,"_",t.dynamic),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 u_(n,t,e){let r=[];if(Array.isArray(e))r=e;else if(e&&typeof e=="object"){let l={};r=t.map(u=>{const p=u.localName;return v(p,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:e}),v(!l[p],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:e}),l[p]=!0,e[p]})}else g(!1,"invalid tuple value","tuple",e);g(t.length===r.length,"types/value length mismatch","tuple",e);let i=new Eo,o=new Eo,c=[];t.forEach((l,u)=>{let p=r[u];if(l.dynamic){let f=o.length;l.encode(o,p);let d=i.writeUpdatableValue();c.push(b=>{d(b+f)})}else l.encode(i,p)}),c.forEach(l=>{l(i.length)});let _=n.appendWriter(i);return _+=n.appendWriter(o),_}function f_(n,t){let e=[],r=[],i=n.subReader(0);return t.forEach(o=>{let c=null;if(o.dynamic){let _=n.readIndex(),l=i.subReader(_);try{c=o.decode(l)}catch(u){if(kt(u,"BUFFER_OVERRUN"))throw u;c=u,c.baseType=o.name,c.name=o.localName,c.type=o.type}}else try{c=o.decode(n)}catch(_){if(kt(_,"BUFFER_OVERRUN"))throw _;c=_,c.baseType=o.name,c.name=o.localName,c.type=o.type}if(c==null)throw new Error("investigate");e.push(c),r.push(o.localName||null)}),qr.fromItems(e,r)}class Ld extends Zr{coder;length;constructor(t,e,r){const i=t.type+"["+(e>=0?e:"")+"]",o=e===-1||t.dynamic;super("array",i,r,o),H(this,{coder:t,length:e})}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){const r=gt.dereference(e,"array");Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,t.writeValue(r.length)),Ka(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let c=0;c<r.length;c++)o.push(this.coder);return u_(t,o,r)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),v(e*Ct<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*Ct,length:t.dataLength}));let r=[];for(let i=0;i<e;i++)r.push(new Ud(this.coder));return f_(t,r)}}class Md extends Zr{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){const r=gt.dereference(e,"bool");return t.writeValue(r?1:0)}decode(t){return!!t.readValue()}}class h_ extends Zr{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=Bt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readIndex(),!0)}}class jd extends h_{constructor(t){super("bytes",t)}decode(t){return O(super.decode(t))}}class Gd extends Zr{size;constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),H(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let r=Bt(gt.dereference(e,this.type));return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return O(t.readBytes(this.size))}}const Hd=new Uint8Array([]);class Vd extends Zr{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Hd)}decode(t){return t.readBytes(0),null}}const Kd=BigInt(0),Qd=BigInt(1),Jd=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class $d extends Zr{size;signed;constructor(t,e,r){const i=(e?"int":"uint")+t*8;super(i,i,r,!1),H(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let r=L(gt.dereference(e,this.type)),i=Ni(Jd,Ct*8);if(this.signed){let o=Ni(i,this.size*8-1);(r>o||r<-(o+Qd))&&this._throwError("value out-of-bounds",e),r=go(r,8*Ct)}else(r<Kd||r>Ni(i,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(r)}decode(t){let e=Ni(t.readValue(),this.size*8);return this.signed&&(e=Xh(e,this.size*8)),e}}class Wd extends h_{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Lr(gt.dereference(e,"string")))}decode(t){return Es(super.decode(t))}}class Bs extends Zr{coders;constructor(t,e){let r=!1;const i=[];t.forEach(c=>{c.dynamic&&(r=!0),i.push(c.type)});const o="tuple("+i.join(",")+")";super("tuple",o,e,r),H(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});const e=this.coders.reduce((r,i)=>{const o=i.localName;return o&&(r[o]||(r[o]=0),r[o]++),r},{});return this.coders.forEach((r,i)=>{let o=r.localName;!o||e[o]!==1||(o==="length"&&(o="_length"),t[o]==null&&(t[o]=t[i]))}),Object.freeze(t)}encode(t,e){const r=gt.dereference(e,"tuple");return u_(t,this.coders,r)}decode(t){return f_(t,this.coders)}}function Ho(n,t){return{address:Y(n),storageKeys:t.map((e,r)=>(g(st(e,32),"invalid slot",`storageKeys[${r}]`,e),e.toLowerCase()))}}function Bn(n){if(Array.isArray(n))return n.map((e,r)=>Array.isArray(e)?(g(e.length===2,"invalid slot set",`value[${r}]`,e),Ho(e[0],e[1])):(g(e!=null&&typeof e=="object","invalid address-slot set","value",n),Ho(e.address,e.storageKeys)));g(n!=null&&typeof n=="object","invalid access list","value",n);const t=Object.keys(n).map(e=>{const r=n[e].reduce((i,o)=>(i[o]=!0,i),{});return Ho(e,Object.keys(r).sort())});return t.sort((e,r)=>e.address.localeCompare(r.address)),t}function p_(n){return{address:Y(n.address),nonce:L(n.nonce!=null?n.nonce:0),chainId:L(n.chainId!=null?n.chainId:0),signature:wt.from(n.signature)}}function qd(n){let t;return typeof n=="string"?t=Xr.computePublicKey(n,!1):t=n.publicKey,Y(dt("0x"+t.substring(4)).substring(26))}function d_(n,t){return qd(Xr.recoverPublicKey(n,t))}const vt=BigInt(0),Zd=BigInt(2),Yd=BigInt(27),Xd=BigInt(28),tw=BigInt(35),ew=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Vo=4096*32;function rw(n){return{blobToKzgCommitment:r=>{if("computeBlobProof"in n){if("blobToKzgCommitment"in n&&typeof n.blobToKzgCommitment=="function")return V(n.blobToKzgCommitment(O(r)))}else if("blobToKzgCommitment"in n&&typeof n.blobToKzgCommitment=="function")return V(n.blobToKzgCommitment(r));if("blobToKZGCommitment"in n&&typeof n.blobToKZGCommitment=="function")return V(n.blobToKZGCommitment(O(r)));g(!1,"unsupported KZG library","kzg",n)},computeBlobKzgProof:(r,i)=>{if("computeBlobProof"in n&&typeof n.computeBlobProof=="function")return V(n.computeBlobProof(O(r),O(i)));if("computeBlobKzgProof"in n&&typeof n.computeBlobKzgProof=="function")return n.computeBlobKzgProof(r,i);if("computeBlobKZGProof"in n&&typeof n.computeBlobKZGProof=="function")return V(n.computeBlobKZGProof(O(r),O(i)));g(!1,"unsupported KZG library","kzg",n)}}}function w_(n,t){let e=n.toString(16);for(;e.length<2;)e="0"+e;return e+=oi(t).substring(4),"0x"+e}function ui(n){return n==="0x"?null:Y(n)}function Cs(n,t){try{return Bn(n)}catch(e){g(!1,e.message,t,n)}}function nw(n,t){try{if(!Array.isArray(n))throw new Error("authorizationList: invalid array");const e=[];for(let r=0;r<n.length;r++){const i=n[r];if(!Array.isArray(i))throw new Error(`authorization[${r}]: invalid array`);if(i.length!==6)throw new Error(`authorization[${r}]: wrong length`);if(!i[1])throw new Error(`authorization[${r}]: null address`);e.push({address:ui(i[1]),nonce:it(i[2],"nonce"),chainId:it(i[0],"chainId"),signature:wt.from({yParity:Cn(i[3],"yParity"),r:Wt(i[4],32),s:Wt(i[5],32)})})}return e}catch(e){g(!1,e.message,t,n)}}function Cn(n,t){return n==="0x"?0:Z(n,t)}function it(n,t){if(n==="0x")return vt;const e=L(n,t);return g(e<=ew,"value exceeds uint size",t,e),e}function X(n,t){const e=L(n,"value"),r=At(e);return g(r.length<=32,"value too large",`tx.${t}`,e),r}function Os(n){return Bn(n).map(t=>[t.address,t.storageKeys])}function iw(n){return n.map(t=>[X(t.chainId,"chainId"),t.address,X(t.nonce,"nonce"),X(t.signature.yParity,"yParity"),At(t.signature.r),At(t.signature.s)])}function sw(n,t){g(Array.isArray(n),`invalid ${t}`,"value",n);for(let e=0;e<n.length;e++)g(st(n[e],32),"invalid ${ param } hash",`value[${e}]`,n[e]);return n}function ow(n){const t=Fi(n);g(Array.isArray(t)&&(t.length===9||t.length===6),"invalid field count for legacy transaction","data",n);const e={type:0,nonce:Cn(t[0],"nonce"),gasPrice:it(t[1],"gasPrice"),gasLimit:it(t[2],"gasLimit"),to:ui(t[3]),value:it(t[4],"value"),data:O(t[5]),chainId:vt};if(t.length===6)return e;const r=it(t[6],"v"),i=it(t[7],"r"),o=it(t[8],"s");if(i===vt&&o===vt)e.chainId=r;else{let c=(r-tw)/Zd;c<vt&&(c=vt),e.chainId=c,g(c!==vt||r===Yd||r===Xd,"non-canonical legacy v","v",t[6]),e.signature=wt.from({r:Wt(t[7],32),s:Wt(t[8],32),v:r})}return e}function aw(n,t){const e=[X(n.nonce,"nonce"),X(n.gasPrice||0,"gasPrice"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data];let r=vt;if(n.chainId!=vt)r=L(n.chainId,"tx.chainId"),g(!t||t.networkV==null||t.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",t);else if(n.signature){const o=n.signature.legacyChainId;o!=null&&(r=o)}if(!t)return r!==vt&&(e.push(At(r)),e.push("0x"),e.push("0x")),ln(e);let i=BigInt(27+t.yParity);return r!==vt?i=wt.getChainIdV(r,t.v):BigInt(t.v)!==i&&g(!1,"tx.chainId/sig.v mismatch","sig",t),e.push(At(i)),e.push(At(t.r)),e.push(At(t.s)),ln(e)}function Ns(n,t){let e;try{if(e=Cn(t[0],"yParity"),e!==0&&e!==1)throw new Error("bad yParity")}catch{g(!1,"invalid yParity","yParity",t[0])}const r=Wt(t[1],32),i=Wt(t[2],32),o=wt.from({r,s:i,yParity:e});n.signature=o}function cw(n){const t=Fi(V(n).slice(1));g(Array.isArray(t)&&(t.length===9||t.length===12),"invalid field count for transaction type: 2","data",O(n));const e={type:2,chainId:it(t[0],"chainId"),nonce:Cn(t[1],"nonce"),maxPriorityFeePerGas:it(t[2],"maxPriorityFeePerGas"),maxFeePerGas:it(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:it(t[4],"gasLimit"),to:ui(t[5]),value:it(t[6],"value"),data:O(t[7]),accessList:Cs(t[8],"accessList")};return t.length===9||Ns(e,t.slice(9)),e}function _w(n,t){const e=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),X(n.maxFeePerGas||0,"maxFeePerGas"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data,Os(n.accessList||[])];return t&&(e.push(X(t.yParity,"yParity")),e.push(At(t.r)),e.push(At(t.s))),ct(["0x02",ln(e)])}function lw(n){const t=Fi(V(n).slice(1));g(Array.isArray(t)&&(t.length===8||t.length===11),"invalid field count for transaction type: 1","data",O(n));const e={type:1,chainId:it(t[0],"chainId"),nonce:Cn(t[1],"nonce"),gasPrice:it(t[2],"gasPrice"),gasLimit:it(t[3],"gasLimit"),to:ui(t[4]),value:it(t[5],"value"),data:O(t[6]),accessList:Cs(t[7],"accessList")};return t.length===8||Ns(e,t.slice(8)),e}function uw(n,t){const e=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.gasPrice||0,"gasPrice"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data,Os(n.accessList||[])];return t&&(e.push(X(t.yParity,"recoveryParam")),e.push(At(t.r)),e.push(At(t.s))),ct(["0x01",ln(e)])}function fw(n){let t=Fi(V(n).slice(1)),e="3",r=null;if(t.length===4&&Array.isArray(t[0])){e="3 (network format)";const o=t[1],c=t[2],_=t[3];g(Array.isArray(o),"invalid network format: blobs not an array","fields[1]",o),g(Array.isArray(c),"invalid network format: commitments not an array","fields[2]",c),g(Array.isArray(_),"invalid network format: proofs not an array","fields[3]",_),g(o.length===c.length,"invalid network format: blobs/commitments length mismatch","fields",t),g(o.length===_.length,"invalid network format: blobs/proofs length mismatch","fields",t),r=[];for(let l=0;l<t[1].length;l++)r.push({data:o[l],commitment:c[l],proof:_[l]});t=t[0]}g(Array.isArray(t)&&(t.length===11||t.length===14),`invalid field count for transaction type: ${e}`,"data",O(n));const i={type:3,chainId:it(t[0],"chainId"),nonce:Cn(t[1],"nonce"),maxPriorityFeePerGas:it(t[2],"maxPriorityFeePerGas"),maxFeePerGas:it(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:it(t[4],"gasLimit"),to:ui(t[5]),value:it(t[6],"value"),data:O(t[7]),accessList:Cs(t[8],"accessList"),maxFeePerBlobGas:it(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10]};r&&(i.blobs=r),g(i.to!=null,`invalid address for transaction type: ${e}`,"data",n),g(Array.isArray(i.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let o=0;o<i.blobVersionedHashes.length;o++)g(st(i.blobVersionedHashes[o],32),`invalid blobVersionedHash at index ${o}: must be length 32`,"data",n);return t.length===11||Ns(i,t.slice(11)),i}function hw(n,t,e){const r=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),X(n.maxFeePerGas||0,"maxFeePerGas"),X(n.gasLimit,"gasLimit"),n.to||ji,X(n.value,"value"),n.data,Os(n.accessList||[]),X(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),sw(n.blobVersionedHashes||[],"blobVersionedHashes")];return t&&(r.push(X(t.yParity,"yParity")),r.push(At(t.r)),r.push(At(t.s)),e)?ct(["0x03",ln([r,e.map(i=>i.data),e.map(i=>i.commitment),e.map(i=>i.proof)])]):ct(["0x03",ln(r)])}function pw(n){const t=Fi(V(n).slice(1));g(Array.isArray(t)&&(t.length===10||t.length===13),"invalid field count for transaction type: 4","data",O(n));const e={type:4,chainId:it(t[0],"chainId"),nonce:Cn(t[1],"nonce"),maxPriorityFeePerGas:it(t[2],"maxPriorityFeePerGas"),maxFeePerGas:it(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:it(t[4],"gasLimit"),to:ui(t[5]),value:it(t[6],"value"),data:O(t[7]),accessList:Cs(t[8],"accessList"),authorizationList:nw(t[9],"authorizationList")};return t.length===10||Ns(e,t.slice(10)),e}function dw(n,t){const e=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),X(n.maxFeePerGas||0,"maxFeePerGas"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data,Os(n.accessList||[]),iw(n.authorizationList||[])];return t&&(e.push(X(t.yParity,"yParity")),e.push(At(t.r)),e.push(At(t.s))),ct(["0x04",ln(e)])}class oe{#t;#e;#r;#n;#i;#o;#s;#a;#h;#_;#p;#d;#c;#l;#u;#f;#g;get type(){return this.#t}set type(t){switch(t){case null:this.#t=null;break;case 0:case"legacy":this.#t=0;break;case 1:case"berlin":case"eip-2930":this.#t=1;break;case 2:case"london":case"eip-1559":this.#t=2;break;case 3:case"cancun":case"eip-4844":this.#t=3;break;case 4:case"pectra":case"eip-7702":this.#t=4;break;default:g(!1,"unsupported transaction type","type",t)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const t=this.#e;return t==null&&this.type===3?ji:t}set to(t){this.#e=t==null?null:Y(t)}get nonce(){return this.#n}set nonce(t){this.#n=Z(t,"value")}get gasLimit(){return this.#i}set gasLimit(t){this.#i=L(t)}get gasPrice(){const t=this.#o;return t==null&&(this.type===0||this.type===1)?vt:t}set gasPrice(t){this.#o=t==null?null:L(t,"gasPrice")}get maxPriorityFeePerGas(){const t=this.#s;return t??(this.type===2||this.type===3?vt:null)}set maxPriorityFeePerGas(t){this.#s=t==null?null:L(t,"maxPriorityFeePerGas")}get maxFeePerGas(){const t=this.#a;return t??(this.type===2||this.type===3?vt:null)}set maxFeePerGas(t){this.#a=t==null?null:L(t,"maxFeePerGas")}get data(){return this.#r}set data(t){this.#r=O(t)}get value(){return this.#h}set value(t){this.#h=L(t,"value")}get chainId(){return this.#_}set chainId(t){this.#_=L(t)}get signature(){return this.#p||null}set signature(t){this.#p=t==null?null:wt.from(t)}get accessList(){const t=this.#d||null;return t??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(t){this.#d=t==null?null:Bn(t)}get authorizationList(){const t=this.#g||null;return t==null&&this.type===4?[]:t}set authorizationList(t){this.#g=t==null?null:t.map(e=>p_(e))}get maxFeePerBlobGas(){const t=this.#c;return t==null&&this.type===3?vt:t}set maxFeePerBlobGas(t){this.#c=t==null?null:L(t,"maxFeePerBlobGas")}get blobVersionedHashes(){let t=this.#l;return t==null&&this.type===3?[]:t}set blobVersionedHashes(t){if(t!=null){g(Array.isArray(t),"blobVersionedHashes must be an Array","value",t),t=t.slice();for(let e=0;e<t.length;e++)g(st(t[e],32),"invalid blobVersionedHash",`value[${e}]`,t[e])}this.#l=t}get blobs(){return this.#f==null?null:this.#f.map(t=>Object.assign({},t))}set blobs(t){if(t==null){this.#f=null;return}const e=[],r=[];for(let i=0;i<t.length;i++){const o=t[i];if(wo(o)){v(this.#u,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let c=V(o);if(g(c.length<=Vo,"blob is too large",`blobs[${i}]`,o),c.length!==Vo){const u=new Uint8Array(Vo);u.set(c),c=u}const _=this.#u.blobToKzgCommitment(c),l=O(this.#u.computeBlobKzgProof(c,_));e.push({data:O(c),commitment:O(_),proof:l}),r.push(w_(1,_))}else{const c=O(o.commitment);e.push({data:O(o.data),commitment:c,proof:O(o.proof)}),r.push(w_(1,c))}}this.#f=e,this.#l=r}get kzg(){return this.#u}set kzg(t){t==null?this.#u=null:this.#u=rw(t)}constructor(){this.#t=null,this.#e=null,this.#n=0,this.#i=vt,this.#o=null,this.#s=null,this.#a=null,this.#r="0x",this.#h=vt,this.#_=vt,this.#p=null,this.#d=null,this.#c=null,this.#l=null,this.#u=null,this.#f=null,this.#g=null}get hash(){return this.signature==null?null:dt(this.#w(!0,!1))}get unsignedHash(){return dt(this.unsignedSerialized)}get from(){return this.signature==null?null:d_(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Xr.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}#w(t,e){v(!t||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=t?this.signature:null;switch(this.inferType()){case 0:return aw(this,r);case 1:return uw(this,r);case 2:return _w(this,r);case 3:return hw(this,r,e?this.blobs:null);case 4:return dw(this,r)}v(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#w(!0,!0)}get unsignedSerialized(){return this.#w(!1,!1)}inferType(){const t=this.inferTypes();return t.indexOf(2)>=0?2:t.pop()}inferTypes(){const t=this.gasPrice!=null,e=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,i=this.#c!=null||this.#l;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&v(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),v(!e||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),v(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const o=[];return this.type!=null?o.push(this.type):this.authorizationList&&this.authorizationList.length?o.push(4):e?o.push(2):t?(o.push(1),r||o.push(0)):r?(o.push(1),o.push(2)):(i&&this.to||(o.push(0),o.push(1),o.push(2)),o.push(3)),o.sort(),o}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return oe.from(this)}toJSON(){const t=e=>e==null?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:t(this.gasLimit),gasPrice:t(this.gasPrice),maxPriorityFeePerGas:t(this.maxPriorityFeePerGas),maxFeePerGas:t(this.maxFeePerGas),value:t(this.value),chainId:t(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(t){if(t==null)return new oe;if(typeof t=="string"){const r=V(t);if(r[0]>=127)return oe.from(ow(r));switch(r[0]){case 1:return oe.from(lw(r));case 2:return oe.from(cw(r));case 3:return oe.from(fw(r));case 4:return oe.from(pw(r))}v(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const e=new oe;return t.type!=null&&(e.type=t.type),t.to!=null&&(e.to=t.to),t.nonce!=null&&(e.nonce=t.nonce),t.gasLimit!=null&&(e.gasLimit=t.gasLimit),t.gasPrice!=null&&(e.gasPrice=t.gasPrice),t.maxPriorityFeePerGas!=null&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas),t.maxFeePerGas!=null&&(e.maxFeePerGas=t.maxFeePerGas),t.maxFeePerBlobGas!=null&&(e.maxFeePerBlobGas=t.maxFeePerBlobGas),t.data!=null&&(e.data=t.data),t.value!=null&&(e.value=t.value),t.chainId!=null&&(e.chainId=t.chainId),t.signature!=null&&(e.signature=wt.from(t.signature)),t.accessList!=null&&(e.accessList=t.accessList),t.authorizationList!=null&&(e.authorizationList=t.authorizationList),t.blobVersionedHashes!=null&&(e.blobVersionedHashes=t.blobVersionedHashes),t.kzg!=null&&(e.kzg=t.kzg),t.blobs!=null&&(e.blobs=t.blobs),t.hash!=null&&(g(e.isSigned(),"unsigned transaction cannot define '.hash'","tx",t),g(e.hash===t.hash,"hash mismatch","tx",t)),t.from!=null&&(g(e.isSigned(),"unsigned transaction cannot define '.from'","tx",t),g(e.from.toLowerCase()===(t.from||"").toLowerCase(),"from mismatch","tx",t)),e}}function On(n){return dt(Lr(n))}var ww="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const g_=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),y_=4;function gw(n){let t=0;function e(){return n[t++]<<8|n[t++]}let r=e(),i=1,o=[0,1];for(let D=1;D<r;D++)o.push(i+=e());let c=e(),_=t;t+=c;let l=0,u=0;function p(){return l==0&&(u=u<<8|n[t++],l=8),u>>--l&1}const f=31,d=2**f,b=d>>>1,x=b>>1,E=d-1;let z=0;for(let D=0;D<f;D++)z=z<<1|p();let P=[],T=0,B=d;for(;;){let D=Math.floor(((z-T+1)*i-1)/B),C=0,j=r;for(;j-C>1;){let Q=C+j>>>1;D<o[Q]?j=Q:C=Q}if(C==0)break;P.push(C);let N=T+Math.floor(B*o[C]/i),q=T+Math.floor(B*o[C+1]/i)-1;for(;((N^q)&b)==0;)z=z<<1&E|p(),N=N<<1&E,q=q<<1&E|1;for(;N&~q&x;)z=z&b|z<<1&E>>>1|p(),N=N<<1^b,q=(q^b)<<1|b|1;T=N,B=1+q-N}let M=r-4;return P.map(D=>{switch(D-M){case 3:return M+65792+(n[_++]<<16|n[_++]<<8|n[_++]);case 2:return M+256+(n[_++]<<8|n[_++]);case 1:return M+n[_++];default:return D-1}})}function yw(n){let t=0;return()=>n[t++]}function b_(n){return yw(gw(bw(n)))}function bw(n){let t=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,o)=>t[i.charCodeAt(0)]=o);let e=n.length,r=new Uint8Array(6*e>>3);for(let i=0,o=0,c=0,_=0;i<e;i++)_=_<<6|t[n.charCodeAt(i)],c+=6,c>=8&&(r[o++]=_>>(c-=8));return r}function mw(n){return n&1?~n>>1:n>>1}function Aw(n,t){let e=Array(n);for(let r=0,i=0;r<n;r++)e[r]=i+=mw(t());return e}function Gi(n,t=0){let e=[];for(;;){let r=n(),i=n();if(!i)break;t+=r;for(let o=0;o<i;o++)e.push(t+o);t+=i+1}return e}function m_(n){return Hi(()=>{let t=Gi(n);if(t.length)return t})}function A_(n){let t=[];for(;;){let e=n();if(e==0)break;t.push(Ew(e,n))}for(;;){let e=n()-1;if(e<0)break;t.push(xw(e,n))}return t.flat()}function Hi(n){let t=[];for(;;){let e=n(t.length);if(!e)break;t.push(e)}return t}function E_(n,t,e){let r=Array(n).fill().map(()=>[]);for(let i=0;i<t;i++)Aw(n,e).forEach((o,c)=>r[c].push(o));return r}function Ew(n,t){let e=1+t(),r=t(),i=Hi(t);return E_(i.length,1+n,t).flatMap((c,_)=>{let[l,...u]=c;return Array(i[_]).fill().map((p,f)=>{let d=f*r;return[l+f*e,u.map(b=>b+d)]})})}function xw(n,t){let e=1+t();return E_(e,1+n,t).map(i=>[i[0],i.slice(1)])}function Rw(n){let t=[],e=Gi(n);return i(r([]),[]),t;function r(o){let c=n(),_=Hi(()=>{let l=Gi(n).map(u=>e[u]);if(l.length)return r(l)});return{S:c,B:_,Q:o}}function i({S:o,B:c},_,l){if(!(o&4&&l===_[_.length-1])){o&2&&(l=_[_.length-1]),o&1&&t.push(_);for(let u of c)for(let p of u.Q)i(u,[..._,p],l)}}}function zw(n){return n.toString(16).toUpperCase().padStart(2,"0")}function x_(n){return`{${zw(n)}}`}function Pw(n){let t=[];for(let e=0,r=n.length;e<r;){let i=n.codePointAt(e);e+=i<65536?1:2,t.push(i)}return t}function fi(n){let e=n.length;if(e<4096)return String.fromCodePoint(...n);let r=[];for(let i=0;i<e;)r.push(String.fromCodePoint(...n.slice(i,i+=4096)));return r.join("")}function vw(n,t){let e=n.length,r=e-t.length;for(let i=0;r==0&&i<e;i++)r=n[i]-t[i];return r}var kw="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";const Vi=44032,Fs=4352,Ds=4449,Us=4519,R_=19,z_=21,hi=28,Ls=z_*hi,Iw=R_*Ls,Sw=Vi+Iw,Tw=Fs+R_,Bw=Ds+z_,Cw=Us+hi;function Ki(n){return n>>24&255}function P_(n){return n&16777215}let Ko,v_,Qo,Ms;function Ow(){let n=b_(kw);Ko=new Map(m_(n).flatMap((t,e)=>t.map(r=>[r,e+1<<24]))),v_=new Set(Gi(n)),Qo=new Map,Ms=new Map;for(let[t,e]of A_(n)){if(!v_.has(t)&&e.length==2){let[r,i]=e,o=Ms.get(r);o||(o=new Map,Ms.set(r,o)),o.set(i,t)}Qo.set(t,e.reverse())}}function k_(n){return n>=Vi&&n<Sw}function Nw(n,t){if(n>=Fs&&n<Tw&&t>=Ds&&t<Bw)return Vi+(n-Fs)*Ls+(t-Ds)*hi;if(k_(n)&&t>Us&&t<Cw&&(n-Vi)%hi==0)return n+(t-Us);{let e=Ms.get(n);return e&&(e=e.get(t),e)?e:-1}}function I_(n){Ko||Ow();let t=[],e=[],r=!1;function i(o){let c=Ko.get(o);c&&(r=!0,o|=c),t.push(o)}for(let o of n)for(;;){if(o<128)t.push(o);else if(k_(o)){let c=o-Vi,_=c/Ls|0,l=c%Ls/hi|0,u=c%hi;i(Fs+_),i(Ds+l),u>0&&i(Us+u)}else{let c=Qo.get(o);c?e.push(...c):i(o)}if(!e.length)break;o=e.pop()}if(r&&t.length>1){let o=Ki(t[0]);for(let c=1;c<t.length;c++){let _=Ki(t[c]);if(_==0||o<=_){o=_;continue}let l=c-1;for(;;){let u=t[l+1];if(t[l+1]=t[l],t[l]=u,!l||(o=Ki(t[--l]),o<=_))break}o=Ki(t[c])}}return t}function Fw(n){let t=[],e=[],r=-1,i=0;for(let o of n){let c=Ki(o),_=P_(o);if(r==-1)c==0?r=_:t.push(_);else if(i>0&&i>=c)c==0?(t.push(r,...e),e.length=0,r=_):e.push(_),i=c;else{let l=Nw(r,_);l>=0?r=l:i==0&&c==0?(t.push(r),r=_):(e.push(_),i=c)}}return r>=0&&t.push(r,...e),t}function S_(n){return I_(n).map(P_)}function Dw(n){return Fw(I_(n))}const T_=45,B_=".",C_=65039,O_=1,js=n=>Array.from(n);function Qi(n,t){return n.P.has(t)||n.Q.has(t)}class Uw extends Array{get is_emoji(){return!0}}let Jo,N_,Nn,$o,F_,pi,Wo,di,Fn,D_,qo;function Zo(){if(Jo)return;let n=b_(ww);const t=()=>Gi(n),e=()=>new Set(t()),r=(p,f)=>f.forEach(d=>p.add(d));Jo=new Map(A_(n)),N_=e(),Nn=t(),$o=new Set(t().map(p=>Nn[p])),Nn=new Set(Nn),F_=e(),e();let i=m_(n),o=n();const c=()=>{let p=new Set;return t().forEach(f=>r(p,i[f])),r(p,t()),p};pi=Hi(p=>{let f=Hi(n).map(d=>d+96);if(f.length){let d=p>=o;f[0]-=32,f=fi(f),d&&(f=`Restricted[${f}]`);let b=c(),x=c(),E=!n();return{N:f,P:b,Q:x,M:E,R:d}}}),Wo=e(),di=new Map;let _=t().concat(js(Wo)).sort((p,f)=>p-f);_.forEach((p,f)=>{let d=n(),b=_[f]=d?_[f-d]:{V:[],M:new Map};b.V.push(p),Wo.has(p)||di.set(p,b)});for(let{V:p,M:f}of new Set(di.values())){let d=[];for(let x of p){let E=pi.filter(P=>Qi(P,x)),z=d.find(({G:P})=>E.some(T=>P.has(T)));z||(z={G:new Set,V:[]},d.push(z)),z.V.push(x),r(z.G,E)}let b=d.flatMap(x=>js(x.G));for(let{G:x,V:E}of d){let z=new Set(b.filter(P=>!x.has(P)));for(let P of E)f.set(P,z)}}Fn=new Set;let l=new Set;const u=p=>Fn.has(p)?l.add(p):Fn.add(p);for(let p of pi){for(let f of p.P)u(f);for(let f of p.Q)u(f)}for(let p of Fn)!di.has(p)&&!l.has(p)&&di.set(p,O_);r(Fn,S_(Fn)),D_=Rw(n).map(p=>Uw.from(p)).sort(vw),qo=new Map;for(let p of D_){let f=[qo];for(let d of p){let b=f.map(x=>{let E=x.get(d);return E||(E=new Map,x.set(d,E)),E});d===C_?f.push(...b):f=b}for(let d of f)d.V=p}}function Yo(n){return(U_(n)?"":`${Xo(Gs([n]))} `)+x_(n)}function Xo(n){return`"${n}"`}function Lw(n){if(n.length>=4&&n[2]==T_&&n[3]==T_)throw new Error(`invalid label extension: "${fi(n.slice(0,4))}"`)}function Mw(n){for(let e=n.lastIndexOf(95);e>0;)if(n[--e]!==95)throw new Error("underscore allowed only at start")}function jw(n){let t=n[0],e=g_.get(t);if(e)throw Ji(`leading ${e}`);let r=n.length,i=-1;for(let o=1;o<r;o++){t=n[o];let c=g_.get(t);if(c){if(i==o)throw Ji(`${e} + ${c}`);i=o+1,e=c}}if(i==r)throw Ji(`trailing ${e}`)}function Gs(n,t=1/0,e=x_){let r=[];Gw(n[0])&&r.push("◌"),n.length>t&&(t>>=1,n=[...n.slice(0,t),8230,...n.slice(-t)]);let i=0,o=n.length;for(let c=0;c<o;c++){let _=n[c];U_(_)&&(r.push(fi(n.slice(i,c))),r.push(e(_)),i=c+1)}return r.push(fi(n.slice(i,o))),r.join("")}function Gw(n){return Zo(),Nn.has(n)}function U_(n){return Zo(),F_.has(n)}function Hw(n){return Jw(Vw(n,Dw,qw))}function Vw(n,t,e){if(!n)return[];Zo();let r=0;return n.split(B_).map(i=>{let o=Pw(i),c={input:o,offset:r};r+=o.length+1;try{let _=c.tokens=Ww(o,t,e),l=_.length,u;if(!l)throw new Error("empty label");let p=c.output=_.flat();if(Mw(p),!(c.emoji=l>1||_[0].is_emoji)&&p.every(d=>d<128))Lw(p),u="ASCII";else{let d=_.flatMap(b=>b.is_emoji?[]:b);if(!d.length)u="Emoji";else{if(Nn.has(p[0]))throw Ji("leading combining mark");for(let E=1;E<l;E++){let z=_[E];if(!z.is_emoji&&Nn.has(z[0]))throw Ji(`emoji + combining mark: "${fi(_[E-1])} + ${Gs([z[0]])}"`)}jw(p);let b=js(new Set(d)),[x]=Qw(b);$w(x,d),Kw(x,b),u=x.N}}c.type=u}catch(_){c.error=_}return c})}function Kw(n,t){let e,r=[];for(let i of t){let o=di.get(i);if(o===O_)return;if(o){let c=o.M.get(i);if(e=e?e.filter(_=>c.has(_)):js(c),!e.length)return}else r.push(i)}if(e){for(let i of e)if(r.every(o=>Qi(i,o)))throw new Error(`whole-script confusable: ${n.N}/${i.N}`)}}function Qw(n){let t=pi;for(let e of n){let r=t.filter(i=>Qi(i,e));if(!r.length)throw pi.some(i=>Qi(i,e))?M_(t[0],e):L_(e);if(t=r,r.length==1)break}return t}function Jw(n){return n.map(({input:t,error:e,output:r})=>{if(e){let i=e.message;throw new Error(n.length==1?i:`Invalid label ${Xo(Gs(t,63))}: ${i}`)}return fi(r)}).join(B_)}function L_(n){return new Error(`disallowed character: ${Yo(n)}`)}function M_(n,t){let e=Yo(t),r=pi.find(i=>i.P.has(t));return r&&(e=`${r.N} ${e}`),new Error(`illegal mixture: ${n.N} + ${e}`)}function Ji(n){return new Error(`illegal placement: ${n}`)}function $w(n,t){for(let e of t)if(!Qi(n,e))throw M_(n,e);if(n.M){let e=S_(t);for(let r=1,i=e.length;r<i;r++)if($o.has(e[r])){let o=r+1;for(let c;o<i&&$o.has(c=e[o]);o++)for(let _=r;_<o;_++)if(e[_]==c)throw new Error(`duplicate non-spacing marks: ${Yo(c)}`);if(o-r>y_)throw new Error(`excessive non-spacing marks: ${Xo(Gs(e.slice(r-1,o)))} (${o-r}/${y_})`);r=o}}}function Ww(n,t,e){let r=[],i=[];for(n=n.slice().reverse();n.length;){let o=Zw(n);if(o)i.length&&(r.push(t(i)),i=[]),r.push(e(o));else{let c=n.pop();if(Fn.has(c))i.push(c);else{let _=Jo.get(c);if(_)i.push(..._);else if(!N_.has(c))throw L_(c)}}}return i.length&&r.push(t(i)),r}function qw(n){return n.filter(t=>t!=C_)}function Zw(n,t){let e=qo,r,i=n.length;for(;i&&(e=e.get(n[--i]),!!e);){let{V:o}=e;o&&(r=o,n.length=i)}return r}const j_=new Uint8Array(32);j_.fill(0);function G_(n){return g(n.length!==0,"invalid ENS name; empty component","comp",n),n}function H_(n){const t=Lr(Yw(n)),e=[];if(n.length===0)return e;let r=0;for(let i=0;i<t.length;i++)t[i]===46&&(e.push(G_(t.slice(r,i))),r=i+1);return g(r<t.length,"invalid ENS name; empty component","name",n),e.push(G_(t.slice(r))),e}function Yw(n){try{if(n.length===0)throw new Error("empty label");return Hw(n)}catch(t){g(!1,`invalid ENS name (${t.message})`,"name",n)}}function ta(n){g(typeof n=="string","invalid ENS name; not a string","name",n),g(n.length,"invalid ENS name (empty label)","name",n);let t=j_;const e=H_(n);for(;e.length;)t=dt(ct([t,dt(e.pop())]));return O(t)}function Xw(n,t){const e=t;return g(e<=255,"DNS encoded label cannot exceed 255","length",e),O(ct(H_(n).map(r=>{g(r.length<=e,`label ${JSON.stringify(n)} exceeds ${e} bytes`,"name",n);const i=new Uint8Array(r.length+1);return i.set(r,1),i[0]=i.length-1,i})))+"00"}const tg=new RegExp("^bytes([0-9]+)$"),eg=new RegExp("^(u?int)([0-9]*)$"),rg=new RegExp("^(.*)\\[([0-9]*)\\]$");function V_(n,t,e){switch(n){case"address":return V(e?Wt(t,32):Y(t));case"string":return Lr(t);case"bytes":return V(t);case"bool":return t=t?"0x01":"0x00",V(e?Wt(t,32):t)}let r=n.match(eg);if(r){let i=r[1]==="int",o=parseInt(r[2]||"256");return g((!r[2]||r[2]===String(o))&&o%8===0&&o!==0&&o<=256,"invalid number type","type",n),e&&(o=256),i&&(t=go(t,o)),V(Wt(At(t),o/8))}if(r=n.match(tg),r){const i=parseInt(r[1]);return g(String(i)===r[1]&&i!==0&&i<=32,"invalid bytes type","type",n),g(vn(t)===i,`invalid value for ${n}`,"value",t),e?V(Wa(t,32)):t}if(r=n.match(rg),r&&Array.isArray(t)){const i=r[1],o=parseInt(r[2]||String(t.length));g(o===t.length,`invalid array length for ${n}`,"value",t);const c=[];return t.forEach(function(_){c.push(V_(i,_,!0))}),V(ct(c))}g(!1,"invalid type","type",n)}function K_(n,t){g(n.length===t.length,"wrong number of values; expected ${ types.length }","values",t);const e=[];return n.forEach(function(r,i){e.push(V_(r,t[i]))}),O(ct(e))}const Q_=new Uint8Array(32);Q_.fill(0);const ng=BigInt(-1),J_=BigInt(0),$_=BigInt(1),ig=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function sg(n){const t=V(n),e=t.length%32;return e?ct([t,Q_.slice(e)]):O(t)}const og=cn($_,32),ag=cn(J_,32),W_={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ea=["name","version","chainId","verifyingContract","salt"];function q_(n){return function(t){return g(typeof t=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,t),t}}const cg={name:q_("name"),version:q_("version"),chainId:function(n){const t=L(n,"domain.chainId");return g(t>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(t)?Number(t):ie(t)},verifyingContract:function(n){try{return Y(n).toLowerCase()}catch{}g(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const t=V(n,"domain.salt");return g(t.length===32,'invalid domain value "salt"',"domain.salt",n),O(t)}};function ra(n){{const t=n.match(/^(u?)int(\d+)$/);if(t){const e=t[1]==="",r=parseInt(t[2]);g(r%8===0&&r!==0&&r<=256&&t[2]===String(r),"invalid numeric width","type",n);const i=Ni(ig,e?r-1:r),o=e?(i+$_)*ng:J_;return function(c){const _=L(c,"value");return g(_>=o&&_<=i,`value out-of-bounds for ${n}`,"value",_),cn(e?go(_,256):_,32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const e=parseInt(t[1]);return g(e!==0&&e<=32&&t[1]===String(e),"invalid bytes width","type",n),function(r){const i=V(r);return g(i.length===e,`invalid length for ${n}`,"value",r),sg(r)}}}switch(n){case"address":return function(t){return Wt(Y(t),32)};case"bool":return function(t){return t?og:ag};case"bytes":return function(t){return dt(t)};case"string":return function(t){return On(t)}}return null}function Z_(n,t){return`${n}(${t.map(({name:e,type:r})=>r+" "+e).join(",")})`}function Hs(n){const t=n.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return t?{base:t[1],index:t[2]+t[4],array:{base:t[1],prefix:t[1]+t[2],count:t[5]?parseInt(t[5]):-1}}:{base:n}}class Lt{primaryType;#t;get types(){return JSON.parse(this.#t)}#e;#r;constructor(t){this.#e=new Map,this.#r=new Map;const e=new Map,r=new Map,i=new Map,o={};Object.keys(t).forEach(l=>{o[l]=t[l].map(({name:u,type:p})=>{let{base:f,index:d}=Hs(p);return f==="int"&&!t.int&&(f="int256"),f==="uint"&&!t.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),e.set(l,new Set),r.set(l,[]),i.set(l,new Set)}),this.#t=JSON.stringify(o);for(const l in o){const u=new Set;for(const p of o[l]){g(!u.has(p.name),`duplicate variable name ${JSON.stringify(p.name)} in ${JSON.stringify(l)}`,"types",t),u.add(p.name);const f=Hs(p.type).base;g(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",t),!ra(f)&&(g(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",t),r.get(f).push(l),e.get(l).add(f))}}const c=Array.from(r.keys()).filter(l=>r.get(l).length===0);g(c.length!==0,"missing primary type","types",t),g(c.length===1,`ambiguous primary types or unused types: ${c.map(l=>JSON.stringify(l)).join(", ")}`,"types",t),H(this,{primaryType:c[0]});function _(l,u){g(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",t),u.add(l);for(const p of e.get(l))if(r.has(p)){_(p,u);for(const f of u)i.get(f).add(p)}u.delete(l)}_(this.primaryType,new Set);for(const[l,u]of i){const p=Array.from(u);p.sort(),this.#e.set(l,Z_(l,o[l])+p.map(f=>Z_(f,o[f])).join(""))}}getEncoder(t){let e=this.#r.get(t);return e||(e=this.#n(t),this.#r.set(t,e)),e}#n(t){{const i=ra(t);if(i)return i}const e=Hs(t).array;if(e){const i=e.prefix,o=this.getEncoder(i);return c=>{g(e.count===-1||e.count===c.length,`array length mismatch; expected length ${e.count}`,"value",c);let _=c.map(o);return this.#e.has(i)&&(_=_.map(dt)),dt(ct(_))}}const r=this.types[t];if(r){const i=On(this.#e.get(t));return o=>{const c=r.map(({name:_,type:l})=>{const u=this.getEncoder(l)(o[_]);return this.#e.has(l)?dt(u):u});return c.unshift(i),ct(c)}}g(!1,`unknown type: ${t}`,"type",t)}encodeType(t){const e=this.#e.get(t);return g(e,`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return dt(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(ra(t))return r(t,e);const i=Hs(t).array;if(i)return g(i.count===-1||i.count===e.length,`array length mismatch; expected length ${i.count}`,"value",e),e.map(c=>this._visit(i.prefix,c,r));const o=this.types[t];if(o)return o.reduce((c,{name:_,type:l})=>(c[_]=this._visit(l,e[_],r),c),{});g(!1,`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Lt(t)}static getPrimaryType(t){return Lt.from(t).primaryType}static hashStruct(t,e,r){return Lt.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){if(t[r]==null)continue;const i=W_[r];g(i,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort((r,i)=>ea.indexOf(r.name)-ea.indexOf(i.name)),Lt.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return ct(["0x1901",Lt.hashDomain(t),Lt.from(e).hash(r)])}static hash(t,e,r){return dt(Lt.encode(t,e,r))}static async resolveNames(t,e,r,i){t=Object.assign({},t);for(const _ in t)t[_]==null&&delete t[_];const o={};t.verifyingContract&&!st(t.verifyingContract,20)&&(o[t.verifyingContract]="0x");const c=Lt.from(e);c.visit(r,(_,l)=>(_==="address"&&!st(l,20)&&(o[l]="0x"),l));for(const _ in o)o[_]=await i(_);return t.verifyingContract&&o[t.verifyingContract]&&(t.verifyingContract=o[t.verifyingContract]),r=c.visit(r,(_,l)=>_==="address"&&o[l]?o[l]:l),{domain:t,value:r}}static getPayload(t,e,r){Lt.hashDomain(t);const i={},o=[];ea.forEach(l=>{const u=t[l];u!=null&&(i[l]=cg[l](u),o.push({name:l,type:W_[l]}))});const c=Lt.from(e);e=c.types;const _=Object.assign({},e);return g(_.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",e),_.EIP712Domain=o,c.encode(r),{types:_,domain:i,primaryType:c.primaryType,message:c.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return O(V(u));if(l.match(/^u?int/))return L(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return g(typeof u=="string","invalid string","value",u),u}g(!1,"unsupported type","type",l)})}}}function Y_(n,t,e,r){return d_(Lt.hash(n,t,e),r)}function Nt(n){const t=new Set;return n.forEach(e=>t.add(e)),Object.freeze(t)}const _g=Nt("external public payable override".split(" ")),X_="constant external internal payable private public pure view override",lg=Nt(X_.split(" ")),tl="constructor error event fallback function receive struct",el=Nt(tl.split(" ")),rl="calldata memory storage payable indexed",ug=Nt(rl.split(" ")),fg=[tl,rl,"tuple returns",X_].join(" "),hg=Nt(fg.split(" ")),pg={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},dg=new RegExp("^(\\s*)"),wg=new RegExp("^([0-9]+)"),gg=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),nl=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),il=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class Yt{#t;#e;get offset(){return this.#t}get length(){return this.#e.length-this.#t}constructor(t){this.#t=0,this.#e=t.slice()}clone(){return new Yt(this.#e)}reset(){this.#t=0}#r(t=0,e=0){return new Yt(this.#e.slice(t,e).map(r=>Object.freeze(Object.assign({},r,{match:r.match-t,linkBack:r.linkBack-t,linkNext:r.linkNext-t}))))}popKeyword(t){const e=this.peek();if(e.type!=="KEYWORD"||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){const e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){const t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");const e=this.#r(this.#t+1,t.match+1);return this.#t=t.match+1,e}popParams(){const t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");const e=[];for(;this.#t<t.match-1;){const r=this.peek().linkNext;e.push(this.#r(this.#t+1,r)),this.#t=r}return this.#t=t.match+1,e}peek(){if(this.#t>=this.#e.length)throw new Error("out-of-bounds");return this.#e[this.#t]}peekKeyword(t){const e=this.peekType("KEYWORD");return e!=null&&t.has(e)?e:null}peekType(t){if(this.length===0)return null;const e=this.peek();return e.type===t?e.text:null}pop(){const t=this.peek();return this.#t++,t}toString(){const t=[];for(let e=this.#t;e<this.#e.length;e++){const r=this.#e[e];t.push(`${r.type}:${r.text}`)}return`<TokenString ${t.join(" ")}>`}}function wn(n){const t=[],e=c=>{const _=o<n.length?JSON.stringify(n[o]):"$EOI";throw new Error(`invalid token ${_} at ${o}: ${c}`)};let r=[],i=[],o=0;for(;o<n.length;){let c=n.substring(o),_=c.match(dg);_&&(o+=_[1].length,c=n.substring(o));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:o,value:-1};t.push(l);let u=pg[c[0]]||"";if(u){if(l.type=u,l.text=c[0],o++,u==="OPEN_PAREN")r.push(t.length-1),i.push(t.length-1);else if(u=="CLOSE_PAREN")r.length===0&&e("no matching open bracket"),l.match=r.pop(),t[l.match].match=t.length-1,l.depth--,l.linkBack=i.pop(),t[l.linkBack].linkNext=t.length-1;else if(u==="COMMA")l.linkBack=i.pop(),t[l.linkBack].linkNext=t.length-1,i.push(t.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let p=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){const f=t.pop().text;p=f+p,t[t.length-1].value=Z(f)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=p}continue}if(_=c.match(gg),_){if(l.text=_[1],o+=l.text.length,hg.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(il)){l.type="TYPE";continue}l.type="ID";continue}if(_=c.match(wg),_){l.text=_[1],l.type="NUMBER",o+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(c[0])} at position ${o}`)}return new Yt(t.map(c=>Object.freeze(c)))}function sl(n,t){let e=[];for(const r in t.keys())n.has(r)&&e.push(r);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}function Vs(n,t){if(t.peekKeyword(el)){const e=t.pop().text;if(e!==n)throw new Error(`expected ${n}, got ${e}`)}return t.popType("ID")}function rn(n,t){const e=new Set;for(;;){const r=n.peekType("KEYWORD");if(r==null||t&&!t.has(r))break;if(n.pop(),e.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);e.add(r)}return Object.freeze(e)}function ol(n){let t=rn(n,lg);return sl(t,Nt("constant payable nonpayable".split(" "))),sl(t,Nt("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}function nn(n,t){return n.popParams().map(e=>ot.from(e,t))}function al(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return L(n.pop().text);throw new Error("invalid gas")}return null}function Dn(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const yg=new RegExp(/^(.*)\[([0-9]*)\]$/);function cl(n){const t=n.match(il);if(g(t,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(t[2]){const e=parseInt(t[2]);g(e!==0&&e<=32,"invalid bytes length","type",n)}else if(t[3]){const e=parseInt(t[3]);g(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",n)}return n}const ft={},Mt=Symbol.for("_ethers_internal"),_l="_ParamTypeInternal",ll="_ErrorInternal",ul="_EventInternal",fl="_ConstructorInternal",hl="_FallbackInternal",pl="_FunctionInternal",dl="_StructInternal";class ot{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,r,i,o,c,_,l){if(bs(t,ft,"ParamType"),Object.defineProperty(this,Mt,{value:_l}),c&&(c=Object.freeze(c.slice())),i==="array"){if(_==null||l==null)throw new Error("")}else if(_!=null||l!=null)throw new Error("");if(i==="tuple"){if(c==null)throw new Error("")}else if(c!=null)throw new Error("");H(this,{name:e,type:r,baseType:i,indexed:o,components:c,arrayLength:_,arrayChildren:l})}format(t){if(t==null&&(t="sighash"),t==="json"){const r=this.name||"";if(this.isArray()){const o=JSON.parse(this.arrayChildren.format("json"));return o.name=r,o.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(o)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(o=>JSON.parse(o.format(t)))),JSON.stringify(i)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(r=>r.format(t)).join(t==="full"?", ":",")+")":e+=this.type,t!=="sighash"&&(this.indexed===!0&&(e+=" indexed"),t==="full"&&this.name&&(e+=" "+this.name)),e}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return t.map(i=>r.arrayChildren.walk(i,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 r=this;return t.map((i,o)=>r.components[o].walk(i,e))}return e(this.type,t)}#t(t,e,r,i){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const c=this.arrayChildren,_=e.slice();_.forEach((l,u)=>{c.#t(t,l,r,p=>{_[u]=p})}),i(_);return}if(this.isTuple()){const c=this.components;let _;if(Array.isArray(e))_=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");_=c.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in e))throw new Error(`missing value for component ${l.name}`);return e[l.name]})}if(_.length!==this.components.length)throw new Error("array is wrong length");_.forEach((l,u)=>{c[u].#t(t,l,r,p=>{_[u]=p})}),i(_);return}const o=r(this.type,e);o.then?t.push(async function(){i(await o)}()):i(o)}async walkAsync(t,e){const r=[],i=[t];return this.#t(r,t,e,o=>{i[0]=o}),r.length&&await Promise.all(r),i[0]}static from(t,e){if(ot.isParamType(t))return t;if(typeof t=="string")try{return ot.from(wn(t),e)}catch{g(!1,"invalid param type","obj",t)}else if(t instanceof Yt){let _="",l="",u=null;rn(t,Nt(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(l="tuple",u=t.popParams().map(E=>ot.from(E)),_=`tuple(${u.map(E=>E.format()).join(",")})`):(_=cl(t.popType("TYPE")),l=_);let p=null,f=null;for(;t.length&&t.peekType("BRACKET");){const E=t.pop();p=new ot(ft,"",_,l,null,u,f,p),f=E.value,_+=E.text,l="array",u=null}let d=null;if(rn(t,ug).has("indexed")){if(!e)throw new Error("");d=!0}const x=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new ot(ft,x,_,l,d,u,f,p)}const r=t.name;g(!r||typeof r=="string"&&r.match(nl),"invalid name","obj.name",r);let i=t.indexed;i!=null&&(g(e,"parameter cannot be indexed","obj.indexed",t.indexed),i=!!i);let o=t.type,c=o.match(yg);if(c){const _=parseInt(c[2]||"-1"),l=ot.from({type:c[1],components:t.components});return new ot(ft,r||"",o,"array",i,null,_,l)}if(o==="tuple"||o.startsWith("tuple(")||o.startsWith("(")){const _=t.components!=null?t.components.map(u=>ot.from(u)):null;return new ot(ft,r||"",o,"tuple",i,_,null,null)}return o=cl(t.type),new ot(ft,r||"",o,o,i,null,null,null)}static isParamType(t){return t&&t[Mt]===_l}}class Un{type;inputs;constructor(t,e,r){bs(t,ft,"Fragment"),r=Object.freeze(r.slice()),H(this,{type:e,inputs:r})}static from(t){if(typeof t=="string"){try{Un.from(JSON.parse(t))}catch{}return Un.from(wn(t))}if(t instanceof Yt)switch(t.peekKeyword(el)){case"constructor":return sn.from(t);case"error":return jt.from(t);case"event":return Gr.from(t);case"fallback":case"receive":return on.from(t);case"function":return Hr.from(t);case"struct":return Ln.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return sn.from(t);case"error":return jt.from(t);case"event":return Gr.from(t);case"fallback":case"receive":return on.from(t);case"function":return Hr.from(t);case"struct":return Ln.from(t)}v(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}g(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return sn.isFragment(t)}static isError(t){return jt.isFragment(t)}static isEvent(t){return Gr.isFragment(t)}static isFunction(t){return Hr.isFragment(t)}static isStruct(t){return Ln.isFragment(t)}}class Ks extends Un{name;constructor(t,e,r,i){super(t,e,i),g(typeof r=="string"&&r.match(nl),"invalid identifier","name",r),i=Object.freeze(i.slice()),H(this,{name:r})}}function $i(n,t){return"("+t.map(e=>e.format(n)).join(n==="full"?", ":",")+")"}class jt extends Ks{constructor(t,e,r){super(t,"error",e,r),Object.defineProperty(this,Mt,{value:ll})}get selector(){return On(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+$i(t,this.inputs)),e.join(" ")}static from(t){if(jt.isFragment(t))return t;if(typeof t=="string")return jt.from(wn(t));if(t instanceof Yt){const e=Vs("error",t),r=nn(t);return Dn(t),new jt(ft,e,r)}return new jt(ft,t.name,t.inputs?t.inputs.map(ot.from):[])}static isFragment(t){return t&&t[Mt]===ll}}class Gr extends Ks{anonymous;constructor(t,e,r,i){super(t,"event",e,r),Object.defineProperty(this,Mt,{value:ul}),H(this,{anonymous:i})}get topicHash(){return On(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+$i(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(i=>ot.from(i)),new Gr(ft,t,e,!1).topicHash}static from(t){if(Gr.isFragment(t))return t;if(typeof t=="string")try{return Gr.from(wn(t))}catch{g(!1,"invalid event fragment","obj",t)}else if(t instanceof Yt){const e=Vs("event",t),r=nn(t,!0),i=!!rn(t,Nt(["anonymous"])).has("anonymous");return Dn(t),new Gr(ft,e,r,i)}return new Gr(ft,t.name,t.inputs?t.inputs.map(e=>ot.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[Mt]===ul}}class sn extends Un{payable;gas;constructor(t,e,r,i,o){super(t,e,r),Object.defineProperty(this,Mt,{value:fl}),H(this,{payable:i,gas:o})}format(t){if(v(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const e=[`constructor${$i(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(sn.isFragment(t))return t;if(typeof t=="string")try{return sn.from(wn(t))}catch{g(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Yt){rn(t,Nt(["constructor"]));const e=nn(t),r=!!rn(t,_g).has("payable"),i=al(t);return Dn(t),new sn(ft,"constructor",e,r,i)}return new sn(ft,"constructor",t.inputs?t.inputs.map(ot.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[Mt]===fl}}class on extends Un{payable;constructor(t,e,r){super(t,"fallback",e),Object.defineProperty(this,Mt,{value:hl}),H(this,{payable:r})}format(t){const e=this.inputs.length===0?"receive":"fallback";if(t==="json"){const r=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:r})}return`${e}()${this.payable?" payable":""}`}static from(t){if(on.isFragment(t))return t;if(typeof t=="string")try{return on.from(wn(t))}catch{g(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Yt){const e=t.toString(),r=t.peekKeyword(Nt(["fallback","receive"]));if(g(r,"type must be fallback or receive","obj",e),t.popKeyword(Nt(["fallback","receive"]))==="receive"){const _=nn(t);return g(_.length===0,"receive cannot have arguments","obj.inputs",_),rn(t,Nt(["payable"])),Dn(t),new on(ft,[],!0)}let o=nn(t);o.length?g(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(_=>_.format("minimal")).join(", ")):o=[ot.from("bytes")];const c=ol(t);if(g(c==="nonpayable"||c==="payable","fallback cannot be constants","obj.stateMutability",c),rn(t,Nt(["returns"])).has("returns")){const _=nn(t);g(_.length===1&&_[0].type==="bytes","invalid fallback outputs","obj.outputs",_.map(l=>l.format("minimal")).join(", "))}return Dn(t),new on(ft,o,c==="payable")}if(t.type==="receive")return new on(ft,[],!0);if(t.type==="fallback"){const e=[ot.from("bytes")],r=t.stateMutability==="payable";return new on(ft,e,r)}g(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[Mt]===hl}}class Hr extends Ks{constant;outputs;stateMutability;payable;gas;constructor(t,e,r,i,o,c){super(t,"function",e,i),Object.defineProperty(this,Mt,{value:pl}),o=Object.freeze(o.slice()),H(this,{constant:r==="view"||r==="pure",gas:c,outputs:o,payable:r==="payable",stateMutability:r})}get selector(){return On(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});const e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+$i(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push($i(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(i=>ot.from(i)),new Hr(ft,t,"view",e,[],null).selector}static from(t){if(Hr.isFragment(t))return t;if(typeof t=="string")try{return Hr.from(wn(t))}catch{g(!1,"invalid function fragment","obj",t)}else if(t instanceof Yt){const r=Vs("function",t),i=nn(t),o=ol(t);let c=[];rn(t,Nt(["returns"])).has("returns")&&(c=nn(t));const _=al(t);return Dn(t),new Hr(ft,r,o,i,c,_)}let e=t.stateMutability;return e==null&&(e="payable",typeof t.constant=="boolean"?(e="view",t.constant||(e="payable",typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable")),new Hr(ft,t.name,e,t.inputs?t.inputs.map(ot.from):[],t.outputs?t.outputs.map(ot.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[Mt]===pl}}class Ln extends Ks{constructor(t,e,r){super(t,"struct",e,r),Object.defineProperty(this,Mt,{value:dl})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return Ln.from(wn(t))}catch{g(!1,"invalid struct fragment","obj",t)}else if(t instanceof Yt){const e=Vs("struct",t),r=nn(t);return Dn(t),new Ln(ft,e,r)}return new Ln(ft,t.name,t.inputs?t.inputs.map(ot.from):[])}static isFragment(t){return t&&t[Mt]===dl}}const ae=new Map;ae.set(0,"GENERIC_PANIC"),ae.set(1,"ASSERT_FALSE"),ae.set(17,"OVERFLOW"),ae.set(18,"DIVIDE_BY_ZERO"),ae.set(33,"ENUM_RANGE_ERROR"),ae.set(34,"BAD_STORAGE_DATA"),ae.set(49,"STACK_UNDERFLOW"),ae.set(50,"ARRAY_RANGE_ERROR"),ae.set(65,"OUT_OF_MEMORY"),ae.set(81,"UNINITIALIZED_FUNCTION_CALL");const bg=new RegExp(/^bytes([0-9]*)$/),mg=new RegExp(/^(u?int)([0-9]*)$/);let na=null,wl=1024;function Ag(n,t,e,r){let i="missing revert data",o=null;const c=null;let _=null;if(e){i="execution reverted";const u=V(e);if(e=O(e),u.length===0)i+=" (no data present; likely require(false) occurred",o="require(false)";else if(u.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(O(u.slice(0,4))==="0x08c379a0")try{o=r.decode(["string"],u.slice(4))[0],_={signature:"Error(string)",name:"Error",args:[o]},i+=`: ${JSON.stringify(o)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(O(u.slice(0,4))==="0x4e487b71")try{const p=Number(r.decode(["uint256"],u.slice(4))[0]);_={signature:"Panic(uint256)",name:"Panic",args:[p]},o=`Panic due to ${ae.get(p)||"UNKNOWN"}(${p})`,i+=`: ${o}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const l={to:t.to?Y(t.to):null,data:t.data||"0x"};return t.from&&(l.from=Y(t.from)),lt(i,"CALL_EXCEPTION",{action:n,data:e,reason:o,transaction:l,invocation:c,revert:_})}class gn{#t(t){if(t.isArray())return new Ld(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new Bs(t.components.map(r=>this.#t(r)),t.name);switch(t.baseType){case"address":return new Dd(t.name);case"bool":return new Md(t.name);case"string":return new Wd(t.name);case"bytes":return new jd(t.name);case"":return new Vd(t.name)}let e=t.type.match(mg);if(e){let r=parseInt(e[2]||"256");return g(r!==0&&r<=256&&r%8===0,"invalid "+e[1]+" bit length","param",t),new $d(r/8,e[1]==="int",t.name)}if(e=t.type.match(bg),e){let r=parseInt(e[1]);return g(r!==0&&r<=32,"invalid bytes length","param",t),new Gd(r,t.name)}g(!1,"invalid type","type",t.type)}getDefaultValue(t){const e=t.map(i=>this.#t(ot.from(i)));return new Bs(e,"_").defaultValue()}encode(t,e){Ka(e.length,t.length,"types/values length mismatch");const r=t.map(c=>this.#t(ot.from(c))),i=new Bs(r,"_"),o=new Eo;return i.encode(o,e),o.data}decode(t,e,r){const i=t.map(c=>this.#t(ot.from(c)));return new Bs(i,"_").decode(new xo(e,r,wl))}static _setDefaultMaxInflation(t){g(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),wl=t}static defaultAbiCoder(){return na==null&&(na=new gn),na}static getBuiltinCallException(t,e,r){return Ag(t,e,r,gn.defaultAbiCoder())}}class Eg{fragment;name;signature;topic;args;constructor(t,e,r){const i=t.name,o=t.format();H(this,{fragment:t,name:i,signature:o,topic:e,args:r})}}class xg{fragment;name;args;signature;selector;value;constructor(t,e,r,i){const o=t.name,c=t.format();H(this,{fragment:t,name:o,args:r,signature:c,selector:e,value:i})}}class Rg{fragment;name;args;signature;selector;constructor(t,e,r){const i=t.name,o=t.format();H(this,{fragment:t,name:i,args:r,signature:o,selector:e})}}class gl{hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){H(this,{hash:t,_isIndexed:!0})}}const yl={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"},bl={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let t="unknown panic code";return n>=0&&n<=255&&yl[n.toString()]&&(t=yl[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${t})`}}};class Mn{fragments;deploy;fallback;receive;#t;#e;#r;#n;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#r=new Map,this.#t=new Map,this.#e=new Map;const r=[];for(const c of e)try{r.push(Un.from(c))}catch(_){console.log(`[Warning] Invalid Fragment ${JSON.stringify(c)}:`,_.message)}H(this,{fragments:Object.freeze(r)});let i=null,o=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((c,_)=>{let l;switch(c.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}H(this,{deploy:c});return;case"fallback":c.inputs.length===0?o=!0:(g(!i||c.payable!==i.payable,"conflicting fallback fragments",`fragments[${_}]`,c),i=c,o=i.payable);return;case"function":l=this.#r;break;case"event":l=this.#e;break;case"error":l=this.#t;break;default:return}const u=c.format();l.has(u)||l.set(u,c)}),this.deploy||H(this,{deploy:sn.from("constructor()")}),H(this,{fallback:i,receive:o})}format(t){const e=t?"minimal":"full";return this.fragments.map(i=>i.format(e))}formatJson(){const t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return gn.defaultAbiCoder()}#i(t,e,r){if(st(t)){const o=t.toLowerCase();for(const c of this.#r.values())if(o===c.selector)return c;return null}if(t.indexOf("(")===-1){const o=[];for(const[c,_]of this.#r)c.split("(")[0]===t&&o.push(_);if(e){const c=e.length>0?e[e.length-1]:null;let _=e.length,l=!0;gt.isTyped(c)&&c.type==="overrides"&&(l=!1,_--);for(let u=o.length-1;u>=0;u--){const p=o[u].inputs.length;p!==_&&(!l||p!==_-1)&&o.splice(u,1)}for(let u=o.length-1;u>=0;u--){const p=o[u].inputs;for(let f=0;f<e.length;f++)if(gt.isTyped(e[f])){if(f>=p.length){if(e[f].type==="overrides")continue;o.splice(u,1);break}if(e[f].type!==p[f].baseType){o.splice(u,1);break}}}}if(o.length===1&&e&&e.length!==o[0].inputs.length){const c=e[e.length-1];(c==null||Array.isArray(c)||typeof c!="object")&&o.splice(0,1)}if(o.length===0)return null;if(o.length>1&&r){const c=o.map(_=>JSON.stringify(_.format())).join(", ");g(!1,`ambiguous function description (i.e. matches ${c})`,"key",t)}return o[0]}const i=this.#r.get(Hr.from(t).format());return i||null}getFunctionName(t){const e=this.#i(t,null,!1);return g(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#i(t,null,!1)}getFunction(t,e){return this.#i(t,e||null,!0)}forEachFunction(t){const e=Array.from(this.#r.keys());e.sort((r,i)=>r.localeCompare(i));for(let r=0;r<e.length;r++){const i=e[r];t(this.#r.get(i),r)}}#o(t,e,r){if(st(t)){const o=t.toLowerCase();for(const c of this.#e.values())if(o===c.topicHash)return c;return null}if(t.indexOf("(")===-1){const o=[];for(const[c,_]of this.#e)c.split("(")[0]===t&&o.push(_);if(e){for(let c=o.length-1;c>=0;c--)o[c].inputs.length<e.length&&o.splice(c,1);for(let c=o.length-1;c>=0;c--){const _=o[c].inputs;for(let l=0;l<e.length;l++)if(gt.isTyped(e[l])&&e[l].type!==_[l].baseType){o.splice(c,1);break}}}if(o.length===0)return null;if(o.length>1&&r){const c=o.map(_=>JSON.stringify(_.format())).join(", ");g(!1,`ambiguous event description (i.e. matches ${c})`,"key",t)}return o[0]}const i=this.#e.get(Gr.from(t).format());return i||null}getEventName(t){const e=this.#o(t,null,!1);return g(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#o(t,null,!1)}getEvent(t,e){return this.#o(t,e||null,!0)}forEachEvent(t){const e=Array.from(this.#e.keys());e.sort((r,i)=>r.localeCompare(i));for(let r=0;r<e.length;r++){const i=e[r];t(this.#e.get(i),r)}}getError(t,e){if(st(t)){const i=t.toLowerCase();if(bl[i])return jt.from(bl[i].signature);for(const o of this.#t.values())if(i===o.selector)return o;return null}if(t.indexOf("(")===-1){const i=[];for(const[o,c]of this.#t)o.split("(")[0]===t&&i.push(c);if(i.length===0)return t==="Error"?jt.from("error Error(string)"):t==="Panic"?jt.from("error Panic(uint256)"):null;if(i.length>1){const o=i.map(c=>JSON.stringify(c.format())).join(", ");g(!1,`ambiguous error description (i.e. ${o})`,"name",t)}return i[0]}if(t=jt.from(t).format(),t==="Error(string)")return jt.from("error Error(string)");if(t==="Panic(uint256)")return jt.from("error Panic(uint256)");const r=this.#t.get(t);return r||null}forEachError(t){const e=Array.from(this.#t.keys());e.sort((r,i)=>r.localeCompare(i));for(let r=0;r<e.length;r++){const i=e[r];t(this.#t.get(i),r)}}_decodeParams(t,e){return this.#n.decode(t,e)}_encodeParams(t,e){return this.#n.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){const r=this.getError(t);g(r,"unknown error","fragment",t),t=r}return g(pt(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,pt(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){const r=this.getError(t);g(r,"unknown error","fragment",t),t=r}return ct([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){const r=this.getFunction(t);g(r,"unknown function","fragment",t),t=r}return g(pt(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,pt(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){const r=this.getFunction(t);g(r,"unknown function","fragment",t),t=r}return ct([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){const o=this.getFunction(t);g(o,"unknown function","fragment",t),t=o}let r="invalid length for result data";const i=Bt(e);if(i.length%32===0)try{return this.#n.decode(t.outputs,i)}catch{r="could not decode result data"}v(!1,r,"BAD_DATA",{value:O(i),info:{method:t.name,signature:t.format()}})}makeError(t,e){const r=V(t,"data"),i=gn.getBuiltinCallException("call",e,r);if(i.message.startsWith("execution reverted (unknown custom error)")){const _=O(r.slice(0,4)),l=this.getError(_);if(l)try{const u=this.#n.decode(l.inputs,r.slice(4));i.revert={name:l.name,signature:l.format(),args:u},i.reason=i.revert.signature,i.message=`execution reverted: ${i.reason}`}catch{i.message="execution reverted (coult not decode custom error)"}}const c=this.parseTransaction(e);return c&&(i.invocation={method:c.name,signature:c.signature,args:c.args}),i}encodeFunctionResult(t,e){if(typeof t=="string"){const r=this.getFunction(t);g(r,"unknown function","fragment",t),t=r}return O(this.#n.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){const o=this.getEvent(t);g(o,"unknown event","eventFragment",t),t=o}v(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});const r=[];t.anonymous||r.push(t.topicHash);const i=(o,c)=>o.type==="string"?On(c):o.type==="bytes"?dt(O(c)):(o.type==="bool"&&typeof c=="boolean"?c=c?"0x01":"0x00":o.type.match(/^u?int/)?c=cn(c):o.type.match(/^bytes/)?c=Wa(c,32):o.type==="address"&&this.#n.encode(["address"],[c]),Wt(O(c),32));for(e.forEach((o,c)=>{const _=t.inputs[c];if(!_.indexed){g(o==null,"cannot filter non-indexed parameters; must be null","contract."+_.name,o);return}o==null?r.push(null):_.baseType==="array"||_.baseType==="tuple"?g(!1,"filtering with tuples or arrays not supported","contract."+_.name,o):Array.isArray(o)?r.push(o.map(l=>i(_,l))):r.push(i(_,o))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(t,e){if(typeof t=="string"){const c=this.getEvent(t);g(c,"unknown event","eventFragment",t),t=c}const r=[],i=[],o=[];return t.anonymous||r.push(t.topicHash),g(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((c,_)=>{const l=e[_];if(c.indexed)if(c.type==="string")r.push(On(l));else if(c.type==="bytes")r.push(dt(l));else{if(c.baseType==="tuple"||c.baseType==="array")throw new Error("not implemented");r.push(this.#n.encode([c.type],[l]))}else i.push(c),o.push(l)}),{data:this.#n.encode(i,o),topics:r}}decodeEventLog(t,e,r){if(typeof t=="string"){const b=this.getEvent(t);g(b,"unknown event","eventFragment",t),t=b}if(r!=null&&!t.anonymous){const b=t.topicHash;g(st(r[0],32)&&r[0].toLowerCase()===b,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const i=[],o=[],c=[];t.inputs.forEach((b,x)=>{b.indexed?b.type==="string"||b.type==="bytes"||b.baseType==="tuple"||b.baseType==="array"?(i.push(ot.from({type:"bytes32",name:b.name})),c.push(!0)):(i.push(b),c.push(!1)):(o.push(b),c.push(!1))});const _=r!=null?this.#n.decode(i,ct(r)):null,l=this.#n.decode(o,e,!0),u=[],p=[];let f=0,d=0;return t.inputs.forEach((b,x)=>{let E=null;if(b.indexed)if(_==null)E=new gl(null);else if(c[x])E=new gl(_[d++]);else try{E=_[d++]}catch(z){E=z}else try{E=l[f++]}catch(z){E=z}u.push(E),p.push(b.name||null)}),qr.fromItems(u,p)}parseTransaction(t){const e=V(t.data,"tx.data"),r=L(t.value!=null?t.value:0,"tx.value"),i=this.getFunction(O(e.slice(0,4)));if(!i)return null;const o=this.#n.decode(i.inputs,e.slice(4));return new xg(i,i.selector,o,r)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){const e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Eg(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){const e=O(t),r=this.getError(pt(e,0,4));if(!r)return null;const i=this.#n.decode(r.inputs,pt(e,4));return new Rg(r,r.selector,i)}static from(t){return t instanceof Mn?t:typeof t=="string"?new Mn(JSON.parse(t)):typeof t.formatJson=="function"?new Mn(t.formatJson()):typeof t.format=="function"?new Mn(t.format("json")):new Mn(t)}}const ml=BigInt(0);function wi(n){return n??null}function mt(n){return n==null?null:n.toString()}class Al{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(t,e,r){H(this,{gasPrice:wi(t),maxFeePerGas:wi(e),maxPriorityFeePerGas:wi(r)})}toJSON(){const{gasPrice:t,maxFeePerGas:e,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:mt(t),maxFeePerGas:mt(e),maxPriorityFeePerGas:mt(r)}}}function Qs(n){const t={};n.to&&(t.to=n.to),n.from&&(t.from=n.from),n.data&&(t.data=O(n.data));const e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of e)!(i in n)||n[i]==null||(t[i]=L(n[i],`request.${i}`));const r="type,nonce".split(/,/);for(const i of r)!(i in n)||n[i]==null||(t[i]=Z(n[i],`request.${i}`));return n.accessList&&(t.accessList=Bn(n.accessList)),n.authorizationList&&(t.authorizationList=n.authorizationList.slice()),"blockTag"in n&&(t.blockTag=n.blockTag),"enableCcipRead"in n&&(t.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(t.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(t.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(t.kzg=n.kzg),"blobs"in n&&n.blobs&&(t.blobs=n.blobs.map(i=>wo(i)?O(i):Object.assign({},i))),t}class zg{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#t;constructor(t,e){this.#t=t.transactions.map(r=>typeof r!="string"?new qi(r,e):r),H(this,{provider:e,hash:wi(t.hash),number:t.number,timestamp:t.timestamp,parentHash:t.parentHash,parentBeaconBlockRoot:t.parentBeaconBlockRoot,nonce:t.nonce,difficulty:t.difficulty,gasLimit:t.gasLimit,gasUsed:t.gasUsed,blobGasUsed:t.blobGasUsed,excessBlobGas:t.excessBlobGas,miner:t.miner,prevRandao:wi(t.prevRandao),extraData:t.extraData,baseFeePerGas:wi(t.baseFeePerGas),stateRoot:t.stateRoot,receiptsRoot:t.receiptsRoot})}get transactions(){return this.#t.map(t=>typeof t=="string"?t:t.hash)}get prefetchedTransactions(){const t=this.#t.slice();return t.length===0?[]:(v(typeof t[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),t)}toJSON(){const{baseFeePerGas:t,difficulty:e,extraData:r,gasLimit:i,gasUsed:o,hash:c,miner:_,prevRandao:l,nonce:u,number:p,parentHash:f,parentBeaconBlockRoot:d,stateRoot:b,receiptsRoot:x,timestamp:E,transactions:z}=this;return{_type:"Block",baseFeePerGas:mt(t),difficulty:mt(e),extraData:r,gasLimit:mt(i),gasUsed:mt(o),blobGasUsed:mt(this.blobGasUsed),excessBlobGas:mt(this.excessBlobGas),hash:c,miner:_,prevRandao:l,nonce:u,number:p,parentHash:f,timestamp:E,parentBeaconBlockRoot:d,stateRoot:b,receiptsRoot:x,transactions:z}}[Symbol.iterator](){let t=0;const e=this.transactions;return{next:()=>t<this.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#t.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(t){let e;if(typeof t=="number")e=this.#t[t];else{const r=t.toLowerCase();for(const i of this.#t)if(typeof i=="string"){if(i!==r)continue;e=i;break}else{if(i.hash!==r)continue;e=i;break}}if(e==null)throw new Error("no such tx");return typeof e=="string"?await this.provider.getTransaction(e):e}getPrefetchedTransaction(t){const e=this.prefetchedTransactions;if(typeof t=="number")return e[t];t=t.toLowerCase();for(const r of e)if(r.hash===t)return r;g(!1,"no matching transaction","indexOrHash",t)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Pg(this)}}class Wi{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;const r=Object.freeze(t.topics.slice());H(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:r,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){const{address:t,blockHash:e,blockNumber:r,data:i,index:o,removed:c,topics:_,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:t,blockHash:e,blockNumber:r,data:i,index:o,removed:c,topics:_,transactionHash:l,transactionIndex:u}}async getBlock(){const t=await this.provider.getBlock(this.blockHash);return v(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){const t=await this.provider.getTransaction(this.transactionHash);return v(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){const t=await this.provider.getTransactionReceipt(this.transactionHash);return v(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return vg(this)}}class El{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#t;constructor(t,e){this.#t=Object.freeze(t.logs.map(i=>new Wi(i,e)));let r=ml;t.effectiveGasPrice!=null?r=t.effectiveGasPrice:t.gasPrice!=null&&(r=t.gasPrice),H(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:r,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){const{to:t,from:e,contractAddress:r,hash:i,index:o,blockHash:c,blockNumber:_,logsBloom:l,logs:u,status:p,root:f}=this;return{_type:"TransactionReceipt",blockHash:c,blockNumber:_,contractAddress:r,cumulativeGasUsed:mt(this.cumulativeGasUsed),from:e,gasPrice:mt(this.gasPrice),blobGasUsed:mt(this.blobGasUsed),blobGasPrice:mt(this.blobGasPrice),gasUsed:mt(this.gasUsed),hash:i,index:o,logs:u,logsBloom:l,root:f,status:p,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(t==null)throw new Error("TODO");return t}async getTransaction(){const t=await this.provider.getTransaction(this.hash);if(t==null)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 Rl(this)}reorderedEvent(t){return v(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),xl(this,t)}}class qi{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;authorizationList;#t;constructor(t,e){this.provider=e,this.blockNumber=t.blockNumber!=null?t.blockNumber:null,this.blockHash=t.blockHash!=null?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=t.maxPriorityFeePerGas!=null?t.maxPriorityFeePerGas:null,this.maxFeePerGas=t.maxFeePerGas!=null?t.maxFeePerGas:null,this.maxFeePerBlobGas=t.maxFeePerBlobGas!=null?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=t.accessList!=null?t.accessList:null,this.blobVersionedHashes=t.blobVersionedHashes!=null?t.blobVersionedHashes:null,this.authorizationList=t.authorizationList!=null?t.authorizationList:null,this.#t=-1}toJSON(){const{blockNumber:t,blockHash:e,index:r,hash:i,type:o,to:c,from:_,nonce:l,data:u,signature:p,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:t,blockHash:e,blobVersionedHashes:d,chainId:mt(this.chainId),data:u,from:_,gasLimit:mt(this.gasLimit),gasPrice:mt(this.gasPrice),hash:i,maxFeePerGas:mt(this.maxFeePerGas),maxPriorityFeePerGas:mt(this.maxPriorityFeePerGas),maxFeePerBlobGas:mt(this.maxFeePerBlobGas),nonce:l,signature:p,to:c,index:r,type:o,value:mt(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){const r=await this.getTransaction();r&&(t=r.blockNumber)}if(t==null)return null;const e=this.provider.getBlock(t);if(e==null)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:e,blockNumber:r}=await Tt({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:r-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){const r=t??1,i=e??0;let o=this.#t,c=-1,_=o===-1;const l=async()=>{if(_)return null;const{blockNumber:d,nonce:b}=await Tt({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(b<this.nonce){o=d;return}if(_)return null;const x=await this.getTransaction();if(!(x&&x.blockNumber!=null))for(c===-1&&(c=o-3,c<this.#t&&(c=this.#t));c<=d;){if(_)return null;const E=await this.provider.getBlock(c,!0);if(E==null)return;for(const z of E)if(z===this.hash)return;for(let z=0;z<E.length;z++){const P=await E.getTransaction(z);if(P.from===this.from&&P.nonce===this.nonce){if(_)return null;const T=await this.provider.getTransactionReceipt(P.hash);if(T==null||d-T.blockNumber+1<r)return;let B="replaced";P.data===this.data&&P.to===this.to&&P.value===this.value?B="repriced":P.data==="0x"&&P.from===P.to&&P.value===ml&&(B="cancelled"),v(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:B==="replaced"||B==="cancelled",reason:B,replacement:P.replaceableTransaction(o),hash:P.hash,receipt:T})}}c++}},u=d=>{if(d==null||d.status!==0)return d;v(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},p=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(p);if(p){if(r===1||await p.confirmations()>=r)return u(p)}else if(await l(),r===0)return null;return await new Promise((d,b)=>{const x=[],E=()=>{x.forEach(P=>P())};if(x.push(()=>{_=!0}),i>0){const P=setTimeout(()=>{E(),b(lt("wait for transaction timeout","TIMEOUT"))},i);x.push(()=>{clearTimeout(P)})}const z=async P=>{if(await P.confirmations()>=r){E();try{d(u(P))}catch(T){b(T)}}};if(x.push(()=>{this.provider.off(this.hash,z)}),this.provider.on(this.hash,z),o>=0){const P=async()=>{try{await l()}catch(T){if(kt(T,"TRANSACTION_REPLACED")){E(),b(T);return}}_||this.provider.once("block",P)};x.push(()=>{this.provider.off("block",P)}),this.provider.once("block",P)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return v(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Rl(this)}reorderedEvent(t){return v(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),v(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),xl(this,t)}replaceableTransaction(t){g(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);const e=new qi(this,this.provider);return e.#t=t,e}}function Pg(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function xl(n,t){return{orphan:"reorder-transaction",tx:n,other:t}}function Rl(n){return{orphan:"drop-transaction",tx:n}}function vg(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class ia extends Wi{interface;fragment;args;constructor(t,e,r){super(t,t.provider);const i=e.decodeEventLog(r,t.data,t.topics);H(this,{args:i,fragment:r,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class zl extends Wi{error;constructor(t,e){super(t,t.provider),H(this,{error:e})}}class kg extends El{#t;constructor(t,e,r){super(r,e),this.#t=t}get logs(){return super.logs.map(t=>{const e=t.topics.length?this.#t.getEvent(t.topics[0]):null;if(e)try{return new ia(t,this.#t,e)}catch(r){return new zl(t,r)}return t})}}class sa extends qi{#t;constructor(t,e,r){super(r,e),this.#t=t}async wait(t,e){const r=await super.wait(t,e);return r==null?null:new kg(this.#t,this.provider,r)}}class Pl extends Xa{log;constructor(t,e,r,i){super(t,e,r),H(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Ig extends Pl{constructor(t,e,r,i,o){super(t,e,r,new ia(o,t.interface,i));const c=t.interface.decodeEventLog(i,this.log.data,this.log.topics);H(this,{args:c,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const vl=BigInt(0);function kl(n){return n&&typeof n.call=="function"}function Il(n){return n&&typeof n.estimateGas=="function"}function Js(n){return n&&typeof n.resolveName=="function"}function Sl(n){return n&&typeof n.sendTransaction=="function"}function Tl(n){if(n!=null){if(Js(n))return n;if(n.provider)return n.provider}}class Sg{#t;fragment;constructor(t,e,r){if(H(this,{fragment:e}),e.inputs.length<r.length)throw new Error("too many arguments");const i=jn(t.runner,"resolveName"),o=Js(i)?i:null;this.#t=async function(){const c=await Promise.all(e.inputs.map((_,l)=>r[l]==null?null:_.walkAsync(r[l],(p,f)=>p==="address"?Array.isArray(f)?Promise.all(f.map(d=>Ot(d,o))):Ot(f,o):f)));return t.interface.encodeFilterTopics(e,c)}()}getTopicFilter(){return this.#t}}function jn(n,t){return n==null?null:typeof n[t]=="function"?n:n.provider&&typeof n.provider[t]=="function"?n.provider:null}function Gn(n){return n==null?null:n.provider||null}async function Bl(n,t){const e=gt.dereference(n,"overrides");g(typeof e=="object","invalid overrides parameter","overrides",n);const r=Qs(e);return g(r.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),g(r.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Tg(n,t,e){const r=jn(n,"resolveName"),i=Js(r)?r:null;return await Promise.all(t.map((o,c)=>o.walkAsync(e[c],(_,l)=>(l=gt.dereference(l,_),_==="address"?Ot(l,i):l))))}function Bg(n){const t=async function(c){const _=await Bl(c,["data"]);_.to=await n.getAddress(),_.from&&(_.from=await Ot(_.from,Tl(n.runner)));const l=n.interface,u=L(_.value||vl,"overrides.value")===vl,p=(_.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!p&&!u&&g(!1,"cannot send data to receive or send value to non-payable fallback","overrides",c),g(l.fallback||p,"cannot send data to receive-only contract","overrides.data",_.data);const f=l.receive||l.fallback&&l.fallback.payable;return g(f||u,"cannot send value to non-payable fallback","overrides.value",_.value),g(l.fallback||p,"cannot send data to receive-only contract","overrides.data",_.data),_},e=async function(c){const _=jn(n.runner,"call");v(kl(_),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await t(c);try{return await _.call(l)}catch(u){throw po(u)&&u.data?n.interface.makeError(u.data,l):u}},r=async function(c){const _=n.runner;v(Sl(_),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await _.sendTransaction(await t(c)),u=Gn(n.runner);return new sa(n.interface,u,l)},i=async function(c){const _=jn(n.runner,"estimateGas");return v(Il(_),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await _.estimateGas(await t(c))},o=async c=>await r(c);return H(o,{_contract:n,estimateGas:i,populateTransaction:t,send:r,staticCall:e}),o}function Cg(n,t){const e=function(...u){const p=n.interface.getFunction(t,u);return v(p,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:u}}),p},r=async function(...u){const p=e(...u);let f={};if(p.inputs.length+1===u.length&&(f=await Bl(u.pop()),f.from&&(f.from=await Ot(f.from,Tl(n.runner)))),p.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Tg(n.runner,p.inputs,u);return Object.assign({},f,await Tt({to:n.getAddress(),data:n.interface.encodeFunctionData(p,d)}))},i=async function(...u){const p=await _(...u);return p.length===1?p[0]:p},o=async function(...u){const p=n.runner;v(Sl(p),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await p.sendTransaction(await r(...u)),d=Gn(n.runner);return new sa(n.interface,d,f)},c=async function(...u){const p=jn(n.runner,"estimateGas");return v(Il(p),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await p.estimateGas(await r(...u))},_=async function(...u){const p=jn(n.runner,"call");v(kl(p),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await p.call(f)}catch(x){throw po(x)&&x.data?n.interface.makeError(x.data,f):x}const b=e(...u);return n.interface.decodeFunctionResult(b,d)},l=async(...u)=>e(...u).constant?await i(...u):await o(...u);return H(l,{name:n.interface.getFunctionName(t),_contract:n,_key:t,getFragment:e,estimateGas:c,populateTransaction:r,send:o,staticCall:i,staticCallResult:_}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=n.interface.getFunction(t);return v(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),u}}),l}function Og(n,t){const e=function(...i){const o=n.interface.getEvent(t,i);return v(o,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:i}}),o},r=function(...i){return new Sg(n,e(...i),i)};return H(r,{name:n.interface.getEventName(t),_contract:n,_key:t,getFragment:e}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=n.interface.getEvent(t);return v(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),i}}),r}const $s=Symbol.for("_ethersInternal_contract"),Cl=new WeakMap;function Ng(n,t){Cl.set(n[$s],t)}function Ht(n){return Cl.get(n[$s])}function Fg(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function oa(n,t){let e,r=null;if(Array.isArray(t)){const o=function(c){if(st(c,32))return c;const _=n.interface.getEvent(c);return g(_,"unknown fragment","name",c),_.topicHash};e=t.map(c=>c==null?null:Array.isArray(c)?c.map(o):o(c))}else t==="*"?e=[null]:typeof t=="string"?st(t,32)?e=[t]:(r=n.interface.getEvent(t),g(r,"unknown fragment","event",t),e=[r.topicHash]):Fg(t)?e=await t.getTopicFilter():"fragment"in t?(r=t.fragment,e=[r.topicHash]):g(!1,"unknown event name","event",t);e=e.map(o=>{if(o==null)return null;if(Array.isArray(o)){const c=Array.from(new Set(o.map(_=>_.toLowerCase())).values());return c.length===1?c[0]:(c.sort(),c)}return o.toLowerCase()});const i=e.map(o=>o==null?"null":Array.isArray(o)?o.join("|"):o).join("&");return{fragment:r,tag:i,topics:e}}async function Zi(n,t){const{subs:e}=Ht(n);return e.get((await oa(n,t)).tag)||null}async function Ol(n,t,e){const r=Gn(n.runner);v(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});const{fragment:i,tag:o,topics:c}=await oa(n,e),{addr:_,subs:l}=Ht(n);let u=l.get(o);if(!u){const f={address:_||n,topics:c},d=z=>{let P=i;if(P==null)try{P=n.interface.getEvent(z.topics[0])}catch{}if(P){const T=P,B=i?n.interface.decodeEventLog(i,z.data,z.topics):[];ca(n,e,B,M=>new Ig(n,M,e,T,z))}else ca(n,e,[],T=>new Pl(n,T,e,z))};let b=[];u={tag:o,listeners:[],start:()=>{b.length||b.push(r.on(f,d))},stop:async()=>{if(b.length==0)return;let z=b;b=[],await Promise.all(z),r.off(f,d)}},l.set(o,u)}return u}let aa=Promise.resolve();async function Dg(n,t,e,r){await aa;const i=await Zi(n,t);if(!i)return!1;const o=i.listeners.length;return i.listeners=i.listeners.filter(({listener:c,once:_})=>{const l=Array.from(e);r&&l.push(r(_?null:c));try{c.call(n,...l)}catch{}return!_}),i.listeners.length===0&&(i.stop(),Ht(n).subs.delete(i.tag)),o>0}async function ca(n,t,e,r){try{await aa}catch{}const i=Dg(n,t,e,r);return aa=i,await i}const Ws=["then"];class Yi{target;interface;runner;filters;[$s];fallback;constructor(t,e,r,i){g(typeof t=="string"||__(t),"invalid value for Contract target","target",t),r==null&&(r=null);const o=Mn.from(e);H(this,{target:t,runner:r,interface:o}),Object.defineProperty(this,$s,{value:{}});let c,_=null,l=null;if(i){const f=Gn(r);l=new sa(this.interface,f,i)}let u=new Map;if(typeof t=="string")if(st(t))_=t,c=Promise.resolve(t);else{const f=jn(r,"resolveName");if(!Js(f))throw lt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});c=f.resolveName(t).then(d=>{if(d==null)throw lt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return Ht(this).addr=d,d})}else c=t.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Ht(this).addr=f,f});Ng(this,{addrPromise:c,addr:_,deployTx:l,subs:u});const p=new Proxy({},{get:(f,d,b)=>{if(typeof d=="symbol"||Ws.indexOf(d)>=0)return Reflect.get(f,d,b);try{return this.getEvent(d)}catch(x){if(!kt(x,"INVALID_ARGUMENT")||x.argument!=="key")throw x}},has:(f,d)=>Ws.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return H(this,{filters:p}),H(this,{fallback:o.receive||o.fallback?Bg(this):null}),new Proxy(this,{get:(f,d,b)=>{if(typeof d=="symbol"||d in f||Ws.indexOf(d)>=0)return Reflect.get(f,d,b);try{return f.getFunction(d)}catch(x){if(!kt(x,"INVALID_ARGUMENT")||x.argument!=="key")throw x}},has:(f,d)=>typeof d=="symbol"||d in f||Ws.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(t){return new Yi(this.target,this.interface,t)}attach(t){return new Yi(t,this.interface,this.runner)}async getAddress(){return await Ht(this).addrPromise}async getDeployedCode(){const t=Gn(this.runner);v(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const e=await t.getCode(await this.getAddress());return e==="0x"?null:e}async waitForDeployment(){const t=this.deploymentTransaction();if(t)return await t.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Gn(this.runner);return v(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,o)=>{const c=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);r.once("block",c)}catch(_){o(_)}};c()})}deploymentTransaction(){return Ht(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),Cg(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),Og(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,r){e==null&&(e=0),r==null&&(r="latest");const{addr:i,addrPromise:o}=Ht(this),c=i||await o,{fragment:_,topics:l}=await oa(this,t),u={address:c,topics:l,fromBlock:e,toBlock:r},p=Gn(this.runner);return v(p,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await p.getLogs(u)).map(f=>{let d=_;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new ia(f,this.interface,d)}catch(b){return new zl(f,b)}return new Wi(f,p)})}async on(t,e){const r=await Ol(this,"on",t);return r.listeners.push({listener:e,once:!1}),r.start(),this}async once(t,e){const r=await Ol(this,"once",t);return r.listeners.push({listener:e,once:!0}),r.start(),this}async emit(t,...e){return await ca(this,t,e,null)}async listenerCount(t){if(t){const i=await Zi(this,t);return i?i.listeners.length:0}const{subs:e}=Ht(this);let r=0;for(const{listeners:i}of e.values())r+=i.length;return r}async listeners(t){if(t){const i=await Zi(this,t);return i?i.listeners.map(({listener:o})=>o):[]}const{subs:e}=Ht(this);let r=[];for(const{listeners:i}of e.values())r=r.concat(i.map(({listener:o})=>o));return r}async off(t,e){const r=await Zi(this,t);if(!r)return this;if(e){const i=r.listeners.map(({listener:o})=>o).indexOf(e);i>=0&&r.listeners.splice(i,1)}return(e==null||r.listeners.length===0)&&(r.stop(),Ht(this).subs.delete(r.tag)),this}async removeAllListeners(t){if(t){const e=await Zi(this,t);if(!e)return this;e.stop(),Ht(this).subs.delete(e.tag)}else{const{subs:e}=Ht(this);for(const{tag:r,stop:i}of e.values())i(),e.delete(r)}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){class e extends Yi{constructor(i,o=null){super(i,t,o)}}return e}static from(t,e,r){return r==null&&(r=null),new this(t,e,r)}}function Ug(){return Yi}class ce extends Ug(){}function _a(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):g(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class Lg{name;constructor(t){H(this,{name:t})}connect(t){return this}supportsCoinType(t){return!1}async encodeAddress(t,e){throw new Error("unsupported coin")}async decodeAddress(t,e){throw new Error("unsupported coin")}}const Nl=new RegExp("^(ipfs)://(.*)$","i"),Fl=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Nl,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class gi{provider;address;name;#t;#e;constructor(t,e,r){H(this,{provider:t,address:e,name:r}),this.#t=null,this.#e=new ce(e,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],t)}async supportsWildcard(){return this.#t==null&&(this.#t=(async()=>{try{return await this.#e.supportsInterface("0x9061b923")}catch(t){if(kt(t,"CALL_EXCEPTION"))return!1;throw this.#t=null,t}})()),await this.#t}async#r(t,e){e=(e||[]).slice();const r=this.#e.interface;e.unshift(ta(this.name));let i=null;await this.supportsWildcard()&&(i=r.getFunction(t),v(i,"missing fragment","UNKNOWN_ERROR",{info:{funcName:t}}),e=[Xw(this.name,255),r.encodeFunctionData(i,e)],t="resolve(bytes,bytes)"),e.push({enableCcipRead:!0});try{const o=await this.#e[t](...e);return i?r.decodeFunctionResult(i,o)[0]:o}catch(o){if(!kt(o,"CALL_EXCEPTION"))throw o}return null}async getAddress(t){if(t==null&&(t=60),t===60)try{const o=await this.#r("addr(bytes32)");return o==null||o===ji?null:o}catch(o){if(kt(o,"CALL_EXCEPTION"))return null;throw o}if(t>=0&&t<2147483648){let o=t+2147483648;const c=await this.#r("addr(bytes32,uint)",[o]);if(st(c,20))return Y(c)}let e=null;for(const o of this.provider.plugins)if(o instanceof Lg&&o.supportsCoinType(t)){e=o;break}if(e==null)return null;const r=await this.#r("addr(bytes32,uint)",[t]);if(r==null||r==="0x")return null;const i=await e.decodeAddress(t,r);if(i!=null)return i;v(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${t})`,info:{coinType:t,data:r}})}async getText(t){const e=await this.#r("text(bytes32,string)",[t]);return e==null||e==="0x"?null:e}async getContentHash(){const t=await this.#r("contenthash(bytes32)");if(t==null||t==="0x")return null;const e=t.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const i=e[1]==="e3010170"?"ipfs":"ipns",o=parseInt(e[4],16);if(e[5].length===o*2)return`${i}://${ep("0x"+e[2])}`}const r=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;v(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:t}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const t=[{type:"name",value:this.name}];try{const e=await this.getText("avatar");if(e==null)return t.push({type:"!avatar",value:""}),{url:null,linkage:t};t.push({type:"avatar",value:e});for(let r=0;r<Fl.length;r++){const i=e.match(Fl[r]);if(i==null)continue;const o=i[1].toLowerCase();switch(o){case"https":case"data":return t.push({type:"url",value:e}),{linkage:t,url:e};case"ipfs":{const c=_a(e);return t.push({type:"ipfs",value:e}),t.push({type:"url",value:c}),{linkage:t,url:c}}case"erc721":case"erc1155":{const c=o==="erc721"?"tokenURI(uint256)":"uri(uint256)";t.push({type:o,value:e});const _=await this.getAddress();if(_==null)return t.push({type:"!owner",value:""}),{url:null,linkage:t};const l=(i[2]||"").split("/");if(l.length!==2)return t.push({type:`!${o}caip`,value:i[2]||""}),{url:null,linkage:t};const u=l[1],p=new ce(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(o==="erc721"){const E=await p.ownerOf(u);if(_!==E)return t.push({type:"!owner",value:E}),{url:null,linkage:t};t.push({type:"owner",value:E})}else if(o==="erc1155"){const E=await p.balanceOf(_,u);if(!E)return t.push({type:"!balance",value:"0"}),{url:null,linkage:t};t.push({type:"balance",value:E.toString()})}let f=await p[c](u);if(f==null||f==="0x")return t.push({type:"!metadata-url",value:""}),{url:null,linkage:t};t.push({type:"metadata-url-base",value:f}),o==="erc1155"&&(f=f.replace("{id}",cn(u,32).substring(2)),t.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=_a(f)),t.push({type:"metadata-url",value:f});let d={};const b=await new Mr(f).send();b.assertOk();try{d=b.bodyJson}catch{try{t.push({type:"!metadata",value:b.bodyText})}catch{const P=b.body;return P&&t.push({type:"!metadata",value:O(P)}),{url:null,linkage:t}}return{url:null,linkage:t}}if(!d)return t.push({type:"!metadata",value:""}),{url:null,linkage:t};t.push({type:"metadata",value:JSON.stringify(d)});let x=d.image;if(typeof x!="string")return t.push({type:"!imageUrl",value:""}),{url:null,linkage:t};if(!x.match(/^(https:\/\/|data:)/i)){if(x.match(Nl)==null)return t.push({type:"!imageUrl-ipfs",value:x}),{url:null,linkage:t};t.push({type:"imageUrl-ipfs",value:x}),x=_a(x)}return t.push({type:"url",value:x}),{linkage:t,url:x}}}}}catch{}return{linkage:t,url:null}}static async getEnsAddress(t){const e=await t.getNetwork(),r=e.getPlugin("org.ethers.plugins.network.Ens");return v(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:e}}),r.address}static async#n(t,e){const r=await gi.getEnsAddress(t);try{const o=await new ce(r,["function resolver(bytes32) view returns (address)"],t).resolver(ta(e),{enableCcipRead:!0});return o===ji?null:o}catch(i){throw i}return null}static async fromName(t,e){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const i=await gi.#n(t,r);if(i!=null){const o=new gi(t,i,e);return r!==e&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}}const Dl=BigInt(0);function tt(n,t){return function(e){return e==null?t:n(e)}}function Xi(n,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>n(r))}}function ts(n,t){return e=>{const r={};for(const i in n){let o=i;if(t&&i in t&&!(o in e)){for(const c of t[i])if(c in e){o=c;break}}try{const c=n[i](e[o]);c!==void 0&&(r[i]=c)}catch(c){const _=c instanceof Error?c.message:"not-an-error";v(!1,`invalid value for value.${i} (${_})`,"BAD_DATA",{value:e})}}return r}}function Mg(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}g(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function yi(n){return g(st(n,!0),"invalid data","value",n),n}function It(n){return g(st(n,32),"invalid hash","value",n),n}const jg=ts({address:Y,blockHash:It,blockNumber:Z,data:yi,index:Z,removed:tt(Mg,!1),topics:Xi(It),transactionHash:It,transactionIndex:Z},{index:["logIndex"]});function Gg(n){return jg(n)}const Hg=ts({hash:tt(It),parentHash:It,parentBeaconBlockRoot:tt(It,null),number:Z,timestamp:Z,nonce:tt(yi),difficulty:L,gasLimit:L,gasUsed:L,stateRoot:tt(It,null),receiptsRoot:tt(It,null),blobGasUsed:tt(L,null),excessBlobGas:tt(L,null),miner:tt(Y),prevRandao:tt(It,null),extraData:yi,baseFeePerGas:tt(L)},{prevRandao:["mixHash"]});function Vg(n){const t=Hg(n);return t.transactions=n.transactions.map(e=>typeof e=="string"?e:Ul(e)),t}const Kg=ts({transactionIndex:Z,blockNumber:Z,transactionHash:It,address:Y,topics:Xi(It),data:yi,index:Z,blockHash:It},{index:["logIndex"]});function Qg(n){return Kg(n)}const Jg=ts({to:tt(Y,null),from:tt(Y,null),contractAddress:tt(Y,null),index:Z,root:tt(O),gasUsed:L,blobGasUsed:tt(L,null),logsBloom:tt(yi),blockHash:It,hash:It,logs:Xi(Qg),blockNumber:Z,cumulativeGasUsed:L,effectiveGasPrice:tt(L),blobGasPrice:tt(L,null),status:tt(Z),type:tt(Z,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function $g(n){return Jg(n)}function Ul(n){n.to&&L(n.to)===Dl&&(n.to="0x0000000000000000000000000000000000000000");const t=ts({hash:It,index:tt(Z,void 0),type:e=>e==="0x"||e==null?0:Z(e),accessList:tt(Bn,null),blobVersionedHashes:tt(Xi(It,!0),null),authorizationList:tt(Xi(e=>{let r;if(e.signature)r=e.signature;else{let i=e.yParity;i==="0x1b"?i=0:i==="0x1c"&&(i=1),r=Object.assign({},e,{yParity:i})}return{address:Y(e.address),chainId:L(e.chainId),nonce:L(e.nonce),signature:wt.from(r)}},!1),null),blockHash:tt(It,null),blockNumber:tt(Z,null),transactionIndex:tt(Z,null),from:Y,gasPrice:tt(L),maxPriorityFeePerGas:tt(L),maxFeePerGas:tt(L),maxFeePerBlobGas:tt(L,null),gasLimit:L,to:tt(Y,null),value:L,nonce:Z,data:yi,creates:tt(Y,null),chainId:tt(L,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(t.to==null&&t.creates==null&&(t.creates=Fd(t)),(n.type===1||n.type===2)&&n.accessList==null&&(t.accessList=[]),n.signature?t.signature=wt.from(n.signature):t.signature=wt.from(n),t.chainId==null){const e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&L(t.blockHash)===Dl&&(t.blockHash=null),t}const Wg="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class es{name;constructor(t){H(this,{name:t})}clone(){return new es(this.name)}}class qs extends es{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(t,e){t==null&&(t=0),super(`org.ethers.network.plugins.GasCost#${t||0}`);const r={effectiveBlock:t};function i(o,c){let _=(e||{})[o];_==null&&(_=c),g(typeof _=="number",`invalud value for ${o}`,"costs",e),r[o]=_}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),H(this,r)}clone(){return new qs(this.effectiveBlock,this)}}class Zs extends es{address;targetNetwork;constructor(t,e){super("org.ethers.plugins.network.Ens"),H(this,{address:t||Wg,targetNetwork:e??1})}clone(){return new Zs(this.address,this.targetNetwork)}}class qg extends es{#t;#e;get url(){return this.#t}get processFunc(){return this.#e}constructor(t,e){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#t=t,this.#e=e}clone(){return this}}const la=new Map;class Vt{#t;#e;#r;constructor(t,e){this.#t=t,this.#e=L(e),this.#r=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#t}set name(t){this.#t=t}get chainId(){return this.#e}set chainId(t){this.#e=L(t,"chainId")}matches(t){if(t==null)return!1;if(typeof t=="string"){try{return this.chainId===L(t)}catch{}return this.name===t}if(typeof t=="number"||typeof t=="bigint"){try{return this.chainId===L(t)}catch{}return!1}if(typeof t=="object"){if(t.chainId!=null){try{return this.chainId===L(t.chainId)}catch{}return!1}return t.name!=null?this.name===t.name:!1}return!1}get plugins(){return Array.from(this.#r.values())}attachPlugin(t){if(this.#r.get(t.name))throw new Error(`cannot replace existing plugin: ${t.name} `);return this.#r.set(t.name,t.clone()),this}getPlugin(t){return this.#r.get(t)||null}getPlugins(t){return this.plugins.filter(e=>e.name.split("#")[0]===t)}clone(){const t=new Vt(this.name,this.chainId);return this.plugins.forEach(e=>{t.attachPlugin(e.clone())}),t}computeIntrinsicGas(t){const e=this.getPlugin("org.ethers.plugins.network.GasCost")||new qs;let r=e.txBase;if(t.to==null&&(r+=e.txCreate),t.data)for(let i=2;i<t.data.length;i+=2)t.data.substring(i,i+2)==="00"?r+=e.txDataZero:r+=e.txDataNonzero;if(t.accessList){const i=Bn(t.accessList);for(const o in i)r+=e.txAccessListAddress+e.txAccessListStorageKey*i[o].storageKeys.length}return r}static from(t){if(Zg(),t==null)return Vt.from("mainnet");if(typeof t=="number"&&(t=BigInt(t)),typeof t=="string"||typeof t=="bigint"){const e=la.get(t);if(e)return e();if(typeof t=="bigint")return new Vt("unknown",t);g(!1,"unknown network","network",t)}if(typeof t.clone=="function")return t.clone();if(typeof t=="object"){g(typeof t.name=="string"&&typeof t.chainId=="number","invalid network object name or chainId","network",t);const e=new Vt(t.name,t.chainId);return(t.ensAddress||t.ensNetwork!=null)&&e.attachPlugin(new Zs(t.ensAddress,t.ensNetwork)),e}g(!1,"invalid network","network",t)}static register(t,e){typeof t=="number"&&(t=BigInt(t));const r=la.get(t);r&&g(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",t),la.set(t,e)}}function Ll(n,t){const e=String(n);if(!e.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const r=e.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${n}`);for(;r[1].length<t;)r[1]+="0";if(r[1].length>9){let i=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||i++,r[1]=i.toString()}return BigInt(r[0]+r[1])}function Ml(n){return new qg(n,async(t,e,r)=>{r.setHeader("User-Agent","ethers");let i;try{const[o,c]=await Promise.all([r.send(),t()]);i=o;const _=i.bodyJson.standard;return{gasPrice:c.gasPrice,maxFeePerGas:Ll(_.maxFee,9),maxPriorityFeePerGas:Ll(_.maxPriorityFee,9)}}catch(o){v(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:i,error:o})}})}let jl=!1;function Zg(){if(jl)return;jl=!0;function n(t,e,r){const i=function(){const o=new Vt(t,e);return r.ensNetwork!=null&&o.attachPlugin(new Zs(null,r.ensNetwork)),o.attachPlugin(new qs),(r.plugins||[]).forEach(c=>{o.attachPlugin(c)}),o};Vt.register(t,i),Vt.register(e,i),r.altNames&&r.altNames.forEach(o=>{Vt.register(o,i)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[Ml("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[Ml("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function ua(n){return JSON.parse(JSON.stringify(n))}class Yg{#t;#e;#r;#n;constructor(t){this.#t=t,this.#e=null,this.#r=4e3,this.#n=-2}get pollingInterval(){return this.#r}set pollingInterval(t){this.#r=t}async#i(){try{const t=await this.#t.getBlockNumber();if(this.#n===-2){this.#n=t;return}if(t!==this.#n){for(let e=this.#n+1;e<=t;e++){if(this.#e==null)return;await this.#t.emit("block",e)}this.#n=t}}catch{}this.#e!=null&&(this.#e=this.#t._setTimeout(this.#i.bind(this),this.#r))}start(){this.#e||(this.#e=this.#t._setTimeout(this.#i.bind(this),this.#r),this.#i())}stop(){this.#e&&(this.#t._clearTimeout(this.#e),this.#e=null)}pause(t){this.stop(),t&&(this.#n=-2)}resume(){this.start()}}class fa{#t;#e;#r;constructor(t){this.#t=t,this.#r=!1,this.#e=e=>{this._poll(e,this.#t)}}async _poll(t,e){throw new Error("sub-classes must override this")}start(){this.#r||(this.#r=!0,this.#e(-2),this.#t.on("block",this.#e))}stop(){this.#r&&(this.#r=!1,this.#t.off("block",this.#e))}pause(t){this.stop()}resume(){this.start()}}class Xg extends fa{#t;#e;constructor(t,e){super(t),this.#t=e,this.#e=-2}pause(t){t&&(this.#e=-2),super.pause(t)}async _poll(t,e){const r=await e.getBlock(this.#t);r!=null&&(this.#e===-2?this.#e=r.number:r.number>this.#e&&(e.emit(this.#t,r.number),this.#e=r.number))}}class ty extends fa{#t;constructor(t,e){super(t),this.#t=ua(e)}async _poll(t,e){throw new Error("@TODO")}}class ey extends fa{#t;constructor(t,e){super(t),this.#t=e}async _poll(t,e){const r=await e.getTransactionReceipt(this.#t);r&&e.emit(this.#t,r)}}class ha{#t;#e;#r;#n;#i;constructor(t,e){this.#t=t,this.#e=ua(e),this.#r=this.#o.bind(this),this.#n=!1,this.#i=-2}async#o(t){if(this.#i===-2)return;const e=ua(this.#e);e.fromBlock=this.#i+1,e.toBlock=t;const r=await this.#t.getLogs(e);if(r.length===0){this.#i<t-60&&(this.#i=t-60);return}for(const i of r)this.#t.emit(this.#e,i),this.#i=i.blockNumber}start(){this.#n||(this.#n=!0,this.#i===-2&&this.#t.getBlockNumber().then(t=>{this.#i=t}),this.#t.on("block",this.#r))}stop(){this.#n&&(this.#n=!1,this.#t.off("block",this.#r))}pause(t){this.stop(),t&&(this.#i=-2)}resume(){this.start()}}const ry=BigInt(2),ny=10;function Ys(n){return n&&typeof n.then=="function"}function Xs(n,t){return n+":"+JSON.stringify(t,(e,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const i=Object.keys(r);return i.sort(),i.reduce((o,c)=>(o[c]=r[c],o),{})}return r})}class Gl{name;constructor(t){H(this,{name:t})}start(){}stop(){}pause(t){}resume(){}}function iy(n){return JSON.parse(JSON.stringify(n))}function pa(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function da(n,t){if(n==null)throw new Error("invalid event");if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(st(n,32)){const e=n.toLowerCase();return{type:"transaction",tag:Xs("tx",{hash:e}),hash:e}}if(n.orphan){const e=n;return{type:"orphan",tag:Xs("orphan",e),filter:iy(e)}}if(n.address||n.topics){const e=n,r={topics:(e.topics||[]).map(i=>i==null?null:Array.isArray(i)?pa(i.map(o=>o.toLowerCase())):i.toLowerCase())};if(e.address){const i=[],o=[],c=_=>{st(_)?i.push(_):o.push((async()=>{i.push(await Ot(_,t))})())};Array.isArray(e.address)?e.address.forEach(c):c(e.address),o.length&&await Promise.all(o),r.address=pa(i.map(_=>_.toLowerCase()))}return{filter:r,tag:Xs("event",r),type:"event"}}g(!1,"unknown ProviderEvent","event",n)}function wa(){return new Date().getTime()}const sy={cacheTimeout:250,pollingInterval:4e3};class oy{#t;#e;#r;#n;#i;#o;#s;#a;#h;#_;#p;#d;constructor(t,e){if(this.#d=Object.assign({},sy,e||{}),t==="any")this.#o=!0,this.#i=null;else if(t){const r=Vt.from(t);this.#o=!1,this.#i=Promise.resolve(r),setTimeout(()=>{this.emit("network",r,null)},0)}else this.#o=!1,this.#i=null;this.#a=-1,this.#s=new Map,this.#t=new Map,this.#e=new Map,this.#r=null,this.#n=!1,this.#h=1,this.#_=new Map,this.#p=!1}get pollingInterval(){return this.#d.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#e.values())}attachPlugin(t){if(this.#e.get(t.name))throw new Error(`cannot replace existing plugin: ${t.name} `);return this.#e.set(t.name,t.connect(this)),this}getPlugin(t){return this.#e.get(t)||null}get disableCcipRead(){return this.#p}set disableCcipRead(t){this.#p=!!t}async#c(t){const e=this.#d.cacheTimeout;if(e<0)return await this._perform(t);const r=Xs(t.method,t);let i=this.#s.get(r);return i||(i=this._perform(t),this.#s.set(r,i),setTimeout(()=>{this.#s.get(r)===i&&this.#s.delete(r)},e)),await i}async ccipReadFetch(t,e,r){if(this.disableCcipRead||r.length===0||t.to==null)return null;const i=t.to.toLowerCase(),o=e.toLowerCase(),c=[];for(let _=0;_<r.length;_++){const l=r[_],u=l.replace("{sender}",i).replace("{data}",o),p=new Mr(u);l.indexOf("{data}")===-1&&(p.body={data:o,sender:i}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:p,index:_,urls:r});let f="unknown error",d;try{d=await p.send()}catch(b){c.push(b.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:p,result:{error:b}});continue}try{const b=d.bodyJson;if(b.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:p,result:b}),b.data;b.message&&(f=b.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:p,result:b})}catch{}v(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:t,info:{url:l,errorMessage:f}}),c.push(f)}v(!1,`error encountered during CCIP fetch: ${c.map(_=>JSON.stringify(_)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:t,info:{urls:r,errorMessages:c}})}_wrapBlock(t,e){return new zg(Vg(t),this)}_wrapLog(t,e){return new Wi(Gg(t),this)}_wrapTransactionReceipt(t,e){return new El($g(t),this)}_wrapTransactionResponse(t,e){return new qi(Ul(t),this)}_detectNetwork(){v(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(t){v(!1,`unsupported method: ${t.method}`,"UNSUPPORTED_OPERATION",{operation:t.method,info:t})}async getBlockNumber(){const t=Z(await this.#c({method:"getBlockNumber"}),"%response");return this.#a>=0&&(this.#a=t),t}_getAddress(t){return Ot(t,this)}_getBlockTag(t){if(t==null)return"latest";switch(t){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return t}if(st(t))return st(t,32)?t:ie(t);if(typeof t=="bigint"&&(t=Z(t,"blockTag")),typeof t=="number")return t>=0?ie(t):this.#a>=0?ie(this.#a+t):this.getBlockNumber().then(e=>ie(e+t));g(!1,"invalid blockTag","blockTag",t)}_getFilter(t){const e=(t.topics||[]).map(l=>l==null?null:Array.isArray(l)?pa(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in t?t.blockHash:void 0,i=(l,u,p)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||p!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),e.length&&(d.topics=e),u&&(d.fromBlock=u),p&&(d.toBlock=p),r&&(d.blockHash=r),d};let o=[];if(t.address)if(Array.isArray(t.address))for(const l of t.address)o.push(this._getAddress(l));else o.push(this._getAddress(t.address));let c;"fromBlock"in t&&(c=this._getBlockTag(t.fromBlock));let _;return"toBlock"in t&&(_=this._getBlockTag(t.toBlock)),o.filter(l=>typeof l!="string").length||c!=null&&typeof c!="string"||_!=null&&typeof _!="string"?Promise.all([Promise.all(o),c,_]).then(l=>i(l[0],l[1],l[2])):i(o,c,_)}_getTransactionRequest(t){const e=Qs(t),r=[];if(["to","from"].forEach(i=>{if(e[i]==null)return;const o=Ot(e[i],this);Ys(o)?r.push(async function(){e[i]=await o}()):e[i]=o}),e.blockTag!=null){const i=this._getBlockTag(e.blockTag);Ys(i)?r.push(async function(){e.blockTag=await i}()):e.blockTag=i}return r.length?async function(){return await Promise.all(r),e}():e}async getNetwork(){if(this.#i==null){const i=(async()=>{try{const o=await this._detectNetwork();return this.emit("network",o,null),o}catch(o){throw this.#i===i&&(this.#i=null),o}})();return this.#i=i,(await i).clone()}const t=this.#i,[e,r]=await Promise.all([t,this._detectNetwork()]);return e.chainId!==r.chainId&&(this.#o?(this.emit("network",r,e),this.#i===t&&(this.#i=Promise.resolve(r))):v(!1,`network changed: ${e.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),e.clone()}async getFeeData(){const t=await this.getNetwork(),e=async()=>{const{_block:i,gasPrice:o,priorityFee:c}=await Tt({_block:this.#g("latest",!1),gasPrice:(async()=>{try{const p=await this.#c({method:"getGasPrice"});return L(p,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const p=await this.#c({method:"getPriorityFee"});return L(p,"%response")}catch{}return null})()});let _=null,l=null;const u=this._wrapBlock(i,t);return u&&u.baseFeePerGas&&(l=c??BigInt("1000000000"),_=u.baseFeePerGas*ry+l),new Al(o,_,l)},r=t.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const i=new Mr(r.url),o=await r.processFunc(e,this,i);return new Al(o.gasPrice,o.maxFeePerGas,o.maxPriorityFeePerGas)}return await e()}async estimateGas(t){let e=this._getTransactionRequest(t);return Ys(e)&&(e=await e),L(await this.#c({method:"estimateGas",transaction:e}),"%response")}async#l(t,e,r){v(r<ny,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},t,{blockTag:e,enableCcipRead:!0})});const i=Qs(t);try{return O(await this._perform({method:"call",transaction:i,blockTag:e}))}catch(o){if(!this.disableCcipRead&&po(o)&&o.data&&r>=0&&e==="latest"&&i.to!=null&&pt(o.data,0,4)==="0x556f1830"){const c=o.data,_=await Ot(i.to,this);let l;try{l=uy(pt(o.data,4))}catch(f){v(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:c}})}v(l.sender.toLowerCase()===_.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:c,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(i,l.calldata,l.urls);v(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:o.data,errorArgs:l.errorArgs}});const p={to:_,data:ct([l.selector,ly([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:p});try{const f=await this.#l(p,e,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},p),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},p),error:f}),f}}throw o}}async#u(t){const{value:e}=await Tt({network:this.getNetwork(),value:t});return e}async call(t){const{tx:e,blockTag:r}=await Tt({tx:this._getTransactionRequest(t),blockTag:this._getBlockTag(t.blockTag)});return await this.#u(this.#l(e,r,t.enableCcipRead?0:-1))}async#f(t,e,r){let i=this._getAddress(e),o=this._getBlockTag(r);return(typeof i!="string"||typeof o!="string")&&([i,o]=await Promise.all([i,o])),await this.#u(this.#c(Object.assign(t,{address:i,blockTag:o})))}async getBalance(t,e){return L(await this.#f({method:"getBalance"},t,e),"%response")}async getTransactionCount(t,e){return Z(await this.#f({method:"getTransactionCount"},t,e),"%response")}async getCode(t,e){return O(await this.#f({method:"getCode"},t,e))}async getStorage(t,e,r){const i=L(e,"position");return O(await this.#f({method:"getStorage",position:i},t,r))}async broadcastTransaction(t){const{blockNumber:e,hash:r,network:i}=await Tt({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:t}),network:this.getNetwork()}),o=oe.from(t);if(o.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(o,i).replaceableTransaction(e)}async#g(t,e){if(st(t,32))return await this.#c({method:"getBlock",blockHash:t,includeTransactions:e});let r=this._getBlockTag(t);return typeof r!="string"&&(r=await r),await this.#c({method:"getBlock",blockTag:r,includeTransactions:e})}async getBlock(t,e){const{network:r,params:i}=await Tt({network:this.getNetwork(),params:this.#g(t,!!e)});return i==null?null:this._wrapBlock(i,r)}async getTransaction(t){const{network:e,params:r}=await Tt({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:t})});return r==null?null:this._wrapTransactionResponse(r,e)}async getTransactionReceipt(t){const{network:e,params:r}=await Tt({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:t})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const i=await this.#c({method:"getTransaction",hash:t});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(r,e)}async getTransactionResult(t){const{result:e}=await Tt({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:t})});return e==null?null:O(e)}async getLogs(t){let e=this._getFilter(t);Ys(e)&&(e=await e);const{network:r,params:i}=await Tt({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:e})});return i.map(o=>this._wrapLog(o,r))}_getProvider(t){v(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(t){return await gi.fromName(this,t)}async getAvatar(t){const e=await this.getResolver(t);return e?await e.getAvatar():null}async resolveName(t){const e=await this.getResolver(t);return e?await e.getAddress():null}async lookupAddress(t){t=Y(t);const e=ta(t.substring(2).toLowerCase()+".addr.reverse");try{const r=await gi.getEnsAddress(this),o=await new ce(r,["function resolver(bytes32) view returns (address)"],this).resolver(e);if(o==null||o===ji)return null;const _=await new ce(o,["function name(bytes32) view returns (string)"],this).name(e);return await this.resolveName(_)!==t?null:_}catch(r){if(kt(r,"BAD_DATA")&&r.value==="0x"||kt(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(t,e,r){const i=e??1;return i===0?this.getTransactionReceipt(t):new Promise(async(o,c)=>{let _=null;const l=async u=>{try{const p=await this.getTransactionReceipt(t);if(p!=null&&u-p.blockNumber+1>=i){o(p),_&&(clearTimeout(_),_=null);return}}catch(p){console.log("EEE",p)}this.once("block",l)};r!=null&&(_=setTimeout(()=>{_!=null&&(_=null,this.off("block",l),c(lt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(t){v(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(t){const e=this.#_.get(t);e&&(e.timer&&clearTimeout(e.timer),this.#_.delete(t))}_setTimeout(t,e){e==null&&(e=0);const r=this.#h++,i=()=>{this.#_.delete(r),t()};if(this.paused)this.#_.set(r,{timer:null,func:i,time:e});else{const o=setTimeout(i,e);this.#_.set(r,{timer:o,func:i,time:wa()})}return r}_forEachSubscriber(t){for(const e of this.#t.values())t(e.subscriber)}_getSubscriber(t){switch(t.type){case"debug":case"error":case"network":return new Gl(t.type);case"block":{const e=new Yg(this);return e.pollingInterval=this.pollingInterval,e}case"safe":case"finalized":return new Xg(this,t.type);case"event":return new ha(this,t.filter);case"transaction":return new ey(this,t.hash);case"orphan":return new ty(this,t.filter)}throw new Error(`unsupported event: ${t.type}`)}_recoverSubscriber(t,e){for(const r of this.#t.values())if(r.subscriber===t){r.started&&r.subscriber.stop(),r.subscriber=e,r.started&&e.start(),this.#r!=null&&e.pause(this.#r);break}}async#w(t,e){let r=await da(t,this);return r.type==="event"&&e&&e.length>0&&e[0].removed===!0&&(r=await da({orphan:"drop-log",log:e[0]},this)),this.#t.get(r.tag)||null}async#y(t){const e=await da(t,this),r=e.tag;let i=this.#t.get(r);return i||(i={subscriber:this._getSubscriber(e),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#t.set(r,i)),i}async on(t,e){const r=await this.#y(t);return r.listeners.push({listener:e,once:!1}),r.started||(r.subscriber.start(),r.started=!0,this.#r!=null&&r.subscriber.pause(this.#r)),this}async once(t,e){const r=await this.#y(t);return r.listeners.push({listener:e,once:!0}),r.started||(r.subscriber.start(),r.started=!0,this.#r!=null&&r.subscriber.pause(this.#r)),this}async emit(t,...e){const r=await this.#w(t,e);if(!r||r.listeners.length===0)return!1;const i=r.listeners.length;return r.listeners=r.listeners.filter(({listener:o,once:c})=>{const _=new Xa(this,c?null:o,t);try{o.call(this,...e,_)}catch{}return!c}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),this.#t.delete(r.tag)),i>0}async listenerCount(t){if(t){const r=await this.#w(t);return r?r.listeners.length:0}let e=0;for(const{listeners:r}of this.#t.values())e+=r.length;return e}async listeners(t){if(t){const r=await this.#w(t);return r?r.listeners.map(({listener:i})=>i):[]}let e=[];for(const{listeners:r}of this.#t.values())e=e.concat(r.map(({listener:i})=>i));return e}async off(t,e){const r=await this.#w(t);if(!r)return this;if(e){const i=r.listeners.map(({listener:o})=>o).indexOf(e);i>=0&&r.listeners.splice(i,1)}return(!e||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),this.#t.delete(r.tag)),this}async removeAllListeners(t){if(t){const{tag:e,started:r,subscriber:i}=await this.#y(t);r&&i.stop(),this.#t.delete(e)}else for(const[e,{started:r,subscriber:i}]of this.#t)r&&i.stop(),this.#t.delete(e);return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return this.off(t,e)}get destroyed(){return this.#n}destroy(){this.removeAllListeners();for(const t of this.#_.keys())this._clearTimeout(t);this.#n=!0}get paused(){return this.#r!=null}set paused(t){!!t!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(t){if(this.#a=-1,this.#r!=null){if(this.#r==!!t)return;v(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(e=>e.pause(t)),this.#r=!!t;for(const e of this.#_.values())e.timer&&clearTimeout(e.timer),e.time=wa()-e.time}resume(){if(this.#r!=null){this._forEachSubscriber(t=>t.resume()),this.#r=null;for(const t of this.#_.values()){let e=t.time;e<0&&(e=0),t.time=wa(),setTimeout(t.func,e)}}}}function ay(n,t){try{const e=ga(n,t);if(e)return Es(e)}catch{}return null}function ga(n,t){if(n==="0x")return null;try{const e=Z(pt(n,t,t+32)),r=Z(pt(n,e,e+32));return pt(n,e+32,e+32+r)}catch{}return null}function Hl(n){const t=At(n);if(t.length>32)throw new Error("internal; should not happen");const e=new Uint8Array(32);return e.set(t,32-t.length),e}function cy(n){if(n.length%32===0)return n;const t=new Uint8Array(Math.ceil(n.length/32)*32);return t.set(n),t}const _y=new Uint8Array([]);function ly(n){const t=[];let e=0;for(let r=0;r<n.length;r++)t.push(_y),e+=32;for(let r=0;r<n.length;r++){const i=V(n[r]);t[r]=Hl(e),t.push(Hl(i.length)),t.push(cy(i)),e+=32+Math.ceil(i.length/32)*32}return ct(t)}const Vl="0x0000000000000000000000000000000000000000000000000000000000000000";function uy(n){const t={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};v(vn(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const e=pt(n,0,32);v(pt(e,0,12)===pt(Vl,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),t.sender=pt(e,12);try{const r=[],i=Z(pt(n,32,64)),o=Z(pt(n,i,i+32)),c=pt(n,i+32);for(let _=0;_<o;_++){const l=ay(c,_*32);if(l==null)throw new Error("abort");r.push(l)}t.urls=r}catch{v(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=ga(n,64);if(r==null)throw new Error("abort");t.calldata=r}catch{v(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}v(pt(n,100,128)===pt(Vl,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),t.selector=pt(n,96,100);try{const r=ga(n,128);if(r==null)throw new Error("abort");t.extraData=r}catch{v(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return t.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>t[r]),t}function Hn(n,t){if(n.provider)return n.provider;v(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Kl(n,t){let e=Qs(t);if(e.to!=null&&(e.to=Ot(e.to,n)),e.from!=null){const r=e.from;e.from=Promise.all([n.getAddress(),Ot(r,n)]).then(([i,o])=>(g(i.toLowerCase()===o.toLowerCase(),"transaction from mismatch","tx.from",o),i))}else e.from=n.getAddress();return await Tt(e)}class fy{provider;constructor(t){H(this,{provider:t||null})}async getNonce(t){return Hn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),t)}async populateCall(t){return await Kl(this,t)}async populateTransaction(t){const e=Hn(this,"populateTransaction"),r=await Kl(this,t);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const i=await this.provider.getNetwork();if(r.chainId!=null){const c=L(r.chainId);g(c===i.chainId,"transaction chainId mismatch","tx.chainId",t.chainId)}else r.chainId=i.chainId;const o=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||o)?g(!1,"eip-1559 transaction do not support gasPrice","tx",t):(r.type===0||r.type===1)&&o&&g(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",t),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const c=await e.getFeeData();v(c.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=c.gasPrice)}else{const c=await e.getFeeData();if(r.type==null)if(c.maxFeePerGas!=null&&c.maxPriorityFeePerGas!=null)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,r.gasPrice!=null){const _=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=_,r.maxPriorityFeePerGas=_}else r.maxFeePerGas==null&&(r.maxFeePerGas=c.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=c.maxPriorityFeePerGas);else c.gasPrice!=null?(v(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=c.gasPrice),r.type=0):v(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3||r.type===4)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=c.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=c.maxPriorityFeePerGas))}return await Tt(r)}async populateAuthorization(t){const e=Object.assign({},t);return e.chainId==null&&(e.chainId=(await Hn(this,"getNetwork").getNetwork()).chainId),e.nonce==null&&(e.nonce=await this.getNonce()),e}async estimateGas(t){return Hn(this,"estimateGas").estimateGas(await this.populateCall(t))}async call(t){return Hn(this,"call").call(await this.populateCall(t))}async resolveName(t){return await Hn(this,"resolveName").resolveName(t)}async sendTransaction(t){const e=Hn(this,"sendTransaction"),r=await this.populateTransaction(t);delete r.from;const i=oe.from(r);return await e.broadcastTransaction(await this.signTransaction(i))}authorize(t){v(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}function hy(n){return JSON.parse(JSON.stringify(n))}class Ql{#t;#e;#r;#n;#i;#o;constructor(t){this.#t=t,this.#e=null,this.#r=this.#s.bind(this),this.#n=!1,this.#i=null,this.#o=!1}_subscribe(t){throw new Error("subclasses must override this")}_emitResults(t,e){throw new Error("subclasses must override this")}_recover(t){throw new Error("subclasses must override this")}async#s(t){try{this.#e==null&&(this.#e=this._subscribe(this.#t));let e=null;try{e=await this.#e}catch(o){if(!kt(o,"UNSUPPORTED_OPERATION")||o.operation!=="eth_newFilter")throw o}if(e==null){this.#e=null,this.#t._recoverSubscriber(this,this._recover(this.#t));return}const r=await this.#t.getNetwork();if(this.#i||(this.#i=r),this.#i.chainId!==r.chainId)throw new Error("chaid changed");if(this.#o)return;const i=await this.#t.send("eth_getFilterChanges",[e]);await this._emitResults(this.#t,i)}catch(e){console.log("@TODO",e)}this.#t.once("block",this.#r)}#a(){const t=this.#e;t&&(this.#e=null,t.then(e=>{this.#t.destroyed||this.#t.send("eth_uninstallFilter",[e])}))}start(){this.#n||(this.#n=!0,this.#s(-2))}stop(){this.#n&&(this.#n=!1,this.#o=!0,this.#a(),this.#t.off("block",this.#r))}pause(t){t&&this.#a(),this.#t.off("block",this.#r)}resume(){this.start()}}class py extends Ql{#t;constructor(t,e){super(t),this.#t=hy(e)}_recover(t){return new ha(t,this.#t)}async _subscribe(t){return await t.send("eth_newFilter",[this.#t])}async _emitResults(t,e){for(const r of e)t.emit(this.#t,t._wrapLog(r,t._network))}}class dy extends Ql{async _subscribe(t){return await t.send("eth_newPendingTransactionFilter",[])}async _emitResults(t,e){for(const r of e)t.emit("pending",r)}}const wy="bigint,boolean,function,number,string,symbol".split(/,/g);function to(n){if(n==null||wy.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(to);if(typeof n=="object")return Object.keys(n).reduce((t,e)=>(t[e]=n[e],t),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function gy(n){return new Promise(t=>{setTimeout(t,n)})}function bi(n){return n&&n.toLowerCase()}function Jl(n){return n&&typeof n.pollingInterval=="number"}const $l={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class ya extends fy{address;constructor(t,e){super(t),e=Y(e),H(this,{address:e})}connect(t){v(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const e=to(t),r=[];if(e.from){const o=e.from;r.push((async()=>{const c=await Ot(o,this.provider);g(c!=null&&c.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),e.from=c})())}else e.from=this.address;if(e.gasLimit==null&&r.push((async()=>{e.gasLimit=await this.provider.estimateGas({...e,from:this.address})})()),e.to!=null){const o=e.to;r.push((async()=>{e.to=await Ot(o,this.provider)})())}r.length&&await Promise.all(r);const i=this.provider.getRpcTransaction(e);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const e=await this.provider.getBlockNumber(),r=await this.sendUncheckedTransaction(t);return await new Promise((i,o)=>{const c=[1e3,100];let _=0;const l=async()=>{try{const u=await this.provider.getTransaction(r);if(u!=null){i(u.replaceableTransaction(e));return}}catch(u){if(kt(u,"CANCELLED")||kt(u,"BAD_DATA")||kt(u,"NETWORK_ERROR")||kt(u,"UNSUPPORTED_OPERATION")){u.info==null&&(u.info={}),u.info.sendTransactionHash=r,o(u);return}if(kt(u,"INVALID_ARGUMENT")&&(_++,u.info==null&&(u.info={}),u.info.sendTransactionHash=r,_>10)){o(u);return}this.provider.emit("error",lt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{l()},c.pop()||4e3)};l()})}async signTransaction(t){const e=to(t);if(e.from){const i=await Ot(e.from,this.provider);g(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),e.from=i}else e.from=this.address;const r=this.provider.getRpcTransaction(e);return await this.provider.send("eth_signTransaction",[r])}async signMessage(t){const e=typeof t=="string"?Lr(t):t;return await this.provider.send("personal_sign",[O(e),this.address.toLowerCase()])}async signTypedData(t,e,r){const i=to(r),o=await Lt.resolveNames(t,e,i,async c=>{const _=await Ot(c);return g(_!=null,"TypedData does not support null address","value",c),_});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Lt.getPayload(o.domain,e,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const e=typeof t=="string"?Lr(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),O(e)])}}class yy extends oy{#t;#e;#r;#n;#i;#o;#s;#a(){if(this.#n)return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#n=setTimeout(()=>{this.#n=null;const e=this.#r;for(this.#r=[];e.length;){const r=[e.shift()];for(;e.length&&r.length!==this.#t.batchMaxCount;)if(r.push(e.shift()),JSON.stringify(r.map(o=>o.payload)).length>this.#t.batchMaxSize){e.unshift(r.pop());break}(async()=>{const i=r.length===1?r[0].payload:r.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:c,reject:_,payload:l}of r){if(this.destroyed){_(lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const u=o.filter(p=>p.id===l.id)[0];if(u==null){const p=lt("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",p),_(p);continue}if("error"in u){_(this.getRpcError(l,u));continue}c(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:c}of r)c(o)}})()}},t)}constructor(t,e){super(t,e),this.#e=1,this.#t=Object.assign({},$l,e||{}),this.#r=[],this.#n=null,this.#o=null,this.#s=null;{let i=null;const o=new Promise(c=>{i=c});this.#i={promise:o,resolve:i}}const r=this._getOption("staticNetwork");typeof r=="boolean"?(g(!r||t!=="any","staticNetwork cannot be used on special network 'any'","options",e),r&&t!=null&&(this.#o=Vt.from(t))):r&&(g(t==null||r.matches(t),"staticNetwork MUST match network object","options",e),this.#o=r)}_getOption(t){return this.#t[t]}get _network(){return v(this.#o,"network is not available yet","NETWORK_ERROR"),this.#o}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let r=t.transaction;if(r&&r.type!=null&&L(r.type)&&r.maxFeePerGas==null&&r.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},r,{type:void 0})}))}}const e=this.getRpcRequest(t);return e!=null?await this.send(e.method,e.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(this.#o)return this.#o}else return t;return this.#s?await this.#s:this.ready?(this.#s=(async()=>{try{const e=Vt.from(L(await this.send("eth_chainId",[])));return this.#s=null,e}catch(e){throw this.#s=null,e}})(),await this.#s):(this.#s=(async()=>{const e={id:this.#e++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:e});let r;try{r=(await this._send(e))[0],this.#s=null}catch(i){throw this.#s=null,this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:r}),"result"in r)return Vt.from(L(r.result));throw this.getRpcError(e,r)})(),await this.#s)}_start(){this.#i==null||this.#i.resolve==null||(this.#i.resolve(),this.#i=null,(async()=>{for(;this.#o==null&&!this.destroyed;)try{this.#o=await this._detectNetwork()}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",lt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await gy(1e3)}this.#a()})())}async _waitUntilReady(){if(this.#i!=null)return await this.#i.promise}_getSubscriber(t){return t.type==="pending"?new dy(this):t.type==="event"?this._getOption("polling")?new ha(this,t.filter):new py(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new Gl("orphan"):super._getSubscriber(t)}get ready(){return this.#i==null}getRpcTransaction(t){const e={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(r=>{if(t[r]==null)return;let i=r;r==="gasLimit"&&(i="gas"),e[i]=ie(L(t[r],`tx.${r}`))}),["from","to","data"].forEach(r=>{t[r]!=null&&(e[r]=O(t[r]))}),t.accessList&&(e.accessList=Bn(t.accessList)),t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.map(r=>r.toLowerCase())),t.authorizationList&&(e.authorizationList=t.authorizationList.map(r=>{const i=p_(r);return{address:i.address,nonce:ie(i.nonce),chainId:ie(i.chainId),yParity:ie(i.signature.yParity),r:ie(i.signature.r),s:ie(i.signature.s)}})),e}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[bi(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[bi(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[bi(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[bi(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(bi):t.filter.address=bi(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,e){const{method:r}=t,{error:i}=e;if(r==="eth_estimateGas"&&i.message){const _=i.message;if(!_.match(/revert/i)&&_.match(/insufficient funds/i))return lt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}});if(_.match(/nonce/i)&&_.match(/too low/i))return lt("nonce has already been used","NONCE_EXPIRED",{transaction:t.params[0],info:{payload:t,error:i}})}if(r==="eth_call"||r==="eth_estimateGas"){const _=ba(i),l=gn.getBuiltinCallException(r==="eth_call"?"call":"estimateGas",t.params[0],_?_.data:null);return l.info={error:i,payload:t},l}const o=JSON.stringify(my(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return lt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[r]||"unknown",reason:"rejected",info:{payload:t,error:i}});if(r==="eth_sendRawTransaction"||r==="eth_sendTransaction"){const _=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return lt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:_,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return lt("nonce has already been used","NONCE_EXPIRED",{transaction:_,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return lt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:_,info:{error:i}});if(o.match(/only replay-protected/i))return lt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:r,info:{transaction:_,info:{error:i}}})}let c=!!o.match(/the method .* does not exist/i);return c||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(c=!0),c?lt("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):lt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,e){if(this.destroyed)return Promise.reject(lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const r=this.#e++,i=new Promise((o,c)=>{this.#r.push({resolve:o,reject:c,payload:{method:t,params:e,id:r,jsonrpc:"2.0"}})});return this.#a(),i}async getSigner(t){t==null&&(t=0);const e=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await e;if(t>=i.length)throw new Error("no such account");return new ya(this,i[t])}const{accounts:r}=await Tt({network:this.getNetwork(),accounts:e});t=Y(t);for(const i of r)if(Y(i)===t)return new ya(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(e=>new ya(this,e))}destroy(){this.#n&&(clearTimeout(this.#n),this.#n=null);for(const{payload:t,reject:e}of this.#r)e(lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));this.#r=[],super.destroy()}}class Wl extends yy{#t;constructor(t,e){super(t,e);let r=this._getOption("pollingInterval");r==null&&(r=$l.pollingInterval),this.#t=r}_getSubscriber(t){const e=super._getSubscriber(t);return Jl(e)&&(e.pollingInterval=this.#t),e}get pollingInterval(){return this.#t}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");this.#t=t,this._forEachSubscriber(e=>{Jl(e)&&(e.pollingInterval=this.#t)})}}class by extends Wl{#t;constructor(t,e,r){t==null&&(t="http://localhost:8545"),super(e,r),typeof t=="string"?this.#t=new Mr(t):this.#t=t.clone()}_getConnection(){return this.#t.clone()}async send(t,e){return await this._start(),await super.send(t,e)}async _send(t){const e=this._getConnection();e.body=JSON.stringify(t),e.setHeader("content-type","application/json");const r=await e.send();r.assertOk();let i=r.bodyJson;return Array.isArray(i)||(i=[i]),i}}function ba(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&st(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const t in n){const e=ba(n[t]);if(e)return e}return null}if(typeof n=="string")try{return ba(JSON.parse(n))}catch{}return null}function ma(n,t){if(n!=null){if(typeof n.message=="string"&&t.push(n.message),typeof n=="object")for(const e in n)ma(n[e],t);if(typeof n=="string")try{return ma(JSON.parse(n),t)}catch{}}}function my(n){const t=[];return ma(n,t),t}class Vn extends Wl{#t;#e;constructor(t,e,r){const i=Object.assign({},r??{},{batchMaxCount:1});g(t&&t.request,"invalid EIP-1193 provider","ethereum",t),super(e,i),this.#e=null,r&&r.providerInfo&&(this.#e=r.providerInfo),this.#t=async(o,c)=>{const _={method:o,params:c};this.emit("debug",{action:"sendEip1193Request",payload:_});try{const l=await t.request(_);return this.emit("debug",{action:"receiveEip1193Result",result:l}),l}catch(l){const u=new Error(l.message);throw u.code=l.code,u.data=l.data,u.payload=_,this.emit("debug",{action:"receiveEip1193Error",error:u}),u}}}get providerInfo(){return this.#e}async send(t,e){return await this._start(),await super.send(t,e)}async _send(t){g(!Array.isArray(t),"EIP-1193 does not support batch request","payload",t);try{const e=await this.#t(t.method,t.params||[]);return[{id:t.id,result:e}]}catch(e){return[{id:t.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(t,e){switch(e=JSON.parse(JSON.stringify(e)),e.error.code||-1){case 4001:e.error.message=`ethers-user-denied: ${e.error.message}`;break;case 4200:e.error.message=`ethers-unsupported: ${e.error.message}`;break}return super.getRpcError(t,e)}async hasSigner(t){t==null&&(t=0);const e=await this.send("eth_accounts",[]);return typeof t=="number"?e.length>t:(t=t.toLowerCase(),e.filter(r=>r.toLowerCase()===t).length!==0)}async getSigner(t){if(t==null&&(t=0),!await this.hasSigner(t))try{await this.#t("eth_requestAccounts",[])}catch(e){const r=e.payload;throw this.getRpcError(r,{id:r.id,error:e})}return await super.getSigner(t)}static async discover(t){if(t==null&&(t={}),t.provider)return new Vn(t.provider);const e=t.window?t.window:typeof window<"u"?window:null;if(e==null)return null;const r=t.anyProvider;if(r&&e.ethereum)return new Vn(e.ethereum);if(!("addEventListener"in e&&"dispatchEvent"in e&&"removeEventListener"in e))return null;const i=t.timeout?t.timeout:300;return i===0?null:await new Promise((o,c)=>{let _=[];const l=f=>{_.push(f.detail),r&&u()},u=()=>{if(clearTimeout(p),_.length)if(t&&t.filter){const f=t.filter(_.map(d=>Object.assign({},d.info)));if(f==null)o(null);else if(f instanceof Vn)o(f);else{let d=null;if(f.uuid&&(d=_.filter(x=>f.uuid===x.info.uuid)[0]),d){const{provider:b,info:x}=d;o(new Vn(b,void 0,{providerInfo:x}))}else c(lt("filter returned unknown info","UNSUPPORTED_OPERATION",{value:f}))}}else{const{provider:f,info:d}=_[0];o(new Vn(f,void 0,{providerInfo:d}))}else o(null);e.removeEventListener("eip6963:announceProvider",l)},p=setTimeout(()=>{u()},i);e.addEventListener("eip6963:announceProvider",l),e.dispatchEvent(new Event("eip6963:requestProvider"))})}}const Ay=()=>(async n=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(n)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var eo=typeof Wr<"u"?Wr:typeof self<"u"?self:typeof window<"u"?window:{};function ql(n,t){return new Promise(e=>{n.addEventListener("message",function r({data:i}){i?.type===t&&(n.removeEventListener("message",r),e(i))})})}ql(self,"wasm_bindgen_worker_init").then(async({init:n,receiver:t})=>{const e=await Promise.resolve().then(function(){return Ty});await e.default(n),postMessage({type:"wasm_bindgen_worker_ready"}),e.wbg_rayon_start_worker(t)});async function Ey(n,t,e){if(e.numThreads()===0)throw new Error("num_threads must be > 0.");const r={type:"wasm_bindgen_worker_init",init:{module_or_path:n,memory:t},receiver:e.receiver()};await Promise.all(Array.from({length:e.numThreads()},async()=>{let i;try{i=new Worker(new URL("/workerHelpers.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:yt&&yt.tagName.toUpperCase()==="SCRIPT"&&yt.src||new URL("relayer-sdk-js.umd.cjs",document.baseURI).href),{type:"module"})}catch{const _=await(await fetch("/workerHelpers.js")).blob(),l=URL.createObjectURL(_);i=new Worker(l)}return i.postMessage(r),await ql(i,"wasm_bindgen_worker_ready"),i})),e.build()}let s;function rs(n){const t=s.__externref_table_alloc();return s.__wbindgen_export_2.set(t,n),t}function mi(n,t){try{return n.apply(this,t)}catch(e){const r=rs(e);s.__wbindgen_exn_store(r)}}let ns=null;function Ai(){return(ns===null||ns.buffer!==s.memory.buffer)&&(ns=new Uint8Array(s.memory.buffer)),ns}let ro=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ro.decode();const xy=2146435072;let Aa=0;function Ry(n,t){return Aa+=t,Aa>=xy&&(ro=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),ro.decode(),Aa=t),ro.decode(Ai().slice(n,n+t))}function is(n,t){return n=n>>>0,Ry(n,t)}function m(n,t){return n=n>>>0,Ai().subarray(n/1,n/1+t)}let w=0;const no=new TextEncoder;no.encodeInto=function(n,t){const e=no.encode(n);return t.set(e),{read:n.length,written:e.length}};function io(n,t,e){if(e===void 0){const _=no.encode(n),l=t(_.length,1)>>>0;return Ai().subarray(l,l+_.length).set(_),w=_.length,l}let r=n.length,i=t(r,1)>>>0;const o=Ai();let c=0;for(;c<r;c++){const _=n.charCodeAt(c);if(_>127)break;o[i+c]=_}if(c!==r){c!==0&&(n=n.slice(c)),i=e(i,r,r=c+n.length*3,1)>>>0;const _=Ai().subarray(i+c,i+r),l=no.encodeInto(n,_);c+=l.written,i=e(i,r,c,1)>>>0}return w=c,i}let ss=null;function Vr(){return(ss===null||ss.buffer!==s.memory.buffer)&&(ss=new DataView(s.memory.buffer)),ss}function Kn(n){return n==null}function Ea(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){const i=n.length;let o="[";i>0&&(o+=Ea(n[0]));for(let c=1;c<i;c++)o+=", "+Ea(n[c]);return o+="]",o}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(e&&e.length>1)r=e[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
|
2
|
-
${n.stack}`:r}function y(n,t){const e=t(n.length*1,1)>>>0;return Ai().set(n,e/1),w=n.length,e}function a(n){const t=s.__wbindgen_export_2.get(n);return s.__externref_table_dealloc(n),t}function h(n,t){if(!(n instanceof t))throw new Error(`expected instance of ${t.name}`)}function xa(){s.init_panic_hook()}function zy(n){s.wbg_rayon_start_worker(n)}function Ra(n){return s.initThreadPool(n)}const Zl=Object.freeze({Proof:0,0:"Proof",Verify:1,1:"Verify"});typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_boolean_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanclientkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleancompressedciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleancompressedserverkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleannoisedistribution_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanparameters_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanpublickey_free(n>>>0,1));const Yl=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactciphertextlist_free(n>>>0,1));class Kr{static __wrap(t){t=t>>>0;const e=Object.create(Kr.prototype);return e.__wbg_ptr=t,Yl.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Yl.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactciphertextlist_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.compactciphertextlist_deserialize(e,r);if(i[2])throw a(i[1]);return Kr.__wrap(i[0])}get_kind_of(t){const e=s.compactciphertextlist_get_kind_of(this.__wbg_ptr,t);return e===84?void 0:e}safe_serialize(t){const e=s.compactciphertextlist_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.compactciphertextlist_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Kr.__wrap(o[0])}len(){return s.compactciphertextlist_len(this.__wbg_ptr)>>>0}expand(){const t=s.compactciphertextlist_expand(this.__wbg_ptr);if(t[2])throw a(t[1]);return yn.__wrap(t[0])}static builder(t){h(t,Qt);const e=s.compactciphertextlist_builder(t.__wbg_ptr);if(e[2])throw a(e[1]);return Qn.__wrap(e[0])}is_empty(){return s.compactciphertextlist_is_empty(this.__wbg_ptr)!==0}serialize(){const t=s.compactciphertextlist_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Kr.prototype[Symbol.dispose]=Kr.prototype.free);const Xl=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactciphertextlistbuilder_free(n>>>0,1));class Qn{static __wrap(t){t=t>>>0;const e=Object.create(Qn.prototype);return e.__wbg_ptr=t,Xl.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Xl.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactciphertextlistbuilder_free(t,0)}push_i1024(t){const e=s.compactciphertextlistbuilder_push_i1024(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i2048(t){const e=s.compactciphertextlistbuilder_push_i2048(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u1024(t){const e=s.compactciphertextlistbuilder_push_u1024(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u2048(t){const e=s.compactciphertextlistbuilder_push_u2048(this.__wbg_ptr,t);if(e[1])throw a(e[0])}build_packed(){const t=s.compactciphertextlistbuilder_build_packed(this.__wbg_ptr);if(t[2])throw a(t[1]);return Kr.__wrap(t[0])}push_boolean(t){const e=s.compactciphertextlistbuilder_push_boolean(this.__wbg_ptr,t);if(e[1])throw a(e[0])}build_with_proof_packed(t,e,r){h(t,Kt);const i=y(e,s.__wbindgen_malloc),o=w,c=s.compactciphertextlistbuilder_build_with_proof_packed(this.__wbg_ptr,t.__wbg_ptr,i,o,r);if(c[2])throw a(c[1]);return bn.__wrap(c[0])}build(){const t=s.compactciphertextlistbuilder_build(this.__wbg_ptr);if(t[2])throw a(t[1]);return Kr.__wrap(t[0])}push_i2(t){const e=s.compactciphertextlistbuilder_push_i2(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i4(t){const e=s.compactciphertextlistbuilder_push_i4(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i6(t){const e=s.compactciphertextlistbuilder_push_i6(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i8(t){const e=s.compactciphertextlistbuilder_push_i8(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u2(t){const e=s.compactciphertextlistbuilder_push_u2(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u4(t){const e=s.compactciphertextlistbuilder_push_u4(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u6(t){const e=s.compactciphertextlistbuilder_push_u6(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u8(t){const e=s.compactciphertextlistbuilder_push_u8(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i10(t){const e=s.compactciphertextlistbuilder_push_i10(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i12(t){const e=s.compactciphertextlistbuilder_push_i12(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i14(t){const e=s.compactciphertextlistbuilder_push_i14(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i16(t){const e=s.compactciphertextlistbuilder_push_i16(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i24(t){const e=s.compactciphertextlistbuilder_push_i24(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i32(t){const e=s.compactciphertextlistbuilder_push_i32(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i40(t){const e=s.compactciphertextlistbuilder_push_i40(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i48(t){const e=s.compactciphertextlistbuilder_push_i48(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i56(t){const e=s.compactciphertextlistbuilder_push_i56(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i64(t){const e=s.compactciphertextlistbuilder_push_i64(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i72(t){const e=s.compactciphertextlistbuilder_push_i72(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i80(t){const e=s.compactciphertextlistbuilder_push_i80(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i88(t){const e=s.compactciphertextlistbuilder_push_i88(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i96(t){const e=s.compactciphertextlistbuilder_push_i96(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u10(t){const e=s.compactciphertextlistbuilder_push_u10(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u12(t){const e=s.compactciphertextlistbuilder_push_u12(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u14(t){const e=s.compactciphertextlistbuilder_push_u14(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u16(t){const e=s.compactciphertextlistbuilder_push_u16(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u24(t){const e=s.compactciphertextlistbuilder_push_u24(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u32(t){const e=s.compactciphertextlistbuilder_push_u32(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u40(t){const e=s.compactciphertextlistbuilder_push_u40(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u48(t){const e=s.compactciphertextlistbuilder_push_u48(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u56(t){const e=s.compactciphertextlistbuilder_push_u56(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u64(t){const e=s.compactciphertextlistbuilder_push_u64(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u72(t){const e=s.compactciphertextlistbuilder_push_u72(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u80(t){const e=s.compactciphertextlistbuilder_push_u80(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u88(t){const e=s.compactciphertextlistbuilder_push_u88(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u96(t){const e=s.compactciphertextlistbuilder_push_u96(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i104(t){const e=s.compactciphertextlistbuilder_push_i104(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i112(t){const e=s.compactciphertextlistbuilder_push_i112(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i120(t){const e=s.compactciphertextlistbuilder_push_i120(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i128(t){const e=s.compactciphertextlistbuilder_push_i128(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i136(t){const e=s.compactciphertextlistbuilder_push_i136(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i144(t){const e=s.compactciphertextlistbuilder_push_i144(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i152(t){const e=s.compactciphertextlistbuilder_push_i152(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i160(t){const e=s.compactciphertextlistbuilder_push_i160(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i168(t){const e=s.compactciphertextlistbuilder_push_i168(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i176(t){const e=s.compactciphertextlistbuilder_push_i176(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i184(t){const e=s.compactciphertextlistbuilder_push_i184(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i192(t){const e=s.compactciphertextlistbuilder_push_i192(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i200(t){const e=s.compactciphertextlistbuilder_push_i200(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i208(t){const e=s.compactciphertextlistbuilder_push_i208(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i216(t){const e=s.compactciphertextlistbuilder_push_i216(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i224(t){const e=s.compactciphertextlistbuilder_push_i224(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i232(t){const e=s.compactciphertextlistbuilder_push_i232(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i240(t){const e=s.compactciphertextlistbuilder_push_i240(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i248(t){const e=s.compactciphertextlistbuilder_push_i248(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i256(t){const e=s.compactciphertextlistbuilder_push_i256(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i512(t){const e=s.compactciphertextlistbuilder_push_i512(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u104(t){const e=s.compactciphertextlistbuilder_push_u104(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u112(t){const e=s.compactciphertextlistbuilder_push_u112(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u120(t){const e=s.compactciphertextlistbuilder_push_u120(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u128(t){const e=s.compactciphertextlistbuilder_push_u128(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u136(t){const e=s.compactciphertextlistbuilder_push_u136(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u144(t){const e=s.compactciphertextlistbuilder_push_u144(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u152(t){const e=s.compactciphertextlistbuilder_push_u152(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u160(t){const e=s.compactciphertextlistbuilder_push_u160(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u168(t){const e=s.compactciphertextlistbuilder_push_u168(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u176(t){const e=s.compactciphertextlistbuilder_push_u176(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u184(t){const e=s.compactciphertextlistbuilder_push_u184(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u192(t){const e=s.compactciphertextlistbuilder_push_u192(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u200(t){const e=s.compactciphertextlistbuilder_push_u200(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u208(t){const e=s.compactciphertextlistbuilder_push_u208(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u216(t){const e=s.compactciphertextlistbuilder_push_u216(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u224(t){const e=s.compactciphertextlistbuilder_push_u224(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u232(t){const e=s.compactciphertextlistbuilder_push_u232(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u240(t){const e=s.compactciphertextlistbuilder_push_u240(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u248(t){const e=s.compactciphertextlistbuilder_push_u248(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u256(t){const e=s.compactciphertextlistbuilder_push_u256(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u512(t){const e=s.compactciphertextlistbuilder_push_u512(this.__wbg_ptr,t);if(e[1])throw a(e[0])}}Symbol.dispose&&(Qn.prototype[Symbol.dispose]=Qn.prototype.free);const tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactciphertextlistexpander_free(n>>>0,1));class yn{static __wrap(t){t=t>>>0;const e=Object.create(yn.prototype);return e.__wbg_ptr=t,tu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,tu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactciphertextlistexpander_free(t,0)}get_int104(t){const e=s.compactciphertextlistexpander_get_int104(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return fe.__wrap(e[0])}get_int112(t){const e=s.compactciphertextlistexpander_get_int112(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return he.__wrap(e[0])}get_int120(t){const e=s.compactciphertextlistexpander_get_int120(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return de.__wrap(e[0])}get_int128(t){const e=s.compactciphertextlistexpander_get_int128(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return we.__wrap(e[0])}get_int136(t){const e=s.compactciphertextlistexpander_get_int136(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ge.__wrap(e[0])}get_int144(t){const e=s.compactciphertextlistexpander_get_int144(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return be.__wrap(e[0])}get_int152(t){const e=s.compactciphertextlistexpander_get_int152(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return me.__wrap(e[0])}get_int160(t){const e=s.compactciphertextlistexpander_get_int160(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ee.__wrap(e[0])}get_int168(t){const e=s.compactciphertextlistexpander_get_int168(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return xe.__wrap(e[0])}get_int176(t){const e=s.compactciphertextlistexpander_get_int176(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Re.__wrap(e[0])}get_int184(t){const e=s.compactciphertextlistexpander_get_int184(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ze.__wrap(e[0])}get_int192(t){const e=s.compactciphertextlistexpander_get_int192(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Pe.__wrap(e[0])}get_int200(t){const e=s.compactciphertextlistexpander_get_int200(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ke.__wrap(e[0])}get_int208(t){const e=s.compactciphertextlistexpander_get_int208(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Se.__wrap(e[0])}get_int216(t){const e=s.compactciphertextlistexpander_get_int216(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Te.__wrap(e[0])}get_int224(t){const e=s.compactciphertextlistexpander_get_int224(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Be.__wrap(e[0])}get_int232(t){const e=s.compactciphertextlistexpander_get_int232(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ce.__wrap(e[0])}get_int240(t){const e=s.compactciphertextlistexpander_get_int240(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ne.__wrap(e[0])}get_int248(t){const e=s.compactciphertextlistexpander_get_int248(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Fe.__wrap(e[0])}get_int256(t){const e=s.compactciphertextlistexpander_get_int256(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return De.__wrap(e[0])}get_int512(t){const e=s.compactciphertextlistexpander_get_int512(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ge.__wrap(e[0])}get_uint10(t){const e=s.compactciphertextlistexpander_get_uint10(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ze.__wrap(e[0])}get_uint12(t){const e=s.compactciphertextlistexpander_get_uint12(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return er.__wrap(e[0])}get_uint14(t){const e=s.compactciphertextlistexpander_get_uint14(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return sr.__wrap(e[0])}get_uint16(t){const e=s.compactciphertextlistexpander_get_uint16(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return cr.__wrap(e[0])}get_uint24(t){const e=s.compactciphertextlistexpander_get_uint24(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ar.__wrap(e[0])}get_uint32(t){const e=s.compactciphertextlistexpander_get_uint32(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return zr.__wrap(e[0])}get_uint40(t){const e=s.compactciphertextlistexpander_get_uint40(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return vr.__wrap(e[0])}get_uint48(t){const e=s.compactciphertextlistexpander_get_uint48(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return kr.__wrap(e[0])}get_uint56(t){const e=s.compactciphertextlistexpander_get_uint56(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Sr.__wrap(e[0])}get_uint64(t){const e=s.compactciphertextlistexpander_get_uint64(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Br.__wrap(e[0])}get_uint72(t){const e=s.compactciphertextlistexpander_get_uint72(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Cr.__wrap(e[0])}get_uint80(t){const e=s.compactciphertextlistexpander_get_uint80(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Nr.__wrap(e[0])}get_uint88(t){const e=s.compactciphertextlistexpander_get_uint88(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Fr.__wrap(e[0])}get_uint96(t){const e=s.compactciphertextlistexpander_get_uint96(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Dr.__wrap(e[0])}get_int1024(t){const e=s.compactciphertextlistexpander_get_int1024(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ue.__wrap(e[0])}get_int2048(t){const e=s.compactciphertextlistexpander_get_int2048(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ie.__wrap(e[0])}get_kind_of(t){const e=s.compactciphertextlistexpander_get_kind_of(this.__wbg_ptr,t);return e===84?void 0:e}get_uint104(t){const e=s.compactciphertextlistexpander_get_uint104(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Xe.__wrap(e[0])}get_uint112(t){const e=s.compactciphertextlistexpander_get_uint112(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return tr.__wrap(e[0])}get_uint120(t){const e=s.compactciphertextlistexpander_get_uint120(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return rr.__wrap(e[0])}get_uint128(t){const e=s.compactciphertextlistexpander_get_uint128(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return nr.__wrap(e[0])}get_uint136(t){const e=s.compactciphertextlistexpander_get_uint136(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ir.__wrap(e[0])}get_uint144(t){const e=s.compactciphertextlistexpander_get_uint144(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return or.__wrap(e[0])}get_uint152(t){const e=s.compactciphertextlistexpander_get_uint152(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ar.__wrap(e[0])}get_uint160(t){const e=s.compactciphertextlistexpander_get_uint160(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return _r.__wrap(e[0])}get_uint168(t){const e=s.compactciphertextlistexpander_get_uint168(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return lr.__wrap(e[0])}get_uint176(t){const e=s.compactciphertextlistexpander_get_uint176(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ur.__wrap(e[0])}get_uint184(t){const e=s.compactciphertextlistexpander_get_uint184(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return fr.__wrap(e[0])}get_uint192(t){const e=s.compactciphertextlistexpander_get_uint192(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return hr.__wrap(e[0])}get_uint200(t){const e=s.compactciphertextlistexpander_get_uint200(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return dr.__wrap(e[0])}get_uint208(t){const e=s.compactciphertextlistexpander_get_uint208(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return gr.__wrap(e[0])}get_uint216(t){const e=s.compactciphertextlistexpander_get_uint216(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return yr.__wrap(e[0])}get_uint224(t){const e=s.compactciphertextlistexpander_get_uint224(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return br.__wrap(e[0])}get_uint232(t){const e=s.compactciphertextlistexpander_get_uint232(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return mr.__wrap(e[0])}get_uint240(t){const e=s.compactciphertextlistexpander_get_uint240(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Er.__wrap(e[0])}get_uint248(t){const e=s.compactciphertextlistexpander_get_uint248(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return xr.__wrap(e[0])}get_uint256(t){const e=s.compactciphertextlistexpander_get_uint256(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Rr.__wrap(e[0])}get_uint512(t){const e=s.compactciphertextlistexpander_get_uint512(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ir.__wrap(e[0])}get_uint1024(t){const e=s.compactciphertextlistexpander_get_uint1024(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ye.__wrap(e[0])}get_uint2048(t){const e=s.compactciphertextlistexpander_get_uint2048(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return wr.__wrap(e[0])}len(){return s.compactciphertextlistexpander_len(this.__wbg_ptr)>>>0}get_bool(t){const e=s.compactciphertextlistexpander_get_bool(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return _e.__wrap(e[0])}get_int2(t){const e=s.compactciphertextlistexpander_get_int2(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ve.__wrap(e[0])}get_int4(t){const e=s.compactciphertextlistexpander_get_int4(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Le.__wrap(e[0])}get_int6(t){const e=s.compactciphertextlistexpander_get_int6(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ve.__wrap(e[0])}get_int8(t){const e=s.compactciphertextlistexpander_get_int8(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Je.__wrap(e[0])}is_empty(){return s.compactciphertextlistexpander_is_empty(this.__wbg_ptr)!==0}get_int10(t){const e=s.compactciphertextlistexpander_get_int10(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return le.__wrap(e[0])}get_int12(t){const e=s.compactciphertextlistexpander_get_int12(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return pe.__wrap(e[0])}get_int14(t){const e=s.compactciphertextlistexpander_get_int14(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ye.__wrap(e[0])}get_int16(t){const e=s.compactciphertextlistexpander_get_int16(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ae.__wrap(e[0])}get_int24(t){const e=s.compactciphertextlistexpander_get_int24(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Oe.__wrap(e[0])}get_int32(t){const e=s.compactciphertextlistexpander_get_int32(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ue.__wrap(e[0])}get_int40(t){const e=s.compactciphertextlistexpander_get_int40(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Me.__wrap(e[0])}get_int48(t){const e=s.compactciphertextlistexpander_get_int48(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return je.__wrap(e[0])}get_int56(t){const e=s.compactciphertextlistexpander_get_int56(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return He.__wrap(e[0])}get_int64(t){const e=s.compactciphertextlistexpander_get_int64(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ke.__wrap(e[0])}get_int72(t){const e=s.compactciphertextlistexpander_get_int72(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Qe.__wrap(e[0])}get_int80(t){const e=s.compactciphertextlistexpander_get_int80(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return $e.__wrap(e[0])}get_int88(t){const e=s.compactciphertextlistexpander_get_int88(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return We.__wrap(e[0])}get_int96(t){const e=s.compactciphertextlistexpander_get_int96(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return qe.__wrap(e[0])}get_uint2(t){const e=s.compactciphertextlistexpander_get_uint2(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return pr.__wrap(e[0])}get_uint4(t){const e=s.compactciphertextlistexpander_get_uint4(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Pr.__wrap(e[0])}get_uint6(t){const e=s.compactciphertextlistexpander_get_uint6(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Tr.__wrap(e[0])}get_uint8(t){const e=s.compactciphertextlistexpander_get_uint8(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Or.__wrap(e[0])}}Symbol.dispose&&(yn.prototype[Symbol.dispose]=yn.prototype.free);const eu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactpkecrs_free(n>>>0,1));class Kt{static __wrap(t){t=t>>>0;const e=Object.create(Kt.prototype);return e.__wbg_ptr=t,eu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,eu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactpkecrs_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.compactpkecrs_deserialize(e,r);if(i[2])throw a(i[1]);return Kt.__wrap(i[0])}static from_config(t,e){h(t,mn);const r=s.compactpkecrs_from_config(t.__wbg_ptr,e);if(r[2])throw a(r[1]);return Kt.__wrap(r[0])}safe_serialize(t){const e=s.compactpkecrs_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.compactpkecrs_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Kt.__wrap(o[0])}static deserialize_from_public_params(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.compactpkecrs_deserialize_from_public_params(e,r);if(i[2])throw a(i[1]);return Kt.__wrap(i[0])}static safe_deserialize_from_public_params(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.compactpkecrs_safe_deserialize_from_public_params(r,i,e);if(o[2])throw a(o[1]);return Kt.__wrap(o[0])}serialize(t){const e=s.compactpkecrs_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}}Symbol.dispose&&(Kt.prototype[Symbol.dispose]=Kt.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfhebool_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint10_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint1024_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint104_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint112_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint12_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint120_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint128_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint136_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint14_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint144_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint152_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint16_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint160_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint168_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint176_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint184_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint192_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint2_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint200_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint2048_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint208_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint216_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint224_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint232_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint24_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint240_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint248_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint256_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint32_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint4_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint40_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint48_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint512_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint56_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint6_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint64_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint72_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint8_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint80_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint88_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint96_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint10_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint1024_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint104_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint112_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint12_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint120_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint128_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint136_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint14_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint144_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint152_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint16_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint160_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint168_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint176_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint184_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint192_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint2_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint200_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint2048_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint208_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint216_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint224_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint232_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint24_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint240_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint248_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint256_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint32_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint4_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint40_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint48_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint512_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint56_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint6_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint64_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint72_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint8_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint80_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint88_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint96_free(n>>>0,1));const ru=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fhebool_free(n>>>0,1));class _e{static __wrap(t){t=t>>>0;const e=Object.create(_e.prototype);return e.__wbg_ptr=t,ru.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ru.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fhebool_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fhebool_deserialize(e,r);if(i[2])throw a(i[1]);return _e.__wrap(i[0])}safe_serialize(t){const e=s.fhebool_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fhebool_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return _e.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fhebool_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _e.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fhebool_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _e.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fhebool_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _e.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fhebool_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]!==0}serialize(){const t=s.fhebool_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(_e.prototype[Symbol.dispose]=_e.prototype.free);const nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint10_free(n>>>0,1));class le{static __wrap(t){t=t>>>0;const e=Object.create(le.prototype);return e.__wbg_ptr=t,nu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,nu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint10_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint10_deserialize(e,r);if(i[2])throw a(i[1]);return le.__wrap(i[0])}safe_serialize(t){const e=s.fheint10_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint10_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return le.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint10_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return le.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint10_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return le.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint10_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return le.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint10_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint10_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(le.prototype[Symbol.dispose]=le.prototype.free);const iu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint1024_free(n>>>0,1));class ue{static __wrap(t){t=t>>>0;const e=Object.create(ue.prototype);return e.__wbg_ptr=t,iu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,iu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint1024_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint1024_deserialize(e,r);if(i[2])throw a(i[1]);return ue.__wrap(i[0])}safe_serialize(t){const e=s.fheint1024_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint1024_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ue.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint1024_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ue.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint1024_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ue.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint1024_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ue.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint1024_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint1024_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ue.prototype[Symbol.dispose]=ue.prototype.free);const su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint104_free(n>>>0,1));class fe{static __wrap(t){t=t>>>0;const e=Object.create(fe.prototype);return e.__wbg_ptr=t,su.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,su.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint104_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint104_deserialize(e,r);if(i[2])throw a(i[1]);return fe.__wrap(i[0])}safe_serialize(t){const e=s.fheint104_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint104_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return fe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint104_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint104_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint104_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint104_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint104_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(fe.prototype[Symbol.dispose]=fe.prototype.free);const ou=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint112_free(n>>>0,1));class he{static __wrap(t){t=t>>>0;const e=Object.create(he.prototype);return e.__wbg_ptr=t,ou.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ou.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint112_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint112_deserialize(e,r);if(i[2])throw a(i[1]);return he.__wrap(i[0])}safe_serialize(t){const e=s.fheint112_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint112_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return he.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint112_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return he.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint112_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return he.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint112_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return he.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint112_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint112_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(he.prototype[Symbol.dispose]=he.prototype.free);const au=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint12_free(n>>>0,1));class pe{static __wrap(t){t=t>>>0;const e=Object.create(pe.prototype);return e.__wbg_ptr=t,au.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,au.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint12_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint12_deserialize(e,r);if(i[2])throw a(i[1]);return pe.__wrap(i[0])}safe_serialize(t){const e=s.fheint12_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint12_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return pe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint12_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint12_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint12_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint12_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint12_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(pe.prototype[Symbol.dispose]=pe.prototype.free);const cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint120_free(n>>>0,1));class de{static __wrap(t){t=t>>>0;const e=Object.create(de.prototype);return e.__wbg_ptr=t,cu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,cu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint120_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint120_deserialize(e,r);if(i[2])throw a(i[1]);return de.__wrap(i[0])}safe_serialize(t){const e=s.fheint120_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint120_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return de.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint120_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return de.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint120_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return de.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint120_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return de.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint120_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint120_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(de.prototype[Symbol.dispose]=de.prototype.free);const _u=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint128_free(n>>>0,1));class we{static __wrap(t){t=t>>>0;const e=Object.create(we.prototype);return e.__wbg_ptr=t,_u.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,_u.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint128_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint128_deserialize(e,r);if(i[2])throw a(i[1]);return we.__wrap(i[0])}safe_serialize(t){const e=s.fheint128_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint128_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return we.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint128_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return we.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint128_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return we.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint128_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return we.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint128_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint128_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(we.prototype[Symbol.dispose]=we.prototype.free);const lu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint136_free(n>>>0,1));class ge{static __wrap(t){t=t>>>0;const e=Object.create(ge.prototype);return e.__wbg_ptr=t,lu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,lu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint136_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint136_deserialize(e,r);if(i[2])throw a(i[1]);return ge.__wrap(i[0])}safe_serialize(t){const e=s.fheint136_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint136_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ge.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint136_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ge.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint136_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ge.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint136_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ge.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint136_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint136_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ge.prototype[Symbol.dispose]=ge.prototype.free);const uu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint14_free(n>>>0,1));class ye{static __wrap(t){t=t>>>0;const e=Object.create(ye.prototype);return e.__wbg_ptr=t,uu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,uu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint14_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint14_deserialize(e,r);if(i[2])throw a(i[1]);return ye.__wrap(i[0])}safe_serialize(t){const e=s.fheint14_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint14_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ye.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint14_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ye.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint14_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ye.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint14_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ye.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint14_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint14_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ye.prototype[Symbol.dispose]=ye.prototype.free);const fu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint144_free(n>>>0,1));class be{static __wrap(t){t=t>>>0;const e=Object.create(be.prototype);return e.__wbg_ptr=t,fu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,fu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint144_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint144_deserialize(e,r);if(i[2])throw a(i[1]);return be.__wrap(i[0])}safe_serialize(t){const e=s.fheint144_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint144_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return be.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint144_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return be.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint144_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return be.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint144_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return be.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint144_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint144_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(be.prototype[Symbol.dispose]=be.prototype.free);const hu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint152_free(n>>>0,1));class me{static __wrap(t){t=t>>>0;const e=Object.create(me.prototype);return e.__wbg_ptr=t,hu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,hu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint152_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint152_deserialize(e,r);if(i[2])throw a(i[1]);return me.__wrap(i[0])}safe_serialize(t){const e=s.fheint152_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint152_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return me.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint152_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return me.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint152_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return me.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint152_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return me.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint152_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint152_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(me.prototype[Symbol.dispose]=me.prototype.free);const pu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint16_free(n>>>0,1));class Ae{static __wrap(t){t=t>>>0;const e=Object.create(Ae.prototype);return e.__wbg_ptr=t,pu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,pu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint16_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint16_deserialize(e,r);if(i[2])throw a(i[1]);return Ae.__wrap(i[0])}safe_serialize(t){const e=s.fheint16_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint16_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ae.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint16_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ae.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint16_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ae.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint16_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ae.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint16_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint16_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ae.prototype[Symbol.dispose]=Ae.prototype.free);const du=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint160_free(n>>>0,1));class Ee{static __wrap(t){t=t>>>0;const e=Object.create(Ee.prototype);return e.__wbg_ptr=t,du.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,du.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint160_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint160_deserialize(e,r);if(i[2])throw a(i[1]);return Ee.__wrap(i[0])}safe_serialize(t){const e=s.fheint160_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint160_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ee.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint160_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ee.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint160_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ee.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint160_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ee.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint160_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint160_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ee.prototype[Symbol.dispose]=Ee.prototype.free);const wu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint168_free(n>>>0,1));class xe{static __wrap(t){t=t>>>0;const e=Object.create(xe.prototype);return e.__wbg_ptr=t,wu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,wu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint168_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint168_deserialize(e,r);if(i[2])throw a(i[1]);return xe.__wrap(i[0])}safe_serialize(t){const e=s.fheint168_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint168_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return xe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint168_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint168_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint168_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint168_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint168_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(xe.prototype[Symbol.dispose]=xe.prototype.free);const gu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint176_free(n>>>0,1));class Re{static __wrap(t){t=t>>>0;const e=Object.create(Re.prototype);return e.__wbg_ptr=t,gu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,gu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint176_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint176_deserialize(e,r);if(i[2])throw a(i[1]);return Re.__wrap(i[0])}safe_serialize(t){const e=s.fheint176_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint176_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Re.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint176_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Re.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint176_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Re.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint176_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Re.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint176_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint176_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Re.prototype[Symbol.dispose]=Re.prototype.free);const yu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint184_free(n>>>0,1));class ze{static __wrap(t){t=t>>>0;const e=Object.create(ze.prototype);return e.__wbg_ptr=t,yu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,yu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint184_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint184_deserialize(e,r);if(i[2])throw a(i[1]);return ze.__wrap(i[0])}safe_serialize(t){const e=s.fheint184_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint184_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ze.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint184_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ze.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint184_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ze.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint184_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ze.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint184_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint184_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ze.prototype[Symbol.dispose]=ze.prototype.free);const bu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint192_free(n>>>0,1));class Pe{static __wrap(t){t=t>>>0;const e=Object.create(Pe.prototype);return e.__wbg_ptr=t,bu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,bu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint192_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint192_deserialize(e,r);if(i[2])throw a(i[1]);return Pe.__wrap(i[0])}safe_serialize(t){const e=s.fheint192_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint192_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Pe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint192_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint192_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint192_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint192_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint192_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Pe.prototype[Symbol.dispose]=Pe.prototype.free);const mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint2_free(n>>>0,1));class ve{static __wrap(t){t=t>>>0;const e=Object.create(ve.prototype);return e.__wbg_ptr=t,mu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,mu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint2_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint2_deserialize(e,r);if(i[2])throw a(i[1]);return ve.__wrap(i[0])}safe_serialize(t){const e=s.fheint2_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint2_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ve.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint2_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ve.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint2_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ve.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint2_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ve.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint2_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint2_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ve.prototype[Symbol.dispose]=ve.prototype.free);const Au=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint200_free(n>>>0,1));class ke{static __wrap(t){t=t>>>0;const e=Object.create(ke.prototype);return e.__wbg_ptr=t,Au.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Au.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint200_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint200_deserialize(e,r);if(i[2])throw a(i[1]);return ke.__wrap(i[0])}safe_serialize(t){const e=s.fheint200_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint200_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ke.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint200_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ke.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint200_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ke.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint200_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ke.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint200_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint200_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ke.prototype[Symbol.dispose]=ke.prototype.free);const Eu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint2048_free(n>>>0,1));class Ie{static __wrap(t){t=t>>>0;const e=Object.create(Ie.prototype);return e.__wbg_ptr=t,Eu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Eu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint2048_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint2048_deserialize(e,r);if(i[2])throw a(i[1]);return Ie.__wrap(i[0])}safe_serialize(t){const e=s.fheint2048_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint2048_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ie.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint2048_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ie.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint2048_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ie.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint2048_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ie.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint2048_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint2048_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ie.prototype[Symbol.dispose]=Ie.prototype.free);const xu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint208_free(n>>>0,1));class Se{static __wrap(t){t=t>>>0;const e=Object.create(Se.prototype);return e.__wbg_ptr=t,xu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,xu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint208_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint208_deserialize(e,r);if(i[2])throw a(i[1]);return Se.__wrap(i[0])}safe_serialize(t){const e=s.fheint208_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint208_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Se.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint208_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Se.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint208_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Se.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint208_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Se.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint208_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint208_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Se.prototype[Symbol.dispose]=Se.prototype.free);const Ru=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint216_free(n>>>0,1));class Te{static __wrap(t){t=t>>>0;const e=Object.create(Te.prototype);return e.__wbg_ptr=t,Ru.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ru.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint216_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint216_deserialize(e,r);if(i[2])throw a(i[1]);return Te.__wrap(i[0])}safe_serialize(t){const e=s.fheint216_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint216_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Te.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint216_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Te.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint216_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Te.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint216_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Te.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint216_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint216_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Te.prototype[Symbol.dispose]=Te.prototype.free);const zu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint224_free(n>>>0,1));class Be{static __wrap(t){t=t>>>0;const e=Object.create(Be.prototype);return e.__wbg_ptr=t,zu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,zu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint224_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint224_deserialize(e,r);if(i[2])throw a(i[1]);return Be.__wrap(i[0])}safe_serialize(t){const e=s.fheint224_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint224_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Be.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint224_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Be.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint224_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Be.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint224_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Be.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint224_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint224_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Be.prototype[Symbol.dispose]=Be.prototype.free);const Pu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint232_free(n>>>0,1));class Ce{static __wrap(t){t=t>>>0;const e=Object.create(Ce.prototype);return e.__wbg_ptr=t,Pu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Pu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint232_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint232_deserialize(e,r);if(i[2])throw a(i[1]);return Ce.__wrap(i[0])}safe_serialize(t){const e=s.fheint232_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint232_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ce.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint232_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ce.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint232_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ce.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint232_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ce.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint232_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint232_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ce.prototype[Symbol.dispose]=Ce.prototype.free);const vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint24_free(n>>>0,1));class Oe{static __wrap(t){t=t>>>0;const e=Object.create(Oe.prototype);return e.__wbg_ptr=t,vu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,vu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint24_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint24_deserialize(e,r);if(i[2])throw a(i[1]);return Oe.__wrap(i[0])}safe_serialize(t){const e=s.fheint24_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint24_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Oe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint24_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Oe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint24_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Oe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint24_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Oe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint24_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint24_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Oe.prototype[Symbol.dispose]=Oe.prototype.free);const ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint240_free(n>>>0,1));class Ne{static __wrap(t){t=t>>>0;const e=Object.create(Ne.prototype);return e.__wbg_ptr=t,ku.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ku.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint240_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint240_deserialize(e,r);if(i[2])throw a(i[1]);return Ne.__wrap(i[0])}safe_serialize(t){const e=s.fheint240_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint240_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ne.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint240_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ne.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint240_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ne.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint240_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ne.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint240_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint240_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ne.prototype[Symbol.dispose]=Ne.prototype.free);const Iu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint248_free(n>>>0,1));class Fe{static __wrap(t){t=t>>>0;const e=Object.create(Fe.prototype);return e.__wbg_ptr=t,Iu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Iu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint248_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint248_deserialize(e,r);if(i[2])throw a(i[1]);return Fe.__wrap(i[0])}safe_serialize(t){const e=s.fheint248_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint248_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Fe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint248_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint248_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint248_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint248_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint248_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Fe.prototype[Symbol.dispose]=Fe.prototype.free);const Su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint256_free(n>>>0,1));class De{static __wrap(t){t=t>>>0;const e=Object.create(De.prototype);return e.__wbg_ptr=t,Su.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Su.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint256_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint256_deserialize(e,r);if(i[2])throw a(i[1]);return De.__wrap(i[0])}safe_serialize(t){const e=s.fheint256_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint256_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return De.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint256_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return De.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint256_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return De.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint256_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return De.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint256_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint256_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(De.prototype[Symbol.dispose]=De.prototype.free);const Tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint32_free(n>>>0,1));class Ue{static __wrap(t){t=t>>>0;const e=Object.create(Ue.prototype);return e.__wbg_ptr=t,Tu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Tu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint32_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint32_deserialize(e,r);if(i[2])throw a(i[1]);return Ue.__wrap(i[0])}safe_serialize(t){const e=s.fheint32_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint32_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ue.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint32_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ue.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint32_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ue.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint32_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ue.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint32_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint32_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ue.prototype[Symbol.dispose]=Ue.prototype.free);const Bu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint4_free(n>>>0,1));class Le{static __wrap(t){t=t>>>0;const e=Object.create(Le.prototype);return e.__wbg_ptr=t,Bu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Bu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint4_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint4_deserialize(e,r);if(i[2])throw a(i[1]);return Le.__wrap(i[0])}safe_serialize(t){const e=s.fheint4_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint4_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Le.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint4_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Le.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint4_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Le.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint4_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Le.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint4_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint4_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Le.prototype[Symbol.dispose]=Le.prototype.free);const Cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint40_free(n>>>0,1));class Me{static __wrap(t){t=t>>>0;const e=Object.create(Me.prototype);return e.__wbg_ptr=t,Cu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Cu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint40_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint40_deserialize(e,r);if(i[2])throw a(i[1]);return Me.__wrap(i[0])}safe_serialize(t){const e=s.fheint40_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint40_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Me.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint40_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Me.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint40_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Me.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint40_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Me.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint40_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint40_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Me.prototype[Symbol.dispose]=Me.prototype.free);const Ou=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint48_free(n>>>0,1));class je{static __wrap(t){t=t>>>0;const e=Object.create(je.prototype);return e.__wbg_ptr=t,Ou.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ou.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint48_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint48_deserialize(e,r);if(i[2])throw a(i[1]);return je.__wrap(i[0])}safe_serialize(t){const e=s.fheint48_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint48_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return je.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint48_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return je.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint48_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return je.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint48_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return je.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint48_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint48_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(je.prototype[Symbol.dispose]=je.prototype.free);const Nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint512_free(n>>>0,1));class Ge{static __wrap(t){t=t>>>0;const e=Object.create(Ge.prototype);return e.__wbg_ptr=t,Nu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Nu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint512_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint512_deserialize(e,r);if(i[2])throw a(i[1]);return Ge.__wrap(i[0])}safe_serialize(t){const e=s.fheint512_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint512_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ge.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint512_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ge.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint512_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ge.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint512_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ge.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint512_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint512_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ge.prototype[Symbol.dispose]=Ge.prototype.free);const Fu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint56_free(n>>>0,1));class He{static __wrap(t){t=t>>>0;const e=Object.create(He.prototype);return e.__wbg_ptr=t,Fu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Fu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint56_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint56_deserialize(e,r);if(i[2])throw a(i[1]);return He.__wrap(i[0])}safe_serialize(t){const e=s.fheint56_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint56_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return He.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint56_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return He.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint56_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return He.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint56_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return He.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint56_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint56_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(He.prototype[Symbol.dispose]=He.prototype.free);const Du=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint6_free(n>>>0,1));class Ve{static __wrap(t){t=t>>>0;const e=Object.create(Ve.prototype);return e.__wbg_ptr=t,Du.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Du.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint6_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint6_deserialize(e,r);if(i[2])throw a(i[1]);return Ve.__wrap(i[0])}safe_serialize(t){const e=s.fheint6_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint6_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ve.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint6_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ve.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint6_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ve.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint6_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ve.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint6_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint6_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ve.prototype[Symbol.dispose]=Ve.prototype.free);const Uu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint64_free(n>>>0,1));class Ke{static __wrap(t){t=t>>>0;const e=Object.create(Ke.prototype);return e.__wbg_ptr=t,Uu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Uu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint64_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint64_deserialize(e,r);if(i[2])throw a(i[1]);return Ke.__wrap(i[0])}safe_serialize(t){const e=s.fheint64_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint64_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ke.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint64_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ke.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint64_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ke.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint64_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ke.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint64_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint64_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ke.prototype[Symbol.dispose]=Ke.prototype.free);const Lu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint72_free(n>>>0,1));class Qe{static __wrap(t){t=t>>>0;const e=Object.create(Qe.prototype);return e.__wbg_ptr=t,Lu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Lu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint72_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint72_deserialize(e,r);if(i[2])throw a(i[1]);return Qe.__wrap(i[0])}safe_serialize(t){const e=s.fheint72_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint72_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Qe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint72_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Qe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint72_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Qe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint72_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Qe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint72_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint72_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Qe.prototype[Symbol.dispose]=Qe.prototype.free);const Mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint8_free(n>>>0,1));class Je{static __wrap(t){t=t>>>0;const e=Object.create(Je.prototype);return e.__wbg_ptr=t,Mu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Mu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint8_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint8_deserialize(e,r);if(i[2])throw a(i[1]);return Je.__wrap(i[0])}safe_serialize(t){const e=s.fheint8_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint8_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Je.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint8_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Je.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint8_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Je.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint8_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Je.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint8_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint8_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Je.prototype[Symbol.dispose]=Je.prototype.free);const ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint80_free(n>>>0,1));class $e{static __wrap(t){t=t>>>0;const e=Object.create($e.prototype);return e.__wbg_ptr=t,ju.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ju.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint80_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint80_deserialize(e,r);if(i[2])throw a(i[1]);return $e.__wrap(i[0])}safe_serialize(t){const e=s.fheint80_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint80_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return $e.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint80_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return $e.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint80_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return $e.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint80_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return $e.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint80_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint80_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&($e.prototype[Symbol.dispose]=$e.prototype.free);const Gu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint88_free(n>>>0,1));class We{static __wrap(t){t=t>>>0;const e=Object.create(We.prototype);return e.__wbg_ptr=t,Gu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Gu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint88_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint88_deserialize(e,r);if(i[2])throw a(i[1]);return We.__wrap(i[0])}safe_serialize(t){const e=s.fheint88_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint88_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return We.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint88_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return We.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint88_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return We.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint88_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return We.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint88_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint88_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(We.prototype[Symbol.dispose]=We.prototype.free);const Hu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint96_free(n>>>0,1));class qe{static __wrap(t){t=t>>>0;const e=Object.create(qe.prototype);return e.__wbg_ptr=t,Hu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Hu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint96_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheint96_deserialize(e,r);if(i[2])throw a(i[1]);return qe.__wrap(i[0])}safe_serialize(t){const e=s.fheint96_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheint96_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return qe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheint96_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return qe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheint96_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return qe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheint96_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return qe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheint96_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint96_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(qe.prototype[Symbol.dispose]=qe.prototype.free);const Vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint10_free(n>>>0,1));class Ze{static __wrap(t){t=t>>>0;const e=Object.create(Ze.prototype);return e.__wbg_ptr=t,Vu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Vu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint10_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint10_deserialize(e,r);if(i[2])throw a(i[1]);return Ze.__wrap(i[0])}safe_serialize(t){const e=s.fheuint10_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint10_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ze.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint10_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ze.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint10_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ze.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint10_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ze.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint10_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint10_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ze.prototype[Symbol.dispose]=Ze.prototype.free);const Ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint1024_free(n>>>0,1));class Ye{static __wrap(t){t=t>>>0;const e=Object.create(Ye.prototype);return e.__wbg_ptr=t,Ku.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ku.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint1024_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint1024_deserialize(e,r);if(i[2])throw a(i[1]);return Ye.__wrap(i[0])}safe_serialize(t){const e=s.fheuint1024_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint1024_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ye.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint1024_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ye.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint1024_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ye.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint1024_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ye.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint1024_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint1024_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ye.prototype[Symbol.dispose]=Ye.prototype.free);const Qu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint104_free(n>>>0,1));class Xe{static __wrap(t){t=t>>>0;const e=Object.create(Xe.prototype);return e.__wbg_ptr=t,Qu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Qu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint104_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint104_deserialize(e,r);if(i[2])throw a(i[1]);return Xe.__wrap(i[0])}safe_serialize(t){const e=s.fheuint104_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint104_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Xe.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint104_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Xe.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint104_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Xe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint104_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Xe.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint104_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint104_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Xe.prototype[Symbol.dispose]=Xe.prototype.free);const Ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint112_free(n>>>0,1));class tr{static __wrap(t){t=t>>>0;const e=Object.create(tr.prototype);return e.__wbg_ptr=t,Ju.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ju.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint112_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint112_deserialize(e,r);if(i[2])throw a(i[1]);return tr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint112_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint112_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return tr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint112_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return tr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint112_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return tr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint112_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return tr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint112_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint112_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(tr.prototype[Symbol.dispose]=tr.prototype.free);const $u=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint12_free(n>>>0,1));class er{static __wrap(t){t=t>>>0;const e=Object.create(er.prototype);return e.__wbg_ptr=t,$u.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$u.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint12_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint12_deserialize(e,r);if(i[2])throw a(i[1]);return er.__wrap(i[0])}safe_serialize(t){const e=s.fheuint12_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint12_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return er.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint12_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return er.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint12_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return er.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint12_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return er.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint12_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint12_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(er.prototype[Symbol.dispose]=er.prototype.free);const Wu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint120_free(n>>>0,1));class rr{static __wrap(t){t=t>>>0;const e=Object.create(rr.prototype);return e.__wbg_ptr=t,Wu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Wu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint120_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint120_deserialize(e,r);if(i[2])throw a(i[1]);return rr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint120_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint120_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return rr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint120_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return rr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint120_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return rr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint120_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return rr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint120_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint120_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(rr.prototype[Symbol.dispose]=rr.prototype.free);const qu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint128_free(n>>>0,1));class nr{static __wrap(t){t=t>>>0;const e=Object.create(nr.prototype);return e.__wbg_ptr=t,qu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,qu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint128_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint128_deserialize(e,r);if(i[2])throw a(i[1]);return nr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint128_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint128_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return nr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint128_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return nr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint128_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return nr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint128_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return nr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint128_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint128_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(nr.prototype[Symbol.dispose]=nr.prototype.free);const Zu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint136_free(n>>>0,1));class ir{static __wrap(t){t=t>>>0;const e=Object.create(ir.prototype);return e.__wbg_ptr=t,Zu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Zu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint136_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint136_deserialize(e,r);if(i[2])throw a(i[1]);return ir.__wrap(i[0])}safe_serialize(t){const e=s.fheuint136_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint136_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ir.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint136_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ir.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint136_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ir.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint136_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ir.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint136_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint136_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ir.prototype[Symbol.dispose]=ir.prototype.free);const Yu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint14_free(n>>>0,1));class sr{static __wrap(t){t=t>>>0;const e=Object.create(sr.prototype);return e.__wbg_ptr=t,Yu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Yu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint14_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint14_deserialize(e,r);if(i[2])throw a(i[1]);return sr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint14_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint14_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return sr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint14_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return sr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint14_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return sr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint14_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return sr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint14_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint14_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(sr.prototype[Symbol.dispose]=sr.prototype.free);const Xu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint144_free(n>>>0,1));class or{static __wrap(t){t=t>>>0;const e=Object.create(or.prototype);return e.__wbg_ptr=t,Xu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Xu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint144_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint144_deserialize(e,r);if(i[2])throw a(i[1]);return or.__wrap(i[0])}safe_serialize(t){const e=s.fheuint144_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint144_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return or.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint144_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return or.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint144_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return or.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint144_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return or.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint144_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint144_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(or.prototype[Symbol.dispose]=or.prototype.free);const tf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint152_free(n>>>0,1));class ar{static __wrap(t){t=t>>>0;const e=Object.create(ar.prototype);return e.__wbg_ptr=t,tf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,tf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint152_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint152_deserialize(e,r);if(i[2])throw a(i[1]);return ar.__wrap(i[0])}safe_serialize(t){const e=s.fheuint152_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint152_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ar.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint152_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ar.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint152_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ar.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint152_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ar.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint152_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint152_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ar.prototype[Symbol.dispose]=ar.prototype.free);const ef=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint16_free(n>>>0,1));class cr{static __wrap(t){t=t>>>0;const e=Object.create(cr.prototype);return e.__wbg_ptr=t,ef.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ef.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint16_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint16_deserialize(e,r);if(i[2])throw a(i[1]);return cr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint16_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint16_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return cr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint16_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return cr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint16_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return cr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint16_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return cr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint16_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint16_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(cr.prototype[Symbol.dispose]=cr.prototype.free);const rf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint160_free(n>>>0,1));class _r{static __wrap(t){t=t>>>0;const e=Object.create(_r.prototype);return e.__wbg_ptr=t,rf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint160_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint160_deserialize(e,r);if(i[2])throw a(i[1]);return _r.__wrap(i[0])}safe_serialize(t){const e=s.fheuint160_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint160_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return _r.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint160_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _r.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint160_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _r.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint160_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _r.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint160_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint160_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(_r.prototype[Symbol.dispose]=_r.prototype.free);const nf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint168_free(n>>>0,1));class lr{static __wrap(t){t=t>>>0;const e=Object.create(lr.prototype);return e.__wbg_ptr=t,nf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,nf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint168_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint168_deserialize(e,r);if(i[2])throw a(i[1]);return lr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint168_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint168_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return lr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint168_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return lr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint168_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return lr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint168_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return lr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint168_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint168_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(lr.prototype[Symbol.dispose]=lr.prototype.free);const sf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint176_free(n>>>0,1));class ur{static __wrap(t){t=t>>>0;const e=Object.create(ur.prototype);return e.__wbg_ptr=t,sf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,sf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint176_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint176_deserialize(e,r);if(i[2])throw a(i[1]);return ur.__wrap(i[0])}safe_serialize(t){const e=s.fheuint176_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint176_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ur.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint176_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ur.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint176_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ur.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint176_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ur.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint176_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint176_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ur.prototype[Symbol.dispose]=ur.prototype.free);const of=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint184_free(n>>>0,1));class fr{static __wrap(t){t=t>>>0;const e=Object.create(fr.prototype);return e.__wbg_ptr=t,of.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,of.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint184_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint184_deserialize(e,r);if(i[2])throw a(i[1]);return fr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint184_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint184_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return fr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint184_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint184_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint184_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint184_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint184_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(fr.prototype[Symbol.dispose]=fr.prototype.free);const af=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint192_free(n>>>0,1));class hr{static __wrap(t){t=t>>>0;const e=Object.create(hr.prototype);return e.__wbg_ptr=t,af.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,af.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint192_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint192_deserialize(e,r);if(i[2])throw a(i[1]);return hr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint192_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint192_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return hr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint192_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return hr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint192_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return hr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint192_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return hr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint192_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint192_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(hr.prototype[Symbol.dispose]=hr.prototype.free);const cf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint2_free(n>>>0,1));class pr{static __wrap(t){t=t>>>0;const e=Object.create(pr.prototype);return e.__wbg_ptr=t,cf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,cf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint2_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint2_deserialize(e,r);if(i[2])throw a(i[1]);return pr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint2_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint2_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return pr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint2_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint2_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint2_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint2_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint2_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(pr.prototype[Symbol.dispose]=pr.prototype.free);const _f=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint200_free(n>>>0,1));class dr{static __wrap(t){t=t>>>0;const e=Object.create(dr.prototype);return e.__wbg_ptr=t,_f.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,_f.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint200_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint200_deserialize(e,r);if(i[2])throw a(i[1]);return dr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint200_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint200_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return dr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint200_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return dr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint200_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return dr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint200_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return dr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint200_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint200_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(dr.prototype[Symbol.dispose]=dr.prototype.free);const lf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint2048_free(n>>>0,1));class wr{static __wrap(t){t=t>>>0;const e=Object.create(wr.prototype);return e.__wbg_ptr=t,lf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,lf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint2048_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint2048_deserialize(e,r);if(i[2])throw a(i[1]);return wr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint2048_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint2048_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return wr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint2048_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return wr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint2048_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return wr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint2048_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return wr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint2048_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint2048_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(wr.prototype[Symbol.dispose]=wr.prototype.free);const uf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint208_free(n>>>0,1));class gr{static __wrap(t){t=t>>>0;const e=Object.create(gr.prototype);return e.__wbg_ptr=t,uf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,uf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint208_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint208_deserialize(e,r);if(i[2])throw a(i[1]);return gr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint208_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint208_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return gr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint208_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return gr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint208_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return gr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint208_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return gr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint208_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint208_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(gr.prototype[Symbol.dispose]=gr.prototype.free);const ff=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint216_free(n>>>0,1));class yr{static __wrap(t){t=t>>>0;const e=Object.create(yr.prototype);return e.__wbg_ptr=t,ff.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ff.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint216_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint216_deserialize(e,r);if(i[2])throw a(i[1]);return yr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint216_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint216_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return yr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint216_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return yr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint216_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return yr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint216_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return yr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint216_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint216_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(yr.prototype[Symbol.dispose]=yr.prototype.free);const hf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint224_free(n>>>0,1));class br{static __wrap(t){t=t>>>0;const e=Object.create(br.prototype);return e.__wbg_ptr=t,hf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,hf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint224_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint224_deserialize(e,r);if(i[2])throw a(i[1]);return br.__wrap(i[0])}safe_serialize(t){const e=s.fheuint224_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint224_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return br.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint224_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return br.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint224_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return br.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint224_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return br.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint224_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint224_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(br.prototype[Symbol.dispose]=br.prototype.free);const pf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint232_free(n>>>0,1));class mr{static __wrap(t){t=t>>>0;const e=Object.create(mr.prototype);return e.__wbg_ptr=t,pf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,pf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint232_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint232_deserialize(e,r);if(i[2])throw a(i[1]);return mr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint232_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint232_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return mr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint232_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return mr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint232_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return mr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint232_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return mr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint232_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint232_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(mr.prototype[Symbol.dispose]=mr.prototype.free);const df=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint24_free(n>>>0,1));class Ar{static __wrap(t){t=t>>>0;const e=Object.create(Ar.prototype);return e.__wbg_ptr=t,df.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,df.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint24_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint24_deserialize(e,r);if(i[2])throw a(i[1]);return Ar.__wrap(i[0])}safe_serialize(t){const e=s.fheuint24_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint24_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ar.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint24_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ar.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint24_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ar.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint24_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ar.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint24_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]>>>0}serialize(){const t=s.fheuint24_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ar.prototype[Symbol.dispose]=Ar.prototype.free);const wf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint240_free(n>>>0,1));class Er{static __wrap(t){t=t>>>0;const e=Object.create(Er.prototype);return e.__wbg_ptr=t,wf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,wf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint240_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint240_deserialize(e,r);if(i[2])throw a(i[1]);return Er.__wrap(i[0])}safe_serialize(t){const e=s.fheuint240_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint240_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Er.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint240_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Er.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint240_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Er.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint240_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Er.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint240_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint240_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Er.prototype[Symbol.dispose]=Er.prototype.free);const gf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint248_free(n>>>0,1));class xr{static __wrap(t){t=t>>>0;const e=Object.create(xr.prototype);return e.__wbg_ptr=t,gf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,gf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint248_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint248_deserialize(e,r);if(i[2])throw a(i[1]);return xr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint248_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint248_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return xr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint248_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint248_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint248_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint248_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint248_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(xr.prototype[Symbol.dispose]=xr.prototype.free);const yf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint256_free(n>>>0,1));class Rr{static __wrap(t){t=t>>>0;const e=Object.create(Rr.prototype);return e.__wbg_ptr=t,yf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,yf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint256_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint256_deserialize(e,r);if(i[2])throw a(i[1]);return Rr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint256_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint256_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Rr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint256_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Rr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint256_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Rr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint256_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Rr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint256_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint256_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Rr.prototype[Symbol.dispose]=Rr.prototype.free);const bf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint32_free(n>>>0,1));class zr{static __wrap(t){t=t>>>0;const e=Object.create(zr.prototype);return e.__wbg_ptr=t,bf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,bf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint32_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint32_deserialize(e,r);if(i[2])throw a(i[1]);return zr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint32_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint32_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return zr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint32_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return zr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint32_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return zr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint32_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return zr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint32_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]>>>0}serialize(){const t=s.fheuint32_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(zr.prototype[Symbol.dispose]=zr.prototype.free);const mf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint4_free(n>>>0,1));class Pr{static __wrap(t){t=t>>>0;const e=Object.create(Pr.prototype);return e.__wbg_ptr=t,mf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,mf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint4_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint4_deserialize(e,r);if(i[2])throw a(i[1]);return Pr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint4_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint4_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Pr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint4_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint4_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint4_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint4_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint4_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Pr.prototype[Symbol.dispose]=Pr.prototype.free);const Af=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint40_free(n>>>0,1));class vr{static __wrap(t){t=t>>>0;const e=Object.create(vr.prototype);return e.__wbg_ptr=t,Af.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Af.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint40_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint40_deserialize(e,r);if(i[2])throw a(i[1]);return vr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint40_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint40_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return vr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint40_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return vr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint40_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return vr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint40_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return vr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint40_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint40_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(vr.prototype[Symbol.dispose]=vr.prototype.free);const Ef=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint48_free(n>>>0,1));class kr{static __wrap(t){t=t>>>0;const e=Object.create(kr.prototype);return e.__wbg_ptr=t,Ef.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ef.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint48_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint48_deserialize(e,r);if(i[2])throw a(i[1]);return kr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint48_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint48_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return kr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint48_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return kr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint48_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return kr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint48_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return kr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint48_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint48_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(kr.prototype[Symbol.dispose]=kr.prototype.free);const xf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint512_free(n>>>0,1));class Ir{static __wrap(t){t=t>>>0;const e=Object.create(Ir.prototype);return e.__wbg_ptr=t,xf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,xf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint512_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint512_deserialize(e,r);if(i[2])throw a(i[1]);return Ir.__wrap(i[0])}safe_serialize(t){const e=s.fheuint512_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint512_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ir.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint512_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ir.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint512_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ir.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint512_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ir.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint512_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint512_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ir.prototype[Symbol.dispose]=Ir.prototype.free);const Rf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint56_free(n>>>0,1));class Sr{static __wrap(t){t=t>>>0;const e=Object.create(Sr.prototype);return e.__wbg_ptr=t,Rf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Rf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint56_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint56_deserialize(e,r);if(i[2])throw a(i[1]);return Sr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint56_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint56_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Sr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint56_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Sr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint56_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Sr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint56_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Sr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint56_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint56_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Sr.prototype[Symbol.dispose]=Sr.prototype.free);const zf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint6_free(n>>>0,1));class Tr{static __wrap(t){t=t>>>0;const e=Object.create(Tr.prototype);return e.__wbg_ptr=t,zf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,zf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint6_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint6_deserialize(e,r);if(i[2])throw a(i[1]);return Tr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint6_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint6_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Tr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint6_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Tr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint6_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Tr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint6_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Tr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint6_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint6_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Tr.prototype[Symbol.dispose]=Tr.prototype.free);const Pf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint64_free(n>>>0,1));class Br{static __wrap(t){t=t>>>0;const e=Object.create(Br.prototype);return e.__wbg_ptr=t,Pf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Pf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint64_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint64_deserialize(e,r);if(i[2])throw a(i[1]);return Br.__wrap(i[0])}safe_serialize(t){const e=s.fheuint64_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint64_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Br.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint64_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Br.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint64_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Br.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint64_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Br.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint64_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint64_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Br.prototype[Symbol.dispose]=Br.prototype.free);const vf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint72_free(n>>>0,1));class Cr{static __wrap(t){t=t>>>0;const e=Object.create(Cr.prototype);return e.__wbg_ptr=t,vf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,vf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint72_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint72_deserialize(e,r);if(i[2])throw a(i[1]);return Cr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint72_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint72_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Cr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint72_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Cr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint72_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Cr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint72_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Cr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint72_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint72_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Cr.prototype[Symbol.dispose]=Cr.prototype.free);const kf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint8_free(n>>>0,1));class Or{static __wrap(t){t=t>>>0;const e=Object.create(Or.prototype);return e.__wbg_ptr=t,kf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,kf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint8_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint8_deserialize(e,r);if(i[2])throw a(i[1]);return Or.__wrap(i[0])}safe_serialize(t){const e=s.fheuint8_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint8_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Or.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint8_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Or.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint8_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Or.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint8_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Or.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint8_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint8_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Or.prototype[Symbol.dispose]=Or.prototype.free);const If=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint80_free(n>>>0,1));class Nr{static __wrap(t){t=t>>>0;const e=Object.create(Nr.prototype);return e.__wbg_ptr=t,If.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,If.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint80_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint80_deserialize(e,r);if(i[2])throw a(i[1]);return Nr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint80_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint80_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Nr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint80_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Nr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint80_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Nr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint80_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Nr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint80_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint80_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Nr.prototype[Symbol.dispose]=Nr.prototype.free);const Sf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint88_free(n>>>0,1));class Fr{static __wrap(t){t=t>>>0;const e=Object.create(Fr.prototype);return e.__wbg_ptr=t,Sf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Sf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint88_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint88_deserialize(e,r);if(i[2])throw a(i[1]);return Fr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint88_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint88_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Fr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint88_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint88_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint88_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint88_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint88_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Fr.prototype[Symbol.dispose]=Fr.prototype.free);const Tf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint96_free(n>>>0,1));class Dr{static __wrap(t){t=t>>>0;const e=Object.create(Dr.prototype);return e.__wbg_ptr=t,Tf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Tf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint96_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.fheuint96_deserialize(e,r);if(i[2])throw a(i[1]);return Dr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint96_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.fheuint96_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Dr.__wrap(o[0])}static encrypt_with_client_key(t,e){h(e,A);const r=s.fheuint96_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Dr.__wrap(r[0])}static encrypt_with_public_key(t,e){h(e,k);const r=s.fheuint96_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Dr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){h(e,I);const r=s.fheuint96_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Dr.__wrap(r[0])}decrypt(t){h(t,A);const e=s.fheuint96_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint96_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Dr.prototype[Symbol.dispose]=Dr.prototype.free);const Bf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_provencompactciphertextlist_free(n>>>0,1));class bn{static __wrap(t){t=t>>>0;const e=Object.create(bn.prototype);return e.__wbg_ptr=t,Bf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Bf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_provencompactciphertextlist_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.provencompactciphertextlist_deserialize(e,r);if(i[2])throw a(i[1]);return bn.__wrap(i[0])}get_kind_of(t){const e=s.provencompactciphertextlist_get_kind_of(this.__wbg_ptr,t);return e===84?void 0:e}safe_serialize(t){const e=s.provencompactciphertextlist_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.provencompactciphertextlist_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return bn.__wrap(o[0])}verify_and_expand(t,e,r){h(t,Kt),h(e,Qt);const i=y(r,s.__wbindgen_malloc),o=w,c=s.provencompactciphertextlist_verify_and_expand(this.__wbg_ptr,t.__wbg_ptr,e.__wbg_ptr,i,o);if(c[2])throw a(c[1]);return yn.__wrap(c[0])}expand_without_verification(){const t=s.provencompactciphertextlist_expand_without_verification(this.__wbg_ptr);if(t[2])throw a(t[1]);return yn.__wrap(t[0])}len(){return s.compactciphertextlistexpander_len(this.__wbg_ptr)>>>0}static builder(t){h(t,Qt);const e=s.provencompactciphertextlist_builder(t.__wbg_ptr);if(e[2])throw a(e[1]);return Qn.__wrap(e[0])}is_empty(){return s.compactciphertextlistexpander_is_empty(this.__wbg_ptr)!==0}serialize(){const t=s.provencompactciphertextlist_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(bn.prototype[Symbol.dispose]=bn.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortint_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintclientkey_free(n>>>0,1));const za=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_shortintcompactpublickeyencryptionparameters_free(n>>>0,1));class Jn{static __wrap(t){t=t>>>0;const e=Object.create(Jn.prototype);return e.__wbg_ptr=t,za.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,za.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_shortintcompactpublickeyencryptionparameters_free(t,0)}static new_parameters(t,e,r,i,o,c,_,l){h(e,Ei);const u=s.shortintcompactpublickeyencryptionparameters_new_parameters(t,e.__wbg_ptr,r,i,o,c,_,l);if(u[2])throw a(u[1]);return Jn.__wrap(u[0])}constructor(t){const e=s.shortintcompactpublickeyencryptionparameters_new(t);return this.__wbg_ptr=e>>>0,za.register(this,this.__wbg_ptr,this),this}}Symbol.dispose&&(Jn.prototype[Symbol.dispose]=Jn.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintcompressedciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintcompressedpublickey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintcompressedserverkey_free(n>>>0,1));const Cf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_shortintnoisedistribution_free(n>>>0,1));class Ei{static __wrap(t){t=t>>>0;const e=Object.create(Ei.prototype);return e.__wbg_ptr=t,Cf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Cf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_shortintnoisedistribution_free(t,0)}}Symbol.dispose&&(Ei.prototype[Symbol.dispose]=Ei.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintparameters_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintpublickey_free(n>>>0,1));const Of=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfheclientkey_free(n>>>0,1));class A{static __wrap(t){t=t>>>0;const e=Object.create(A.prototype);return e.__wbg_ptr=t,Of.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Of.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfheclientkey_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.tfheclientkey_deserialize(e,r);if(i[2])throw a(i[1]);return A.__wrap(i[0])}safe_serialize(t){const e=s.tfheclientkey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.tfheclientkey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return A.__wrap(o[0])}static generate_with_seed(t,e){h(t,mn);const r=s.tfheclientkey_generate_with_seed(t.__wbg_ptr,e);if(r[2])throw a(r[1]);return A.__wrap(r[0])}static generate(t){h(t,mn);const e=s.tfheclientkey_generate(t.__wbg_ptr);if(e[2])throw a(e[1]);return A.__wrap(e[0])}serialize(){const t=s.tfheclientkey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(A.prototype[Symbol.dispose]=A.prototype.free);const Nf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfhecompactpublickey_free(n>>>0,1));class Qt{static __wrap(t){t=t>>>0;const e=Object.create(Qt.prototype);return e.__wbg_ptr=t,Nf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Nf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfhecompactpublickey_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.tfhecompactpublickey_deserialize(e,r);if(i[2])throw a(i[1]);return Qt.__wrap(i[0])}safe_serialize(t){const e=s.tfhecompactpublickey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.tfhecompactpublickey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Qt.__wrap(o[0])}static safe_deserialize_conformant(t,e,r){const i=y(t,s.__wbindgen_malloc),o=w;h(r,Jn);const c=s.tfhecompactpublickey_safe_deserialize_conformant(i,o,e,r.__wbg_ptr);if(c[2])throw a(c[1]);return Qt.__wrap(c[0])}static new(t){h(t,A);const e=s.tfhecompactpublickey_new(t.__wbg_ptr);if(e[2])throw a(e[1]);return Qt.__wrap(e[0])}serialize(){const t=s.tfhecompactpublickey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Qt.prototype[Symbol.dispose]=Qt.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfhecompressedcompactpublickey_free(n>>>0,1));const Ff=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfhecompressedpublickey_free(n>>>0,1));class I{static __wrap(t){t=t>>>0;const e=Object.create(I.prototype);return e.__wbg_ptr=t,Ff.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ff.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfhecompressedpublickey_free(t,0)}decompress(){const t=s.tfhecompressedpublickey_decompress(this.__wbg_ptr);if(t[2])throw a(t[1]);return k.__wrap(t[0])}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.tfhecompressedpublickey_deserialize(e,r);if(i[2])throw a(i[1]);return I.__wrap(i[0])}safe_serialize(t){const e=s.tfhecompressedpublickey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.tfhecompressedpublickey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return I.__wrap(o[0])}static new(t){h(t,A);const e=s.tfhecompressedpublickey_new(t.__wbg_ptr);if(e[2])throw a(e[1]);return I.__wrap(e[0])}serialize(){const t=s.tfhecompressedpublickey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(I.prototype[Symbol.dispose]=I.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfhecompressedserverkey_free(n>>>0,1));const Df=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfheconfig_free(n>>>0,1));class mn{static __wrap(t){t=t>>>0;const e=Object.create(mn.prototype);return e.__wbg_ptr=t,Df.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Df.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfheconfig_free(t,0)}}Symbol.dispose&&(mn.prototype[Symbol.dispose]=mn.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfheconfigbuilder_free(n>>>0,1));const Uf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfhepublickey_free(n>>>0,1));class k{static __wrap(t){t=t>>>0;const e=Object.create(k.prototype);return e.__wbg_ptr=t,Uf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Uf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfhepublickey_free(t,0)}static deserialize(t){const e=y(t,s.__wbindgen_malloc),r=w,i=s.tfhepublickey_deserialize(e,r);if(i[2])throw a(i[1]);return k.__wrap(i[0])}safe_serialize(t){const e=s.tfhepublickey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=y(t,s.__wbindgen_malloc),i=w,o=s.tfhepublickey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return k.__wrap(o[0])}static new(t){h(t,A);const e=s.tfhepublickey_new(t.__wbg_ptr);if(e[2])throw a(e[1]);return k.__wrap(e[0])}serialize(){const t=s.tfhepublickey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(k.prototype[Symbol.dispose]=k.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfheserverkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfhe_free(n>>>0,1));const Lf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_wbg_rayon_poolbuilder_free(n>>>0,1));class xi{static __wrap(t){t=t>>>0;const e=Object.create(xi.prototype);return e.__wbg_ptr=t,Lf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Lf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_wbg_rayon_poolbuilder_free(t,0)}numThreads(){return s.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr)>>>0}build(){s.wbg_rayon_poolbuilder_build(this.__wbg_ptr)}receiver(){return s.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr)>>>0}}Symbol.dispose&&(xi.prototype[Symbol.dispose]=xi.prototype.free);const Py=new Set(["basic","cors","default"]);async function vy(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(r){if(n.ok&&Py.has(n.type)&&n.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function ky(){const n={};return n.wbg={},n.wbg.__wbg_BigInt_40a77d45cca49470=function(){return mi(function(t){return BigInt(t)},arguments)},n.wbg.__wbg_BigInt_6adbfd8eb0f7ec07=function(t){return BigInt(t)},n.wbg.__wbg_Error_e17e777aac105295=function(t,e){return Error(is(t,e))},n.wbg.__wbg_call_13410aac570ffff7=function(){return mi(function(t,e){return t.call(e)},arguments)},n.wbg.__wbg_call_a5400b25a865cfd8=function(){return mi(function(t,e,r){return t.call(e,r)},arguments)},n.wbg.__wbg_crypto_574e78ad8b13b65f=function(t){return t.crypto},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(t,e){let r,i;try{r=t,i=e,console.error(is(t,e))}finally{s.__wbindgen_free(r,i,1)}},n.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return mi(function(t,e){t.getRandomValues(e)},arguments)},n.wbg.__wbg_getTime_6bb3f64e0f18f817=function(t){return t.getTime()},n.wbg.__wbg_instanceof_Window_12d20d558ef92592=function(t){let e;try{e=t instanceof Window}catch{e=!1}return e},n.wbg.__wbg_length_6bb7e81f9d7713e4=function(t){return t.length},n.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(t){return t.msCrypto},n.wbg.__wbg_new0_b0a0a38c201e6df5=function(){return new Date},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},n.wbg.__wbg_newnoargs_254190557c45b4ec=function(t,e){return new Function(is(t,e))},n.wbg.__wbg_newwithlength_a167dcc7aaa3ba77=function(t){return new Uint8Array(t>>>0)},n.wbg.__wbg_node_905d3e251edff8a2=function(t){return t.node},n.wbg.__wbg_process_dc0fbacc7c1c06f7=function(t){return t.process},n.wbg.__wbg_prototypesetcall_3d4a26c1ed734349=function(t,e,r){Uint8Array.prototype.set.call(m(t,e),r)},n.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return mi(function(t,e){t.randomFillSync(e)},arguments)},n.wbg.__wbg_require_60cc747a6bc5215a=function(){return mi(function(){return module.require},arguments)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(t,e){const r=e.stack,i=io(r,s.__wbindgen_malloc,s.__wbindgen_realloc),o=w;Vr().setInt32(t+4*1,o,!0),Vr().setInt32(t+4*0,i,!0)},n.wbg.__wbg_startWorkers_2ca11761e08ff5d5=function(t,e,r){return Ey(t,e,xi.__wrap(r))},n.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12=function(){const t=typeof eo>"u"?null:eo;return Kn(t)?0:rs(t)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184=function(){const t=typeof globalThis>"u"?null:globalThis;return Kn(t)?0:rs(t)},n.wbg.__wbg_static_accessor_SELF_995b214ae681ff99=function(){const t=typeof self>"u"?null:self;return Kn(t)?0:rs(t)},n.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea=function(){const t=typeof window>"u"?null:window;return Kn(t)?0:rs(t)},n.wbg.__wbg_subarray_70fd07feefe14294=function(t,e,r){return t.subarray(e>>>0,r>>>0)},n.wbg.__wbg_toString_1f1286a7a97689fe=function(t,e,r){const i=e.toString(r),o=io(i,s.__wbindgen_malloc,s.__wbindgen_realloc),c=w;Vr().setInt32(t+4*1,c,!0),Vr().setInt32(t+4*0,o,!0)},n.wbg.__wbg_toString_d8f537919ef401d6=function(t){return t.toString()},n.wbg.__wbg_versions_c01dfd4722a88165=function(t){return t.versions},n.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1=function(t,e){const r=e,i=typeof r=="bigint"?r:void 0;Vr().setBigInt64(t+8*1,Kn(i)?BigInt(0):i,!0),Vr().setInt32(t+4*0,!Kn(i),!0)},n.wbg.__wbg_wbindgenbitand_24bfc92ff26d44cb=function(t,e){return t&e},n.wbg.__wbg_wbindgenbitor_87169f71f306a104=function(t,e){return t|e},n.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d=function(t,e){const r=Ea(e),i=io(r,s.__wbindgen_malloc,s.__wbindgen_realloc),o=w;Vr().setInt32(t+4*1,o,!0),Vr().setInt32(t+4*0,i,!0)},n.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74=function(t){return typeof t=="function"},n.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8=function(t){const e=t;return typeof e=="object"&&e!==null},n.wbg.__wbg_wbindgenisstring_d4fa939789f003b0=function(t){return typeof t=="string"},n.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5=function(t){return t===void 0},n.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58=function(t,e){return t===e},n.wbg.__wbg_wbindgenlt_544155a2b3097bd5=function(t,e){return t<e},n.wbg.__wbg_wbindgenmemory_d84da70f7c42d172=function(){return s.memory},n.wbg.__wbg_wbindgenmodule_7e59019f6366ff9c=function(){return os.__wbindgen_wasm_module},n.wbg.__wbg_wbindgenneg_3577d8a6fd6fd98b=function(t){return-t},n.wbg.__wbg_wbindgenshl_54c6fe049ff902f0=function(t,e){return t<<e},n.wbg.__wbg_wbindgenshr_7d2aae6044c0dab1=function(t,e){return t>>e},n.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f=function(t,e){const r=e,i=typeof r=="string"?r:void 0;var o=Kn(i)?0:io(i,s.__wbindgen_malloc,s.__wbindgen_realloc),c=w;Vr().setInt32(t+4*1,c,!0),Vr().setInt32(t+4*0,o,!0)},n.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6=function(t,e){throw new Error(is(t,e))},n.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,e){return is(t,e)},n.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(t,e){return BigInt.asUintN(64,t)|e<<BigInt(64)},n.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(t){return BigInt.asUintN(64,t)},n.wbg.__wbindgen_cast_9ae0607507abb057=function(t){return t},n.wbg.__wbindgen_cast_cb9088102bce6b30=function(t,e){return m(t,e)},n.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(t){return t},n.wbg.__wbindgen_cast_e7b45dd881f38ce3=function(t,e){return BigInt.asUintN(64,t)|BigInt.asUintN(64,e)<<BigInt(64)},n.wbg.__wbindgen_init_externref_table=function(){const t=s.__wbindgen_export_2,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},n}function Iy(n,t){n.wbg.memory=t||new WebAssembly.Memory({initial:21,maximum:16384,shared:!0})}function Sy(n,t,e){if(s=n.exports,os.__wbindgen_wasm_module=t,ss=null,ns=null,typeof e<"u"&&(typeof e!="number"||e===0||e%65536!==0))throw"invalid stack size";return s.__wbindgen_start(e),s}async function os(n,t){if(s!==void 0)return s;let e;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n,memory:t,thread_stack_size:e}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof n>"u"&&(n=new URL("/tfhe_bg.wasm",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:yt&&yt.tagName.toUpperCase()==="SCRIPT"&&yt.src||new URL("relayer-sdk-js.umd.cjs",document.baseURI).href));const r=ky();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n)),Iy(r,t);const{instance:i,module:o}=await vy(await n,r);return Sy(i,o,e)}var Ty=Object.freeze({__proto__:null,CompactCiphertextList:Kr,CompactCiphertextListBuilder:Qn,CompactCiphertextListExpander:yn,CompactPkeCrs:Kt,FheBool:_e,FheInt10:le,FheInt1024:ue,FheInt104:fe,FheInt112:he,FheInt12:pe,FheInt120:de,FheInt128:we,FheInt136:ge,FheInt14:ye,FheInt144:be,FheInt152:me,FheInt16:Ae,FheInt160:Ee,FheInt168:xe,FheInt176:Re,FheInt184:ze,FheInt192:Pe,FheInt2:ve,FheInt200:ke,FheInt2048:Ie,FheInt208:Se,FheInt216:Te,FheInt224:Be,FheInt232:Ce,FheInt24:Oe,FheInt240:Ne,FheInt248:Fe,FheInt256:De,FheInt32:Ue,FheInt4:Le,FheInt40:Me,FheInt48:je,FheInt512:Ge,FheInt56:He,FheInt6:Ve,FheInt64:Ke,FheInt72:Qe,FheInt8:Je,FheInt80:$e,FheInt88:We,FheInt96:qe,FheUint10:Ze,FheUint1024:Ye,FheUint104:Xe,FheUint112:tr,FheUint12:er,FheUint120:rr,FheUint128:nr,FheUint136:ir,FheUint14:sr,FheUint144:or,FheUint152:ar,FheUint16:cr,FheUint160:_r,FheUint168:lr,FheUint176:ur,FheUint184:fr,FheUint192:hr,FheUint2:pr,FheUint200:dr,FheUint2048:wr,FheUint208:gr,FheUint216:yr,FheUint224:br,FheUint232:mr,FheUint24:Ar,FheUint240:Er,FheUint248:xr,FheUint256:Rr,FheUint32:zr,FheUint4:Pr,FheUint40:vr,FheUint48:kr,FheUint512:Ir,FheUint56:Sr,FheUint6:Tr,FheUint64:Br,FheUint72:Cr,FheUint8:Or,FheUint80:Nr,FheUint88:Fr,FheUint96:Dr,ProvenCompactCiphertextList:bn,ShortintCompactPublicKeyEncryptionParameters:Jn,ShortintNoiseDistribution:Ei,TfheClientKey:A,TfheCompactPublicKey:Qt,TfheCompressedPublicKey:I,TfheConfig:mn,TfhePublicKey:k,ZkComputeLoad:Zl,default:os,initThreadPool:Ra,init_panic_hook:xa,wbg_rayon_PoolBuilder:xi,wbg_rayon_start_worker:zy});let R,_t=0,as=null;function Ri(){return(as===null||as.byteLength===0)&&(as=new Uint8Array(R.memory.buffer)),as}const so=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},By=typeof so.encodeInto=="function"?function(n,t){return so.encodeInto(n,t)}:function(n,t){const e=so.encode(n);return t.set(e),{read:n.length,written:e.length}};function $n(n,t,e){if(e===void 0){const _=so.encode(n),l=t(_.length,1)>>>0;return Ri().subarray(l,l+_.length).set(_),_t=_.length,l}let r=n.length,i=t(r,1)>>>0;const o=Ri();let c=0;for(;c<r;c++){const _=n.charCodeAt(c);if(_>127)break;o[i+c]=_}if(c!==r){c!==0&&(n=n.slice(c)),i=e(i,r,r=c+n.length*3,1)>>>0;const _=Ri().subarray(i+c,i+r),l=By(n,_);c+=l.written,i=e(i,r,c,1)>>>0}return _t=c,i}let Wn=null;function Xt(){return(Wn===null||Wn.buffer.detached===!0||Wn.buffer.detached===void 0&&Wn.buffer!==R.memory.buffer)&&(Wn=new DataView(R.memory.buffer)),Wn}function zi(n){const t=R.__externref_table_alloc();return R.__wbindgen_export_4.set(t,n),t}function qn(n,t){try{return n.apply(this,t)}catch(e){const r=zi(e);R.__wbindgen_exn_store(r)}}const Mf=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Mf.decode();function cs(n,t){return n=n>>>0,Mf.decode(Ri().subarray(n,n+t))}function An(n){return n==null}function Pa(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){const i=n.length;let o="[";i>0&&(o+=Pa(n[0]));for(let c=1;c<i;c++)o+=", "+Pa(n[c]);return o+="]",o}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(e&&e.length>1)r=e[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
|
3
|
-
${n.stack}`:r}function Zn(n,t){if(!(n instanceof t))throw new Error(`expected instance of ${t.name}`)}function te(n,t){return n=n>>>0,Ri().subarray(n/1,n/1+t)}function ee(n,t){const e=t(n.length*1,1)>>>0;return Ri().set(n,e/1),_t=n.length,e}function Yn(n){const t=R.__wbindgen_export_4.get(n);return R.__externref_table_dealloc(n),t}function Cy(n,t){const e=$n(t,R.__wbindgen_malloc,R.__wbindgen_realloc),r=_t,i=R.new_server_id_addr(n,e,r);if(i[2])throw Yn(i[1]);return vi.__wrap(i[0])}function jf(n,t){const e=t(n.length*4,4)>>>0;for(let r=0;r<n.length;r++){const i=zi(n[r]);Xt().setUint32(e+4*r,i,!0)}return _t=n.length,e}function Oy(n,t,e){const r=jf(n,R.__wbindgen_malloc),i=_t,o=$n(t,R.__wbindgen_malloc,R.__wbindgen_realloc),c=_t,_=$n(e,R.__wbindgen_malloc,R.__wbindgen_realloc),l=_t,u=R.new_client(r,i,o,c,_,l);if(u[2])throw Yn(u[1]);return oo.__wrap(u[0])}function Gf(n,t){n=n>>>0;const e=Xt(),r=[];for(let i=n;i<n+4*t;i+=4)r.push(R.__wbindgen_export_4.get(e.getUint32(i,!0)));return R.__externref_drop_slice(n,t),r}function Ny(){const n=R.ml_kem_pke_keygen();return Xn.__wrap(n)}function Fy(n){Zn(n,Xn);const t=R.ml_kem_pke_get_pk(n.__wbg_ptr);return Pi.__wrap(t)}function Dy(n){Zn(n,Pi);const t=R.ml_kem_pke_pk_to_u8vec(n.__wbg_ptr);if(t[3])throw Yn(t[2]);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}function Uy(n){Zn(n,Xn);const t=R.ml_kem_pke_sk_to_u8vec(n.__wbg_ptr);if(t[3])throw Yn(t[2]);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}function Ly(n){const t=ee(n,R.__wbindgen_malloc),e=_t,r=R.u8vec_to_ml_kem_pke_pk(t,e);if(r[2])throw Yn(r[1]);return Pi.__wrap(r[0])}function My(n){const t=ee(n,R.__wbindgen_malloc),e=_t,r=R.u8vec_to_ml_kem_pke_sk(t,e);if(r[2])throw Yn(r[1]);return Xn.__wrap(r[0])}function jy(n,t,e,r,i,o,c){Zn(n,oo),Zn(i,Pi),Zn(o,Xn);const _=R.process_user_decryption_resp_from_js(n.__wbg_ptr,t,e,r,i.__wbg_ptr,o.__wbg_ptr,c);if(_[3])throw Yn(_[2]);var l=Gf(_[0],_[1]).slice();return R.__wbindgen_free(_[0],_[1]*4,4),l}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_ciphertexthandle_free(n>>>0,1));const Hf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_client_free(n>>>0,1));class oo{static __wrap(t){t=t>>>0;const e=Object.create(oo.prototype);return e.__wbg_ptr=t,Hf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Hf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_client_free(t,0)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_eip712domainmsg_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_parseduserdecryptionrequest_free(n>>>0,1));const Vf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_privateenckeymlkem512_free(n>>>0,1));class Xn{static __wrap(t){t=t>>>0;const e=Object.create(Xn.prototype);return e.__wbg_ptr=t,Vf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Vf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_privateenckeymlkem512_free(t,0)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_privatesigkey_free(n>>>0,1));const Kf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_publicenckeymlkem512_free(n>>>0,1));class Pi{static __wrap(t){t=t>>>0;const e=Object.create(Pi.prototype);return e.__wbg_ptr=t,Kf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Kf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_publicenckeymlkem512_free(t,0)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_publicsigkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_requestid_free(n>>>0,1));const Qf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_serveridaddr_free(n>>>0,1));class vi{static __wrap(t){t=t>>>0;const e=Object.create(vi.prototype);return e.__wbg_ptr=t,Qf.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof vi?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Qf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_serveridaddr_free(t,0)}}const Jf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_typedciphertext_free(n>>>0,1));class _s{static __wrap(t){t=t>>>0;const e=Object.create(_s.prototype);return e.__wbg_ptr=t,Jf.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof _s?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Jf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_typedciphertext_free(t,0)}get ciphertext(){const t=R.__wbg_get_typedciphertext_ciphertext(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set ciphertext(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get fhe_type(){return R.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr)}set fhe_type(t){R.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr,t)}get external_handle(){const t=R.__wbg_get_typedciphertext_external_handle(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set external_handle(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get ciphertext_format(){return R.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr)}set ciphertext_format(t){R.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr,t)}}const $f=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_typedplaintext_free(n>>>0,1));class va{static __wrap(t){t=t>>>0;const e=Object.create(va.prototype);return e.__wbg_ptr=t,$f.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$f.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_typedplaintext_free(t,0)}get bytes(){const t=R.__wbg_get_typedplaintext_bytes(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set bytes(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get fhe_type(){return R.__wbg_get_typedplaintext_fhe_type(this.__wbg_ptr)}set fhe_type(t){R.__wbg_set_typedplaintext_fhe_type(this.__wbg_ptr,t)}}const Wf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_typedsigncryptedciphertext_free(n>>>0,1));class ls{static __wrap(t){t=t>>>0;const e=Object.create(ls.prototype);return e.__wbg_ptr=t,Wf.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof ls?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Wf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_typedsigncryptedciphertext_free(t,0)}get fhe_type(){return R.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr)}set fhe_type(t){R.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr,t)}get signcrypted_ciphertext(){const t=R.__wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set signcrypted_ciphertext(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get external_handle(){const t=R.__wbg_get_typedsigncryptedciphertext_external_handle(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set external_handle(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get packing_factor(){return R.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr)>>>0}set packing_factor(t){R.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr,t)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>R.__wbg_userdecryptionrequest_free(n>>>0,1));const Gy=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_userdecryptionresponse_free(n>>>0,1));class ka{static __unwrap(t){return t instanceof ka?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Gy.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_userdecryptionresponse_free(t,0)}get signature(){const t=R.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set signature(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get external_signature(){const t=R.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set external_signature(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get payload(){const t=R.__wbg_get_userdecryptionresponse_payload(this.__wbg_ptr);return t===0?void 0:ao.__wrap(t)}set payload(t){let e=0;An(t)||(Zn(t,ao),e=t.__destroy_into_raw()),R.__wbg_set_userdecryptionresponse_payload(this.__wbg_ptr,e)}get extra_data(){const t=R.__wbg_get_userdecryptionresponse_extra_data(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set extra_data(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr,e,r)}}const qf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>R.__wbg_userdecryptionresponsepayload_free(n>>>0,1));class ao{static __wrap(t){t=t>>>0;const e=Object.create(ao.prototype);return e.__wbg_ptr=t,qf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,qf.unregister(this),t}free(){const t=this.__destroy_into_raw();R.__wbg_userdecryptionresponsepayload_free(t,0)}get verification_key(){const t=R.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set verification_key(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get digest(){const t=R.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);var e=te(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*1,1),e}set digest(t){const e=ee(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get signcrypted_ciphertexts(){const t=R.__wbg_get_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr);var e=Gf(t[0],t[1]).slice();return R.__wbindgen_free(t[0],t[1]*4,4),e}set signcrypted_ciphertexts(t){const e=jf(t,R.__wbindgen_malloc),r=_t;R.__wbg_set_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr,e,r)}get party_id(){return R.__wbg_get_userdecryptionresponsepayload_party_id(this.__wbg_ptr)>>>0}set party_id(t){R.__wbg_set_userdecryptionresponsepayload_party_id(this.__wbg_ptr,t)}get degree(){return R.__wbg_get_userdecryptionresponsepayload_degree(this.__wbg_ptr)>>>0}set degree(t){R.__wbg_set_userdecryptionresponsepayload_degree(this.__wbg_ptr,t)}}async function Hy(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function Vy(){const n={};return n.wbg={},n.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,e){const r=String(e),i=$n(r,R.__wbindgen_malloc,R.__wbindgen_realloc),o=_t;Xt().setInt32(t+4*1,o,!0),Xt().setInt32(t+4*0,i,!0)},n.wbg.__wbg_buffer_609cc3eee51ed158=function(t){return t.buffer},n.wbg.__wbg_call_672a4d21634d4a24=function(){return qn(function(t,e){return t.call(e)},arguments)},n.wbg.__wbg_call_7cccdd69e0791ae2=function(){return qn(function(t,e,r){return t.call(e,r)},arguments)},n.wbg.__wbg_crypto_ed58b8e10a292839=function(t){return t.crypto},n.wbg.__wbg_done_769e5ede4b31c67b=function(t){return t.done},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(t,e){let r,i;try{r=t,i=e,console.error(cs(t,e))}finally{R.__wbindgen_free(r,i,1)}},n.wbg.__wbg_getRandomValues_bcb4912f16000dc4=function(){return qn(function(t,e){t.getRandomValues(e)},arguments)},n.wbg.__wbg_get_67b2ba62fc30de12=function(){return qn(function(t,e){return Reflect.get(t,e)},arguments)},n.wbg.__wbg_get_b9b93047fe3cf45b=function(t,e){return t[e>>>0]},n.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,e){return t[e]},n.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let e;try{e=t instanceof ArrayBuffer}catch{e=!1}return e},n.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let e;try{e=t instanceof Uint8Array}catch{e=!1}return e},n.wbg.__wbg_isArray_a1eab7e0d067391b=function(t){return Array.isArray(t)},n.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(t){return Number.isSafeInteger(t)},n.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},n.wbg.__wbg_length_a446193dc22c12f8=function(t){return t.length},n.wbg.__wbg_length_e2d2a49132c1b256=function(t){return t.length},n.wbg.__wbg_msCrypto_0a36e2ec3a343d26=function(t){return t.msCrypto},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},n.wbg.__wbg_new_a12002a7f91c75be=function(t){return new Uint8Array(t)},n.wbg.__wbg_newnoargs_105ed471475aaf50=function(t,e){return new Function(cs(t,e))},n.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(t,e,r){return new Uint8Array(t,e>>>0,r>>>0)},n.wbg.__wbg_newwithlength_a381634e90c276d4=function(t){return new Uint8Array(t>>>0)},n.wbg.__wbg_next_25feadfc0913fea9=function(t){return t.next},n.wbg.__wbg_next_6574e1a8a62d1055=function(){return qn(function(t){return t.next()},arguments)},n.wbg.__wbg_node_02999533c4ea02e3=function(t){return t.node},n.wbg.__wbg_process_5c1d670bc53614b8=function(t){return t.process},n.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740=function(){return qn(function(t,e){t.randomFillSync(e)},arguments)},n.wbg.__wbg_require_79b1e9274cde3c87=function(){return qn(function(){return module.require},arguments)},n.wbg.__wbg_serveridaddr_new=function(t){return vi.__wrap(t)},n.wbg.__wbg_serveridaddr_unwrap=function(t){return vi.__unwrap(t)},n.wbg.__wbg_set_65595bdd868b3009=function(t,e,r){t.set(e,r>>>0)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(t,e){const r=e.stack,i=$n(r,R.__wbindgen_malloc,R.__wbindgen_realloc),o=_t;Xt().setInt32(t+4*1,o,!0),Xt().setInt32(t+4*0,i,!0)},n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const t=typeof eo>"u"?null:eo;return An(t)?0:zi(t)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const t=typeof globalThis>"u"?null:globalThis;return An(t)?0:zi(t)},n.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const t=typeof self>"u"?null:self;return An(t)?0:zi(t)},n.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const t=typeof window>"u"?null:window;return An(t)?0:zi(t)},n.wbg.__wbg_subarray_aa9065fa9dc5df96=function(t,e,r){return t.subarray(e>>>0,r>>>0)},n.wbg.__wbg_typedciphertext_new=function(t){return _s.__wrap(t)},n.wbg.__wbg_typedciphertext_unwrap=function(t){return _s.__unwrap(t)},n.wbg.__wbg_typedplaintext_new=function(t){return va.__wrap(t)},n.wbg.__wbg_typedsigncryptedciphertext_new=function(t){return ls.__wrap(t)},n.wbg.__wbg_typedsigncryptedciphertext_unwrap=function(t){return ls.__unwrap(t)},n.wbg.__wbg_userdecryptionresponse_unwrap=function(t){return ka.__unwrap(t)},n.wbg.__wbg_value_cd1ffa7b1ab794f1=function(t){return t.value},n.wbg.__wbg_versions_c71aa1626a93e0a1=function(t){return t.versions},n.wbg.__wbindgen_as_number=function(t){return+t},n.wbg.__wbindgen_boolean_get=function(t){const e=t;return typeof e=="boolean"?e?1:0:2},n.wbg.__wbindgen_debug_string=function(t,e){const r=Pa(e),i=$n(r,R.__wbindgen_malloc,R.__wbindgen_realloc),o=_t;Xt().setInt32(t+4*1,o,!0),Xt().setInt32(t+4*0,i,!0)},n.wbg.__wbindgen_error_new=function(t,e){return new Error(cs(t,e))},n.wbg.__wbindgen_in=function(t,e){return t in e},n.wbg.__wbindgen_init_externref_table=function(){const t=R.__wbindgen_export_4,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},n.wbg.__wbindgen_is_function=function(t){return typeof t=="function"},n.wbg.__wbindgen_is_null=function(t){return t===null},n.wbg.__wbindgen_is_object=function(t){const e=t;return typeof e=="object"&&e!==null},n.wbg.__wbindgen_is_string=function(t){return typeof t=="string"},n.wbg.__wbindgen_is_undefined=function(t){return t===void 0},n.wbg.__wbindgen_jsval_loose_eq=function(t,e){return t==e},n.wbg.__wbindgen_memory=function(){return R.memory},n.wbg.__wbindgen_number_get=function(t,e){const r=e,i=typeof r=="number"?r:void 0;Xt().setFloat64(t+8*1,An(i)?0:i,!0),Xt().setInt32(t+4*0,!An(i),!0)},n.wbg.__wbindgen_string_get=function(t,e){const r=e,i=typeof r=="string"?r:void 0;var o=An(i)?0:$n(i,R.__wbindgen_malloc,R.__wbindgen_realloc),c=_t;Xt().setInt32(t+4*1,c,!0),Xt().setInt32(t+4*0,o,!0)},n.wbg.__wbindgen_string_new=function(t,e){return cs(t,e)},n.wbg.__wbindgen_throw=function(t,e){throw new Error(cs(t,e))},n}function Ky(n,t){return R=n.exports,Ia.__wbindgen_wasm_module=t,Wn=null,as=null,R.__wbindgen_start(),R}async function Ia(n){if(R!==void 0)return R;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof n>"u"&&(n=new URL("/kms_lib_bg.wasm",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:yt&&yt.tagName.toUpperCase()==="SCRIPT"&&yt.src||new URL("relayer-sdk-js.umd.cjs",document.baseURI).href));const t=Vy();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:e,module:r}=await Hy(await n,t);return Ky(e,r)}const Qy=BigInt(1024*1024*512),us=BigInt(1024*1024*512),fs=BigInt(1024*1024*512),hs="0.4.0-alpha.1",co="@zama-fhe/relayer-sdk";function Zf(n){if(n instanceof Error&&typeof n.cause=="object"&&n.cause!==null)return n.cause}function Jy(n){const t=Zf(n);if(!(!t||!("code"in t)||!t.code)&&typeof t.code=="string")return t.code}function $y(n){const t=Zf(n);if(!(!t||!("status"in t)||t.status===void 0)&&typeof t.status=="number")return t.status}async function Yf(n,t){let e;if(t.status===429)e="Relayer rate limit exceeded: Please wait and try again later.";else switch(n){case"PUBLIC_DECRYPT":{e=`Public decrypt failed: relayer respond with HTTP code ${t.status}`;break}case"USER_DECRYPT":{e=`User decrypt failed: relayer respond with HTTP code ${t.status}`;break}case"KEY_URL":{e=`HTTP error! status: ${t.status}`;break}default:{const o=await t.text();e=`Relayer didn't response correctly. Bad status ${t.statusText}. Content: ${o}`;break}}let r;try{r=await t.json()}catch{r=""}const i={code:"RELAYER_FETCH_ERROR",operation:n,status:t.status,statusText:t.statusText,url:t.url,response:t,responseJson:r};throw new Error(e,{cause:i})}function Xf(n,t,e){let r;switch(n){case"PUBLIC_DECRYPT":{r="Public decrypt failed: Relayer didn't return a JSON";break}case"USER_DECRYPT":{r="User decrypt failed: Relayer didn't return a JSON";break}default:{r="Relayer didn't return a JSON";break}}const i={code:"RELAYER_NO_JSON_ERROR",operation:n,error:t,response:e};throw new Error(r,{cause:i})}function th(n,t){let e;switch(n){case"PUBLIC_DECRYPT":{e="Public decrypt failed: Relayer returned an unexpected JSON response";break}case"USER_DECRYPT":{e="User decrypt failed: Relayer returned an unexpected JSON response";break}default:{e="Relayer returned an unexpected JSON response";break}}const r={code:"RELAYER_UNEXPECTED_JSON_ERROR",operation:n,error:t};throw new Error(e,{cause:r})}function Wy(n,t){let e;switch(n){case"PUBLIC_DECRYPT":{e="Pulbic decrypt failed: the public decryption didn't succeed for an unknown reason";break}case"USER_DECRYPT":{e="User decrypt failed: the user decryption didn't succeed for an unknown reason";break}default:{e="Relayer didn't response correctly.";break}}const r={code:"RELAYER_INTERNAL_ERROR",operation:n,error:t};throw new Error(e,{cause:r})}function eh(n,t,e){if(!e)switch(n){case"PUBLIC_DECRYPT":{e="Public decrypt failed: Relayer didn't respond";break}case"USER_DECRYPT":{e="User decrypt failed: Relayer didn't respond";break}default:{e="Relayer didn't response correctly. Bad JSON.";break}}const r={code:"RELAYER_UNKNOWN_ERROR",operation:n,error:t};throw new Error(e??"Relayer didn't response correctly.",{cause:r})}function rh(n,t){if(t)switch(t.__type){case"BearerToken":n.headers.Authorization=`Bearer ${t.token}`;break;case"ApiKeyHeader":n.headers[t.header||"x-api-key"]=t.value;break;case"ApiKeyCookie":if(typeof window<"u")document.cookie=`${t.cookie||"x-api-key"}=${t.value}; path=/; SameSite=Lax; Secure; HttpOnly;`,n.credentials="include";else{let e=`${t.cookie||"x-api-key"}=${t.value};`;n.headers.Cookie=e}break}return n}function nh(n){if(!n||typeof n!="object")throw new Error("Unexpected response JSON.");if(!("response"in n&&n.response!==null&&n.response!==void 0))throw new Error("Unexpected response JSON format: missing 'response' property.")}async function Sa(n,t,e,r){const i=rh({method:"POST",headers:{"Content-Type":"application/json","ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${co}`},body:JSON.stringify(e)},r?.auth);let o,c;try{o=await fetch(t,i)}catch(l){eh(n,l)}o.ok||await Yf(n,o);let _;try{_=await o.json()}catch(l){Xf(n,l,o)}try{nh(_),c=_}catch(l){th(n,l)}return c}async function Ta(n,t){const e={method:"GET",headers:{"ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${co}`}};let r,i;try{r=await fetch(t,e)}catch(c){eh(n,c)}r.ok||await Yf(n,r);let o;try{o=await r.json()}catch(c){Xf(n,c,r)}try{nh(o),i=o}catch(c){th(n,c)}return i}const Ba={},ih=async(n,t)=>{if(Ba[n])return Ba[n];const e=await Ta("KEY_URL",`${n}/keyurl`);try{let r;if(!t)r=e.response.fhe_key_info[0].fhe_public_key.urls[0],t=e.response.fhe_key_info[0].fhe_public_key.data_id;else{const b=e.response.fhe_key_info.find(x=>x.fhe_public_key.data_id===t);if(!b)throw new Error(`Could not find FHE key info with data_id ${t}`);r=b.fhe_public_key.urls[0]}const i=await fetch(r);if(!i.ok)throw new Error(`HTTP error! status: ${i.status} on ${i.url}`);let o;typeof i.bytes=="function"?o=await i.bytes():o=new Uint8Array(await i.arrayBuffer());const c=e.response.crs[2048].urls[0],_=e.response.crs[2048].data_id,l=await fetch(c);if(!l.ok)throw new Error(`HTTP error! status: ${l.status} on ${l.url}`);let u;typeof l.bytes=="function"?u=await l.bytes():u=new Uint8Array(await l.arrayBuffer());let p;try{p=TFHE.TfheCompactPublicKey.safe_deserialize(o,us)}catch(b){throw new Error("Invalid public key (deserialization failed)",{cause:b})}let f;try{f=TFHE.CompactPkeCrs.safe_deserialize(new Uint8Array(u),fs)}catch(b){throw new Error("Invalid crs (deserialization failed)",{cause:b})}const d={publicKey:p,publicKeyId:t,publicParams:{2048:{publicParams:f,publicParamsId:_}}};return Ba[n]=d,d}catch(r){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:r})}};class Ft extends Error{name="RelayerErrorBase";_details;_docsPath;_docsUrl;_version;static VERSION=hs;static DEFAULT_DOCS_BASE_URL="https//docs.zama.org";static FULL_VERSION=`@zama-fhe/relayer-sdk@${Ft.VERSION}`;constructor(t){let e,r;t.cause instanceof Ft?(r=t.docsPath||t.cause.docsPath,e=t.details||t.cause.details):(r=t.docsPath,e=t.details||t.cause?.message);const i=r?`${t.docsBaseUrl??Ft.DEFAULT_DOCS_BASE_URL}${r}${t.docsSlug?`#${t.docsSlug}`:""}`:void 0,o=[t.message||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...e?[`Details: ${e}`]:[],`Version: ${Ft.FULL_VERSION}`].join(`
|
|
4
|
-
`);super(o,t.cause?{cause:t.cause}:void 0),Object.setPrototypeOf(this,new.target.prototype),this._details=e,this._docsPath=r,this._docsUrl=i,this._version=Ft.VERSION,this.name=t.name??this.name}get docsPath(){return this._docsPath}get docsUrl(){return this._docsUrl}get details(){return this._details}get version(){return this._version}}class at extends Ft{_objName;_property;_expectedType;_index;_value;_type;_expectedValue;constructor({objName:t,property:e,index:r,type:i,value:o,expectedValue:c,expectedType:_}){let l=i==="undefined"&&c!==void 0,u;!e||e===""?u=r!==void 0?`${t}[${r}]`:`${t}`:u=r!==void 0?`${t}.${e}[${r}]`:`${t}.${e}`;let p=l?`InvalidPropertyError: Missing '${u}'`:`InvalidPropertyError: ${u}`;i===_?o!==void 0&&(p+=` unexpected value ${o}`):l?(Array.isArray(c)&&(c=c.join("|")),p+=`, expected '${u}: ${c}'.`):_!=="unknown"&&i!=="unknown"&&(p+=` not a ${_}`,i&&(p+=`, type is ${i}`)),super({message:p,name:"InvalidPropertyError"}),this._objName=t,this._property=e,this._value=o,this._type=i,this._expectedValue=c,this._expectedType=_,this._index=r}static missingProperty({objName:t,property:e,expectedType:r,expectedValue:i}){return new at({objName:t,property:e,expectedType:r,expectedValue:i,type:"undefined"})}static invalidFormat({objName:t,property:e}){return new at({objName:t,property:e,expectedType:"unknown"})}static invalidObject({objName:t,expectedType:e,type:r}){return new at({objName:t,property:"",expectedType:e,type:r})}}function Jt(n,t){return!(!n||typeof n!="object"||!(t in n)||n[t]===void 0||n[t]===null)}function an(n,t,e){if(!Jt(n,t))throw new at({objName:e,property:t,expectedType:"non-nullable",type:xn(n,t)})}function qy(n,t){return Jt(n,t)?Array.isArray(n[t]):!1}function En(n,t,e){if(!qy(n,t))throw new at({objName:e,property:t,expectedType:"Array",type:xn(n,t)})}function Zy(n,t){return Jt(n,t)?typeof n[t]=="boolean":!1}function Ca(n,t,e,r){if(!Zy(n,t))throw new at({objName:e,property:t,expectedType:"boolean",type:xn(n,t)});if(r!==void 0&&n[t]!==r)throw new at({objName:e,property:t,expectedType:"boolean",expectedValue:String(r),type:typeof n[t],value:String(n[t])})}function xn(n,t){return Jt(n,t)?typeof n[t]:"undefined"}class ps extends Ft{constructor(t){super({...t,name:"InternalError",message:t.message??"internal error"})}}function sh(n){if(!n)throw new ps({message:"Assertion failed"})}function Oa(n,t){return n?t.length===0?n:n.endsWith(t)?n.slice(0,-t.length):n:""}function Yy(n){return typeof n=="string"&&n.startsWith("0x")}function Xy(n){return typeof n=="string"&&!n.startsWith("0x")}function oh(n){return n.startsWith("0x")?n:`0x${n}`}function tb(n){return n.startsWith("0x")?n.substring(2):n}function eb(n,t){return Jt(n,t)?typeof n[t]=="string":!1}function W(n,t,e,r){if(!eb(n,t))throw new at({objName:e,property:t,expectedType:"string",expectedValue:r,type:xn(n,t)});if(r!==void 0){if(Array.isArray(r)){for(let i=0;i<r.length;++i)if(n[t]===r[i])return;throw new at({objName:e,property:t,expectedType:"string",expectedValue:r,type:typeof n[t],value:n[t]})}else if(n[t]!==r)throw new at({objName:e,property:t,expectedType:"string",expectedValue:r,type:typeof n[t],value:n[t]})}}function rb(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(typeof r[i]!="string")throw new at({objName:e,property:`${t}[${i}]`,expectedType:"string",type:typeof r[i]})}function re(n){try{return JSON.stringify(n,(t,e)=>typeof e=="bigint"?e.toString():e)}catch{return""}}const ah=["function getKmsSigners() view returns (address[])","function getThreshold() view returns (uint256)"],ch=["function getCoprocessorSigners() view returns (address[])","function getThreshold() view returns (uint256)"],nb=n=>{if(typeof n=="string")return new by(n);if(n)return new Vn(n);throw new Error("You must provide a network URL or a EIP1193 object (eg: window.ethereum)")},ib=async(n,t)=>{if(t.chainId&&typeof t.chainId=="number")return t.chainId;if(t.chainId&&typeof t.chainId!="number")throw new Error("chainId must be a number.");{const e=(await n.getNetwork()).chainId;return Number(e)}},sb=async n=>{if(n.relayerVersionUrl&&!n.publicKey){const t=await ih(Oa(n.relayerVersionUrl,"/"));return{publicKey:t.publicKey,publicKeyId:t.publicKeyId}}else if(n.publicKey&&n.publicKey.data&&n.publicKey.id){const t=n.publicKey.data;try{return{publicKey:TFHE.TfheCompactPublicKey.safe_deserialize(t,us),publicKeyId:n.publicKey.id}}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}else throw new Error("You must provide a public key with its public key ID.")},ob=async n=>{if(n.relayerVersionUrl&&!n.publicParams)return(await ih(Oa(n.relayerVersionUrl,"/"))).publicParams;if(n.publicParams&&n.publicParams[2048]){const t=n.publicParams[2048].publicParams;try{return{2048:{publicParams:TFHE.CompactPkeCrs.safe_deserialize(t,fs),publicParamsId:n.publicParams[2048].publicParamsId}}}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}else throw new Error("You must provide a valid CRS with its CRS ID.")},ab=async(n,t)=>await new ce(t,ah,n).getKmsSigners(),cb=async(n,t)=>{const r=await new ce(t,ah,n).getThreshold();return Number(r)},_b=async(n,t)=>await new ce(t,ch,n).getCoprocessorSigners(),lb=async(n,t)=>{const r=await new ce(t,ch,n).getThreshold();return Number(r)},_h={0:2,2:8,3:16,4:32,5:64,6:128,7:160,8:256};function lh(n){let t=0;for(const e of n){if(e.length!==66)throw new Error(`Handle ${e} is not of valid length`);const r=e.slice(-4,-2).toLowerCase(),i=parseInt(r,16);if(!(i in _h))throw new Error(`Handle ${e} is not of valid type`);if(t+=_h[i],t>2048)throw new Error("Cannot decrypt more than 2048 encrypted bits in a single request")}return t}class ds extends Ft{_objName;_type;_expectedType;_expectedCustomType;constructor({objName:t,type:e,expectedType:r,expectedCustomType:i}){super({message:`InvalidTypeError ${t} ${r} ${e}`,name:"InvalidTypeError"}),this._objName=t,this._type=e,this._expectedType=r,this._expectedCustomType=i}get objName(){return this._objName}get type(){return this._type}get expectedType(){return this._expectedType}get expectedCustomType(){return this._expectedCustomType}}function ub(n,t){return!n||!(n instanceof Uint8Array)?!1:n.length===t}function _o(n,t){return!(!Yy(n)||t!==void 0&&n.length!==2*t+2||(n.length-2)%2!==0||!/^0x[a-fA-F0-9]*$/.test(n))}function uh(n,t){return!(!Xy(n)||(n.length-2)%2!==0||!/^[a-fA-F0-9]*$/.test(n))}function Na(n){return _o(n,32)}function fb(n){return _o(n,65)}function hb(n){return ub(n,32)}function pb(n){if(!hb(n))throw new ds({type:typeof n,expectedType:"Bytes32"})}function db(n,t){return Jt(n,t)?_o(n[t]):!1}function lo(n,t,e){if(!db(n,t))throw new at({objName:e,property:t,expectedType:"BytesHex",type:xn(n,t)})}function wb(n,t){return Jt(n,t)?uh(n[t]):!1}function ws(n,t,e){if(!wb(n,t))throw new at({objName:e,property:t,expectedType:"BytesHexNo0x",type:xn(n,t)})}function fh(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!Na(r[i]))throw new at({objName:e,property:`${t}[${i}]`,expectedType:"Bytes32Hex",type:typeof r[i]})}function gb(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!fb(r[i]))throw new at({objName:e,property:`${t}[${i}]`,expectedType:"Bytes65Hex",type:typeof r[i]})}function yb(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!_o(r[i]))throw new at({objName:e,property:`${t}[${i}]`,expectedType:"BytesHex",type:typeof r[i]})}function hh(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!uh(r[i]))throw new at({objName:e,property:`${t}[${i}]`,expectedType:"BytesHexNo0x",type:typeof r[i]})}function bb(n,t){return Jt(n,t)?n[t]instanceof Uint8Array:!1}function Fa(n,t,e){if(!bb(n,t))throw new at({objName:e,property:t,expectedType:"Uint8Array",type:xn(n,t)})}function mb(n){if(!n||n?.length===0)return"";let t="";for(let e=0;e<n.length;e++)t+=n[e].toString(16).padStart(2,"0");return t}function Ab(n){return`0x${mb(n)}`}function $t(n){const t=n.replace(/^(0x)/,"").match(/.{1,2}/g);return t?Uint8Array.from(t.map(e=>parseInt(e,16))):new Uint8Array}function Eb(n){if(!n||n.length===0)return BigInt(0);let t=BigInt(0);for(let e=0;e<n.length;e++)t=t<<BigInt(8)|BigInt(n[e]);return t}function Qr(n,t=!1){return`${t?"0x":""}${n.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}`}async function ph(n){const t=await fetch(n);if(!t.ok)throw new Error(`HTTP error! status: ${t.status} on ${t.url}`);return typeof t.bytes=="function"?await t.bytes():new Uint8Array(await t.arrayBuffer())}function dh(...n){let t=0;for(const i of n)t+=i.length;const e=new Uint8Array(t);let r=0;for(const i of n)e.set(i,r),r+=i.length;return e}const uo=n=>Y(n),xb=["function persistAllowed(bytes32 handle, address account) view returns (bool)"],wh=10,gh=BigInt(365);function Rb(n,t){if(t===0)return n===BigInt(1);if(t===7)return uo("0x"+n.toString(16).padStart(40,"0"));if(t>8||t==1)throw new Error(`Unsupported handle type ${t}`);return n}function zb(n,t){let e=[];for(const i of n){const o=i.slice(-4,-2).toLowerCase(),c=parseInt(o,16);e.push(c)}const r={};return n.forEach((i,o)=>r[i]=Rb(t[o],e[o])),r}function Pb(n,t){if(t===BigInt(0))throw Error("durationDays is null");if(t>gh)throw Error(`durationDays is above max duration of ${gh}`);const e=BigInt(Math.floor(Date.now()/1e3));if(n>e)throw Error("startTimestamp is set in the future");const r=t*BigInt(86400);if(n+r<e)throw Error("User decrypt request has expired")}const vb=(n,t,e,r,i,o,c,_)=>async(l,u,p,f,d,b,x,E,z)=>{const P="0x00";let T,B;try{T=TKMS.u8vec_to_ml_kem_pke_pk($t(p)),B=TKMS.u8vec_to_ml_kem_pke_sk($t(u))}catch(G){throw new Error("Invalid public or private key",{cause:G})}const M=f.replace(/^(0x)/,""),D=p.replace(/^(0x)/,""),C=l.map(G=>({handle:typeof G.handle=="string"?Qr($t(G.handle),!0):Qr(G.handle,!0),contractAddress:uo(G.contractAddress)}));lh(C.map(G=>G.handle)),Pb(BigInt(x),BigInt(E));const j=new ce(i,xb,c),N=C.map(async({handle:G,contractAddress:S})=>{const U=await j.persistAllowed(G,b),J=await j.persistAllowed(G,S);if(!U)throw new Error(`User ${b} is not authorized to user decrypt handle ${G}!`);if(!J)throw new Error(`dapp contract ${S} is not authorized to user decrypt handle ${G}!`);if(b===S)throw new Error(`userAddress ${b} should not be equal to contractAddress when requesting user decryption!`)}),q=d.length;if(q===0)throw Error("contractAddresses is empty");if(q>wh)throw Error(`contractAddresses max length of ${wh} exceeded`);await Promise.all(N).catch(G=>{throw G});const Q={handleContractPairs:C,requestValidity:{startTimestamp:x.toString(),durationDays:E.toString()},contractsChainId:e.toString(),contractAddresses:d.map(G=>uo(G)),userAddress:uo(b),signature:M,publicKey:D,extraData:P},K=await o.fetchPostUserDecrypt(Q,{..._,...z});let ht=n.map((G,S)=>TKMS.new_server_id_addr(S+1,G));const Et=TKMS.new_client(ht,b,"default");try{const G=new ArrayBuffer(32);new DataView(G).setUint32(28,t,!1);const J={name:"Decryption",version:"1",chain_id:new Uint8Array(G),verifying_contract:r,salt:null},nt={signature:M,client_address:b,enc_key:D,ciphertext_handles:C.map(zt=>zt.handle.replace(/^0x/,"")),eip712_verifying_contract:r},xt=TKMS.process_user_decryption_resp_from_js(Et,nt,J,K,T,B,!0).map(zt=>Eb(zt.bytes));return zb(C.map(zt=>zt.handle),xt)}catch(G){throw new Error("An error occured during decryption",{cause:G})}},ti=(n,t)=>{if(n==null)throw new Error("Missing value");let e;if(t>=8?e=BigInt(`0x${new Array(t/8).fill(null).reduce(r=>`${r}ff`,"")}`):e=BigInt(2**t-1),typeof n!="number"&&typeof n!="bigint")throw new Error("Value must be a number or a bigint.");if(n>e)throw new Error(`The value exceeds the limit for ${t}bits integer (${e.toString()}).`)},kb=({aclContractAddress:n,chainId:t,tfheCompactPublicKey:e,publicParams:r,contractAddress:i,userAddress:o})=>{if(!tn(i))throw new Error("Contract address is not a valid address.");if(!tn(o))throw new Error("User address is not a valid address.");const c=e,_=[],l=TFHE.CompactCiphertextList.builder(c);let u=new Uint8Array;const p=f=>{if(_.reduce((d,b)=>d+Math.max(2,b),0)+f>2048)throw Error("Packing more than 2048 bits in a single input ciphertext is unsupported");if(_.length+1>256)throw Error("Packing more than 256 variables in a single input ciphertext is unsupported")};return{addBool(f){if(f==null)throw new Error("Missing value");if(typeof f!="boolean"&&typeof f!="number"&&typeof f!="bigint")throw new Error("The value must be a boolean, a number or a bigint.");if(Number(f)>1)throw new Error("The value must be 1 or 0.");return ti(Number(f),1),p(2),l.push_boolean(!!f),_.push(2),this},add8(f){return ti(f,8),p(8),l.push_u8(Number(f)),_.push(8),this},add16(f){return ti(f,16),p(16),l.push_u16(Number(f)),_.push(16),this},add32(f){return ti(f,32),p(32),l.push_u32(Number(f)),_.push(32),this},add64(f){return ti(f,64),p(64),l.push_u64(BigInt(f)),_.push(64),this},add128(f){return ti(f,128),p(128),l.push_u128(BigInt(f)),_.push(128),this},addAddress(f){if(!tn(f))throw new Error("The value must be a valid address.");return p(160),l.push_u160(BigInt(f)),_.push(160),this},add256(f){return ti(f,256),p(256),l.push_u256(BigInt(f)),_.push(256),this},getBits(){return _},encrypt(){const d=(()=>{const M=N=>Object.keys(N),D=_.reduce((N,q)=>N+q,0),C=M(r),j=C.find(N=>Number(N)>=D);if(!j)throw new Error(`Too many bits in provided values. Maximum is ${C[C.length-1]}.`);return j})(),b=r[d].publicParams,x=$t(i),E=$t(o),z=$t(n),P=$t(t.toString(16).padStart(64,"0")),T=new Uint8Array(x.length+E.length+z.length+32);return T.set(x,0),T.set(E,20),T.set(z,40),T.set(P,T.length-P.length),u=l.build_with_proof_packed(b,T,TFHE.ZkComputeLoad.Verify).safe_serialize(Qy),u}}},yh=BigInt("18446744073709551615");BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ib=4294967295,Sb=255;function bh(n){let t=n.toString(16);return t.length%2?"0"+t:t}function Tb(n){return typeof n=="number"?n<0?!1:Number.isInteger(n):!1}function Bb(n){return typeof n=="bigint"?n>=0:!1}function gs(n){return Tb(n)?!0:!!Bb(n)}function Cb(n){return gs(n)?n<=Sb:!1}function Ob(n){return gs(n)?n<=Ib:!1}function Nb(n){return gs(n)?n<=yh:!1}function mh(n){if(!Ob(n))throw new ds({expectedType:"Uint32"});const t=new ArrayBuffer(32);return new DataView(t).setUint32(28,Number(n),!1),new Uint8Array(t)}function Da(n){if(!Cb(n))throw new ds({type:typeof n,expectedType:"Uint8"})}function Ah(n){if(!Nb(n))throw new ds({type:typeof n,expectedType:"Uint64"})}function Fb(n,t){return Jt(n,t)?gs(n[t]):!1}function Eh(n,t,e){if(!Fb(n,t))throw new at({objName:e,property:t,type:xn(n,t),expectedType:"Uint"})}class Db extends Ft{constructor({address:t}){super({message:`Checksummed address "${t}" is invalid.`,name:"ChecksummedAddressError"})}}function ki(n){if(typeof n!="string"||!n.startsWith("0x")||n.length!==42)return!1;try{return Y(n)===n}catch{return!1}}function xh(n){if(!ki(n))throw new Db({address:String(n)})}function Ub(n){return!(typeof n!="string"||!n.startsWith("0x")||n.length!==42||!tn(n))}function Lb(n){if(!Ub(n))throw new ds({expectedType:"ChecksummedAddress"});const t=tb(n),e=new Uint8Array(20);for(let r=0;r<20;r++)e[r]=parseInt(t.slice(r*2,r*2+2),16);return e}class Ua extends Ft{constructor({handle:t,message:e}){super({message:e??`FHEVM Handle "${t}" is invalid.`,name:"FhevmHandleError"})}}const Dt=class Dt{_hash21;_chainId;_fheTypeId;_version;_computed;_index;constructor(t,e,r,i,o,c){if(BigInt(e)>yh)throw new Error("ChainId exceeds maximum allowed value (8 bytes)");this._hash21=t,this._chainId=e,this._fheTypeId=r,this._version=i,this._computed=o,c!==void 0&&(this._index=c)}get hash21(){return this._hash21}get chainId(){return this._chainId}get fheTypeId(){return this._fheTypeId}get version(){return this._version}get computed(){return this._computed}get index(){return this._index}static fromZKProof(t){xh(t.aclAddress),Ah(t.chainId),Da(t.ciphertextVersion);let e;if(t.fheTypeIds!==void 0)e=t.fheTypeIds;else if(t.fheTypeEncryptionBitwidths!==void 0)e=t.fheTypeEncryptionBitwidths.map(l=>Dt.FheTypeEncryptionBitwidthsToId[l]);else throw new ps({message:"createInputHandles requires either fheTypeIds or fheTypeEncryptionBitwidths"});Da(e.length);let r;if(typeof t.ciphertextWithZKProof=="string")r=$t(t.ciphertextWithZKProof);else if(t.ciphertextWithZKProof instanceof Uint8Array)r=t.ciphertextWithZKProof;else throw new ps({message:"Invalid ciphertextWithZKProof argument"});if(r.length===0)throw new ps({message:"Invalid ciphertextWithZKProof argument"});const o=new TextEncoder().encode(Dt.RAW_CT_HASH_DOMAIN_SEPARATOR),c=dt(dh(o,r)),_=[];for(let l=0;l<e.length;++l){const u=Dt._computeInputHash21($t(c),t.aclAddress,t.chainId,l);_.push(new Dt(u,t.chainId,e[l],t.ciphertextVersion,!1,l))}return _}static _computeInputHash21(t,e,r,i){pb(t),xh(e),Da(i),Ah(r);const o=new Uint8Array([i]),c=Lb(e),_=mh(r),u=new TextEncoder().encode(Dt.HANDLE_HASH_DOMAIN_SEPARATOR);return dt(dh(u,t,o,c,_))}toBytes32(){sh(this._index===void 0&&this._computed||this._index!==void 0&&this._index<255&&!this._computed);const e=mh(this._chainId).subarray(24,32),r=$t(this._hash21),i=new Uint8Array(32);return i.set(r,0),i[21]=this._index===void 0?255:this._index,i.set(e,22),i[30]=this._fheTypeId,i[31]=this._version,i}toBytes32Hex(){return Ab(this.toBytes32())}static checkHandleHex(t){if(!Na(t))throw new Ua({handle:t})}static isFheTypeId(t){switch(t){case 0:case 2:case 3:case 4:case 5:case 6:case 7:case 8:return!0;default:return!1}}static getFheTypeId(t){if(!Na(t))throw new Ua({handle:t});const e=t.slice(-4,-2).toLowerCase(),r=parseInt(e,16);if(!Dt.isFheTypeId(r))throw new Ua({handle:t,message:`FHEVM Handle "${t}" is invalid. Unknown FheType: ${r}`});return r}};Oi(Dt,"RAW_CT_HASH_DOMAIN_SEPARATOR","ZK-w_rct"),Oi(Dt,"HANDLE_HASH_DOMAIN_SEPARATOR","ZK-w_hdl"),Oi(Dt,"FheTypeIdToEncryptionBitwidths",{0:2,2:8,3:16,4:32,5:64,6:128,7:160,8:256}),Oi(Dt,"FheTypeEncryptionBitwidthsToId",{2:0,8:2,16:3,32:4,64:5,128:6,160:7,256:8}),Oi(Dt,"FheTypeIdToSolidityPrimitiveType",{0:"bool",2:"uint256",3:"uint256",4:"uint256",5:"uint256",6:"uint256",7:"address",8:"uint256"}),Object.freeze(Dt.FheTypeIdToEncryptionBitwidths),Object.freeze(Dt.FheTypeEncryptionBitwidthsToId);let ei=Dt;const Rh=n=>Y(n),Mb=()=>0;function jb(n,t,e){const r=new Map;t.forEach((i,o)=>{if(r.has(i)){const c=i;throw new Error(`Duplicate coprocessor signer address found: ${c} appears multiple times in recovered addresses`)}r.set(i,o)});for(const i of t)if(!n.includes(i))throw new Error(`Invalid address found: ${i} is not in the list of coprocessor signers`);return t.length>=e}function Gb(n){const t=n;return typeof t!="object"||t===null||!("handles"in t&&Array.isArray(t.handles))||!("signatures"in t&&Array.isArray(t.signatures))?!1:t.signatures.every(e=>typeof e=="string")&&t.handles.every(e=>typeof e=="string")}const Hb=(n,t,e,r,i,o,c,_,l,u)=>(p,f)=>{if(!tn(p))throw new Error("Contract address is not a valid address.");if(!tn(f))throw new Error("User address is not a valid address.");const d=kb({aclContractAddress:n,chainId:e,tfheCompactPublicKey:o,publicParams:c,contractAddress:p,userAddress:f});return{_input:d,addBool(b){return d.addBool(b),this},add8(b){return d.add8(b),this},add16(b){return d.add16(b),this},add32(b){return d.add32(b),this},add64(b){return d.add64(b),this},add128(b){return d.add128(b),this},add256(b){return d.add256(b),this},addAddress(b){return d.addAddress(b),this},getBits(){return d.getBits()},getCiphertextWithInputVerification(){return d.encrypt()},encrypt:async b=>{const x="0x00",E=d.getBits(),z=d.encrypt(),P={contractAddress:Rh(p),userAddress:Rh(f),ciphertextWithInputVerification:Qr(z),contractChainId:"0x"+e.toString(16),extraData:x},T=await i.fetchPostInputProof(P,{...u,...b});Gb(T)||Wy("INPUT_PROOF",T);const M=ei.fromZKProof({ciphertextWithZKProof:z,chainId:e,aclAddress:n,ciphertextVersion:Mb(),fheTypeEncryptionBitwidths:E}).map(G=>G.toBytes32()),D=T;if(D.handles&&D.handles.length>0){const G=D.handles.map($t);if(M.length!=G.length)throw new Error(`Incorrect Handles list sizes: (expected) ${M.length} != ${G.length} (received)`);for(let S=0;S<M.length;S+=1){let U=M[S],J=G[S],nt=Qr(U),rt=Qr(J);if(nt!==rt)throw new Error(`Incorrect Handle ${S}: (expected) ${nt} != ${rt} (received)`)}}const C=D.signatures,j={name:"InputVerification",version:"1",chainId:r,verifyingContract:t},N={CiphertextVerification:[{name:"ctHandles",type:"bytes32[]"},{name:"userAddress",type:"address"},{name:"contractAddress",type:"address"},{name:"contractChainId",type:"uint256"},{name:"extraData",type:"bytes"}]},q=C.map(G=>{const S=G.startsWith("0x")?G:`0x${G}`;return Y_(j,N,{ctHandles:M,userAddress:f,contractAddress:p,contractChainId:e,extraData:x},S)});if(!jb(_,q,l))throw Error("Coprocessor signers threshold is not reached");let K=bh(M.length);const ht=C.length;return K+=bh(ht),M.map(G=>Qr(G)).map(G=>K+=G),C.map(G=>K+=G.slice(2)),K+=x.slice(2),{handles:M,inputProof:$t(K)}}}};function La(n){if(n instanceof Error)return n;const t=n.message??"Non-Error value caught in exception handler",e=n.name??"ErrorWrapper",r=n.cause??n,i=new Error(t,{cause:r});return i.name=e,i}function Vb(n,t){throw new ps({message:t})}const Kb=["function isAllowedForDecryption(bytes32 handle) view returns (bool)"];function Qb(n,t,e){const r=new Map;t.forEach((i,o)=>{if(r.has(i)){const c=i;throw new Error(`Duplicate KMS signer address found: ${c} appears multiple times in recovered addresses`)}r.set(i,o)});for(const i of t)if(!n.includes(i))throw new Error(`Invalid address found: ${i} is not in the list of KMS signers`);return t.length>=e}function Jb(n){const t=Object.keys(n),e=[],r=[];for(let c=0;c<t.length;++c){const _=t[c],l=ei.getFheTypeId(_);let u=n[_];typeof u=="boolean"&&(u=u?"0x01":"0x00");const p=BigInt(u);switch(e.push("uint256"),l){case 7:{r.push(`0x${p.toString(16).padStart(40,"0")}`);break}case 0:{if(p!==BigInt(0)&&p!==BigInt(1))throw new Error(`Invalid ebool clear text value ${p}. Expecting 0 or 1.`);r.push(p);break}case 2:case 3:case 4:case 5:case 6:case 8:{r.push(p);break}default:Vb(l,`Unsupported Fhevm primitive type id: ${l}`)}}const o=gn.defaultAbiCoder().encode(e,r);return{abiTypes:e,abiValues:r,abiEncodedClearValues:o}}function $b(n,t){const e=K_(["uint8"],[n.length]),r=K_(Array(n.length).fill("bytes"),n);return ct([e,r,t])}function Wb(n,t){let e=[];for(const u of n){const p=ei.getFheTypeId(u);sh(ei.isFheTypeId(p)),e.push(p)}const r="0x"+"00".repeat(32)+t.slice(2)+"00".repeat(32),i=e.map(u=>ei.FheTypeIdToSolidityPrimitiveType[u]),_=new gn().decode(["uint256",...i,"bytes[]"],r).slice(1,1+e.length),l={};return n.forEach((u,p)=>l[u]=_[p]),l}const qb=(n,t,e,r,i,o,c,_)=>async(l,u)=>{const p="0x00",f=new ce(i,Kb,c);let d;try{d=await Promise.all(l.map(async Q=>{const K=Qr(typeof Q=="string"?$t(Q):Q,!0);if(!await f.isAllowedForDecryption(K))throw new Error(`Handle ${K} is not allowed for public decryption!`);return K}))}catch(Q){throw Q}lh(d);const b={ciphertextHandles:d,extraData:p},x=await o.fetchPostPublicDecrypt(b,{..._,...u}),E={name:"Decryption",version:"1",chainId:e,verifyingContract:r},z={PublicDecryptVerification:[{name:"ctHandles",type:"bytes32[]"},{name:"decryptedResult",type:"bytes"},{name:"extraData",type:"bytes"}]},P=x,T=oh(P.decryptedValue),B=P.signatures.map(oh),M="0x",D=B.map(Q=>Y_(E,z,{ctHandles:d,decryptedResult:T,extraData:M},Q));if(!Qb(n,D,t))throw Error("KMS signers threshold is not reached");const j=Wb(d,T),N=Jb(j),q=$b(B,M);return{clearValues:j,abiEncodedClearValues:N.abiEncodedClearValues,decryptionProof:q}},zh=(n,t)=>(e,r,i,o,c)=>{const _="0x00";if(c&&!tn(c))throw new Error("Invalid delegated account.");if(!tn(n))throw new Error("Invalid verifying contract address.");if(!r.every(b=>tn(b)))throw new Error("Invalid contract address.");const l=typeof e=="string"?e.startsWith("0x")?e:`0x${e}`:e,u=typeof i=="number"?i.toString():i,p=typeof o=="number"?o.toString():o,f=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],d={name:"Decryption",version:"1",chainId:t,verifyingContract:n};return c?{types:{EIP712Domain:f,DelegatedUserDecryptRequestVerification:[{name:"publicKey",type:"bytes"},{name:"contractAddresses",type:"address[]"},{name:"startTimestamp",type:"uint256"},{name:"durationDays",type:"uint256"},{name:"extraData",type:"bytes"},{name:"delegatedAccount",type:"address"}]},primaryType:"DelegatedUserDecryptRequestVerification",domain:d,message:{publicKey:l,contractAddresses:r,startTimestamp:u,durationDays:p,extraData:_,delegatedAccount:c}}:{types:{EIP712Domain:f,UserDecryptRequestVerification:[{name:"publicKey",type:"bytes"},{name:"contractAddresses",type:"address[]"},{name:"startTimestamp",type:"uint256"},{name:"durationDays",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"UserDecryptRequestVerification",domain:d,message:{publicKey:l,contractAddresses:r,startTimestamp:u,durationDays:p,extraData:_}}},Ph=()=>{const n=TKMS.ml_kem_pke_keygen();return{publicKey:Qr(TKMS.ml_kem_pke_pk_to_u8vec(TKMS.ml_kem_pke_get_pk(n))),privateKey:Qr(TKMS.ml_kem_pke_sk_to_u8vec(n))}};class vh{_relayerUrl;constructor(t){this._relayerUrl=t}get url(){return this._relayerUrl}get keyUrl(){return`${this.url}/keyurl`}get inputProof(){return`${this.url}/input-proof`}get publicDecrypt(){return`${this.url}/public-decrypt`}get userDecrypt(){return`${this.url}/user-decrypt`}}function kh(n,t){fh(n,"handles",t),gb(n,"signatures",t)}function Ih(n,t){hh(n,"signatures",t),W(n,"decryptedValue",t),lo(n,"extraData",t)}function Sh(n,t){if(!Array.isArray(n))throw at.invalidObject({objName:t,expectedType:"Array",type:typeof n});for(let e=0;e<n.length;++e)ws(n[e],"payload",`${t}[i]`),ws(n[e],"signature",`${t}[i]`)}class Zb extends vh{constructor(t){super(t)}get version(){return 1}async fetchGetKeyUrl(){return await Ta("KEY_URL",this.keyUrl)}async fetchPostInputProof(t,e){const r=await Sa("INPUT_PROOF",this.inputProof,t,e);return kh(r.response,"fetchPostInputProof()"),r.response}async fetchPostPublicDecrypt(t,e){const i=(await Sa("PUBLIC_DECRYPT",this.publicDecrypt,t,e)).response[0],o={signatures:i.signatures,decryptedValue:i.decrypted_value,extraData:"0x"};return Ih(o,"fetchPostPublicDecrypt()"),o}async fetchPostUserDecrypt(t,e){const r=await Sa("USER_DECRYPT",this.userDecrypt,t,e);return Sh(r.response,"RelayerUserDecryptResult()"),r.response}}class Yb extends Ft{_operation;constructor(t){super(t),this._operation=t.operation}get operation(){return this._operation}}class Xb extends Yb{constructor({cause:t}){super({message:"Invalid relayer response.",name:"RelayerV2GetKeyUrlError",operation:"KEY_URL",cause:t})}}class t0 extends Xb{constructor({cause:t}){super({cause:t})}}function Th(n,t){if(W(n,"label",t),!(n.label==="malformed_json"||n.label==="request_error"||n.label==="not_ready_for_decryption"))throw new at({objName:t,property:"label",expectedType:"string",expectedValue:["malformed_json","request_error","not_ready_for_decryption"],type:typeof n.label,value:n.label});W(n,"message",t)}function Bh(n,t){if(W(n,"label",t),!(n.label==="missing_fields"||n.label==="validation_failed"))throw new at({objName:t,property:"label",expectedType:"string",expectedValue:["missing_fields","validation_failed"],type:typeof n.label,value:n.label});W(n,"message",t),En(n,"details",t);const e=n.details;for(let r=0;r<e.length;++r){const i=e[r];W(i,"field",`${t}.details[${r}]`),W(i,"issue",`${t}.details[${r}]`)}}function Ch(n,t){W(n,"label",t,"rate_limited"),W(n,"message",t)}function Oh(n,t){W(n,"label",t,"internal_server_error"),W(n,"message",t)}function Nh(n,t){W(n,"label",t,"not_found"),W(n,"message",t)}function Fh(n,t){W(n,"label",t,["protocol_paused","gateway_not_reachable"]),W(n,"message",t)}function Dh(n,t){W(n,"label",t,["readiness_check_timedout","response_timedout"]),W(n,"message",t)}function Ii(n,t){W(n,"status",t,"failed"),an(n,"error",t),e0(n.error,`${t}.error`)}function e0(n,t){if(W(n,"label",t),n.label==="malformed_json"||n.label==="request_error"||n.label==="not_ready_for_decryption")Th(n,t);else if(n.label==="missing_fields"||n.label==="validation_failed")Bh(n,t);else if(n.label==="not_found")Nh(n,t);else if(n.label==="rate_limited")Ch(n,t);else if(n.label==="internal_server_error")Oh(n,t);else if(n.label==="protocol_paused"||n.label==="gateway_not_reachable")Fh(n,t);else if(n.label==="readiness_check_timedout"||n.label==="response_timedout")Dh(n,t);else throw new at({objName:t,property:"label",expectedType:"string",expectedValue:["malformed_json","request_error","not_ready_for_decryption","missing_fields","validation_failed","rate_limited","internal_server_error","protocol_paused","gateway_not_reachable","readiness_check_timedout","response_timedout"],type:typeof n.label,value:n.label})}function Uh(n,t){if(Ii(n,t),n.error.label==="malformed_json"||n.error.label==="request_error"||n.error.label==="not_ready_for_decryption")Th(n.error,`${t}.error`);else if(n.error.label==="missing_fields"||n.error.label==="validation_failed")Bh(n.error,`${t}.error`);else throw new at({objName:`${t}.error`,property:"label",expectedType:"string",expectedValue:["malformed_json","request_error","not_ready_for_decryption","missing_fields","validation_failed"],type:typeof n.error.label,value:n.error.label})}function r0(n,t){Ii(n,t),Nh(n.error,`${t}.error`)}function n0(n,t){Ii(n,t),Ch(n.error,`${t}.error`)}function Lh(n,t){Ii(n,t),Oh(n.error,`${t}.error`)}function Mh(n,t){Ii(n,t),Fh(n.error,`${t}.error`)}function i0(n,t){Ii(n,t),Dh(n.error,`${t}.error`)}class Ma extends Ft{_fetchMethod;_url;_jobId;_operation;_retryCount;_elapsed;_state;constructor(t){super({...t,name:t.name??"RelayerV2FetchErrorBase"}),this._fetchMethod=t.fetchMethod,this._url=t.url,this._operation=t.operation,this._elapsed=t.elapsed,this._retryCount=t.retryCount,this._state=t.state,this._jobId=t.jobId}get url(){return this._url}get operation(){return this._operation}get fetchMethod(){return this._fetchMethod}get jobId(){return this._jobId}get retryCount(){return this._retryCount}get elapsed(){return this._elapsed}get state(){return this._state}get isAbort(){return this.cause?this.cause.name==="AbortError":!1}}class fo extends Ma{_status;constructor(t){super({...t,name:t.name??"RelayerV2ResponseErrorBase"}),this._status=t.status}get status(){return this._status}}class s0 extends fo{constructor(t){super({...t,cause:La(t.cause),name:"RelayerV2ResponseInvalidBodyError",message:`fetchMethod: ${t.fetchMethod} status:${t.status} url:${t.url} operation:${t.operation}`})}}class jh extends fo{constructor(t){super({...t,name:"RelayerV2ResponseStatusError",message:`fetchMethod: ${t.fetchMethod} status:${t.status} url:${t.url} operation:${t.operation}`})}}function o0(n,t){Ca(n,"accepted",t),n.accepted?a0(n,t):c0(n,t)}function a0(n,t){Ca(n,"accepted",t,!0),fh(n,"handles",t),yb(n,"signatures",t),lo(n,"extraData",t)}function c0(n,t){Ca(n,"accepted",t,!1),lo(n,"extraData",t)}function _0(n,t){an(n,"result",t),W(n,"status",t,"succeeded"),W(n,"requestId",t),o0(n.result,`${t}.result`)}function l0(n,t){hh(n,"signatures",t),ws(n,"decryptedValue",t),lo(n,"extraData",t)}function u0(n,t){an(n,"result",t),W(n,"status",t,"succeeded"),W(n,"requestId",t),l0(n.result,`${t}.result`)}function f0(n,t){En(n,"result",t);for(let e=0;e<n.result.length;++e)ws(n.result[e],"payload",`${t}.result[${e}]`),ws(n.result[e],"signature",`${t}.result[${e}]`)}function h0(n,t){an(n,"result",t),W(n,"status",t,"succeeded"),W(n,"requestId",t),f0(n.result,`${t}.result`)}class p0 extends Ft{_url;_operation;_jobId;constructor(t){super({...t,name:t.name??"RelayerV2RequestErrorBase"}),this._url=t.url,this._operation=t.operation,this._jobId=t.jobId}get url(){return this._url}get jobId(){return this._jobId}get operation(){return this._operation}}class d0 extends p0{_status;_state;constructor(t){super({...t,name:"RelayerV2RequestInternalError",message:t.message??"internal error"}),this._status=t.status,this._state=t.state}get status(){return this._status}get state(){return this._state}}class w0 extends fo{constructor(t){super({...t,name:"RelayerV2ResponseApiError",message:t.relayerApiError.message})}}class g0 extends Ma{constructor(t){super({...t,name:"RelayerV2FetchError",message:`Fetch ${t.fetchMethod} error`,cause:La(t.cause)})}}class Gh extends fo{_result;constructor(t){super({...t,name:"RelayerV2ResponseInputProofRejectedError",message:"InputProof rejected"}),this._result=t.result}get result(){return this._result}}class Jr extends Ft{_state;constructor(t){super({...t,name:"RelayerV2StateError"}),this._state={...t.state},Object.freeze(this._state)}get state(){return this._state}}class y0 extends Ma{constructor(t){super({...t,name:"RelayerV2MaxRetryError",message:"max retry error"})}}function b0(n,t){W(n,"jobId",t)}function m0(n,t){W(n,"status",t,"queued"),W(n,"requestId",t),an(n,"result",t),b0(n.result,`${t}.result`)}function A0(n,t){W(n,"status",t,"queued"),W(n,"requestId",t)}class Ur{_jobId;_jobIdTimestamp;_state;_relayerOperation;_publicAPINoReentrancy;_internalAbortController;_internalAbortSignal;_externalAbortSignal;_terminateReason;_terminateError;_retryCount;_retryAfterTimeoutID;_url;_payload;_fhevmInstanceOptions;_retryAfterTimeoutPromiseFuncReject;_onProgress;_requestMaxDurationInSecs;_requestStartTimestamp;_requestGlobalTimeoutID;_throwErrorIfNoRetryAfter;static DEFAULT_RETRY_AFTER_SECS=2;static DEFAULT_GLOBAL_REQUEST_TIMEOUT_SECS=60*60;static MAX_GET_RETRY=100;static MAX_POST_RETRY=100;constructor(t){if(t.relayerOperation!=="INPUT_PROOF"&&t.relayerOperation!=="PUBLIC_DECRYPT"&&t.relayerOperation!=="USER_DECRYPT")throw new at({objName:"RelayerV2AsyncRequestParams",property:"relayerOperation",expectedType:"string",value:t.relayerOperation,expectedValue:"INPUT_PROOF | PUBLIC_DECRYPT | USER_DECRYPT"});this._relayerOperation=t.relayerOperation,this._internalAbortController=new AbortController,this._internalAbortSignal=this._internalAbortController.signal,this._internalAbortSignal.addEventListener("abort",this._handleInternalSignalAbort),this._externalAbortSignal=t.signal,this._externalAbortSignal&&this._externalAbortSignal.addEventListener("abort",this._handleExternalSignalAbort),this._url=t.url,this._payload=t.payload,this._fhevmInstanceOptions=t.instanceOptions,this._onProgress=t.onProgress,this._state={aborted:!1,canceled:!1,failed:!1,fetching:!1,running:!1,succeeded:!1,terminated:!1},this._retryCount=0,this._retryAfterTimeoutID=void 0,this._requestGlobalTimeoutID=void 0,this._terminateReason=void 0,this._publicAPINoReentrancy=!1,this._throwErrorIfNoRetryAfter=t.throwErrorIfNoRetryAfter??!1,this._requestMaxDurationInSecs=t.timeoutInSeconds??Ur.DEFAULT_GLOBAL_REQUEST_TIMEOUT_SECS}async run(){if(this._publicAPINoReentrancy)throw new Jr({message:"Relayer.run() failed. Call not permitted.",state:{...this._state}});if(this._state.terminated)throw new Jr({message:"Relayer.run() failed. Request already terminated.",state:{...this._state}});if(this._state.canceled)throw new Jr({message:"Relayer.run() failed. Request already canceled.",state:{...this._state}});if(this._state.succeeded)throw new Jr({message:"Relayer.run() failed. Request already succeeded.",state:{...this._state}});if(this._state.failed)throw new Jr({message:"Relayer.run() failed. Request already failed.",state:{...this._state}});if(this._state.aborted)throw new Jr({message:"Relayer.run() failed. Request already aborted.",state:{...this._state}});if(this._externalAbortSignal?.aborted===!0)throw new Jr({message:`Relayer.run() failed. External AbortSignal already aborted (reason:${this._externalAbortSignal?.reason}).`,state:{...this._state}});if(this._internalAbortSignal?.aborted===!0)throw new Jr({message:`Relayer.run() failed. Internal AbortSignal already aborted (reason:${this._internalAbortSignal?.reason}).`,state:{...this._state}});if(this._state.running)throw new Jr({message:"Relayer.run() failed. Request already running.",state:{...this._state}});this._state.running=!0,this._requestStartTimestamp=Date.now(),this._setGlobalRequestTimeout(this._requestMaxDurationInSecs*1e3);try{const t=await this._runPostLoop();return this._state.succeeded=!0,this._terminate("succeeded"),t}catch(t){throw this._state.failed=!0,t.name==="AbortError"&&(this._assert(this._state.aborted,"this._state.aborted"),this._assert(this._state.terminated,"this._state.terminated")),this._terminate("failed",t),t}}_canContinue(){return!(this._state.canceled||this._state.terminated||this._state.succeeded||this._state.aborted)}cancel(){if(this._publicAPINoReentrancy)throw new Jr({message:"Relayer.cancel() failed. Call not permitted.",state:{...this._state}});if(!this._canContinue()){this._trace("cancel","!this._canContinue()");return}this._state.canceled=!0,this._internalAbortController?.abort("cancel"),this._assert(this._state.aborted,"this._state.aborted"),this._assert(this._state.terminated,"this._state.terminated")}get state(){return{...this._state}}get canceled(){return this._state.canceled}get terminated(){return this._state.terminated}get terminateReason(){return this._terminateReason}get terminateError(){return this._terminateError}get running(){return this._state.running}get fetching(){return this._state.fetching}get failed(){return this._state.failed}get succeeded(){return this._state.succeeded}get startTimeMs(){return this._requestStartTimestamp}get elapsedTimeMs(){if(this._requestStartTimestamp!==void 0)return Date.now()-this._requestStartTimestamp}get retryCount(){return this._retryCount}async _runPostLoop(){let t=0;for(;t<Ur.MAX_POST_RETRY;){++t,this._assertCanContinueAfterAwait();const e=this._jobId?Date.now()-this._jobIdTimestamp:0,r=await this._fetchPost(e),i=r.status;switch(i){case 202:{const o=await this._getResponseJson(r);try{m0(o,"body")}catch(l){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:l,elapsed:e,bodyJson:re(o)})}let c=this._getRetryAfterHeaderValueInSecs(r);return c<1&&(c=1),this._setJobIdOnce(o.result.jobId),this._postAsyncOnProgressCallback({type:"queued",url:this._url,method:"POST",status:i,requestId:o.requestId,jobId:this.jobId,operation:this._relayerOperation,retryCount:this._retryCount,retryAfter:c,elapsed:e}),await this._setRetryAfterTimeout(c*1e3),await this._runGetLoop()}case 400:{const o=await this._getResponseJson(r);try{Uh(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:c,elapsed:e,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"POST",status:i,relayerApiError:o.error,elapsed:e})}case 429:{const o=await this._getResponseJson(r);try{n0(o,"body")}catch(_){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:_,elapsed:e,bodyJson:re(o)})}let c=this._getRetryAfterHeaderValueInSecs(r);c<1&&(c=1),this._postAsyncOnProgressCallback({type:"ratelimited",url:this._url,method:"POST",status:i,retryAfter:c,retryCount:this._retryCount,elapsed:e,message:o.error.message}),await this._setRetryAfterTimeout(c*1e3);continue}case 500:{const o=await this._getResponseJson(r);try{Lh(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:c,elapsed:e,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"POST",status:i,relayerApiError:o.error,elapsed:e})}case 503:{const o=await this._getResponseJson(r);try{Mh(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:c,elapsed:e,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"POST",status:i,relayerApiError:o.error,elapsed:e})}default:(c=>{throw new jh({fetchMethod:"POST",status:c,url:this._url,operation:this._relayerOperation,elapsed:e,retryCount:this._retryCount,state:{...this._state}})})(i)}}this._throwMaxRetryError({fetchMethod:"POST"})}async _runGetLoop(){this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._assert(this._jobIdTimestamp!==void 0,"this._jobIdTimestamp !== undefined");let t=0;for(;t<Ur.MAX_GET_RETRY;){++t,this._assertCanContinueAfterAwait();const e=Date.now()-this._jobIdTimestamp,r=await this._fetchGet(e),i=r.status;switch(i){case 200:{const o=await this._getResponseJson(r);try{if(this._relayerOperation==="INPUT_PROOF"){if(_0(o,"body"),this._postAsyncOnProgressCallback({type:"succeeded",url:this._url,method:"GET",status:i,jobId:this.jobId,requestId:o.requestId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:e,result:o.result}),!o.result.accepted)throw new Gh({url:this._url,fetchMethod:"GET",jobId:this.jobId,operation:this._relayerOperation,retryCount:this._retryCount,status:i,state:{...this._state},elapsed:e,result:o.result})}else this._relayerOperation==="PUBLIC_DECRYPT"?(u0(o,"body"),this._postAsyncOnProgressCallback({type:"succeeded",url:this._url,method:"GET",status:i,jobId:this.jobId,requestId:o.requestId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:e,result:o.result})):this._relayerOperation==="USER_DECRYPT"&&(h0(o,"body"),this._postAsyncOnProgressCallback({type:"succeeded",url:this._url,method:"GET",status:i,jobId:this.jobId,requestId:o.requestId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:e,result:o.result}))}catch(c){if(c instanceof Gh)throw c;this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:re(o)})}return o.result}case 202:{const o=await this._getResponseJson(r);try{A0(o,"body")}catch(_){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:_,bodyJson:re(o)})}let c=this._getRetryAfterHeaderValueInSecs(r);c<1&&(c=1),this._postAsyncOnProgressCallback({type:"queued",url:this._url,method:"GET",status:i,requestId:o.requestId,operation:this._relayerOperation,jobId:this.jobId,retryAfter:c,retryCount:this._retryCount,elapsed:e}),await this._setRetryAfterTimeout(c*1e3);continue}case 400:{const o=await this._getResponseJson(r);try{Uh(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 404:{const o=await this._getResponseJson(r);try{r0(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 500:{const o=await this._getResponseJson(r);try{Lh(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 503:{const o=await this._getResponseJson(r);try{Mh(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 504:{const o=await this._getResponseJson(r);try{i0(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:re(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}default:(c=>{throw new jh({fetchMethod:"GET",status:c,url:this._url,jobId:this.jobId,operation:this._relayerOperation,elapsed:e,retryCount:this._retryCount,state:{...this._state}})})(i)}}this._throwMaxRetryError({fetchMethod:"GET"})}async _getResponseJson(t){const e=await t.json();return this._assertCanContinueAfterAwait(),e}_getRetryAfterHeaderValueInSecs(t){if(!t.headers.has("Retry-After")){if(this._throwErrorIfNoRetryAfter)throw new Error("Missing 'Retry-After' header key");return Ur.DEFAULT_RETRY_AFTER_SECS}try{const e=Number.parseInt(t.headers.get("Retry-After"));if(gs(e))return e}catch{}if(this._throwErrorIfNoRetryAfter)throw new Error("Invalid 'Retry-After' header key");return Ur.DEFAULT_RETRY_AFTER_SECS}_setJobIdOnce(t){this._assert(t!==void 0,"jobId !== undefined"),this._assert(this._jobId===void 0,"this._jobId === undefined"),this._jobId=t,this._jobIdTimestamp=Date.now()}get jobId(){return this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._jobId}async _fetchPost(t){this._assert(this._jobId===void 0,"this._jobId === undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.fetching,"!this._state.fetching"),this._trace("_fetchPost","enter");const e=rh({method:"POST",headers:{"Content-Type":"application/json","ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${co}`},body:JSON.stringify(this._payload),...this._internalAbortSignal?{signal:this._internalAbortSignal}:{}},this._fhevmInstanceOptions?.auth);this._state.fetching=!0;let r;try{r=await fetch(this._url,e)}catch(i){if(this._state.fetching=!1,this._trace("_fetchPost","catch(e) + throw e: "+i),i.name==="AbortError")throw i;this._throwFetchError({fetchMethod:"POST",cause:i,elapsed:t})}return this._state.fetching=!1,this._assert(this._jobId===void 0,"this._jobId === undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assertCanContinueAfterAwait(),this._trace("_fetchPost","return response Ok"),r}async _fetchGet(t){this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.fetching,"!this._state.fetching"),this._trace("_fetchGet",`jobId=${this.jobId}`);const e={method:"GET",headers:{"ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${co}`},...this._internalAbortSignal?{signal:this._internalAbortSignal}:{}};this._state.fetching=!0;let r;try{r=await fetch(`${this._url}/${this.jobId}`,e)}catch(i){if(this._state.fetching=!1,this._trace("_fetchGet",`jobId=${this.jobId}, catch(e) + throw e: ${i}`),i.name==="AbortError")throw i;this._throwFetchError({fetchMethod:"GET",cause:i,elapsed:t})}return this._state.fetching=!1,this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assertCanContinueAfterAwait(),this._trace("_fetchGet",`jobId=${this.jobId}, return response Ok, status=${r.status}`),r}_handleExternalSignalAbort=t=>{const e=t.currentTarget;this._assert(this instanceof Ur,"this instanceof RelayerV2AsyncRequest"),this._assert(e===this._externalAbortSignal,"signal === this._externalAbortSignal"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.aborted,"!this._state.aborted"),this._assert(!this._state.canceled,"!this._state.canceled"),this.cancel()};_handleInternalSignalAbort=t=>{const e=t.currentTarget;this._assert(this instanceof Ur,"this instanceof RelayerV2AsyncRequest"),this._assert(e===this._internalAbortSignal,"signal === this._internalAbortSignal"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.aborted,"!this._state.aborted"),this._state.aborted=!0,e.reason!=="cancel"&&this._assert(!this._state.canceled,"!this._state.canceled"),this._terminate("abort")};_terminate(t,e){if(this._state.terminated){this._trace("_terminate",`reason=${t}. Already terminated with reason='${this._terminateReason}'. IGNORE`),this._assert(this._terminateReason!==void 0,"this._terminateReason !== undefined"),this._assert(this._internalAbortSignal===void 0,"this._signal === undefined"),this._assert(this._requestGlobalTimeoutID===void 0,"this._requestGlobalTimeoutID === undefined"),this._assert(this._retryAfterTimeoutID===void 0,"this._retryAfterTimeoutID === undefined"),this._assert(this._retryAfterTimeoutPromiseFuncReject===void 0,"this._retryAfterTimeoutPromiseFuncReject === undefined");return}this._trace("_terminate",`reason=${t}`),this._terminateReason=t,this._terminateError=e,this._state.terminated=!0,this._tryClearRetryAfterTimeout(),this._tryClearGlobalRequestTimeout();const r=this._internalAbortSignal,i=this._externalAbortSignal;this._externalAbortSignal=void 0,this._internalAbortSignal=void 0,this._internalAbortController=void 0,i&&i.removeEventListener("abort",this._handleExternalSignalAbort),r&&r.removeEventListener("abort",this._handleInternalSignalAbort),this._trace("_terminate",`reason=${t} completed.`)}async _setRetryAfterTimeout(t){if(this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(this._retryAfterTimeoutID===void 0,"this._retryAfterTimeoutID === undefined"),this._assert(t>=1e3,"delayMs >= 1000"),this._trace("_setRetryAfterTimeout",`delayMs=${t}`),this._retryAfterTimeoutID!==void 0)return Promise.reject(new Error("retry-after already running."));const e=new Promise((r,i)=>{this._retryAfterTimeoutPromiseFuncReject=i;const o=()=>{this._retryAfterTimeoutID=void 0,this._retryAfterTimeoutPromiseFuncReject=void 0,r()};this._retryCount++,this._retryAfterTimeoutID=setTimeout(o,t)});return this._assert(this._retryAfterTimeoutID!==void 0,"this._retryAfterTimeoutID !== undefined"),this._assert(this._retryAfterTimeoutPromiseFuncReject!==void 0,"this._retryAfterTimeoutPromiseFuncReject !== undefined"),e}_tryClearRetryAfterTimeout(){if(this._retryAfterTimeoutID===void 0){this._assert(this._retryAfterTimeoutPromiseFuncReject===void 0,"this._retryAfterTimeoutPromiseFuncReject === undefined");return}const t=this._retryAfterTimeoutPromiseFuncReject,e=this._retryAfterTimeoutID;this._retryAfterTimeoutID=void 0,this._retryAfterTimeoutPromiseFuncReject=void 0,clearTimeout(e),t(new Error("_tryClearRetryAfterTimeout"))}_setGlobalRequestTimeout(t){this._assert(this._requestGlobalTimeoutID===void 0,"this._requestGlobalTimeoutID === undefined");const e=()=>{this._requestGlobalTimeoutID=void 0,this._handleGlobalRequestTimeout()};this._requestGlobalTimeoutID=setTimeout(e,t)}_handleGlobalRequestTimeout(){this._terminate("timeout")}_tryClearGlobalRequestTimeout(){if(this._requestGlobalTimeoutID===void 0)return;const t=this._requestGlobalTimeoutID;this._requestGlobalTimeoutID=void 0,clearTimeout(t)}_postAsyncOnProgressCallback(t){const e=this._onProgress;e&&queueMicrotask(()=>{e(t)})}_throwRelayerV2ResponseApiError(t){const e=JSON.parse(JSON.stringify(t.relayerApiError));throw this._postAsyncOnProgressCallback({type:"failed",url:this._url,method:t.fetchMethod,status:t.status,...this._jobId?{jobId:this._jobId}:{},operation:this._relayerOperation,retryCount:this._retryCount,elapsed:t.elapsed,relayerApiError:e}),new w0({url:this._url,fetchMethod:t.fetchMethod,status:t.status,jobId:this._jobId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:t.elapsed,relayerApiError:t.relayerApiError,state:{...this._state}})}_assert(t,e){t||this._throwInternalError(`Assertion failed: ${e}`)}_throwInternalError(t){throw new d0({operation:this._relayerOperation,url:this._url,message:t,state:JSON.stringify(this._state),jobId:this._jobId})}_throwMaxRetryError(t){const e=this._jobIdTimestamp?Date.now()-this._jobIdTimestamp:0;throw new y0({operation:this._relayerOperation,url:this._url,state:{...this._state},retryCount:this._retryCount,jobId:this._jobId,fetchMethod:t.fetchMethod,elapsed:e})}_throwResponseInvalidBodyError(t){throw new s0({...t,url:this._url,jobId:this._jobId,operation:this._relayerOperation,state:{...this._state},retryCount:this._retryCount})}_throwFetchError(t){throw new g0({...t,url:this._url,jobId:this._jobId,operation:this._relayerOperation,state:{...this._state},retryCount:this._retryCount})}_assertCanContinueAfterAwait(){this._canContinue()||this._throwInternalError("cannot continue.")}_trace(t,e){console.log(`[RelayerV2AsyncRequest]:${t}: ${e}`)}}function Hh(n,t){an(n,"response",t),an(n.response,"crs",`${t}.response`);const e=n.response.crs,r=Object.keys(e);for(let o=0;o<r.length;++o)Vh(e[r[o]],`${t}.response.crs.${r[o]}`);En(n.response,"fheKeyInfo",`${t}.response`);const i=n.response.fheKeyInfo;for(let o=0;o<i.length;++o){const c=i[o],_=`${t}.response.fheKeyInfo[${o}]`;an(c,"fhePublicKey",_),Vh(c.fhePublicKey,`${_}.fhePublicKey`)}}function Vh(n,t){W(n,"dataId",t),rb(n,"urls",t)}function E0(n){const t=n.response.fheKeyInfo.map(r=>({fhe_public_key:{data_id:r.fhePublicKey.dataId,urls:r.fhePublicKey.urls}})),e={};for(const[r,i]of Object.entries(n.response.crs))e[r]={data_id:i.dataId,urls:i.urls};return{response:{fhe_key_info:t,crs:e}}}class x0 extends vh{constructor(t){super(t)}get version(){return 2}async fetchGetKeyUrlV2(){const t=await Ta("KEY_URL",this.keyUrl);try{Hh(t,"fetchGetKeyUrl()")}catch(e){throw new t0({cause:La(e)})}return t}async fetchGetKeyUrl(){const t=await this.fetchGetKeyUrlV2();return E0(t)}async fetchPostInputProof(t,e,r){const o=await new Ur({relayerOperation:"INPUT_PROOF",url:this.inputProof,payload:t,instanceOptions:e,...r}).run();return kh(o,"fetchPostInputProof()"),o}async fetchPostPublicDecrypt(t,e,r){const o=await new Ur({relayerOperation:"PUBLIC_DECRYPT",url:this.publicDecrypt,payload:t,instanceOptions:e,...r}).run();return Ih(o,"fetchPostPublicDecrypt()"),o}async fetchPostUserDecrypt(t,e,r){const o=await new Ur({relayerOperation:"USER_DECRYPT",url:this.userDecrypt,payload:t,instanceOptions:e,...r}).run();return Sh(o.result,"fetchPostUserDecrypt()"),o.result}}class Kh{}class ut{_id;_compactPkeCrs;_bits;_srcUrl;constructor(t){this._id=t.id,this._compactPkeCrs=t.compactPkeCrs,this._bits=t.bits,this._srcUrl=t.srcUrl}static isKeyBytesType(t){try{return ut.assertKeyBytesType(t,""),!0}catch{return!1}}static isKeyUrlType(t){try{return ut.assertKeyUrlType(t,""),!0}catch{return!1}}static assertKeyBytesType(t,e){W(t,"id",e),Fa(t,"data",e),Eh(t,"bits",e),Jt(t,"srcUrl")&&W(t,"srcUrl",e)}static assertKeyUrlType(t,e){W(t,"id",e),Eh(t,"bits",e),W(t,"srcUrl",e)}static assertIsPublicParams2048BytesType(t,e){an(t,"2048",e),W(t[2048],"publicParamsId",`${e}.2048`),Fa(t[2048],"publicParams",`${e}.2048`)}static isPublicParams2048BytesType(t){try{return ut.assertIsPublicParams2048BytesType(t,""),!0}catch{return!1}}static async fromBytesOrUrl(t){if(ut.isKeyBytesType(t))return ut._fromBytes(t);if(ut.isPublicParams2048BytesType(t))return ut._fromPublicParamsBytes(t);if(ut.isKeyUrlType(t))return ut._fromUrl(t);throw new Error("Invalid public key (deserialization failed)")}static fromBytes(t){try{return ut.assertKeyBytesType(t,"arg"),ut._fromBytes(t)}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}static _fromBytes(t){const e={compactPkeCrs:TFHE.CompactPkeCrs.safe_deserialize(t.data,fs),id:t.id,bits:t.bits,srcUrl:t.srcUrl};return new ut(e)}static fromPublicParamsBytes(t){try{return ut.assertIsPublicParams2048BytesType(t,"arg"),ut._fromPublicParamsBytes(t)}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}static _fromPublicParamsBytes(t){return ut._fromBytes({bits:2048,data:t[2048].publicParams,id:t[2048].publicParamsId})}static async fromUrl(t){try{return ut.assertKeyUrlType(t,"arg"),ut._fromUrl(t)}catch(e){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:e})}}static async _fromUrl(t){ut.assertKeyUrlType(t,"arg");const e=await ph(t.srcUrl);return ut.fromBytes({data:e,id:t.id,bits:t.bits,srcUrl:t.srcUrl})}toBytes(){return{data:this._compactPkeCrs.safe_serialize(fs),id:this._id,bits:this._bits,...this._srcUrl?{srcUrl:this._srcUrl}:{}}}toPublicParamsWasm(){if(this._bits!==2048)throw new Error(`Unsupported PublicParams bits format ${this._bits}`);return{2048:{publicParams:this._compactPkeCrs,publicParamsId:this._id}}}toPublicParamsBytes(){if(this._bits!==2048)throw new Error(`Unsupported PublicParams bits format ${this._bits}`);return{2048:{publicParams:this.toBytes().data,publicParamsId:this._id}}}}class St{_id;_tfheCompactPublicKey;_srcUrl;constructor(t){this._id=t.id,this._tfheCompactPublicKey=t.tfheCompactPublicKey,this._srcUrl=t.srcUrl}static isKeyBytesType(t){try{return St.assertKeyBytesType(t,""),!0}catch{return!1}}static isKeyUrlType(t){try{return St.assertKeyUrlType(t,""),!0}catch{return!1}}static assertKeyBytesType(t,e){W(t,"id",e),Fa(t,"data",e),Jt(t,"srcUrl")&&W(t,"srcUrl",e)}static assertKeyUrlType(t,e){W(t,"id",e),W(t,"srcUrl",e)}static async fromBytesOrUrl(t){if(St.isKeyBytesType(t))return St._fromBytes(t);if(St.isKeyUrlType(t))return St._fromUrl(t);throw new Error("Invalid public key (deserialization failed)")}static fromBytes(t){try{return St.assertKeyBytesType(t,"arg"),St._fromBytes(t)}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}static _fromBytes(t){const e={tfheCompactPublicKey:TFHE.TfheCompactPublicKey.safe_deserialize(t.data,us),id:t.id,srcUrl:t.srcUrl};return new St(e)}static async fromUrl(t){try{return St.assertKeyUrlType(t,"arg"),St._fromUrl(t)}catch(e){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:e})}}static async _fromUrl(t){const e=await ph(t.srcUrl);return St.fromBytes({data:e,id:t.id,srcUrl:t.srcUrl})}toBytes(){return{data:this._tfheCompactPublicKey.safe_serialize(us),id:this._id,...this._srcUrl?{srcUrl:this._srcUrl}:{}}}toPublicKeyWasm(){return{publicKey:this._tfheCompactPublicKey,publicKeyId:this._id}}toPublicKeyBytes(){return{publicKey:this.toBytes().data,publicKeyId:this._id}}}class Si{_crs2048;_publicKey;constructor(t){this._publicKey=t.publicKey,this._crs2048=t.crs2048}static tryFromBytes(t){if(!Jt(t,"publicParams")||!ut.isPublicParams2048BytesType(t.publicParams)||!Jt(t,"publicKey")||!St.isKeyBytesType(t.publicKey))return null;const e=t.publicKey,r=t.publicParams;return Si.fromBytes({publicKey:e,publicParams:r})}static fromBytes(t){ut.assertIsPublicParams2048BytesType(t.publicParams,"arg.publicParams");const e=St.fromBytes(t.publicKey),r=ut.fromBytes({id:t.publicParams[2048].publicParamsId,data:t.publicParams[2048].publicParams,bits:2048});return new Si({publicKey:e,crs2048:r})}static async fromRelayerResponse(t){try{Hh(t,"RelayerV2GetResponseKeyUrl");const e=t.response.fheKeyInfo[0].fhePublicKey,r=e.dataId,i=e.urls[0],o=t.response.crs[2048],c=o.dataId,_=o.urls[0],l=await St.fromUrl({id:r,srcUrl:i}),u=await ut.fromUrl({id:c,bits:2048,srcUrl:_});return new Si({publicKey:l,crs2048:u})}catch(e){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:e})}}getTFHEPublicKey(){return this._publicKey}getTFHECrs(){return this._crs2048}toBytes(){return{publicKey:this._publicKey.toBytes(),publicParams:this._crs2048.toPublicParamsBytes()}}}class ja extends Kh{_relayerProvider;_relayerPublicKey;constructor(t){super(),this._relayerProvider=t.relayerProvider,this._relayerPublicKey=t.relayerPublicKey}get version(){return 2}get relayerVersionUrl(){return this.relayerProvider.url}static async fromConfig(t){const e=new x0(t.relayerVersionUrl);let r=Si.tryFromBytes(t);if(!r){const i=await e.fetchGetKeyUrlV2();r=await Si.fromRelayerResponse(i)}return new ja({relayerProvider:e,relayerPublicKey:r})}get relayerProvider(){return this._relayerProvider}getPublicKeyBytes(){return this._relayerPublicKey.getTFHEPublicKey().toPublicKeyBytes()}getPublicKeyWasm(){return this._relayerPublicKey.getTFHEPublicKey().toPublicKeyWasm()}getPublicParamsBytes(t){if(t!==2048)throw new Error(`Unsupported PublicParams bits format ${t}`);return this._relayerPublicKey.getTFHECrs().toPublicParamsBytes()[2048]}getPublicParamsWasm(t){if(t!==2048)throw new Error(`Unsupported PublicParams bits format ${t}`);return this._relayerPublicKey.getTFHECrs().toPublicParamsWasm()[2048]}}class Ga extends Kh{_relayerProvider;_publicKeyData;_publicParamsData;constructor(t){super(),this._relayerProvider=t.relayerProvider,this._publicKeyData=t.publicKeyData,this._publicParamsData=t.publicParamsData}get version(){return 1}get relayerVersionUrl(){return this.relayerProvider.url}static async fromConfig(t){const e=new Zb(t.relayerVersionUrl),r=await sb(t),i=await ob(t);return new Ga({relayerProvider:e,publicKeyData:r,publicParamsData:i})}get relayerProvider(){return this._relayerProvider}getPublicKeyBytes(){return{publicKey:this._publicKeyData.publicKey.safe_serialize(us),publicKeyId:this._publicKeyData.publicKeyId}}getPublicKeyWasm(){return{publicKey:this._publicKeyData.publicKey,publicKeyId:this._publicKeyData.publicKeyId}}getPublicParamsBytes(t){if(t!==2048)throw new Error(`Unsupported PublicParams bits format ${t}`);return{publicParams:this._publicParamsData[2048].publicParams.safe_serialize(fs),publicParamsId:this._publicParamsData[2048].publicParamsId}}getPublicParamsWasm(t){if(t!==2048)throw new Error(`Unsupported PublicParams bits format ${t}`);return{publicParams:this._publicParamsData[2048].publicParams,publicParamsId:this._publicParamsData[2048].publicParamsId}}}async function R0(n){const t=z0(n.relayerUrl,n.defaultRelayerVersion);if(!t)throw new Error(`Invalid relayerUrl: ${n.relayerUrl}`);return t.version===2?ja.fromConfig({relayerVersionUrl:t.url,publicKey:n.publicKey,publicParams:n.publicParams}):Ga.fromConfig({relayerVersionUrl:t.url,publicKey:n.publicKey,publicParams:n.publicParams})}function z0(n,t){if(!n||typeof n!="string")return null;const e=Oa(n,"/");if(!URL.canParse(e))return null;if(e.endsWith("/v1"))return{url:n,version:1};if(e.endsWith("/v2"))return{url:n,version:2};if(typeof t!="number")throw new Error(`relayerUrl cannot be resolved. (value=${n})`);return{url:`${e}/v${t}`,version:t}}const Qh={aclContractAddress:"0xcA2E8f1F656CD25C01F05d0b243Ab1ecd4a8ffb6",kmsContractAddress:"0x77627828a55156b04Ac0DC0eb30467f1a552BB03",inputVerifierContractAddress:"0xCe0FC2e05CFff1B719EFF7169f7D80Af770c8EA2",verifyingContractAddressDecryption:"0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24",verifyingContractAddressInputVerification:"0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287",chainId:1,gatewayChainId:261131,network:"https://ethereum-rpc.publicnode.com",relayerUrl:"https://relayer.mainnet.zama.org"};Object.freeze(Qh);const Ha={aclContractAddress:"0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D",kmsContractAddress:"0xbE0E383937d564D7FF0BC3b46c51f0bF8d5C311A",inputVerifierContractAddress:"0xBBC1fFCdc7C316aAAd72E807D9b0272BE8F84DA0",verifyingContractAddressDecryption:"0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478",verifyingContractAddressInputVerification:"0x483b9dE06E4E4C7D35CCf5837A1668487406D955",chainId:11155111,gatewayChainId:10901,network:"https://ethereum-sepolia-rpc.publicnode.com",relayerUrl:"https://relayer.testnet.zama.org"};Object.freeze(Ha);const P0=async n=>{const{verifyingContractAddressDecryption:t,verifyingContractAddressInputVerification:e,publicKey:r,inputVerifierContractAddress:i,kmsContractAddress:o,aclContractAddress:c,gatewayChainId:_,auth:l}=n;if(!ki(c))throw new Error("ACL contract address is not valid or empty");if(!ki(i))throw new Error("InputVerifier contract address is not valid or empty");if(!ki(o))throw new Error("KMS contract address is not valid or empty");if(!ki(t))throw new Error("Verifying contract for Decryption address is not valid or empty");if(!ki(e))throw new Error("Verifying contract for InputVerification address is not valid or empty");if(r&&!(r.data instanceof Uint8Array))throw new Error("publicKey must be a Uint8Array");const u=nb(n.network),p=n.relayerUrl??Ha.relayerUrl,f=await R0({relayerUrl:p,publicKey:n.publicKey,publicParams:n.publicParams,defaultRelayerVersion:1}),d=await ib(u,n),b=await ab(u,o),x=await cb(u,o),E=await _b(u,i),z=await lb(u,i);return{createEncryptedInput:Hb(c,e,d,_,f.relayerProvider,f.getPublicKeyWasm().publicKey,{2048:f.getPublicParamsWasm(2048)},E,z,l&&{auth:l}),generateKeypair:Ph,createEIP712:zh(t,d),publicDecrypt:qb(b,x,_,t,c,f.relayerProvider,u,l&&{auth:l}),userDecrypt:vb(b,_,d,t,c,f.relayerProvider,u,l&&{auth:l}),getPublicKey:()=>f.getPublicKeyBytes(),getPublicParams:P=>f.getPublicParamsBytes(P)}};let Jh=!1;const v0=async({tfheParams:n,kmsParams:t,thread:e}={})=>(e==null&&(e=navigator.hardwareConcurrency),await Ay()||(console.warn(`This browser does not support threads. Verify that your server returns correct headers:
|
|
1
|
+
(function(Kt,Vt){typeof exports=="object"&&typeof module<"u"?Vt(exports):typeof define=="function"&&define.amd?define(["exports"],Vt):(Kt=typeof globalThis<"u"?globalThis:Kt||self,Vt(Kt.relayerSDK={}))})(this,function(Kt){"use strict";var Vt=typeof document<"u"?document.currentScript:null;const As=globalThis||void 0||self,dp="6.15.0";function wp(n,t,e){const r=t.split("|").map(o=>o.trim());for(let o=0;o<r.length;o++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===t)return}const i=new Error(`invalid value for type ${t}`);throw i.code="INVALID_ARGUMENT",i.argument=`value.${e}`,i.value=n,i}async function Ot(n){const t=Object.keys(n);return(await Promise.all(t.map(r=>Promise.resolve(n[r])))).reduce((r,i,o)=>(r[t[o]]=i,r),{})}function V(n,t,e){for(let r in t){let i=t[r];const o=e?e[r]:null;o&&wp(i,o,r),Object.defineProperty(n,r,{enumerable:!0,value:i,writable:!1})}}function ni(n,t){if(n==null)return"null";if(t==null&&(t=new Set),typeof n=="object"){if(t.has(n))return"[Circular]";t.add(n)}if(Array.isArray(n))return"[ "+n.map(e=>ni(e,t)).join(", ")+" ]";if(n instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let i=0;i<n.length;i++)r+=e[n[i]>>4],r+=e[n[i]&15];return r}if(typeof n=="object"&&typeof n.toJSON=="function")return ni(n.toJSON(),t);switch(typeof n){case"boolean":case"number":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{ "+e.map(r=>`${ni(r,t)}: ${ni(n[r],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function kt(n,t){return n&&n.code===t}function Eo(n){return kt(n,"CALL_EXCEPTION")}function ft(n,t,e){let r=n;{const o=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${ni(e)}`);for(const c in e){if(c==="shortMessage")continue;const _=e[c];o.push(c+"="+ni(_))}}o.push(`code=${t}`),o.push(`version=${dp}`),o.length&&(n+=" ("+o.join(", ")+")")}let i;switch(t){case"INVALID_ARGUMENT":i=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(n);break;default:i=new Error(n)}return V(i,{code:t}),e&&Object.assign(i,e),i.shortMessage==null&&V(i,{shortMessage:r}),i}function I(n,t,e,r){if(!n)throw ft(t,e,r)}function g(n,t,e,r){I(n,t,"INVALID_ARGUMENT",{argument:e,value:r})}function Xa(n,t,e){e==null&&(e=""),e&&(e=": "+e),I(n>=t,"missing argument"+e,"MISSING_ARGUMENT",{count:n,expectedCount:t}),I(n<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:t})}["NFD","NFC","NFKD","NFKC"].reduce((n,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(t)}catch{}return n},[]);function Es(n,t,e){if(e==null&&(e=""),n!==t){let r=e,i="new";e&&(r+=".",i+=" "+e),I(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function tc(n,t,e){if(n instanceof Uint8Array)return e?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((n.length-2)/2);let i=2;for(let o=0;o<r.length;o++)r[o]=parseInt(n.substring(i,i+2),16),i+=2;return r}g(!1,"invalid BytesLike value",t||"value",n)}function J(n,t){return tc(n,t,!1)}function Nt(n,t){return tc(n,t,!0)}function ot(n,t){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&n.length!==2+2*t||t===!0&&n.length%2!==0)}function xo(n){return ot(n,!0)||n instanceof Uint8Array}const ec="0123456789abcdef";function O(n){const t=J(n);let e="0x";for(let r=0;r<t.length;r++){const i=t[r];e+=ec[(i&240)>>4]+ec[i&15]}return e}function lt(n){return"0x"+n.map(t=>O(t).substring(2)).join("")}function vn(n){return ot(n,!0)?(n.length-2)/2:J(n).length}function pt(n,t,e){const r=J(n);return e!=null&&e>r.length&&I(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:e}),O(r.slice(t??0,e??r.length))}function rc(n,t,e){const r=J(n);I(t>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:t,offset:t+1});const i=new Uint8Array(t);return i.fill(0),e?i.set(r,t-r.length):i.set(r,0),O(i)}function qt(n,t){return rc(n,t,!0)}function nc(n,t){return rc(n,t,!1)}const xs=BigInt(0),se=BigInt(1),ii=9007199254740991;function gp(n,t){const e=Rs(n,"value"),r=BigInt(q(t,"width"));if(I(e>>r===xs,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),e>>r-se){const i=(se<<r)-se;return-((~e&i)+se)}return e}function Ro(n,t){let e=M(n,"value");const r=BigInt(q(t,"width")),i=se<<r-se;if(e<xs){e=-e,I(e<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const o=(se<<r)-se;return(~e&o)+se}else I(e<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return e}function Ui(n,t){const e=Rs(n,"value"),r=BigInt(q(t,"bits"));return e&(se<<r)-se}function M(n,t){switch(typeof n){case"bigint":return n;case"number":return g(Number.isInteger(n),"underflow",t||"value",n),g(n>=-ii&&n<=ii,"overflow",t||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(e){g(!1,`invalid BigNumberish string: ${e.message}`,t||"value",n)}}g(!1,"invalid BigNumberish value",t||"value",n)}function Rs(n,t){const e=M(n,t);return I(e>=xs,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),e}const ic="0123456789abcdef";function zo(n){if(n instanceof Uint8Array){let t="0x0";for(const e of n)t+=ic[e>>4],t+=ic[e&15];return BigInt(t)}return M(n)}function q(n,t){switch(typeof n){case"bigint":return g(n>=-ii&&n<=ii,"overflow",t||"value",n),Number(n);case"number":return g(Number.isInteger(n),"underflow",t||"value",n),g(n>=-ii&&n<=ii,"overflow",t||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return q(BigInt(n),t)}catch(e){g(!1,`invalid numeric string: ${e.message}`,t||"value",n)}}g(!1,"invalid numeric value",t||"value",n)}function yp(n){return q(zo(n))}function cn(n,t){let r=Rs(n,"value").toString(16);if(t==null)r.length%2&&(r="0"+r);else{const i=q(t,"width");for(I(i*2>=r.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<i*2;)r="0"+r}return"0x"+r}function Et(n){const t=Rs(n,"value");if(t===xs)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);const r=new Uint8Array(e.length/2);for(let i=0;i<r.length;i++){const o=i*2;r[i]=parseInt(e.substring(o,o+2),16)}return r}function oe(n){let t=O(xo(n)?n:Et(n)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return t===""&&(t="0"),"0x"+t}const sc="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const oc=BigInt(58);function bp(n){const t=J(n);let e=zo(t),r="";for(;e;)r=sc[Number(e%oc)]+r,e/=oc;for(let i=0;i<t.length&&!t[i];i++)r=sc[0]+r;return r}function mp(n){n=atob(n);const t=new Uint8Array(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return J(t)}function Ap(n){const t=J(n);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}class ac{filter;emitter;#t;constructor(t,e,r){this.#t=e,V(this,{emitter:t,filter:r})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}}function Ep(n,t,e,r,i){g(!1,`invalid codepoint at offset ${t}; ${n}`,"bytes",e)}function cc(n,t,e,r,i){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let o=0;for(let c=t+1;c<e.length&&e[c]>>6===2;c++)o++;return o}return n==="OVERRUN"?e.length-t-1:0}function xp(n,t,e,r,i){return n==="OVERLONG"?(g(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),r.push(i),0):(r.push(65533),cc(n,t,e))}const Rp=Object.freeze({error:Ep,ignore:cc,replace:xp});function zp(n,t){t==null&&(t=Rp.error);const e=J(n,"bytes"),r=[];let i=0;for(;i<e.length;){const o=e[i++];if(o>>7===0){r.push(o);continue}let c=null,_=null;if((o&224)===192)c=1,_=127;else if((o&240)===224)c=2,_=2047;else if((o&248)===240)c=3,_=65535;else{(o&192)===128?i+=t("UNEXPECTED_CONTINUE",i-1,e,r):i+=t("BAD_PREFIX",i-1,e,r);continue}if(i-1+c>=e.length){i+=t("OVERRUN",i-1,e,r);continue}let l=o&(1<<8-c-1)-1;for(let u=0;u<c;u++){let h=e[i];if((h&192)!=128){i+=t("MISSING_CONTINUE",i,e,r),l=null;break}l=l<<6|h&63,i++}if(l!==null){if(l>1114111){i+=t("OUT_OF_RANGE",i-1-c,e,r,l);continue}if(l>=55296&&l<=57343){i+=t("UTF16_SURROGATE",i-1-c,e,r,l);continue}if(l<=_){i+=t("OVERLONG",i-1-c,e,r,l);continue}r.push(l)}}return r}function Gr(n,t){g(typeof n=="string","invalid string value","str",n);let e=[];for(let r=0;r<n.length;r++){const i=n.charCodeAt(r);if(i<128)e.push(i);else if(i<2048)e.push(i>>6|192),e.push(i&63|128);else if((i&64512)==55296){r++;const o=n.charCodeAt(r);g(r<n.length&&(o&64512)===56320,"invalid surrogate pair","str",n);const c=65536+((i&1023)<<10)+(o&1023);e.push(c>>18|240),e.push(c>>12&63|128),e.push(c>>6&63|128),e.push(c&63|128)}else e.push(i>>12|224),e.push(i>>6&63|128),e.push(i&63|128)}return new Uint8Array(e)}function Pp(n){return n.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function zs(n,t){return Pp(zp(n,t))}function _c(n){async function t(e,r){I(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const i=e.url.split(":")[0].toLowerCase();I(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),I(i==="https"||!e.credentials||e.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let o=null;const c=new AbortController,_=setTimeout(()=>{o=ft("request timeout","TIMEOUT"),c.abort()},e.timeout);r&&r.addListener(()=>{o=ft("request cancelled","CANCELLED"),c.abort()});const l=Object.assign({},n,{method:e.method,headers:new Headers(Array.from(e)),body:e.body||void 0,signal:c.signal});let u;try{u=await fetch(e.url,l)}catch(y){throw clearTimeout(_),o||y}clearTimeout(_);const h={};u.headers.forEach((y,R)=>{h[R.toLowerCase()]=y});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:h,body:d}}return t}const Ip=12,vp=250;let lc=_c();const kp=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Sp=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Po=!1;async function uc(n,t){try{const e=n.match(kp);if(!e)throw new Error("invalid data");return new _n(200,"OK",{"content-type":e[1]||"text/plain"},e[2]?mp(e[3]):Tp(e[3]))}catch{return new _n(599,"BAD REQUEST (invalid data: URI)",{},null,new Hr(n))}}function fc(n){async function t(e,r){try{const i=e.match(Sp);if(!i)throw new Error("invalid link");return new Hr(`${n}${i[2]}`)}catch{return new _n(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Hr(e))}}return t}const Ps={data:uc,ipfs:fc("https://gateway.ipfs.io/ipfs/")},hc=new WeakMap;class Bp{#t;#e;constructor(t){this.#t=[],this.#e=!1,hc.set(t,()=>{if(!this.#e){this.#e=!0;for(const e of this.#t)setTimeout(()=>{e()},0);this.#t=[]}})}addListener(t){I(!this.#e,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#t.push(t)}get cancelled(){return this.#e}checkSignal(){I(!this.cancelled,"cancelled","CANCELLED",{})}}function Is(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}class Hr{#t;#e;#r;#n;#i;#o;#s;#a;#h;#_;#p;#d;#c;#l;#u;get url(){return this.#o}set url(t){this.#o=String(t)}get body(){return this.#s==null?null:new Uint8Array(this.#s)}set body(t){if(t==null)this.#s=void 0,this.#a=void 0;else if(typeof t=="string")this.#s=Gr(t),this.#a="text/plain";else if(t instanceof Uint8Array)this.#s=t,this.#a="application/octet-stream";else if(typeof t=="object")this.#s=Gr(JSON.stringify(t)),this.#a="application/json";else throw new Error("invalid body")}hasBody(){return this.#s!=null}get method(){return this.#n?this.#n:this.hasBody()?"POST":"GET"}set method(t){t==null&&(t=""),this.#n=String(t).toUpperCase()}get headers(){const t=Object.assign({},this.#r);return this.#h&&(t.authorization=`Basic ${Ap(Gr(this.#h))}`),this.allowGzip&&(t["accept-encoding"]="gzip"),t["content-type"]==null&&this.#a&&(t["content-type"]=this.#a),this.body&&(t["content-length"]=String(this.body.length)),t}getHeader(t){return this.headers[t.toLowerCase()]}setHeader(t,e){this.#r[String(t).toLowerCase()]=String(e)}clearHeaders(){this.#r={}}[Symbol.iterator](){const t=this.headers,e=Object.keys(t);let r=0;return{next:()=>{if(r<e.length){const i=e[r++];return{value:[i,t[i]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#h||null}setCredentials(t,e){g(!t.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#h=`${t}:${e}`}get allowGzip(){return this.#e}set allowGzip(t){this.#e=!!t}get allowInsecureAuthentication(){return!!this.#t}set allowInsecureAuthentication(t){this.#t=!!t}get timeout(){return this.#i}set timeout(t){g(t>=0,"timeout must be non-zero","timeout",t),this.#i=t}get preflightFunc(){return this.#_||null}set preflightFunc(t){this.#_=t}get processFunc(){return this.#p||null}set processFunc(t){this.#p=t}get retryFunc(){return this.#d||null}set retryFunc(t){this.#d=t}get getUrlFunc(){return this.#u||lc}set getUrlFunc(t){this.#u=t}constructor(t){this.#o=String(t),this.#t=!1,this.#e=!0,this.#r={},this.#n="",this.#i=3e5,this.#l={slotInterval:vp,maxAttempts:Ip},this.#u=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#s?O(this.#s):"null"}>`}setThrottleParams(t){t.slotInterval!=null&&(this.#l.slotInterval=t.slotInterval),t.maxAttempts!=null&&(this.#l.maxAttempts=t.maxAttempts)}async#f(t,e,r,i,o){if(t>=this.#l.maxAttempts)return o.makeServerError("exceeded maximum retry limit");I(pc()<=e,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),r>0&&await Cp(r);let c=this.clone();const _=(c.url.split(":")[0]||"").toLowerCase();if(_ in Ps){const h=await Ps[_](c.url,Is(i.#c));if(h instanceof _n){let f=h;if(this.processFunc){Is(i.#c);try{f=await this.processFunc(c,f)}catch(d){(d.throttle==null||typeof d.stall!="number")&&f.makeServerError("error in post-processing function",d).assertOk()}}return f}c=h}this.preflightFunc&&(c=await this.preflightFunc(c));const l=await this.getUrlFunc(c,Is(i.#c));let u=new _n(l.statusCode,l.statusMessage,l.headers,l.body,i);if(u.statusCode===301||u.statusCode===302){try{const h=u.headers.location||"";return c.redirect(h).#f(t+1,e,0,i,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(c,u,t))){const h=u.headers["retry-after"];let f=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,t));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(f=parseInt(h)),c.clone().#f(t+1,e,f,i,u)}if(this.processFunc){Is(i.#c);try{u=await this.processFunc(c,u)}catch(h){(h.throttle==null||typeof h.stall!="number")&&u.makeServerError("error in post-processing function",h).assertOk();let f=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,t));return h.stall>=0&&(f=h.stall),c.clone().#f(t+1,e,f,i,u)}}return u}send(){return I(this.#c==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#c=new Bp(this),this.#f(0,pc()+this.timeout,0,this,new _n(0,"",{},null,this))}cancel(){I(this.#c!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const t=hc.get(this);if(!t)throw new Error("missing signal; should not happen");t()}redirect(t){const e=this.url.split(":")[0].toLowerCase(),r=t.split(":")[0].toLowerCase();I(this.method==="GET"&&(e!=="https"||r!=="http")&&t.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(t)})`});const i=new Hr(t);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,i.#r=Object.assign({},this.#r),this.#s&&(i.#s=new Uint8Array(this.#s)),i.#a=this.#a,i}clone(){const t=new Hr(this.url);return t.#n=this.#n,this.#s&&(t.#s=this.#s),t.#a=this.#a,t.#r=Object.assign({},this.#r),t.#h=this.#h,this.allowGzip&&(t.allowGzip=!0),t.timeout=this.timeout,this.allowInsecureAuthentication&&(t.allowInsecureAuthentication=!0),t.#_=this.#_,t.#p=this.#p,t.#d=this.#d,t.#l=Object.assign({},this.#l),t.#u=this.#u,t}static lockConfig(){Po=!0}static getGateway(t){return Ps[t.toLowerCase()]||null}static registerGateway(t,e){if(t=t.toLowerCase(),t==="http"||t==="https")throw new Error(`cannot intercept ${t}; use registerGetUrl`);if(Po)throw new Error("gateways locked");Ps[t]=e}static registerGetUrl(t){if(Po)throw new Error("gateways locked");lc=t}static createGetUrlFunc(t){return _c(t)}static createDataGateway(){return uc}static createIpfsGatewayFunc(t){return fc(t)}}class _n{#t;#e;#r;#n;#i;#o;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#n?O(this.#n):"null"}>`}get statusCode(){return this.#t}get statusMessage(){return this.#e}get headers(){return Object.assign({},this.#r)}get body(){return this.#n==null?null:new Uint8Array(this.#n)}get bodyText(){try{return this.#n==null?"":zs(this.#n)}catch{I(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{I(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const t=this.headers,e=Object.keys(t);let r=0;return{next:()=>{if(r<e.length){const i=e[r++];return{value:[i,t[i]],done:!1}}return{value:void 0,done:!0}}}}constructor(t,e,r,i,o){this.#t=t,this.#e=e,this.#r=Object.keys(r).reduce((c,_)=>(c[_.toLowerCase()]=String(r[_]),c),{}),this.#n=i==null?null:new Uint8Array(i),this.#i=o||null,this.#o={message:""}}makeServerError(t,e){let r;t?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${t})`:(t=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${t})`);const i=new _n(599,r,this.headers,this.body,this.#i||void 0);return i.#o={message:t,error:e},i}throwThrottleError(t,e){e==null?e=-1:g(Number.isInteger(e)&&e>=0,"invalid stall timeout","stall",e);const r=new Error(t||"throttling requests");throw V(r,{stall:e,throttle:!0}),r}getHeader(t){return this.headers[t.toLowerCase()]}hasBody(){return this.#n!=null}get request(){return this.#i}ok(){return this.#o.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:t,error:e}=this.#o;t===""&&(t=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let i=null;try{this.#n&&(i=zs(this.#n))}catch{}I(!1,t,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:e,info:{requestUrl:r,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function pc(){return new Date().getTime()}function Tp(n){return Gr(n.replace(/%([0-9a-f][0-9a-f])/gi,(t,e)=>String.fromCharCode(parseInt(e,16))))}function Cp(n){return new Promise(t=>setTimeout(t,n))}function Op(n){let t=n.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function dc(n,t,e){let r=0;for(let i=0;i<e;i++)r=r*256+n[t+i];return r}function wc(n,t,e,r){const i=[];for(;e<t+1+r;){const o=gc(n,e);i.push(o.result),e+=o.consumed,I(e<=t+1+r,"child data too short","BUFFER_OVERRUN",{buffer:n,length:r,offset:t})}return{consumed:1+r,result:i}}function gc(n,t){I(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const e=r=>{I(r<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r})};if(n[t]>=248){const r=n[t]-247;e(t+1+r);const i=dc(n,t+1,r);return e(t+1+r+i),wc(n,t,t+1+r,r+i)}else if(n[t]>=192){const r=n[t]-192;return e(t+1+r),wc(n,t,t+1,r)}else if(n[t]>=184){const r=n[t]-183;e(t+1+r);const i=dc(n,t+1,r);e(t+1+r+i);const o=O(n.slice(t+1+r,t+1+r+i));return{consumed:1+r+i,result:o}}else if(n[t]>=128){const r=n[t]-128;e(t+1+r);const i=O(n.slice(t+1,t+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:Op(n[t])}}function Di(n){const t=J(n,"data"),e=gc(t,0);return g(e.consumed===t.length,"unexpected junk after rlp payload","data",n),e.result}function yc(n){const t=[];for(;n;)t.unshift(n&255),n>>=8;return t}function bc(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(o){r=r.concat(bc(o))}),r.length<=55)return r.unshift(192+r.length),r;const i=yc(r.length);return i.unshift(247+i.length),i.concat(r)}const t=Array.prototype.slice.call(J(n,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const e=yc(t.length);return e.unshift(183+e.length),e.concat(t)}const mc="0123456789abcdef";function ln(n){let t="0x";for(const e of bc(n))t+=mc[e>>4],t+=mc[e&15];return t}const Ft=32,Io=new Uint8Array(Ft),Np=["then"],vs={},Ac=new WeakMap;function kn(n){return Ac.get(n)}function Ec(n,t){Ac.set(n,t)}function Li(n,t){const e=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw e.error=t,e}function vo(n,t,e){return n.indexOf(null)>=0?t.map((r,i)=>r instanceof qr?vo(kn(r),r,e):r):n.reduce((r,i,o)=>{let c=t.getValue(i);return i in r||(e&&c instanceof qr&&(c=vo(kn(c),c,e)),r[i]=c),r},{})}class qr extends Array{#t;constructor(...t){const e=t[0];let r=t[1],i=(t[2]||[]).slice(),o=!0;e!==vs&&(r=t,i=[],o=!1),super(r.length),r.forEach((l,u)=>{this[u]=l});const c=i.reduce((l,u)=>(typeof u=="string"&&l.set(u,(l.get(u)||0)+1),l),new Map);if(Ec(this,Object.freeze(r.map((l,u)=>{const h=i[u];return h!=null&&c.get(h)===1?h:null}))),this.#t=[],this.#t==null&&this.#t,!o)return;Object.freeze(this);const _=new Proxy(this,{get:(l,u,h)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const d=q(u,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const y=l[d];return y instanceof Error&&Li(`index ${d}`,y),y}if(Np.indexOf(u)>=0)return Reflect.get(l,u,h);const f=l[u];if(f instanceof Function)return function(...d){return f.apply(this===h?l:this,d)};if(!(u in l))return l.getValue.apply(this===h?l:this,[u])}return Reflect.get(l,u,h)}});return Ec(_,kn(this)),_}toArray(t){const e=[];return this.forEach((r,i)=>{r instanceof Error&&Li(`index ${i}`,r),t&&r instanceof qr&&(r=r.toArray(t)),e.push(r)}),e}toObject(t){const e=kn(this);return e.reduce((r,i,o)=>(I(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),vo(e,this,t)),{})}slice(t,e){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),e==null&&(e=this.length),e<0&&(e+=this.length,e<0&&(e=0)),e>this.length&&(e=this.length);const r=kn(this),i=[],o=[];for(let c=t;c<e;c++)i.push(this[c]),o.push(r[c]);return new qr(vs,i,o)}filter(t,e){const r=kn(this),i=[],o=[];for(let c=0;c<this.length;c++){const _=this[c];_ instanceof Error&&Li(`index ${c}`,_),t.call(e,_,c,this)&&(i.push(_),o.push(r[c]))}return new qr(vs,i,o)}map(t,e){const r=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&Li(`index ${i}`,o),r.push(t.call(e,o,i,this))}return r}getValue(t){const e=kn(this).indexOf(t);if(e===-1)return;const r=this[e];return r instanceof Error&&Li(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,e){return new qr(vs,t,e)}}function xc(n){let t=Et(n);return I(t.length<=Ft,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:Ft,offset:t.length}),t.length!==Ft&&(t=Nt(lt([Io.slice(t.length%Ft),t]))),t}class Yr{name;type;localName;dynamic;constructor(t,e,r,i){V(this,{name:t,type:e,localName:r,dynamic:i},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){g(!1,t,this.localName,e)}}class ko{#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return lt(this.#t)}get length(){return this.#e}#r(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#r(Nt(t.data))}writeBytes(t){let e=Nt(t);const r=e.length%Ft;return r&&(e=Nt(lt([e,Io.slice(r)]))),this.#r(e)}writeValue(t){return this.#r(xc(t))}writeUpdatableValue(){const t=this.#t.length;return this.#t.push(Io),this.#e+=Ft,e=>{this.#t[t]=xc(e)}}}class So{allowLoose;#t;#e;#r;#n;#i;constructor(t,e,r){V(this,{allowLoose:!!e}),this.#t=Nt(t),this.#r=0,this.#n=null,this.#i=r??1024,this.#e=0}get data(){return O(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#o(t){if(this.#n)return this.#n.#o(t);this.#r+=t,I(this.#i<1||this.#r<=this.#i*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#i} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Nt(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#s(t,e,r){let i=Math.ceil(e/Ft)*Ft;return this.#e+i>this.#t.length&&(this.allowLoose&&r&&this.#e+e<=this.#t.length?i=e:I(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Nt(this.#t),length:this.#t.length,offset:this.#e+i})),this.#t.slice(this.#e,this.#e+i)}subReader(t){const e=new So(this.#t.slice(this.#e+t),this.allowLoose,this.#i);return e.#n=this,e}readBytes(t,e){let r=this.#s(0,t,!!e);return this.#o(t),this.#e+=r.length,r.slice(0,t)}readValue(){return zo(this.readBytes(Ft))}readIndex(){return yp(this.readBytes(Ft))}}function ks(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function Bo(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function Fp(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ks(n.outputLen),ks(n.blockLen)}function si(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Rc(n,t){Bo(n);const e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}const To=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zc=n=>n instanceof Uint8Array,Up=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),Co=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Kr=(n,t)=>n<<32-t|n>>>t;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Dp(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Ss(n){if(typeof n=="string"&&(n=Dp(n)),!zc(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Lp(...n){const t=new Uint8Array(n.reduce((r,i)=>r+i.length,0));let e=0;return n.forEach(r=>{if(!zc(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}class Oo{clone(){return this._cloneInto()}}function No(n){const t=r=>n().update(Ss(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Mp(n=32){if(To&&typeof To.getRandomValues=="function")return To.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}class Pc extends Oo{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Fp(t);const r=Ss(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?t.create().update(r).digest():r);for(let c=0;c<o.length;c++)o[c]^=54;this.iHash.update(o),this.oHash=t.create();for(let c=0;c<o.length;c++)o[c]^=106;this.oHash.update(o),o.fill(0)}update(t){return si(this),this.iHash.update(t),this}digestInto(t){si(this),Bo(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:i,destroyed:o,blockLen:c,outputLen:_}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=c,t.outputLen=_,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ic=(n,t,e)=>new Pc(n,t).update(e).digest();Ic.create=(n,t)=>new Pc(n,t);function jp(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),o=BigInt(4294967295),c=Number(e>>i&o),_=Number(e&o),l=r?4:0,u=r?0:4;n.setUint32(t+l,c,r),n.setUint32(t+u,_,r)}class vc extends Oo{constructor(t,e,r,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Co(this.buffer)}update(t){si(this);const{view:e,buffer:r,blockLen:i}=this;t=Ss(t);const o=t.length;for(let c=0;c<o;){const _=Math.min(i-this.pos,o-c);if(_===i){const l=Co(t);for(;i<=o-c;c+=i)this.process(l,c);continue}r.set(t.subarray(c,c+_),this.pos),this.pos+=_,c+=_,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){si(this),Rc(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:o}=this;let{pos:c}=this;e[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>i-c&&(this.process(r,0),c=0);for(let f=c;f<i;f++)e[f]=0;jp(r,i-8,BigInt(this.length*8),o),this.process(r,0);const _=Co(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)_.setUint32(4*f,h[f],o)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:o,destroyed:c,pos:_}=this;return t.length=i,t.pos=_,t.finished=o,t.destroyed=c,i%e&&t.buffer.set(r),t}}const Gp=(n,t,e)=>n&t^~n&e,Hp=(n,t,e)=>n&t^n&e^t&e,Kp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),un=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fn=new Uint32Array(64);class Vp extends vc{constructor(){super(64,32,8,!1),this.A=un[0]|0,this.B=un[1]|0,this.C=un[2]|0,this.D=un[3]|0,this.E=un[4]|0,this.F=un[5]|0,this.G=un[6]|0,this.H=un[7]|0}get(){const{A:t,B:e,C:r,D:i,E:o,F:c,G:_,H:l}=this;return[t,e,r,i,o,c,_,l]}set(t,e,r,i,o,c,_,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=c|0,this.G=_|0,this.H=l|0}process(t,e){for(let f=0;f<16;f++,e+=4)fn[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){const d=fn[f-15],y=fn[f-2],R=Kr(d,7)^Kr(d,18)^d>>>3,E=Kr(y,17)^Kr(y,19)^y>>>10;fn[f]=E+fn[f-7]+R+fn[f-16]|0}let{A:r,B:i,C:o,D:c,E:_,F:l,G:u,H:h}=this;for(let f=0;f<64;f++){const d=Kr(_,6)^Kr(_,11)^Kr(_,25),y=h+d+Gp(_,l,u)+Kp[f]+fn[f]|0,E=(Kr(r,2)^Kr(r,13)^Kr(r,22))+Hp(r,i,o)|0;h=u,u=l,l=_,_=c+y|0,c=o,o=i,i=r,r=y+E|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,_=_+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,o,c,_,l,u,h)}roundClean(){fn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const kc=No(()=>new Vp),Bs=BigInt(2**32-1),Fo=BigInt(32);function Sc(n,t=!1){return t?{h:Number(n&Bs),l:Number(n>>Fo&Bs)}:{h:Number(n>>Fo&Bs)|0,l:Number(n&Bs)|0}}function Bc(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let i=0;i<n.length;i++){const{h:o,l:c}=Sc(n[i],t);[e[i],r[i]]=[o,c]}return[e,r]}const Qp=(n,t)=>BigInt(n>>>0)<<Fo|BigInt(t>>>0),Jp=(n,t,e)=>n>>>e,$p=(n,t,e)=>n<<32-e|t>>>e,Wp=(n,t,e)=>n>>>e|t<<32-e,Zp=(n,t,e)=>n<<32-e|t>>>e,qp=(n,t,e)=>n<<64-e|t>>>e-32,Yp=(n,t,e)=>n>>>e-32|t<<64-e,Xp=(n,t)=>t,td=(n,t)=>n,Tc=(n,t,e)=>n<<e|t>>>32-e,Cc=(n,t,e)=>t<<e|n>>>32-e,Oc=(n,t,e)=>t<<e-32|n>>>64-e,Nc=(n,t,e)=>n<<e-32|t>>>64-e;function ed(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const W={fromBig:Sc,split:Bc,toBig:Qp,shrSH:Jp,shrSL:$p,rotrSH:Wp,rotrSL:Zp,rotrBH:qp,rotrBL:Yp,rotr32H:Xp,rotr32L:td,rotlSH:Tc,rotlSL:Cc,rotlBH:Oc,rotlBL:Nc,add:ed,add3L:(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),add3H:(n,t,e,r)=>t+e+r+(n/2**32|0)|0,add4L:(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),add4H:(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,add5H:(n,t,e,r,i,o)=>t+e+r+i+o+(n/2**32|0)|0,add5L:(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0)},[rd,nd]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),hn=new Uint32Array(80),pn=new Uint32Array(80);class id extends vc{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:o,Cl:c,Dh:_,Dl:l,Eh:u,El:h,Fh:f,Fl:d,Gh:y,Gl:R,Hh:E,Hl:x}=this;return[t,e,r,i,o,c,_,l,u,h,f,d,y,R,E,x]}set(t,e,r,i,o,c,_,l,u,h,f,d,y,R,E,x){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=c|0,this.Dh=_|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=f|0,this.Fl=d|0,this.Gh=y|0,this.Gl=R|0,this.Hh=E|0,this.Hl=x|0}process(t,e){for(let T=0;T<16;T++,e+=4)hn[T]=t.getUint32(e),pn[T]=t.getUint32(e+=4);for(let T=16;T<80;T++){const j=hn[T-15]|0,F=pn[T-15]|0,C=W.rotrSH(j,F,1)^W.rotrSH(j,F,8)^W.shrSH(j,F,7),D=W.rotrSL(j,F,1)^W.rotrSL(j,F,8)^W.shrSL(j,F,7),N=hn[T-2]|0,Z=pn[T-2]|0,G=W.rotrSH(N,Z,19)^W.rotrBH(N,Z,61)^W.shrSH(N,Z,6),H=W.rotrSL(N,Z,19)^W.rotrBL(N,Z,61)^W.shrSL(N,Z,6),_t=W.add4L(D,H,pn[T-7],pn[T-16]),yt=W.add4H(_t,C,G,hn[T-7],hn[T-16]);hn[T]=yt|0,pn[T]=_t|0}let{Ah:r,Al:i,Bh:o,Bl:c,Ch:_,Cl:l,Dh:u,Dl:h,Eh:f,El:d,Fh:y,Fl:R,Gh:E,Gl:x,Hh:z,Hl:k}=this;for(let T=0;T<80;T++){const j=W.rotrSH(f,d,14)^W.rotrSH(f,d,18)^W.rotrBH(f,d,41),F=W.rotrSL(f,d,14)^W.rotrSL(f,d,18)^W.rotrBL(f,d,41),C=f&y^~f&E,D=d&R^~d&x,N=W.add5L(k,F,D,nd[T],pn[T]),Z=W.add5H(N,z,j,C,rd[T],hn[T]),G=N|0,H=W.rotrSH(r,i,28)^W.rotrBH(r,i,34)^W.rotrBH(r,i,39),_t=W.rotrSL(r,i,28)^W.rotrBL(r,i,34)^W.rotrBL(r,i,39),yt=r&o^r&_^o&_,K=i&c^i&l^c&l;z=E|0,k=x|0,E=y|0,x=R|0,y=f|0,R=d|0,{h:f,l:d}=W.add(u|0,h|0,Z|0,G|0),u=_|0,h=l|0,_=o|0,l=c|0,o=r|0,c=i|0;const v=W.add3L(G,_t,K);r=W.add3H(v,Z,H,yt),i=v|0}({h:r,l:i}=W.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:c}=W.add(this.Bh|0,this.Bl|0,o|0,c|0),{h:_,l}=W.add(this.Ch|0,this.Cl|0,_|0,l|0),{h:u,l:h}=W.add(this.Dh|0,this.Dl|0,u|0,h|0),{h:f,l:d}=W.add(this.Eh|0,this.El|0,f|0,d|0),{h:y,l:R}=W.add(this.Fh|0,this.Fl|0,y|0,R|0),{h:E,l:x}=W.add(this.Gh|0,this.Gl|0,E|0,x|0),{h:z,l:k}=W.add(this.Hh|0,this.Hl|0,z|0,k|0),this.set(r,i,o,c,_,l,u,h,f,d,y,R,E,x,z,k)}roundClean(){hn.fill(0),pn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sd=No(()=>new id);function od(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof As<"u")return As;throw new Error("unable to locate global object")}const Fc=od();Fc.crypto||Fc.msCrypto;function ad(n){switch(n){case"sha256":return kc.create();case"sha512":return sd.create()}g(!1,"invalid hashing algorithm name","algorithm",n)}const[Uc,Dc,Lc]=[[],[],[]],cd=BigInt(0),Mi=BigInt(1),_d=BigInt(2),ld=BigInt(7),ud=BigInt(256),fd=BigInt(113);for(let n=0,t=Mi,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Uc.push(2*(5*r+e)),Dc.push((n+1)*(n+2)/2%64);let i=cd;for(let o=0;o<7;o++)t=(t<<Mi^(t>>ld)*fd)%ud,t&_d&&(i^=Mi<<(Mi<<BigInt(o))-Mi);Lc.push(i)}const[hd,pd]=Bc(Lc,!0),Mc=(n,t,e)=>e>32?Oc(n,t,e):Tc(n,t,e),jc=(n,t,e)=>e>32?Nc(n,t,e):Cc(n,t,e);function dd(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let c=0;c<10;c++)e[c]=n[c]^n[c+10]^n[c+20]^n[c+30]^n[c+40];for(let c=0;c<10;c+=2){const _=(c+8)%10,l=(c+2)%10,u=e[l],h=e[l+1],f=Mc(u,h,1)^e[_],d=jc(u,h,1)^e[_+1];for(let y=0;y<50;y+=10)n[c+y]^=f,n[c+y+1]^=d}let i=n[2],o=n[3];for(let c=0;c<24;c++){const _=Dc[c],l=Mc(i,o,_),u=jc(i,o,_),h=Uc[c];i=n[h],o=n[h+1],n[h]=l,n[h+1]=u}for(let c=0;c<50;c+=10){for(let _=0;_<10;_++)e[_]=n[c+_];for(let _=0;_<10;_++)n[c+_]^=~e[(_+2)%10]&e[(_+4)%10]}n[0]^=hd[r],n[1]^=pd[r]}e.fill(0)}class Uo extends Oo{constructor(t,e,r,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ks(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Up(this.state)}keccak(){dd(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){si(this);const{blockLen:e,state:r}=this;t=Ss(t);const i=t.length;for(let o=0;o<i;){const c=Math.min(e-this.pos,i-o);for(let _=0;_<c;_++)r[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:i}=this;t[r]^=e,(e&128)!==0&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){si(this,!1),Bo(t),this.finish();const e=this.state,{blockLen:r}=this;for(let i=0,o=t.length;i<o;){this.posOut>=r&&this.keccak();const c=Math.min(r-this.posOut,o-i);t.set(e.subarray(this.posOut,this.posOut+c),i),this.posOut+=c,i+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ks(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Rc(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:r,outputLen:i,rounds:o,enableXOF:c}=this;return t||(t=new Uo(e,r,i,c,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=c,t.destroyed=this.destroyed,t}}const wd=((n,t,e)=>No(()=>new Uo(t,n,e)))(1,136,256/8);let Gc=!1;const Hc=function(n){return wd(n)};let Kc=Hc;function dt(n){const t=J(n,"data");return O(Kc(t))}dt._=Hc,dt.lock=function(){Gc=!0},dt.register=function(n){if(Gc)throw new TypeError("keccak256 is locked");Kc=n},Object.freeze(dt);const Vc=function(n){return ad("sha256").update(n).digest()};let Qc=Vc,Jc=!1;function oi(n){const t=J(n,"data");return O(Qc(t))}oi._=Vc,oi.lock=function(){Jc=!0},oi.register=function(n){if(Jc)throw new Error("sha256 is locked");Qc=n},Object.freeze(oi),Object.freeze(oi);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $c=BigInt(0),Ts=BigInt(1),gd=BigInt(2),Cs=n=>n instanceof Uint8Array,yd=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function ai(n){if(!Cs(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=yd[n[e]];return t}function Wc(n){const t=n.toString(16);return t.length&1?`0${t}`:t}function Do(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function ci(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const t=n.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const e=new Uint8Array(t/2);for(let r=0;r<e.length;r++){const i=r*2,o=n.slice(i,i+2),c=Number.parseInt(o,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[r]=c}return e}function Sn(n){return Do(ai(n))}function Lo(n){if(!Cs(n))throw new Error("Uint8Array expected");return Do(ai(Uint8Array.from(n).reverse()))}function _i(n,t){return ci(n.toString(16).padStart(t*2,"0"))}function Mo(n,t){return _i(n,t).reverse()}function bd(n){return ci(Wc(n))}function ae(n,t,e){let r;if(typeof t=="string")try{r=ci(t)}catch(o){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${o}`)}else if(Cs(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);const i=r.length;if(typeof e=="number"&&i!==e)throw new Error(`${n} expected ${e} bytes, got ${i}`);return r}function ji(...n){const t=new Uint8Array(n.reduce((r,i)=>r+i.length,0));let e=0;return n.forEach(r=>{if(!Cs(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}function md(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function Ad(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Ed(n){let t;for(t=0;n>$c;n>>=Ts,t+=1);return t}function xd(n,t){return n>>BigInt(t)&Ts}const Rd=(n,t,e)=>n|(e?Ts:$c)<<BigInt(t),jo=n=>(gd<<BigInt(n-1))-Ts,Go=n=>new Uint8Array(n),Zc=n=>Uint8Array.from(n);function qc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=Go(n),i=Go(n),o=0;const c=()=>{r.fill(1),i.fill(0),o=0},_=(...f)=>e(i,r,...f),l=(f=Go())=>{i=_(Zc([0]),f),r=_(),f.length!==0&&(i=_(Zc([1]),f),r=_())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<t;){r=_();const y=r.slice();d.push(y),f+=r.length}return ji(...d)};return(f,d)=>{c(),l(f);let y;for(;!(y=d(u()));)l();return c(),y}}const zd={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Gi(n,t,e={}){const r=(i,o,c)=>{const _=zd[o];if(typeof _!="function")throw new Error(`Invalid validator "${o}", expected function`);const l=n[i];if(!(c&&l===void 0)&&!_(l,n))throw new Error(`Invalid param ${String(i)}=${l} (${typeof l}), expected ${o}`)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(e))r(i,o,!0);return n}const Pd=Object.freeze(Object.defineProperty({__proto__:null,bitGet:xd,bitLen:Ed,bitMask:jo,bitSet:Rd,bytesToHex:ai,bytesToNumberBE:Sn,bytesToNumberLE:Lo,concatBytes:ji,createHmacDrbg:qc,ensureBytes:ae,equalBytes:md,hexToBytes:ci,hexToNumber:Do,numberToBytesBE:_i,numberToBytesLE:Mo,numberToHexUnpadded:Wc,numberToVarBytesBE:bd,utf8ToBytes:Ad,validateObject:Gi},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zt=BigInt(0),bt=BigInt(1),Bn=BigInt(2),Id=BigInt(3),Ho=BigInt(4),Yc=BigInt(5),Xc=BigInt(8);BigInt(9),BigInt(16);function Lt(n,t){const e=n%t;return e>=zt?e:t+e}function vd(n,t,e){if(e<=zt||t<zt)throw new Error("Expected power/modulo > 0");if(e===bt)return zt;let r=bt;for(;t>zt;)t&bt&&(r=r*n%e),n=n*n%e,t>>=bt;return r}function Yt(n,t,e){let r=n;for(;t-- >zt;)r*=r,r%=e;return r}function Ko(n,t){if(n===zt||t<=zt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=Lt(n,t),r=t,i=zt,o=bt;for(;e!==zt;){const _=r/e,l=r%e,u=i-o*_;r=e,e=l,i=o,o=u}if(r!==bt)throw new Error("invert: does not exist");return Lt(i,t)}function kd(n){const t=(n-bt)/Bn;let e,r,i;for(e=n-bt,r=0;e%Bn===zt;e/=Bn,r++);for(i=Bn;i<n&&vd(i,t,n)!==n-bt;i++);if(r===1){const c=(n+bt)/Ho;return function(l,u){const h=l.pow(u,c);if(!l.eql(l.sqr(h),u))throw new Error("Cannot find square root");return h}}const o=(e+bt)/Bn;return function(_,l){if(_.pow(l,t)===_.neg(_.ONE))throw new Error("Cannot find square root");let u=r,h=_.pow(_.mul(_.ONE,i),e),f=_.pow(l,o),d=_.pow(l,e);for(;!_.eql(d,_.ONE);){if(_.eql(d,_.ZERO))return _.ZERO;let y=1;for(let E=_.sqr(d);y<u&&!_.eql(E,_.ONE);y++)E=_.sqr(E);const R=_.pow(h,bt<<BigInt(u-y-1));h=_.sqr(R),f=_.mul(f,R),d=_.mul(d,h),u=y}return f}}function Sd(n){if(n%Ho===Id){const t=(n+bt)/Ho;return function(r,i){const o=r.pow(i,t);if(!r.eql(r.sqr(o),i))throw new Error("Cannot find square root");return o}}if(n%Xc===Yc){const t=(n-Yc)/Xc;return function(r,i){const o=r.mul(i,Bn),c=r.pow(o,t),_=r.mul(i,c),l=r.mul(r.mul(_,Bn),c),u=r.mul(_,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return kd(n)}const Bd=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Td(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Bd.reduce((r,i)=>(r[i]="function",r),t);return Gi(n,e)}function Cd(n,t,e){if(e<zt)throw new Error("Expected power > 0");if(e===zt)return n.ONE;if(e===bt)return t;let r=n.ONE,i=t;for(;e>zt;)e&bt&&(r=n.mul(r,i)),i=n.sqr(i),e>>=bt;return r}function Od(n,t){const e=new Array(t.length),r=t.reduce((o,c,_)=>n.is0(c)?o:(e[_]=o,n.mul(o,c)),n.ONE),i=n.inv(r);return t.reduceRight((o,c,_)=>n.is0(c)?o:(e[_]=n.mul(o,e[_]),n.mul(o,c)),i),e}function t_(n,t){const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Nd(n,t,e=!1,r={}){if(n<=zt)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:i,nByteLength:o}=t_(n,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=Sd(n),_=Object.freeze({ORDER:n,BITS:i,BYTES:o,MASK:jo(i),ZERO:zt,ONE:bt,create:l=>Lt(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return zt<=l&&l<n},is0:l=>l===zt,isOdd:l=>(l&bt)===bt,neg:l=>Lt(-l,n),eql:(l,u)=>l===u,sqr:l=>Lt(l*l,n),add:(l,u)=>Lt(l+u,n),sub:(l,u)=>Lt(l-u,n),mul:(l,u)=>Lt(l*u,n),pow:(l,u)=>Cd(_,l,u),div:(l,u)=>Lt(l*Ko(u,n),n),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Ko(l,n),sqrt:r.sqrt||(l=>c(_,l)),invertBatch:l=>Od(_,l),cmov:(l,u,h)=>h?u:l,toBytes:l=>e?Mo(l,o):_i(l,o),fromBytes:l=>{if(l.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${l.length}`);return e?Lo(l):Sn(l)}});return Object.freeze(_)}function e_(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function r_(n){const t=e_(n);return t+Math.ceil(t/2)}function Fd(n,t,e=!1){const r=n.length,i=e_(t),o=r_(t);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const c=e?Sn(n):Lo(n),_=Lt(c,t-bt)+bt;return e?Mo(_,i):_i(_,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ud=BigInt(0),Vo=BigInt(1);function Dd(n,t){const e=(i,o)=>{const c=o.negate();return i?c:o},r=i=>{const o=Math.ceil(t/i)+1,c=2**(i-1);return{windows:o,windowSize:c}};return{constTimeNegate:e,unsafeLadder(i,o){let c=n.ZERO,_=i;for(;o>Ud;)o&Vo&&(c=c.add(_)),_=_.double(),o>>=Vo;return c},precomputeWindow(i,o){const{windows:c,windowSize:_}=r(o),l=[];let u=i,h=u;for(let f=0;f<c;f++){h=u,l.push(h);for(let d=1;d<_;d++)h=h.add(u),l.push(h);u=h.double()}return l},wNAF(i,o,c){const{windows:_,windowSize:l}=r(i);let u=n.ZERO,h=n.BASE;const f=BigInt(2**i-1),d=2**i,y=BigInt(i);for(let R=0;R<_;R++){const E=R*l;let x=Number(c&f);c>>=y,x>l&&(x-=d,c+=Vo);const z=E,k=E+Math.abs(x)-1,T=R%2!==0,j=x<0;x===0?h=h.add(e(T,o[z])):u=u.add(e(j,o[k]))}return{p:u,f:h}},wNAFCached(i,o,c,_){const l=i._WINDOW_SIZE||1;let u=o.get(i);return u||(u=this.precomputeWindow(i,l),l!==1&&o.set(i,_(u))),this.wNAF(l,u,c)}}}function n_(n){return Td(n.Fp),Gi(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...t_(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ld(n){const t=n_(n);Gi(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:e,Fp:r,a:i}=t;if(e){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Md,hexToBytes:jd}=Pd,Tn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){const{Err:t}=Tn;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");const e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Md(r),l:n.subarray(e+2)}},toSig(n){const{Err:t}=Tn,e=typeof n=="string"?jd(n):n;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=Tn._parseInt(e.subarray(2)),{d:c,l:_}=Tn._parseInt(o);if(_.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:c}},hexFromSig(n){const t=u=>Number.parseInt(u[0],16)&8?"00"+u:u,e=u=>{const h=u.toString(16);return h.length&1?`0${h}`:h},r=t(e(n.s)),i=t(e(n.r)),o=r.length/2,c=i.length/2,_=e(o),l=e(c);return`30${e(c+o+4)}02${l}${i}02${_}${r}`}},Xr=BigInt(0),Xt=BigInt(1);BigInt(2);const i_=BigInt(3);BigInt(4);function Gd(n){const t=Ld(n),{Fp:e}=t,r=t.toBytes||((R,E,x)=>{const z=E.toAffine();return ji(Uint8Array.from([4]),e.toBytes(z.x),e.toBytes(z.y))}),i=t.fromBytes||(R=>{const E=R.subarray(1),x=e.fromBytes(E.subarray(0,e.BYTES)),z=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x,y:z}});function o(R){const{a:E,b:x}=t,z=e.sqr(R),k=e.mul(z,R);return e.add(e.add(k,e.mul(R,E)),x)}if(!e.eql(e.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function c(R){return typeof R=="bigint"&&Xr<R&&R<t.n}function _(R){if(!c(R))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(R){const{allowedPrivateKeyLengths:E,nByteLength:x,wrapPrivateKey:z,n:k}=t;if(E&&typeof R!="bigint"){if(R instanceof Uint8Array&&(R=ai(R)),typeof R!="string"||!E.includes(R.length))throw new Error("Invalid key");R=R.padStart(x*2,"0")}let T;try{T=typeof R=="bigint"?R:Sn(ae("private key",R,x))}catch{throw new Error(`private key must be ${x} bytes, hex or bigint, not ${typeof R}`)}return z&&(T=Lt(T,k)),_(T),T}const u=new Map;function h(R){if(!(R instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(E,x,z){if(this.px=E,this.py=x,this.pz=z,E==null||!e.isValid(E))throw new Error("x required");if(x==null||!e.isValid(x))throw new Error("y required");if(z==null||!e.isValid(z))throw new Error("z required")}static fromAffine(E){const{x,y:z}=E||{};if(!E||!e.isValid(x)||!e.isValid(z))throw new Error("invalid affine point");if(E instanceof f)throw new Error("projective point not allowed");const k=T=>e.eql(T,e.ZERO);return k(x)&&k(z)?f.ZERO:new f(x,z,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){const x=e.invertBatch(E.map(z=>z.pz));return E.map((z,k)=>z.toAffine(x[k])).map(f.fromAffine)}static fromHex(E){const x=f.fromAffine(i(ae("pointHex",E)));return x.assertValidity(),x}static fromPrivateKey(E){return f.BASE.multiply(l(E))}_setWindowSize(E){this._WINDOW_SIZE=E,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:E,y:x}=this.toAffine();if(!e.isValid(E)||!e.isValid(x))throw new Error("bad point: x or y not FE");const z=e.sqr(x),k=o(E);if(!e.eql(z,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:E}=this.toAffine();if(e.isOdd)return!e.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){h(E);const{px:x,py:z,pz:k}=this,{px:T,py:j,pz:F}=E,C=e.eql(e.mul(x,F),e.mul(T,k)),D=e.eql(e.mul(z,F),e.mul(j,k));return C&&D}negate(){return new f(this.px,e.neg(this.py),this.pz)}double(){const{a:E,b:x}=t,z=e.mul(x,i_),{px:k,py:T,pz:j}=this;let F=e.ZERO,C=e.ZERO,D=e.ZERO,N=e.mul(k,k),Z=e.mul(T,T),G=e.mul(j,j),H=e.mul(k,T);return H=e.add(H,H),D=e.mul(k,j),D=e.add(D,D),F=e.mul(E,D),C=e.mul(z,G),C=e.add(F,C),F=e.sub(Z,C),C=e.add(Z,C),C=e.mul(F,C),F=e.mul(H,F),D=e.mul(z,D),G=e.mul(E,G),H=e.sub(N,G),H=e.mul(E,H),H=e.add(H,D),D=e.add(N,N),N=e.add(D,N),N=e.add(N,G),N=e.mul(N,H),C=e.add(C,N),G=e.mul(T,j),G=e.add(G,G),N=e.mul(G,H),F=e.sub(F,N),D=e.mul(G,Z),D=e.add(D,D),D=e.add(D,D),new f(F,C,D)}add(E){h(E);const{px:x,py:z,pz:k}=this,{px:T,py:j,pz:F}=E;let C=e.ZERO,D=e.ZERO,N=e.ZERO;const Z=t.a,G=e.mul(t.b,i_);let H=e.mul(x,T),_t=e.mul(z,j),yt=e.mul(k,F),K=e.add(x,z),v=e.add(T,j);K=e.mul(K,v),v=e.add(H,_t),K=e.sub(K,v),v=e.add(x,k);let L=e.add(T,F);return v=e.mul(v,L),L=e.add(H,yt),v=e.sub(v,L),L=e.add(z,k),C=e.add(j,F),L=e.mul(L,C),C=e.add(_t,yt),L=e.sub(L,C),N=e.mul(Z,v),C=e.mul(G,yt),N=e.add(C,N),C=e.sub(_t,N),N=e.add(_t,N),D=e.mul(C,N),_t=e.add(H,H),_t=e.add(_t,H),yt=e.mul(Z,yt),v=e.mul(G,v),_t=e.add(_t,yt),yt=e.sub(H,yt),yt=e.mul(Z,yt),v=e.add(v,yt),H=e.mul(_t,v),D=e.add(D,H),H=e.mul(L,v),C=e.mul(K,C),C=e.sub(C,H),H=e.mul(K,_t),N=e.mul(L,N),N=e.add(N,H),new f(C,D,N)}subtract(E){return this.add(E.negate())}is0(){return this.equals(f.ZERO)}wNAF(E){return y.wNAFCached(this,u,E,x=>{const z=e.invertBatch(x.map(k=>k.pz));return x.map((k,T)=>k.toAffine(z[T])).map(f.fromAffine)})}multiplyUnsafe(E){const x=f.ZERO;if(E===Xr)return x;if(_(E),E===Xt)return this;const{endo:z}=t;if(!z)return y.unsafeLadder(this,E);let{k1neg:k,k1:T,k2neg:j,k2:F}=z.splitScalar(E),C=x,D=x,N=this;for(;T>Xr||F>Xr;)T&Xt&&(C=C.add(N)),F&Xt&&(D=D.add(N)),N=N.double(),T>>=Xt,F>>=Xt;return k&&(C=C.negate()),j&&(D=D.negate()),D=new f(e.mul(D.px,z.beta),D.py,D.pz),C.add(D)}multiply(E){_(E);let x=E,z,k;const{endo:T}=t;if(T){const{k1neg:j,k1:F,k2neg:C,k2:D}=T.splitScalar(x);let{p:N,f:Z}=this.wNAF(F),{p:G,f:H}=this.wNAF(D);N=y.constTimeNegate(j,N),G=y.constTimeNegate(C,G),G=new f(e.mul(G.px,T.beta),G.py,G.pz),z=N.add(G),k=Z.add(H)}else{const{p:j,f:F}=this.wNAF(x);z=j,k=F}return f.normalizeZ([z,k])[0]}multiplyAndAddUnsafe(E,x,z){const k=f.BASE,T=(F,C)=>C===Xr||C===Xt||!F.equals(k)?F.multiplyUnsafe(C):F.multiply(C),j=T(this,x).add(T(E,z));return j.is0()?void 0:j}toAffine(E){const{px:x,py:z,pz:k}=this,T=this.is0();E==null&&(E=T?e.ONE:e.inv(k));const j=e.mul(x,E),F=e.mul(z,E),C=e.mul(k,E);if(T)return{x:e.ZERO,y:e.ZERO};if(!e.eql(C,e.ONE))throw new Error("invZ was invalid");return{x:j,y:F}}isTorsionFree(){const{h:E,isTorsionFree:x}=t;if(E===Xt)return!0;if(x)return x(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:E,clearCofactor:x}=t;return E===Xt?this:x?x(f,this):this.multiplyUnsafe(t.h)}toRawBytes(E=!0){return this.assertValidity(),r(f,this,E)}toHex(E=!0){return ai(this.toRawBytes(E))}}f.BASE=new f(t.Gx,t.Gy,e.ONE),f.ZERO=new f(e.ZERO,e.ONE,e.ZERO);const d=t.nBitLength,y=Dd(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:c}}function Hd(n){const t=n_(n);return Gi(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Kd(n){const t=Hd(n),{Fp:e,n:r}=t,i=e.BYTES+1,o=2*e.BYTES+1;function c(v){return Xr<v&&v<e.ORDER}function _(v){return Lt(v,r)}function l(v){return Ko(v,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:h,weierstrassEquation:f,isWithinCurveOrder:d}=Gd({...t,toBytes(v,L,$){const nt=L.toAffine(),rt=e.toBytes(nt.x),xt=ji;return $?xt(Uint8Array.from([L.hasEvenY()?2:3]),rt):xt(Uint8Array.from([4]),rt,e.toBytes(nt.y))},fromBytes(v){const L=v.length,$=v[0],nt=v.subarray(1);if(L===i&&($===2||$===3)){const rt=Sn(nt);if(!c(rt))throw new Error("Point is not on curve");const xt=f(rt);let Ht=e.sqrt(xt);const Rt=(Ht&Xt)===Xt;return($&1)===1!==Rt&&(Ht=e.neg(Ht)),{x:rt,y:Ht}}else if(L===o&&$===4){const rt=e.fromBytes(nt.subarray(0,e.BYTES)),xt=e.fromBytes(nt.subarray(e.BYTES,2*e.BYTES));return{x:rt,y:xt}}else throw new Error(`Point of length ${L} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),y=v=>ai(_i(v,t.nByteLength));function R(v){const L=r>>Xt;return v>L}function E(v){return R(v)?_(-v):v}const x=(v,L,$)=>Sn(v.slice(L,$));class z{constructor(L,$,nt){this.r=L,this.s=$,this.recovery=nt,this.assertValidity()}static fromCompact(L){const $=t.nByteLength;return L=ae("compactSignature",L,$*2),new z(x(L,0,$),x(L,$,2*$))}static fromDER(L){const{r:$,s:nt}=Tn.toSig(ae("DER",L));return new z($,nt)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(L){return new z(this.r,this.s,L)}recoverPublicKey(L){const{r:$,s:nt,recovery:rt}=this,xt=D(ae("msgHash",L));if(rt==null||![0,1,2,3].includes(rt))throw new Error("recovery id invalid");const Ht=rt===2||rt===3?$+t.n:$;if(Ht>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const Rt=(rt&1)===0?"02":"03",zn=u.fromHex(Rt+y(Ht)),Pn=l(Ht),Oi=_(-xt*Pn),ms=_(nt*Pn),In=u.BASE.multiplyAndAddUnsafe(zn,Oi,ms);if(!In)throw new Error("point at infinify");return In.assertValidity(),In}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new z(this.r,_(-this.s),this.recovery):this}toDERRawBytes(){return ci(this.toDERHex())}toDERHex(){return Tn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ci(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(v){try{return h(v),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const v=r_(t.n);return Fd(t.randomBytes(v),t.n)},precompute(v=8,L=u.BASE){return L._setWindowSize(v),L.multiply(BigInt(3)),L}};function T(v,L=!0){return u.fromPrivateKey(v).toRawBytes(L)}function j(v){const L=v instanceof Uint8Array,$=typeof v=="string",nt=(L||$)&&v.length;return L?nt===i||nt===o:$?nt===2*i||nt===2*o:v instanceof u}function F(v,L,$=!0){if(j(v))throw new Error("first arg must be private key");if(!j(L))throw new Error("second arg must be public key");return u.fromHex(L).multiply(h(v)).toRawBytes($)}const C=t.bits2int||function(v){const L=Sn(v),$=v.length*8-t.nBitLength;return $>0?L>>BigInt($):L},D=t.bits2int_modN||function(v){return _(C(v))},N=jo(t.nBitLength);function Z(v){if(typeof v!="bigint")throw new Error("bigint expected");if(!(Xr<=v&&v<N))throw new Error(`bigint expected < 2^${t.nBitLength}`);return _i(v,t.nByteLength)}function G(v,L,$=H){if(["recovered","canonical"].some(ri=>ri in $))throw new Error("sign() legacy options not supported");const{hash:nt,randomBytes:rt}=t;let{lowS:xt,prehash:Ht,extraEntropy:Rt}=$;xt==null&&(xt=!0),v=ae("msgHash",v),Ht&&(v=ae("prehashed msgHash",nt(v)));const zn=D(v),Pn=h(L),Oi=[Z(Pn),Z(zn)];if(Rt!=null){const ri=Rt===!0?rt(e.BYTES):Rt;Oi.push(ae("extraEntropy",ri))}const ms=ji(...Oi),In=zn;function Ya(ri){const Ni=C(ri);if(!d(Ni))return;const fp=l(Ni),Zr=u.BASE.multiply(Ni).toAffine(),Fi=_(Zr.x);if(Fi===Xr)return;const Ao=_(fp*_(In+Fi*Pn));if(Ao===Xr)return;let hp=(Zr.x===Fi?0:2)|Number(Zr.y&Xt),pp=Ao;return xt&&R(Ao)&&(pp=E(Ao),hp^=1),new z(Fi,pp,hp)}return{seed:ms,k2sig:Ya}}const H={lowS:t.lowS,prehash:!1},_t={lowS:t.lowS,prehash:!1};function yt(v,L,$=H){const{seed:nt,k2sig:rt}=G(v,L,$),xt=t;return qc(xt.hash.outputLen,xt.nByteLength,xt.hmac)(nt,rt)}u.BASE._setWindowSize(8);function K(v,L,$,nt=_t){const rt=v;if(L=ae("msgHash",L),$=ae("publicKey",$),"strict"in nt)throw new Error("options.strict was renamed to lowS");const{lowS:xt,prehash:Ht}=nt;let Rt,zn;try{if(typeof rt=="string"||rt instanceof Uint8Array)try{Rt=z.fromDER(rt)}catch(Zr){if(!(Zr instanceof Tn.Err))throw Zr;Rt=z.fromCompact(rt)}else if(typeof rt=="object"&&typeof rt.r=="bigint"&&typeof rt.s=="bigint"){const{r:Zr,s:Fi}=rt;Rt=new z(Zr,Fi)}else throw new Error("PARSE");zn=u.fromHex($)}catch(Zr){if(Zr.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xt&&Rt.hasHighS())return!1;Ht&&(L=t.hash(L));const{r:Pn,s:Oi}=Rt,ms=D(L),In=l(Oi),Ya=_(ms*In),ri=_(Pn*In),Ni=u.BASE.multiplyAndAddUnsafe(zn,Ya,ri)?.toAffine();return Ni?_(Ni.x)===Pn:!1}return{CURVE:t,getPublicKey:T,getSharedSecret:F,sign:yt,verify:K,ProjectivePoint:u,Signature:z,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Vd(n){return{hash:n,hmac:(t,...e)=>Ic(n,t,Lp(...e)),randomBytes:Mp}}function Qd(n,t){const e=r=>Kd({...n,...Vd(r)});return Object.freeze({...e(t),create:e})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s_=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),o_=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Jd=BigInt(1),Qo=BigInt(2),a_=(n,t)=>(n+t/Qo)/t;function $d(n){const t=s_,e=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),c=BigInt(23),_=BigInt(44),l=BigInt(88),u=n*n*n%t,h=u*u*n%t,f=Yt(h,e,t)*h%t,d=Yt(f,e,t)*h%t,y=Yt(d,Qo,t)*u%t,R=Yt(y,i,t)*y%t,E=Yt(R,o,t)*R%t,x=Yt(E,_,t)*E%t,z=Yt(x,l,t)*x%t,k=Yt(z,_,t)*E%t,T=Yt(k,e,t)*h%t,j=Yt(T,c,t)*R%t,F=Yt(j,r,t)*u%t,C=Yt(F,Qo,t);if(!Jo.eql(Jo.sqr(C),n))throw new Error("Cannot find square root");return C}const Jo=Nd(s_,void 0,void 0,{sqrt:$d}),dn=Qd({a:BigInt(0),b:BigInt(7),Fp:Jo,n:o_,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const t=o_,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Jd*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=e,c=BigInt("0x100000000000000000000000000000000"),_=a_(o*n,t),l=a_(-r*n,t);let u=Lt(n-_*e-l*i,t),h=Lt(-_*r-l*o,t);const f=u>c,d=h>c;if(f&&(u=t-u),d&&(h=t-h),u>c||h>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:f,k1:u,k2neg:d,k2:h}}}},kc);BigInt(0),dn.ProjectivePoint;const Hi="0x0000000000000000000000000000000000000000",c_="0x0000000000000000000000000000000000000000000000000000000000000000",__=BigInt(0),l_=BigInt(1),u_=BigInt(2),f_=BigInt(27),h_=BigInt(28),Os=BigInt(35),li={};function p_(n){return qt(Et(n),32)}class wt{#t;#e;#r;#n;get r(){return this.#t}set r(t){g(vn(t)===32,"invalid r","value",t),this.#t=O(t)}get s(){return g(parseInt(this.#e.substring(0,3))<8,"non-canonical s; use ._s","s",this.#e),this.#e}set s(t){g(vn(t)===32,"invalid s","value",t),this.#e=O(t)}get _s(){return this.#e}isValid(){return parseInt(this.#e.substring(0,3))<8}get v(){return this.#r}set v(t){const e=q(t,"value");g(e===27||e===28,"invalid v","v",t),this.#r=e}get networkV(){return this.#n}get legacyChainId(){const t=this.networkV;return t==null?null:wt.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){const t=J(this.s);return this.yParity&&(t[0]|=128),O(t)}get compactSerialized(){return lt([this.r,this.yParityAndS])}get serialized(){return lt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,r,i){Es(t,li,"Signature"),this.#t=e,this.#e=r,this.#r=i,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const t=new wt(li,this.r,this._s,this.v);return this.networkV&&(t.#n=this.networkV),t}toJSON(){const t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(t){const e=M(t,"v");return e==f_||e==h_?__:(g(e>=Os,"invalid EIP-155 v","v",t),(e-Os)/u_)}static getChainIdV(t,e){return M(t)*u_+BigInt(35+e-27)}static getNormalizedV(t){const e=M(t);return e===__||e===f_?27:e===l_||e===h_?28:(g(e>=Os,"invalid v","v",t),e&l_?27:28)}static from(t){function e(u,h){g(u,h,"signature",t)}if(t==null)return new wt(li,c_,c_,27);if(typeof t=="string"){const u=J(t,"signature");if(u.length===64){const h=O(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new wt(li,h,O(f),d)}if(u.length===65){const h=O(u.slice(0,32)),f=O(u.slice(32,64)),d=wt.getNormalizedV(u[64]);return new wt(li,h,f,d)}e(!1,"invalid raw signature length")}if(t instanceof wt)return t.clone();const r=t.r;e(r!=null,"missing r");const i=p_(r),o=function(u,h){if(u!=null)return p_(u);if(h!=null){e(ot(h,32),"invalid yParityAndS");const f=J(h);return f[0]&=127,O(f)}e(!1,"missing s")}(t.s,t.yParityAndS),{networkV:c,v:_}=function(u,h,f){if(u!=null){const d=M(u);return{networkV:d>=Os?d:void 0,v:wt.getNormalizedV(d)}}if(h!=null)return e(ot(h,32),"invalid yParityAndS"),{v:J(h)[0]&128?28:27};if(f!=null){switch(q(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),l=new wt(li,i,o,_);return c&&(l.#n=c),e(t.yParity==null||q(t.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}}class tn{#t;constructor(t){g(vn(t)===32,"invalid private key","privateKey","[REDACTED]"),this.#t=O(t)}get privateKey(){return this.#t}get publicKey(){return tn.computePublicKey(this.#t)}get compressedPublicKey(){return tn.computePublicKey(this.#t,!0)}sign(t){g(vn(t)===32,"invalid digest length","digest",t);const e=dn.sign(Nt(t),Nt(this.#t),{lowS:!0});return wt.from({r:cn(e.r,32),s:cn(e.s,32),v:e.recovery?28:27})}computeSharedSecret(t){const e=tn.computePublicKey(t);return O(dn.getSharedSecret(Nt(this.#t),J(e),!1))}static computePublicKey(t,e){let r=J(t,"key");if(r.length===32){const o=dn.getPublicKey(r,!!e);return O(o)}if(r.length===64){const o=new Uint8Array(65);o[0]=4,o.set(r,1),r=o}const i=dn.ProjectivePoint.fromHex(r);return O(i.toRawBytes(e))}static recoverPublicKey(t,e){g(vn(t)===32,"invalid digest length","digest",t);const r=wt.from(e);let i=dn.Signature.fromCompact(Nt(lt([r.r,r.s])));i=i.addRecoveryBit(r.yParity);const o=i.recoverPublicKey(Nt(t));return g(o!=null,"invalid signature for digest","signature",e),"0x"+o.toHex(!1)}static addPoints(t,e,r){const i=dn.ProjectivePoint.fromHex(tn.computePublicKey(t).substring(2)),o=dn.ProjectivePoint.fromHex(tn.computePublicKey(e).substring(2));return"0x"+i.add(o).toHex(!!r)}}const Wd=BigInt(0),Zd=BigInt(36);function d_(n){n=n.toLowerCase();const t=n.substring(2).split(""),e=new Uint8Array(40);for(let i=0;i<40;i++)e[i]=t[i].charCodeAt(0);const r=J(dt(e));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(r[i>>1]&15)>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}const $o={};for(let n=0;n<10;n++)$o[String(n)]=String(n);for(let n=0;n<26;n++)$o[String.fromCharCode(65+n)]=String(10+n);const w_=15;function qd(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let t=n.split("").map(r=>$o[r]).join("");for(;t.length>=w_;){let r=t.substring(0,w_);t=parseInt(r,10)%97+t.substring(r.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}const Yd=function(){const n={};for(let t=0;t<36;t++){const e="0123456789abcdefghijklmnopqrstuvwxyz"[t];n[e]=BigInt(t)}return n}();function Xd(n){n=n.toLowerCase();let t=Wd;for(let e=0;e<n.length;e++)t=t*Zd+Yd[n[e]];return t}function Y(n){if(g(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const t=d_(n);return g(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===n,"bad address checksum","address",n),t}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){g(n.substring(2,4)===qd(n),"bad icap checksum","address",n);let t=Xd(n.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return d_("0x"+t)}g(!1,"invalid address","address",n)}function tw(n){const t=Y(n.from);let r=M(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,Y(pt(dt(ln([t,r])),12))}function g_(n){return n&&typeof n.getAddress=="function"}function en(n){try{return Y(n),!0}catch{}return!1}async function Wo(n,t){const e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(I(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),g(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),Y(e)}function Ut(n,t){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?Y(n):(I(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Wo(n,t.resolveName(n)));if(g_(n))return Wo(n,n.getAddress());if(n&&typeof n.then=="function")return Wo(n,n);g(!1,"unsupported addressable value","target",n)}const rn={};function U(n,t){let e=!1;return t<0&&(e=!0,t*=-1),new gt(rn,`${e?"":"u"}int${t}`,n,{signed:e,width:t})}function et(n,t){return new gt(rn,`bytes${t||""}`,n,{size:t})}const y_=Symbol.for("_ethers_typed");class gt{type;value;#t;_typedSymbol;constructor(t,e,r,i){i==null&&(i=null),Es(rn,t,"Typed"),V(this,{_typedSymbol:y_,type:e,value:r}),this.#t=i,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${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 this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#t}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#t===!0?-1:this.#t===!1?this.value.length:null}static from(t,e){return new gt(rn,t,e)}static uint8(t){return U(t,8)}static uint16(t){return U(t,16)}static uint24(t){return U(t,24)}static uint32(t){return U(t,32)}static uint40(t){return U(t,40)}static uint48(t){return U(t,48)}static uint56(t){return U(t,56)}static uint64(t){return U(t,64)}static uint72(t){return U(t,72)}static uint80(t){return U(t,80)}static uint88(t){return U(t,88)}static uint96(t){return U(t,96)}static uint104(t){return U(t,104)}static uint112(t){return U(t,112)}static uint120(t){return U(t,120)}static uint128(t){return U(t,128)}static uint136(t){return U(t,136)}static uint144(t){return U(t,144)}static uint152(t){return U(t,152)}static uint160(t){return U(t,160)}static uint168(t){return U(t,168)}static uint176(t){return U(t,176)}static uint184(t){return U(t,184)}static uint192(t){return U(t,192)}static uint200(t){return U(t,200)}static uint208(t){return U(t,208)}static uint216(t){return U(t,216)}static uint224(t){return U(t,224)}static uint232(t){return U(t,232)}static uint240(t){return U(t,240)}static uint248(t){return U(t,248)}static uint256(t){return U(t,256)}static uint(t){return U(t,256)}static int8(t){return U(t,-8)}static int16(t){return U(t,-16)}static int24(t){return U(t,-24)}static int32(t){return U(t,-32)}static int40(t){return U(t,-40)}static int48(t){return U(t,-48)}static int56(t){return U(t,-56)}static int64(t){return U(t,-64)}static int72(t){return U(t,-72)}static int80(t){return U(t,-80)}static int88(t){return U(t,-88)}static int96(t){return U(t,-96)}static int104(t){return U(t,-104)}static int112(t){return U(t,-112)}static int120(t){return U(t,-120)}static int128(t){return U(t,-128)}static int136(t){return U(t,-136)}static int144(t){return U(t,-144)}static int152(t){return U(t,-152)}static int160(t){return U(t,-160)}static int168(t){return U(t,-168)}static int176(t){return U(t,-176)}static int184(t){return U(t,-184)}static int192(t){return U(t,-192)}static int200(t){return U(t,-200)}static int208(t){return U(t,-208)}static int216(t){return U(t,-216)}static int224(t){return U(t,-224)}static int232(t){return U(t,-232)}static int240(t){return U(t,-240)}static int248(t){return U(t,-248)}static int256(t){return U(t,-256)}static int(t){return U(t,-256)}static bytes1(t){return et(t,1)}static bytes2(t){return et(t,2)}static bytes3(t){return et(t,3)}static bytes4(t){return et(t,4)}static bytes5(t){return et(t,5)}static bytes6(t){return et(t,6)}static bytes7(t){return et(t,7)}static bytes8(t){return et(t,8)}static bytes9(t){return et(t,9)}static bytes10(t){return et(t,10)}static bytes11(t){return et(t,11)}static bytes12(t){return et(t,12)}static bytes13(t){return et(t,13)}static bytes14(t){return et(t,14)}static bytes15(t){return et(t,15)}static bytes16(t){return et(t,16)}static bytes17(t){return et(t,17)}static bytes18(t){return et(t,18)}static bytes19(t){return et(t,19)}static bytes20(t){return et(t,20)}static bytes21(t){return et(t,21)}static bytes22(t){return et(t,22)}static bytes23(t){return et(t,23)}static bytes24(t){return et(t,24)}static bytes25(t){return et(t,25)}static bytes26(t){return et(t,26)}static bytes27(t){return et(t,27)}static bytes28(t){return et(t,28)}static bytes29(t){return et(t,29)}static bytes30(t){return et(t,30)}static bytes31(t){return et(t,31)}static bytes32(t){return et(t,32)}static address(t){return new gt(rn,"address",t)}static bool(t){return new gt(rn,"bool",!!t)}static bytes(t){return new gt(rn,"bytes",t)}static string(t){return new gt(rn,"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 gt(rn,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===y_}static dereference(t,e){if(gt.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}}class ew extends Yr{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let r=gt.dereference(e,"string");try{r=Y(r)}catch(i){return this._throwError(i.message,e)}return t.writeValue(r)}decode(t){return Y(cn(t.readValue(),20))}}class rw extends Yr{coder;constructor(t){super(t.name,t.type,"_",t.dynamic),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 b_(n,t,e){let r=[];if(Array.isArray(e))r=e;else if(e&&typeof e=="object"){let l={};r=t.map(u=>{const h=u.localName;return I(h,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:e}),I(!l[h],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:e}),l[h]=!0,e[h]})}else g(!1,"invalid tuple value","tuple",e);g(t.length===r.length,"types/value length mismatch","tuple",e);let i=new ko,o=new ko,c=[];t.forEach((l,u)=>{let h=r[u];if(l.dynamic){let f=o.length;l.encode(o,h);let d=i.writeUpdatableValue();c.push(y=>{d(y+f)})}else l.encode(i,h)}),c.forEach(l=>{l(i.length)});let _=n.appendWriter(i);return _+=n.appendWriter(o),_}function m_(n,t){let e=[],r=[],i=n.subReader(0);return t.forEach(o=>{let c=null;if(o.dynamic){let _=n.readIndex(),l=i.subReader(_);try{c=o.decode(l)}catch(u){if(kt(u,"BUFFER_OVERRUN"))throw u;c=u,c.baseType=o.name,c.name=o.localName,c.type=o.type}}else try{c=o.decode(n)}catch(_){if(kt(_,"BUFFER_OVERRUN"))throw _;c=_,c.baseType=o.name,c.name=o.localName,c.type=o.type}if(c==null)throw new Error("investigate");e.push(c),r.push(o.localName||null)}),qr.fromItems(e,r)}class nw extends Yr{coder;length;constructor(t,e,r){const i=t.type+"["+(e>=0?e:"")+"]",o=e===-1||t.dynamic;super("array",i,r,o),V(this,{coder:t,length:e})}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){const r=gt.dereference(e,"array");Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,t.writeValue(r.length)),Xa(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let c=0;c<r.length;c++)o.push(this.coder);return b_(t,o,r)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),I(e*Ft<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*Ft,length:t.dataLength}));let r=[];for(let i=0;i<e;i++)r.push(new rw(this.coder));return m_(t,r)}}class iw extends Yr{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){const r=gt.dereference(e,"bool");return t.writeValue(r?1:0)}decode(t){return!!t.readValue()}}class A_ extends Yr{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=Nt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readIndex(),!0)}}class sw extends A_{constructor(t){super("bytes",t)}decode(t){return O(super.decode(t))}}class ow extends Yr{size;constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),V(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let r=Nt(gt.dereference(e,this.type));return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return O(t.readBytes(this.size))}}const aw=new Uint8Array([]);class cw extends Yr{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(aw)}decode(t){return t.readBytes(0),null}}const _w=BigInt(0),lw=BigInt(1),uw=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class fw extends Yr{size;signed;constructor(t,e,r){const i=(e?"int":"uint")+t*8;super(i,i,r,!1),V(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let r=M(gt.dereference(e,this.type)),i=Ui(uw,Ft*8);if(this.signed){let o=Ui(i,this.size*8-1);(r>o||r<-(o+lw))&&this._throwError("value out-of-bounds",e),r=Ro(r,8*Ft)}else(r<_w||r>Ui(i,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(r)}decode(t){let e=Ui(t.readValue(),this.size*8);return this.signed&&(e=gp(e,this.size*8)),e}}class hw extends A_{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Gr(gt.dereference(e,"string")))}decode(t){return zs(super.decode(t))}}class Ns extends Yr{coders;constructor(t,e){let r=!1;const i=[];t.forEach(c=>{c.dynamic&&(r=!0),i.push(c.type)});const o="tuple("+i.join(",")+")";super("tuple",o,e,r),V(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});const e=this.coders.reduce((r,i)=>{const o=i.localName;return o&&(r[o]||(r[o]=0),r[o]++),r},{});return this.coders.forEach((r,i)=>{let o=r.localName;!o||e[o]!==1||(o==="length"&&(o="_length"),t[o]==null&&(t[o]=t[i]))}),Object.freeze(t)}encode(t,e){const r=gt.dereference(e,"tuple");return b_(t,this.coders,r)}decode(t){return m_(t,this.coders)}}function Zo(n,t){return{address:Y(n),storageKeys:t.map((e,r)=>(g(ot(e,32),"invalid slot",`storageKeys[${r}]`,e),e.toLowerCase()))}}function Cn(n){if(Array.isArray(n))return n.map((e,r)=>Array.isArray(e)?(g(e.length===2,"invalid slot set",`value[${r}]`,e),Zo(e[0],e[1])):(g(e!=null&&typeof e=="object","invalid address-slot set","value",n),Zo(e.address,e.storageKeys)));g(n!=null&&typeof n=="object","invalid access list","value",n);const t=Object.keys(n).map(e=>{const r=n[e].reduce((i,o)=>(i[o]=!0,i),{});return Zo(e,Object.keys(r).sort())});return t.sort((e,r)=>e.address.localeCompare(r.address)),t}function E_(n){return{address:Y(n.address),nonce:M(n.nonce!=null?n.nonce:0),chainId:M(n.chainId!=null?n.chainId:0),signature:wt.from(n.signature)}}function pw(n){let t;return typeof n=="string"?t=tn.computePublicKey(n,!1):t=n.publicKey,Y(dt("0x"+t.substring(4)).substring(26))}function x_(n,t){return pw(tn.recoverPublicKey(n,t))}const Pt=BigInt(0),dw=BigInt(2),ww=BigInt(27),gw=BigInt(28),yw=BigInt(35),bw=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),qo=4096*32;function mw(n){return{blobToKzgCommitment:r=>{if("computeBlobProof"in n){if("blobToKzgCommitment"in n&&typeof n.blobToKzgCommitment=="function")return J(n.blobToKzgCommitment(O(r)))}else if("blobToKzgCommitment"in n&&typeof n.blobToKzgCommitment=="function")return J(n.blobToKzgCommitment(r));if("blobToKZGCommitment"in n&&typeof n.blobToKZGCommitment=="function")return J(n.blobToKZGCommitment(O(r)));g(!1,"unsupported KZG library","kzg",n)},computeBlobKzgProof:(r,i)=>{if("computeBlobProof"in n&&typeof n.computeBlobProof=="function")return J(n.computeBlobProof(O(r),O(i)));if("computeBlobKzgProof"in n&&typeof n.computeBlobKzgProof=="function")return n.computeBlobKzgProof(r,i);if("computeBlobKZGProof"in n&&typeof n.computeBlobKZGProof=="function")return J(n.computeBlobKZGProof(O(r),O(i)));g(!1,"unsupported KZG library","kzg",n)}}}function R_(n,t){let e=n.toString(16);for(;e.length<2;)e="0"+e;return e+=oi(t).substring(4),"0x"+e}function ui(n){return n==="0x"?null:Y(n)}function Fs(n,t){try{return Cn(n)}catch(e){g(!1,e.message,t,n)}}function Aw(n,t){try{if(!Array.isArray(n))throw new Error("authorizationList: invalid array");const e=[];for(let r=0;r<n.length;r++){const i=n[r];if(!Array.isArray(i))throw new Error(`authorization[${r}]: invalid array`);if(i.length!==6)throw new Error(`authorization[${r}]: wrong length`);if(!i[1])throw new Error(`authorization[${r}]: null address`);e.push({address:ui(i[1]),nonce:it(i[2],"nonce"),chainId:it(i[0],"chainId"),signature:wt.from({yParity:On(i[3],"yParity"),r:qt(i[4],32),s:qt(i[5],32)})})}return e}catch(e){g(!1,e.message,t,n)}}function On(n,t){return n==="0x"?0:q(n,t)}function it(n,t){if(n==="0x")return Pt;const e=M(n,t);return g(e<=bw,"value exceeds uint size",t,e),e}function X(n,t){const e=M(n,"value"),r=Et(e);return g(r.length<=32,"value too large",`tx.${t}`,e),r}function Us(n){return Cn(n).map(t=>[t.address,t.storageKeys])}function Ew(n){return n.map(t=>[X(t.chainId,"chainId"),t.address,X(t.nonce,"nonce"),X(t.signature.yParity,"yParity"),Et(t.signature.r),Et(t.signature.s)])}function xw(n,t){g(Array.isArray(n),`invalid ${t}`,"value",n);for(let e=0;e<n.length;e++)g(ot(n[e],32),"invalid ${ param } hash",`value[${e}]`,n[e]);return n}function Rw(n){const t=Di(n);g(Array.isArray(t)&&(t.length===9||t.length===6),"invalid field count for legacy transaction","data",n);const e={type:0,nonce:On(t[0],"nonce"),gasPrice:it(t[1],"gasPrice"),gasLimit:it(t[2],"gasLimit"),to:ui(t[3]),value:it(t[4],"value"),data:O(t[5]),chainId:Pt};if(t.length===6)return e;const r=it(t[6],"v"),i=it(t[7],"r"),o=it(t[8],"s");if(i===Pt&&o===Pt)e.chainId=r;else{let c=(r-yw)/dw;c<Pt&&(c=Pt),e.chainId=c,g(c!==Pt||r===ww||r===gw,"non-canonical legacy v","v",t[6]),e.signature=wt.from({r:qt(t[7],32),s:qt(t[8],32),v:r})}return e}function zw(n,t){const e=[X(n.nonce,"nonce"),X(n.gasPrice||0,"gasPrice"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data];let r=Pt;if(n.chainId!=Pt)r=M(n.chainId,"tx.chainId"),g(!t||t.networkV==null||t.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",t);else if(n.signature){const o=n.signature.legacyChainId;o!=null&&(r=o)}if(!t)return r!==Pt&&(e.push(Et(r)),e.push("0x"),e.push("0x")),ln(e);let i=BigInt(27+t.yParity);return r!==Pt?i=wt.getChainIdV(r,t.v):BigInt(t.v)!==i&&g(!1,"tx.chainId/sig.v mismatch","sig",t),e.push(Et(i)),e.push(Et(t.r)),e.push(Et(t.s)),ln(e)}function Ds(n,t){let e;try{if(e=On(t[0],"yParity"),e!==0&&e!==1)throw new Error("bad yParity")}catch{g(!1,"invalid yParity","yParity",t[0])}const r=qt(t[1],32),i=qt(t[2],32),o=wt.from({r,s:i,yParity:e});n.signature=o}function Pw(n){const t=Di(J(n).slice(1));g(Array.isArray(t)&&(t.length===9||t.length===12),"invalid field count for transaction type: 2","data",O(n));const e={type:2,chainId:it(t[0],"chainId"),nonce:On(t[1],"nonce"),maxPriorityFeePerGas:it(t[2],"maxPriorityFeePerGas"),maxFeePerGas:it(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:it(t[4],"gasLimit"),to:ui(t[5]),value:it(t[6],"value"),data:O(t[7]),accessList:Fs(t[8],"accessList")};return t.length===9||Ds(e,t.slice(9)),e}function Iw(n,t){const e=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),X(n.maxFeePerGas||0,"maxFeePerGas"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data,Us(n.accessList||[])];return t&&(e.push(X(t.yParity,"yParity")),e.push(Et(t.r)),e.push(Et(t.s))),lt(["0x02",ln(e)])}function vw(n){const t=Di(J(n).slice(1));g(Array.isArray(t)&&(t.length===8||t.length===11),"invalid field count for transaction type: 1","data",O(n));const e={type:1,chainId:it(t[0],"chainId"),nonce:On(t[1],"nonce"),gasPrice:it(t[2],"gasPrice"),gasLimit:it(t[3],"gasLimit"),to:ui(t[4]),value:it(t[5],"value"),data:O(t[6]),accessList:Fs(t[7],"accessList")};return t.length===8||Ds(e,t.slice(8)),e}function kw(n,t){const e=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.gasPrice||0,"gasPrice"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data,Us(n.accessList||[])];return t&&(e.push(X(t.yParity,"recoveryParam")),e.push(Et(t.r)),e.push(Et(t.s))),lt(["0x01",ln(e)])}function Sw(n){let t=Di(J(n).slice(1)),e="3",r=null;if(t.length===4&&Array.isArray(t[0])){e="3 (network format)";const o=t[1],c=t[2],_=t[3];g(Array.isArray(o),"invalid network format: blobs not an array","fields[1]",o),g(Array.isArray(c),"invalid network format: commitments not an array","fields[2]",c),g(Array.isArray(_),"invalid network format: proofs not an array","fields[3]",_),g(o.length===c.length,"invalid network format: blobs/commitments length mismatch","fields",t),g(o.length===_.length,"invalid network format: blobs/proofs length mismatch","fields",t),r=[];for(let l=0;l<t[1].length;l++)r.push({data:o[l],commitment:c[l],proof:_[l]});t=t[0]}g(Array.isArray(t)&&(t.length===11||t.length===14),`invalid field count for transaction type: ${e}`,"data",O(n));const i={type:3,chainId:it(t[0],"chainId"),nonce:On(t[1],"nonce"),maxPriorityFeePerGas:it(t[2],"maxPriorityFeePerGas"),maxFeePerGas:it(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:it(t[4],"gasLimit"),to:ui(t[5]),value:it(t[6],"value"),data:O(t[7]),accessList:Fs(t[8],"accessList"),maxFeePerBlobGas:it(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10]};r&&(i.blobs=r),g(i.to!=null,`invalid address for transaction type: ${e}`,"data",n),g(Array.isArray(i.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let o=0;o<i.blobVersionedHashes.length;o++)g(ot(i.blobVersionedHashes[o],32),`invalid blobVersionedHash at index ${o}: must be length 32`,"data",n);return t.length===11||Ds(i,t.slice(11)),i}function Bw(n,t,e){const r=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),X(n.maxFeePerGas||0,"maxFeePerGas"),X(n.gasLimit,"gasLimit"),n.to||Hi,X(n.value,"value"),n.data,Us(n.accessList||[]),X(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),xw(n.blobVersionedHashes||[],"blobVersionedHashes")];return t&&(r.push(X(t.yParity,"yParity")),r.push(Et(t.r)),r.push(Et(t.s)),e)?lt(["0x03",ln([r,e.map(i=>i.data),e.map(i=>i.commitment),e.map(i=>i.proof)])]):lt(["0x03",ln(r)])}function Tw(n){const t=Di(J(n).slice(1));g(Array.isArray(t)&&(t.length===10||t.length===13),"invalid field count for transaction type: 4","data",O(n));const e={type:4,chainId:it(t[0],"chainId"),nonce:On(t[1],"nonce"),maxPriorityFeePerGas:it(t[2],"maxPriorityFeePerGas"),maxFeePerGas:it(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:it(t[4],"gasLimit"),to:ui(t[5]),value:it(t[6],"value"),data:O(t[7]),accessList:Fs(t[8],"accessList"),authorizationList:Aw(t[9],"authorizationList")};return t.length===10||Ds(e,t.slice(10)),e}function Cw(n,t){const e=[X(n.chainId,"chainId"),X(n.nonce,"nonce"),X(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),X(n.maxFeePerGas||0,"maxFeePerGas"),X(n.gasLimit,"gasLimit"),n.to||"0x",X(n.value,"value"),n.data,Us(n.accessList||[]),Ew(n.authorizationList||[])];return t&&(e.push(X(t.yParity,"yParity")),e.push(Et(t.r)),e.push(Et(t.s))),lt(["0x04",ln(e)])}class ce{#t;#e;#r;#n;#i;#o;#s;#a;#h;#_;#p;#d;#c;#l;#u;#f;#g;get type(){return this.#t}set type(t){switch(t){case null:this.#t=null;break;case 0:case"legacy":this.#t=0;break;case 1:case"berlin":case"eip-2930":this.#t=1;break;case 2:case"london":case"eip-1559":this.#t=2;break;case 3:case"cancun":case"eip-4844":this.#t=3;break;case 4:case"pectra":case"eip-7702":this.#t=4;break;default:g(!1,"unsupported transaction type","type",t)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const t=this.#e;return t==null&&this.type===3?Hi:t}set to(t){this.#e=t==null?null:Y(t)}get nonce(){return this.#n}set nonce(t){this.#n=q(t,"value")}get gasLimit(){return this.#i}set gasLimit(t){this.#i=M(t)}get gasPrice(){const t=this.#o;return t==null&&(this.type===0||this.type===1)?Pt:t}set gasPrice(t){this.#o=t==null?null:M(t,"gasPrice")}get maxPriorityFeePerGas(){const t=this.#s;return t??(this.type===2||this.type===3?Pt:null)}set maxPriorityFeePerGas(t){this.#s=t==null?null:M(t,"maxPriorityFeePerGas")}get maxFeePerGas(){const t=this.#a;return t??(this.type===2||this.type===3?Pt:null)}set maxFeePerGas(t){this.#a=t==null?null:M(t,"maxFeePerGas")}get data(){return this.#r}set data(t){this.#r=O(t)}get value(){return this.#h}set value(t){this.#h=M(t,"value")}get chainId(){return this.#_}set chainId(t){this.#_=M(t)}get signature(){return this.#p||null}set signature(t){this.#p=t==null?null:wt.from(t)}get accessList(){const t=this.#d||null;return t??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(t){this.#d=t==null?null:Cn(t)}get authorizationList(){const t=this.#g||null;return t==null&&this.type===4?[]:t}set authorizationList(t){this.#g=t==null?null:t.map(e=>E_(e))}get maxFeePerBlobGas(){const t=this.#c;return t==null&&this.type===3?Pt:t}set maxFeePerBlobGas(t){this.#c=t==null?null:M(t,"maxFeePerBlobGas")}get blobVersionedHashes(){let t=this.#l;return t==null&&this.type===3?[]:t}set blobVersionedHashes(t){if(t!=null){g(Array.isArray(t),"blobVersionedHashes must be an Array","value",t),t=t.slice();for(let e=0;e<t.length;e++)g(ot(t[e],32),"invalid blobVersionedHash",`value[${e}]`,t[e])}this.#l=t}get blobs(){return this.#f==null?null:this.#f.map(t=>Object.assign({},t))}set blobs(t){if(t==null){this.#f=null;return}const e=[],r=[];for(let i=0;i<t.length;i++){const o=t[i];if(xo(o)){I(this.#u,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let c=J(o);if(g(c.length<=qo,"blob is too large",`blobs[${i}]`,o),c.length!==qo){const u=new Uint8Array(qo);u.set(c),c=u}const _=this.#u.blobToKzgCommitment(c),l=O(this.#u.computeBlobKzgProof(c,_));e.push({data:O(c),commitment:O(_),proof:l}),r.push(R_(1,_))}else{const c=O(o.commitment);e.push({data:O(o.data),commitment:c,proof:O(o.proof)}),r.push(R_(1,c))}}this.#f=e,this.#l=r}get kzg(){return this.#u}set kzg(t){t==null?this.#u=null:this.#u=mw(t)}constructor(){this.#t=null,this.#e=null,this.#n=0,this.#i=Pt,this.#o=null,this.#s=null,this.#a=null,this.#r="0x",this.#h=Pt,this.#_=Pt,this.#p=null,this.#d=null,this.#c=null,this.#l=null,this.#u=null,this.#f=null,this.#g=null}get hash(){return this.signature==null?null:dt(this.#w(!0,!1))}get unsignedHash(){return dt(this.unsignedSerialized)}get from(){return this.signature==null?null:x_(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:tn.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}#w(t,e){I(!t||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=t?this.signature:null;switch(this.inferType()){case 0:return zw(this,r);case 1:return kw(this,r);case 2:return Iw(this,r);case 3:return Bw(this,r,e?this.blobs:null);case 4:return Cw(this,r)}I(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#w(!0,!0)}get unsignedSerialized(){return this.#w(!1,!1)}inferType(){const t=this.inferTypes();return t.indexOf(2)>=0?2:t.pop()}inferTypes(){const t=this.gasPrice!=null,e=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,i=this.#c!=null||this.#l;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&I(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),I(!e||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),I(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const o=[];return this.type!=null?o.push(this.type):this.authorizationList&&this.authorizationList.length?o.push(4):e?o.push(2):t?(o.push(1),r||o.push(0)):r?(o.push(1),o.push(2)):(i&&this.to||(o.push(0),o.push(1),o.push(2)),o.push(3)),o.sort(),o}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return ce.from(this)}toJSON(){const t=e=>e==null?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:t(this.gasLimit),gasPrice:t(this.gasPrice),maxPriorityFeePerGas:t(this.maxPriorityFeePerGas),maxFeePerGas:t(this.maxFeePerGas),value:t(this.value),chainId:t(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(t){if(t==null)return new ce;if(typeof t=="string"){const r=J(t);if(r[0]>=127)return ce.from(Rw(r));switch(r[0]){case 1:return ce.from(vw(r));case 2:return ce.from(Pw(r));case 3:return ce.from(Sw(r));case 4:return ce.from(Tw(r))}I(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const e=new ce;return t.type!=null&&(e.type=t.type),t.to!=null&&(e.to=t.to),t.nonce!=null&&(e.nonce=t.nonce),t.gasLimit!=null&&(e.gasLimit=t.gasLimit),t.gasPrice!=null&&(e.gasPrice=t.gasPrice),t.maxPriorityFeePerGas!=null&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas),t.maxFeePerGas!=null&&(e.maxFeePerGas=t.maxFeePerGas),t.maxFeePerBlobGas!=null&&(e.maxFeePerBlobGas=t.maxFeePerBlobGas),t.data!=null&&(e.data=t.data),t.value!=null&&(e.value=t.value),t.chainId!=null&&(e.chainId=t.chainId),t.signature!=null&&(e.signature=wt.from(t.signature)),t.accessList!=null&&(e.accessList=t.accessList),t.authorizationList!=null&&(e.authorizationList=t.authorizationList),t.blobVersionedHashes!=null&&(e.blobVersionedHashes=t.blobVersionedHashes),t.kzg!=null&&(e.kzg=t.kzg),t.blobs!=null&&(e.blobs=t.blobs),t.hash!=null&&(g(e.isSigned(),"unsigned transaction cannot define '.hash'","tx",t),g(e.hash===t.hash,"hash mismatch","tx",t)),t.from!=null&&(g(e.isSigned(),"unsigned transaction cannot define '.from'","tx",t),g(e.from.toLowerCase()===(t.from||"").toLowerCase(),"from mismatch","tx",t)),e}}function Nn(n){return dt(Gr(n))}var Ow="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";const z_=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),P_=4;function Nw(n){let t=0;function e(){return n[t++]<<8|n[t++]}let r=e(),i=1,o=[0,1];for(let F=1;F<r;F++)o.push(i+=e());let c=e(),_=t;t+=c;let l=0,u=0;function h(){return l==0&&(u=u<<8|n[t++],l=8),u>>--l&1}const f=31,d=2**f,y=d>>>1,R=y>>1,E=d-1;let x=0;for(let F=0;F<f;F++)x=x<<1|h();let z=[],k=0,T=d;for(;;){let F=Math.floor(((x-k+1)*i-1)/T),C=0,D=r;for(;D-C>1;){let G=C+D>>>1;F<o[G]?D=G:C=G}if(C==0)break;z.push(C);let N=k+Math.floor(T*o[C]/i),Z=k+Math.floor(T*o[C+1]/i)-1;for(;((N^Z)&y)==0;)x=x<<1&E|h(),N=N<<1&E,Z=Z<<1&E|1;for(;N&~Z&R;)x=x&y|x<<1&E>>>1|h(),N=N<<1^y,Z=(Z^y)<<1|y|1;k=N,T=1+Z-N}let j=r-4;return z.map(F=>{switch(F-j){case 3:return j+65792+(n[_++]<<16|n[_++]<<8|n[_++]);case 2:return j+256+(n[_++]<<8|n[_++]);case 1:return j+n[_++];default:return F-1}})}function Fw(n){let t=0;return()=>n[t++]}function I_(n){return Fw(Nw(Uw(n)))}function Uw(n){let t=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,o)=>t[i.charCodeAt(0)]=o);let e=n.length,r=new Uint8Array(6*e>>3);for(let i=0,o=0,c=0,_=0;i<e;i++)_=_<<6|t[n.charCodeAt(i)],c+=6,c>=8&&(r[o++]=_>>(c-=8));return r}function Dw(n){return n&1?~n>>1:n>>1}function Lw(n,t){let e=Array(n);for(let r=0,i=0;r<n;r++)e[r]=i+=Dw(t());return e}function Ki(n,t=0){let e=[];for(;;){let r=n(),i=n();if(!i)break;t+=r;for(let o=0;o<i;o++)e.push(t+o);t+=i+1}return e}function v_(n){return Vi(()=>{let t=Ki(n);if(t.length)return t})}function k_(n){let t=[];for(;;){let e=n();if(e==0)break;t.push(Mw(e,n))}for(;;){let e=n()-1;if(e<0)break;t.push(jw(e,n))}return t.flat()}function Vi(n){let t=[];for(;;){let e=n(t.length);if(!e)break;t.push(e)}return t}function S_(n,t,e){let r=Array(n).fill().map(()=>[]);for(let i=0;i<t;i++)Lw(n,e).forEach((o,c)=>r[c].push(o));return r}function Mw(n,t){let e=1+t(),r=t(),i=Vi(t);return S_(i.length,1+n,t).flatMap((c,_)=>{let[l,...u]=c;return Array(i[_]).fill().map((h,f)=>{let d=f*r;return[l+f*e,u.map(y=>y+d)]})})}function jw(n,t){let e=1+t();return S_(e,1+n,t).map(i=>[i[0],i.slice(1)])}function Gw(n){let t=[],e=Ki(n);return i(r([]),[]),t;function r(o){let c=n(),_=Vi(()=>{let l=Ki(n).map(u=>e[u]);if(l.length)return r(l)});return{S:c,B:_,Q:o}}function i({S:o,B:c},_,l){if(!(o&4&&l===_[_.length-1])){o&2&&(l=_[_.length-1]),o&1&&t.push(_);for(let u of c)for(let h of u.Q)i(u,[..._,h],l)}}}function Hw(n){return n.toString(16).toUpperCase().padStart(2,"0")}function B_(n){return`{${Hw(n)}}`}function Kw(n){let t=[];for(let e=0,r=n.length;e<r;){let i=n.codePointAt(e);e+=i<65536?1:2,t.push(i)}return t}function fi(n){let e=n.length;if(e<4096)return String.fromCodePoint(...n);let r=[];for(let i=0;i<e;)r.push(String.fromCodePoint(...n.slice(i,i+=4096)));return r.join("")}function Vw(n,t){let e=n.length,r=e-t.length;for(let i=0;r==0&&i<e;i++)r=n[i]-t[i];return r}var Qw="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";const Qi=44032,Ls=4352,Ms=4449,js=4519,T_=19,C_=21,hi=28,Gs=C_*hi,Jw=T_*Gs,$w=Qi+Jw,Ww=Ls+T_,Zw=Ms+C_,qw=js+hi;function Ji(n){return n>>24&255}function O_(n){return n&16777215}let Yo,N_,Xo,Hs;function Yw(){let n=I_(Qw);Yo=new Map(v_(n).flatMap((t,e)=>t.map(r=>[r,e+1<<24]))),N_=new Set(Ki(n)),Xo=new Map,Hs=new Map;for(let[t,e]of k_(n)){if(!N_.has(t)&&e.length==2){let[r,i]=e,o=Hs.get(r);o||(o=new Map,Hs.set(r,o)),o.set(i,t)}Xo.set(t,e.reverse())}}function F_(n){return n>=Qi&&n<$w}function Xw(n,t){if(n>=Ls&&n<Ww&&t>=Ms&&t<Zw)return Qi+(n-Ls)*Gs+(t-Ms)*hi;if(F_(n)&&t>js&&t<qw&&(n-Qi)%hi==0)return n+(t-js);{let e=Hs.get(n);return e&&(e=e.get(t),e)?e:-1}}function U_(n){Yo||Yw();let t=[],e=[],r=!1;function i(o){let c=Yo.get(o);c&&(r=!0,o|=c),t.push(o)}for(let o of n)for(;;){if(o<128)t.push(o);else if(F_(o)){let c=o-Qi,_=c/Gs|0,l=c%Gs/hi|0,u=c%hi;i(Ls+_),i(Ms+l),u>0&&i(js+u)}else{let c=Xo.get(o);c?e.push(...c):i(o)}if(!e.length)break;o=e.pop()}if(r&&t.length>1){let o=Ji(t[0]);for(let c=1;c<t.length;c++){let _=Ji(t[c]);if(_==0||o<=_){o=_;continue}let l=c-1;for(;;){let u=t[l+1];if(t[l+1]=t[l],t[l]=u,!l||(o=Ji(t[--l]),o<=_))break}o=Ji(t[c])}}return t}function tg(n){let t=[],e=[],r=-1,i=0;for(let o of n){let c=Ji(o),_=O_(o);if(r==-1)c==0?r=_:t.push(_);else if(i>0&&i>=c)c==0?(t.push(r,...e),e.length=0,r=_):e.push(_),i=c;else{let l=Xw(r,_);l>=0?r=l:i==0&&c==0?(t.push(r),r=_):(e.push(_),i=c)}}return r>=0&&t.push(r,...e),t}function D_(n){return U_(n).map(O_)}function eg(n){return tg(U_(n))}const L_=45,M_=".",j_=65039,G_=1,Ks=n=>Array.from(n);function $i(n,t){return n.P.has(t)||n.Q.has(t)}class rg extends Array{get is_emoji(){return!0}}let ta,H_,Fn,ea,K_,pi,ra,di,Un,V_,na;function ia(){if(ta)return;let n=I_(Ow);const t=()=>Ki(n),e=()=>new Set(t()),r=(h,f)=>f.forEach(d=>h.add(d));ta=new Map(k_(n)),H_=e(),Fn=t(),ea=new Set(t().map(h=>Fn[h])),Fn=new Set(Fn),K_=e(),e();let i=v_(n),o=n();const c=()=>{let h=new Set;return t().forEach(f=>r(h,i[f])),r(h,t()),h};pi=Vi(h=>{let f=Vi(n).map(d=>d+96);if(f.length){let d=h>=o;f[0]-=32,f=fi(f),d&&(f=`Restricted[${f}]`);let y=c(),R=c(),E=!n();return{N:f,P:y,Q:R,M:E,R:d}}}),ra=e(),di=new Map;let _=t().concat(Ks(ra)).sort((h,f)=>h-f);_.forEach((h,f)=>{let d=n(),y=_[f]=d?_[f-d]:{V:[],M:new Map};y.V.push(h),ra.has(h)||di.set(h,y)});for(let{V:h,M:f}of new Set(di.values())){let d=[];for(let R of h){let E=pi.filter(z=>$i(z,R)),x=d.find(({G:z})=>E.some(k=>z.has(k)));x||(x={G:new Set,V:[]},d.push(x)),x.V.push(R),r(x.G,E)}let y=d.flatMap(R=>Ks(R.G));for(let{G:R,V:E}of d){let x=new Set(y.filter(z=>!R.has(z)));for(let z of E)f.set(z,x)}}Un=new Set;let l=new Set;const u=h=>Un.has(h)?l.add(h):Un.add(h);for(let h of pi){for(let f of h.P)u(f);for(let f of h.Q)u(f)}for(let h of Un)!di.has(h)&&!l.has(h)&&di.set(h,G_);r(Un,D_(Un)),V_=Gw(n).map(h=>rg.from(h)).sort(Vw),na=new Map;for(let h of V_){let f=[na];for(let d of h){let y=f.map(R=>{let E=R.get(d);return E||(E=new Map,R.set(d,E)),E});d===j_?f.push(...y):f=y}for(let d of f)d.V=h}}function sa(n){return(Q_(n)?"":`${oa(Vs([n]))} `)+B_(n)}function oa(n){return`"${n}"`}function ng(n){if(n.length>=4&&n[2]==L_&&n[3]==L_)throw new Error(`invalid label extension: "${fi(n.slice(0,4))}"`)}function ig(n){for(let e=n.lastIndexOf(95);e>0;)if(n[--e]!==95)throw new Error("underscore allowed only at start")}function sg(n){let t=n[0],e=z_.get(t);if(e)throw Wi(`leading ${e}`);let r=n.length,i=-1;for(let o=1;o<r;o++){t=n[o];let c=z_.get(t);if(c){if(i==o)throw Wi(`${e} + ${c}`);i=o+1,e=c}}if(i==r)throw Wi(`trailing ${e}`)}function Vs(n,t=1/0,e=B_){let r=[];og(n[0])&&r.push("◌"),n.length>t&&(t>>=1,n=[...n.slice(0,t),8230,...n.slice(-t)]);let i=0,o=n.length;for(let c=0;c<o;c++){let _=n[c];Q_(_)&&(r.push(fi(n.slice(i,c))),r.push(e(_)),i=c+1)}return r.push(fi(n.slice(i,o))),r.join("")}function og(n){return ia(),Fn.has(n)}function Q_(n){return ia(),K_.has(n)}function ag(n){return ug(cg(n,eg,pg))}function cg(n,t,e){if(!n)return[];ia();let r=0;return n.split(M_).map(i=>{let o=Kw(i),c={input:o,offset:r};r+=o.length+1;try{let _=c.tokens=hg(o,t,e),l=_.length,u;if(!l)throw new Error("empty label");let h=c.output=_.flat();if(ig(h),!(c.emoji=l>1||_[0].is_emoji)&&h.every(d=>d<128))ng(h),u="ASCII";else{let d=_.flatMap(y=>y.is_emoji?[]:y);if(!d.length)u="Emoji";else{if(Fn.has(h[0]))throw Wi("leading combining mark");for(let E=1;E<l;E++){let x=_[E];if(!x.is_emoji&&Fn.has(x[0]))throw Wi(`emoji + combining mark: "${fi(_[E-1])} + ${Vs([x[0]])}"`)}sg(h);let y=Ks(new Set(d)),[R]=lg(y);fg(R,d),_g(R,y),u=R.N}}c.type=u}catch(_){c.error=_}return c})}function _g(n,t){let e,r=[];for(let i of t){let o=di.get(i);if(o===G_)return;if(o){let c=o.M.get(i);if(e=e?e.filter(_=>c.has(_)):Ks(c),!e.length)return}else r.push(i)}if(e){for(let i of e)if(r.every(o=>$i(i,o)))throw new Error(`whole-script confusable: ${n.N}/${i.N}`)}}function lg(n){let t=pi;for(let e of n){let r=t.filter(i=>$i(i,e));if(!r.length)throw pi.some(i=>$i(i,e))?$_(t[0],e):J_(e);if(t=r,r.length==1)break}return t}function ug(n){return n.map(({input:t,error:e,output:r})=>{if(e){let i=e.message;throw new Error(n.length==1?i:`Invalid label ${oa(Vs(t,63))}: ${i}`)}return fi(r)}).join(M_)}function J_(n){return new Error(`disallowed character: ${sa(n)}`)}function $_(n,t){let e=sa(t),r=pi.find(i=>i.P.has(t));return r&&(e=`${r.N} ${e}`),new Error(`illegal mixture: ${n.N} + ${e}`)}function Wi(n){return new Error(`illegal placement: ${n}`)}function fg(n,t){for(let e of t)if(!$i(n,e))throw $_(n,e);if(n.M){let e=D_(t);for(let r=1,i=e.length;r<i;r++)if(ea.has(e[r])){let o=r+1;for(let c;o<i&&ea.has(c=e[o]);o++)for(let _=r;_<o;_++)if(e[_]==c)throw new Error(`duplicate non-spacing marks: ${sa(c)}`);if(o-r>P_)throw new Error(`excessive non-spacing marks: ${oa(Vs(e.slice(r-1,o)))} (${o-r}/${P_})`);r=o}}}function hg(n,t,e){let r=[],i=[];for(n=n.slice().reverse();n.length;){let o=dg(n);if(o)i.length&&(r.push(t(i)),i=[]),r.push(e(o));else{let c=n.pop();if(Un.has(c))i.push(c);else{let _=ta.get(c);if(_)i.push(..._);else if(!H_.has(c))throw J_(c)}}}return i.length&&r.push(t(i)),r}function pg(n){return n.filter(t=>t!=j_)}function dg(n,t){let e=na,r,i=n.length;for(;i&&(e=e.get(n[--i]),!!e);){let{V:o}=e;o&&(r=o,n.length=i)}return r}const W_=new Uint8Array(32);W_.fill(0);function Z_(n){return g(n.length!==0,"invalid ENS name; empty component","comp",n),n}function q_(n){const t=Gr(wg(n)),e=[];if(n.length===0)return e;let r=0;for(let i=0;i<t.length;i++)t[i]===46&&(e.push(Z_(t.slice(r,i))),r=i+1);return g(r<t.length,"invalid ENS name; empty component","name",n),e.push(Z_(t.slice(r))),e}function wg(n){try{if(n.length===0)throw new Error("empty label");return ag(n)}catch(t){g(!1,`invalid ENS name (${t.message})`,"name",n)}}function aa(n){g(typeof n=="string","invalid ENS name; not a string","name",n),g(n.length,"invalid ENS name (empty label)","name",n);let t=W_;const e=q_(n);for(;e.length;)t=dt(lt([t,dt(e.pop())]));return O(t)}function gg(n,t){const e=t;return g(e<=255,"DNS encoded label cannot exceed 255","length",e),O(lt(q_(n).map(r=>{g(r.length<=e,`label ${JSON.stringify(n)} exceeds ${e} bytes`,"name",n);const i=new Uint8Array(r.length+1);return i.set(r,1),i[0]=i.length-1,i})))+"00"}const yg=new RegExp("^bytes([0-9]+)$"),bg=new RegExp("^(u?int)([0-9]*)$"),mg=new RegExp("^(.*)\\[([0-9]*)\\]$");function Y_(n,t,e){switch(n){case"address":return J(e?qt(t,32):Y(t));case"string":return Gr(t);case"bytes":return J(t);case"bool":return t=t?"0x01":"0x00",J(e?qt(t,32):t)}let r=n.match(bg);if(r){let i=r[1]==="int",o=parseInt(r[2]||"256");return g((!r[2]||r[2]===String(o))&&o%8===0&&o!==0&&o<=256,"invalid number type","type",n),e&&(o=256),i&&(t=Ro(t,o)),J(qt(Et(t),o/8))}if(r=n.match(yg),r){const i=parseInt(r[1]);return g(String(i)===r[1]&&i!==0&&i<=32,"invalid bytes type","type",n),g(vn(t)===i,`invalid value for ${n}`,"value",t),e?J(nc(t,32)):t}if(r=n.match(mg),r&&Array.isArray(t)){const i=r[1],o=parseInt(r[2]||String(t.length));g(o===t.length,`invalid array length for ${n}`,"value",t);const c=[];return t.forEach(function(_){c.push(Y_(i,_,!0))}),J(lt(c))}g(!1,"invalid type","type",n)}function X_(n,t){g(n.length===t.length,"wrong number of values; expected ${ types.length }","values",t);const e=[];return n.forEach(function(r,i){e.push(Y_(r,t[i]))}),O(lt(e))}const tl=new Uint8Array(32);tl.fill(0);const Ag=BigInt(-1),el=BigInt(0),rl=BigInt(1),Eg=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function xg(n){const t=J(n),e=t.length%32;return e?lt([t,tl.slice(e)]):O(t)}const Rg=cn(rl,32),zg=cn(el,32),nl={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ca=["name","version","chainId","verifyingContract","salt"];function il(n){return function(t){return g(typeof t=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,t),t}}const Pg={name:il("name"),version:il("version"),chainId:function(n){const t=M(n,"domain.chainId");return g(t>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(t)?Number(t):oe(t)},verifyingContract:function(n){try{return Y(n).toLowerCase()}catch{}g(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const t=J(n,"domain.salt");return g(t.length===32,'invalid domain value "salt"',"domain.salt",n),O(t)}};function _a(n){{const t=n.match(/^(u?)int(\d+)$/);if(t){const e=t[1]==="",r=parseInt(t[2]);g(r%8===0&&r!==0&&r<=256&&t[2]===String(r),"invalid numeric width","type",n);const i=Ui(Eg,e?r-1:r),o=e?(i+rl)*Ag:el;return function(c){const _=M(c,"value");return g(_>=o&&_<=i,`value out-of-bounds for ${n}`,"value",_),cn(e?Ro(_,256):_,32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const e=parseInt(t[1]);return g(e!==0&&e<=32&&t[1]===String(e),"invalid bytes width","type",n),function(r){const i=J(r);return g(i.length===e,`invalid length for ${n}`,"value",r),xg(r)}}}switch(n){case"address":return function(t){return qt(Y(t),32)};case"bool":return function(t){return t?Rg:zg};case"bytes":return function(t){return dt(t)};case"string":return function(t){return Nn(t)}}return null}function sl(n,t){return`${n}(${t.map(({name:e,type:r})=>r+" "+e).join(",")})`}function Qs(n){const t=n.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return t?{base:t[1],index:t[2]+t[4],array:{base:t[1],prefix:t[1]+t[2],count:t[5]?parseInt(t[5]):-1}}:{base:n}}class Mt{primaryType;#t;get types(){return JSON.parse(this.#t)}#e;#r;constructor(t){this.#e=new Map,this.#r=new Map;const e=new Map,r=new Map,i=new Map,o={};Object.keys(t).forEach(l=>{o[l]=t[l].map(({name:u,type:h})=>{let{base:f,index:d}=Qs(h);return f==="int"&&!t.int&&(f="int256"),f==="uint"&&!t.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),e.set(l,new Set),r.set(l,[]),i.set(l,new Set)}),this.#t=JSON.stringify(o);for(const l in o){const u=new Set;for(const h of o[l]){g(!u.has(h.name),`duplicate variable name ${JSON.stringify(h.name)} in ${JSON.stringify(l)}`,"types",t),u.add(h.name);const f=Qs(h.type).base;g(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",t),!_a(f)&&(g(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",t),r.get(f).push(l),e.get(l).add(f))}}const c=Array.from(r.keys()).filter(l=>r.get(l).length===0);g(c.length!==0,"missing primary type","types",t),g(c.length===1,`ambiguous primary types or unused types: ${c.map(l=>JSON.stringify(l)).join(", ")}`,"types",t),V(this,{primaryType:c[0]});function _(l,u){g(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",t),u.add(l);for(const h of e.get(l))if(r.has(h)){_(h,u);for(const f of u)i.get(f).add(h)}u.delete(l)}_(this.primaryType,new Set);for(const[l,u]of i){const h=Array.from(u);h.sort(),this.#e.set(l,sl(l,o[l])+h.map(f=>sl(f,o[f])).join(""))}}getEncoder(t){let e=this.#r.get(t);return e||(e=this.#n(t),this.#r.set(t,e)),e}#n(t){{const i=_a(t);if(i)return i}const e=Qs(t).array;if(e){const i=e.prefix,o=this.getEncoder(i);return c=>{g(e.count===-1||e.count===c.length,`array length mismatch; expected length ${e.count}`,"value",c);let _=c.map(o);return this.#e.has(i)&&(_=_.map(dt)),dt(lt(_))}}const r=this.types[t];if(r){const i=Nn(this.#e.get(t));return o=>{const c=r.map(({name:_,type:l})=>{const u=this.getEncoder(l)(o[_]);return this.#e.has(l)?dt(u):u});return c.unshift(i),lt(c)}}g(!1,`unknown type: ${t}`,"type",t)}encodeType(t){const e=this.#e.get(t);return g(e,`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return dt(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(_a(t))return r(t,e);const i=Qs(t).array;if(i)return g(i.count===-1||i.count===e.length,`array length mismatch; expected length ${i.count}`,"value",e),e.map(c=>this._visit(i.prefix,c,r));const o=this.types[t];if(o)return o.reduce((c,{name:_,type:l})=>(c[_]=this._visit(l,e[_],r),c),{});g(!1,`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Mt(t)}static getPrimaryType(t){return Mt.from(t).primaryType}static hashStruct(t,e,r){return Mt.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){if(t[r]==null)continue;const i=nl[r];g(i,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort((r,i)=>ca.indexOf(r.name)-ca.indexOf(i.name)),Mt.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return lt(["0x1901",Mt.hashDomain(t),Mt.from(e).hash(r)])}static hash(t,e,r){return dt(Mt.encode(t,e,r))}static async resolveNames(t,e,r,i){t=Object.assign({},t);for(const _ in t)t[_]==null&&delete t[_];const o={};t.verifyingContract&&!ot(t.verifyingContract,20)&&(o[t.verifyingContract]="0x");const c=Mt.from(e);c.visit(r,(_,l)=>(_==="address"&&!ot(l,20)&&(o[l]="0x"),l));for(const _ in o)o[_]=await i(_);return t.verifyingContract&&o[t.verifyingContract]&&(t.verifyingContract=o[t.verifyingContract]),r=c.visit(r,(_,l)=>_==="address"&&o[l]?o[l]:l),{domain:t,value:r}}static getPayload(t,e,r){Mt.hashDomain(t);const i={},o=[];ca.forEach(l=>{const u=t[l];u!=null&&(i[l]=Pg[l](u),o.push({name:l,type:nl[l]}))});const c=Mt.from(e);e=c.types;const _=Object.assign({},e);return g(_.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",e),_.EIP712Domain=o,c.encode(r),{types:_,domain:i,primaryType:c.primaryType,message:c.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return O(J(u));if(l.match(/^u?int/))return M(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return g(typeof u=="string","invalid string","value",u),u}g(!1,"unsupported type","type",l)})}}}function la(n,t,e,r){return x_(Mt.hash(n,t,e),r)}function Dt(n){const t=new Set;return n.forEach(e=>t.add(e)),Object.freeze(t)}const Ig=Dt("external public payable override".split(" ")),ol="constant external internal payable private public pure view override",vg=Dt(ol.split(" ")),al="constructor error event fallback function receive struct",cl=Dt(al.split(" ")),_l="calldata memory storage payable indexed",kg=Dt(_l.split(" ")),Sg=[al,_l,"tuple returns",ol].join(" "),Bg=Dt(Sg.split(" ")),Tg={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Cg=new RegExp("^(\\s*)"),Og=new RegExp("^([0-9]+)"),Ng=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),ll=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),ul=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class te{#t;#e;get offset(){return this.#t}get length(){return this.#e.length-this.#t}constructor(t){this.#t=0,this.#e=t.slice()}clone(){return new te(this.#e)}reset(){this.#t=0}#r(t=0,e=0){return new te(this.#e.slice(t,e).map(r=>Object.freeze(Object.assign({},r,{match:r.match-t,linkBack:r.linkBack-t,linkNext:r.linkNext-t}))))}popKeyword(t){const e=this.peek();if(e.type!=="KEYWORD"||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){const e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){const t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");const e=this.#r(this.#t+1,t.match+1);return this.#t=t.match+1,e}popParams(){const t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");const e=[];for(;this.#t<t.match-1;){const r=this.peek().linkNext;e.push(this.#r(this.#t+1,r)),this.#t=r}return this.#t=t.match+1,e}peek(){if(this.#t>=this.#e.length)throw new Error("out-of-bounds");return this.#e[this.#t]}peekKeyword(t){const e=this.peekType("KEYWORD");return e!=null&&t.has(e)?e:null}peekType(t){if(this.length===0)return null;const e=this.peek();return e.type===t?e.text:null}pop(){const t=this.peek();return this.#t++,t}toString(){const t=[];for(let e=this.#t;e<this.#e.length;e++){const r=this.#e[e];t.push(`${r.type}:${r.text}`)}return`<TokenString ${t.join(" ")}>`}}function wn(n){const t=[],e=c=>{const _=o<n.length?JSON.stringify(n[o]):"$EOI";throw new Error(`invalid token ${_} at ${o}: ${c}`)};let r=[],i=[],o=0;for(;o<n.length;){let c=n.substring(o),_=c.match(Cg);_&&(o+=_[1].length,c=n.substring(o));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:o,value:-1};t.push(l);let u=Tg[c[0]]||"";if(u){if(l.type=u,l.text=c[0],o++,u==="OPEN_PAREN")r.push(t.length-1),i.push(t.length-1);else if(u=="CLOSE_PAREN")r.length===0&&e("no matching open bracket"),l.match=r.pop(),t[l.match].match=t.length-1,l.depth--,l.linkBack=i.pop(),t[l.linkBack].linkNext=t.length-1;else if(u==="COMMA")l.linkBack=i.pop(),t[l.linkBack].linkNext=t.length-1,i.push(t.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let h=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){const f=t.pop().text;h=f+h,t[t.length-1].value=q(f)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=h}continue}if(_=c.match(Ng),_){if(l.text=_[1],o+=l.text.length,Bg.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(ul)){l.type="TYPE";continue}l.type="ID";continue}if(_=c.match(Og),_){l.text=_[1],l.type="NUMBER",o+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(c[0])} at position ${o}`)}return new te(t.map(c=>Object.freeze(c)))}function fl(n,t){let e=[];for(const r in t.keys())n.has(r)&&e.push(r);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}function Js(n,t){if(t.peekKeyword(cl)){const e=t.pop().text;if(e!==n)throw new Error(`expected ${n}, got ${e}`)}return t.popType("ID")}function nn(n,t){const e=new Set;for(;;){const r=n.peekType("KEYWORD");if(r==null||t&&!t.has(r))break;if(n.pop(),e.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);e.add(r)}return Object.freeze(e)}function hl(n){let t=nn(n,vg);return fl(t,Dt("constant payable nonpayable".split(" "))),fl(t,Dt("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}function sn(n,t){return n.popParams().map(e=>at.from(e,t))}function pl(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return M(n.pop().text);throw new Error("invalid gas")}return null}function Dn(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const Fg=new RegExp(/^(.*)\[([0-9]*)\]$/);function dl(n){const t=n.match(ul);if(g(t,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(t[2]){const e=parseInt(t[2]);g(e!==0&&e<=32,"invalid bytes length","type",n)}else if(t[3]){const e=parseInt(t[3]);g(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",n)}return n}const ht={},jt=Symbol.for("_ethers_internal"),wl="_ParamTypeInternal",gl="_ErrorInternal",yl="_EventInternal",bl="_ConstructorInternal",ml="_FallbackInternal",Al="_FunctionInternal",El="_StructInternal";class at{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,r,i,o,c,_,l){if(Es(t,ht,"ParamType"),Object.defineProperty(this,jt,{value:wl}),c&&(c=Object.freeze(c.slice())),i==="array"){if(_==null||l==null)throw new Error("")}else if(_!=null||l!=null)throw new Error("");if(i==="tuple"){if(c==null)throw new Error("")}else if(c!=null)throw new Error("");V(this,{name:e,type:r,baseType:i,indexed:o,components:c,arrayLength:_,arrayChildren:l})}format(t){if(t==null&&(t="sighash"),t==="json"){const r=this.name||"";if(this.isArray()){const o=JSON.parse(this.arrayChildren.format("json"));return o.name=r,o.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(o)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(o=>JSON.parse(o.format(t)))),JSON.stringify(i)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(r=>r.format(t)).join(t==="full"?", ":",")+")":e+=this.type,t!=="sighash"&&(this.indexed===!0&&(e+=" indexed"),t==="full"&&this.name&&(e+=" "+this.name)),e}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return t.map(i=>r.arrayChildren.walk(i,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 r=this;return t.map((i,o)=>r.components[o].walk(i,e))}return e(this.type,t)}#t(t,e,r,i){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const c=this.arrayChildren,_=e.slice();_.forEach((l,u)=>{c.#t(t,l,r,h=>{_[u]=h})}),i(_);return}if(this.isTuple()){const c=this.components;let _;if(Array.isArray(e))_=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");_=c.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in e))throw new Error(`missing value for component ${l.name}`);return e[l.name]})}if(_.length!==this.components.length)throw new Error("array is wrong length");_.forEach((l,u)=>{c[u].#t(t,l,r,h=>{_[u]=h})}),i(_);return}const o=r(this.type,e);o.then?t.push(async function(){i(await o)}()):i(o)}async walkAsync(t,e){const r=[],i=[t];return this.#t(r,t,e,o=>{i[0]=o}),r.length&&await Promise.all(r),i[0]}static from(t,e){if(at.isParamType(t))return t;if(typeof t=="string")try{return at.from(wn(t),e)}catch{g(!1,"invalid param type","obj",t)}else if(t instanceof te){let _="",l="",u=null;nn(t,Dt(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(l="tuple",u=t.popParams().map(E=>at.from(E)),_=`tuple(${u.map(E=>E.format()).join(",")})`):(_=dl(t.popType("TYPE")),l=_);let h=null,f=null;for(;t.length&&t.peekType("BRACKET");){const E=t.pop();h=new at(ht,"",_,l,null,u,f,h),f=E.value,_+=E.text,l="array",u=null}let d=null;if(nn(t,kg).has("indexed")){if(!e)throw new Error("");d=!0}const R=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new at(ht,R,_,l,d,u,f,h)}const r=t.name;g(!r||typeof r=="string"&&r.match(ll),"invalid name","obj.name",r);let i=t.indexed;i!=null&&(g(e,"parameter cannot be indexed","obj.indexed",t.indexed),i=!!i);let o=t.type,c=o.match(Fg);if(c){const _=parseInt(c[2]||"-1"),l=at.from({type:c[1],components:t.components});return new at(ht,r||"",o,"array",i,null,_,l)}if(o==="tuple"||o.startsWith("tuple(")||o.startsWith("(")){const _=t.components!=null?t.components.map(u=>at.from(u)):null;return new at(ht,r||"",o,"tuple",i,_,null,null)}return o=dl(t.type),new at(ht,r||"",o,o,i,null,null,null)}static isParamType(t){return t&&t[jt]===wl}}class Ln{type;inputs;constructor(t,e,r){Es(t,ht,"Fragment"),r=Object.freeze(r.slice()),V(this,{type:e,inputs:r})}static from(t){if(typeof t=="string"){try{Ln.from(JSON.parse(t))}catch{}return Ln.from(wn(t))}if(t instanceof te)switch(t.peekKeyword(cl)){case"constructor":return on.from(t);case"error":return Gt.from(t);case"event":return Vr.from(t);case"fallback":case"receive":return an.from(t);case"function":return Qr.from(t);case"struct":return Mn.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return on.from(t);case"error":return Gt.from(t);case"event":return Vr.from(t);case"fallback":case"receive":return an.from(t);case"function":return Qr.from(t);case"struct":return Mn.from(t)}I(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}g(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return on.isFragment(t)}static isError(t){return Gt.isFragment(t)}static isEvent(t){return Vr.isFragment(t)}static isFunction(t){return Qr.isFragment(t)}static isStruct(t){return Mn.isFragment(t)}}class $s extends Ln{name;constructor(t,e,r,i){super(t,e,i),g(typeof r=="string"&&r.match(ll),"invalid identifier","name",r),i=Object.freeze(i.slice()),V(this,{name:r})}}function Zi(n,t){return"("+t.map(e=>e.format(n)).join(n==="full"?", ":",")+")"}class Gt extends $s{constructor(t,e,r){super(t,"error",e,r),Object.defineProperty(this,jt,{value:gl})}get selector(){return Nn(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+Zi(t,this.inputs)),e.join(" ")}static from(t){if(Gt.isFragment(t))return t;if(typeof t=="string")return Gt.from(wn(t));if(t instanceof te){const e=Js("error",t),r=sn(t);return Dn(t),new Gt(ht,e,r)}return new Gt(ht,t.name,t.inputs?t.inputs.map(at.from):[])}static isFragment(t){return t&&t[jt]===gl}}class Vr extends $s{anonymous;constructor(t,e,r,i){super(t,"event",e,r),Object.defineProperty(this,jt,{value:yl}),V(this,{anonymous:i})}get topicHash(){return Nn(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+Zi(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(i=>at.from(i)),new Vr(ht,t,e,!1).topicHash}static from(t){if(Vr.isFragment(t))return t;if(typeof t=="string")try{return Vr.from(wn(t))}catch{g(!1,"invalid event fragment","obj",t)}else if(t instanceof te){const e=Js("event",t),r=sn(t,!0),i=!!nn(t,Dt(["anonymous"])).has("anonymous");return Dn(t),new Vr(ht,e,r,i)}return new Vr(ht,t.name,t.inputs?t.inputs.map(e=>at.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[jt]===yl}}class on extends Ln{payable;gas;constructor(t,e,r,i,o){super(t,e,r),Object.defineProperty(this,jt,{value:bl}),V(this,{payable:i,gas:o})}format(t){if(I(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const e=[`constructor${Zi(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(on.isFragment(t))return t;if(typeof t=="string")try{return on.from(wn(t))}catch{g(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof te){nn(t,Dt(["constructor"]));const e=sn(t),r=!!nn(t,Ig).has("payable"),i=pl(t);return Dn(t),new on(ht,"constructor",e,r,i)}return new on(ht,"constructor",t.inputs?t.inputs.map(at.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[jt]===bl}}class an extends Ln{payable;constructor(t,e,r){super(t,"fallback",e),Object.defineProperty(this,jt,{value:ml}),V(this,{payable:r})}format(t){const e=this.inputs.length===0?"receive":"fallback";if(t==="json"){const r=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:r})}return`${e}()${this.payable?" payable":""}`}static from(t){if(an.isFragment(t))return t;if(typeof t=="string")try{return an.from(wn(t))}catch{g(!1,"invalid fallback fragment","obj",t)}else if(t instanceof te){const e=t.toString(),r=t.peekKeyword(Dt(["fallback","receive"]));if(g(r,"type must be fallback or receive","obj",e),t.popKeyword(Dt(["fallback","receive"]))==="receive"){const _=sn(t);return g(_.length===0,"receive cannot have arguments","obj.inputs",_),nn(t,Dt(["payable"])),Dn(t),new an(ht,[],!0)}let o=sn(t);o.length?g(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(_=>_.format("minimal")).join(", ")):o=[at.from("bytes")];const c=hl(t);if(g(c==="nonpayable"||c==="payable","fallback cannot be constants","obj.stateMutability",c),nn(t,Dt(["returns"])).has("returns")){const _=sn(t);g(_.length===1&&_[0].type==="bytes","invalid fallback outputs","obj.outputs",_.map(l=>l.format("minimal")).join(", "))}return Dn(t),new an(ht,o,c==="payable")}if(t.type==="receive")return new an(ht,[],!0);if(t.type==="fallback"){const e=[at.from("bytes")],r=t.stateMutability==="payable";return new an(ht,e,r)}g(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[jt]===ml}}class Qr extends $s{constant;outputs;stateMutability;payable;gas;constructor(t,e,r,i,o,c){super(t,"function",e,i),Object.defineProperty(this,jt,{value:Al}),o=Object.freeze(o.slice()),V(this,{constant:r==="view"||r==="pure",gas:c,outputs:o,payable:r==="payable",stateMutability:r})}get selector(){return Nn(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});const e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+Zi(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(Zi(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(i=>at.from(i)),new Qr(ht,t,"view",e,[],null).selector}static from(t){if(Qr.isFragment(t))return t;if(typeof t=="string")try{return Qr.from(wn(t))}catch{g(!1,"invalid function fragment","obj",t)}else if(t instanceof te){const r=Js("function",t),i=sn(t),o=hl(t);let c=[];nn(t,Dt(["returns"])).has("returns")&&(c=sn(t));const _=pl(t);return Dn(t),new Qr(ht,r,o,i,c,_)}let e=t.stateMutability;return e==null&&(e="payable",typeof t.constant=="boolean"?(e="view",t.constant||(e="payable",typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable")),new Qr(ht,t.name,e,t.inputs?t.inputs.map(at.from):[],t.outputs?t.outputs.map(at.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[jt]===Al}}class Mn extends $s{constructor(t,e,r){super(t,"struct",e,r),Object.defineProperty(this,jt,{value:El})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return Mn.from(wn(t))}catch{g(!1,"invalid struct fragment","obj",t)}else if(t instanceof te){const e=Js("struct",t),r=sn(t);return Dn(t),new Mn(ht,e,r)}return new Mn(ht,t.name,t.inputs?t.inputs.map(at.from):[])}static isFragment(t){return t&&t[jt]===El}}const _e=new Map;_e.set(0,"GENERIC_PANIC"),_e.set(1,"ASSERT_FALSE"),_e.set(17,"OVERFLOW"),_e.set(18,"DIVIDE_BY_ZERO"),_e.set(33,"ENUM_RANGE_ERROR"),_e.set(34,"BAD_STORAGE_DATA"),_e.set(49,"STACK_UNDERFLOW"),_e.set(50,"ARRAY_RANGE_ERROR"),_e.set(65,"OUT_OF_MEMORY"),_e.set(81,"UNINITIALIZED_FUNCTION_CALL");const Ug=new RegExp(/^bytes([0-9]*)$/),Dg=new RegExp(/^(u?int)([0-9]*)$/);let ua=null,xl=1024;function Lg(n,t,e,r){let i="missing revert data",o=null;const c=null;let _=null;if(e){i="execution reverted";const u=J(e);if(e=O(e),u.length===0)i+=" (no data present; likely require(false) occurred",o="require(false)";else if(u.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(O(u.slice(0,4))==="0x08c379a0")try{o=r.decode(["string"],u.slice(4))[0],_={signature:"Error(string)",name:"Error",args:[o]},i+=`: ${JSON.stringify(o)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(O(u.slice(0,4))==="0x4e487b71")try{const h=Number(r.decode(["uint256"],u.slice(4))[0]);_={signature:"Panic(uint256)",name:"Panic",args:[h]},o=`Panic due to ${_e.get(h)||"UNKNOWN"}(${h})`,i+=`: ${o}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const l={to:t.to?Y(t.to):null,data:t.data||"0x"};return t.from&&(l.from=Y(t.from)),ft(i,"CALL_EXCEPTION",{action:n,data:e,reason:o,transaction:l,invocation:c,revert:_})}class gn{#t(t){if(t.isArray())return new nw(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new Ns(t.components.map(r=>this.#t(r)),t.name);switch(t.baseType){case"address":return new ew(t.name);case"bool":return new iw(t.name);case"string":return new hw(t.name);case"bytes":return new sw(t.name);case"":return new cw(t.name)}let e=t.type.match(Dg);if(e){let r=parseInt(e[2]||"256");return g(r!==0&&r<=256&&r%8===0,"invalid "+e[1]+" bit length","param",t),new fw(r/8,e[1]==="int",t.name)}if(e=t.type.match(Ug),e){let r=parseInt(e[1]);return g(r!==0&&r<=32,"invalid bytes length","param",t),new ow(r,t.name)}g(!1,"invalid type","type",t.type)}getDefaultValue(t){const e=t.map(i=>this.#t(at.from(i)));return new Ns(e,"_").defaultValue()}encode(t,e){Xa(e.length,t.length,"types/values length mismatch");const r=t.map(c=>this.#t(at.from(c))),i=new Ns(r,"_"),o=new ko;return i.encode(o,e),o.data}decode(t,e,r){const i=t.map(c=>this.#t(at.from(c)));return new Ns(i,"_").decode(new So(e,r,xl))}static _setDefaultMaxInflation(t){g(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),xl=t}static defaultAbiCoder(){return ua==null&&(ua=new gn),ua}static getBuiltinCallException(t,e,r){return Lg(t,e,r,gn.defaultAbiCoder())}}class Mg{fragment;name;signature;topic;args;constructor(t,e,r){const i=t.name,o=t.format();V(this,{fragment:t,name:i,signature:o,topic:e,args:r})}}class jg{fragment;name;args;signature;selector;value;constructor(t,e,r,i){const o=t.name,c=t.format();V(this,{fragment:t,name:o,args:r,signature:c,selector:e,value:i})}}class Gg{fragment;name;args;signature;selector;constructor(t,e,r){const i=t.name,o=t.format();V(this,{fragment:t,name:i,args:r,signature:o,selector:e})}}class Rl{hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){V(this,{hash:t,_isIndexed:!0})}}const zl={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"},Pl={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let t="unknown panic code";return n>=0&&n<=255&&zl[n.toString()]&&(t=zl[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${t})`}}};class jn{fragments;deploy;fallback;receive;#t;#e;#r;#n;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#r=new Map,this.#t=new Map,this.#e=new Map;const r=[];for(const c of e)try{r.push(Ln.from(c))}catch(_){console.log(`[Warning] Invalid Fragment ${JSON.stringify(c)}:`,_.message)}V(this,{fragments:Object.freeze(r)});let i=null,o=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((c,_)=>{let l;switch(c.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}V(this,{deploy:c});return;case"fallback":c.inputs.length===0?o=!0:(g(!i||c.payable!==i.payable,"conflicting fallback fragments",`fragments[${_}]`,c),i=c,o=i.payable);return;case"function":l=this.#r;break;case"event":l=this.#e;break;case"error":l=this.#t;break;default:return}const u=c.format();l.has(u)||l.set(u,c)}),this.deploy||V(this,{deploy:on.from("constructor()")}),V(this,{fallback:i,receive:o})}format(t){const e=t?"minimal":"full";return this.fragments.map(i=>i.format(e))}formatJson(){const t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return gn.defaultAbiCoder()}#i(t,e,r){if(ot(t)){const o=t.toLowerCase();for(const c of this.#r.values())if(o===c.selector)return c;return null}if(t.indexOf("(")===-1){const o=[];for(const[c,_]of this.#r)c.split("(")[0]===t&&o.push(_);if(e){const c=e.length>0?e[e.length-1]:null;let _=e.length,l=!0;gt.isTyped(c)&&c.type==="overrides"&&(l=!1,_--);for(let u=o.length-1;u>=0;u--){const h=o[u].inputs.length;h!==_&&(!l||h!==_-1)&&o.splice(u,1)}for(let u=o.length-1;u>=0;u--){const h=o[u].inputs;for(let f=0;f<e.length;f++)if(gt.isTyped(e[f])){if(f>=h.length){if(e[f].type==="overrides")continue;o.splice(u,1);break}if(e[f].type!==h[f].baseType){o.splice(u,1);break}}}}if(o.length===1&&e&&e.length!==o[0].inputs.length){const c=e[e.length-1];(c==null||Array.isArray(c)||typeof c!="object")&&o.splice(0,1)}if(o.length===0)return null;if(o.length>1&&r){const c=o.map(_=>JSON.stringify(_.format())).join(", ");g(!1,`ambiguous function description (i.e. matches ${c})`,"key",t)}return o[0]}const i=this.#r.get(Qr.from(t).format());return i||null}getFunctionName(t){const e=this.#i(t,null,!1);return g(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#i(t,null,!1)}getFunction(t,e){return this.#i(t,e||null,!0)}forEachFunction(t){const e=Array.from(this.#r.keys());e.sort((r,i)=>r.localeCompare(i));for(let r=0;r<e.length;r++){const i=e[r];t(this.#r.get(i),r)}}#o(t,e,r){if(ot(t)){const o=t.toLowerCase();for(const c of this.#e.values())if(o===c.topicHash)return c;return null}if(t.indexOf("(")===-1){const o=[];for(const[c,_]of this.#e)c.split("(")[0]===t&&o.push(_);if(e){for(let c=o.length-1;c>=0;c--)o[c].inputs.length<e.length&&o.splice(c,1);for(let c=o.length-1;c>=0;c--){const _=o[c].inputs;for(let l=0;l<e.length;l++)if(gt.isTyped(e[l])&&e[l].type!==_[l].baseType){o.splice(c,1);break}}}if(o.length===0)return null;if(o.length>1&&r){const c=o.map(_=>JSON.stringify(_.format())).join(", ");g(!1,`ambiguous event description (i.e. matches ${c})`,"key",t)}return o[0]}const i=this.#e.get(Vr.from(t).format());return i||null}getEventName(t){const e=this.#o(t,null,!1);return g(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#o(t,null,!1)}getEvent(t,e){return this.#o(t,e||null,!0)}forEachEvent(t){const e=Array.from(this.#e.keys());e.sort((r,i)=>r.localeCompare(i));for(let r=0;r<e.length;r++){const i=e[r];t(this.#e.get(i),r)}}getError(t,e){if(ot(t)){const i=t.toLowerCase();if(Pl[i])return Gt.from(Pl[i].signature);for(const o of this.#t.values())if(i===o.selector)return o;return null}if(t.indexOf("(")===-1){const i=[];for(const[o,c]of this.#t)o.split("(")[0]===t&&i.push(c);if(i.length===0)return t==="Error"?Gt.from("error Error(string)"):t==="Panic"?Gt.from("error Panic(uint256)"):null;if(i.length>1){const o=i.map(c=>JSON.stringify(c.format())).join(", ");g(!1,`ambiguous error description (i.e. ${o})`,"name",t)}return i[0]}if(t=Gt.from(t).format(),t==="Error(string)")return Gt.from("error Error(string)");if(t==="Panic(uint256)")return Gt.from("error Panic(uint256)");const r=this.#t.get(t);return r||null}forEachError(t){const e=Array.from(this.#t.keys());e.sort((r,i)=>r.localeCompare(i));for(let r=0;r<e.length;r++){const i=e[r];t(this.#t.get(i),r)}}_decodeParams(t,e){return this.#n.decode(t,e)}_encodeParams(t,e){return this.#n.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){const r=this.getError(t);g(r,"unknown error","fragment",t),t=r}return g(pt(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,pt(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){const r=this.getError(t);g(r,"unknown error","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){const r=this.getFunction(t);g(r,"unknown function","fragment",t),t=r}return g(pt(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,pt(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){const r=this.getFunction(t);g(r,"unknown function","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){const o=this.getFunction(t);g(o,"unknown function","fragment",t),t=o}let r="invalid length for result data";const i=Nt(e);if(i.length%32===0)try{return this.#n.decode(t.outputs,i)}catch{r="could not decode result data"}I(!1,r,"BAD_DATA",{value:O(i),info:{method:t.name,signature:t.format()}})}makeError(t,e){const r=J(t,"data"),i=gn.getBuiltinCallException("call",e,r);if(i.message.startsWith("execution reverted (unknown custom error)")){const _=O(r.slice(0,4)),l=this.getError(_);if(l)try{const u=this.#n.decode(l.inputs,r.slice(4));i.revert={name:l.name,signature:l.format(),args:u},i.reason=i.revert.signature,i.message=`execution reverted: ${i.reason}`}catch{i.message="execution reverted (coult not decode custom error)"}}const c=this.parseTransaction(e);return c&&(i.invocation={method:c.name,signature:c.signature,args:c.args}),i}encodeFunctionResult(t,e){if(typeof t=="string"){const r=this.getFunction(t);g(r,"unknown function","fragment",t),t=r}return O(this.#n.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){const o=this.getEvent(t);g(o,"unknown event","eventFragment",t),t=o}I(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});const r=[];t.anonymous||r.push(t.topicHash);const i=(o,c)=>o.type==="string"?Nn(c):o.type==="bytes"?dt(O(c)):(o.type==="bool"&&typeof c=="boolean"?c=c?"0x01":"0x00":o.type.match(/^u?int/)?c=cn(c):o.type.match(/^bytes/)?c=nc(c,32):o.type==="address"&&this.#n.encode(["address"],[c]),qt(O(c),32));for(e.forEach((o,c)=>{const _=t.inputs[c];if(!_.indexed){g(o==null,"cannot filter non-indexed parameters; must be null","contract."+_.name,o);return}o==null?r.push(null):_.baseType==="array"||_.baseType==="tuple"?g(!1,"filtering with tuples or arrays not supported","contract."+_.name,o):Array.isArray(o)?r.push(o.map(l=>i(_,l))):r.push(i(_,o))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(t,e){if(typeof t=="string"){const c=this.getEvent(t);g(c,"unknown event","eventFragment",t),t=c}const r=[],i=[],o=[];return t.anonymous||r.push(t.topicHash),g(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((c,_)=>{const l=e[_];if(c.indexed)if(c.type==="string")r.push(Nn(l));else if(c.type==="bytes")r.push(dt(l));else{if(c.baseType==="tuple"||c.baseType==="array")throw new Error("not implemented");r.push(this.#n.encode([c.type],[l]))}else i.push(c),o.push(l)}),{data:this.#n.encode(i,o),topics:r}}decodeEventLog(t,e,r){if(typeof t=="string"){const y=this.getEvent(t);g(y,"unknown event","eventFragment",t),t=y}if(r!=null&&!t.anonymous){const y=t.topicHash;g(ot(r[0],32)&&r[0].toLowerCase()===y,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const i=[],o=[],c=[];t.inputs.forEach((y,R)=>{y.indexed?y.type==="string"||y.type==="bytes"||y.baseType==="tuple"||y.baseType==="array"?(i.push(at.from({type:"bytes32",name:y.name})),c.push(!0)):(i.push(y),c.push(!1)):(o.push(y),c.push(!1))});const _=r!=null?this.#n.decode(i,lt(r)):null,l=this.#n.decode(o,e,!0),u=[],h=[];let f=0,d=0;return t.inputs.forEach((y,R)=>{let E=null;if(y.indexed)if(_==null)E=new Rl(null);else if(c[R])E=new Rl(_[d++]);else try{E=_[d++]}catch(x){E=x}else try{E=l[f++]}catch(x){E=x}u.push(E),h.push(y.name||null)}),qr.fromItems(u,h)}parseTransaction(t){const e=J(t.data,"tx.data"),r=M(t.value!=null?t.value:0,"tx.value"),i=this.getFunction(O(e.slice(0,4)));if(!i)return null;const o=this.#n.decode(i.inputs,e.slice(4));return new jg(i,i.selector,o,r)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){const e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Mg(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){const e=O(t),r=this.getError(pt(e,0,4));if(!r)return null;const i=this.#n.decode(r.inputs,pt(e,4));return new Gg(r,r.selector,i)}static from(t){return t instanceof jn?t:typeof t=="string"?new jn(JSON.parse(t)):typeof t.formatJson=="function"?new jn(t.formatJson()):typeof t.format=="function"?new jn(t.format("json")):new jn(t)}}const Il=BigInt(0);function wi(n){return n??null}function mt(n){return n==null?null:n.toString()}class vl{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(t,e,r){V(this,{gasPrice:wi(t),maxFeePerGas:wi(e),maxPriorityFeePerGas:wi(r)})}toJSON(){const{gasPrice:t,maxFeePerGas:e,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:mt(t),maxFeePerGas:mt(e),maxPriorityFeePerGas:mt(r)}}}function Ws(n){const t={};n.to&&(t.to=n.to),n.from&&(t.from=n.from),n.data&&(t.data=O(n.data));const e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of e)!(i in n)||n[i]==null||(t[i]=M(n[i],`request.${i}`));const r="type,nonce".split(/,/);for(const i of r)!(i in n)||n[i]==null||(t[i]=q(n[i],`request.${i}`));return n.accessList&&(t.accessList=Cn(n.accessList)),n.authorizationList&&(t.authorizationList=n.authorizationList.slice()),"blockTag"in n&&(t.blockTag=n.blockTag),"enableCcipRead"in n&&(t.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(t.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(t.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(t.kzg=n.kzg),"blobs"in n&&n.blobs&&(t.blobs=n.blobs.map(i=>xo(i)?O(i):Object.assign({},i))),t}class Hg{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#t;constructor(t,e){this.#t=t.transactions.map(r=>typeof r!="string"?new Yi(r,e):r),V(this,{provider:e,hash:wi(t.hash),number:t.number,timestamp:t.timestamp,parentHash:t.parentHash,parentBeaconBlockRoot:t.parentBeaconBlockRoot,nonce:t.nonce,difficulty:t.difficulty,gasLimit:t.gasLimit,gasUsed:t.gasUsed,blobGasUsed:t.blobGasUsed,excessBlobGas:t.excessBlobGas,miner:t.miner,prevRandao:wi(t.prevRandao),extraData:t.extraData,baseFeePerGas:wi(t.baseFeePerGas),stateRoot:t.stateRoot,receiptsRoot:t.receiptsRoot})}get transactions(){return this.#t.map(t=>typeof t=="string"?t:t.hash)}get prefetchedTransactions(){const t=this.#t.slice();return t.length===0?[]:(I(typeof t[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),t)}toJSON(){const{baseFeePerGas:t,difficulty:e,extraData:r,gasLimit:i,gasUsed:o,hash:c,miner:_,prevRandao:l,nonce:u,number:h,parentHash:f,parentBeaconBlockRoot:d,stateRoot:y,receiptsRoot:R,timestamp:E,transactions:x}=this;return{_type:"Block",baseFeePerGas:mt(t),difficulty:mt(e),extraData:r,gasLimit:mt(i),gasUsed:mt(o),blobGasUsed:mt(this.blobGasUsed),excessBlobGas:mt(this.excessBlobGas),hash:c,miner:_,prevRandao:l,nonce:u,number:h,parentHash:f,timestamp:E,parentBeaconBlockRoot:d,stateRoot:y,receiptsRoot:R,transactions:x}}[Symbol.iterator](){let t=0;const e=this.transactions;return{next:()=>t<this.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#t.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(t){let e;if(typeof t=="number")e=this.#t[t];else{const r=t.toLowerCase();for(const i of this.#t)if(typeof i=="string"){if(i!==r)continue;e=i;break}else{if(i.hash!==r)continue;e=i;break}}if(e==null)throw new Error("no such tx");return typeof e=="string"?await this.provider.getTransaction(e):e}getPrefetchedTransaction(t){const e=this.prefetchedTransactions;if(typeof t=="number")return e[t];t=t.toLowerCase();for(const r of e)if(r.hash===t)return r;g(!1,"no matching transaction","indexOrHash",t)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Kg(this)}}class qi{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;const r=Object.freeze(t.topics.slice());V(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:r,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){const{address:t,blockHash:e,blockNumber:r,data:i,index:o,removed:c,topics:_,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:t,blockHash:e,blockNumber:r,data:i,index:o,removed:c,topics:_,transactionHash:l,transactionIndex:u}}async getBlock(){const t=await this.provider.getBlock(this.blockHash);return I(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){const t=await this.provider.getTransaction(this.transactionHash);return I(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){const t=await this.provider.getTransactionReceipt(this.transactionHash);return I(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return Vg(this)}}class kl{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#t;constructor(t,e){this.#t=Object.freeze(t.logs.map(i=>new qi(i,e)));let r=Il;t.effectiveGasPrice!=null?r=t.effectiveGasPrice:t.gasPrice!=null&&(r=t.gasPrice),V(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:r,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){const{to:t,from:e,contractAddress:r,hash:i,index:o,blockHash:c,blockNumber:_,logsBloom:l,logs:u,status:h,root:f}=this;return{_type:"TransactionReceipt",blockHash:c,blockNumber:_,contractAddress:r,cumulativeGasUsed:mt(this.cumulativeGasUsed),from:e,gasPrice:mt(this.gasPrice),blobGasUsed:mt(this.blobGasUsed),blobGasPrice:mt(this.blobGasPrice),gasUsed:mt(this.gasUsed),hash:i,index:o,logs:u,logsBloom:l,root:f,status:h,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(t==null)throw new Error("TODO");return t}async getTransaction(){const t=await this.provider.getTransaction(this.hash);if(t==null)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 Bl(this)}reorderedEvent(t){return I(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Sl(this,t)}}class Yi{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;authorizationList;#t;constructor(t,e){this.provider=e,this.blockNumber=t.blockNumber!=null?t.blockNumber:null,this.blockHash=t.blockHash!=null?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=t.maxPriorityFeePerGas!=null?t.maxPriorityFeePerGas:null,this.maxFeePerGas=t.maxFeePerGas!=null?t.maxFeePerGas:null,this.maxFeePerBlobGas=t.maxFeePerBlobGas!=null?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=t.accessList!=null?t.accessList:null,this.blobVersionedHashes=t.blobVersionedHashes!=null?t.blobVersionedHashes:null,this.authorizationList=t.authorizationList!=null?t.authorizationList:null,this.#t=-1}toJSON(){const{blockNumber:t,blockHash:e,index:r,hash:i,type:o,to:c,from:_,nonce:l,data:u,signature:h,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:t,blockHash:e,blobVersionedHashes:d,chainId:mt(this.chainId),data:u,from:_,gasLimit:mt(this.gasLimit),gasPrice:mt(this.gasPrice),hash:i,maxFeePerGas:mt(this.maxFeePerGas),maxPriorityFeePerGas:mt(this.maxPriorityFeePerGas),maxFeePerBlobGas:mt(this.maxFeePerBlobGas),nonce:l,signature:h,to:c,index:r,type:o,value:mt(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){const r=await this.getTransaction();r&&(t=r.blockNumber)}if(t==null)return null;const e=this.provider.getBlock(t);if(e==null)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:e,blockNumber:r}=await Ot({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:r-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){const r=t??1,i=e??0;let o=this.#t,c=-1,_=o===-1;const l=async()=>{if(_)return null;const{blockNumber:d,nonce:y}=await Ot({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(y<this.nonce){o=d;return}if(_)return null;const R=await this.getTransaction();if(!(R&&R.blockNumber!=null))for(c===-1&&(c=o-3,c<this.#t&&(c=this.#t));c<=d;){if(_)return null;const E=await this.provider.getBlock(c,!0);if(E==null)return;for(const x of E)if(x===this.hash)return;for(let x=0;x<E.length;x++){const z=await E.getTransaction(x);if(z.from===this.from&&z.nonce===this.nonce){if(_)return null;const k=await this.provider.getTransactionReceipt(z.hash);if(k==null||d-k.blockNumber+1<r)return;let T="replaced";z.data===this.data&&z.to===this.to&&z.value===this.value?T="repriced":z.data==="0x"&&z.from===z.to&&z.value===Il&&(T="cancelled"),I(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:T==="replaced"||T==="cancelled",reason:T,replacement:z.replaceableTransaction(o),hash:z.hash,receipt:k})}}c++}},u=d=>{if(d==null||d.status!==0)return d;I(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},h=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(h);if(h){if(r===1||await h.confirmations()>=r)return u(h)}else if(await l(),r===0)return null;return await new Promise((d,y)=>{const R=[],E=()=>{R.forEach(z=>z())};if(R.push(()=>{_=!0}),i>0){const z=setTimeout(()=>{E(),y(ft("wait for transaction timeout","TIMEOUT"))},i);R.push(()=>{clearTimeout(z)})}const x=async z=>{if(await z.confirmations()>=r){E();try{d(u(z))}catch(k){y(k)}}};if(R.push(()=>{this.provider.off(this.hash,x)}),this.provider.on(this.hash,x),o>=0){const z=async()=>{try{await l()}catch(k){if(kt(k,"TRANSACTION_REPLACED")){E(),y(k);return}}_||this.provider.once("block",z)};R.push(()=>{this.provider.off("block",z)}),this.provider.once("block",z)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return I(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Bl(this)}reorderedEvent(t){return I(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),I(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Sl(this,t)}replaceableTransaction(t){g(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);const e=new Yi(this,this.provider);return e.#t=t,e}}function Kg(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function Sl(n,t){return{orphan:"reorder-transaction",tx:n,other:t}}function Bl(n){return{orphan:"drop-transaction",tx:n}}function Vg(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class fa extends qi{interface;fragment;args;constructor(t,e,r){super(t,t.provider);const i=e.decodeEventLog(r,t.data,t.topics);V(this,{args:i,fragment:r,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class Tl extends qi{error;constructor(t,e){super(t,t.provider),V(this,{error:e})}}class Qg extends kl{#t;constructor(t,e,r){super(r,e),this.#t=t}get logs(){return super.logs.map(t=>{const e=t.topics.length?this.#t.getEvent(t.topics[0]):null;if(e)try{return new fa(t,this.#t,e)}catch(r){return new Tl(t,r)}return t})}}class ha extends Yi{#t;constructor(t,e,r){super(r,e),this.#t=t}async wait(t,e){const r=await super.wait(t,e);return r==null?null:new Qg(this.#t,this.provider,r)}}class Cl extends ac{log;constructor(t,e,r,i){super(t,e,r),V(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Jg extends Cl{constructor(t,e,r,i,o){super(t,e,r,new fa(o,t.interface,i));const c=t.interface.decodeEventLog(i,this.log.data,this.log.topics);V(this,{args:c,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Ol=BigInt(0);function Nl(n){return n&&typeof n.call=="function"}function Fl(n){return n&&typeof n.estimateGas=="function"}function Zs(n){return n&&typeof n.resolveName=="function"}function Ul(n){return n&&typeof n.sendTransaction=="function"}function Dl(n){if(n!=null){if(Zs(n))return n;if(n.provider)return n.provider}}class $g{#t;fragment;constructor(t,e,r){if(V(this,{fragment:e}),e.inputs.length<r.length)throw new Error("too many arguments");const i=Gn(t.runner,"resolveName"),o=Zs(i)?i:null;this.#t=async function(){const c=await Promise.all(e.inputs.map((_,l)=>r[l]==null?null:_.walkAsync(r[l],(h,f)=>h==="address"?Array.isArray(f)?Promise.all(f.map(d=>Ut(d,o))):Ut(f,o):f)));return t.interface.encodeFilterTopics(e,c)}()}getTopicFilter(){return this.#t}}function Gn(n,t){return n==null?null:typeof n[t]=="function"?n:n.provider&&typeof n.provider[t]=="function"?n.provider:null}function Hn(n){return n==null?null:n.provider||null}async function Ll(n,t){const e=gt.dereference(n,"overrides");g(typeof e=="object","invalid overrides parameter","overrides",n);const r=Ws(e);return g(r.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),g(r.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Wg(n,t,e){const r=Gn(n,"resolveName"),i=Zs(r)?r:null;return await Promise.all(t.map((o,c)=>o.walkAsync(e[c],(_,l)=>(l=gt.dereference(l,_),_==="address"?Ut(l,i):l))))}function Zg(n){const t=async function(c){const _=await Ll(c,["data"]);_.to=await n.getAddress(),_.from&&(_.from=await Ut(_.from,Dl(n.runner)));const l=n.interface,u=M(_.value||Ol,"overrides.value")===Ol,h=(_.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!h&&!u&&g(!1,"cannot send data to receive or send value to non-payable fallback","overrides",c),g(l.fallback||h,"cannot send data to receive-only contract","overrides.data",_.data);const f=l.receive||l.fallback&&l.fallback.payable;return g(f||u,"cannot send value to non-payable fallback","overrides.value",_.value),g(l.fallback||h,"cannot send data to receive-only contract","overrides.data",_.data),_},e=async function(c){const _=Gn(n.runner,"call");I(Nl(_),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await t(c);try{return await _.call(l)}catch(u){throw Eo(u)&&u.data?n.interface.makeError(u.data,l):u}},r=async function(c){const _=n.runner;I(Ul(_),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await _.sendTransaction(await t(c)),u=Hn(n.runner);return new ha(n.interface,u,l)},i=async function(c){const _=Gn(n.runner,"estimateGas");return I(Fl(_),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await _.estimateGas(await t(c))},o=async c=>await r(c);return V(o,{_contract:n,estimateGas:i,populateTransaction:t,send:r,staticCall:e}),o}function qg(n,t){const e=function(...u){const h=n.interface.getFunction(t,u);return I(h,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:u}}),h},r=async function(...u){const h=e(...u);let f={};if(h.inputs.length+1===u.length&&(f=await Ll(u.pop()),f.from&&(f.from=await Ut(f.from,Dl(n.runner)))),h.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Wg(n.runner,h.inputs,u);return Object.assign({},f,await Ot({to:n.getAddress(),data:n.interface.encodeFunctionData(h,d)}))},i=async function(...u){const h=await _(...u);return h.length===1?h[0]:h},o=async function(...u){const h=n.runner;I(Ul(h),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await h.sendTransaction(await r(...u)),d=Hn(n.runner);return new ha(n.interface,d,f)},c=async function(...u){const h=Gn(n.runner,"estimateGas");return I(Fl(h),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await h.estimateGas(await r(...u))},_=async function(...u){const h=Gn(n.runner,"call");I(Nl(h),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await h.call(f)}catch(R){throw Eo(R)&&R.data?n.interface.makeError(R.data,f):R}const y=e(...u);return n.interface.decodeFunctionResult(y,d)},l=async(...u)=>e(...u).constant?await i(...u):await o(...u);return V(l,{name:n.interface.getFunctionName(t),_contract:n,_key:t,getFragment:e,estimateGas:c,populateTransaction:r,send:o,staticCall:i,staticCallResult:_}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=n.interface.getFunction(t);return I(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),u}}),l}function Yg(n,t){const e=function(...i){const o=n.interface.getEvent(t,i);return I(o,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:i}}),o},r=function(...i){return new $g(n,e(...i),i)};return V(r,{name:n.interface.getEventName(t),_contract:n,_key:t,getFragment:e}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=n.interface.getEvent(t);return I(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),i}}),r}const qs=Symbol.for("_ethersInternal_contract"),Ml=new WeakMap;function Xg(n,t){Ml.set(n[qs],t)}function Qt(n){return Ml.get(n[qs])}function ty(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function pa(n,t){let e,r=null;if(Array.isArray(t)){const o=function(c){if(ot(c,32))return c;const _=n.interface.getEvent(c);return g(_,"unknown fragment","name",c),_.topicHash};e=t.map(c=>c==null?null:Array.isArray(c)?c.map(o):o(c))}else t==="*"?e=[null]:typeof t=="string"?ot(t,32)?e=[t]:(r=n.interface.getEvent(t),g(r,"unknown fragment","event",t),e=[r.topicHash]):ty(t)?e=await t.getTopicFilter():"fragment"in t?(r=t.fragment,e=[r.topicHash]):g(!1,"unknown event name","event",t);e=e.map(o=>{if(o==null)return null;if(Array.isArray(o)){const c=Array.from(new Set(o.map(_=>_.toLowerCase())).values());return c.length===1?c[0]:(c.sort(),c)}return o.toLowerCase()});const i=e.map(o=>o==null?"null":Array.isArray(o)?o.join("|"):o).join("&");return{fragment:r,tag:i,topics:e}}async function Xi(n,t){const{subs:e}=Qt(n);return e.get((await pa(n,t)).tag)||null}async function jl(n,t,e){const r=Hn(n.runner);I(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});const{fragment:i,tag:o,topics:c}=await pa(n,e),{addr:_,subs:l}=Qt(n);let u=l.get(o);if(!u){const f={address:_||n,topics:c},d=x=>{let z=i;if(z==null)try{z=n.interface.getEvent(x.topics[0])}catch{}if(z){const k=z,T=i?n.interface.decodeEventLog(i,x.data,x.topics):[];wa(n,e,T,j=>new Jg(n,j,e,k,x))}else wa(n,e,[],k=>new Cl(n,k,e,x))};let y=[];u={tag:o,listeners:[],start:()=>{y.length||y.push(r.on(f,d))},stop:async()=>{if(y.length==0)return;let x=y;y=[],await Promise.all(x),r.off(f,d)}},l.set(o,u)}return u}let da=Promise.resolve();async function ey(n,t,e,r){await da;const i=await Xi(n,t);if(!i)return!1;const o=i.listeners.length;return i.listeners=i.listeners.filter(({listener:c,once:_})=>{const l=Array.from(e);r&&l.push(r(_?null:c));try{c.call(n,...l)}catch{}return!_}),i.listeners.length===0&&(i.stop(),Qt(n).subs.delete(i.tag)),o>0}async function wa(n,t,e,r){try{await da}catch{}const i=ey(n,t,e,r);return da=i,await i}const Ys=["then"];class ts{target;interface;runner;filters;[qs];fallback;constructor(t,e,r,i){g(typeof t=="string"||g_(t),"invalid value for Contract target","target",t),r==null&&(r=null);const o=jn.from(e);V(this,{target:t,runner:r,interface:o}),Object.defineProperty(this,qs,{value:{}});let c,_=null,l=null;if(i){const f=Hn(r);l=new ha(this.interface,f,i)}let u=new Map;if(typeof t=="string")if(ot(t))_=t,c=Promise.resolve(t);else{const f=Gn(r,"resolveName");if(!Zs(f))throw ft("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});c=f.resolveName(t).then(d=>{if(d==null)throw ft("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return Qt(this).addr=d,d})}else c=t.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Qt(this).addr=f,f});Xg(this,{addrPromise:c,addr:_,deployTx:l,subs:u});const h=new Proxy({},{get:(f,d,y)=>{if(typeof d=="symbol"||Ys.indexOf(d)>=0)return Reflect.get(f,d,y);try{return this.getEvent(d)}catch(R){if(!kt(R,"INVALID_ARGUMENT")||R.argument!=="key")throw R}},has:(f,d)=>Ys.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return V(this,{filters:h}),V(this,{fallback:o.receive||o.fallback?Zg(this):null}),new Proxy(this,{get:(f,d,y)=>{if(typeof d=="symbol"||d in f||Ys.indexOf(d)>=0)return Reflect.get(f,d,y);try{return f.getFunction(d)}catch(R){if(!kt(R,"INVALID_ARGUMENT")||R.argument!=="key")throw R}},has:(f,d)=>typeof d=="symbol"||d in f||Ys.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(t){return new ts(this.target,this.interface,t)}attach(t){return new ts(t,this.interface,this.runner)}async getAddress(){return await Qt(this).addrPromise}async getDeployedCode(){const t=Hn(this.runner);I(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const e=await t.getCode(await this.getAddress());return e==="0x"?null:e}async waitForDeployment(){const t=this.deploymentTransaction();if(t)return await t.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Hn(this.runner);return I(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,o)=>{const c=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);r.once("block",c)}catch(_){o(_)}};c()})}deploymentTransaction(){return Qt(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),qg(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),Yg(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,r){e==null&&(e=0),r==null&&(r="latest");const{addr:i,addrPromise:o}=Qt(this),c=i||await o,{fragment:_,topics:l}=await pa(this,t),u={address:c,topics:l,fromBlock:e,toBlock:r},h=Hn(this.runner);return I(h,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await h.getLogs(u)).map(f=>{let d=_;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new fa(f,this.interface,d)}catch(y){return new Tl(f,y)}return new qi(f,h)})}async on(t,e){const r=await jl(this,"on",t);return r.listeners.push({listener:e,once:!1}),r.start(),this}async once(t,e){const r=await jl(this,"once",t);return r.listeners.push({listener:e,once:!0}),r.start(),this}async emit(t,...e){return await wa(this,t,e,null)}async listenerCount(t){if(t){const i=await Xi(this,t);return i?i.listeners.length:0}const{subs:e}=Qt(this);let r=0;for(const{listeners:i}of e.values())r+=i.length;return r}async listeners(t){if(t){const i=await Xi(this,t);return i?i.listeners.map(({listener:o})=>o):[]}const{subs:e}=Qt(this);let r=[];for(const{listeners:i}of e.values())r=r.concat(i.map(({listener:o})=>o));return r}async off(t,e){const r=await Xi(this,t);if(!r)return this;if(e){const i=r.listeners.map(({listener:o})=>o).indexOf(e);i>=0&&r.listeners.splice(i,1)}return(e==null||r.listeners.length===0)&&(r.stop(),Qt(this).subs.delete(r.tag)),this}async removeAllListeners(t){if(t){const e=await Xi(this,t);if(!e)return this;e.stop(),Qt(this).subs.delete(e.tag)}else{const{subs:e}=Qt(this);for(const{tag:r,stop:i}of e.values())i(),e.delete(r)}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){class e extends ts{constructor(i,o=null){super(i,t,o)}}return e}static from(t,e,r){return r==null&&(r=null),new this(t,e,r)}}function ry(){return ts}class le extends ry(){}function ga(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):g(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class ny{name;constructor(t){V(this,{name:t})}connect(t){return this}supportsCoinType(t){return!1}async encodeAddress(t,e){throw new Error("unsupported coin")}async decodeAddress(t,e){throw new Error("unsupported coin")}}const Gl=new RegExp("^(ipfs)://(.*)$","i"),Hl=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Gl,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class gi{provider;address;name;#t;#e;constructor(t,e,r){V(this,{provider:t,address:e,name:r}),this.#t=null,this.#e=new le(e,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],t)}async supportsWildcard(){return this.#t==null&&(this.#t=(async()=>{try{return await this.#e.supportsInterface("0x9061b923")}catch(t){if(kt(t,"CALL_EXCEPTION"))return!1;throw this.#t=null,t}})()),await this.#t}async#r(t,e){e=(e||[]).slice();const r=this.#e.interface;e.unshift(aa(this.name));let i=null;await this.supportsWildcard()&&(i=r.getFunction(t),I(i,"missing fragment","UNKNOWN_ERROR",{info:{funcName:t}}),e=[gg(this.name,255),r.encodeFunctionData(i,e)],t="resolve(bytes,bytes)"),e.push({enableCcipRead:!0});try{const o=await this.#e[t](...e);return i?r.decodeFunctionResult(i,o)[0]:o}catch(o){if(!kt(o,"CALL_EXCEPTION"))throw o}return null}async getAddress(t){if(t==null&&(t=60),t===60)try{const o=await this.#r("addr(bytes32)");return o==null||o===Hi?null:o}catch(o){if(kt(o,"CALL_EXCEPTION"))return null;throw o}if(t>=0&&t<2147483648){let o=t+2147483648;const c=await this.#r("addr(bytes32,uint)",[o]);if(ot(c,20))return Y(c)}let e=null;for(const o of this.provider.plugins)if(o instanceof ny&&o.supportsCoinType(t)){e=o;break}if(e==null)return null;const r=await this.#r("addr(bytes32,uint)",[t]);if(r==null||r==="0x")return null;const i=await e.decodeAddress(t,r);if(i!=null)return i;I(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${t})`,info:{coinType:t,data:r}})}async getText(t){const e=await this.#r("text(bytes32,string)",[t]);return e==null||e==="0x"?null:e}async getContentHash(){const t=await this.#r("contenthash(bytes32)");if(t==null||t==="0x")return null;const e=t.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const i=e[1]==="e3010170"?"ipfs":"ipns",o=parseInt(e[4],16);if(e[5].length===o*2)return`${i}://${bp("0x"+e[2])}`}const r=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;I(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:t}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const t=[{type:"name",value:this.name}];try{const e=await this.getText("avatar");if(e==null)return t.push({type:"!avatar",value:""}),{url:null,linkage:t};t.push({type:"avatar",value:e});for(let r=0;r<Hl.length;r++){const i=e.match(Hl[r]);if(i==null)continue;const o=i[1].toLowerCase();switch(o){case"https":case"data":return t.push({type:"url",value:e}),{linkage:t,url:e};case"ipfs":{const c=ga(e);return t.push({type:"ipfs",value:e}),t.push({type:"url",value:c}),{linkage:t,url:c}}case"erc721":case"erc1155":{const c=o==="erc721"?"tokenURI(uint256)":"uri(uint256)";t.push({type:o,value:e});const _=await this.getAddress();if(_==null)return t.push({type:"!owner",value:""}),{url:null,linkage:t};const l=(i[2]||"").split("/");if(l.length!==2)return t.push({type:`!${o}caip`,value:i[2]||""}),{url:null,linkage:t};const u=l[1],h=new le(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(o==="erc721"){const E=await h.ownerOf(u);if(_!==E)return t.push({type:"!owner",value:E}),{url:null,linkage:t};t.push({type:"owner",value:E})}else if(o==="erc1155"){const E=await h.balanceOf(_,u);if(!E)return t.push({type:"!balance",value:"0"}),{url:null,linkage:t};t.push({type:"balance",value:E.toString()})}let f=await h[c](u);if(f==null||f==="0x")return t.push({type:"!metadata-url",value:""}),{url:null,linkage:t};t.push({type:"metadata-url-base",value:f}),o==="erc1155"&&(f=f.replace("{id}",cn(u,32).substring(2)),t.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=ga(f)),t.push({type:"metadata-url",value:f});let d={};const y=await new Hr(f).send();y.assertOk();try{d=y.bodyJson}catch{try{t.push({type:"!metadata",value:y.bodyText})}catch{const z=y.body;return z&&t.push({type:"!metadata",value:O(z)}),{url:null,linkage:t}}return{url:null,linkage:t}}if(!d)return t.push({type:"!metadata",value:""}),{url:null,linkage:t};t.push({type:"metadata",value:JSON.stringify(d)});let R=d.image;if(typeof R!="string")return t.push({type:"!imageUrl",value:""}),{url:null,linkage:t};if(!R.match(/^(https:\/\/|data:)/i)){if(R.match(Gl)==null)return t.push({type:"!imageUrl-ipfs",value:R}),{url:null,linkage:t};t.push({type:"imageUrl-ipfs",value:R}),R=ga(R)}return t.push({type:"url",value:R}),{linkage:t,url:R}}}}}catch{}return{linkage:t,url:null}}static async getEnsAddress(t){const e=await t.getNetwork(),r=e.getPlugin("org.ethers.plugins.network.Ens");return I(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:e}}),r.address}static async#n(t,e){const r=await gi.getEnsAddress(t);try{const o=await new le(r,["function resolver(bytes32) view returns (address)"],t).resolver(aa(e),{enableCcipRead:!0});return o===Hi?null:o}catch(i){throw i}return null}static async fromName(t,e){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const i=await gi.#n(t,r);if(i!=null){const o=new gi(t,i,e);return r!==e&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}}const Kl=BigInt(0);function tt(n,t){return function(e){return e==null?t:n(e)}}function es(n,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>n(r))}}function rs(n,t){return e=>{const r={};for(const i in n){let o=i;if(t&&i in t&&!(o in e)){for(const c of t[i])if(c in e){o=c;break}}try{const c=n[i](e[o]);c!==void 0&&(r[i]=c)}catch(c){const _=c instanceof Error?c.message:"not-an-error";I(!1,`invalid value for value.${i} (${_})`,"BAD_DATA",{value:e})}}return r}}function iy(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}g(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function yi(n){return g(ot(n,!0),"invalid data","value",n),n}function St(n){return g(ot(n,32),"invalid hash","value",n),n}const sy=rs({address:Y,blockHash:St,blockNumber:q,data:yi,index:q,removed:tt(iy,!1),topics:es(St),transactionHash:St,transactionIndex:q},{index:["logIndex"]});function oy(n){return sy(n)}const ay=rs({hash:tt(St),parentHash:St,parentBeaconBlockRoot:tt(St,null),number:q,timestamp:q,nonce:tt(yi),difficulty:M,gasLimit:M,gasUsed:M,stateRoot:tt(St,null),receiptsRoot:tt(St,null),blobGasUsed:tt(M,null),excessBlobGas:tt(M,null),miner:tt(Y),prevRandao:tt(St,null),extraData:yi,baseFeePerGas:tt(M)},{prevRandao:["mixHash"]});function cy(n){const t=ay(n);return t.transactions=n.transactions.map(e=>typeof e=="string"?e:Vl(e)),t}const _y=rs({transactionIndex:q,blockNumber:q,transactionHash:St,address:Y,topics:es(St),data:yi,index:q,blockHash:St},{index:["logIndex"]});function ly(n){return _y(n)}const uy=rs({to:tt(Y,null),from:tt(Y,null),contractAddress:tt(Y,null),index:q,root:tt(O),gasUsed:M,blobGasUsed:tt(M,null),logsBloom:tt(yi),blockHash:St,hash:St,logs:es(ly),blockNumber:q,cumulativeGasUsed:M,effectiveGasPrice:tt(M),blobGasPrice:tt(M,null),status:tt(q),type:tt(q,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function fy(n){return uy(n)}function Vl(n){n.to&&M(n.to)===Kl&&(n.to="0x0000000000000000000000000000000000000000");const t=rs({hash:St,index:tt(q,void 0),type:e=>e==="0x"||e==null?0:q(e),accessList:tt(Cn,null),blobVersionedHashes:tt(es(St,!0),null),authorizationList:tt(es(e=>{let r;if(e.signature)r=e.signature;else{let i=e.yParity;i==="0x1b"?i=0:i==="0x1c"&&(i=1),r=Object.assign({},e,{yParity:i})}return{address:Y(e.address),chainId:M(e.chainId),nonce:M(e.nonce),signature:wt.from(r)}},!1),null),blockHash:tt(St,null),blockNumber:tt(q,null),transactionIndex:tt(q,null),from:Y,gasPrice:tt(M),maxPriorityFeePerGas:tt(M),maxFeePerGas:tt(M),maxFeePerBlobGas:tt(M,null),gasLimit:M,to:tt(Y,null),value:M,nonce:q,data:yi,creates:tt(Y,null),chainId:tt(M,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(t.to==null&&t.creates==null&&(t.creates=tw(t)),(n.type===1||n.type===2)&&n.accessList==null&&(t.accessList=[]),n.signature?t.signature=wt.from(n.signature):t.signature=wt.from(n),t.chainId==null){const e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&M(t.blockHash)===Kl&&(t.blockHash=null),t}const hy="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class ns{name;constructor(t){V(this,{name:t})}clone(){return new ns(this.name)}}class Xs extends ns{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(t,e){t==null&&(t=0),super(`org.ethers.network.plugins.GasCost#${t||0}`);const r={effectiveBlock:t};function i(o,c){let _=(e||{})[o];_==null&&(_=c),g(typeof _=="number",`invalud value for ${o}`,"costs",e),r[o]=_}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),V(this,r)}clone(){return new Xs(this.effectiveBlock,this)}}class to extends ns{address;targetNetwork;constructor(t,e){super("org.ethers.plugins.network.Ens"),V(this,{address:t||hy,targetNetwork:e??1})}clone(){return new to(this.address,this.targetNetwork)}}class py extends ns{#t;#e;get url(){return this.#t}get processFunc(){return this.#e}constructor(t,e){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#t=t,this.#e=e}clone(){return this}}const ya=new Map;class Jt{#t;#e;#r;constructor(t,e){this.#t=t,this.#e=M(e),this.#r=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#t}set name(t){this.#t=t}get chainId(){return this.#e}set chainId(t){this.#e=M(t,"chainId")}matches(t){if(t==null)return!1;if(typeof t=="string"){try{return this.chainId===M(t)}catch{}return this.name===t}if(typeof t=="number"||typeof t=="bigint"){try{return this.chainId===M(t)}catch{}return!1}if(typeof t=="object"){if(t.chainId!=null){try{return this.chainId===M(t.chainId)}catch{}return!1}return t.name!=null?this.name===t.name:!1}return!1}get plugins(){return Array.from(this.#r.values())}attachPlugin(t){if(this.#r.get(t.name))throw new Error(`cannot replace existing plugin: ${t.name} `);return this.#r.set(t.name,t.clone()),this}getPlugin(t){return this.#r.get(t)||null}getPlugins(t){return this.plugins.filter(e=>e.name.split("#")[0]===t)}clone(){const t=new Jt(this.name,this.chainId);return this.plugins.forEach(e=>{t.attachPlugin(e.clone())}),t}computeIntrinsicGas(t){const e=this.getPlugin("org.ethers.plugins.network.GasCost")||new Xs;let r=e.txBase;if(t.to==null&&(r+=e.txCreate),t.data)for(let i=2;i<t.data.length;i+=2)t.data.substring(i,i+2)==="00"?r+=e.txDataZero:r+=e.txDataNonzero;if(t.accessList){const i=Cn(t.accessList);for(const o in i)r+=e.txAccessListAddress+e.txAccessListStorageKey*i[o].storageKeys.length}return r}static from(t){if(dy(),t==null)return Jt.from("mainnet");if(typeof t=="number"&&(t=BigInt(t)),typeof t=="string"||typeof t=="bigint"){const e=ya.get(t);if(e)return e();if(typeof t=="bigint")return new Jt("unknown",t);g(!1,"unknown network","network",t)}if(typeof t.clone=="function")return t.clone();if(typeof t=="object"){g(typeof t.name=="string"&&typeof t.chainId=="number","invalid network object name or chainId","network",t);const e=new Jt(t.name,t.chainId);return(t.ensAddress||t.ensNetwork!=null)&&e.attachPlugin(new to(t.ensAddress,t.ensNetwork)),e}g(!1,"invalid network","network",t)}static register(t,e){typeof t=="number"&&(t=BigInt(t));const r=ya.get(t);r&&g(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",t),ya.set(t,e)}}function Ql(n,t){const e=String(n);if(!e.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const r=e.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${n}`);for(;r[1].length<t;)r[1]+="0";if(r[1].length>9){let i=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||i++,r[1]=i.toString()}return BigInt(r[0]+r[1])}function Jl(n){return new py(n,async(t,e,r)=>{r.setHeader("User-Agent","ethers");let i;try{const[o,c]=await Promise.all([r.send(),t()]);i=o;const _=i.bodyJson.standard;return{gasPrice:c.gasPrice,maxFeePerGas:Ql(_.maxFee,9),maxPriorityFeePerGas:Ql(_.maxPriorityFee,9)}}catch(o){I(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:i,error:o})}})}let $l=!1;function dy(){if($l)return;$l=!0;function n(t,e,r){const i=function(){const o=new Jt(t,e);return r.ensNetwork!=null&&o.attachPlugin(new to(null,r.ensNetwork)),o.attachPlugin(new Xs),(r.plugins||[]).forEach(c=>{o.attachPlugin(c)}),o};Jt.register(t,i),Jt.register(e,i),r.altNames&&r.altNames.forEach(o=>{Jt.register(o,i)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[Jl("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[Jl("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function ba(n){return JSON.parse(JSON.stringify(n))}class wy{#t;#e;#r;#n;constructor(t){this.#t=t,this.#e=null,this.#r=4e3,this.#n=-2}get pollingInterval(){return this.#r}set pollingInterval(t){this.#r=t}async#i(){try{const t=await this.#t.getBlockNumber();if(this.#n===-2){this.#n=t;return}if(t!==this.#n){for(let e=this.#n+1;e<=t;e++){if(this.#e==null)return;await this.#t.emit("block",e)}this.#n=t}}catch{}this.#e!=null&&(this.#e=this.#t._setTimeout(this.#i.bind(this),this.#r))}start(){this.#e||(this.#e=this.#t._setTimeout(this.#i.bind(this),this.#r),this.#i())}stop(){this.#e&&(this.#t._clearTimeout(this.#e),this.#e=null)}pause(t){this.stop(),t&&(this.#n=-2)}resume(){this.start()}}class ma{#t;#e;#r;constructor(t){this.#t=t,this.#r=!1,this.#e=e=>{this._poll(e,this.#t)}}async _poll(t,e){throw new Error("sub-classes must override this")}start(){this.#r||(this.#r=!0,this.#e(-2),this.#t.on("block",this.#e))}stop(){this.#r&&(this.#r=!1,this.#t.off("block",this.#e))}pause(t){this.stop()}resume(){this.start()}}class gy extends ma{#t;#e;constructor(t,e){super(t),this.#t=e,this.#e=-2}pause(t){t&&(this.#e=-2),super.pause(t)}async _poll(t,e){const r=await e.getBlock(this.#t);r!=null&&(this.#e===-2?this.#e=r.number:r.number>this.#e&&(e.emit(this.#t,r.number),this.#e=r.number))}}class yy extends ma{#t;constructor(t,e){super(t),this.#t=ba(e)}async _poll(t,e){throw new Error("@TODO")}}class by extends ma{#t;constructor(t,e){super(t),this.#t=e}async _poll(t,e){const r=await e.getTransactionReceipt(this.#t);r&&e.emit(this.#t,r)}}class Aa{#t;#e;#r;#n;#i;constructor(t,e){this.#t=t,this.#e=ba(e),this.#r=this.#o.bind(this),this.#n=!1,this.#i=-2}async#o(t){if(this.#i===-2)return;const e=ba(this.#e);e.fromBlock=this.#i+1,e.toBlock=t;const r=await this.#t.getLogs(e);if(r.length===0){this.#i<t-60&&(this.#i=t-60);return}for(const i of r)this.#t.emit(this.#e,i),this.#i=i.blockNumber}start(){this.#n||(this.#n=!0,this.#i===-2&&this.#t.getBlockNumber().then(t=>{this.#i=t}),this.#t.on("block",this.#r))}stop(){this.#n&&(this.#n=!1,this.#t.off("block",this.#r))}pause(t){this.stop(),t&&(this.#i=-2)}resume(){this.start()}}const my=BigInt(2),Ay=10;function eo(n){return n&&typeof n.then=="function"}function ro(n,t){return n+":"+JSON.stringify(t,(e,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const i=Object.keys(r);return i.sort(),i.reduce((o,c)=>(o[c]=r[c],o),{})}return r})}class Wl{name;constructor(t){V(this,{name:t})}start(){}stop(){}pause(t){}resume(){}}function Ey(n){return JSON.parse(JSON.stringify(n))}function Ea(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function xa(n,t){if(n==null)throw new Error("invalid event");if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(ot(n,32)){const e=n.toLowerCase();return{type:"transaction",tag:ro("tx",{hash:e}),hash:e}}if(n.orphan){const e=n;return{type:"orphan",tag:ro("orphan",e),filter:Ey(e)}}if(n.address||n.topics){const e=n,r={topics:(e.topics||[]).map(i=>i==null?null:Array.isArray(i)?Ea(i.map(o=>o.toLowerCase())):i.toLowerCase())};if(e.address){const i=[],o=[],c=_=>{ot(_)?i.push(_):o.push((async()=>{i.push(await Ut(_,t))})())};Array.isArray(e.address)?e.address.forEach(c):c(e.address),o.length&&await Promise.all(o),r.address=Ea(i.map(_=>_.toLowerCase()))}return{filter:r,tag:ro("event",r),type:"event"}}g(!1,"unknown ProviderEvent","event",n)}function Ra(){return new Date().getTime()}const xy={cacheTimeout:250,pollingInterval:4e3};class Ry{#t;#e;#r;#n;#i;#o;#s;#a;#h;#_;#p;#d;constructor(t,e){if(this.#d=Object.assign({},xy,e||{}),t==="any")this.#o=!0,this.#i=null;else if(t){const r=Jt.from(t);this.#o=!1,this.#i=Promise.resolve(r),setTimeout(()=>{this.emit("network",r,null)},0)}else this.#o=!1,this.#i=null;this.#a=-1,this.#s=new Map,this.#t=new Map,this.#e=new Map,this.#r=null,this.#n=!1,this.#h=1,this.#_=new Map,this.#p=!1}get pollingInterval(){return this.#d.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#e.values())}attachPlugin(t){if(this.#e.get(t.name))throw new Error(`cannot replace existing plugin: ${t.name} `);return this.#e.set(t.name,t.connect(this)),this}getPlugin(t){return this.#e.get(t)||null}get disableCcipRead(){return this.#p}set disableCcipRead(t){this.#p=!!t}async#c(t){const e=this.#d.cacheTimeout;if(e<0)return await this._perform(t);const r=ro(t.method,t);let i=this.#s.get(r);return i||(i=this._perform(t),this.#s.set(r,i),setTimeout(()=>{this.#s.get(r)===i&&this.#s.delete(r)},e)),await i}async ccipReadFetch(t,e,r){if(this.disableCcipRead||r.length===0||t.to==null)return null;const i=t.to.toLowerCase(),o=e.toLowerCase(),c=[];for(let _=0;_<r.length;_++){const l=r[_],u=l.replace("{sender}",i).replace("{data}",o),h=new Hr(u);l.indexOf("{data}")===-1&&(h.body={data:o,sender:i}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:h,index:_,urls:r});let f="unknown error",d;try{d=await h.send()}catch(y){c.push(y.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:h,result:{error:y}});continue}try{const y=d.bodyJson;if(y.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:h,result:y}),y.data;y.message&&(f=y.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:h,result:y})}catch{}I(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:t,info:{url:l,errorMessage:f}}),c.push(f)}I(!1,`error encountered during CCIP fetch: ${c.map(_=>JSON.stringify(_)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:t,info:{urls:r,errorMessages:c}})}_wrapBlock(t,e){return new Hg(cy(t),this)}_wrapLog(t,e){return new qi(oy(t),this)}_wrapTransactionReceipt(t,e){return new kl(fy(t),this)}_wrapTransactionResponse(t,e){return new Yi(Vl(t),this)}_detectNetwork(){I(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(t){I(!1,`unsupported method: ${t.method}`,"UNSUPPORTED_OPERATION",{operation:t.method,info:t})}async getBlockNumber(){const t=q(await this.#c({method:"getBlockNumber"}),"%response");return this.#a>=0&&(this.#a=t),t}_getAddress(t){return Ut(t,this)}_getBlockTag(t){if(t==null)return"latest";switch(t){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return t}if(ot(t))return ot(t,32)?t:oe(t);if(typeof t=="bigint"&&(t=q(t,"blockTag")),typeof t=="number")return t>=0?oe(t):this.#a>=0?oe(this.#a+t):this.getBlockNumber().then(e=>oe(e+t));g(!1,"invalid blockTag","blockTag",t)}_getFilter(t){const e=(t.topics||[]).map(l=>l==null?null:Array.isArray(l)?Ea(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in t?t.blockHash:void 0,i=(l,u,h)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||h!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),e.length&&(d.topics=e),u&&(d.fromBlock=u),h&&(d.toBlock=h),r&&(d.blockHash=r),d};let o=[];if(t.address)if(Array.isArray(t.address))for(const l of t.address)o.push(this._getAddress(l));else o.push(this._getAddress(t.address));let c;"fromBlock"in t&&(c=this._getBlockTag(t.fromBlock));let _;return"toBlock"in t&&(_=this._getBlockTag(t.toBlock)),o.filter(l=>typeof l!="string").length||c!=null&&typeof c!="string"||_!=null&&typeof _!="string"?Promise.all([Promise.all(o),c,_]).then(l=>i(l[0],l[1],l[2])):i(o,c,_)}_getTransactionRequest(t){const e=Ws(t),r=[];if(["to","from"].forEach(i=>{if(e[i]==null)return;const o=Ut(e[i],this);eo(o)?r.push(async function(){e[i]=await o}()):e[i]=o}),e.blockTag!=null){const i=this._getBlockTag(e.blockTag);eo(i)?r.push(async function(){e.blockTag=await i}()):e.blockTag=i}return r.length?async function(){return await Promise.all(r),e}():e}async getNetwork(){if(this.#i==null){const i=(async()=>{try{const o=await this._detectNetwork();return this.emit("network",o,null),o}catch(o){throw this.#i===i&&(this.#i=null),o}})();return this.#i=i,(await i).clone()}const t=this.#i,[e,r]=await Promise.all([t,this._detectNetwork()]);return e.chainId!==r.chainId&&(this.#o?(this.emit("network",r,e),this.#i===t&&(this.#i=Promise.resolve(r))):I(!1,`network changed: ${e.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),e.clone()}async getFeeData(){const t=await this.getNetwork(),e=async()=>{const{_block:i,gasPrice:o,priorityFee:c}=await Ot({_block:this.#g("latest",!1),gasPrice:(async()=>{try{const h=await this.#c({method:"getGasPrice"});return M(h,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const h=await this.#c({method:"getPriorityFee"});return M(h,"%response")}catch{}return null})()});let _=null,l=null;const u=this._wrapBlock(i,t);return u&&u.baseFeePerGas&&(l=c??BigInt("1000000000"),_=u.baseFeePerGas*my+l),new vl(o,_,l)},r=t.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const i=new Hr(r.url),o=await r.processFunc(e,this,i);return new vl(o.gasPrice,o.maxFeePerGas,o.maxPriorityFeePerGas)}return await e()}async estimateGas(t){let e=this._getTransactionRequest(t);return eo(e)&&(e=await e),M(await this.#c({method:"estimateGas",transaction:e}),"%response")}async#l(t,e,r){I(r<Ay,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},t,{blockTag:e,enableCcipRead:!0})});const i=Ws(t);try{return O(await this._perform({method:"call",transaction:i,blockTag:e}))}catch(o){if(!this.disableCcipRead&&Eo(o)&&o.data&&r>=0&&e==="latest"&&i.to!=null&&pt(o.data,0,4)==="0x556f1830"){const c=o.data,_=await Ut(i.to,this);let l;try{l=ky(pt(o.data,4))}catch(f){I(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:c}})}I(l.sender.toLowerCase()===_.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:c,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(i,l.calldata,l.urls);I(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:o.data,errorArgs:l.errorArgs}});const h={to:_,data:lt([l.selector,vy([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:h});try{const f=await this.#l(h,e,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},h),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},h),error:f}),f}}throw o}}async#u(t){const{value:e}=await Ot({network:this.getNetwork(),value:t});return e}async call(t){const{tx:e,blockTag:r}=await Ot({tx:this._getTransactionRequest(t),blockTag:this._getBlockTag(t.blockTag)});return await this.#u(this.#l(e,r,t.enableCcipRead?0:-1))}async#f(t,e,r){let i=this._getAddress(e),o=this._getBlockTag(r);return(typeof i!="string"||typeof o!="string")&&([i,o]=await Promise.all([i,o])),await this.#u(this.#c(Object.assign(t,{address:i,blockTag:o})))}async getBalance(t,e){return M(await this.#f({method:"getBalance"},t,e),"%response")}async getTransactionCount(t,e){return q(await this.#f({method:"getTransactionCount"},t,e),"%response")}async getCode(t,e){return O(await this.#f({method:"getCode"},t,e))}async getStorage(t,e,r){const i=M(e,"position");return O(await this.#f({method:"getStorage",position:i},t,r))}async broadcastTransaction(t){const{blockNumber:e,hash:r,network:i}=await Ot({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:t}),network:this.getNetwork()}),o=ce.from(t);if(o.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(o,i).replaceableTransaction(e)}async#g(t,e){if(ot(t,32))return await this.#c({method:"getBlock",blockHash:t,includeTransactions:e});let r=this._getBlockTag(t);return typeof r!="string"&&(r=await r),await this.#c({method:"getBlock",blockTag:r,includeTransactions:e})}async getBlock(t,e){const{network:r,params:i}=await Ot({network:this.getNetwork(),params:this.#g(t,!!e)});return i==null?null:this._wrapBlock(i,r)}async getTransaction(t){const{network:e,params:r}=await Ot({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:t})});return r==null?null:this._wrapTransactionResponse(r,e)}async getTransactionReceipt(t){const{network:e,params:r}=await Ot({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:t})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const i=await this.#c({method:"getTransaction",hash:t});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(r,e)}async getTransactionResult(t){const{result:e}=await Ot({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:t})});return e==null?null:O(e)}async getLogs(t){let e=this._getFilter(t);eo(e)&&(e=await e);const{network:r,params:i}=await Ot({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:e})});return i.map(o=>this._wrapLog(o,r))}_getProvider(t){I(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(t){return await gi.fromName(this,t)}async getAvatar(t){const e=await this.getResolver(t);return e?await e.getAvatar():null}async resolveName(t){const e=await this.getResolver(t);return e?await e.getAddress():null}async lookupAddress(t){t=Y(t);const e=aa(t.substring(2).toLowerCase()+".addr.reverse");try{const r=await gi.getEnsAddress(this),o=await new le(r,["function resolver(bytes32) view returns (address)"],this).resolver(e);if(o==null||o===Hi)return null;const _=await new le(o,["function name(bytes32) view returns (string)"],this).name(e);return await this.resolveName(_)!==t?null:_}catch(r){if(kt(r,"BAD_DATA")&&r.value==="0x"||kt(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(t,e,r){const i=e??1;return i===0?this.getTransactionReceipt(t):new Promise(async(o,c)=>{let _=null;const l=async u=>{try{const h=await this.getTransactionReceipt(t);if(h!=null&&u-h.blockNumber+1>=i){o(h),_&&(clearTimeout(_),_=null);return}}catch(h){console.log("EEE",h)}this.once("block",l)};r!=null&&(_=setTimeout(()=>{_!=null&&(_=null,this.off("block",l),c(ft("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(t){I(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(t){const e=this.#_.get(t);e&&(e.timer&&clearTimeout(e.timer),this.#_.delete(t))}_setTimeout(t,e){e==null&&(e=0);const r=this.#h++,i=()=>{this.#_.delete(r),t()};if(this.paused)this.#_.set(r,{timer:null,func:i,time:e});else{const o=setTimeout(i,e);this.#_.set(r,{timer:o,func:i,time:Ra()})}return r}_forEachSubscriber(t){for(const e of this.#t.values())t(e.subscriber)}_getSubscriber(t){switch(t.type){case"debug":case"error":case"network":return new Wl(t.type);case"block":{const e=new wy(this);return e.pollingInterval=this.pollingInterval,e}case"safe":case"finalized":return new gy(this,t.type);case"event":return new Aa(this,t.filter);case"transaction":return new by(this,t.hash);case"orphan":return new yy(this,t.filter)}throw new Error(`unsupported event: ${t.type}`)}_recoverSubscriber(t,e){for(const r of this.#t.values())if(r.subscriber===t){r.started&&r.subscriber.stop(),r.subscriber=e,r.started&&e.start(),this.#r!=null&&e.pause(this.#r);break}}async#w(t,e){let r=await xa(t,this);return r.type==="event"&&e&&e.length>0&&e[0].removed===!0&&(r=await xa({orphan:"drop-log",log:e[0]},this)),this.#t.get(r.tag)||null}async#y(t){const e=await xa(t,this),r=e.tag;let i=this.#t.get(r);return i||(i={subscriber:this._getSubscriber(e),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#t.set(r,i)),i}async on(t,e){const r=await this.#y(t);return r.listeners.push({listener:e,once:!1}),r.started||(r.subscriber.start(),r.started=!0,this.#r!=null&&r.subscriber.pause(this.#r)),this}async once(t,e){const r=await this.#y(t);return r.listeners.push({listener:e,once:!0}),r.started||(r.subscriber.start(),r.started=!0,this.#r!=null&&r.subscriber.pause(this.#r)),this}async emit(t,...e){const r=await this.#w(t,e);if(!r||r.listeners.length===0)return!1;const i=r.listeners.length;return r.listeners=r.listeners.filter(({listener:o,once:c})=>{const _=new ac(this,c?null:o,t);try{o.call(this,...e,_)}catch{}return!c}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),this.#t.delete(r.tag)),i>0}async listenerCount(t){if(t){const r=await this.#w(t);return r?r.listeners.length:0}let e=0;for(const{listeners:r}of this.#t.values())e+=r.length;return e}async listeners(t){if(t){const r=await this.#w(t);return r?r.listeners.map(({listener:i})=>i):[]}let e=[];for(const{listeners:r}of this.#t.values())e=e.concat(r.map(({listener:i})=>i));return e}async off(t,e){const r=await this.#w(t);if(!r)return this;if(e){const i=r.listeners.map(({listener:o})=>o).indexOf(e);i>=0&&r.listeners.splice(i,1)}return(!e||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),this.#t.delete(r.tag)),this}async removeAllListeners(t){if(t){const{tag:e,started:r,subscriber:i}=await this.#y(t);r&&i.stop(),this.#t.delete(e)}else for(const[e,{started:r,subscriber:i}]of this.#t)r&&i.stop(),this.#t.delete(e);return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return this.off(t,e)}get destroyed(){return this.#n}destroy(){this.removeAllListeners();for(const t of this.#_.keys())this._clearTimeout(t);this.#n=!0}get paused(){return this.#r!=null}set paused(t){!!t!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(t){if(this.#a=-1,this.#r!=null){if(this.#r==!!t)return;I(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(e=>e.pause(t)),this.#r=!!t;for(const e of this.#_.values())e.timer&&clearTimeout(e.timer),e.time=Ra()-e.time}resume(){if(this.#r!=null){this._forEachSubscriber(t=>t.resume()),this.#r=null;for(const t of this.#_.values()){let e=t.time;e<0&&(e=0),t.time=Ra(),setTimeout(t.func,e)}}}}function zy(n,t){try{const e=za(n,t);if(e)return zs(e)}catch{}return null}function za(n,t){if(n==="0x")return null;try{const e=q(pt(n,t,t+32)),r=q(pt(n,e,e+32));return pt(n,e+32,e+32+r)}catch{}return null}function Zl(n){const t=Et(n);if(t.length>32)throw new Error("internal; should not happen");const e=new Uint8Array(32);return e.set(t,32-t.length),e}function Py(n){if(n.length%32===0)return n;const t=new Uint8Array(Math.ceil(n.length/32)*32);return t.set(n),t}const Iy=new Uint8Array([]);function vy(n){const t=[];let e=0;for(let r=0;r<n.length;r++)t.push(Iy),e+=32;for(let r=0;r<n.length;r++){const i=J(n[r]);t[r]=Zl(e),t.push(Zl(i.length)),t.push(Py(i)),e+=32+Math.ceil(i.length/32)*32}return lt(t)}const ql="0x0000000000000000000000000000000000000000000000000000000000000000";function ky(n){const t={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};I(vn(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const e=pt(n,0,32);I(pt(e,0,12)===pt(ql,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),t.sender=pt(e,12);try{const r=[],i=q(pt(n,32,64)),o=q(pt(n,i,i+32)),c=pt(n,i+32);for(let _=0;_<o;_++){const l=zy(c,_*32);if(l==null)throw new Error("abort");r.push(l)}t.urls=r}catch{I(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=za(n,64);if(r==null)throw new Error("abort");t.calldata=r}catch{I(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}I(pt(n,100,128)===pt(ql,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),t.selector=pt(n,96,100);try{const r=za(n,128);if(r==null)throw new Error("abort");t.extraData=r}catch{I(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return t.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>t[r]),t}function Kn(n,t){if(n.provider)return n.provider;I(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Yl(n,t){let e=Ws(t);if(e.to!=null&&(e.to=Ut(e.to,n)),e.from!=null){const r=e.from;e.from=Promise.all([n.getAddress(),Ut(r,n)]).then(([i,o])=>(g(i.toLowerCase()===o.toLowerCase(),"transaction from mismatch","tx.from",o),i))}else e.from=n.getAddress();return await Ot(e)}class Sy{provider;constructor(t){V(this,{provider:t||null})}async getNonce(t){return Kn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),t)}async populateCall(t){return await Yl(this,t)}async populateTransaction(t){const e=Kn(this,"populateTransaction"),r=await Yl(this,t);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const i=await this.provider.getNetwork();if(r.chainId!=null){const c=M(r.chainId);g(c===i.chainId,"transaction chainId mismatch","tx.chainId",t.chainId)}else r.chainId=i.chainId;const o=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||o)?g(!1,"eip-1559 transaction do not support gasPrice","tx",t):(r.type===0||r.type===1)&&o&&g(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",t),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const c=await e.getFeeData();I(c.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=c.gasPrice)}else{const c=await e.getFeeData();if(r.type==null)if(c.maxFeePerGas!=null&&c.maxPriorityFeePerGas!=null)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,r.gasPrice!=null){const _=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=_,r.maxPriorityFeePerGas=_}else r.maxFeePerGas==null&&(r.maxFeePerGas=c.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=c.maxPriorityFeePerGas);else c.gasPrice!=null?(I(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=c.gasPrice),r.type=0):I(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3||r.type===4)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=c.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=c.maxPriorityFeePerGas))}return await Ot(r)}async populateAuthorization(t){const e=Object.assign({},t);return e.chainId==null&&(e.chainId=(await Kn(this,"getNetwork").getNetwork()).chainId),e.nonce==null&&(e.nonce=await this.getNonce()),e}async estimateGas(t){return Kn(this,"estimateGas").estimateGas(await this.populateCall(t))}async call(t){return Kn(this,"call").call(await this.populateCall(t))}async resolveName(t){return await Kn(this,"resolveName").resolveName(t)}async sendTransaction(t){const e=Kn(this,"sendTransaction"),r=await this.populateTransaction(t);delete r.from;const i=ce.from(r);return await e.broadcastTransaction(await this.signTransaction(i))}authorize(t){I(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}function By(n){return JSON.parse(JSON.stringify(n))}class Xl{#t;#e;#r;#n;#i;#o;constructor(t){this.#t=t,this.#e=null,this.#r=this.#s.bind(this),this.#n=!1,this.#i=null,this.#o=!1}_subscribe(t){throw new Error("subclasses must override this")}_emitResults(t,e){throw new Error("subclasses must override this")}_recover(t){throw new Error("subclasses must override this")}async#s(t){try{this.#e==null&&(this.#e=this._subscribe(this.#t));let e=null;try{e=await this.#e}catch(o){if(!kt(o,"UNSUPPORTED_OPERATION")||o.operation!=="eth_newFilter")throw o}if(e==null){this.#e=null,this.#t._recoverSubscriber(this,this._recover(this.#t));return}const r=await this.#t.getNetwork();if(this.#i||(this.#i=r),this.#i.chainId!==r.chainId)throw new Error("chaid changed");if(this.#o)return;const i=await this.#t.send("eth_getFilterChanges",[e]);await this._emitResults(this.#t,i)}catch(e){console.log("@TODO",e)}this.#t.once("block",this.#r)}#a(){const t=this.#e;t&&(this.#e=null,t.then(e=>{this.#t.destroyed||this.#t.send("eth_uninstallFilter",[e])}))}start(){this.#n||(this.#n=!0,this.#s(-2))}stop(){this.#n&&(this.#n=!1,this.#o=!0,this.#a(),this.#t.off("block",this.#r))}pause(t){t&&this.#a(),this.#t.off("block",this.#r)}resume(){this.start()}}class Ty extends Xl{#t;constructor(t,e){super(t),this.#t=By(e)}_recover(t){return new Aa(t,this.#t)}async _subscribe(t){return await t.send("eth_newFilter",[this.#t])}async _emitResults(t,e){for(const r of e)t.emit(this.#t,t._wrapLog(r,t._network))}}class Cy extends Xl{async _subscribe(t){return await t.send("eth_newPendingTransactionFilter",[])}async _emitResults(t,e){for(const r of e)t.emit("pending",r)}}const Oy="bigint,boolean,function,number,string,symbol".split(/,/g);function no(n){if(n==null||Oy.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(no);if(typeof n=="object")return Object.keys(n).reduce((t,e)=>(t[e]=n[e],t),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function Ny(n){return new Promise(t=>{setTimeout(t,n)})}function bi(n){return n&&n.toLowerCase()}function tu(n){return n&&typeof n.pollingInterval=="number"}const eu={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Pa extends Sy{address;constructor(t,e){super(t),e=Y(e),V(this,{address:e})}connect(t){I(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const e=no(t),r=[];if(e.from){const o=e.from;r.push((async()=>{const c=await Ut(o,this.provider);g(c!=null&&c.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),e.from=c})())}else e.from=this.address;if(e.gasLimit==null&&r.push((async()=>{e.gasLimit=await this.provider.estimateGas({...e,from:this.address})})()),e.to!=null){const o=e.to;r.push((async()=>{e.to=await Ut(o,this.provider)})())}r.length&&await Promise.all(r);const i=this.provider.getRpcTransaction(e);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const e=await this.provider.getBlockNumber(),r=await this.sendUncheckedTransaction(t);return await new Promise((i,o)=>{const c=[1e3,100];let _=0;const l=async()=>{try{const u=await this.provider.getTransaction(r);if(u!=null){i(u.replaceableTransaction(e));return}}catch(u){if(kt(u,"CANCELLED")||kt(u,"BAD_DATA")||kt(u,"NETWORK_ERROR")||kt(u,"UNSUPPORTED_OPERATION")){u.info==null&&(u.info={}),u.info.sendTransactionHash=r,o(u);return}if(kt(u,"INVALID_ARGUMENT")&&(_++,u.info==null&&(u.info={}),u.info.sendTransactionHash=r,_>10)){o(u);return}this.provider.emit("error",ft("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{l()},c.pop()||4e3)};l()})}async signTransaction(t){const e=no(t);if(e.from){const i=await Ut(e.from,this.provider);g(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),e.from=i}else e.from=this.address;const r=this.provider.getRpcTransaction(e);return await this.provider.send("eth_signTransaction",[r])}async signMessage(t){const e=typeof t=="string"?Gr(t):t;return await this.provider.send("personal_sign",[O(e),this.address.toLowerCase()])}async signTypedData(t,e,r){const i=no(r),o=await Mt.resolveNames(t,e,i,async c=>{const _=await Ut(c);return g(_!=null,"TypedData does not support null address","value",c),_});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Mt.getPayload(o.domain,e,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const e=typeof t=="string"?Gr(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),O(e)])}}class Fy extends Ry{#t;#e;#r;#n;#i;#o;#s;#a(){if(this.#n)return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#n=setTimeout(()=>{this.#n=null;const e=this.#r;for(this.#r=[];e.length;){const r=[e.shift()];for(;e.length&&r.length!==this.#t.batchMaxCount;)if(r.push(e.shift()),JSON.stringify(r.map(o=>o.payload)).length>this.#t.batchMaxSize){e.unshift(r.pop());break}(async()=>{const i=r.length===1?r[0].payload:r.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:c,reject:_,payload:l}of r){if(this.destroyed){_(ft("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const u=o.filter(h=>h.id===l.id)[0];if(u==null){const h=ft("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",h),_(h);continue}if("error"in u){_(this.getRpcError(l,u));continue}c(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:c}of r)c(o)}})()}},t)}constructor(t,e){super(t,e),this.#e=1,this.#t=Object.assign({},eu,e||{}),this.#r=[],this.#n=null,this.#o=null,this.#s=null;{let i=null;const o=new Promise(c=>{i=c});this.#i={promise:o,resolve:i}}const r=this._getOption("staticNetwork");typeof r=="boolean"?(g(!r||t!=="any","staticNetwork cannot be used on special network 'any'","options",e),r&&t!=null&&(this.#o=Jt.from(t))):r&&(g(t==null||r.matches(t),"staticNetwork MUST match network object","options",e),this.#o=r)}_getOption(t){return this.#t[t]}get _network(){return I(this.#o,"network is not available yet","NETWORK_ERROR"),this.#o}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let r=t.transaction;if(r&&r.type!=null&&M(r.type)&&r.maxFeePerGas==null&&r.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},r,{type:void 0})}))}}const e=this.getRpcRequest(t);return e!=null?await this.send(e.method,e.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(this.#o)return this.#o}else return t;return this.#s?await this.#s:this.ready?(this.#s=(async()=>{try{const e=Jt.from(M(await this.send("eth_chainId",[])));return this.#s=null,e}catch(e){throw this.#s=null,e}})(),await this.#s):(this.#s=(async()=>{const e={id:this.#e++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:e});let r;try{r=(await this._send(e))[0],this.#s=null}catch(i){throw this.#s=null,this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:r}),"result"in r)return Jt.from(M(r.result));throw this.getRpcError(e,r)})(),await this.#s)}_start(){this.#i==null||this.#i.resolve==null||(this.#i.resolve(),this.#i=null,(async()=>{for(;this.#o==null&&!this.destroyed;)try{this.#o=await this._detectNetwork()}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",ft("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await Ny(1e3)}this.#a()})())}async _waitUntilReady(){if(this.#i!=null)return await this.#i.promise}_getSubscriber(t){return t.type==="pending"?new Cy(this):t.type==="event"?this._getOption("polling")?new Aa(this,t.filter):new Ty(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new Wl("orphan"):super._getSubscriber(t)}get ready(){return this.#i==null}getRpcTransaction(t){const e={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(r=>{if(t[r]==null)return;let i=r;r==="gasLimit"&&(i="gas"),e[i]=oe(M(t[r],`tx.${r}`))}),["from","to","data"].forEach(r=>{t[r]!=null&&(e[r]=O(t[r]))}),t.accessList&&(e.accessList=Cn(t.accessList)),t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.map(r=>r.toLowerCase())),t.authorizationList&&(e.authorizationList=t.authorizationList.map(r=>{const i=E_(r);return{address:i.address,nonce:oe(i.nonce),chainId:oe(i.chainId),yParity:oe(i.signature.yParity),r:oe(i.signature.r),s:oe(i.signature.s)}})),e}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[bi(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[bi(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[bi(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[bi(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(bi):t.filter.address=bi(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,e){const{method:r}=t,{error:i}=e;if(r==="eth_estimateGas"&&i.message){const _=i.message;if(!_.match(/revert/i)&&_.match(/insufficient funds/i))return ft("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}});if(_.match(/nonce/i)&&_.match(/too low/i))return ft("nonce has already been used","NONCE_EXPIRED",{transaction:t.params[0],info:{payload:t,error:i}})}if(r==="eth_call"||r==="eth_estimateGas"){const _=Ia(i),l=gn.getBuiltinCallException(r==="eth_call"?"call":"estimateGas",t.params[0],_?_.data:null);return l.info={error:i,payload:t},l}const o=JSON.stringify(Dy(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return ft("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[r]||"unknown",reason:"rejected",info:{payload:t,error:i}});if(r==="eth_sendRawTransaction"||r==="eth_sendTransaction"){const _=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return ft("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:_,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return ft("nonce has already been used","NONCE_EXPIRED",{transaction:_,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return ft("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:_,info:{error:i}});if(o.match(/only replay-protected/i))return ft("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:r,info:{transaction:_,info:{error:i}}})}let c=!!o.match(/the method .* does not exist/i);return c||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(c=!0),c?ft("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):ft("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,e){if(this.destroyed)return Promise.reject(ft("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const r=this.#e++,i=new Promise((o,c)=>{this.#r.push({resolve:o,reject:c,payload:{method:t,params:e,id:r,jsonrpc:"2.0"}})});return this.#a(),i}async getSigner(t){t==null&&(t=0);const e=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await e;if(t>=i.length)throw new Error("no such account");return new Pa(this,i[t])}const{accounts:r}=await Ot({network:this.getNetwork(),accounts:e});t=Y(t);for(const i of r)if(Y(i)===t)return new Pa(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(e=>new Pa(this,e))}destroy(){this.#n&&(clearTimeout(this.#n),this.#n=null);for(const{payload:t,reject:e}of this.#r)e(ft("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));this.#r=[],super.destroy()}}class ru extends Fy{#t;constructor(t,e){super(t,e);let r=this._getOption("pollingInterval");r==null&&(r=eu.pollingInterval),this.#t=r}_getSubscriber(t){const e=super._getSubscriber(t);return tu(e)&&(e.pollingInterval=this.#t),e}get pollingInterval(){return this.#t}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");this.#t=t,this._forEachSubscriber(e=>{tu(e)&&(e.pollingInterval=this.#t)})}}class Uy extends ru{#t;constructor(t,e,r){t==null&&(t="http://localhost:8545"),super(e,r),typeof t=="string"?this.#t=new Hr(t):this.#t=t.clone()}_getConnection(){return this.#t.clone()}async send(t,e){return await this._start(),await super.send(t,e)}async _send(t){const e=this._getConnection();e.body=JSON.stringify(t),e.setHeader("content-type","application/json");const r=await e.send();r.assertOk();let i=r.bodyJson;return Array.isArray(i)||(i=[i]),i}}function Ia(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&ot(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const t in n){const e=Ia(n[t]);if(e)return e}return null}if(typeof n=="string")try{return Ia(JSON.parse(n))}catch{}return null}function va(n,t){if(n!=null){if(typeof n.message=="string"&&t.push(n.message),typeof n=="object")for(const e in n)va(n[e],t);if(typeof n=="string")try{return va(JSON.parse(n),t)}catch{}}}function Dy(n){const t=[];return va(n,t),t}class Vn extends ru{#t;#e;constructor(t,e,r){const i=Object.assign({},r??{},{batchMaxCount:1});g(t&&t.request,"invalid EIP-1193 provider","ethereum",t),super(e,i),this.#e=null,r&&r.providerInfo&&(this.#e=r.providerInfo),this.#t=async(o,c)=>{const _={method:o,params:c};this.emit("debug",{action:"sendEip1193Request",payload:_});try{const l=await t.request(_);return this.emit("debug",{action:"receiveEip1193Result",result:l}),l}catch(l){const u=new Error(l.message);throw u.code=l.code,u.data=l.data,u.payload=_,this.emit("debug",{action:"receiveEip1193Error",error:u}),u}}}get providerInfo(){return this.#e}async send(t,e){return await this._start(),await super.send(t,e)}async _send(t){g(!Array.isArray(t),"EIP-1193 does not support batch request","payload",t);try{const e=await this.#t(t.method,t.params||[]);return[{id:t.id,result:e}]}catch(e){return[{id:t.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(t,e){switch(e=JSON.parse(JSON.stringify(e)),e.error.code||-1){case 4001:e.error.message=`ethers-user-denied: ${e.error.message}`;break;case 4200:e.error.message=`ethers-unsupported: ${e.error.message}`;break}return super.getRpcError(t,e)}async hasSigner(t){t==null&&(t=0);const e=await this.send("eth_accounts",[]);return typeof t=="number"?e.length>t:(t=t.toLowerCase(),e.filter(r=>r.toLowerCase()===t).length!==0)}async getSigner(t){if(t==null&&(t=0),!await this.hasSigner(t))try{await this.#t("eth_requestAccounts",[])}catch(e){const r=e.payload;throw this.getRpcError(r,{id:r.id,error:e})}return await super.getSigner(t)}static async discover(t){if(t==null&&(t={}),t.provider)return new Vn(t.provider);const e=t.window?t.window:typeof window<"u"?window:null;if(e==null)return null;const r=t.anyProvider;if(r&&e.ethereum)return new Vn(e.ethereum);if(!("addEventListener"in e&&"dispatchEvent"in e&&"removeEventListener"in e))return null;const i=t.timeout?t.timeout:300;return i===0?null:await new Promise((o,c)=>{let _=[];const l=f=>{_.push(f.detail),r&&u()},u=()=>{if(clearTimeout(h),_.length)if(t&&t.filter){const f=t.filter(_.map(d=>Object.assign({},d.info)));if(f==null)o(null);else if(f instanceof Vn)o(f);else{let d=null;if(f.uuid&&(d=_.filter(R=>f.uuid===R.info.uuid)[0]),d){const{provider:y,info:R}=d;o(new Vn(y,void 0,{providerInfo:R}))}else c(ft("filter returned unknown info","UNSUPPORTED_OPERATION",{value:f}))}}else{const{provider:f,info:d}=_[0];o(new Vn(f,void 0,{providerInfo:d}))}else o(null);e.removeEventListener("eip6963:announceProvider",l)},h=setTimeout(()=>{u()},i);e.addEventListener("eip6963:announceProvider",l),e.dispatchEvent(new Event("eip6963:requestProvider"))})}}const Ly=()=>(async n=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(n)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var io=typeof As<"u"?As:typeof self<"u"?self:typeof window<"u"?window:{};function nu(n,t){return new Promise(e=>{n.addEventListener("message",function r({data:i}){i?.type===t&&(n.removeEventListener("message",r),e(i))})})}nu(self,"wasm_bindgen_worker_init").then(async({init:n,receiver:t})=>{const e=await Promise.resolve().then(function(){return Wy});await e.default(n),postMessage({type:"wasm_bindgen_worker_ready"}),e.wbg_rayon_start_worker(t)});async function My(n,t,e){if(e.numThreads()===0)throw new Error("num_threads must be > 0.");const r={type:"wasm_bindgen_worker_init",init:{module_or_path:n,memory:t},receiver:e.receiver()};await Promise.all(Array.from({length:e.numThreads()},async()=>{let i;try{i=new Worker(new URL("/workerHelpers.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Vt&&Vt.tagName.toUpperCase()==="SCRIPT"&&Vt.src||new URL("relayer-sdk-js.umd.cjs",document.baseURI).href),{type:"module"})}catch{const _=await(await fetch("/workerHelpers.js")).blob(),l=URL.createObjectURL(_);i=new Worker(l)}return i.postMessage(r),await nu(i,"wasm_bindgen_worker_ready"),i})),e.build()}let s;function is(n){const t=s.__externref_table_alloc();return s.__wbindgen_export_2.set(t,n),t}function mi(n,t){try{return n.apply(this,t)}catch(e){const r=is(e);s.__wbindgen_exn_store(r)}}let ss=null;function Ai(){return(ss===null||ss.buffer!==s.memory.buffer)&&(ss=new Uint8Array(s.memory.buffer)),ss}let so=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});so.decode();const jy=2146435072;let ka=0;function Gy(n,t){return ka+=t,ka>=jy&&(so=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),so.decode(),ka=t),so.decode(Ai().slice(n,n+t))}function os(n,t){return n=n>>>0,Gy(n,t)}function m(n,t){return n=n>>>0,Ai().subarray(n/1,n/1+t)}let w=0;const oo=new TextEncoder;oo.encodeInto=function(n,t){const e=oo.encode(n);return t.set(e),{read:n.length,written:e.length}};function ao(n,t,e){if(e===void 0){const _=oo.encode(n),l=t(_.length,1)>>>0;return Ai().subarray(l,l+_.length).set(_),w=_.length,l}let r=n.length,i=t(r,1)>>>0;const o=Ai();let c=0;for(;c<r;c++){const _=n.charCodeAt(c);if(_>127)break;o[i+c]=_}if(c!==r){c!==0&&(n=n.slice(c)),i=e(i,r,r=c+n.length*3,1)>>>0;const _=Ai().subarray(i+c,i+r),l=oo.encodeInto(n,_);c+=l.written,i=e(i,r,c,1)>>>0}return w=c,i}let as=null;function Jr(){return(as===null||as.buffer!==s.memory.buffer)&&(as=new DataView(s.memory.buffer)),as}function Qn(n){return n==null}function Sa(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){const i=n.length;let o="[";i>0&&(o+=Sa(n[0]));for(let c=1;c<i;c++)o+=", "+Sa(n[c]);return o+="]",o}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(e&&e.length>1)r=e[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
|
2
|
+
${n.stack}`:r}function b(n,t){const e=t(n.length*1,1)>>>0;return Ai().set(n,e/1),w=n.length,e}function a(n){const t=s.__wbindgen_export_2.get(n);return s.__externref_table_dealloc(n),t}function p(n,t){if(!(n instanceof t))throw new Error(`expected instance of ${t.name}`)}function Ba(){s.init_panic_hook()}function Hy(n){s.wbg_rayon_start_worker(n)}function Ta(n){return s.initThreadPool(n)}const iu=Object.freeze({Proof:0,0:"Proof",Verify:1,1:"Verify"});typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_boolean_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanclientkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleancompressedciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleancompressedserverkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleannoisedistribution_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanparameters_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_booleanpublickey_free(n>>>0,1));const su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactciphertextlist_free(n>>>0,1));class $r{static __wrap(t){t=t>>>0;const e=Object.create($r.prototype);return e.__wbg_ptr=t,su.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,su.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactciphertextlist_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.compactciphertextlist_deserialize(e,r);if(i[2])throw a(i[1]);return $r.__wrap(i[0])}get_kind_of(t){const e=s.compactciphertextlist_get_kind_of(this.__wbg_ptr,t);return e===84?void 0:e}safe_serialize(t){const e=s.compactciphertextlist_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.compactciphertextlist_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return $r.__wrap(o[0])}len(){return s.compactciphertextlist_len(this.__wbg_ptr)>>>0}expand(){const t=s.compactciphertextlist_expand(this.__wbg_ptr);if(t[2])throw a(t[1]);return yn.__wrap(t[0])}static builder(t){p(t,Wt);const e=s.compactciphertextlist_builder(t.__wbg_ptr);if(e[2])throw a(e[1]);return Jn.__wrap(e[0])}is_empty(){return s.compactciphertextlist_is_empty(this.__wbg_ptr)!==0}serialize(){const t=s.compactciphertextlist_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&($r.prototype[Symbol.dispose]=$r.prototype.free);const ou=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactciphertextlistbuilder_free(n>>>0,1));class Jn{static __wrap(t){t=t>>>0;const e=Object.create(Jn.prototype);return e.__wbg_ptr=t,ou.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ou.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactciphertextlistbuilder_free(t,0)}push_i1024(t){const e=s.compactciphertextlistbuilder_push_i1024(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i2048(t){const e=s.compactciphertextlistbuilder_push_i2048(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u1024(t){const e=s.compactciphertextlistbuilder_push_u1024(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u2048(t){const e=s.compactciphertextlistbuilder_push_u2048(this.__wbg_ptr,t);if(e[1])throw a(e[0])}build_packed(){const t=s.compactciphertextlistbuilder_build_packed(this.__wbg_ptr);if(t[2])throw a(t[1]);return $r.__wrap(t[0])}push_boolean(t){const e=s.compactciphertextlistbuilder_push_boolean(this.__wbg_ptr,t);if(e[1])throw a(e[0])}build_with_proof_packed(t,e,r){p(t,$t);const i=b(e,s.__wbindgen_malloc),o=w,c=s.compactciphertextlistbuilder_build_with_proof_packed(this.__wbg_ptr,t.__wbg_ptr,i,o,r);if(c[2])throw a(c[1]);return bn.__wrap(c[0])}build(){const t=s.compactciphertextlistbuilder_build(this.__wbg_ptr);if(t[2])throw a(t[1]);return $r.__wrap(t[0])}push_i2(t){const e=s.compactciphertextlistbuilder_push_i2(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i4(t){const e=s.compactciphertextlistbuilder_push_i4(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i6(t){const e=s.compactciphertextlistbuilder_push_i6(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i8(t){const e=s.compactciphertextlistbuilder_push_i8(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u2(t){const e=s.compactciphertextlistbuilder_push_u2(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u4(t){const e=s.compactciphertextlistbuilder_push_u4(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u6(t){const e=s.compactciphertextlistbuilder_push_u6(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u8(t){const e=s.compactciphertextlistbuilder_push_u8(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i10(t){const e=s.compactciphertextlistbuilder_push_i10(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i12(t){const e=s.compactciphertextlistbuilder_push_i12(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i14(t){const e=s.compactciphertextlistbuilder_push_i14(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i16(t){const e=s.compactciphertextlistbuilder_push_i16(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i24(t){const e=s.compactciphertextlistbuilder_push_i24(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i32(t){const e=s.compactciphertextlistbuilder_push_i32(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i40(t){const e=s.compactciphertextlistbuilder_push_i40(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i48(t){const e=s.compactciphertextlistbuilder_push_i48(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i56(t){const e=s.compactciphertextlistbuilder_push_i56(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i64(t){const e=s.compactciphertextlistbuilder_push_i64(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i72(t){const e=s.compactciphertextlistbuilder_push_i72(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i80(t){const e=s.compactciphertextlistbuilder_push_i80(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i88(t){const e=s.compactciphertextlistbuilder_push_i88(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i96(t){const e=s.compactciphertextlistbuilder_push_i96(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u10(t){const e=s.compactciphertextlistbuilder_push_u10(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u12(t){const e=s.compactciphertextlistbuilder_push_u12(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u14(t){const e=s.compactciphertextlistbuilder_push_u14(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u16(t){const e=s.compactciphertextlistbuilder_push_u16(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u24(t){const e=s.compactciphertextlistbuilder_push_u24(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u32(t){const e=s.compactciphertextlistbuilder_push_u32(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u40(t){const e=s.compactciphertextlistbuilder_push_u40(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u48(t){const e=s.compactciphertextlistbuilder_push_u48(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u56(t){const e=s.compactciphertextlistbuilder_push_u56(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u64(t){const e=s.compactciphertextlistbuilder_push_u64(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u72(t){const e=s.compactciphertextlistbuilder_push_u72(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u80(t){const e=s.compactciphertextlistbuilder_push_u80(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u88(t){const e=s.compactciphertextlistbuilder_push_u88(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u96(t){const e=s.compactciphertextlistbuilder_push_u96(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i104(t){const e=s.compactciphertextlistbuilder_push_i104(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i112(t){const e=s.compactciphertextlistbuilder_push_i112(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i120(t){const e=s.compactciphertextlistbuilder_push_i120(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i128(t){const e=s.compactciphertextlistbuilder_push_i128(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i136(t){const e=s.compactciphertextlistbuilder_push_i136(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i144(t){const e=s.compactciphertextlistbuilder_push_i144(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i152(t){const e=s.compactciphertextlistbuilder_push_i152(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i160(t){const e=s.compactciphertextlistbuilder_push_i160(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i168(t){const e=s.compactciphertextlistbuilder_push_i168(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i176(t){const e=s.compactciphertextlistbuilder_push_i176(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i184(t){const e=s.compactciphertextlistbuilder_push_i184(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i192(t){const e=s.compactciphertextlistbuilder_push_i192(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i200(t){const e=s.compactciphertextlistbuilder_push_i200(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i208(t){const e=s.compactciphertextlistbuilder_push_i208(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i216(t){const e=s.compactciphertextlistbuilder_push_i216(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i224(t){const e=s.compactciphertextlistbuilder_push_i224(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i232(t){const e=s.compactciphertextlistbuilder_push_i232(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i240(t){const e=s.compactciphertextlistbuilder_push_i240(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i248(t){const e=s.compactciphertextlistbuilder_push_i248(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i256(t){const e=s.compactciphertextlistbuilder_push_i256(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_i512(t){const e=s.compactciphertextlistbuilder_push_i512(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u104(t){const e=s.compactciphertextlistbuilder_push_u104(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u112(t){const e=s.compactciphertextlistbuilder_push_u112(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u120(t){const e=s.compactciphertextlistbuilder_push_u120(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u128(t){const e=s.compactciphertextlistbuilder_push_u128(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u136(t){const e=s.compactciphertextlistbuilder_push_u136(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u144(t){const e=s.compactciphertextlistbuilder_push_u144(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u152(t){const e=s.compactciphertextlistbuilder_push_u152(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u160(t){const e=s.compactciphertextlistbuilder_push_u160(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u168(t){const e=s.compactciphertextlistbuilder_push_u168(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u176(t){const e=s.compactciphertextlistbuilder_push_u176(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u184(t){const e=s.compactciphertextlistbuilder_push_u184(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u192(t){const e=s.compactciphertextlistbuilder_push_u192(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u200(t){const e=s.compactciphertextlistbuilder_push_u200(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u208(t){const e=s.compactciphertextlistbuilder_push_u208(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u216(t){const e=s.compactciphertextlistbuilder_push_u216(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u224(t){const e=s.compactciphertextlistbuilder_push_u224(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u232(t){const e=s.compactciphertextlistbuilder_push_u232(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u240(t){const e=s.compactciphertextlistbuilder_push_u240(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u248(t){const e=s.compactciphertextlistbuilder_push_u248(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u256(t){const e=s.compactciphertextlistbuilder_push_u256(this.__wbg_ptr,t);if(e[1])throw a(e[0])}push_u512(t){const e=s.compactciphertextlistbuilder_push_u512(this.__wbg_ptr,t);if(e[1])throw a(e[0])}}Symbol.dispose&&(Jn.prototype[Symbol.dispose]=Jn.prototype.free);const au=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactciphertextlistexpander_free(n>>>0,1));class yn{static __wrap(t){t=t>>>0;const e=Object.create(yn.prototype);return e.__wbg_ptr=t,au.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,au.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactciphertextlistexpander_free(t,0)}get_int104(t){const e=s.compactciphertextlistexpander_get_int104(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return pe.__wrap(e[0])}get_int112(t){const e=s.compactciphertextlistexpander_get_int112(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return de.__wrap(e[0])}get_int120(t){const e=s.compactciphertextlistexpander_get_int120(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ge.__wrap(e[0])}get_int128(t){const e=s.compactciphertextlistexpander_get_int128(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ye.__wrap(e[0])}get_int136(t){const e=s.compactciphertextlistexpander_get_int136(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return be.__wrap(e[0])}get_int144(t){const e=s.compactciphertextlistexpander_get_int144(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ae.__wrap(e[0])}get_int152(t){const e=s.compactciphertextlistexpander_get_int152(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ee.__wrap(e[0])}get_int160(t){const e=s.compactciphertextlistexpander_get_int160(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Re.__wrap(e[0])}get_int168(t){const e=s.compactciphertextlistexpander_get_int168(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ze.__wrap(e[0])}get_int176(t){const e=s.compactciphertextlistexpander_get_int176(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Pe.__wrap(e[0])}get_int184(t){const e=s.compactciphertextlistexpander_get_int184(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ie.__wrap(e[0])}get_int192(t){const e=s.compactciphertextlistexpander_get_int192(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ve.__wrap(e[0])}get_int200(t){const e=s.compactciphertextlistexpander_get_int200(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Se.__wrap(e[0])}get_int208(t){const e=s.compactciphertextlistexpander_get_int208(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Te.__wrap(e[0])}get_int216(t){const e=s.compactciphertextlistexpander_get_int216(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ce.__wrap(e[0])}get_int224(t){const e=s.compactciphertextlistexpander_get_int224(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Oe.__wrap(e[0])}get_int232(t){const e=s.compactciphertextlistexpander_get_int232(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ne.__wrap(e[0])}get_int240(t){const e=s.compactciphertextlistexpander_get_int240(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ue.__wrap(e[0])}get_int248(t){const e=s.compactciphertextlistexpander_get_int248(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return De.__wrap(e[0])}get_int256(t){const e=s.compactciphertextlistexpander_get_int256(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Le.__wrap(e[0])}get_int512(t){const e=s.compactciphertextlistexpander_get_int512(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ke.__wrap(e[0])}get_uint10(t){const e=s.compactciphertextlistexpander_get_uint10(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Xe.__wrap(e[0])}get_uint12(t){const e=s.compactciphertextlistexpander_get_uint12(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return nr.__wrap(e[0])}get_uint14(t){const e=s.compactciphertextlistexpander_get_uint14(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ar.__wrap(e[0])}get_uint16(t){const e=s.compactciphertextlistexpander_get_uint16(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return lr.__wrap(e[0])}get_uint24(t){const e=s.compactciphertextlistexpander_get_uint24(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return xr.__wrap(e[0])}get_uint32(t){const e=s.compactciphertextlistexpander_get_uint32(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ir.__wrap(e[0])}get_uint40(t){const e=s.compactciphertextlistexpander_get_uint40(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return kr.__wrap(e[0])}get_uint48(t){const e=s.compactciphertextlistexpander_get_uint48(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Sr.__wrap(e[0])}get_uint56(t){const e=s.compactciphertextlistexpander_get_uint56(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Tr.__wrap(e[0])}get_uint64(t){const e=s.compactciphertextlistexpander_get_uint64(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Or.__wrap(e[0])}get_uint72(t){const e=s.compactciphertextlistexpander_get_uint72(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Nr.__wrap(e[0])}get_uint80(t){const e=s.compactciphertextlistexpander_get_uint80(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ur.__wrap(e[0])}get_uint88(t){const e=s.compactciphertextlistexpander_get_uint88(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Dr.__wrap(e[0])}get_uint96(t){const e=s.compactciphertextlistexpander_get_uint96(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Lr.__wrap(e[0])}get_int1024(t){const e=s.compactciphertextlistexpander_get_int1024(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return he.__wrap(e[0])}get_int2048(t){const e=s.compactciphertextlistexpander_get_int2048(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Be.__wrap(e[0])}get_kind_of(t){const e=s.compactciphertextlistexpander_get_kind_of(this.__wbg_ptr,t);return e===84?void 0:e}get_uint104(t){const e=s.compactciphertextlistexpander_get_uint104(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return er.__wrap(e[0])}get_uint112(t){const e=s.compactciphertextlistexpander_get_uint112(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return rr.__wrap(e[0])}get_uint120(t){const e=s.compactciphertextlistexpander_get_uint120(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ir.__wrap(e[0])}get_uint128(t){const e=s.compactciphertextlistexpander_get_uint128(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return sr.__wrap(e[0])}get_uint136(t){const e=s.compactciphertextlistexpander_get_uint136(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return or.__wrap(e[0])}get_uint144(t){const e=s.compactciphertextlistexpander_get_uint144(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return cr.__wrap(e[0])}get_uint152(t){const e=s.compactciphertextlistexpander_get_uint152(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return _r.__wrap(e[0])}get_uint160(t){const e=s.compactciphertextlistexpander_get_uint160(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ur.__wrap(e[0])}get_uint168(t){const e=s.compactciphertextlistexpander_get_uint168(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return fr.__wrap(e[0])}get_uint176(t){const e=s.compactciphertextlistexpander_get_uint176(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return hr.__wrap(e[0])}get_uint184(t){const e=s.compactciphertextlistexpander_get_uint184(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return pr.__wrap(e[0])}get_uint192(t){const e=s.compactciphertextlistexpander_get_uint192(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return dr.__wrap(e[0])}get_uint200(t){const e=s.compactciphertextlistexpander_get_uint200(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return gr.__wrap(e[0])}get_uint208(t){const e=s.compactciphertextlistexpander_get_uint208(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return br.__wrap(e[0])}get_uint216(t){const e=s.compactciphertextlistexpander_get_uint216(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return mr.__wrap(e[0])}get_uint224(t){const e=s.compactciphertextlistexpander_get_uint224(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ar.__wrap(e[0])}get_uint232(t){const e=s.compactciphertextlistexpander_get_uint232(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Er.__wrap(e[0])}get_uint240(t){const e=s.compactciphertextlistexpander_get_uint240(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Rr.__wrap(e[0])}get_uint248(t){const e=s.compactciphertextlistexpander_get_uint248(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return zr.__wrap(e[0])}get_uint256(t){const e=s.compactciphertextlistexpander_get_uint256(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Pr.__wrap(e[0])}get_uint512(t){const e=s.compactciphertextlistexpander_get_uint512(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Br.__wrap(e[0])}get_uint1024(t){const e=s.compactciphertextlistexpander_get_uint1024(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return tr.__wrap(e[0])}get_uint2048(t){const e=s.compactciphertextlistexpander_get_uint2048(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return yr.__wrap(e[0])}len(){return s.compactciphertextlistexpander_len(this.__wbg_ptr)>>>0}get_bool(t){const e=s.compactciphertextlistexpander_get_bool(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ue.__wrap(e[0])}get_int2(t){const e=s.compactciphertextlistexpander_get_int2(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return ke.__wrap(e[0])}get_int4(t){const e=s.compactciphertextlistexpander_get_int4(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return je.__wrap(e[0])}get_int6(t){const e=s.compactciphertextlistexpander_get_int6(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Qe.__wrap(e[0])}get_int8(t){const e=s.compactciphertextlistexpander_get_int8(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return We.__wrap(e[0])}is_empty(){return s.compactciphertextlistexpander_is_empty(this.__wbg_ptr)!==0}get_int10(t){const e=s.compactciphertextlistexpander_get_int10(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return fe.__wrap(e[0])}get_int12(t){const e=s.compactciphertextlistexpander_get_int12(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return we.__wrap(e[0])}get_int14(t){const e=s.compactciphertextlistexpander_get_int14(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return me.__wrap(e[0])}get_int16(t){const e=s.compactciphertextlistexpander_get_int16(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return xe.__wrap(e[0])}get_int24(t){const e=s.compactciphertextlistexpander_get_int24(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Fe.__wrap(e[0])}get_int32(t){const e=s.compactciphertextlistexpander_get_int32(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Me.__wrap(e[0])}get_int40(t){const e=s.compactciphertextlistexpander_get_int40(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ge.__wrap(e[0])}get_int48(t){const e=s.compactciphertextlistexpander_get_int48(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return He.__wrap(e[0])}get_int56(t){const e=s.compactciphertextlistexpander_get_int56(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ve.__wrap(e[0])}get_int64(t){const e=s.compactciphertextlistexpander_get_int64(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Je.__wrap(e[0])}get_int72(t){const e=s.compactciphertextlistexpander_get_int72(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return $e.__wrap(e[0])}get_int80(t){const e=s.compactciphertextlistexpander_get_int80(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ze.__wrap(e[0])}get_int88(t){const e=s.compactciphertextlistexpander_get_int88(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return qe.__wrap(e[0])}get_int96(t){const e=s.compactciphertextlistexpander_get_int96(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Ye.__wrap(e[0])}get_uint2(t){const e=s.compactciphertextlistexpander_get_uint2(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return wr.__wrap(e[0])}get_uint4(t){const e=s.compactciphertextlistexpander_get_uint4(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return vr.__wrap(e[0])}get_uint6(t){const e=s.compactciphertextlistexpander_get_uint6(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Cr.__wrap(e[0])}get_uint8(t){const e=s.compactciphertextlistexpander_get_uint8(this.__wbg_ptr,t);if(e[2])throw a(e[1]);return Fr.__wrap(e[0])}}Symbol.dispose&&(yn.prototype[Symbol.dispose]=yn.prototype.free);const cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_compactpkecrs_free(n>>>0,1));class $t{static __wrap(t){t=t>>>0;const e=Object.create($t.prototype);return e.__wbg_ptr=t,cu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,cu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_compactpkecrs_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.compactpkecrs_deserialize(e,r);if(i[2])throw a(i[1]);return $t.__wrap(i[0])}static from_config(t,e){p(t,mn);const r=s.compactpkecrs_from_config(t.__wbg_ptr,e);if(r[2])throw a(r[1]);return $t.__wrap(r[0])}safe_serialize(t){const e=s.compactpkecrs_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.compactpkecrs_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return $t.__wrap(o[0])}static deserialize_from_public_params(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.compactpkecrs_deserialize_from_public_params(e,r);if(i[2])throw a(i[1]);return $t.__wrap(i[0])}static safe_deserialize_from_public_params(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.compactpkecrs_safe_deserialize_from_public_params(r,i,e);if(o[2])throw a(o[1]);return $t.__wrap(o[0])}serialize(t){const e=s.compactpkecrs_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}}Symbol.dispose&&($t.prototype[Symbol.dispose]=$t.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfhebool_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint10_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint1024_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint104_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint112_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint12_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint120_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint128_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint136_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint14_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint144_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint152_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint16_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint160_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint168_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint176_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint184_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint192_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint2_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint200_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint2048_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint208_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint216_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint224_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint232_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint24_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint240_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint248_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint256_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint32_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint4_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint40_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint48_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint512_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint56_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint6_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint64_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint72_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint8_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint80_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint88_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheint96_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint10_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint1024_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint104_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint112_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint12_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint120_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint128_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint136_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint14_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint144_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint152_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint16_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint160_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint168_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint176_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint184_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint192_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint2_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint200_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint2048_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint208_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint216_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint224_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint232_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint24_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint240_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint248_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint256_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint32_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint4_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint40_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint48_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint512_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint56_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint6_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint64_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint72_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint8_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint80_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint88_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_compressedfheuint96_free(n>>>0,1));const _u=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fhebool_free(n>>>0,1));class ue{static __wrap(t){t=t>>>0;const e=Object.create(ue.prototype);return e.__wbg_ptr=t,_u.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,_u.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fhebool_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fhebool_deserialize(e,r);if(i[2])throw a(i[1]);return ue.__wrap(i[0])}safe_serialize(t){const e=s.fhebool_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fhebool_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ue.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fhebool_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ue.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fhebool_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ue.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fhebool_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ue.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fhebool_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]!==0}serialize(){const t=s.fhebool_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ue.prototype[Symbol.dispose]=ue.prototype.free);const lu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint10_free(n>>>0,1));class fe{static __wrap(t){t=t>>>0;const e=Object.create(fe.prototype);return e.__wbg_ptr=t,lu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,lu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint10_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint10_deserialize(e,r);if(i[2])throw a(i[1]);return fe.__wrap(i[0])}safe_serialize(t){const e=s.fheint10_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint10_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return fe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint10_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint10_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint10_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint10_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint10_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(fe.prototype[Symbol.dispose]=fe.prototype.free);const uu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint1024_free(n>>>0,1));class he{static __wrap(t){t=t>>>0;const e=Object.create(he.prototype);return e.__wbg_ptr=t,uu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,uu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint1024_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint1024_deserialize(e,r);if(i[2])throw a(i[1]);return he.__wrap(i[0])}safe_serialize(t){const e=s.fheint1024_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint1024_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return he.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint1024_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return he.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint1024_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return he.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint1024_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return he.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint1024_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint1024_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(he.prototype[Symbol.dispose]=he.prototype.free);const fu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint104_free(n>>>0,1));class pe{static __wrap(t){t=t>>>0;const e=Object.create(pe.prototype);return e.__wbg_ptr=t,fu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,fu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint104_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint104_deserialize(e,r);if(i[2])throw a(i[1]);return pe.__wrap(i[0])}safe_serialize(t){const e=s.fheint104_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint104_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return pe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint104_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint104_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint104_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint104_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint104_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(pe.prototype[Symbol.dispose]=pe.prototype.free);const hu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint112_free(n>>>0,1));class de{static __wrap(t){t=t>>>0;const e=Object.create(de.prototype);return e.__wbg_ptr=t,hu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,hu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint112_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint112_deserialize(e,r);if(i[2])throw a(i[1]);return de.__wrap(i[0])}safe_serialize(t){const e=s.fheint112_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint112_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return de.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint112_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return de.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint112_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return de.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint112_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return de.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint112_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint112_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(de.prototype[Symbol.dispose]=de.prototype.free);const pu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint12_free(n>>>0,1));class we{static __wrap(t){t=t>>>0;const e=Object.create(we.prototype);return e.__wbg_ptr=t,pu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,pu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint12_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint12_deserialize(e,r);if(i[2])throw a(i[1]);return we.__wrap(i[0])}safe_serialize(t){const e=s.fheint12_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint12_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return we.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint12_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return we.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint12_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return we.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint12_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return we.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint12_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint12_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(we.prototype[Symbol.dispose]=we.prototype.free);const du=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint120_free(n>>>0,1));class ge{static __wrap(t){t=t>>>0;const e=Object.create(ge.prototype);return e.__wbg_ptr=t,du.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,du.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint120_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint120_deserialize(e,r);if(i[2])throw a(i[1]);return ge.__wrap(i[0])}safe_serialize(t){const e=s.fheint120_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint120_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ge.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint120_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ge.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint120_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ge.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint120_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ge.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint120_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint120_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ge.prototype[Symbol.dispose]=ge.prototype.free);const wu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint128_free(n>>>0,1));class ye{static __wrap(t){t=t>>>0;const e=Object.create(ye.prototype);return e.__wbg_ptr=t,wu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,wu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint128_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint128_deserialize(e,r);if(i[2])throw a(i[1]);return ye.__wrap(i[0])}safe_serialize(t){const e=s.fheint128_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint128_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ye.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint128_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ye.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint128_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ye.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint128_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ye.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint128_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint128_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ye.prototype[Symbol.dispose]=ye.prototype.free);const gu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint136_free(n>>>0,1));class be{static __wrap(t){t=t>>>0;const e=Object.create(be.prototype);return e.__wbg_ptr=t,gu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,gu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint136_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint136_deserialize(e,r);if(i[2])throw a(i[1]);return be.__wrap(i[0])}safe_serialize(t){const e=s.fheint136_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint136_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return be.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint136_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return be.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint136_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return be.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint136_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return be.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint136_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint136_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(be.prototype[Symbol.dispose]=be.prototype.free);const yu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint14_free(n>>>0,1));class me{static __wrap(t){t=t>>>0;const e=Object.create(me.prototype);return e.__wbg_ptr=t,yu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,yu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint14_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint14_deserialize(e,r);if(i[2])throw a(i[1]);return me.__wrap(i[0])}safe_serialize(t){const e=s.fheint14_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint14_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return me.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint14_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return me.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint14_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return me.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint14_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return me.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint14_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint14_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(me.prototype[Symbol.dispose]=me.prototype.free);const bu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint144_free(n>>>0,1));class Ae{static __wrap(t){t=t>>>0;const e=Object.create(Ae.prototype);return e.__wbg_ptr=t,bu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,bu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint144_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint144_deserialize(e,r);if(i[2])throw a(i[1]);return Ae.__wrap(i[0])}safe_serialize(t){const e=s.fheint144_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint144_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ae.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint144_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ae.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint144_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ae.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint144_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ae.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint144_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint144_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ae.prototype[Symbol.dispose]=Ae.prototype.free);const mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint152_free(n>>>0,1));class Ee{static __wrap(t){t=t>>>0;const e=Object.create(Ee.prototype);return e.__wbg_ptr=t,mu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,mu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint152_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint152_deserialize(e,r);if(i[2])throw a(i[1]);return Ee.__wrap(i[0])}safe_serialize(t){const e=s.fheint152_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint152_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ee.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint152_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ee.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint152_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ee.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint152_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ee.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint152_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint152_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ee.prototype[Symbol.dispose]=Ee.prototype.free);const Au=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint16_free(n>>>0,1));class xe{static __wrap(t){t=t>>>0;const e=Object.create(xe.prototype);return e.__wbg_ptr=t,Au.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Au.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint16_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint16_deserialize(e,r);if(i[2])throw a(i[1]);return xe.__wrap(i[0])}safe_serialize(t){const e=s.fheint16_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint16_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return xe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint16_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint16_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint16_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint16_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint16_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(xe.prototype[Symbol.dispose]=xe.prototype.free);const Eu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint160_free(n>>>0,1));class Re{static __wrap(t){t=t>>>0;const e=Object.create(Re.prototype);return e.__wbg_ptr=t,Eu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Eu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint160_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint160_deserialize(e,r);if(i[2])throw a(i[1]);return Re.__wrap(i[0])}safe_serialize(t){const e=s.fheint160_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint160_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Re.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint160_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Re.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint160_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Re.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint160_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Re.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint160_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint160_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Re.prototype[Symbol.dispose]=Re.prototype.free);const xu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint168_free(n>>>0,1));class ze{static __wrap(t){t=t>>>0;const e=Object.create(ze.prototype);return e.__wbg_ptr=t,xu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,xu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint168_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint168_deserialize(e,r);if(i[2])throw a(i[1]);return ze.__wrap(i[0])}safe_serialize(t){const e=s.fheint168_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint168_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ze.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint168_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ze.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint168_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ze.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint168_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ze.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint168_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint168_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ze.prototype[Symbol.dispose]=ze.prototype.free);const Ru=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint176_free(n>>>0,1));class Pe{static __wrap(t){t=t>>>0;const e=Object.create(Pe.prototype);return e.__wbg_ptr=t,Ru.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ru.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint176_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint176_deserialize(e,r);if(i[2])throw a(i[1]);return Pe.__wrap(i[0])}safe_serialize(t){const e=s.fheint176_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint176_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Pe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint176_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint176_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint176_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint176_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint176_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Pe.prototype[Symbol.dispose]=Pe.prototype.free);const zu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint184_free(n>>>0,1));class Ie{static __wrap(t){t=t>>>0;const e=Object.create(Ie.prototype);return e.__wbg_ptr=t,zu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,zu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint184_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint184_deserialize(e,r);if(i[2])throw a(i[1]);return Ie.__wrap(i[0])}safe_serialize(t){const e=s.fheint184_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint184_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ie.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint184_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ie.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint184_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ie.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint184_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ie.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint184_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint184_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ie.prototype[Symbol.dispose]=Ie.prototype.free);const Pu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint192_free(n>>>0,1));class ve{static __wrap(t){t=t>>>0;const e=Object.create(ve.prototype);return e.__wbg_ptr=t,Pu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Pu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint192_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint192_deserialize(e,r);if(i[2])throw a(i[1]);return ve.__wrap(i[0])}safe_serialize(t){const e=s.fheint192_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint192_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ve.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint192_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ve.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint192_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ve.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint192_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ve.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint192_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint192_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ve.prototype[Symbol.dispose]=ve.prototype.free);const Iu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint2_free(n>>>0,1));class ke{static __wrap(t){t=t>>>0;const e=Object.create(ke.prototype);return e.__wbg_ptr=t,Iu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Iu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint2_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint2_deserialize(e,r);if(i[2])throw a(i[1]);return ke.__wrap(i[0])}safe_serialize(t){const e=s.fheint2_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint2_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ke.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint2_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ke.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint2_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ke.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint2_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ke.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint2_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint2_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ke.prototype[Symbol.dispose]=ke.prototype.free);const vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint200_free(n>>>0,1));class Se{static __wrap(t){t=t>>>0;const e=Object.create(Se.prototype);return e.__wbg_ptr=t,vu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,vu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint200_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint200_deserialize(e,r);if(i[2])throw a(i[1]);return Se.__wrap(i[0])}safe_serialize(t){const e=s.fheint200_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint200_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Se.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint200_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Se.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint200_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Se.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint200_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Se.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint200_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint200_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Se.prototype[Symbol.dispose]=Se.prototype.free);const ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint2048_free(n>>>0,1));class Be{static __wrap(t){t=t>>>0;const e=Object.create(Be.prototype);return e.__wbg_ptr=t,ku.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ku.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint2048_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint2048_deserialize(e,r);if(i[2])throw a(i[1]);return Be.__wrap(i[0])}safe_serialize(t){const e=s.fheint2048_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint2048_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Be.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint2048_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Be.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint2048_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Be.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint2048_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Be.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint2048_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint2048_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Be.prototype[Symbol.dispose]=Be.prototype.free);const Su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint208_free(n>>>0,1));class Te{static __wrap(t){t=t>>>0;const e=Object.create(Te.prototype);return e.__wbg_ptr=t,Su.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Su.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint208_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint208_deserialize(e,r);if(i[2])throw a(i[1]);return Te.__wrap(i[0])}safe_serialize(t){const e=s.fheint208_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint208_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Te.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint208_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Te.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint208_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Te.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint208_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Te.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint208_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint208_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Te.prototype[Symbol.dispose]=Te.prototype.free);const Bu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint216_free(n>>>0,1));class Ce{static __wrap(t){t=t>>>0;const e=Object.create(Ce.prototype);return e.__wbg_ptr=t,Bu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Bu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint216_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint216_deserialize(e,r);if(i[2])throw a(i[1]);return Ce.__wrap(i[0])}safe_serialize(t){const e=s.fheint216_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint216_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ce.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint216_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ce.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint216_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ce.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint216_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ce.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint216_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint216_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ce.prototype[Symbol.dispose]=Ce.prototype.free);const Tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint224_free(n>>>0,1));class Oe{static __wrap(t){t=t>>>0;const e=Object.create(Oe.prototype);return e.__wbg_ptr=t,Tu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Tu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint224_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint224_deserialize(e,r);if(i[2])throw a(i[1]);return Oe.__wrap(i[0])}safe_serialize(t){const e=s.fheint224_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint224_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Oe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint224_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Oe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint224_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Oe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint224_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Oe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint224_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint224_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Oe.prototype[Symbol.dispose]=Oe.prototype.free);const Cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint232_free(n>>>0,1));class Ne{static __wrap(t){t=t>>>0;const e=Object.create(Ne.prototype);return e.__wbg_ptr=t,Cu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Cu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint232_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint232_deserialize(e,r);if(i[2])throw a(i[1]);return Ne.__wrap(i[0])}safe_serialize(t){const e=s.fheint232_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint232_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ne.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint232_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ne.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint232_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ne.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint232_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ne.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint232_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint232_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ne.prototype[Symbol.dispose]=Ne.prototype.free);const Ou=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint24_free(n>>>0,1));class Fe{static __wrap(t){t=t>>>0;const e=Object.create(Fe.prototype);return e.__wbg_ptr=t,Ou.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ou.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint24_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint24_deserialize(e,r);if(i[2])throw a(i[1]);return Fe.__wrap(i[0])}safe_serialize(t){const e=s.fheint24_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint24_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Fe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint24_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint24_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint24_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint24_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint24_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Fe.prototype[Symbol.dispose]=Fe.prototype.free);const Nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint240_free(n>>>0,1));class Ue{static __wrap(t){t=t>>>0;const e=Object.create(Ue.prototype);return e.__wbg_ptr=t,Nu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Nu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint240_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint240_deserialize(e,r);if(i[2])throw a(i[1]);return Ue.__wrap(i[0])}safe_serialize(t){const e=s.fheint240_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint240_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ue.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint240_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ue.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint240_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ue.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint240_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ue.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint240_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint240_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ue.prototype[Symbol.dispose]=Ue.prototype.free);const Fu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint248_free(n>>>0,1));class De{static __wrap(t){t=t>>>0;const e=Object.create(De.prototype);return e.__wbg_ptr=t,Fu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Fu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint248_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint248_deserialize(e,r);if(i[2])throw a(i[1]);return De.__wrap(i[0])}safe_serialize(t){const e=s.fheint248_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint248_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return De.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint248_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return De.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint248_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return De.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint248_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return De.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint248_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint248_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(De.prototype[Symbol.dispose]=De.prototype.free);const Uu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint256_free(n>>>0,1));class Le{static __wrap(t){t=t>>>0;const e=Object.create(Le.prototype);return e.__wbg_ptr=t,Uu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Uu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint256_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint256_deserialize(e,r);if(i[2])throw a(i[1]);return Le.__wrap(i[0])}safe_serialize(t){const e=s.fheint256_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint256_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Le.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint256_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Le.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint256_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Le.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint256_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Le.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint256_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint256_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Le.prototype[Symbol.dispose]=Le.prototype.free);const Du=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint32_free(n>>>0,1));class Me{static __wrap(t){t=t>>>0;const e=Object.create(Me.prototype);return e.__wbg_ptr=t,Du.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Du.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint32_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint32_deserialize(e,r);if(i[2])throw a(i[1]);return Me.__wrap(i[0])}safe_serialize(t){const e=s.fheint32_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint32_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Me.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint32_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Me.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint32_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Me.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint32_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Me.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint32_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint32_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Me.prototype[Symbol.dispose]=Me.prototype.free);const Lu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint4_free(n>>>0,1));class je{static __wrap(t){t=t>>>0;const e=Object.create(je.prototype);return e.__wbg_ptr=t,Lu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Lu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint4_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint4_deserialize(e,r);if(i[2])throw a(i[1]);return je.__wrap(i[0])}safe_serialize(t){const e=s.fheint4_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint4_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return je.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint4_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return je.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint4_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return je.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint4_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return je.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint4_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint4_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(je.prototype[Symbol.dispose]=je.prototype.free);const Mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint40_free(n>>>0,1));class Ge{static __wrap(t){t=t>>>0;const e=Object.create(Ge.prototype);return e.__wbg_ptr=t,Mu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Mu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint40_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint40_deserialize(e,r);if(i[2])throw a(i[1]);return Ge.__wrap(i[0])}safe_serialize(t){const e=s.fheint40_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint40_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ge.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint40_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ge.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint40_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ge.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint40_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ge.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint40_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint40_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ge.prototype[Symbol.dispose]=Ge.prototype.free);const ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint48_free(n>>>0,1));class He{static __wrap(t){t=t>>>0;const e=Object.create(He.prototype);return e.__wbg_ptr=t,ju.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ju.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint48_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint48_deserialize(e,r);if(i[2])throw a(i[1]);return He.__wrap(i[0])}safe_serialize(t){const e=s.fheint48_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint48_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return He.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint48_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return He.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint48_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return He.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint48_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return He.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint48_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint48_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(He.prototype[Symbol.dispose]=He.prototype.free);const Gu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint512_free(n>>>0,1));class Ke{static __wrap(t){t=t>>>0;const e=Object.create(Ke.prototype);return e.__wbg_ptr=t,Gu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Gu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint512_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint512_deserialize(e,r);if(i[2])throw a(i[1]);return Ke.__wrap(i[0])}safe_serialize(t){const e=s.fheint512_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint512_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ke.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint512_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ke.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint512_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ke.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint512_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ke.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint512_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint512_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ke.prototype[Symbol.dispose]=Ke.prototype.free);const Hu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint56_free(n>>>0,1));class Ve{static __wrap(t){t=t>>>0;const e=Object.create(Ve.prototype);return e.__wbg_ptr=t,Hu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Hu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint56_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint56_deserialize(e,r);if(i[2])throw a(i[1]);return Ve.__wrap(i[0])}safe_serialize(t){const e=s.fheint56_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint56_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ve.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint56_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ve.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint56_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ve.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint56_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ve.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint56_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint56_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ve.prototype[Symbol.dispose]=Ve.prototype.free);const Ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint6_free(n>>>0,1));class Qe{static __wrap(t){t=t>>>0;const e=Object.create(Qe.prototype);return e.__wbg_ptr=t,Ku.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ku.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint6_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint6_deserialize(e,r);if(i[2])throw a(i[1]);return Qe.__wrap(i[0])}safe_serialize(t){const e=s.fheint6_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint6_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Qe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint6_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Qe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint6_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Qe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint6_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Qe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint6_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint6_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Qe.prototype[Symbol.dispose]=Qe.prototype.free);const Vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint64_free(n>>>0,1));class Je{static __wrap(t){t=t>>>0;const e=Object.create(Je.prototype);return e.__wbg_ptr=t,Vu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Vu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint64_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint64_deserialize(e,r);if(i[2])throw a(i[1]);return Je.__wrap(i[0])}safe_serialize(t){const e=s.fheint64_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint64_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Je.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint64_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Je.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint64_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Je.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint64_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Je.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint64_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint64_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Je.prototype[Symbol.dispose]=Je.prototype.free);const Qu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint72_free(n>>>0,1));class $e{static __wrap(t){t=t>>>0;const e=Object.create($e.prototype);return e.__wbg_ptr=t,Qu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Qu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint72_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint72_deserialize(e,r);if(i[2])throw a(i[1]);return $e.__wrap(i[0])}safe_serialize(t){const e=s.fheint72_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint72_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return $e.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint72_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return $e.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint72_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return $e.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint72_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return $e.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint72_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint72_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&($e.prototype[Symbol.dispose]=$e.prototype.free);const Ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint8_free(n>>>0,1));class We{static __wrap(t){t=t>>>0;const e=Object.create(We.prototype);return e.__wbg_ptr=t,Ju.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ju.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint8_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint8_deserialize(e,r);if(i[2])throw a(i[1]);return We.__wrap(i[0])}safe_serialize(t){const e=s.fheint8_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint8_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return We.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint8_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return We.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint8_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return We.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint8_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return We.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint8_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheint8_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(We.prototype[Symbol.dispose]=We.prototype.free);const $u=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint80_free(n>>>0,1));class Ze{static __wrap(t){t=t>>>0;const e=Object.create(Ze.prototype);return e.__wbg_ptr=t,$u.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$u.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint80_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint80_deserialize(e,r);if(i[2])throw a(i[1]);return Ze.__wrap(i[0])}safe_serialize(t){const e=s.fheint80_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint80_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ze.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint80_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ze.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint80_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ze.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint80_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ze.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint80_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint80_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ze.prototype[Symbol.dispose]=Ze.prototype.free);const Wu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint88_free(n>>>0,1));class qe{static __wrap(t){t=t>>>0;const e=Object.create(qe.prototype);return e.__wbg_ptr=t,Wu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Wu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint88_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint88_deserialize(e,r);if(i[2])throw a(i[1]);return qe.__wrap(i[0])}safe_serialize(t){const e=s.fheint88_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint88_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return qe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint88_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return qe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint88_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return qe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint88_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return qe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint88_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint88_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(qe.prototype[Symbol.dispose]=qe.prototype.free);const Zu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheint96_free(n>>>0,1));class Ye{static __wrap(t){t=t>>>0;const e=Object.create(Ye.prototype);return e.__wbg_ptr=t,Zu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Zu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheint96_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheint96_deserialize(e,r);if(i[2])throw a(i[1]);return Ye.__wrap(i[0])}safe_serialize(t){const e=s.fheint96_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheint96_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ye.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheint96_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ye.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheint96_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ye.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheint96_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ye.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheint96_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheint96_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ye.prototype[Symbol.dispose]=Ye.prototype.free);const qu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint10_free(n>>>0,1));class Xe{static __wrap(t){t=t>>>0;const e=Object.create(Xe.prototype);return e.__wbg_ptr=t,qu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,qu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint10_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint10_deserialize(e,r);if(i[2])throw a(i[1]);return Xe.__wrap(i[0])}safe_serialize(t){const e=s.fheuint10_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint10_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Xe.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint10_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Xe.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint10_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Xe.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint10_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Xe.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint10_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint10_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Xe.prototype[Symbol.dispose]=Xe.prototype.free);const Yu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint1024_free(n>>>0,1));class tr{static __wrap(t){t=t>>>0;const e=Object.create(tr.prototype);return e.__wbg_ptr=t,Yu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Yu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint1024_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint1024_deserialize(e,r);if(i[2])throw a(i[1]);return tr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint1024_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint1024_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return tr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint1024_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return tr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint1024_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return tr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint1024_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return tr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint1024_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint1024_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(tr.prototype[Symbol.dispose]=tr.prototype.free);const Xu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint104_free(n>>>0,1));class er{static __wrap(t){t=t>>>0;const e=Object.create(er.prototype);return e.__wbg_ptr=t,Xu.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Xu.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint104_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint104_deserialize(e,r);if(i[2])throw a(i[1]);return er.__wrap(i[0])}safe_serialize(t){const e=s.fheuint104_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint104_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return er.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint104_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return er.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint104_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return er.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint104_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return er.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint104_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint104_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(er.prototype[Symbol.dispose]=er.prototype.free);const tf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint112_free(n>>>0,1));class rr{static __wrap(t){t=t>>>0;const e=Object.create(rr.prototype);return e.__wbg_ptr=t,tf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,tf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint112_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint112_deserialize(e,r);if(i[2])throw a(i[1]);return rr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint112_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint112_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return rr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint112_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return rr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint112_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return rr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint112_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return rr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint112_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint112_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(rr.prototype[Symbol.dispose]=rr.prototype.free);const ef=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint12_free(n>>>0,1));class nr{static __wrap(t){t=t>>>0;const e=Object.create(nr.prototype);return e.__wbg_ptr=t,ef.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ef.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint12_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint12_deserialize(e,r);if(i[2])throw a(i[1]);return nr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint12_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint12_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return nr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint12_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return nr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint12_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return nr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint12_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return nr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint12_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint12_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(nr.prototype[Symbol.dispose]=nr.prototype.free);const rf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint120_free(n>>>0,1));class ir{static __wrap(t){t=t>>>0;const e=Object.create(ir.prototype);return e.__wbg_ptr=t,rf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint120_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint120_deserialize(e,r);if(i[2])throw a(i[1]);return ir.__wrap(i[0])}safe_serialize(t){const e=s.fheuint120_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint120_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ir.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint120_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ir.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint120_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ir.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint120_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ir.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint120_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint120_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ir.prototype[Symbol.dispose]=ir.prototype.free);const nf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint128_free(n>>>0,1));class sr{static __wrap(t){t=t>>>0;const e=Object.create(sr.prototype);return e.__wbg_ptr=t,nf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,nf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint128_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint128_deserialize(e,r);if(i[2])throw a(i[1]);return sr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint128_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint128_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return sr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint128_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return sr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint128_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return sr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint128_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return sr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint128_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint128_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(sr.prototype[Symbol.dispose]=sr.prototype.free);const sf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint136_free(n>>>0,1));class or{static __wrap(t){t=t>>>0;const e=Object.create(or.prototype);return e.__wbg_ptr=t,sf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,sf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint136_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint136_deserialize(e,r);if(i[2])throw a(i[1]);return or.__wrap(i[0])}safe_serialize(t){const e=s.fheuint136_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint136_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return or.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint136_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return or.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint136_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return or.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint136_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return or.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint136_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint136_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(or.prototype[Symbol.dispose]=or.prototype.free);const of=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint14_free(n>>>0,1));class ar{static __wrap(t){t=t>>>0;const e=Object.create(ar.prototype);return e.__wbg_ptr=t,of.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,of.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint14_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint14_deserialize(e,r);if(i[2])throw a(i[1]);return ar.__wrap(i[0])}safe_serialize(t){const e=s.fheuint14_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint14_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ar.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint14_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ar.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint14_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ar.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint14_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ar.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint14_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint14_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ar.prototype[Symbol.dispose]=ar.prototype.free);const af=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint144_free(n>>>0,1));class cr{static __wrap(t){t=t>>>0;const e=Object.create(cr.prototype);return e.__wbg_ptr=t,af.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,af.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint144_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint144_deserialize(e,r);if(i[2])throw a(i[1]);return cr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint144_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint144_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return cr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint144_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return cr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint144_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return cr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint144_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return cr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint144_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint144_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(cr.prototype[Symbol.dispose]=cr.prototype.free);const cf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint152_free(n>>>0,1));class _r{static __wrap(t){t=t>>>0;const e=Object.create(_r.prototype);return e.__wbg_ptr=t,cf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,cf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint152_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint152_deserialize(e,r);if(i[2])throw a(i[1]);return _r.__wrap(i[0])}safe_serialize(t){const e=s.fheuint152_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint152_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return _r.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint152_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _r.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint152_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _r.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint152_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return _r.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint152_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint152_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(_r.prototype[Symbol.dispose]=_r.prototype.free);const _f=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint16_free(n>>>0,1));class lr{static __wrap(t){t=t>>>0;const e=Object.create(lr.prototype);return e.__wbg_ptr=t,_f.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,_f.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint16_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint16_deserialize(e,r);if(i[2])throw a(i[1]);return lr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint16_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint16_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return lr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint16_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return lr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint16_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return lr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint16_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return lr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint16_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint16_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(lr.prototype[Symbol.dispose]=lr.prototype.free);const lf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint160_free(n>>>0,1));class ur{static __wrap(t){t=t>>>0;const e=Object.create(ur.prototype);return e.__wbg_ptr=t,lf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,lf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint160_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint160_deserialize(e,r);if(i[2])throw a(i[1]);return ur.__wrap(i[0])}safe_serialize(t){const e=s.fheuint160_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint160_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return ur.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint160_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ur.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint160_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ur.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint160_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return ur.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint160_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint160_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(ur.prototype[Symbol.dispose]=ur.prototype.free);const uf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint168_free(n>>>0,1));class fr{static __wrap(t){t=t>>>0;const e=Object.create(fr.prototype);return e.__wbg_ptr=t,uf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,uf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint168_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint168_deserialize(e,r);if(i[2])throw a(i[1]);return fr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint168_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint168_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return fr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint168_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint168_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint168_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return fr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint168_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint168_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(fr.prototype[Symbol.dispose]=fr.prototype.free);const ff=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint176_free(n>>>0,1));class hr{static __wrap(t){t=t>>>0;const e=Object.create(hr.prototype);return e.__wbg_ptr=t,ff.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ff.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint176_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint176_deserialize(e,r);if(i[2])throw a(i[1]);return hr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint176_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint176_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return hr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint176_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return hr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint176_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return hr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint176_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return hr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint176_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint176_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(hr.prototype[Symbol.dispose]=hr.prototype.free);const hf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint184_free(n>>>0,1));class pr{static __wrap(t){t=t>>>0;const e=Object.create(pr.prototype);return e.__wbg_ptr=t,hf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,hf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint184_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint184_deserialize(e,r);if(i[2])throw a(i[1]);return pr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint184_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint184_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return pr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint184_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint184_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint184_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return pr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint184_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint184_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(pr.prototype[Symbol.dispose]=pr.prototype.free);const pf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint192_free(n>>>0,1));class dr{static __wrap(t){t=t>>>0;const e=Object.create(dr.prototype);return e.__wbg_ptr=t,pf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,pf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint192_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint192_deserialize(e,r);if(i[2])throw a(i[1]);return dr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint192_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint192_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return dr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint192_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return dr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint192_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return dr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint192_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return dr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint192_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint192_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(dr.prototype[Symbol.dispose]=dr.prototype.free);const df=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint2_free(n>>>0,1));class wr{static __wrap(t){t=t>>>0;const e=Object.create(wr.prototype);return e.__wbg_ptr=t,df.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,df.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint2_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint2_deserialize(e,r);if(i[2])throw a(i[1]);return wr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint2_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint2_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return wr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint2_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return wr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint2_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return wr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint2_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return wr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint2_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint2_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(wr.prototype[Symbol.dispose]=wr.prototype.free);const wf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint200_free(n>>>0,1));class gr{static __wrap(t){t=t>>>0;const e=Object.create(gr.prototype);return e.__wbg_ptr=t,wf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,wf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint200_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint200_deserialize(e,r);if(i[2])throw a(i[1]);return gr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint200_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint200_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return gr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint200_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return gr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint200_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return gr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint200_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return gr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint200_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint200_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(gr.prototype[Symbol.dispose]=gr.prototype.free);const gf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint2048_free(n>>>0,1));class yr{static __wrap(t){t=t>>>0;const e=Object.create(yr.prototype);return e.__wbg_ptr=t,gf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,gf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint2048_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint2048_deserialize(e,r);if(i[2])throw a(i[1]);return yr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint2048_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint2048_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return yr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint2048_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return yr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint2048_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return yr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint2048_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return yr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint2048_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint2048_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(yr.prototype[Symbol.dispose]=yr.prototype.free);const yf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint208_free(n>>>0,1));class br{static __wrap(t){t=t>>>0;const e=Object.create(br.prototype);return e.__wbg_ptr=t,yf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,yf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint208_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint208_deserialize(e,r);if(i[2])throw a(i[1]);return br.__wrap(i[0])}safe_serialize(t){const e=s.fheuint208_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint208_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return br.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint208_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return br.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint208_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return br.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint208_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return br.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint208_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint208_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(br.prototype[Symbol.dispose]=br.prototype.free);const bf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint216_free(n>>>0,1));class mr{static __wrap(t){t=t>>>0;const e=Object.create(mr.prototype);return e.__wbg_ptr=t,bf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,bf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint216_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint216_deserialize(e,r);if(i[2])throw a(i[1]);return mr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint216_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint216_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return mr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint216_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return mr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint216_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return mr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint216_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return mr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint216_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint216_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(mr.prototype[Symbol.dispose]=mr.prototype.free);const mf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint224_free(n>>>0,1));class Ar{static __wrap(t){t=t>>>0;const e=Object.create(Ar.prototype);return e.__wbg_ptr=t,mf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,mf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint224_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint224_deserialize(e,r);if(i[2])throw a(i[1]);return Ar.__wrap(i[0])}safe_serialize(t){const e=s.fheuint224_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint224_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ar.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint224_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ar.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint224_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ar.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint224_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ar.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint224_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint224_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ar.prototype[Symbol.dispose]=Ar.prototype.free);const Af=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint232_free(n>>>0,1));class Er{static __wrap(t){t=t>>>0;const e=Object.create(Er.prototype);return e.__wbg_ptr=t,Af.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Af.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint232_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint232_deserialize(e,r);if(i[2])throw a(i[1]);return Er.__wrap(i[0])}safe_serialize(t){const e=s.fheuint232_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint232_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Er.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint232_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Er.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint232_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Er.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint232_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Er.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint232_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint232_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Er.prototype[Symbol.dispose]=Er.prototype.free);const Ef=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint24_free(n>>>0,1));class xr{static __wrap(t){t=t>>>0;const e=Object.create(xr.prototype);return e.__wbg_ptr=t,Ef.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ef.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint24_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint24_deserialize(e,r);if(i[2])throw a(i[1]);return xr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint24_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint24_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return xr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint24_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint24_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint24_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return xr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint24_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]>>>0}serialize(){const t=s.fheuint24_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(xr.prototype[Symbol.dispose]=xr.prototype.free);const xf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint240_free(n>>>0,1));class Rr{static __wrap(t){t=t>>>0;const e=Object.create(Rr.prototype);return e.__wbg_ptr=t,xf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,xf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint240_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint240_deserialize(e,r);if(i[2])throw a(i[1]);return Rr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint240_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint240_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Rr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint240_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Rr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint240_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Rr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint240_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Rr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint240_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint240_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Rr.prototype[Symbol.dispose]=Rr.prototype.free);const Rf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint248_free(n>>>0,1));class zr{static __wrap(t){t=t>>>0;const e=Object.create(zr.prototype);return e.__wbg_ptr=t,Rf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Rf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint248_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint248_deserialize(e,r);if(i[2])throw a(i[1]);return zr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint248_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint248_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return zr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint248_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return zr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint248_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return zr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint248_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return zr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint248_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint248_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(zr.prototype[Symbol.dispose]=zr.prototype.free);const zf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint256_free(n>>>0,1));class Pr{static __wrap(t){t=t>>>0;const e=Object.create(Pr.prototype);return e.__wbg_ptr=t,zf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,zf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint256_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint256_deserialize(e,r);if(i[2])throw a(i[1]);return Pr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint256_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint256_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Pr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint256_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint256_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint256_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Pr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint256_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint256_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Pr.prototype[Symbol.dispose]=Pr.prototype.free);const Pf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint32_free(n>>>0,1));class Ir{static __wrap(t){t=t>>>0;const e=Object.create(Ir.prototype);return e.__wbg_ptr=t,Pf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Pf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint32_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint32_deserialize(e,r);if(i[2])throw a(i[1]);return Ir.__wrap(i[0])}safe_serialize(t){const e=s.fheuint32_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint32_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ir.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint32_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ir.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint32_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ir.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint32_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ir.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint32_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]>>>0}serialize(){const t=s.fheuint32_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ir.prototype[Symbol.dispose]=Ir.prototype.free);const If=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint4_free(n>>>0,1));class vr{static __wrap(t){t=t>>>0;const e=Object.create(vr.prototype);return e.__wbg_ptr=t,If.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,If.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint4_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint4_deserialize(e,r);if(i[2])throw a(i[1]);return vr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint4_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint4_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return vr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint4_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return vr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint4_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return vr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint4_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return vr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint4_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint4_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(vr.prototype[Symbol.dispose]=vr.prototype.free);const vf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint40_free(n>>>0,1));class kr{static __wrap(t){t=t>>>0;const e=Object.create(kr.prototype);return e.__wbg_ptr=t,vf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,vf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint40_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint40_deserialize(e,r);if(i[2])throw a(i[1]);return kr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint40_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint40_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return kr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint40_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return kr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint40_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return kr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint40_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return kr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint40_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint40_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(kr.prototype[Symbol.dispose]=kr.prototype.free);const kf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint48_free(n>>>0,1));class Sr{static __wrap(t){t=t>>>0;const e=Object.create(Sr.prototype);return e.__wbg_ptr=t,kf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,kf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint48_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint48_deserialize(e,r);if(i[2])throw a(i[1]);return Sr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint48_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint48_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Sr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint48_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Sr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint48_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Sr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint48_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Sr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint48_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint48_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Sr.prototype[Symbol.dispose]=Sr.prototype.free);const Sf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint512_free(n>>>0,1));class Br{static __wrap(t){t=t>>>0;const e=Object.create(Br.prototype);return e.__wbg_ptr=t,Sf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Sf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint512_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint512_deserialize(e,r);if(i[2])throw a(i[1]);return Br.__wrap(i[0])}safe_serialize(t){const e=s.fheuint512_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint512_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Br.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint512_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Br.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint512_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Br.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint512_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Br.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint512_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint512_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Br.prototype[Symbol.dispose]=Br.prototype.free);const Bf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint56_free(n>>>0,1));class Tr{static __wrap(t){t=t>>>0;const e=Object.create(Tr.prototype);return e.__wbg_ptr=t,Bf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Bf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint56_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint56_deserialize(e,r);if(i[2])throw a(i[1]);return Tr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint56_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint56_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Tr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint56_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Tr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint56_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Tr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint56_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Tr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint56_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint56_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Tr.prototype[Symbol.dispose]=Tr.prototype.free);const Tf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint6_free(n>>>0,1));class Cr{static __wrap(t){t=t>>>0;const e=Object.create(Cr.prototype);return e.__wbg_ptr=t,Tf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Tf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint6_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint6_deserialize(e,r);if(i[2])throw a(i[1]);return Cr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint6_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint6_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Cr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint6_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Cr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint6_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Cr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint6_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Cr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint6_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint6_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Cr.prototype[Symbol.dispose]=Cr.prototype.free);const Cf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint64_free(n>>>0,1));class Or{static __wrap(t){t=t>>>0;const e=Object.create(Or.prototype);return e.__wbg_ptr=t,Cf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Cf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint64_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint64_deserialize(e,r);if(i[2])throw a(i[1]);return Or.__wrap(i[0])}safe_serialize(t){const e=s.fheuint64_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint64_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Or.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint64_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Or.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint64_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Or.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint64_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Or.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint64_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return BigInt.asUintN(64,e[0])}serialize(){const t=s.fheuint64_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Or.prototype[Symbol.dispose]=Or.prototype.free);const Of=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint72_free(n>>>0,1));class Nr{static __wrap(t){t=t>>>0;const e=Object.create(Nr.prototype);return e.__wbg_ptr=t,Of.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Of.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint72_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint72_deserialize(e,r);if(i[2])throw a(i[1]);return Nr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint72_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint72_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Nr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint72_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Nr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint72_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Nr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint72_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Nr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint72_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint72_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Nr.prototype[Symbol.dispose]=Nr.prototype.free);const Nf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint8_free(n>>>0,1));class Fr{static __wrap(t){t=t>>>0;const e=Object.create(Fr.prototype);return e.__wbg_ptr=t,Nf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Nf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint8_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint8_deserialize(e,r);if(i[2])throw a(i[1]);return Fr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint8_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint8_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Fr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint8_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint8_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint8_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Fr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint8_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return e[0]}serialize(){const t=s.fheuint8_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Fr.prototype[Symbol.dispose]=Fr.prototype.free);const Ff=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint80_free(n>>>0,1));class Ur{static __wrap(t){t=t>>>0;const e=Object.create(Ur.prototype);return e.__wbg_ptr=t,Ff.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ff.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint80_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint80_deserialize(e,r);if(i[2])throw a(i[1]);return Ur.__wrap(i[0])}safe_serialize(t){const e=s.fheuint80_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint80_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Ur.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint80_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ur.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint80_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ur.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint80_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Ur.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint80_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint80_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Ur.prototype[Symbol.dispose]=Ur.prototype.free);const Uf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint88_free(n>>>0,1));class Dr{static __wrap(t){t=t>>>0;const e=Object.create(Dr.prototype);return e.__wbg_ptr=t,Uf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Uf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint88_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint88_deserialize(e,r);if(i[2])throw a(i[1]);return Dr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint88_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint88_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Dr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint88_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Dr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint88_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Dr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint88_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Dr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint88_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint88_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Dr.prototype[Symbol.dispose]=Dr.prototype.free);const Df=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_fheuint96_free(n>>>0,1));class Lr{static __wrap(t){t=t>>>0;const e=Object.create(Lr.prototype);return e.__wbg_ptr=t,Df.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Df.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_fheuint96_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.fheuint96_deserialize(e,r);if(i[2])throw a(i[1]);return Lr.__wrap(i[0])}safe_serialize(t){const e=s.fheuint96_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.fheuint96_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Lr.__wrap(o[0])}static encrypt_with_client_key(t,e){p(e,A);const r=s.fheuint96_encrypt_with_client_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Lr.__wrap(r[0])}static encrypt_with_public_key(t,e){p(e,S);const r=s.fheuint96_encrypt_with_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Lr.__wrap(r[0])}static encrypt_with_compressed_public_key(t,e){p(e,B);const r=s.fheuint96_encrypt_with_compressed_public_key(t,e.__wbg_ptr);if(r[2])throw a(r[1]);return Lr.__wrap(r[0])}decrypt(t){p(t,A);const e=s.fheuint96_decrypt(this.__wbg_ptr,t.__wbg_ptr);if(e[2])throw a(e[1]);return a(e[0])}serialize(){const t=s.fheuint96_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Lr.prototype[Symbol.dispose]=Lr.prototype.free);const Lf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_provencompactciphertextlist_free(n>>>0,1));class bn{static __wrap(t){t=t>>>0;const e=Object.create(bn.prototype);return e.__wbg_ptr=t,Lf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Lf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_provencompactciphertextlist_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.provencompactciphertextlist_deserialize(e,r);if(i[2])throw a(i[1]);return bn.__wrap(i[0])}get_kind_of(t){const e=s.provencompactciphertextlist_get_kind_of(this.__wbg_ptr,t);return e===84?void 0:e}safe_serialize(t){const e=s.provencompactciphertextlist_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.provencompactciphertextlist_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return bn.__wrap(o[0])}verify_and_expand(t,e,r){p(t,$t),p(e,Wt);const i=b(r,s.__wbindgen_malloc),o=w,c=s.provencompactciphertextlist_verify_and_expand(this.__wbg_ptr,t.__wbg_ptr,e.__wbg_ptr,i,o);if(c[2])throw a(c[1]);return yn.__wrap(c[0])}expand_without_verification(){const t=s.provencompactciphertextlist_expand_without_verification(this.__wbg_ptr);if(t[2])throw a(t[1]);return yn.__wrap(t[0])}len(){return s.compactciphertextlistexpander_len(this.__wbg_ptr)>>>0}static builder(t){p(t,Wt);const e=s.provencompactciphertextlist_builder(t.__wbg_ptr);if(e[2])throw a(e[1]);return Jn.__wrap(e[0])}is_empty(){return s.compactciphertextlistexpander_is_empty(this.__wbg_ptr)!==0}serialize(){const t=s.provencompactciphertextlist_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(bn.prototype[Symbol.dispose]=bn.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortint_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintclientkey_free(n>>>0,1));const Ca=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_shortintcompactpublickeyencryptionparameters_free(n>>>0,1));class $n{static __wrap(t){t=t>>>0;const e=Object.create($n.prototype);return e.__wbg_ptr=t,Ca.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Ca.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_shortintcompactpublickeyencryptionparameters_free(t,0)}static new_parameters(t,e,r,i,o,c,_,l){p(e,Ei);const u=s.shortintcompactpublickeyencryptionparameters_new_parameters(t,e.__wbg_ptr,r,i,o,c,_,l);if(u[2])throw a(u[1]);return $n.__wrap(u[0])}constructor(t){const e=s.shortintcompactpublickeyencryptionparameters_new(t);return this.__wbg_ptr=e>>>0,Ca.register(this,this.__wbg_ptr,this),this}}Symbol.dispose&&($n.prototype[Symbol.dispose]=$n.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintcompressedciphertext_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintcompressedpublickey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintcompressedserverkey_free(n>>>0,1));const Mf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_shortintnoisedistribution_free(n>>>0,1));class Ei{static __wrap(t){t=t>>>0;const e=Object.create(Ei.prototype);return e.__wbg_ptr=t,Mf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Mf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_shortintnoisedistribution_free(t,0)}}Symbol.dispose&&(Ei.prototype[Symbol.dispose]=Ei.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintparameters_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_shortintpublickey_free(n>>>0,1));const jf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfheclientkey_free(n>>>0,1));class A{static __wrap(t){t=t>>>0;const e=Object.create(A.prototype);return e.__wbg_ptr=t,jf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,jf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfheclientkey_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.tfheclientkey_deserialize(e,r);if(i[2])throw a(i[1]);return A.__wrap(i[0])}safe_serialize(t){const e=s.tfheclientkey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.tfheclientkey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return A.__wrap(o[0])}static generate_with_seed(t,e){p(t,mn);const r=s.tfheclientkey_generate_with_seed(t.__wbg_ptr,e);if(r[2])throw a(r[1]);return A.__wrap(r[0])}static generate(t){p(t,mn);const e=s.tfheclientkey_generate(t.__wbg_ptr);if(e[2])throw a(e[1]);return A.__wrap(e[0])}serialize(){const t=s.tfheclientkey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(A.prototype[Symbol.dispose]=A.prototype.free);const Gf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfhecompactpublickey_free(n>>>0,1));class Wt{static __wrap(t){t=t>>>0;const e=Object.create(Wt.prototype);return e.__wbg_ptr=t,Gf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Gf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfhecompactpublickey_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.tfhecompactpublickey_deserialize(e,r);if(i[2])throw a(i[1]);return Wt.__wrap(i[0])}safe_serialize(t){const e=s.tfhecompactpublickey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.tfhecompactpublickey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return Wt.__wrap(o[0])}static safe_deserialize_conformant(t,e,r){const i=b(t,s.__wbindgen_malloc),o=w;p(r,$n);const c=s.tfhecompactpublickey_safe_deserialize_conformant(i,o,e,r.__wbg_ptr);if(c[2])throw a(c[1]);return Wt.__wrap(c[0])}static new(t){p(t,A);const e=s.tfhecompactpublickey_new(t.__wbg_ptr);if(e[2])throw a(e[1]);return Wt.__wrap(e[0])}serialize(){const t=s.tfhecompactpublickey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(Wt.prototype[Symbol.dispose]=Wt.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfhecompressedcompactpublickey_free(n>>>0,1));const Hf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfhecompressedpublickey_free(n>>>0,1));class B{static __wrap(t){t=t>>>0;const e=Object.create(B.prototype);return e.__wbg_ptr=t,Hf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Hf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfhecompressedpublickey_free(t,0)}decompress(){const t=s.tfhecompressedpublickey_decompress(this.__wbg_ptr);if(t[2])throw a(t[1]);return S.__wrap(t[0])}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.tfhecompressedpublickey_deserialize(e,r);if(i[2])throw a(i[1]);return B.__wrap(i[0])}safe_serialize(t){const e=s.tfhecompressedpublickey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.tfhecompressedpublickey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return B.__wrap(o[0])}static new(t){p(t,A);const e=s.tfhecompressedpublickey_new(t.__wbg_ptr);if(e[2])throw a(e[1]);return B.__wrap(e[0])}serialize(){const t=s.tfhecompressedpublickey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(B.prototype[Symbol.dispose]=B.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfhecompressedserverkey_free(n>>>0,1));const Kf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfheconfig_free(n>>>0,1));class mn{static __wrap(t){t=t>>>0;const e=Object.create(mn.prototype);return e.__wbg_ptr=t,Kf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Kf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfheconfig_free(t,0)}}Symbol.dispose&&(mn.prototype[Symbol.dispose]=mn.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfheconfigbuilder_free(n>>>0,1));const Vf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_tfhepublickey_free(n>>>0,1));class S{static __wrap(t){t=t>>>0;const e=Object.create(S.prototype);return e.__wbg_ptr=t,Vf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Vf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_tfhepublickey_free(t,0)}static deserialize(t){const e=b(t,s.__wbindgen_malloc),r=w,i=s.tfhepublickey_deserialize(e,r);if(i[2])throw a(i[1]);return S.__wrap(i[0])}safe_serialize(t){const e=s.tfhepublickey_safe_serialize(this.__wbg_ptr,t);if(e[3])throw a(e[2]);var r=m(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),r}static safe_deserialize(t,e){const r=b(t,s.__wbindgen_malloc),i=w,o=s.tfhepublickey_safe_deserialize(r,i,e);if(o[2])throw a(o[1]);return S.__wrap(o[0])}static new(t){p(t,A);const e=s.tfhepublickey_new(t.__wbg_ptr);if(e[2])throw a(e[1]);return S.__wrap(e[0])}serialize(){const t=s.tfhepublickey_serialize(this.__wbg_ptr);if(t[3])throw a(t[2]);var e=m(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*1,1),e}}Symbol.dispose&&(S.prototype[Symbol.dispose]=S.prototype.free),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfheserverkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>s.__wbg_tfhe_free(n>>>0,1));const Qf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_wbg_rayon_poolbuilder_free(n>>>0,1));class xi{static __wrap(t){t=t>>>0;const e=Object.create(xi.prototype);return e.__wbg_ptr=t,Qf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Qf.unregister(this),t}free(){const t=this.__destroy_into_raw();s.__wbg_wbg_rayon_poolbuilder_free(t,0)}numThreads(){return s.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr)>>>0}build(){s.wbg_rayon_poolbuilder_build(this.__wbg_ptr)}receiver(){return s.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr)>>>0}}Symbol.dispose&&(xi.prototype[Symbol.dispose]=xi.prototype.free);const Ky=new Set(["basic","cors","default"]);async function Vy(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(r){if(n.ok&&Ky.has(n.type)&&n.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function Qy(){const n={};return n.wbg={},n.wbg.__wbg_BigInt_40a77d45cca49470=function(){return mi(function(t){return BigInt(t)},arguments)},n.wbg.__wbg_BigInt_6adbfd8eb0f7ec07=function(t){return BigInt(t)},n.wbg.__wbg_Error_e17e777aac105295=function(t,e){return Error(os(t,e))},n.wbg.__wbg_call_13410aac570ffff7=function(){return mi(function(t,e){return t.call(e)},arguments)},n.wbg.__wbg_call_a5400b25a865cfd8=function(){return mi(function(t,e,r){return t.call(e,r)},arguments)},n.wbg.__wbg_crypto_574e78ad8b13b65f=function(t){return t.crypto},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(t,e){let r,i;try{r=t,i=e,console.error(os(t,e))}finally{s.__wbindgen_free(r,i,1)}},n.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return mi(function(t,e){t.getRandomValues(e)},arguments)},n.wbg.__wbg_getTime_6bb3f64e0f18f817=function(t){return t.getTime()},n.wbg.__wbg_instanceof_Window_12d20d558ef92592=function(t){let e;try{e=t instanceof Window}catch{e=!1}return e},n.wbg.__wbg_length_6bb7e81f9d7713e4=function(t){return t.length},n.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(t){return t.msCrypto},n.wbg.__wbg_new0_b0a0a38c201e6df5=function(){return new Date},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},n.wbg.__wbg_newnoargs_254190557c45b4ec=function(t,e){return new Function(os(t,e))},n.wbg.__wbg_newwithlength_a167dcc7aaa3ba77=function(t){return new Uint8Array(t>>>0)},n.wbg.__wbg_node_905d3e251edff8a2=function(t){return t.node},n.wbg.__wbg_process_dc0fbacc7c1c06f7=function(t){return t.process},n.wbg.__wbg_prototypesetcall_3d4a26c1ed734349=function(t,e,r){Uint8Array.prototype.set.call(m(t,e),r)},n.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return mi(function(t,e){t.randomFillSync(e)},arguments)},n.wbg.__wbg_require_60cc747a6bc5215a=function(){return mi(function(){return module.require},arguments)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(t,e){const r=e.stack,i=ao(r,s.__wbindgen_malloc,s.__wbindgen_realloc),o=w;Jr().setInt32(t+4*1,o,!0),Jr().setInt32(t+4*0,i,!0)},n.wbg.__wbg_startWorkers_2ca11761e08ff5d5=function(t,e,r){return My(t,e,xi.__wrap(r))},n.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12=function(){const t=typeof io>"u"?null:io;return Qn(t)?0:is(t)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184=function(){const t=typeof globalThis>"u"?null:globalThis;return Qn(t)?0:is(t)},n.wbg.__wbg_static_accessor_SELF_995b214ae681ff99=function(){const t=typeof self>"u"?null:self;return Qn(t)?0:is(t)},n.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea=function(){const t=typeof window>"u"?null:window;return Qn(t)?0:is(t)},n.wbg.__wbg_subarray_70fd07feefe14294=function(t,e,r){return t.subarray(e>>>0,r>>>0)},n.wbg.__wbg_toString_1f1286a7a97689fe=function(t,e,r){const i=e.toString(r),o=ao(i,s.__wbindgen_malloc,s.__wbindgen_realloc),c=w;Jr().setInt32(t+4*1,c,!0),Jr().setInt32(t+4*0,o,!0)},n.wbg.__wbg_toString_d8f537919ef401d6=function(t){return t.toString()},n.wbg.__wbg_versions_c01dfd4722a88165=function(t){return t.versions},n.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1=function(t,e){const r=e,i=typeof r=="bigint"?r:void 0;Jr().setBigInt64(t+8*1,Qn(i)?BigInt(0):i,!0),Jr().setInt32(t+4*0,!Qn(i),!0)},n.wbg.__wbg_wbindgenbitand_24bfc92ff26d44cb=function(t,e){return t&e},n.wbg.__wbg_wbindgenbitor_87169f71f306a104=function(t,e){return t|e},n.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d=function(t,e){const r=Sa(e),i=ao(r,s.__wbindgen_malloc,s.__wbindgen_realloc),o=w;Jr().setInt32(t+4*1,o,!0),Jr().setInt32(t+4*0,i,!0)},n.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74=function(t){return typeof t=="function"},n.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8=function(t){const e=t;return typeof e=="object"&&e!==null},n.wbg.__wbg_wbindgenisstring_d4fa939789f003b0=function(t){return typeof t=="string"},n.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5=function(t){return t===void 0},n.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58=function(t,e){return t===e},n.wbg.__wbg_wbindgenlt_544155a2b3097bd5=function(t,e){return t<e},n.wbg.__wbg_wbindgenmemory_d84da70f7c42d172=function(){return s.memory},n.wbg.__wbg_wbindgenmodule_7e59019f6366ff9c=function(){return cs.__wbindgen_wasm_module},n.wbg.__wbg_wbindgenneg_3577d8a6fd6fd98b=function(t){return-t},n.wbg.__wbg_wbindgenshl_54c6fe049ff902f0=function(t,e){return t<<e},n.wbg.__wbg_wbindgenshr_7d2aae6044c0dab1=function(t,e){return t>>e},n.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f=function(t,e){const r=e,i=typeof r=="string"?r:void 0;var o=Qn(i)?0:ao(i,s.__wbindgen_malloc,s.__wbindgen_realloc),c=w;Jr().setInt32(t+4*1,c,!0),Jr().setInt32(t+4*0,o,!0)},n.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6=function(t,e){throw new Error(os(t,e))},n.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,e){return os(t,e)},n.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(t,e){return BigInt.asUintN(64,t)|e<<BigInt(64)},n.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(t){return BigInt.asUintN(64,t)},n.wbg.__wbindgen_cast_9ae0607507abb057=function(t){return t},n.wbg.__wbindgen_cast_cb9088102bce6b30=function(t,e){return m(t,e)},n.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(t){return t},n.wbg.__wbindgen_cast_e7b45dd881f38ce3=function(t,e){return BigInt.asUintN(64,t)|BigInt.asUintN(64,e)<<BigInt(64)},n.wbg.__wbindgen_init_externref_table=function(){const t=s.__wbindgen_export_2,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},n}function Jy(n,t){n.wbg.memory=t||new WebAssembly.Memory({initial:21,maximum:16384,shared:!0})}function $y(n,t,e){if(s=n.exports,cs.__wbindgen_wasm_module=t,as=null,ss=null,typeof e<"u"&&(typeof e!="number"||e===0||e%65536!==0))throw"invalid stack size";return s.__wbindgen_start(e),s}async function cs(n,t){if(s!==void 0)return s;let e;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n,memory:t,thread_stack_size:e}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof n>"u"&&(n=new URL("/tfhe_bg.wasm",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Vt&&Vt.tagName.toUpperCase()==="SCRIPT"&&Vt.src||new URL("relayer-sdk-js.umd.cjs",document.baseURI).href));const r=Qy();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n)),Jy(r,t);const{instance:i,module:o}=await Vy(await n,r);return $y(i,o,e)}var Wy=Object.freeze({__proto__:null,CompactCiphertextList:$r,CompactCiphertextListBuilder:Jn,CompactCiphertextListExpander:yn,CompactPkeCrs:$t,FheBool:ue,FheInt10:fe,FheInt1024:he,FheInt104:pe,FheInt112:de,FheInt12:we,FheInt120:ge,FheInt128:ye,FheInt136:be,FheInt14:me,FheInt144:Ae,FheInt152:Ee,FheInt16:xe,FheInt160:Re,FheInt168:ze,FheInt176:Pe,FheInt184:Ie,FheInt192:ve,FheInt2:ke,FheInt200:Se,FheInt2048:Be,FheInt208:Te,FheInt216:Ce,FheInt224:Oe,FheInt232:Ne,FheInt24:Fe,FheInt240:Ue,FheInt248:De,FheInt256:Le,FheInt32:Me,FheInt4:je,FheInt40:Ge,FheInt48:He,FheInt512:Ke,FheInt56:Ve,FheInt6:Qe,FheInt64:Je,FheInt72:$e,FheInt8:We,FheInt80:Ze,FheInt88:qe,FheInt96:Ye,FheUint10:Xe,FheUint1024:tr,FheUint104:er,FheUint112:rr,FheUint12:nr,FheUint120:ir,FheUint128:sr,FheUint136:or,FheUint14:ar,FheUint144:cr,FheUint152:_r,FheUint16:lr,FheUint160:ur,FheUint168:fr,FheUint176:hr,FheUint184:pr,FheUint192:dr,FheUint2:wr,FheUint200:gr,FheUint2048:yr,FheUint208:br,FheUint216:mr,FheUint224:Ar,FheUint232:Er,FheUint24:xr,FheUint240:Rr,FheUint248:zr,FheUint256:Pr,FheUint32:Ir,FheUint4:vr,FheUint40:kr,FheUint48:Sr,FheUint512:Br,FheUint56:Tr,FheUint6:Cr,FheUint64:Or,FheUint72:Nr,FheUint8:Fr,FheUint80:Ur,FheUint88:Dr,FheUint96:Lr,ProvenCompactCiphertextList:bn,ShortintCompactPublicKeyEncryptionParameters:$n,ShortintNoiseDistribution:Ei,TfheClientKey:A,TfheCompactPublicKey:Wt,TfheCompressedPublicKey:B,TfheConfig:mn,TfhePublicKey:S,ZkComputeLoad:iu,default:cs,initThreadPool:Ta,init_panic_hook:Ba,wbg_rayon_PoolBuilder:xi,wbg_rayon_start_worker:Hy});let P,ut=0,_s=null;function Ri(){return(_s===null||_s.byteLength===0)&&(_s=new Uint8Array(P.memory.buffer)),_s}const co=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Zy=typeof co.encodeInto=="function"?function(n,t){return co.encodeInto(n,t)}:function(n,t){const e=co.encode(n);return t.set(e),{read:n.length,written:e.length}};function Wn(n,t,e){if(e===void 0){const _=co.encode(n),l=t(_.length,1)>>>0;return Ri().subarray(l,l+_.length).set(_),ut=_.length,l}let r=n.length,i=t(r,1)>>>0;const o=Ri();let c=0;for(;c<r;c++){const _=n.charCodeAt(c);if(_>127)break;o[i+c]=_}if(c!==r){c!==0&&(n=n.slice(c)),i=e(i,r,r=c+n.length*3,1)>>>0;const _=Ri().subarray(i+c,i+r),l=Zy(n,_);c+=l.written,i=e(i,r,c,1)>>>0}return ut=c,i}let Zn=null;function ee(){return(Zn===null||Zn.buffer.detached===!0||Zn.buffer.detached===void 0&&Zn.buffer!==P.memory.buffer)&&(Zn=new DataView(P.memory.buffer)),Zn}function zi(n){const t=P.__externref_table_alloc();return P.__wbindgen_export_4.set(t,n),t}function qn(n,t){try{return n.apply(this,t)}catch(e){const r=zi(e);P.__wbindgen_exn_store(r)}}const Jf=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Jf.decode();function ls(n,t){return n=n>>>0,Jf.decode(Ri().subarray(n,n+t))}function An(n){return n==null}function Oa(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){const i=n.length;let o="[";i>0&&(o+=Oa(n[0]));for(let c=1;c<i;c++)o+=", "+Oa(n[c]);return o+="]",o}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(e&&e.length>1)r=e[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
|
3
|
+
${n.stack}`:r}function Yn(n,t){if(!(n instanceof t))throw new Error(`expected instance of ${t.name}`)}function re(n,t){return n=n>>>0,Ri().subarray(n/1,n/1+t)}function ne(n,t){const e=t(n.length*1,1)>>>0;return Ri().set(n,e/1),ut=n.length,e}function Xn(n){const t=P.__wbindgen_export_4.get(n);return P.__externref_table_dealloc(n),t}function qy(n,t){const e=Wn(t,P.__wbindgen_malloc,P.__wbindgen_realloc),r=ut,i=P.new_server_id_addr(n,e,r);if(i[2])throw Xn(i[1]);return Ii.__wrap(i[0])}function $f(n,t){const e=t(n.length*4,4)>>>0;for(let r=0;r<n.length;r++){const i=zi(n[r]);ee().setUint32(e+4*r,i,!0)}return ut=n.length,e}function Yy(n,t,e){const r=$f(n,P.__wbindgen_malloc),i=ut,o=Wn(t,P.__wbindgen_malloc,P.__wbindgen_realloc),c=ut,_=Wn(e,P.__wbindgen_malloc,P.__wbindgen_realloc),l=ut,u=P.new_client(r,i,o,c,_,l);if(u[2])throw Xn(u[1]);return _o.__wrap(u[0])}function Wf(n,t){n=n>>>0;const e=ee(),r=[];for(let i=n;i<n+4*t;i+=4)r.push(P.__wbindgen_export_4.get(e.getUint32(i,!0)));return P.__externref_drop_slice(n,t),r}function Xy(){const n=P.ml_kem_pke_keygen();return ti.__wrap(n)}function tb(n){Yn(n,ti);const t=P.ml_kem_pke_get_pk(n.__wbg_ptr);return Pi.__wrap(t)}function eb(n){Yn(n,Pi);const t=P.ml_kem_pke_pk_to_u8vec(n.__wbg_ptr);if(t[3])throw Xn(t[2]);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}function rb(n){Yn(n,ti);const t=P.ml_kem_pke_sk_to_u8vec(n.__wbg_ptr);if(t[3])throw Xn(t[2]);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}function nb(n){const t=ne(n,P.__wbindgen_malloc),e=ut,r=P.u8vec_to_ml_kem_pke_pk(t,e);if(r[2])throw Xn(r[1]);return Pi.__wrap(r[0])}function ib(n){const t=ne(n,P.__wbindgen_malloc),e=ut,r=P.u8vec_to_ml_kem_pke_sk(t,e);if(r[2])throw Xn(r[1]);return ti.__wrap(r[0])}function sb(n,t,e,r,i,o,c){Yn(n,_o),Yn(i,Pi),Yn(o,ti);const _=P.process_user_decryption_resp_from_js(n.__wbg_ptr,t,e,r,i.__wbg_ptr,o.__wbg_ptr,c);if(_[3])throw Xn(_[2]);var l=Wf(_[0],_[1]).slice();return P.__wbindgen_free(_[0],_[1]*4,4),l}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_ciphertexthandle_free(n>>>0,1));const Zf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_client_free(n>>>0,1));class _o{static __wrap(t){t=t>>>0;const e=Object.create(_o.prototype);return e.__wbg_ptr=t,Zf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Zf.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_client_free(t,0)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_eip712domainmsg_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_parseduserdecryptionrequest_free(n>>>0,1));const qf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_privateenckeymlkem512_free(n>>>0,1));class ti{static __wrap(t){t=t>>>0;const e=Object.create(ti.prototype);return e.__wbg_ptr=t,qf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,qf.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_privateenckeymlkem512_free(t,0)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_privatesigkey_free(n>>>0,1));const Yf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_publicenckeymlkem512_free(n>>>0,1));class Pi{static __wrap(t){t=t>>>0;const e=Object.create(Pi.prototype);return e.__wbg_ptr=t,Yf.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Yf.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_publicenckeymlkem512_free(t,0)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_publicsigkey_free(n>>>0,1)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_requestid_free(n>>>0,1));const Xf=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_serveridaddr_free(n>>>0,1));class Ii{static __wrap(t){t=t>>>0;const e=Object.create(Ii.prototype);return e.__wbg_ptr=t,Xf.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof Ii?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Xf.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_serveridaddr_free(t,0)}}const th=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_typedciphertext_free(n>>>0,1));class us{static __wrap(t){t=t>>>0;const e=Object.create(us.prototype);return e.__wbg_ptr=t,th.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof us?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,th.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_typedciphertext_free(t,0)}get ciphertext(){const t=P.__wbg_get_typedciphertext_ciphertext(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set ciphertext(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get fhe_type(){return P.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr)}set fhe_type(t){P.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr,t)}get external_handle(){const t=P.__wbg_get_typedciphertext_external_handle(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set external_handle(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get ciphertext_format(){return P.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr)}set ciphertext_format(t){P.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr,t)}}const eh=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_typedplaintext_free(n>>>0,1));class Na{static __wrap(t){t=t>>>0;const e=Object.create(Na.prototype);return e.__wbg_ptr=t,eh.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,eh.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_typedplaintext_free(t,0)}get bytes(){const t=P.__wbg_get_typedplaintext_bytes(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set bytes(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get fhe_type(){return P.__wbg_get_typedplaintext_fhe_type(this.__wbg_ptr)}set fhe_type(t){P.__wbg_set_typedplaintext_fhe_type(this.__wbg_ptr,t)}}const rh=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_typedsigncryptedciphertext_free(n>>>0,1));class fs{static __wrap(t){t=t>>>0;const e=Object.create(fs.prototype);return e.__wbg_ptr=t,rh.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof fs?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rh.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_typedsigncryptedciphertext_free(t,0)}get fhe_type(){return P.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr)}set fhe_type(t){P.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr,t)}get signcrypted_ciphertext(){const t=P.__wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set signcrypted_ciphertext(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get external_handle(){const t=P.__wbg_get_typedsigncryptedciphertext_external_handle(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set external_handle(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get packing_factor(){return P.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr)>>>0}set packing_factor(t){P.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr,t)}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>P.__wbg_userdecryptionrequest_free(n>>>0,1));const ob=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_userdecryptionresponse_free(n>>>0,1));class Fa{static __unwrap(t){return t instanceof Fa?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ob.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_userdecryptionresponse_free(t,0)}get signature(){const t=P.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set signature(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get external_signature(){const t=P.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set external_signature(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get payload(){const t=P.__wbg_get_userdecryptionresponse_payload(this.__wbg_ptr);return t===0?void 0:lo.__wrap(t)}set payload(t){let e=0;An(t)||(Yn(t,lo),e=t.__destroy_into_raw()),P.__wbg_set_userdecryptionresponse_payload(this.__wbg_ptr,e)}get extra_data(){const t=P.__wbg_get_userdecryptionresponse_extra_data(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set extra_data(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr,e,r)}}const nh=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>P.__wbg_userdecryptionresponsepayload_free(n>>>0,1));class lo{static __wrap(t){t=t>>>0;const e=Object.create(lo.prototype);return e.__wbg_ptr=t,nh.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,nh.unregister(this),t}free(){const t=this.__destroy_into_raw();P.__wbg_userdecryptionresponsepayload_free(t,0)}get verification_key(){const t=P.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set verification_key(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_name(this.__wbg_ptr,e,r)}get digest(){const t=P.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);var e=re(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*1,1),e}set digest(t){const e=ne(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_eip712domainmsg_version(this.__wbg_ptr,e,r)}get signcrypted_ciphertexts(){const t=P.__wbg_get_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr);var e=Wf(t[0],t[1]).slice();return P.__wbindgen_free(t[0],t[1]*4,4),e}set signcrypted_ciphertexts(t){const e=$f(t,P.__wbindgen_malloc),r=ut;P.__wbg_set_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr,e,r)}get party_id(){return P.__wbg_get_userdecryptionresponsepayload_party_id(this.__wbg_ptr)>>>0}set party_id(t){P.__wbg_set_userdecryptionresponsepayload_party_id(this.__wbg_ptr,t)}get degree(){return P.__wbg_get_userdecryptionresponsepayload_degree(this.__wbg_ptr)>>>0}set degree(t){P.__wbg_set_userdecryptionresponsepayload_degree(this.__wbg_ptr,t)}}async function ab(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function cb(){const n={};return n.wbg={},n.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,e){const r=String(e),i=Wn(r,P.__wbindgen_malloc,P.__wbindgen_realloc),o=ut;ee().setInt32(t+4*1,o,!0),ee().setInt32(t+4*0,i,!0)},n.wbg.__wbg_buffer_609cc3eee51ed158=function(t){return t.buffer},n.wbg.__wbg_call_672a4d21634d4a24=function(){return qn(function(t,e){return t.call(e)},arguments)},n.wbg.__wbg_call_7cccdd69e0791ae2=function(){return qn(function(t,e,r){return t.call(e,r)},arguments)},n.wbg.__wbg_crypto_ed58b8e10a292839=function(t){return t.crypto},n.wbg.__wbg_done_769e5ede4b31c67b=function(t){return t.done},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(t,e){let r,i;try{r=t,i=e,console.error(ls(t,e))}finally{P.__wbindgen_free(r,i,1)}},n.wbg.__wbg_getRandomValues_bcb4912f16000dc4=function(){return qn(function(t,e){t.getRandomValues(e)},arguments)},n.wbg.__wbg_get_67b2ba62fc30de12=function(){return qn(function(t,e){return Reflect.get(t,e)},arguments)},n.wbg.__wbg_get_b9b93047fe3cf45b=function(t,e){return t[e>>>0]},n.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,e){return t[e]},n.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let e;try{e=t instanceof ArrayBuffer}catch{e=!1}return e},n.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let e;try{e=t instanceof Uint8Array}catch{e=!1}return e},n.wbg.__wbg_isArray_a1eab7e0d067391b=function(t){return Array.isArray(t)},n.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(t){return Number.isSafeInteger(t)},n.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},n.wbg.__wbg_length_a446193dc22c12f8=function(t){return t.length},n.wbg.__wbg_length_e2d2a49132c1b256=function(t){return t.length},n.wbg.__wbg_msCrypto_0a36e2ec3a343d26=function(t){return t.msCrypto},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},n.wbg.__wbg_new_a12002a7f91c75be=function(t){return new Uint8Array(t)},n.wbg.__wbg_newnoargs_105ed471475aaf50=function(t,e){return new Function(ls(t,e))},n.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(t,e,r){return new Uint8Array(t,e>>>0,r>>>0)},n.wbg.__wbg_newwithlength_a381634e90c276d4=function(t){return new Uint8Array(t>>>0)},n.wbg.__wbg_next_25feadfc0913fea9=function(t){return t.next},n.wbg.__wbg_next_6574e1a8a62d1055=function(){return qn(function(t){return t.next()},arguments)},n.wbg.__wbg_node_02999533c4ea02e3=function(t){return t.node},n.wbg.__wbg_process_5c1d670bc53614b8=function(t){return t.process},n.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740=function(){return qn(function(t,e){t.randomFillSync(e)},arguments)},n.wbg.__wbg_require_79b1e9274cde3c87=function(){return qn(function(){return module.require},arguments)},n.wbg.__wbg_serveridaddr_new=function(t){return Ii.__wrap(t)},n.wbg.__wbg_serveridaddr_unwrap=function(t){return Ii.__unwrap(t)},n.wbg.__wbg_set_65595bdd868b3009=function(t,e,r){t.set(e,r>>>0)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(t,e){const r=e.stack,i=Wn(r,P.__wbindgen_malloc,P.__wbindgen_realloc),o=ut;ee().setInt32(t+4*1,o,!0),ee().setInt32(t+4*0,i,!0)},n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const t=typeof io>"u"?null:io;return An(t)?0:zi(t)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const t=typeof globalThis>"u"?null:globalThis;return An(t)?0:zi(t)},n.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const t=typeof self>"u"?null:self;return An(t)?0:zi(t)},n.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const t=typeof window>"u"?null:window;return An(t)?0:zi(t)},n.wbg.__wbg_subarray_aa9065fa9dc5df96=function(t,e,r){return t.subarray(e>>>0,r>>>0)},n.wbg.__wbg_typedciphertext_new=function(t){return us.__wrap(t)},n.wbg.__wbg_typedciphertext_unwrap=function(t){return us.__unwrap(t)},n.wbg.__wbg_typedplaintext_new=function(t){return Na.__wrap(t)},n.wbg.__wbg_typedsigncryptedciphertext_new=function(t){return fs.__wrap(t)},n.wbg.__wbg_typedsigncryptedciphertext_unwrap=function(t){return fs.__unwrap(t)},n.wbg.__wbg_userdecryptionresponse_unwrap=function(t){return Fa.__unwrap(t)},n.wbg.__wbg_value_cd1ffa7b1ab794f1=function(t){return t.value},n.wbg.__wbg_versions_c71aa1626a93e0a1=function(t){return t.versions},n.wbg.__wbindgen_as_number=function(t){return+t},n.wbg.__wbindgen_boolean_get=function(t){const e=t;return typeof e=="boolean"?e?1:0:2},n.wbg.__wbindgen_debug_string=function(t,e){const r=Oa(e),i=Wn(r,P.__wbindgen_malloc,P.__wbindgen_realloc),o=ut;ee().setInt32(t+4*1,o,!0),ee().setInt32(t+4*0,i,!0)},n.wbg.__wbindgen_error_new=function(t,e){return new Error(ls(t,e))},n.wbg.__wbindgen_in=function(t,e){return t in e},n.wbg.__wbindgen_init_externref_table=function(){const t=P.__wbindgen_export_4,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},n.wbg.__wbindgen_is_function=function(t){return typeof t=="function"},n.wbg.__wbindgen_is_null=function(t){return t===null},n.wbg.__wbindgen_is_object=function(t){const e=t;return typeof e=="object"&&e!==null},n.wbg.__wbindgen_is_string=function(t){return typeof t=="string"},n.wbg.__wbindgen_is_undefined=function(t){return t===void 0},n.wbg.__wbindgen_jsval_loose_eq=function(t,e){return t==e},n.wbg.__wbindgen_memory=function(){return P.memory},n.wbg.__wbindgen_number_get=function(t,e){const r=e,i=typeof r=="number"?r:void 0;ee().setFloat64(t+8*1,An(i)?0:i,!0),ee().setInt32(t+4*0,!An(i),!0)},n.wbg.__wbindgen_string_get=function(t,e){const r=e,i=typeof r=="string"?r:void 0;var o=An(i)?0:Wn(i,P.__wbindgen_malloc,P.__wbindgen_realloc),c=ut;ee().setInt32(t+4*1,c,!0),ee().setInt32(t+4*0,o,!0)},n.wbg.__wbindgen_string_new=function(t,e){return ls(t,e)},n.wbg.__wbindgen_throw=function(t,e){throw new Error(ls(t,e))},n}function _b(n,t){return P=n.exports,Ua.__wbindgen_wasm_module=t,Zn=null,_s=null,P.__wbindgen_start(),P}async function Ua(n){if(P!==void 0)return P;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof n>"u"&&(n=new URL("/kms_lib_bg.wasm",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Vt&&Vt.tagName.toUpperCase()==="SCRIPT"&&Vt.src||new URL("relayer-sdk-js.umd.cjs",document.baseURI).href));const t=cb();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:e,module:r}=await ab(await n,t);return _b(e,r)}const lb=BigInt(1024*1024*512),vi=BigInt(1024*1024*512),ki=BigInt(1024*1024*512),hs="0.4.0-alpha.2",uo="@zama-fhe/relayer-sdk";function ih(n){if(n instanceof Error&&typeof n.cause=="object"&&n.cause!==null)return n.cause}function ub(n){const t=ih(n);if(!(!t||!("code"in t)||!t.code)&&typeof t.code=="string")return t.code}function fb(n){const t=ih(n);if(!(!t||!("status"in t)||t.status===void 0)&&typeof t.status=="number")return t.status}async function sh(n,t){let e;if(t.status===429)e="Relayer rate limit exceeded: Please wait and try again later.";else switch(n){case"PUBLIC_DECRYPT":{e=`Public decrypt failed: relayer respond with HTTP code ${t.status}`;break}case"USER_DECRYPT":{e=`User decrypt failed: relayer respond with HTTP code ${t.status}`;break}case"KEY_URL":{e=`HTTP error! status: ${t.status}`;break}default:{const o=await t.text();e=`Relayer didn't response correctly. Bad status ${t.statusText}. Content: ${o}`;break}}let r;try{r=await t.json()}catch{r=""}const i={code:"RELAYER_FETCH_ERROR",operation:n,status:t.status,statusText:t.statusText,url:t.url,response:t,responseJson:r};throw new Error(e,{cause:i})}function oh(n,t,e){let r;switch(n){case"PUBLIC_DECRYPT":{r="Public decrypt failed: Relayer didn't return a JSON";break}case"USER_DECRYPT":{r="User decrypt failed: Relayer didn't return a JSON";break}default:{r="Relayer didn't return a JSON";break}}const i={code:"RELAYER_NO_JSON_ERROR",operation:n,error:t,response:e};throw new Error(r,{cause:i})}function ah(n,t){let e;switch(n){case"PUBLIC_DECRYPT":{e="Public decrypt failed: Relayer returned an unexpected JSON response";break}case"USER_DECRYPT":{e="User decrypt failed: Relayer returned an unexpected JSON response";break}default:{e="Relayer returned an unexpected JSON response";break}}const r={code:"RELAYER_UNEXPECTED_JSON_ERROR",operation:n,error:t};throw new Error(e,{cause:r})}function ch(n,t){let e;switch(n){case"PUBLIC_DECRYPT":{e="Pulbic decrypt failed: the public decryption didn't succeed for an unknown reason";break}case"USER_DECRYPT":{e="User decrypt failed: the user decryption didn't succeed for an unknown reason";break}default:{e="Relayer didn't response correctly.";break}}const r={code:"RELAYER_INTERNAL_ERROR",operation:n,error:t};throw new Error(e,{cause:r})}function _h(n,t,e){if(!e)switch(n){case"PUBLIC_DECRYPT":{e="Public decrypt failed: Relayer didn't respond";break}case"USER_DECRYPT":{e="User decrypt failed: Relayer didn't respond";break}default:{e="Relayer didn't response correctly. Bad JSON.";break}}const r={code:"RELAYER_UNKNOWN_ERROR",operation:n,error:t};throw new Error(e??"Relayer didn't response correctly.",{cause:r})}function lh(n,t){if(t)switch(t.__type){case"BearerToken":n.headers.Authorization=`Bearer ${t.token}`;break;case"ApiKeyHeader":n.headers[t.header||"x-api-key"]=t.value;break;case"ApiKeyCookie":if(typeof window<"u")document.cookie=`${t.cookie||"x-api-key"}=${t.value}; path=/; SameSite=Lax; Secure; HttpOnly;`,n.credentials="include";else{let e=`${t.cookie||"x-api-key"}=${t.value};`;n.headers.Cookie=e}break}return n}function uh(n){if(!n||typeof n!="object")throw new Error("Unexpected response JSON.");if(!("response"in n&&n.response!==null&&n.response!==void 0))throw new Error("Unexpected response JSON format: missing 'response' property.")}async function Da(n,t,e,r){const i=lh({method:"POST",headers:{"Content-Type":"application/json","ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${uo}`},body:JSON.stringify(e)},r?.auth);let o,c;try{o=await fetch(t,i)}catch(l){_h(n,l)}o.ok||await sh(n,o);let _;try{_=await o.json()}catch(l){oh(n,l,o)}try{uh(_),c=_}catch(l){ah(n,l)}return c}async function La(n,t){const e={method:"GET",headers:{"ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${uo}`}};let r,i;try{r=await fetch(t,e)}catch(c){_h(n,c)}r.ok||await sh(n,r);let o;try{o=await r.json()}catch(c){oh(n,c,r)}try{uh(o),i=o}catch(c){ah(n,c)}return i}const Ma={},fh=async(n,t)=>{if(Ma[n])return Ma[n];const e=await La("KEY_URL",`${n}/keyurl`);try{let r;if(!t)r=e.response.fhe_key_info[0].fhe_public_key.urls[0],t=e.response.fhe_key_info[0].fhe_public_key.data_id;else{const y=e.response.fhe_key_info.find(R=>R.fhe_public_key.data_id===t);if(!y)throw new Error(`Could not find FHE key info with data_id ${t}`);r=y.fhe_public_key.urls[0]}const i=await fetch(r);if(!i.ok)throw new Error(`HTTP error! status: ${i.status} on ${i.url}`);let o;typeof i.bytes=="function"?o=await i.bytes():o=new Uint8Array(await i.arrayBuffer());const c=e.response.crs[2048].urls[0],_=e.response.crs[2048].data_id,l=await fetch(c);if(!l.ok)throw new Error(`HTTP error! status: ${l.status} on ${l.url}`);let u;typeof l.bytes=="function"?u=await l.bytes():u=new Uint8Array(await l.arrayBuffer());let h;try{h=TFHE.TfheCompactPublicKey.safe_deserialize(o,vi)}catch(y){throw new Error("Invalid public key (deserialization failed)",{cause:y})}let f;try{f=TFHE.CompactPkeCrs.safe_deserialize(new Uint8Array(u),ki)}catch(y){throw new Error("Invalid crs (deserialization failed)",{cause:y})}const d={publicKey:h,publicKeyId:t,publicParams:{2048:{publicParams:f,publicParamsId:_}}};return Ma[n]=d,d}catch(r){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:r})}};class It extends Error{name="RelayerErrorBase";_details;_docsPath;_docsUrl;_version;static VERSION=hs;static DEFAULT_DOCS_BASE_URL="https//docs.zama.org";static FULL_VERSION=`@zama-fhe/relayer-sdk@${It.VERSION}`;constructor(t){let e,r;t.cause instanceof It?(r=t.docsPath||t.cause.docsPath,e=t.details||t.cause.details):(r=t.docsPath,e=t.details||t.cause?.message);const i=r?`${t.docsBaseUrl??It.DEFAULT_DOCS_BASE_URL}${r}${t.docsSlug?`#${t.docsSlug}`:""}`:void 0,o=[t.message||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...e?[`Details: ${e}`]:[],`Version: ${It.FULL_VERSION}`].join(`
|
|
4
|
+
`);super(o,t.cause?{cause:t.cause}:void 0),Object.setPrototypeOf(this,new.target.prototype),this._details=e,this._docsPath=r,this._docsUrl=i,this._version=It.VERSION,this.name=t.name??this.name}get docsPath(){return this._docsPath}get docsUrl(){return this._docsUrl}get details(){return this._details}get version(){return this._version}}class ct extends It{_objName;_property;_expectedType;_index;_value;_type;_expectedValue;constructor({objName:t,property:e,index:r,type:i,value:o,expectedValue:c,expectedType:_}){let l=i==="undefined"&&c!==void 0,u;!e||e===""?u=r!==void 0?`${t}[${r}]`:`${t}`:u=r!==void 0?`${t}.${e}[${r}]`:`${t}.${e}`;let h=l?`InvalidPropertyError: Missing '${u}'`:`InvalidPropertyError: ${u}`;i===_?o!==void 0&&(h+=` unexpected value ${o}`):l?(Array.isArray(c)&&(c=c.join("|")),h+=`, expected '${u}: ${c}'.`):_!=="unknown"&&i!=="unknown"&&(h+=` not a ${_}`,i&&(h+=`, type is ${i}`)),super({message:h,name:"InvalidPropertyError"}),this._objName=t,this._property=e,this._value=o,this._type=i,this._expectedValue=c,this._expectedType=_,this._index=r}static missingProperty({objName:t,property:e,expectedType:r,expectedValue:i}){return new ct({objName:t,property:e,expectedType:r,expectedValue:i,type:"undefined"})}static invalidFormat({objName:t,property:e}){return new ct({objName:t,property:e,expectedType:"unknown"})}static invalidObject({objName:t,expectedType:e,type:r}){return new ct({objName:t,property:"",expectedType:e,type:r})}}function Zt(n,t){return!(!n||typeof n!="object"||!(t in n)||n[t]===void 0||n[t]===null)}function Wr(n,t,e){if(!Zt(n,t))throw new ct({objName:e,property:t,expectedType:"non-nullable",type:xn(n,t)})}function hb(n,t){return Zt(n,t)?Array.isArray(n[t]):!1}function En(n,t,e){if(!hb(n,t))throw new ct({objName:e,property:t,expectedType:"Array",type:xn(n,t)})}function pb(n,t){return Zt(n,t)?typeof n[t]=="boolean":!1}function ja(n,t,e,r){if(!pb(n,t))throw new ct({objName:e,property:t,expectedType:"boolean",type:xn(n,t)});if(r!==void 0&&n[t]!==r)throw new ct({objName:e,property:t,expectedType:"boolean",expectedValue:String(r),type:typeof n[t],value:String(n[t])})}function xn(n,t){return Zt(n,t)?typeof n[t]:"undefined"}class ps extends It{constructor(t){super({...t,name:"InternalError",message:t.message??"internal error"})}}function hh(n){if(!n)throw new ps({message:"Assertion failed"})}function Ga(n,t){return n?t.length===0?n:n.endsWith(t)?n.slice(0,-t.length):n:""}function db(n){return typeof n=="string"&&n.startsWith("0x")}function wb(n){return typeof n=="string"&&!n.startsWith("0x")}function ph(n){return n.startsWith("0x")?n:`0x${n}`}function gb(n){return n.startsWith("0x")?n.substring(2):n}function yb(n,t){return Zt(n,t)?typeof n[t]=="string":!1}function Q(n,t,e,r){if(!yb(n,t))throw new ct({objName:e,property:t,expectedType:"string",expectedValue:r,type:xn(n,t)});if(r!==void 0){if(Array.isArray(r)){for(let i=0;i<r.length;++i)if(n[t]===r[i])return;throw new ct({objName:e,property:t,expectedType:"string",expectedValue:r,type:typeof n[t],value:n[t]})}else if(n[t]!==r)throw new ct({objName:e,property:t,expectedType:"string",expectedValue:r,type:typeof n[t],value:n[t]})}}function bb(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(typeof r[i]!="string")throw new ct({objName:e,property:`${t}[${i}]`,expectedType:"string",type:typeof r[i]})}function ie(n,t){try{return JSON.stringify(n,(e,r)=>typeof r=="bigint"?r.toString():r,t)}catch{return""}}const dh=["function getKmsSigners() view returns (address[])","function getThreshold() view returns (uint256)"],wh=["function getCoprocessorSigners() view returns (address[])","function getThreshold() view returns (uint256)"],mb=n=>{if(typeof n=="string")return new Uy(n);if(n)return new Vn(n);throw new Error("You must provide a network URL or a EIP1193 object (eg: window.ethereum)")},Ab=async(n,t)=>{if(t.chainId&&typeof t.chainId=="number")return t.chainId;if(t.chainId&&typeof t.chainId!="number")throw new Error("chainId must be a number.");{const e=(await n.getNetwork()).chainId;return Number(e)}},Eb=async n=>{if(n.relayerVersionUrl&&!n.publicKey){const t=await fh(Ga(n.relayerVersionUrl,"/"));return{publicKey:t.publicKey,publicKeyId:t.publicKeyId}}else if(n.publicKey&&n.publicKey.data&&n.publicKey.id){const t=n.publicKey.data;try{return{publicKey:TFHE.TfheCompactPublicKey.safe_deserialize(t,vi),publicKeyId:n.publicKey.id}}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}else throw new Error("You must provide a public key with its public key ID.")},xb=async n=>{if(n.relayerVersionUrl&&!n.publicParams)return(await fh(Ga(n.relayerVersionUrl,"/"))).publicParams;if(n.publicParams&&n.publicParams[2048]){const t=n.publicParams[2048].publicParams;try{return{2048:{publicParams:TFHE.CompactPkeCrs.safe_deserialize(t,ki),publicParamsId:n.publicParams[2048].publicParamsId}}}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}else throw new Error("You must provide a valid CRS with its CRS ID.")},Rb=async(n,t)=>await new le(t,dh,n).getKmsSigners(),zb=async(n,t)=>{const r=await new le(t,dh,n).getThreshold();return Number(r)},Pb=async(n,t)=>await new le(t,wh,n).getCoprocessorSigners(),Ib=async(n,t)=>{const r=await new le(t,wh,n).getThreshold();return Number(r)},gh={0:2,2:8,3:16,4:32,5:64,6:128,7:160,8:256};function yh(n){let t=0;for(const e of n){if(e.length!==66)throw new Error(`Handle ${e} is not of valid length`);const r=e.slice(-4,-2).toLowerCase(),i=parseInt(r,16);if(!(i in gh))throw new Error(`Handle ${e} is not of valid type`);if(t+=gh[i],t>2048)throw new Error("Cannot decrypt more than 2048 encrypted bits in a single request")}return t}class ds extends It{_objName;_type;_expectedType;_expectedCustomType;constructor({objName:t,type:e,expectedType:r,expectedCustomType:i}){super({message:`InvalidTypeError ${t} ${r} ${e}`,name:"InvalidTypeError"}),this._objName=t,this._type=e,this._expectedType=r,this._expectedCustomType=i}get objName(){return this._objName}get type(){return this._type}get expectedType(){return this._expectedType}get expectedCustomType(){return this._expectedCustomType}}function bh(n,t){return!n||!(n instanceof Uint8Array)?!1:t?n.length===t:!0}function ws(n,t){return!(!db(n)||t!==void 0&&n.length!==2*t+2||(n.length-2)%2!==0||!/^0x[a-fA-F0-9]*$/.test(n))}function mh(n,t){return!(!wb(n)||(n.length-2)%2!==0||!/^[a-fA-F0-9]*$/.test(n))}function Ah(n){return ws(n,32)}function vb(n){return ws(n,65)}function Eh(n){return bh(n,32)}function kb(n){if(!Eh(n))throw new ds({type:typeof n,expectedType:"Bytes32"})}function Sb(n,t){return Zt(n,t)?ws(n[t]):!1}function fo(n,t,e){if(!Sb(n,t))throw new ct({objName:e,property:t,expectedType:"BytesHex",type:xn(n,t)})}function Bb(n,t){return Zt(n,t)?mh(n[t]):!1}function gs(n,t,e){if(!Bb(n,t))throw new ct({objName:e,property:t,expectedType:"BytesHexNo0x",type:xn(n,t)})}function xh(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!Ah(r[i]))throw new ct({objName:e,property:`${t}[${i}]`,expectedType:"Bytes32Hex",type:typeof r[i]})}function Tb(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!vb(r[i]))throw new ct({objName:e,property:`${t}[${i}]`,expectedType:"Bytes65Hex",type:typeof r[i]})}function Cb(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!ws(r[i]))throw new ct({objName:e,property:`${t}[${i}]`,expectedType:"BytesHex",type:typeof r[i]})}function Rh(n,t,e){En(n,t,e);const r=n[t];for(let i=0;i<r.length;++i)if(!mh(r[i]))throw new ct({objName:e,property:`${t}[${i}]`,expectedType:"BytesHexNo0x",type:typeof r[i]})}function Ob(n,t){return Zt(n,t)?n[t]instanceof Uint8Array:!1}function ys(n,t,e){if(!Ob(n,t))throw new ct({objName:e,property:t,expectedType:"Uint8Array",type:xn(n,t)})}const Ha={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};Object.freeze(Ha);const Nb=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));Object.freeze(Nb);const zh=new Uint8Array([48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102]);function Mr(n){if(!n||n?.length===0)return"";let t="";for(let e=0;e<n.length;e++)t+=n[e].toString(16).padStart(2,"0");return t}function Si(n){return`0x${Mr(n)}`}function Ph(n){const t=new Uint8Array(2+n.length*2);t[0]=48,t[1]=120;for(let e=0;e<n.length;e++){const r=2+e*2;t[r]=zh[n[e]>>4],t[r+1]=zh[n[e]&15]}return new TextDecoder().decode(t)}function Ct(n){if(n.length%2!==0)throw new Error("Invalid hex string: odd length");const t=n.replace(/^(0x)/,"").match(/.{1,2}/g);return t?Uint8Array.from(t.map(e=>parseInt(e,16))):new Uint8Array}function ho(n,t=!1){const e=n[0]==="0"&&n[1]==="x"?2:0,r=n.length-e;if(r%2!==0)throw new Error("Invalid hex string: odd length");const i=new Uint8Array(r/2);for(let o=0;o<i.length;o++){const c=Ha[n[e+o*2]],_=Ha[n[e+o*2+1]];if((c===void 0||_===void 0)&&t)throw new Error(`Invalid hex character at position ${e+o*2}`);i[o]=c<<4|_}return i}function Fb(n){if(!n||n.length===0)return BigInt(0);let t=BigInt(0);for(let e=0;e<n.length;e++)t=t<<BigInt(8)|BigInt(n[e]);return t}async function Ih(n){const t=await fetch(n);if(!t.ok)throw new Error(`HTTP error! status: ${t.status} on ${t.url}`);return typeof t.bytes=="function"?await t.bytes():new Uint8Array(await t.arrayBuffer())}function vh(...n){let t=0;for(const i of n)t+=i.length;const e=new Uint8Array(t);let r=0;for(const i of n)e.set(i,r),r+=i.length;return e}const po=n=>Y(n),Ub=["function persistAllowed(bytes32 handle, address account) view returns (bool)"],kh=10,Sh=BigInt(365);function Db(n,t){if(t===0)return n===BigInt(1);if(t===7)return po("0x"+n.toString(16).padStart(40,"0"));if(t>8||t==1)throw new Error(`Unsupported handle type ${t}`);return n}function Lb(n,t){let e=[];for(const i of n){const o=i.slice(-4,-2).toLowerCase(),c=parseInt(o,16);e.push(c)}const r={};return n.forEach((i,o)=>r[i]=Db(t[o],e[o])),r}function Mb(n,t){if(t===BigInt(0))throw Error("durationDays is null");if(t>Sh)throw Error(`durationDays is above max duration of ${Sh}`);const e=BigInt(Math.floor(Date.now()/1e3));if(n>e)throw Error("startTimestamp is set in the future");const r=t*BigInt(86400);if(n+r<e)throw Error("User decrypt request has expired")}const jb=(n,t,e,r,i,o,c,_)=>async(l,u,h,f,d,y,R,E,x)=>{const z="0x00";let k,T;try{k=TKMS.u8vec_to_ml_kem_pke_pk(Ct(h)),T=TKMS.u8vec_to_ml_kem_pke_sk(Ct(u))}catch(K){throw new Error("Invalid public or private key",{cause:K})}const j=f.replace(/^(0x)/,""),F=h.replace(/^(0x)/,""),C=l.map(K=>({handle:typeof K.handle=="string"?Si(Ct(K.handle)):Si(K.handle),contractAddress:po(K.contractAddress)}));yh(C.map(K=>K.handle)),Mb(BigInt(R),BigInt(E));const D=new le(i,Ub,c),N=C.map(async({handle:K,contractAddress:v})=>{const L=await D.persistAllowed(K,y),$=await D.persistAllowed(K,v);if(!L)throw new Error(`User ${y} is not authorized to user decrypt handle ${K}!`);if(!$)throw new Error(`dapp contract ${v} is not authorized to user decrypt handle ${K}!`);if(y===v)throw new Error(`userAddress ${y} should not be equal to contractAddress when requesting user decryption!`)}),Z=d.length;if(Z===0)throw Error("contractAddresses is empty");if(Z>kh)throw Error(`contractAddresses max length of ${kh} exceeded`);await Promise.all(N).catch(K=>{throw K});const G={handleContractPairs:C,requestValidity:{startTimestamp:R.toString(),durationDays:E.toString()},contractsChainId:e.toString(),contractAddresses:d.map(K=>po(K)),userAddress:po(y),signature:j,publicKey:F,extraData:z},H=await o.fetchPostUserDecrypt(G,{..._,...x});let _t=n.map((K,v)=>TKMS.new_server_id_addr(v+1,K));const yt=TKMS.new_client(_t,y,"default");try{const K=new ArrayBuffer(32);new DataView(K).setUint32(28,t,!1);const $={name:"Decryption",version:"1",chain_id:new Uint8Array(K),verifying_contract:r,salt:null},nt={signature:j,client_address:y,enc_key:F,ciphertext_handles:C.map(Rt=>Rt.handle.replace(/^0x/,"")),eip712_verifying_contract:r},xt=TKMS.process_user_decryption_resp_from_js(yt,nt,$,H,k,T,!0).map(Rt=>Fb(Rt.bytes));return Lb(C.map(Rt=>Rt.handle),xt)}catch(K){throw new Error("An error occured during decryption",{cause:K})}},ei=(n,t)=>{if(n==null)throw new Error("Missing value");let e;if(t>=8?e=BigInt(`0x${new Array(t/8).fill(null).reduce(r=>`${r}ff`,"")}`):e=BigInt(2**t-1),typeof n!="number"&&typeof n!="bigint")throw new Error("Value must be a number or a bigint.");if(n>e)throw new Error(`The value exceeds the limit for ${t}bits integer (${e.toString()}).`)},Gb=({aclContractAddress:n,chainId:t,tfheCompactPublicKey:e,publicParams:r,contractAddress:i,userAddress:o})=>{if(!en(i))throw new Error("Contract address is not a valid address.");if(!en(o))throw new Error("User address is not a valid address.");const c=e,_=[],l=TFHE.CompactCiphertextList.builder(c);let u=new Uint8Array;const h=f=>{if(_.reduce((d,y)=>d+Math.max(2,y),0)+f>2048)throw Error("Packing more than 2048 bits in a single input ciphertext is unsupported");if(_.length+1>256)throw Error("Packing more than 256 variables in a single input ciphertext is unsupported")};return{addBool(f){if(f==null)throw new Error("Missing value");if(typeof f!="boolean"&&typeof f!="number"&&typeof f!="bigint")throw new Error("The value must be a boolean, a number or a bigint.");if(Number(f)>1)throw new Error("The value must be 1 or 0.");return ei(Number(f),1),h(2),l.push_boolean(!!f),_.push(2),this},add8(f){return ei(f,8),h(8),l.push_u8(Number(f)),_.push(8),this},add16(f){return ei(f,16),h(16),l.push_u16(Number(f)),_.push(16),this},add32(f){return ei(f,32),h(32),l.push_u32(Number(f)),_.push(32),this},add64(f){return ei(f,64),h(64),l.push_u64(BigInt(f)),_.push(64),this},add128(f){return ei(f,128),h(128),l.push_u128(BigInt(f)),_.push(128),this},addAddress(f){if(!en(f))throw new Error("The value must be a valid address.");return h(160),l.push_u160(BigInt(f)),_.push(160),this},add256(f){return ei(f,256),h(256),l.push_u256(BigInt(f)),_.push(256),this},getBits(){return _},encrypt(){const d=(()=>{const j=N=>Object.keys(N),F=_.reduce((N,Z)=>N+Z,0),C=j(r),D=C.find(N=>Number(N)>=F);if(!D)throw new Error(`Too many bits in provided values. Maximum is ${C[C.length-1]}.`);return D})(),y=r[d].publicParams,R=Ct(i),E=Ct(o),x=Ct(n),z=Ct(t.toString(16).padStart(64,"0")),k=new Uint8Array(R.length+E.length+x.length+32);return k.set(R,0),k.set(E,20),k.set(x,40),k.set(z,k.length-z.length),u=l.build_with_proof_packed(y,k,TFHE.ZkComputeLoad.Verify).safe_serialize(lb),u}}},Bh=BigInt("18446744073709551615");BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Hb=255;function wo(n){let t=n.toString(16);return t.length%2?"0"+t:t}function Ka(n){return typeof n=="number"?n<0?!1:Number.isInteger(n):!1}function Kb(n){return typeof n=="bigint"?n>=0:!1}function go(n){return Ka(n)?!0:!!Kb(n)}function Vb(n){return go(n)?n<=Hb:!1}function Qb(n){return go(n)?n<=Bh:!1}function Th(n){if(!Ka(n))throw new ds({expectedType:"Uint"});const t=new ArrayBuffer(32);return new DataView(t).setBigUint64(24,BigInt(n),!1),new Uint8Array(t)}function Va(n){if(!Vb(n))throw new ds({type:typeof n,expectedType:"Uint8"})}function Ch(n){if(!Qb(n))throw new ds({type:typeof n,expectedType:"Uint64"})}function Jb(n,t){return Zt(n,t)?go(n[t]):!1}function Oh(n,t,e){if(!Jb(n,t))throw new ct({objName:e,property:t,type:xn(n,t),expectedType:"Uint"})}class $b extends It{constructor({address:t}){super({message:`Checksummed address "${t}" is invalid.`,name:"ChecksummedAddressError"})}}function Bi(n){if(typeof n!="string"||!n.startsWith("0x")||n.length!==42)return!1;try{return Y(n)===n}catch{return!1}}function Nh(n){if(!Bi(n))throw new $b({address:String(n)})}function Wb(n){return!(typeof n!="string"||!n.startsWith("0x")||n.length!==42||!en(n))}function Zb(n){if(!Wb(n))throw new ds({expectedType:"ChecksummedAddress"});const t=gb(n),e=new Uint8Array(20);for(let r=0;r<20;r++)e[r]=parseInt(t.slice(r*2,r*2+2),16);return e}class Rn extends It{constructor({handle:t,message:e}){super({message:e??(t?`FHEVM Handle "${t}" is invalid.`:"FHEVM Handle is invalid."),name:"FhevmHandleError"})}}class yo extends It{constructor({fheTypeId:t,message:e}){super({message:e??(t?`FheTypeId "${t}" is invalid.`:"FheTypeId is invalid."),name:"FheTypeError"})}}const qb={0:"ebool",2:"euint8",3:"euint16",4:"euint32",5:"euint64",6:"euint128",7:"eaddress",8:"euint256"},Fh={0:2,2:8,3:16,4:32,5:64,6:128,7:160,8:256},Qa={2:0,8:2,16:3,32:4,64:5,128:6,160:7,256:8},Uh={0:"bool",2:"uint256",3:"uint256",4:"uint256",5:"uint256",6:"uint256",7:"address",8:"uint256"};Object.freeze(Fh),Object.freeze(Qa),Object.freeze(Uh);function bo(n){switch(n){case 0:case 2:case 3:case 4:case 5:case 6:case 7:case 8:return!0;default:return!1}}function Yb(n){return typeof n!="number"?!1:n in Qa}function Xb(n){if(!Yb(n))throw new yo({message:`Invalid encryption bits ${n}`});return Qa[n]}function t0(n){if(!bo(n))throw new yo({message:`Invalid FheType id '${n}'`});return qb[n]}function Dh(n){if(!bo(n))throw new yo({message:`Invalid FheType id '${n}'`});return Uh[n]}function e0(n){if(!bo(n))throw new yo({message:`Invalid FheType id '${n}'`});return Fh[n]}class Bt{_hash21;_chainId;_fheTypeId;_version;_computed;_index;_handleBytes32Hex;_handleBytes32;static RAW_CT_HASH_DOMAIN_SEPARATOR="ZK-w_rct";static HANDLE_HASH_DOMAIN_SEPARATOR="ZK-w_hdl";static CURRENT_CIPHERTEXT_VERSION=0;constructor({hash21:t,chainId:e,fheTypeId:r,version:i,computed:o,index:c,handleBytes32:_,handleBytes32Hex:l}){if(!Ka(e))throw new Rn({message:"ChainId must be a positive integer"});if(BigInt(e)>Bh)throw new Rn({message:"ChainId exceeds maximum allowed value (8 bytes)"});if(!ws(t,21))throw new Rn({message:"Hash21 should be 21 bytes long"});this._handleBytes32=_,this._handleBytes32Hex=l,this._hash21=t,this._chainId=e,this._fheTypeId=r,this._version=i,this._computed=o,c!==void 0&&(this._index=c)}get hash21(){return this._hash21}get chainId(){return this._chainId}get fheTypeId(){return this._fheTypeId}get fheTypeName(){return t0(this._fheTypeId)}get version(){return this._version}get computed(){return this._computed}get index(){return this._index}get encryptedBitwidth(){return e0(this._fheTypeId)}get solidityPrimitiveTypeName(){return Dh(this._fheTypeId)}toJSON(){return{handle:this.toBytes32Hex(),fheTypeName:this.fheTypeName,fheTypeId:this.fheTypeId,chainId:this.chainId,index:this.index,computed:this.computed,encryptedBitwidth:this.encryptedBitwidth,version:this.version,solidityPrimitiveTypeName:this.solidityPrimitiveTypeName,hash21:this.hash21}}toBytes32(){if(this._handleBytes32===void 0){hh(this._index===void 0&&this._computed||this._index!==void 0&&this._index<255&&!this._computed);const e=Th(this._chainId).subarray(24,32),r=Ct(this._hash21);hh(r.length===21);const i=new Uint8Array(32);i.set(r,0),i[21]=this._index===void 0?255:this._index,i.set(e,22),i[30]=this._fheTypeId,i[31]=this._version,this._handleBytes32=i}return this._handleBytes32}toBytes32Hex(){return this._handleBytes32Hex===void 0&&(this._handleBytes32Hex=Si(this.toBytes32())),this._handleBytes32Hex}static fromComponents(t){return new Bt(t)}static fromBytes32(t){if(!Eh(t))throw new Rn({message:"FHEVM Handle is not a valid bytes32 array."});const e=t,r=Si(e.slice(0,21)),i=e[21],o=i===255,c=o?void 0:i;let _=0;for(let h=22;h<30;h++)_=_*256+e[h];const l=e[30];if(!bo(l))throw new Rn({handle:t,message:`FHEVM Handle "${t}" is invalid. Unknown FheType: ${l}`});const u=e[31];return new Bt({hash21:r,chainId:_,fheTypeId:l,version:u,computed:o,index:c,handleBytes32:t})}static fromBytes32Hex(t){if(!Ah(t))throw new Rn({handle:t});const e=Ct(t),r=Bt.fromBytes32(e);return r._handleBytes32Hex=t,r}static fromZKProof(t){Nh(t.aclAddress),Ch(t.chainId),Va(t.ciphertextVersion);let e;if(t.fheTypeIds!==void 0)e=t.fheTypeIds;else if(t.fheTypeEncryptionBitwidths!==void 0)e=t.fheTypeEncryptionBitwidths.map(l=>Xb(l));else throw new ps({message:"createInputHandles requires either fheTypeIds or fheTypeEncryptionBitwidths"});Va(e.length);let r;if(typeof t.ciphertextWithZKProof=="string")r=Ct(t.ciphertextWithZKProof);else if(t.ciphertextWithZKProof instanceof Uint8Array)r=t.ciphertextWithZKProof;else throw new ps({message:"Invalid ciphertextWithZKProof argument"});if(r.length===0)throw new ps({message:"Invalid ciphertextWithZKProof argument"});const o=new TextEncoder().encode(Bt.RAW_CT_HASH_DOMAIN_SEPARATOR),c=dt(vh(o,r)),_=[];for(let l=0;l<e.length;++l){const u=Bt._computeInputHash21(Ct(c),t.aclAddress,t.chainId,l);_.push(new Bt({hash21:u,chainId:t.chainId,fheTypeId:e[l],version:t.ciphertextVersion,computed:!1,index:l}))}return _}static parse(t){return bh(t)?Bt.fromBytes32(t):Bt.fromBytes32Hex(t)}static canParse(t){try{return Bt.parse(t),!0}catch{return!1}}static assertIsHandleHex(t){if(typeof t!="string")throw new Rn({message:"Invalid bytes32 hexadecimal string"});if(!Bt.canParse(t))throw new Rn({handle:t})}static currentCiphertextVersion(){return Bt.CURRENT_CIPHERTEXT_VERSION}static _computeInputHash21(t,e,r,i){kb(t),Nh(e),Va(i),Ch(r);const o=new Uint8Array([i]),c=Zb(e),_=Th(r),u=new TextEncoder().encode(Bt.HANDLE_HASH_DOMAIN_SEPARATOR);return dt(vh(u,t,o,c,_)).slice(0,2+2*21)}}const Lh=n=>Y(n),Mh=()=>0;async function r0({bits:n,ciphertext:t,contractAddress:e,userAddress:r,aclContractAddress:i,verifyingContractAddressInputVerification:o,chainId:c,gatewayChainId:_,relayerProvider:l,coprocessorSigners:u,thresholdCoprocessorSigners:h,extraData:f,options:d}){const y={contractAddress:e,userAddress:r,ciphertextWithInputVerification:Mr(t),contractChainId:"0x"+c.toString(16),extraData:f},R=await l.fetchPostInputProof(y,d);Gh(R)||ch("INPUT_PROOF",R);const x=Bt.fromZKProof({ciphertextWithZKProof:t,chainId:c,aclAddress:i,ciphertextVersion:Mh(),fheTypeEncryptionBitwidths:n}).map(G=>G.toBytes32()),z=R;if(z.handles&&z.handles.length>0){const G=z.handles.map(Ct);if(x.length!=G.length)throw new Error(`Incorrect Handles list sizes: (expected) ${x.length} != ${G.length} (received)`);for(let H=0;H<x.length;H+=1){let _t=x[H],yt=G[H],K=Mr(_t),v=Mr(yt);if(K!==v)throw new Error(`Incorrect Handle ${H}: (expected) ${K} != ${v} (received)`)}}const k=z.signatures,T={name:"InputVerification",version:"1",chainId:_,verifyingContract:o},j={CiphertextVerification:[{name:"ctHandles",type:"bytes32[]"},{name:"userAddress",type:"address"},{name:"contractAddress",type:"address"},{name:"contractChainId",type:"uint256"},{name:"extraData",type:"bytes"}]},F=k.map(G=>{const H=G.startsWith("0x")?G:`0x${G}`;return la(T,j,{ctHandles:x,userAddress:r,contractAddress:e,contractChainId:c,extraData:f},H)});if(!jh(u,F,h))throw Error("Coprocessor signers threshold is not reached");let D=wo(x.length);const N=k.length;return D+=wo(N),x.map(G=>Mr(G)).map(G=>D+=G),k.map(G=>D+=G.slice(2)),D+=f.slice(2),{handles:x,inputProof:Ct(D)}}function jh(n,t,e){const r=new Map;t.forEach((i,o)=>{if(r.has(i)){const c=i;throw new Error(`Duplicate coprocessor signer address found: ${c} appears multiple times in recovered addresses`)}r.set(i,o)});for(const i of t)if(!n.includes(i))throw new Error(`Invalid address found: ${i} is not in the list of coprocessor signers`);return t.length>=e}function Gh(n){const t=n;return typeof t!="object"||t===null||!("handles"in t&&Array.isArray(t.handles))||!("signatures"in t&&Array.isArray(t.signatures))?!1:t.signatures.every(e=>typeof e=="string")&&t.handles.every(e=>typeof e=="string")}const n0=(n,t,e,r,i,o,c,_,l,u)=>(h,f)=>{if(!en(h))throw new Error("Contract address is not a valid address.");if(!en(f))throw new Error("User address is not a valid address.");const d=Gb({aclContractAddress:n,chainId:e,tfheCompactPublicKey:o,publicParams:c,contractAddress:h,userAddress:f});return{_input:d,addBool(y){return d.addBool(y),this},add8(y){return d.add8(y),this},add16(y){return d.add16(y),this},add32(y){return d.add32(y),this},add64(y){return d.add64(y),this},add128(y){return d.add128(y),this},add256(y){return d.add256(y),this},addAddress(y){return d.addAddress(y),this},getBits(){return d.getBits()},generateZKProof(){return{chainId:e,aclContractAddress:n,userAddress:f,contractAddress:h,ciphertextWithZkProof:d.encrypt(),bits:d.getBits()}},encrypt:async y=>{const R="0x00",E=d.getBits(),x=d.encrypt(),z={contractAddress:Lh(h),userAddress:Lh(f),ciphertextWithInputVerification:Mr(x),contractChainId:"0x"+e.toString(16),extraData:R},k=await i.fetchPostInputProof(z,{...u,...y});Gh(k)||ch("INPUT_PROOF",k);const j=Bt.fromZKProof({ciphertextWithZKProof:x,chainId:e,aclAddress:n,ciphertextVersion:Mh(),fheTypeEncryptionBitwidths:E}).map(K=>K.toBytes32()),F=k;if(F.handles&&F.handles.length>0){const K=F.handles.map(Ct);if(j.length!=K.length)throw new Error(`Incorrect Handles list sizes: (expected) ${j.length} != ${K.length} (received)`);for(let v=0;v<j.length;v+=1){let L=j[v],$=K[v],nt=Mr(L),rt=Mr($);if(nt!==rt)throw new Error(`Incorrect Handle ${v}: (expected) ${nt} != ${rt} (received)`)}}const C=F.signatures,D={name:"InputVerification",version:"1",chainId:r,verifyingContract:t},N={CiphertextVerification:[{name:"ctHandles",type:"bytes32[]"},{name:"userAddress",type:"address"},{name:"contractAddress",type:"address"},{name:"contractChainId",type:"uint256"},{name:"extraData",type:"bytes"}]},Z=C.map(K=>{const v=K.startsWith("0x")?K:`0x${K}`;return la(D,N,{ctHandles:j,userAddress:f,contractAddress:h,contractChainId:e,extraData:R},v)});if(!jh(_,Z,l))throw Error("Coprocessor signers threshold is not reached");let H=wo(j.length);const _t=C.length;return H+=wo(_t),j.map(K=>Mr(K)).map(K=>H+=K),C.map(K=>H+=K.slice(2)),H+=R.slice(2),{handles:j,inputProof:Ct(H)}}}};function bs(n){if(n instanceof Error)return n;const t=n.message??"Non-Error value caught in exception handler",e=n.name??"ErrorWrapper",r=n.cause??n,i=new Error(t,{cause:r});return i.name=e,i}function i0(n,t){throw new ps({message:t})}const s0=["function isAllowedForDecryption(bytes32 handle) view returns (bool)"];function o0(n,t,e){const r=new Map;t.forEach((i,o)=>{if(r.has(i)){const c=i;throw new Error(`Duplicate KMS signer address found: ${c} appears multiple times in recovered addresses`)}r.set(i,o)});for(const i of t)if(!n.includes(i))throw new Error(`Invalid address found: ${i} is not in the list of KMS signers`);return t.length>=e}function a0(n){const t=Object.keys(n),e=[],r=[];for(let c=0;c<t.length;++c){const _=t[c],l=Bt.parse(_).fheTypeId;let u=n[_];typeof u=="boolean"&&(u=u?"0x01":"0x00");const h=BigInt(u);switch(e.push("uint256"),l){case 7:{r.push(`0x${h.toString(16).padStart(40,"0")}`);break}case 0:{if(h!==BigInt(0)&&h!==BigInt(1))throw new Error(`Invalid ebool clear text value ${h}. Expecting 0 or 1.`);r.push(h);break}case 2:case 3:case 4:case 5:case 6:case 8:{r.push(h);break}default:i0(l,`Unsupported Fhevm primitive type id: ${l}`)}}const o=gn.defaultAbiCoder().encode(e,r);return{abiTypes:e,abiValues:r,abiEncodedClearValues:o}}function c0(n,t){const e=X_(["uint8"],[n.length]),r=X_(Array(n.length).fill("bytes"),n);return lt([e,r,t])}function _0(n,t){let e=[];for(const u of n){const h=Bt.parse(u).fheTypeId;e.push(h)}const r="0x"+"00".repeat(32)+t.slice(2)+"00".repeat(32),i=e.map(u=>Dh(u)),_=new gn().decode(["uint256",...i,"bytes[]"],r).slice(1,1+e.length),l={};return n.forEach((u,h)=>l[u]=_[h]),l}const l0=(n,t,e,r,i,o,c,_)=>async(l,u)=>{const h="0x00",f=new le(i,s0,c);let d;try{d=await Promise.all(l.map(async G=>{const H=Si(typeof G=="string"?Ct(G):G);if(!await f.isAllowedForDecryption(H))throw new Error(`Handle ${H} is not allowed for public decryption!`);return H}))}catch(G){throw G}yh(d);const y={ciphertextHandles:d,extraData:h},R=await o.fetchPostPublicDecrypt(y,{..._,...u}),E={name:"Decryption",version:"1",chainId:e,verifyingContract:r},x={PublicDecryptVerification:[{name:"ctHandles",type:"bytes32[]"},{name:"decryptedResult",type:"bytes"},{name:"extraData",type:"bytes"}]},z=R,k=ph(z.decryptedValue),T=z.signatures.map(ph),j="0x",F=T.map(G=>la(E,x,{ctHandles:d,decryptedResult:k,extraData:j},G));if(!o0(n,F,t))throw Error("KMS signers threshold is not reached");const D=_0(d,k),N=a0(D),Z=c0(T,j);return{clearValues:D,abiEncodedClearValues:N.abiEncodedClearValues,decryptionProof:Z}},Hh=(n,t)=>(e,r,i,o,c)=>{const _="0x00";if(c&&!en(c))throw new Error("Invalid delegated account.");if(!en(n))throw new Error("Invalid verifying contract address.");if(!r.every(y=>en(y)))throw new Error("Invalid contract address.");const l=typeof e=="string"?e.startsWith("0x")?e:`0x${e}`:e,u=typeof i=="number"?i.toString():i,h=typeof o=="number"?o.toString():o,f=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],d={name:"Decryption",version:"1",chainId:t,verifyingContract:n};return c?{types:{EIP712Domain:f,DelegatedUserDecryptRequestVerification:[{name:"publicKey",type:"bytes"},{name:"contractAddresses",type:"address[]"},{name:"startTimestamp",type:"uint256"},{name:"durationDays",type:"uint256"},{name:"extraData",type:"bytes"},{name:"delegatedAccount",type:"address"}]},primaryType:"DelegatedUserDecryptRequestVerification",domain:d,message:{publicKey:l,contractAddresses:r,startTimestamp:u,durationDays:h,extraData:_,delegatedAccount:c}}:{types:{EIP712Domain:f,UserDecryptRequestVerification:[{name:"publicKey",type:"bytes"},{name:"contractAddresses",type:"address[]"},{name:"startTimestamp",type:"uint256"},{name:"durationDays",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"UserDecryptRequestVerification",domain:d,message:{publicKey:l,contractAddresses:r,startTimestamp:u,durationDays:h,extraData:_}}},Kh=()=>{const n=TKMS.ml_kem_pke_keygen();return{publicKey:Mr(TKMS.ml_kem_pke_pk_to_u8vec(TKMS.ml_kem_pke_get_pk(n))),privateKey:Mr(TKMS.ml_kem_pke_sk_to_u8vec(n))}};class Vh{_relayerUrl;constructor(t){this._relayerUrl=t}get url(){return this._relayerUrl}get keyUrl(){return`${this.url}/keyurl`}get inputProof(){return`${this.url}/input-proof`}get publicDecrypt(){return`${this.url}/public-decrypt`}get userDecrypt(){return`${this.url}/user-decrypt`}}function Qh(n,t){xh(n,"handles",t),Tb(n,"signatures",t)}function Jh(n,t){Rh(n,"signatures",t),Q(n,"decryptedValue",t),fo(n,"extraData",t)}function $h(n,t){if(!Array.isArray(n))throw ct.invalidObject({objName:t,expectedType:"Array",type:typeof n});for(let e=0;e<n.length;++e)gs(n[e],"payload",`${t}[i]`),gs(n[e],"signature",`${t}[i]`)}class u0 extends Vh{constructor(t){super(t)}get version(){return 1}async fetchGetKeyUrl(){return await La("KEY_URL",this.keyUrl)}async fetchPostInputProof(t,e){const r=await Da("INPUT_PROOF",this.inputProof,t,e);return Qh(r.response,"fetchPostInputProof()"),r.response}async fetchPostPublicDecrypt(t,e){const i=(await Da("PUBLIC_DECRYPT",this.publicDecrypt,t,e)).response[0],o={signatures:i.signatures,decryptedValue:i.decrypted_value,extraData:"0x"};return Jh(o,"fetchPostPublicDecrypt()"),o}async fetchPostUserDecrypt(t,e){const r=await Da("USER_DECRYPT",this.userDecrypt,t,e);return $h(r.response,"RelayerUserDecryptResult()"),r.response}}class f0 extends It{_operation;constructor(t){super(t),this._operation=t.operation}get operation(){return this._operation}}class h0 extends f0{constructor({cause:t}){super({message:"Invalid relayer response.",name:"RelayerV2GetKeyUrlError",operation:"KEY_URL",cause:t})}}class p0 extends h0{constructor({cause:t}){super({cause:t})}}function Wh(n,t){if(Q(n,"label",t),!(n.label==="malformed_json"||n.label==="request_error"||n.label==="not_ready_for_decryption"))throw new ct({objName:t,property:"label",expectedType:"string",expectedValue:["malformed_json","request_error","not_ready_for_decryption"],type:typeof n.label,value:n.label});Q(n,"message",t)}function Zh(n,t){if(Q(n,"label",t),!(n.label==="missing_fields"||n.label==="validation_failed"))throw new ct({objName:t,property:"label",expectedType:"string",expectedValue:["missing_fields","validation_failed"],type:typeof n.label,value:n.label});Q(n,"message",t),En(n,"details",t);const e=n.details;for(let r=0;r<e.length;++r){const i=e[r];Q(i,"field",`${t}.details[${r}]`),Q(i,"issue",`${t}.details[${r}]`)}}function qh(n,t){Q(n,"label",t,"rate_limited"),Q(n,"message",t)}function Yh(n,t){Q(n,"label",t,"internal_server_error"),Q(n,"message",t)}function Xh(n,t){Q(n,"label",t,"not_found"),Q(n,"message",t)}function tp(n,t){Q(n,"label",t,["protocol_paused","gateway_not_reachable"]),Q(n,"message",t)}function ep(n,t){Q(n,"label",t,["readiness_check_timedout","response_timedout"]),Q(n,"message",t)}function Ti(n,t){Q(n,"status",t,"failed"),Wr(n,"error",t),d0(n.error,`${t}.error`)}function d0(n,t){if(Q(n,"label",t),n.label==="malformed_json"||n.label==="request_error"||n.label==="not_ready_for_decryption")Wh(n,t);else if(n.label==="missing_fields"||n.label==="validation_failed")Zh(n,t);else if(n.label==="not_found")Xh(n,t);else if(n.label==="rate_limited")qh(n,t);else if(n.label==="internal_server_error")Yh(n,t);else if(n.label==="protocol_paused"||n.label==="gateway_not_reachable")tp(n,t);else if(n.label==="readiness_check_timedout"||n.label==="response_timedout")ep(n,t);else throw new ct({objName:t,property:"label",expectedType:"string",expectedValue:["malformed_json","request_error","not_ready_for_decryption","missing_fields","validation_failed","rate_limited","internal_server_error","protocol_paused","gateway_not_reachable","readiness_check_timedout","response_timedout"],type:typeof n.label,value:n.label})}function rp(n,t){if(Ti(n,t),n.error.label==="malformed_json"||n.error.label==="request_error"||n.error.label==="not_ready_for_decryption")Wh(n.error,`${t}.error`);else if(n.error.label==="missing_fields"||n.error.label==="validation_failed")Zh(n.error,`${t}.error`);else throw new ct({objName:`${t}.error`,property:"label",expectedType:"string",expectedValue:["malformed_json","request_error","not_ready_for_decryption","missing_fields","validation_failed"],type:typeof n.error.label,value:n.error.label})}function w0(n,t){Ti(n,t),Xh(n.error,`${t}.error`)}function g0(n,t){Ti(n,t),qh(n.error,`${t}.error`)}function np(n,t){Ti(n,t),Yh(n.error,`${t}.error`)}function ip(n,t){Ti(n,t),tp(n.error,`${t}.error`)}function y0(n,t){Ti(n,t),ep(n.error,`${t}.error`)}class Ja extends It{_fetchMethod;_url;_jobId;_operation;_retryCount;_elapsed;_state;constructor(t){super({...t,name:t.name??"RelayerV2FetchErrorBase"}),this._fetchMethod=t.fetchMethod,this._url=t.url,this._operation=t.operation,this._elapsed=t.elapsed,this._retryCount=t.retryCount,this._state=t.state,this._jobId=t.jobId}get url(){return this._url}get operation(){return this._operation}get fetchMethod(){return this._fetchMethod}get jobId(){return this._jobId}get retryCount(){return this._retryCount}get elapsed(){return this._elapsed}get state(){return this._state}get isAbort(){return this.cause?this.cause.name==="AbortError":!1}}class mo extends Ja{_status;constructor(t){super({...t,name:t.name??"RelayerV2ResponseErrorBase"}),this._status=t.status}get status(){return this._status}}class b0 extends mo{constructor(t){super({...t,cause:bs(t.cause),name:"RelayerV2ResponseInvalidBodyError",message:`fetchMethod: ${t.fetchMethod} status:${t.status} url:${t.url} operation:${t.operation}`})}}class sp extends mo{constructor(t){super({...t,name:"RelayerV2ResponseStatusError",message:`fetchMethod: ${t.fetchMethod} status:${t.status} url:${t.url} operation:${t.operation}`})}}function m0(n,t){ja(n,"accepted",t),n.accepted?A0(n,t):E0(n,t)}function A0(n,t){ja(n,"accepted",t,!0),xh(n,"handles",t),Cb(n,"signatures",t),fo(n,"extraData",t)}function E0(n,t){ja(n,"accepted",t,!1),fo(n,"extraData",t)}function x0(n,t){Wr(n,"result",t),Q(n,"status",t,"succeeded"),Q(n,"requestId",t),m0(n.result,`${t}.result`)}function R0(n,t){Rh(n,"signatures",t),gs(n,"decryptedValue",t),fo(n,"extraData",t)}function z0(n,t){Wr(n,"result",t),Q(n,"status",t,"succeeded"),Q(n,"requestId",t),R0(n.result,`${t}.result`)}function P0(n,t){En(n,"result",t);for(let e=0;e<n.result.length;++e)gs(n.result[e],"payload",`${t}.result[${e}]`),gs(n.result[e],"signature",`${t}.result[${e}]`)}function I0(n,t){Wr(n,"result",t),Q(n,"status",t,"succeeded"),Q(n,"requestId",t),P0(n.result,`${t}.result`)}class $a extends It{_url;_operation;_jobId;constructor(t){super({...t,name:t.name??"RelayerV2RequestErrorBase"}),this._url=t.url,this._operation=t.operation,this._jobId=t.jobId}get url(){return this._url}get jobId(){return this._jobId}get operation(){return this._operation}}class v0 extends $a{_status;_state;constructor(t){super({...t,name:"RelayerV2RequestInternalError",message:t.message??"internal error"}),this._status=t.status,this._state=t.state}get status(){return this._status}get state(){return this._state}}class k0 extends mo{constructor(t){super({...t,name:"RelayerV2ResponseApiError",message:t.relayerApiError.message})}}class S0 extends Ja{constructor(t){super({...t,name:"RelayerV2FetchError",message:`Fetch ${t.fetchMethod} error`,cause:bs(t.cause)})}}class op extends mo{_result;constructor(t){super({...t,name:"RelayerV2ResponseInputProofRejectedError",message:"InputProof rejected"}),this._result=t.result}get result(){return this._result}}class jr extends It{_state;constructor(t){super({...t,name:"RelayerV2StateError"}),this._state={...t.state},Object.freeze(this._state)}get state(){return this._state}}class B0 extends Ja{constructor(t){super({...t,name:"RelayerV2MaxRetryError",message:"max retry error"})}}function T0(n,t){Q(n,"jobId",t)}function C0(n,t){Q(n,"status",t,"queued"),Q(n,"requestId",t),Wr(n,"result",t),T0(n.result,`${t}.result`)}function O0(n,t){Q(n,"status",t,"queued"),Q(n,"requestId",t)}class N0 extends $a{constructor(t){super({...t,name:"RelayerV2TimeoutError",message:`Request timed out after ${t.timeoutMs}ms`})}}class F0 extends $a{constructor(t){super({...t,name:"RelayerV2AbortError",message:"Request aborted"})}}class Tt{_fetchMethod;_jobId;_jobIdTimestamp;_state;_relayerOperation;_publicAPINoReentrancy;_internalAbortController;_internalAbortSignal;_externalAbortSignal;_terminateReason;_terminateError;_retryCount;_retryAfterTimeoutID;_url;_payload;_fhevmAuth;_retryAfterTimeoutPromiseFuncReject;_onProgress;_requestMaxDurationInMs;_requestStartTimestamp;_requestGlobalTimeoutID;_throwErrorIfNoRetryAfter;static DEFAULT_RETRY_AFTER_MS=2500;static MINIMUM_RETRY_AFTER_MS=1e3;static DEFAULT_GLOBAL_REQUEST_TIMEOUT_MS=60*60*1e3;static MAX_GET_RETRY=60*30;static MAX_POST_RETRY=Tt.MAX_GET_RETRY;constructor(t){if(t.relayerOperation!=="INPUT_PROOF"&&t.relayerOperation!=="PUBLIC_DECRYPT"&&t.relayerOperation!=="USER_DECRYPT")throw new ct({objName:"RelayerV2AsyncRequestParams",property:"relayerOperation",expectedType:"string",value:t.relayerOperation,expectedValue:"INPUT_PROOF | PUBLIC_DECRYPT | USER_DECRYPT"});this._relayerOperation=t.relayerOperation,this._internalAbortController=new AbortController,this._internalAbortSignal=this._internalAbortController.signal,this._internalAbortSignal.addEventListener("abort",this._handleInternalSignalAbort),this._externalAbortSignal=t.options?.signal,this._externalAbortSignal&&this._externalAbortSignal.addEventListener("abort",this._handleExternalSignalAbort),this._url=t.url,this._payload=t.payload,this._fhevmAuth=t.options?.auth,this._onProgress=t.options?.onProgress,this._state={aborted:!1,canceled:!1,failed:!1,fetching:!1,running:!1,succeeded:!1,terminated:!1,timeout:!1},this._retryCount=0,this._retryAfterTimeoutID=void 0,this._requestGlobalTimeoutID=void 0,this._terminateReason=void 0,this._publicAPINoReentrancy=!1,this._throwErrorIfNoRetryAfter=t.throwErrorIfNoRetryAfter??!1,this._requestMaxDurationInMs=t.options?.timeout??Tt.DEFAULT_GLOBAL_REQUEST_TIMEOUT_MS}async run(){if(this._publicAPINoReentrancy)throw new jr({message:"Relayer.run() failed. Call not permitted.",state:{...this._state}});if(this._state.terminated)throw new jr({message:"Relayer.run() failed. Request already terminated.",state:{...this._state}});if(this._state.canceled)throw new jr({message:"Relayer.run() failed. Request already canceled.",state:{...this._state}});if(this._state.succeeded)throw new jr({message:"Relayer.run() failed. Request already succeeded.",state:{...this._state}});if(this._state.failed)throw new jr({message:"Relayer.run() failed. Request already failed.",state:{...this._state}});if(this._state.aborted)throw new jr({message:"Relayer.run() failed. Request already aborted.",state:{...this._state}});if(this._state.timeout)throw new jr({message:"Relayer.run() failed. Request already timeout.",state:{...this._state}});if(this._externalAbortSignal?.aborted===!0)throw new jr({message:`Relayer.run() failed. External AbortSignal already aborted (reason:${this._externalAbortSignal?.reason}).`,state:{...this._state}});if(this._internalAbortSignal?.aborted===!0)throw new jr({message:`Relayer.run() failed. Internal AbortSignal already aborted (reason:${this._internalAbortSignal?.reason}).`,state:{...this._state}});if(this._state.running)throw new jr({message:"Relayer.run() failed. Request already running.",state:{...this._state}});this._state.running=!0,this._requestStartTimestamp=Date.now(),this._setGlobalRequestTimeout(this._requestMaxDurationInMs);try{const t=await this._runPostLoop();return this._state.succeeded=!0,this._terminate("succeeded"),t}catch(t){throw this._state.failed=!0,t.name==="AbortError"&&(this._assert(this._state.aborted,"this._state.aborted"),this._assert(this._state.terminated,"this._state.terminated")),this._terminate("failed",t),t}}_canContinue(){return!(this._state.canceled||this._state.terminated||this._state.succeeded||this._state.aborted)}cancel(){if(this._publicAPINoReentrancy)throw new jr({message:"Relayer.cancel() failed. Call not permitted.",state:{...this._state}});if(!this._canContinue()){this._trace("cancel","!this._canContinue()");return}this._state.canceled=!0,this._internalAbortController?.abort("cancel"),this._assert(this._state.aborted,"this._state.aborted"),this._assert(this._state.terminated,"this._state.terminated")}get state(){return{...this._state}}get canceled(){return this._state.canceled}get terminated(){return this._state.terminated}get terminateReason(){return this._terminateReason}get terminateError(){return this._terminateError}get running(){return this._state.running}get fetching(){return this._state.fetching}get failed(){return this._state.failed}get aborted(){return this._state.aborted}get timeout(){return this._state.timeout}get succeeded(){return this._state.succeeded}get startTimeMs(){return this._requestStartTimestamp}get elapsedTimeMs(){if(this._requestStartTimestamp!==void 0)return Date.now()-this._requestStartTimestamp}get retryCount(){return this._retryCount}async _runPostLoop(){this._assert(this._fetchMethod===void 0,"this._fetchMethod === undefined"),this._fetchMethod="POST";let t=0;for(;t<Tt.MAX_POST_RETRY;){++t,this._assertCanContinueAfterAwait();const e=this._jobId?Date.now()-this._jobIdTimestamp:0,r=await this._fetchPost(e),i=r.status;switch(i){case 202:{const o=await this._getResponseJson(r);try{C0(o,"body")}catch(l){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:l,elapsed:e,bodyJson:ie(o)})}const c=this._getRetryAfterHeaderValueInMs(r);return this._setJobIdOnce(o.result.jobId),this._postAsyncOnProgressCallback({type:"queued",url:this._url,method:"POST",status:i,requestId:o.requestId,jobId:this.jobId,operation:this._relayerOperation,retryCount:this._retryCount,retryAfterMs:c,elapsed:e}),await this._setRetryAfterTimeout(c),await this._runGetLoop()}case 400:{const o=await this._getResponseJson(r);try{rp(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:c,elapsed:e,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"POST",status:i,relayerApiError:o.error,elapsed:e})}case 429:{const o=await this._getResponseJson(r);try{g0(o,"body")}catch(_){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:_,elapsed:e,bodyJson:ie(o)})}const c=this._getRetryAfterHeaderValueInMs(r);this._postAsyncOnProgressCallback({type:"ratelimited",url:this._url,method:"POST",status:i,retryAfterMs:c,retryCount:this._retryCount,elapsed:e,relayerApiError:o.error}),await this._setRetryAfterTimeout(c);continue}case 500:{const o=await this._getResponseJson(r);try{np(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:c,elapsed:e,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"POST",status:i,relayerApiError:o.error,elapsed:e})}case 503:{const o=await this._getResponseJson(r);try{ip(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"POST",status:i,cause:c,elapsed:e,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"POST",status:i,relayerApiError:o.error,elapsed:e})}default:(c=>{throw new sp({fetchMethod:"POST",status:c,url:this._url,operation:this._relayerOperation,elapsed:e,retryCount:this._retryCount,state:{...this._state}})})(i)}}this._throwMaxRetryError({fetchMethod:"POST"})}async _runGetLoop(){this._assert(this._fetchMethod==="POST","this._fetchMethod === 'POST'"),this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._assert(this._jobIdTimestamp!==void 0,"this._jobIdTimestamp !== undefined"),this._fetchMethod="GET";let t=0;for(;t<Tt.MAX_GET_RETRY;){++t,this._assertCanContinueAfterAwait();const e=Date.now()-this._jobIdTimestamp,r=await this._fetchGet(e),i=r.status;switch(i){case 200:{const o=await this._getResponseJson(r);try{if(this._relayerOperation==="INPUT_PROOF"){if(x0(o,"body"),this._postAsyncOnProgressCallback({type:"succeeded",url:this._url,method:"GET",status:i,jobId:this.jobId,requestId:o.requestId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:e,result:o.result}),!o.result.accepted)throw new op({url:this._url,fetchMethod:"GET",jobId:this.jobId,operation:this._relayerOperation,retryCount:this._retryCount,status:i,state:{...this._state},elapsed:e,result:o.result})}else this._relayerOperation==="PUBLIC_DECRYPT"?(z0(o,"body"),this._postAsyncOnProgressCallback({type:"succeeded",url:this._url,method:"GET",status:i,jobId:this.jobId,requestId:o.requestId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:e,result:o.result})):this._relayerOperation==="USER_DECRYPT"&&(I0(o,"body"),this._postAsyncOnProgressCallback({type:"succeeded",url:this._url,method:"GET",status:i,jobId:this.jobId,requestId:o.requestId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:e,result:o.result}))}catch(c){if(c instanceof op)throw c;this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:ie(o)})}return o.result}case 202:{const o=await this._getResponseJson(r);try{O0(o,"body")}catch(_){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:_,bodyJson:ie(o)})}const c=this._getRetryAfterHeaderValueInMs(r);this._postAsyncOnProgressCallback({type:"queued",url:this._url,method:"GET",status:i,requestId:o.requestId,operation:this._relayerOperation,jobId:this.jobId,retryAfterMs:c,retryCount:this._retryCount,elapsed:e}),await this._setRetryAfterTimeout(c);continue}case 400:{const o=await this._getResponseJson(r);try{rp(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 404:{const o=await this._getResponseJson(r);try{w0(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 500:{const o=await this._getResponseJson(r);try{np(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 503:{const o=await this._getResponseJson(r);try{ip(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}case 504:{const o=await this._getResponseJson(r);try{y0(o,"body")}catch(c){this._throwResponseInvalidBodyError({fetchMethod:"GET",status:i,elapsed:e,cause:c,bodyJson:ie(o)})}this._throwRelayerV2ResponseApiError({fetchMethod:"GET",status:i,relayerApiError:o.error,elapsed:e})}default:(c=>{throw new sp({fetchMethod:"GET",status:c,url:this._url,jobId:this.jobId,operation:this._relayerOperation,elapsed:e,retryCount:this._retryCount,state:{...this._state}})})(i)}}this._throwMaxRetryError({fetchMethod:"GET"})}async _getResponseJson(t){const e=await t.json();return this._assertCanContinueAfterAwait(),e}_getRetryAfterHeaderValueInMs(t){if(!t.headers.has("Retry-After")){if(this._throwErrorIfNoRetryAfter)throw new Error("Missing 'Retry-After' header key");return Tt.DEFAULT_RETRY_AFTER_MS}try{const e=Number.parseInt(t.headers.get("Retry-After"));if(go(e)){const r=e*1e3;return r<Tt.MINIMUM_RETRY_AFTER_MS?Tt.MINIMUM_RETRY_AFTER_MS:r}}catch{}if(this._throwErrorIfNoRetryAfter)throw new Error("Invalid 'Retry-After' header key");return Tt.DEFAULT_RETRY_AFTER_MS}_setJobIdOnce(t){this._assert(t!==void 0,"jobId !== undefined"),this._assert(this._jobId===void 0,"this._jobId === undefined"),this._jobId=t,this._jobIdTimestamp=Date.now()}get jobId(){return this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._jobId}async _fetchPost(t){this._assert(this._jobId===void 0,"this._jobId === undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.fetching,"!this._state.fetching"),this._trace("_fetchPost",this._url);const e=lh({method:"POST",headers:{"Content-Type":"application/json","ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${uo}`},body:JSON.stringify(this._payload),...this._internalAbortSignal?{signal:this._internalAbortSignal}:{}},this._fhevmAuth);this._state.fetching=!0;let r;try{r=await fetch(this._url,e)}catch(i){if(this._state.fetching=!1,this._trace("_fetchPost","catch(e) + throw e: "+i),i.name==="AbortError")throw i;this._throwFetchError({fetchMethod:"POST",cause:i,elapsed:t})}return this._state.fetching=!1,this._assert(this._jobId===void 0,"this._jobId === undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assertCanContinueAfterAwait(),this._trace("_fetchPost","return response Ok"),r}async _fetchGet(t){this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.fetching,"!this._state.fetching"),this._trace("_fetchGet",`jobId=${this.jobId}`);const e={method:"GET",headers:{"ZAMA-SDK-VERSION":`${hs}`,"ZAMA-SDK-NAME":`${uo}`},...this._internalAbortSignal?{signal:this._internalAbortSignal}:{}};this._state.fetching=!0;let r;try{r=await fetch(`${this._url}/${this.jobId}`,e)}catch(i){if(this._state.fetching=!1,this._trace("_fetchGet",`jobId=${this.jobId}, catch(e) + throw e: ${i}`),i.name==="AbortError")throw i;this._throwFetchError({fetchMethod:"GET",cause:i,elapsed:t})}return this._state.fetching=!1,this._assert(this._jobId!==void 0,"this._jobId !== undefined"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assertCanContinueAfterAwait(),this._trace("_fetchGet",`jobId=${this.jobId}, return response Ok, status=${r.status}`),r}_handleExternalSignalAbort=t=>{const e=t.currentTarget;this._assert(this instanceof Tt,"this instanceof RelayerV2AsyncRequest"),this._assert(e===this._externalAbortSignal,"signal === this._externalAbortSignal"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.aborted,"!this._state.aborted"),this._assert(!this._state.canceled,"!this._state.canceled"),this.cancel()};_handleInternalSignalAbort=t=>{const e=t.currentTarget;this._assert(this instanceof Tt,"this instanceof RelayerV2AsyncRequest"),this._assert(e===this._internalAbortSignal,"signal === this._internalAbortSignal"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.aborted,"!this._state.aborted"),this._state.aborted=!0,e.reason!=="cancel"&&this._assert(!this._state.canceled,"!this._state.canceled"),this._postAsyncOnProgressCallback({type:"abort",url:this._url,...this._jobId?{jobId:this._jobId}:{},operation:this._relayerOperation,retryCount:this._retryCount}),this._terminate("abort",new F0({operation:this._relayerOperation,jobId:this._jobId,url:this._url}))};_terminate(t,e){if(this._state.terminated){this._trace("_terminate",`reason=${t}. Already terminated with reason='${this._terminateReason}'. IGNORE`),this._assert(this._terminateReason!==void 0,"this._terminateReason !== undefined"),this._assert(this._internalAbortSignal===void 0,"this._signal === undefined"),this._assert(this._requestGlobalTimeoutID===void 0,"this._requestGlobalTimeoutID === undefined"),this._assert(this._retryAfterTimeoutID===void 0,"this._retryAfterTimeoutID === undefined"),this._assert(this._retryAfterTimeoutPromiseFuncReject===void 0,"this._retryAfterTimeoutPromiseFuncReject === undefined");return}this._trace("_terminate",`reason=${t}`),this._terminateReason=t,this._terminateError=e,this._state.terminated=!0,this._tryClearRetryAfterTimeout(e),this._tryClearGlobalRequestTimeout();const r=this._internalAbortSignal,i=this._externalAbortSignal;this._externalAbortSignal=void 0,this._internalAbortSignal=void 0,this._internalAbortController=void 0,i&&i.removeEventListener("abort",this._handleExternalSignalAbort),r&&r.removeEventListener("abort",this._handleInternalSignalAbort),this._trace("_terminate",`reason=${t} completed.`)}async _setRetryAfterTimeout(t){if(this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(this._retryAfterTimeoutID===void 0,"this._retryAfterTimeoutID === undefined"),this._assert(t>=Tt.MINIMUM_RETRY_AFTER_MS,`delayMs >= ${Tt.MINIMUM_RETRY_AFTER_MS}`),this._trace("_setRetryAfterTimeout",`delayMs=${t}`),this._retryAfterTimeoutID!==void 0)return Promise.reject(new Error("retry-after already running."));const e=new Promise((r,i)=>{this._retryAfterTimeoutPromiseFuncReject=i;const o=()=>{this._retryAfterTimeoutID=void 0,this._retryAfterTimeoutPromiseFuncReject=void 0,r()};this._retryCount++,this._retryAfterTimeoutID=setTimeout(o,t)});return this._assert(this._retryAfterTimeoutID!==void 0,"this._retryAfterTimeoutID !== undefined"),this._assert(this._retryAfterTimeoutPromiseFuncReject!==void 0,"this._retryAfterTimeoutPromiseFuncReject !== undefined"),e}_tryClearRetryAfterTimeout(t){if(this._retryAfterTimeoutID===void 0){this._assert(this._retryAfterTimeoutPromiseFuncReject===void 0,"this._retryAfterTimeoutPromiseFuncReject === undefined");return}const e=this._retryAfterTimeoutPromiseFuncReject,r=this._retryAfterTimeoutID;this._retryAfterTimeoutID=void 0,this._retryAfterTimeoutPromiseFuncReject=void 0,clearTimeout(r),e(t??new Error("_tryClearRetryAfterTimeout"))}_setGlobalRequestTimeout(t){this._assert(this._requestGlobalTimeoutID===void 0,"this._requestGlobalTimeoutID === undefined");const e=()=>{this._requestGlobalTimeoutID=void 0,this._handleGlobalRequestTimeout()};this._requestGlobalTimeoutID=setTimeout(e,t)}_handleGlobalRequestTimeout(){this._state.timeout=!0,this._assert(this instanceof Tt,"this instanceof RelayerV2AsyncRequest"),this._assert(!this._state.terminated,"!this._state.terminated"),this._assert(!this._state.timeout,"!this._state.timeout"),this._postAsyncOnProgressCallback({type:"timeout",url:this._url,...this._jobId?{jobId:this._jobId}:{},operation:this._relayerOperation,retryCount:this._retryCount}),this._terminate("timeout",new N0({operation:this._relayerOperation,jobId:this._jobId,url:this._url,timeoutMs:this._requestMaxDurationInMs}))}_tryClearGlobalRequestTimeout(){if(this._requestGlobalTimeoutID===void 0)return;const t=this._requestGlobalTimeoutID;this._requestGlobalTimeoutID=void 0,clearTimeout(t)}_postAsyncOnProgressCallback(t){const e=this._onProgress;e&&queueMicrotask(()=>{e(t)})}_throwRelayerV2ResponseApiError(t){const e=JSON.parse(JSON.stringify(t.relayerApiError));throw this._postAsyncOnProgressCallback({type:"failed",url:this._url,method:t.fetchMethod,status:t.status,...this._jobId?{jobId:this._jobId}:{},operation:this._relayerOperation,retryCount:this._retryCount,elapsed:t.elapsed,relayerApiError:e}),new k0({url:this._url,fetchMethod:t.fetchMethod,status:t.status,jobId:this._jobId,operation:this._relayerOperation,retryCount:this._retryCount,elapsed:t.elapsed,relayerApiError:t.relayerApiError,state:{...this._state}})}_assert(t,e){t||this._throwInternalError(`Assertion failed: ${e}`)}_throwInternalError(t){throw new v0({operation:this._relayerOperation,url:this._url,message:t,state:JSON.stringify(this._state),jobId:this._jobId})}_throwMaxRetryError(t){const e=this._jobIdTimestamp?Date.now()-this._jobIdTimestamp:0;throw new B0({operation:this._relayerOperation,url:this._url,state:{...this._state},retryCount:this._retryCount,jobId:this._jobId,fetchMethod:t.fetchMethod,elapsed:e})}_throwResponseInvalidBodyError(t){throw new b0({...t,url:this._url,jobId:this._jobId,operation:this._relayerOperation,state:{...this._state},retryCount:this._retryCount})}_throwFetchError(t){throw new S0({...t,url:this._url,jobId:this._jobId,operation:this._relayerOperation,state:{...this._state},retryCount:this._retryCount})}_assertCanContinueAfterAwait(){this._canContinue()||this._throwInternalError("cannot continue.")}_trace(t,e){console.log(`[RelayerV2AsyncRequest]:${t}: ${e}`)}}function ap(n,t){Wr(n,"response",t),Wr(n.response,"crs",`${t}.response`);const e=n.response.crs,r=Object.keys(e);for(let o=0;o<r.length;++o)cp(e[r[o]],`${t}.response.crs.${r[o]}`);En(n.response,"fheKeyInfo",`${t}.response`);const i=n.response.fheKeyInfo;for(let o=0;o<i.length;++o){const c=i[o],_=`${t}.response.fheKeyInfo[${o}]`;Wr(c,"fhePublicKey",_),cp(c.fhePublicKey,`${_}.fhePublicKey`)}}function cp(n,t){Q(n,"dataId",t),bb(n,"urls",t)}function U0(n){const t=n.response.fheKeyInfo.map(r=>({fhe_public_key:{data_id:r.fhePublicKey.dataId,urls:r.fhePublicKey.urls}})),e={};for(const[r,i]of Object.entries(n.response.crs))e[r]={data_id:i.dataId,urls:i.urls};return{response:{fhe_key_info:t,crs:e}}}class D0 extends Vh{constructor(t){super(t)}get version(){return 2}async fetchGetKeyUrlV2(){const t=await La("KEY_URL",this.keyUrl);try{ap(t,"fetchGetKeyUrl()")}catch(e){throw new p0({cause:bs(e)})}return t}async fetchGetKeyUrl(){const t=await this.fetchGetKeyUrlV2();return U0(t)}async fetchPostInputProof(t,e){const i=await new Tt({relayerOperation:"INPUT_PROOF",url:this.inputProof,payload:t,options:e}).run();return Qh(i,"fetchPostInputProof()"),i}async fetchPostPublicDecrypt(t,e){const i=await new Tt({relayerOperation:"PUBLIC_DECRYPT",url:this.publicDecrypt,payload:t,options:e}).run();return Jh(i,"fetchPostPublicDecrypt()"),i}async fetchPostUserDecrypt(t,e){const i=await new Tt({relayerOperation:"USER_DECRYPT",url:this.userDecrypt,payload:t,options:e}).run();return $h(i.result,"fetchPostUserDecrypt()"),i.result}}class vt extends It{constructor({message:t,cause:e}){super({message:t,name:"TFHECrsError",...e?{cause:bs(e)}:{}})}}class _p{}class st{_id;_compactPkeCrs;_bits;_srcUrl;constructor(t){this._id=t.id,this._compactPkeCrs=t.compactPkeCrs,this._bits=t.bits,this._srcUrl=t.srcUrl}get id(){return this._id}get bits(){return this._bits}get srcUrl(){return this._srcUrl}static isKeyBytesType(t){try{return st.assertKeyBytesType(t,""),!0}catch{return!1}}static isKeyUrlType(t){try{return st.assertKeyUrlType(t,""),!0}catch{return!1}}static assertKeyBytesType(t,e){Q(t,"id",e),ys(t,"data",e),Oh(t,"bits",e),Zt(t,"srcUrl")&&Q(t,"srcUrl",e)}static assertKeyUrlType(t,e){Q(t,"id",e),Oh(t,"bits",e),Q(t,"srcUrl",e)}static assertIsPublicParams2048BytesType(t,e){Wr(t,"2048",e),Q(t[2048],"publicParamsId",`${e}.2048`),ys(t[2048],"publicParams",`${e}.2048`)}static isPublicParams2048BytesType(t){try{return st.assertIsPublicParams2048BytesType(t,""),!0}catch{return!1}}static async fromBytesOrUrl(t){if(st.isKeyBytesType(t))return st._fromBytes(t);if(st.isPublicParams2048BytesType(t))return st._fromPublicParamsBytes(t);if(st.isKeyUrlType(t))return st._fromUrl(t);throw new vt({message:"Invalid public key (deserialization failed)"})}static fromBytes(t){try{return st.assertKeyBytesType(t,"arg"),st._fromBytes(t)}catch(e){throw new vt({message:"Invalid public key (deserialization failed)",cause:e})}}static fromBytesHex(t){let e;try{Q(t,"data","arg"),e=ho(t.data,!0)}catch(r){throw new vt({message:"Invalid public key (deserialization failed)",cause:r})}return st.fromBytes({id:t?.id,bits:t?.bits,srcUrl:t?.srcUrl,data:e})}static _fromBytes(t){const e={compactPkeCrs:TFHE.CompactPkeCrs.safe_deserialize(t.data,ki),id:t.id,bits:t.bits,srcUrl:t.srcUrl};return new st(e)}static fromPublicParamsBytes(t){try{return st.assertIsPublicParams2048BytesType(t,"arg"),st._fromPublicParamsBytes(t)}catch(e){throw new vt({message:"Invalid public key (deserialization failed)",cause:e})}}static fromBitsPublicParamsBytes(t,e){if(t===void 0)throw new vt({message:"Missing PublicParams bits format"});if(t!==2048)throw new vt({message:`Unsupported PublicParams bits format '${t}'`});try{return Q(e,"publicParamsId","arg"),ys(e,"publicParams","arg"),st._fromPublicParamsBytes({2048:e})}catch(r){throw new vt({message:"Invalid public key (deserialization failed)",cause:r})}}static fromPublicParamsBytesHex(t){try{return Wr(t,"2048","arg"),Q(t[2048],"publicParamsId","arg.2048"),Q(t[2048],"publicParams","arg.2048"),st._fromPublicParamsBytes({2048:{publicParams:ho(t[2048].publicParams,!0),publicParamsId:t[2048].publicParamsId}})}catch(e){throw new vt({message:"Invalid public key (deserialization failed)",cause:e})}}static _fromPublicParamsBytes(t){return st._fromBytes({bits:2048,data:t[2048].publicParams,id:t[2048].publicParamsId})}static async fromUrl(t){try{return st.assertKeyUrlType(t,"arg"),st._fromUrl(t)}catch(e){throw new vt({message:"Impossible to fetch public key: wrong relayer url.",cause:e})}}static async _fromUrl(t){st.assertKeyUrlType(t,"arg");const e=await Ih(t.srcUrl);return st.fromBytes({data:e,id:t.id,bits:t.bits,srcUrl:t.srcUrl})}toBytes(){return{data:this._compactPkeCrs.safe_serialize(ki),id:this._id,bits:this._bits,...this._srcUrl?{srcUrl:this._srcUrl}:{}}}toBytesHex(){return{data:Ph(this._compactPkeCrs.safe_serialize(ki)),id:this._id,bits:this._bits,...this._srcUrl?{srcUrl:this._srcUrl}:{}}}toPublicParams2048Wasm(){if(this._bits!==2048)throw new vt({message:"Unsupported PublicParams bits format '2048'"});return{2048:{publicParams:this._compactPkeCrs,publicParamsId:this._id}}}toPublicParams2048Bytes(){if(this._bits!==2048)throw new vt({message:"Unsupported PublicParams bits format '2048'"});return{2048:{publicParams:this.toBytes().data,publicParamsId:this._id}}}toPublicParams2048BytesHex(){if(this._bits===void 0)throw new vt({message:"Missing PublicParams bits format"});if(this._bits!==2048)throw new vt({message:`Unsupported PublicParams bits format '${this._bits}'`});return{2048:{publicParams:this.toBytesHex().data,publicParamsId:this._id}}}toJSON(){return{__type:"TFHECrs",...this.toBytesHex()}}static fromJSON(t){if(t.__type!=="TFHECrs")throw new vt({message:"Invalid TFHECrs JSON."});return st.fromBytesHex(t)}}class L0 extends It{constructor({message:t,cause:e}){super({message:t,name:"TFHEPublicKeyError",...e?{cause:bs(e)}:{}})}}class At{_id;_tfheCompactPublicKey;_srcUrl;constructor(t){this._id=t.id,this._tfheCompactPublicKey=t.tfheCompactPublicKey,this._srcUrl=t.srcUrl}get id(){return this._id}get srcUrl(){return this._srcUrl}static isKeyBytesType(t){try{return At.assertKeyBytesType(t,""),!0}catch{return!1}}static isKeyUrlType(t){try{return At.assertKeyUrlType(t,""),!0}catch{return!1}}static assertKeyBytesType(t,e){Q(t,"id",e),ys(t,"data",e),Zt(t,"srcUrl")&&Q(t,"srcUrl",e)}static assertKeyUrlType(t,e){Q(t,"id",e),Q(t,"srcUrl",e)}static async fromBytesOrUrl(t){if(At.isKeyBytesType(t))return At._fromBytes(t);if(At.isKeyUrlType(t))return At._fromUrl(t);throw new Error("Invalid public key (deserialization failed)")}static fromBytes(t){try{return At.assertKeyBytesType(t,"arg"),At._fromBytes(t)}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}static fromBytesHex(t){let e;try{Q(t,"data","arg"),e=ho(t.data,!0)}catch(r){throw new Error("Invalid public key (deserialization failed)",{cause:r})}return At.fromBytes({id:t?.id,srcUrl:t?.srcUrl,data:e})}static _fromBytes(t){const e={tfheCompactPublicKey:TFHE.TfheCompactPublicKey.safe_deserialize(t.data,vi),id:t.id,srcUrl:t.srcUrl};return new At(e)}static async fromUrl(t){try{return At.assertKeyUrlType(t,"arg"),At._fromUrl(t)}catch(e){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:e})}}static async _fromUrl(t){const e=await Ih(t.srcUrl);return At.fromBytes({data:e,id:t.id,srcUrl:t.srcUrl})}toBytes(){return{data:this._tfheCompactPublicKey.safe_serialize(vi),id:this._id,...this._srcUrl?{srcUrl:this._srcUrl}:{}}}toBytesHex(){return{data:Ph(this._tfheCompactPublicKey.safe_serialize(vi)),id:this._id,...this._srcUrl?{srcUrl:this._srcUrl}:{}}}toPublicKeyWasm(){return{publicKey:this._tfheCompactPublicKey,publicKeyId:this._id}}toPublicKeyBytes(){return{publicKey:this.toBytes().data,publicKeyId:this._id}}toPublicKeyBytesHex(){return{publicKey:this.toBytesHex().data,publicKeyId:this._id}}static _fromPublicKeyBytes(t){return At._fromBytes({data:t.publicKey,id:t.publicKeyId,srcUrl:t.srcUrl})}static fromPublicKeyBytesHex(t){try{return Q(t,"publicKey","arg"),Q(t,"publicKeyId","arg"),At._fromPublicKeyBytes({publicKey:ho(t.publicKey,!0),publicKeyId:t.publicKeyId})}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}static fromPublicKeyBytes(t){try{return ys(t,"publicKey","arg"),Q(t,"publicKeyId","arg"),At._fromPublicKeyBytes(t)}catch(e){throw new Error("Invalid public key (deserialization failed)",{cause:e})}}toJSON(){return{__type:"TFHEPublicKey",...this.toBytesHex()}}static fromJSON(t){if(t.__type!=="TFHEPublicKey")throw new L0({message:"Invalid TFHEPublicKey JSON."});return At.fromBytesHex(t)}}class Ci{_crs2048;_publicKey;constructor(t){this._publicKey=t.publicKey,this._crs2048=t.crs2048}static tryFromBytes(t){if(!Zt(t,"publicParams")||!st.isPublicParams2048BytesType(t.publicParams)||!Zt(t,"publicKey")||!At.isKeyBytesType(t.publicKey))return null;const e=t.publicKey,r=t.publicParams;return Ci.fromBytes({publicKey:e,publicParams:r})}static fromBytes(t){st.assertIsPublicParams2048BytesType(t.publicParams,"arg.publicParams");const e=At.fromBytes(t.publicKey),r=st.fromBytes({id:t.publicParams[2048].publicParamsId,data:t.publicParams[2048].publicParams,bits:2048});return new Ci({publicKey:e,crs2048:r})}static async fromRelayerResponse(t){try{ap(t,"RelayerV2GetResponseKeyUrl");const e=t.response.fheKeyInfo[0].fhePublicKey,r=e.dataId,i=e.urls[0],o=t.response.crs[2048],c=o.dataId,_=o.urls[0],l=await At.fromUrl({id:r,srcUrl:i}),u=await st.fromUrl({id:c,bits:2048,srcUrl:_});return new Ci({publicKey:l,crs2048:u})}catch(e){throw new Error("Impossible to fetch public key: wrong relayer url.",{cause:e})}}getTFHEPublicKey(){return this._publicKey}getTFHECrs(){return this._crs2048}toBytes(){return{publicKey:this._publicKey.toBytes(),publicParams:this._crs2048.toPublicParams2048Bytes()}}}class Wa extends _p{_relayerProvider;_relayerPublicKey;constructor(t){super(),this._relayerProvider=t.relayerProvider,this._relayerPublicKey=t.relayerPublicKey}get version(){return 2}get relayerVersionUrl(){return this.relayerProvider.url}static async fromConfig(t){const e=new D0(t.relayerVersionUrl);let r=Ci.tryFromBytes(t);if(!r){const i=await e.fetchGetKeyUrlV2();r=await Ci.fromRelayerResponse(i)}return new Wa({relayerProvider:e,relayerPublicKey:r})}get relayerProvider(){return this._relayerProvider}getPublicKeyInfo(){return{id:this._relayerPublicKey.getTFHEPublicKey().id,srcUrl:this._relayerPublicKey.getTFHEPublicKey().srcUrl}}getPublicKeyBytes(){return this._relayerPublicKey.getTFHEPublicKey().toPublicKeyBytes()}getPublicKeyWasm(){return this._relayerPublicKey.getTFHEPublicKey().toPublicKeyWasm()}getPublicParamsBytesForBits(t){if(t===void 0)throw new vt({message:"Missing PublicParams bits format"});if(t!==2048)throw new vt({message:`Unsupported PublicParams bits format '${t}'`});return this._relayerPublicKey.getTFHECrs().toPublicParams2048Bytes()[2048]}getPublicParamsWasmForBits(t){if(t===void 0)throw new vt({message:"Missing PublicParams bits format"});if(t!==2048)throw new vt({message:`Unsupported PublicParams bits format '${t}'`});return this._relayerPublicKey.getTFHECrs().toPublicParams2048Wasm()[2048]}getPublicParamsInfo(){return{id:this._relayerPublicKey.getTFHECrs().id,bits:this._relayerPublicKey.getTFHECrs().bits,srcUrl:this._relayerPublicKey.getTFHECrs().srcUrl}}}class Za extends _p{_relayerProvider;_publicKeyData;_publicParamsData;constructor(t){super(),this._relayerProvider=t.relayerProvider,this._publicKeyData=t.publicKeyData,this._publicParamsData=t.publicParamsData}get version(){return 1}get relayerVersionUrl(){return this.relayerProvider.url}static async fromConfig(t){const e=new u0(t.relayerVersionUrl),r=await Eb(t),i=await xb(t);return new Za({relayerProvider:e,publicKeyData:r,publicParamsData:i})}get relayerProvider(){return this._relayerProvider}getPublicKeyBytes(){return{publicKey:this._publicKeyData.publicKey.safe_serialize(vi),publicKeyId:this._publicKeyData.publicKeyId}}getPublicKeyInfo(){return{id:this._publicKeyData.publicKeyId}}getPublicParamsInfo(){return{id:this._publicParamsData[2048].publicParamsId,bits:2048}}getPublicKeyWasm(){return{publicKey:this._publicKeyData.publicKey,publicKeyId:this._publicKeyData.publicKeyId}}getPublicParamsBytesForBits(t){if(t===void 0)throw new Error("Missing PublicParams bits format");if(t!==2048)throw new Error(`Unsupported PublicParams bits format '${t}'`);return{publicParams:this._publicParamsData[2048].publicParams.safe_serialize(ki),publicParamsId:this._publicParamsData[2048].publicParamsId}}getPublicParamsWasmForBits(t){if(t===void 0)throw new Error("Missing PublicParams bits format");if(t!==2048)throw new Error(`Unsupported PublicParams bits format '${t}'`);return{publicParams:this._publicParamsData[2048].publicParams,publicParamsId:this._publicParamsData[2048].publicParamsId}}}async function M0(n){const t=j0(n.relayerUrl,n.defaultRelayerVersion);if(!t)throw new Error(`Invalid relayerUrl: ${n.relayerUrl}`);if(t.version===2)return Wa.fromConfig({relayerVersionUrl:t.url,publicKey:n.publicKey,publicParams:n.publicParams});if(t.version===1)return Za.fromConfig({relayerVersionUrl:t.url,publicKey:n.publicKey,publicParams:n.publicParams});throw new Error(`Invalid relayerUrl: ${n.relayerUrl}`)}function j0(n,t){if(!n||typeof n!="string")return null;const e=Ga(n,"/");if(!URL.canParse(e))return null;if(e.endsWith("/v1"))return{url:n,version:1};if(e.endsWith("/v2"))return{url:n,version:2};if(typeof t!="number")throw new Error(`relayerUrl cannot be resolved. (value=${n})`);return{url:`${e}/v${t}`,version:t}}const lp={aclContractAddress:"0xcA2E8f1F656CD25C01F05d0b243Ab1ecd4a8ffb6",kmsContractAddress:"0x77627828a55156b04Ac0DC0eb30467f1a552BB03",inputVerifierContractAddress:"0xCe0FC2e05CFff1B719EFF7169f7D80Af770c8EA2",verifyingContractAddressDecryption:"0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24",verifyingContractAddressInputVerification:"0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287",chainId:1,gatewayChainId:261131,network:"https://ethereum-rpc.publicnode.com",relayerUrl:"https://relayer.mainnet.zama.org"};Object.freeze(lp);const qa={aclContractAddress:"0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D",kmsContractAddress:"0xbE0E383937d564D7FF0BC3b46c51f0bF8d5C311A",inputVerifierContractAddress:"0xBBC1fFCdc7C316aAAd72E807D9b0272BE8F84DA0",verifyingContractAddressDecryption:"0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478",verifyingContractAddressInputVerification:"0x483b9dE06E4E4C7D35CCf5837A1668487406D955",chainId:11155111,gatewayChainId:10901,network:"https://ethereum-sepolia-rpc.publicnode.com",relayerUrl:"https://relayer.testnet.zama.org"};Object.freeze(qa);const G0=async n=>{const{verifyingContractAddressDecryption:t,verifyingContractAddressInputVerification:e,publicKey:r,inputVerifierContractAddress:i,kmsContractAddress:o,aclContractAddress:c,gatewayChainId:_,auth:l}=n;if(!Bi(c))throw new Error("ACL contract address is not valid or empty");if(!Bi(i))throw new Error("InputVerifier contract address is not valid or empty");if(!Bi(o))throw new Error("KMS contract address is not valid or empty");if(!Bi(t))throw new Error("Verifying contract for Decryption address is not valid or empty");if(!Bi(e))throw new Error("Verifying contract for InputVerification address is not valid or empty");if(r&&!(r.data instanceof Uint8Array))throw new Error("publicKey must be a Uint8Array");const u=mb(n.network),h=n.relayerUrl??qa.relayerUrl,f=await M0({relayerUrl:h,publicKey:n.publicKey,publicParams:n.publicParams,defaultRelayerVersion:1}),d=await Ab(u,n),y=await Rb(u,o),R=await zb(u,o),E=await Pb(u,i),x=await Ib(u,i);return{createEncryptedInput:n0(c,e,d,_,f.relayerProvider,f.getPublicKeyWasm().publicKey,{2048:f.getPublicParamsWasmForBits(2048)},E,x,l&&{auth:l}),requestZKProofVerification:(z,k)=>{if(z.chainId!==d||z.aclContractAddress!==c)throw new Error("Invalid ZKProof");return r0({ciphertext:z.ciphertextWithZkProof,aclContractAddress:c,contractAddress:z.contractAddress,userAddress:z.userAddress,chainId:d,gatewayChainId:_,bits:z.bits,coprocessorSigners:E,extraData:"0x00",thresholdCoprocessorSigners:x,relayerProvider:f.relayerProvider,verifyingContractAddressInputVerification:e,options:k})},generateKeypair:Kh,createEIP712:Hh(t,d),publicDecrypt:l0(y,R,_,t,c,f.relayerProvider,u,l&&{auth:l}),userDecrypt:jb(y,_,d,t,c,f.relayerProvider,u,l&&{auth:l}),getPublicKey:()=>f.getPublicKeyBytes(),getPublicParams:z=>f.getPublicParamsBytesForBits(z)}};let up=!1;const H0=async({tfheParams:n,kmsParams:t,thread:e}={})=>(e==null&&(e=navigator.hardwareConcurrency),await Ly()||(console.warn(`This browser does not support threads. Verify that your server returns correct headers:
|
|
5
5
|
`,`'Cross-Origin-Opener-Policy': 'same-origin'
|
|
6
|
-
`,"'Cross-Origin-Embedder-Policy': 'require-corp'"),e=void 0),
|
|
6
|
+
`,"'Cross-Origin-Embedder-Policy': 'require-corp'"),e=void 0),up||(await cs({module_or_path:n}),await Ua({module_or_path:t}),e&&(Ba(),await Ta(e)),up=!0),!0);window.TFHE={default:cs,initThreadPool:Ta,init_panic_hook:Ba,TfheCompactPublicKey:Wt,CompactPkeCrs:$t,CompactCiphertextList:$r,ZkComputeLoad:iu},window.TKMS={default:Ua,u8vec_to_ml_kem_pke_pk:nb,u8vec_to_ml_kem_pke_sk:ib,new_client:Yy,new_server_id_addr:qy,process_user_decryption_resp_from_js:sb,ml_kem_pke_keygen:Xy,ml_kem_pke_pk_to_u8vec:eb,ml_kem_pke_sk_to_u8vec:rb,ml_kem_pke_get_pk:tb},Kt.MainnetConfig=lp,Kt.SepoliaConfig=qa,Kt.createEIP712=Hh,Kt.createInstance=G0,Kt.generateKeypair=Kh,Kt.getErrorCauseCode=ub,Kt.getErrorCauseStatus=fb,Kt.initSDK=H0,Object.defineProperty(Kt,Symbol.toStringTag,{value:"Module"})});
|