@ethersphere/bee-dashboard 0.35.2 → 0.36.0

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.
Files changed (43) hide show
  1. package/README.md +16 -0
  2. package/build/assets/{__vite-browser-external-9jrN1CIx.js → __vite-browser-external-D_bWAWBK.js} +2 -2
  3. package/build/assets/{download.browser-DkW-1Tu7.js → download.browser-DiGQFa2N.js} +1 -1
  4. package/build/assets/{download.node-DYTXAdrY.js → download.node-CzjvEswv.js} +1 -1
  5. package/build/assets/{fs.node-DwBlG7zh.js → fs.node-B87L1gKf.js} +2 -2
  6. package/build/assets/index-Dd3cxIPS.js +133 -0
  7. package/build/assets/vendor-ethers-DdwEM-gK.js +87 -0
  8. package/build/assets/vendor-react-mui-tUcmOwCz.js +227 -0
  9. package/build/index.html +3 -3
  10. package/lib/{App-BaED7J22.mjs → App-DNdxuM_D.mjs} +11167 -21655
  11. package/lib/{App-C_kvJWIL.js → App-bJc-m8lc.js} +11167 -21655
  12. package/lib/App.cjs.js +1 -1
  13. package/lib/App.d.ts +5 -1
  14. package/lib/App.js +1 -1
  15. package/lib/assets/data/nodes-db.json.d.ts +8670 -47142
  16. package/lib/components/ChainSync.d.ts +1 -1
  17. package/lib/components/Flex.d.ts +1 -1
  18. package/lib/{download.browser-Brcsou-R.js → download.browser-BtsZfHY2.js} +1 -1
  19. package/lib/{download.browser-CuzNogtF.mjs → download.browser-xicfmV_K.mjs} +1 -1
  20. package/lib/{download.node-Bnd9C4co.js → download.node-Bzm4Mzw4.js} +1 -1
  21. package/lib/{download.node-C_QRIakM.mjs → download.node-Cot8qXzn.mjs} +1 -1
  22. package/lib/{fs.node-p28LxQ49.mjs → fs.node-6BiRJR_i.mjs} +1 -1
  23. package/lib/{fs.node-BOfQnDum.js → fs.node-CVEodnBo.js} +1 -1
  24. package/lib/modules/filemanager/components/CustomDropdown/CustomDropdown.d.ts +1 -1
  25. package/lib/modules/filemanager/components/VersionHistoryModal/VersionList/VersionList.d.ts +1 -1
  26. package/lib/pages/filemanager/SearchContext.d.ts +1 -1
  27. package/lib/pages/filemanager/ViewContext.d.ts +1 -1
  28. package/lib/pages/giftCode/index.d.ts +1 -1
  29. package/lib/pages/info/ChequebookInfoCard.d.ts +1 -1
  30. package/lib/pages/info/WalletInfoCard.d.ts +1 -1
  31. package/lib/providers/FileManager.d.ts +1 -1
  32. package/lib/providers/Settings.d.ts +10 -0
  33. package/lib/theme.d.ts +1 -1
  34. package/lib/{upload.node-BsycYU0Z.mjs → upload.node-Do4ZBa7z.mjs} +3 -3
  35. package/lib/{upload.node-BOc26jHW.js → upload.node-Lj4JAWof.js} +3 -3
  36. package/lib/utils/bee-error.d.ts +22 -0
  37. package/lib/utils/common.d.ts +1 -0
  38. package/lib/utils/desktop.d.ts +4 -0
  39. package/lib/utils/index.d.ts +1 -0
  40. package/package.json +9 -6
  41. package/build/assets/index-BWr_7okq.js +0 -126
  42. package/build/assets/vendor-ethers-Dmh4iz5c.js +0 -87
  43. package/build/assets/vendor-react-mui-Dv6xxk4a.js +0 -227
@@ -0,0 +1,87 @@
1
+ import{p as Ce,g as lh,c as Ir,a as Td}from"./vendor-react-mui-tUcmOwCz.js";var Iu={},Bd;function y4(){return Bd||(Bd=1,(function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.Vector=t.Cache=t.Assertions=t.Strings=t.Types=t.Objects=t.Dates=t.Promises=t.Numbers=t.System=t.Arrays=t.Random=t.Elliptic=t.Binary=t.Lock=t.Solver=t.RollingValueProvider=t.TrieRouter=t.AsyncQueue=t.PubSubChannel=t.FixedPointNumber=t.MerkleTree=t.Chunk=t.Uint8ArrayWriter=t.Uint8ArrayReader=t.AsyncLazy=t.Lazy=t.Optional=void 0;async function r(s){return new Promise((c,f)=>s.then(f,c))}async function n(s){return r(Promise.all(s.map(r)))}async function i(s,c=1){const f=W0(s,c),p=[],b=f.map(async v=>{for(const V of v)p.push(await V())});return await Promise.all(b),p}async function o(s){return new Promise(c=>setTimeout(()=>{c(!0)},s))}function a(s,c=Math.random){for(let f=s.length-1;f>0;f--){const p=Math.floor(c()*(f+1)),b=s[f];s[f]=s[p],s[p]=b}return s}function u(s){if(s.length===1)return s[0];throw Error(`Expected exactly one element, actual: ${s.length}`)}function l(s){return s.length===1?s[0]:null}function h(s){return s.length>0?s[0]:null}function d(s){if(!s.length)throw Error("Received empty array");return s[0]}function m(s,c){const f=[];for(let p=0;p<s;p++)f.push(c(p));return f}function y(s){const c=[];for(let f=0;f<s[0].length;f++){c.push([]);for(let p=0;p<s.length;p++)c[f].push(s[p][f])}return c}function w(s,c,f){const p=[];for(let b=0;b<s;b++){p.push([]);for(let v=0;v<c;v++)p[b].push(f)}return p}function T(s,c,f,p){if(f<0||p<0||p+c[0].length>s[0].length||f+c.length>s.length)return!1;for(let b=0;b<c.length;b++)for(let v=0;v<c[b].length;v++)if(c[b][v]!==void 0&&s[f+b][p+v]!==c[b][v])return!1;return!0}function R(s,c,f=Math.random){return a(y0(0,s.length-1),f).slice(0,c)}function O(s,c){return s.map(f=>f[c])}function A(s){let c=s,f=3405648695,p=3735928559;return function(){return c+=f,f^=c<<7,c*=p,p^=c<<13,c^=f^p,(c>>>0)/4294967296}}function I(s,c,f=Math.random){return Math.floor(f()*(c-s+1))+s}function B(s,c,f=Math.random){return f()*(c-s)+s}function S(){return Math.random()*2-1}function N(s,c,f){return c>=s.x&&c<s.x+s.width&&f>=s.y&&f<s.y+s.height}function _(s,c,f,p=Math.random){let b,v;do b=I(0,s-1,p),v=I(0,c-1,p);while(f&&N(f,b,v));return[b,v]}function D(s,c=Math.random){const f=Math.floor(s),p=s-f;return L(p,c)?f+1:f}function L(s,c=Math.random){return c()<s}function H(s,c=Math.random){return s[Math.floor(s.length*c())]}function K(s,c,f=Math.random){if(c>s.length)throw new Error(`Count (${c}) is greater than array length (${s.length})`);return R(s,c,f).map(p=>s[p])}function le(s,c,f,p=Math.random){if(c>s.length)throw new Error(`Count (${c}) is greater than array length (${s.length})`);const b=[];for(;b.length<c;){const v=H(s,p);b.some(V=>f(V,v))||b.push(v)}return b}function U(s,c,f,p,b,v=Math.random){const V=s.filter(Y=>Y!==c&&Y!==f),te=[];for(c!==null&&te.push(c);V.length&&te.length<p;){const Y=t.Random.intBetween(0,V.length-1,v);b(V[Y],te)&&te.push(V[Y]),V.splice(Y,1)}return a(te,v),{values:te,indexOfGuaranteed:c!==null?te.indexOf(c):-1}}function ge(s){if(!s.length)throw Error("Received empty array");return s[s.length-1]}function Be(s,c,f){return f(c.reduce((p,b)=>b(p),s))}function ne(s,c){return f=>Be(f,s,c)}function ue(s,c,f){if(f===void 0&&(f=Math.random()),s.length!==c.length)throw new Error("Array length mismatch");let p=c.reduce((v,V)=>v+V,0);const b=f*p;for(let v=0;v<s.length-1;v++)if(p-=c[v],b>=p)return s[v];return ge(s)}function ye(s,c,f=Math.random){const p=c.map(v=>f()*v),b=[];for(let v=0;v<s.length;v++)b.push([s[v],p[v]]);return b.sort((v,V)=>V[1]-v[1]).map(v=>v[0])}function Ae(s,c){if(s==null)return null;const f=c.split(".");let p=s;for(const b of f){if(p[b]===null||p[b]===void 0)return null;p=p[b]}return p}function Ee(s,c,f){const p=c.split(/\.|\[/);let b=s;for(let v=0;v<p.length;v++){const V=p[v],te=v<p.length-1&&p[v+1].includes("]"),Y=V.includes("]")?V.replace(/\[|\]/g,""):V;if(v===p.length-1)return b[Y]=f,f;xt(b[Y])||(te?b[Y]=[]:b[Y]={}),b=b[Y]}return f}function Se(s,c,f=1){const p=Ae(s,c)||0;return Ee(s,c,p+f),p}function Ue(s,c,f){return Ae(s,c)||Ee(s,c,f)}function _e(s,c){const f=mc(c,"."),p=b0(c,".");if(!f||!p)return;const b=Ae(s,f);b&&delete b[p]}function j(s,c,f){const p=Ae(s,c);if(!p)throw new Error("Key '"+c+"' does not exist.");return Ee(s,c,f),p}function J(s,c,f){for(const p of c){const b=Ae(s,p);if(b)return b}if(f){const p=Object.values(s);if(p.length)return p[0]}return null}async function se(s,c,f){for(;;){try{await s()}catch(p){f&&f("Error in forever",p)}await o(c)}}function M(s,c){s();const f=setInterval(()=>{s()},c);return()=>clearInterval(f)}function z(){const s=globalThis.process;return s?s.browser===!0?"browser":"node":"browser"}async function Q(s,c,f,p,b,v){let V=null;for(let te=0;te<=c;te++)try{return await s()}catch(Y){if(V=Y,te===c)break;const we=f+(p-f)*(te/(c-1));b&&b("Error in withRetries, retrying",{attempt:te+1,allowedFailures:c,delayMillis:we,error:Y}),v&&v(),await o(we)}throw V}function ie(s){return s/1024/1024}function oe(s,c=1024){return s>=c*c*c*c?(s/c/c/c/c).toFixed(3)+" TB":s>=c*c*c?(s/c/c/c).toFixed(3)+" GB":s>=c*c?(s/c/c).toFixed(3)+" MB":s>=c?(s/c).toFixed(3)+" KB":s+" B"}function P(s){const c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s.toLowerCase());if(!c)throw new Error("Invalid hex color: "+s);return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]}function k(s){return"#"+s.map(c=>c.toString(16).padStart(2,"0")).join("")}function Z(s,c,f,p){const b=s*Math.PI/180,v=f*Math.PI/180,V=(f-s)*Math.PI/180,te=(p-c)*Math.PI/180,Y=Math.sin(V/2)*Math.sin(V/2)+Math.cos(b)*Math.cos(v)*Math.sin(te/2)*Math.sin(te/2);return 6371e3*(2*Math.atan2(Math.sqrt(Y),Math.sqrt(1-Y)))}function fe(s,c){return Math.round(s/c)*c}function Oe(s){return s>1e3?(s/1e3).toFixed(0)+" km":s>=500?fe(s,100)+" m":s>=100?fe(s,50)+" m":fe(s,10)+" m"}function xe(s){return s*(s+1)/2}function Fe(s){const c=s.match(/-?\d+(\.\d+)?/);if(!c)throw Error("No float found in "+s);return parseFloat(c[0])}function Lt(s,c,f=Math.random){const p=s*c,b=Math.sqrt(s*c*(1-c)),v=(f()+f()+f()+f()+f()+f()-3)*Math.SQRT2,V=Math.round(p+b*v);return Math.max(0,Math.min(s,V))}function X(s,c){if(!s.includes("."))return s;if(parseFloat(s)===0)return"0";const[f,p]=s.split("."),b=f.replace("-",""),v=b.length;if(v>=c)return f;if(b!=="0"){const Y=c-v,we=p.slice(0,Y);return/[1-9]/.test(we)?`${f}.${we.replace(/0+$/,"")}`:f}const V=p.match(/^0*/)?.[0].length??0,te=c+V;return`${f}.${p.slice(0,te)}`}function xt(s,c=!0){return!s||c&&!jt(s._readableState)||c&&s.constructor&&(s.constructor.isBuffer||s.constructor.name=="AbortController"||s.constructor.name=="AbortSignal"||s.constructor.name=="Uint8Array"||s.constructor.name==="ArrayBuffer"||s.constructor.name==="ReadableStream")?!1:typeof s=="object"}function wt(s){return xt(s)&&!Array.isArray(s)}function qe(s){return Array.isArray(s)&&s.length===0}function st(s){return wt(s)&&Object.keys(s).length===0}function jt(s){return s===void 0}function Er(s){return Object.prototype.toString.call(s)==="[object Function]"||Object.prototype.toString.call(s)==="[object AsyncFunction]"}function at(s){return Object.prototype.toString.call(s)==="[object String]"}function Bt(s){return typeof s=="number"&&isFinite(s)}function cr(s){return s===!0||s===!1}function rr(s){return Object.prototype.toString.call(s)==="[object Date]"}function un(s){return!at(s)||s.trim().length===0}function fi(s){return Bt(s)&&Number.isInteger(s)&&s>=1}function wo(s){return at(s)&&s.match(/^-?\d+$/)!==null}function is(s){return at(s)&&s.match(/^(0x)?[0-9a-f]+$/i)!==null}const ln="!@#$%^&*()_+-=[]{}|;:<>?,./",Cn="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),ss="abcdefghijklmnopqrstuvwxyz",lc="ABCDEFGHIJKLMNOPQRSTUVWXYZ",os="1234567890",as=ss+lc+os,Ao=as+ln,cs=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],_n="0123456789abcdef";function ur(s,c=Math.random){let f="";for(let p=0;p<s;p++)f+=ss[Math.floor(c()*ss.length)];return f}function us(s,c=Math.random){let f="";for(let p=0;p<s;p++)f+=as[Math.floor(c()*as.length)];return f}function fc(s,c=Math.random){let f="";for(let p=0;p<s;p++)f+=Ao[Math.floor(c()*Ao.length)];return f}function Nr(s,c=Math.random){let f="";for(let p=0;p<s;p++)f+=cs[Math.floor(c()*cs.length)];return f}function hc(s,c){const f=new RegExp(`[0-9a-f]{${c}}`,"i"),p=s.match(f);return p?p[0]:null}function E(s,c,f=Cn){const p=x0(s,f);for(const b of p)if(c(b))return b;return null}function g(s,c=Math.random){let f="";for(let p=0;p<s;p++)f+=_n[Math.floor(c()*_n.length)];return f}function x(s,c){if(!wo(s))throw new TypeError(`Expected integer string${c?.name?` for ${c.name}`:""}, got: `+s);const f=BigInt(s);if(c&&(c.min&&f<c.min||c.max&&f>c.max))throw RangeError(`Expected integer string${c?.name?` for ${c.name}`:""} in range: ${c.min??"-inf"}..${c.max??"inf"}; got: `+f);return s}function C(s,c){if(un(s))throw new TypeError(`Expected string${c?.name?` for ${c.name}`:""}, got: `+s);if(c&&(c.min!==void 0&&s.length<c.min||c.max!==void 0&&s.length>c.max))throw RangeError(`Expected string${c?.name?` for ${c.name}`:""} length in range: ${c.min??"-inf"}..${c.max??"inf"}; got: ${s.length}`);return s}function $(s,c){if(!is(s))throw new TypeError(`Expected hex string${c?.name?` for ${c.name}`:""}, got: `+s);if(c?.strictPrefix&&!s.startsWith("0x")&&!s.startsWith("0X"))throw new TypeError(`Expected hex string with 0x prefix${c?.name?` for ${c.name}`:""}, got: `+s);const f=s.replace(/^0x/i,"");if(f.length%2!==0&&!c?.uneven)throw RangeError(`Expected even number of hex digits${c?.name?` for ${c.name}`:""}; got: `+s);if(c&&c.byteLength&&f.length!==c.byteLength*2)throw RangeError(`Expected hex string${c?.name?` for ${c.name}`:""} of byte length ${c.byteLength}; got: `+f);return`0x${f}`}function q(s,c){if(!C(s,c).split("").every(f=>f==="_"||hs(f)))throw new TypeError(`Expected safe string${c?.name?` for ${c.name}`:""}, got: `+s);return s}function ee(s,c){if(c.min!==void 0&&s<c.min||c.max!==void 0&&s>c.max)throw RangeError(`Expected value${c?.name?` for ${c.name}`:""} in range: ${c.min??"-inf"}..${c.max??"inf"}; got: ${s}`)}function Ne(s,c){if(!Er(s))throw new TypeError(`Expected function${c?.name?` for ${c.name}`:""}, got: `+s);return s}function Je(s,c){if(Bt(s))return c&&ee(s,c),s;if(!at(s)||!s.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${c?.name?` for ${c.name}`:""}, got: `+s);const f=parseFloat(s);return c&&ee(f,c),f}function Ze(s,c){return Math.trunc(Je(s,c))}function ct(s,c){if(s==="true")return!0;if(s==="false")return!1;if(!cr(s))throw new TypeError(`Expected boolean${c?.name?` for ${c.name}`:""}, got: `+s);return s}function Ke(s,c){if(!rr(s))throw new TypeError(`Expected date${c?.name?` for ${c.name}`:""}, got: `+s);return s}function Cw(s){return un(s)?null:s}function _w(s,c){if(!at(s))throw new TypeError(`Expected string${c?.name?` for ${c.name}`:""}, got: `+s);return s}function Fw(s,c){if(fi(s))return s;const f=parseInt(s,10);if(!fi(f))throw new TypeError(`Expected id${c?.name?` for ${c.name}`:""}, got: `+s);return f}function Dw(s,c){if(!at(s))throw new TypeError(`Expected time${c?.name?` for ${c.name}`:""}, got: `+s);const f=s.split(":");if(f.length!==2)throw new TypeError(`Expected time${c?.name?` for ${c.name}`:""}, got: `+s);const p=parseInt(f[0],10),b=parseInt(f[1],10);if(!Bt(p)||!Bt(b)||p<0||p>23||b<0||b>59)throw new TypeError(`Expected time, got${c?.name?` for ${c.name}`:""}: `+s);return`${String(p).padStart(2,"0")}:${String(b).padStart(2,"0")}`}function Lw(s,c){if(!Array.isArray(s))throw new TypeError(`Expected array${c?.name?` for ${c.name}`:""}, got: `+s);return s}function Eo(s,c){if(!wt(s))throw new TypeError(`Expected object${c?.name?` for ${c.name}`:""}, got: `+s);return s}function Uw(s,c){return s===null?null:Eo(s,c)}function Mw(s,c){const f=Eo(s,c);for(const p of Object.keys(f))if(!at(f[p]))throw new TypeError(`Expected string map${c?.name?` for ${c.name}`:""}, got: `+s);return f}function zw(s,c){const f=Eo(s),p=Object.keys(f),b=Object.values(f);if(!p.every(at)||!b.every(Bt))throw new TypeError(`Expected numeric dictionary${c?.name?` for ${c.name}`:""}, got: `+s);return f}function h0(s){return at(s)&&s.match(/^https?:\/\/.+/)!==null}function $w(s,c){if(!h0(s))throw new TypeError(`Expected url${c?.name?` for ${c.name}`:""}, got: `+s);return s}function d0(s){return typeof s=="bigint"}function p0(s,c){if(!d0(s))throw new TypeError(`Expected bigint${c?.name?` for ${c.name}`:""}, got: `+s);if(c?.min!==void 0&&s<c?.min||c?.max!==void 0&&s>c?.max)throw RangeError(`Expected value${c?.name?` for ${c.name}`:""} in range: ${c.min??"-inf"}..${c.max??"inf"}; got: ${s}`);return s}function Vw(s,c){return c==null?!0:s(c)}function Gw(s,c){return c==null?null:s(c)}function jw(s,c){return c===""?void 0:s(c)}function Hw(s,c){return c==null?void 0:s(c)}function m0(s,c){for(const[f,p]of Object.entries(c))if(!p(s[f]))throw TypeError(`${f} in value does not exist or match shape`);for(const f of Object.keys(s))if(!c[f])throw TypeError(`${f} exists in value but not in shape`);return!0}function qw(s,c){return s.every(f=>m0(f,c))}function ls(s,c="json",f=0){if(s&&Er(s.represent)){const p=s.represent();if(at(p))return c==="json"&&f===0?JSON.stringify(p):p}if(xt(s,!1)){if(f>1)return"[object Object]";if(c==="json"){if(Array.isArray(s)){const b=s.map(v=>ls(v,"json",f+1));return f===0?JSON.stringify(b):b}const p={};s.message&&(p.message=ls(s.message,"json",f+1));for(const[b,v]of Object.entries(s))p[b]=ls(v,"json",f+1);return f===0?JSON.stringify(p):p}else if(c==="key-value"){const p=Object.keys(s);return s.message&&!p.includes("message")&&p.unshift("message"),p.map(b=>`${b}=${JSON.stringify(ls(s[b],"json",f+1))}`).join(" ")}}return jt(s)&&(s="undefined"),f===0?JSON.stringify(s):s}function Zw(s,c){if(at(s))return s;const f=Object.keys(s);s.message&&!f.includes("message")&&f.push("message");const p=f.map(b=>`${b}: ${s[b]}`).join("; ");return c&&s.stack?p+`
2
+ `+s.stack:p}function Fn(s,c){if(wt(s)&&wt(c))for(const f in c)wt(c[f])?(s[f]||(s[f]={}),Fn(s[f],c[f])):Array.isArray(c[f])?s[f]=[...c[f]]:(c[f]!==null&&c[f]!==void 0||s[f]===null||s[f]===void 0)&&(s[f]=c[f]);return s}function Kw(s,c){const f={};return Fn(f,s),Fn(f,c),f}function Jw(s,c,f){const p={};return Fn(p,s),Fn(p,c),Fn(p,f),p}function g0(s,c){const f={};for(const p of s)for(const b of Object.keys(p))f[b]?f[b]=c(f[b],p[b]):f[b]=p[b];return f}function Ww(s){return g0(s,(c,f)=>c+f)}function Qw(s,c,f){s[c]||(s[c]=[]),s[c].push(f)}function Yw(s,c,f){for(s.unshift(c);s.length>f;)s.pop()}function Xw(s,c){let f=c%s.length;return f<0&&(f+=s.length),s[f]}function vo(s,c){Array.prototype.push.apply(s,c)}function e2(s,c){Array.prototype.unshift.apply(s,c)}async function t2(s,c){const f=[];for(const p of s)f.push(await c(p));return f}function r2(s,c){const f=[];for(let p=0;p<s.length;p++)f.push(s[p]),p<s.length-1&&(Er(c)?f.push(c()):f.push(c));return f}function n2(s,c){if(s!==c)throw Error(`Expected [${s}] to equal [${c}]`);return[s,c]}function i2(s){if(s!==!0)throw Error(`Expected [true], got: [${s}]`);return s}function s2(s){if(!s)throw Error(`Expected truthy value, got: [${s}]`);return s}function o2(s){if(s!==!1)throw Error(`Expected [false], got: [${s}]`);return s}function a2(s){if(s)throw Error(`Expected falsy value, got: [${s}]`);return s}function c2(s,c){if(!c.includes(s))throw Error(`Expected any of [${c.join(", ")}], got: [${s}]`);return s}function u2(s,c){for(let f=0;f<s.length;f++){const p=s[f],b=c[f],v=Math.max(0,b.getTime()-Date.now());setTimeout(p,v)}}function l2(s,c,f){return s+(c-s)*f}function f2(s){return s.reduce((c,f)=>c+f,0)}function h2(s){return s.reduce((c,f)=>c+f,0)/s.length}function d2(s){const c=[...s].sort((p,b)=>p-b),f=Math.floor(c.length/2);return c.length%2===0?(c[f]+c[f-1])/2:c[f]}function p2(s,c){return s-(c-1)/2}function y0(s,c){const f=[];for(let p=s;p<=c;p++)f.push(p);return f}function m2(s,c){return c.some(f=>s.includes(f))}function g2(s){return/^[\u4E00-\u9FA5]+$/.test(s)}function dc(s,c=()=>!1){return s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").split("").map(f=>/[a-z0-9]/.test(f)||c(f)?f:"-").join("").replace(/-+/g,"-").replace(/^-|-$/g,"")}function y2(s){return dc(s).replaceAll("-","")}function b2(s){return Bo(s.replace(/([A-Z])/g," $1"))}function x2(s){return s.split("-").map(Bo).join(" ")}function w2(s){return A0(s.split("-").map(Bo).join(""))}function A2(s,c=", ",f=" and "){return!s||!s.length?"":s.length===1?s[0]:s.length===2?`${s[0]}${f}${s[1]}`:`${s.slice(0,s.length-1).join(c)}${f}${s[s.length-1]}`}function E2(s,c){return c+s.split("").join(c)+c}function v2(s){return dc(s).replace(/-/g,"_").toUpperCase()}function Ro(s,c){if(c.length===0)return 0;const f=s.toLowerCase(),p=c.toLowerCase();return s===c?1e4:f.startsWith(p)?1e4-s.length:f.includes(p)?5e3-s.length:new RegExp(".*"+p.split("").join(".*")+".*").test(f)?1e3-s.length:0}function R2(s,c){return s.filter(f=>Ro(f,c)).sort((f,p)=>Ro(p,c)-Ro(f,c))}function T2(s){return s.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const B2={"&amp;":"&","&quot;":'"',"&apos;":"'","&gt;":">","&lt;":"<"};function S2(s){let c=s.replace(/&#(\d+);/g,(f,p)=>String.fromCharCode(p)).replace(/&#x(\d+);/g,(f,p)=>String.fromCharCode(parseInt(p,16)));for(const[f,p]of Object.entries(B2))c=c.replaceAll(f,p);return c}function pc(s,c){const f=s.indexOf(c);return f===-1?null:s.slice(0,f)}function To(s,c){const f=s.indexOf(c);return f===-1?null:s.slice(f+c.length)}function mc(s,c){const f=s.lastIndexOf(c);return f===-1?null:s.slice(0,f)}function b0(s,c){const f=s.lastIndexOf(c);return f===-1?null:s.slice(f+c.length)}function P2(s,c,f){const p=mc(s,f);return p?To(p,c):null}function O2(s,c,f){const p=To(s,c);return p?pc(p,f):null}function gc(s,c,f=!1){const p=f?s.lastIndexOf(c):s.indexOf(c);return p===-1?f?[null,s]:[s,null]:[s.slice(0,p),s.slice(p+c.length)]}function x0(s,c){let f=[s];for(const p of c)f=f.flatMap(b=>b.split(p));return f.filter(p=>p)}function yc(s){const c=ge(s.split(/\\|\//g)),f=c.lastIndexOf(".",c.length-1);return f<=0?"":c.slice(f+1)}function bc(s){const c=ge(s.split(/\\|\//g)),f=c.lastIndexOf(".",c.length-1);return f<=0?c:c.slice(0,f)}function I2(s){let[c,f]=s.split("@");c=fs(c.replaceAll(".","").toLowerCase()).replaceAll(" ","");const[p]=c.split("+");if(!p||!f||f.indexOf(".")===-1||f.indexOf(".")===f.length-1)throw new Error("Invalid email");return f=fs(f.toLowerCase()).replaceAll(" ",""),`${p}@${f}`}function k2(s){const c=bc(s),f=yc(s);return f?`${c}.${f}`:c}function N2(s){const c=bc(s),f=yc(s);return{basename:c,extension:f,filename:f?`${c}.${f}`:c}}function C2(s,c=Math.random){return s.replace(/\{(.+?)\}/g,(f,p)=>H(p.split("|"),c))}function w0(s){const c=/\{(.+?)\}/,f=s.match(c);if(!f||!f.index)return[s];const p=f[1].split(","),b=s.slice(0,f.index),v=s.slice(f.index+f[0].length);let V=[];for(const te of p){const Y=w0(b+te+v);V=V.concat(Y)}return V}function fs(s){return s.split(`
3
+ `).map(c=>c.trim().replace(/\s+/g," ")).filter(c=>c.length>0).join(`
4
+ `)}function Bo(s){return s.charAt(0).toUpperCase()+s.slice(1)}function A0(s){return s.charAt(0).toLowerCase()+s.slice(1)}function E0(s){if(!s)return!1;const c=s.charCodeAt(0);return c>=65&&c<=90||c>=97&&c<=122}function v0(s){if(!s)return!1;const c=s.charCodeAt(0);return c>=48&&c<=57}function hs(s){return E0(s)||v0(s)}const _2=`
5
+ \r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");function F2(s){return _2.includes(s)}function D2(s){return hs(s)||s==="."||s==="["||s==="]"||s==="_"}function L2(s,c,f,p,b){return s.slice(0,c)+p+s.slice(c,c+f)+b+s.slice(c+f)}function R0(s,c,f=0){const p=c.exec(s.slice(f));return p?{index:p.index,match:p[0]}:null}function T0(s,c,f=!0){if(!f)return c.every(b=>b instanceof RegExp?b.test(s):s.indexOf(b,0)!==-1);let p=0;for(const b of c)if(b instanceof RegExp){const v=R0(s,b,p);if(!v)return!1;p=v.index+v.match.length}else{const v=s.indexOf(b,p);if(v===-1)return!1;p=v+b.length}return!0}function U2(s,c,f=!0){let p=0;for(const b of c){let v=!1;for(;!v&&p<s.length;)T0(s[p],b,f)&&(v=!0),p++;if(!v)return!1}return!0}function M2(s){return s.match(/"|,/)?`"${s.replace(/"/g,'""')}"`:s}function B0(s,c,f=0){const p=[];let b=s.indexOf(c,f);for(;b!==-1;)p.push(b),b=s.indexOf(c,b+c.length);return p}function hi(s,c,f=0){let p=-1;for(const b of c){const v=s.indexOf(b,f);v!==-1&&(p===-1||v<p)&&(p=v)}return p}function z2(s,c=0){for(let f=c;f<s.length;f++)if(F2(s[f]))return f;return-1}function $2(s,c=0){for(let f=c;f<s.length;f++)if(s[f]==="#"&&hs(s[f+1]))return f;return-1}function S0(s,c,f=0){return s.slice(0,f).lastIndexOf(c)}function P0(s,c=0,f="{",p="}"){let b=1;for(let v=c;v<s.length;v++)if(s.slice(v,v+p.length)===p){if(--b===0)return v}else s.slice(v,v+f.length)===f&&b++;return-1}function O0(s,c){const f=c.wordBoundary?hi(s,[`${c.opening} `,`${c.opening}
6
+ `],c.start||0):s.indexOf(c.opening,c.start||0);if(f===-1)return null;const p=P0(s,f+c.opening.length,c.opening,c.closing);return p===-1?null:c.exclusive?s.slice(f+c.opening.length,p):s.slice(f,p+c.closing.length)}function V2(s,c){const f=[];let p=c.wordBoundary?hi(s,[`${c.opening} `,`${c.opening}
7
+ `],c.start||0):s.indexOf(c.opening,c.start||0);for(;;){if(p===-1)return f;const b=O0(s,{...c,start:p});if(!b)return f;f.push(b),p=c.wordBoundary?hi(s,[`${c.opening} `,`${c.opening}
8
+ `],p+b.length):s.indexOf(c.opening,p+b.length)}}function G2(s,c,f){let p=0;for(;;){const b=t.Strings.extractBlock(s,{...f,start:p});if(!b)return s;const v=c(b);p=s.indexOf(b,p)+v.length,s=s.replace(b,v)}}function j2(s,c){const f=[];let p=0;for(;p<s.length;){const b=s.indexOf(c,p);if(b===-1){f.push({string:s.slice(p),symbol:null});break}const v=s.indexOf(c,b+c.length);if(b>p&&v!==-1&&f.push({string:s.slice(p,b),symbol:null}),v===-1){f.push({string:s.slice(p),symbol:null});break}f.push({string:s.slice(b+c.length,v),symbol:c}),p=v+c.length}return f}function H2(s){const c=[];let f=0;for(;f<s.length;){const p=$2(s,f);if(p===-1){c.push({string:s.slice(f),symbol:null});break}const b=z2(s,p+1);if(b===-1){c.push({string:s.slice(f,p),symbol:null}),c.push({string:s.slice(p+1),symbol:"#"});break}p>f&&c.push({string:s.slice(f,p),symbol:null}),c.push({string:s.slice(p+1,b),symbol:"#"}),f=b}return c}function q2(s){const c=[];let f=0;for(;f<s.length;){const p=hi(s,["http://","https://"],f);if(p===-1){c.push({string:s.slice(f),symbol:null});break}const b=hi(s,[" ",`
9
+ `],p);if(b===-1){p>f&&c.push({string:s.slice(f,p),symbol:null}),c.push({string:s.slice(p),symbol:"http"});break}p>f&&c.push({string:s.slice(f,p),symbol:null}),c.push({string:s.slice(p,b),symbol:"http"}),f=b}return c}const I0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k0="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Z2(s){return N0(s,I0)}function K2(s){return C0(s,I0)}function J2(s){return N0(s,k0)}function W2(s){return C0(s,k0)}function N0(s,c){const p=c.length;let b=0,v=0;const V=[];for(let te=0;te<s.length;te++){const Y=s[te];if(Y==="=")break;const we=c.indexOf(Y);if(we===-1)throw new Error(`Invalid character: ${Y}`);v=v<<Math.log2(p)|we,b+=Math.log2(p),b>=8&&(b-=8,V.push(v>>b&255))}return new Uint8Array(V)}function C0(s,c){const f=c.length;let p=0,b=0,v="";for(let V=0;V<s.length;V++)for(b=b<<8|s[V],p+=8;p>=Math.log2(f);)p-=Math.log2(f),v+=c[b>>p&f-1];return p>0&&(v+=c[b<<Math.log2(f)-p&f-1]),v.length%4!==0&&(v+="=".repeat(4-v.length%4)),v}function Q2(s){(s.startsWith("0x")||s.startsWith("0X"))&&(s=s.slice(2));const c=s.length/2,f=new Uint8Array(c);for(let p=0;p<c;p++){const b=parseInt(s.slice(p*2,p*2+2),16);f[p]=b}return f}function Y2(s){return Array.from(s).map(c=>c.toString(16).padStart(2,"0")).join("")}function X2(s){return Array.from(s).map(c=>c.toString(2).padStart(8,"0")).join("")}function eA(s){const c=Math.ceil(s.length/8),f=new Uint8Array(c);for(let p=0;p<c;p++){const b=parseInt(s.slice(p*8,p*8+8),2);f[p]=b}return f}function tA(s,c){const f=s.split("/").filter(v=>v),p=c.split("/").filter(v=>v);if(f.length!==p.length)return null;const b={};for(let v=0;v<f.length;v++){const V=f[v];if(V.startsWith(":"))b[V.slice(1)]=p[v];else if(V!==p[v])return null}return b}function xc(s,c,f){const p=[];for(const b of f)b!==c&&p.push(s.replace(c,b));return p}function rA(s,c,f,p=Math.random){const b=t.Arrays.shuffle(c.map(V=>({variants:t.Arrays.shuffle(V.variants.map(te=>te),p),avoid:V.avoid})),p),v=[];for(const V of b){const te=V.variants.filter(we=>we!==V.avoid),Y=te.find(we=>s.includes(we));if(Y&&(vo(v,xc(s,Y,te)),v.length>=f))break}if(v.length<f)for(const V of b){const te=V.variants.find(Y=>s.includes(Y));if(te&&(vo(v,xc(s,te,V.variants)),v.length>=f))break}return v.slice(0,f)}function nA(s,c,f,p=!1){const b=new RegExp(p?`(?<=\\s|^)${c}(?=\\s|$)`:`\\b${c}\\b`,"g");return s.replace(b,f)}function iA(s,c){const f=/\b[A-Z][a-zA-Z0-9]*\b/g;return s.replace(f,p=>p.toUpperCase()===p?p:c(p))}function sA(s){return s.replace(/<[^>]*>/g,"")}function _0(s){const c=s.lastIndexOf(" ");if(c===-1)return{line:s,rest:""};const f=s.slice(0,c),p=s.slice(c+1);return{line:f,rest:p}}function oA(s,c={}){return[...s].reduce((f,p)=>f+(c[p]||1),0)}function aA(s,c,f={}){const p=[];let b="",v=0;for(let V=0;V<s.length;V++){const te=s[V],Y=f[te]||1;if(b+=te,v+=Y,v>c){const{line:we,rest:Rt}=_0(b);p.push(we),b=Rt,v=Rt.split("").map(Ht=>f[Ht]||1).reduce((Ht,gi)=>Ht+gi,0)}}return b&&p.push(b),p}function cA(s,c){const f=[];for(let p=0;p<=s.length;p++)f[p]=[p];for(let p=0;p<=c.length;p++)f[0][p]=p;for(let p=1;p<=s.length;p++)for(let b=1;b<=c.length;b++){const v=s[p-1]===c[b-1]?0:1;f[p][b]=Math.min(f[p-1][b]+1,f[p][b-1]+1,f[p-1][b-1]+v)}return f[s.length][c.length]}function F0(s){const c=s.reduce((p,b)=>p.length<b.length?p:b);let f="";for(let p=0;p<c.length;p++){const b=c[p];if(s.every(v=>v[p]===b))f+=b;else break}return f}function uA(s){const c=F0(s),f=c.lastIndexOf("/");return f===-1?"":c.slice(0,f+1)}function wc(s,c){return new RegExp(`\\b${c}\\b`).test(s)}function lA(s,c,f){return f==="any"?c.some(p=>wc(s,p)):c.every(p=>wc(s,p))}function fA(s){const c={},f=s.match(/([a-z\-]+)="([^"]+)"/g);if(f)for(const p of f){const[b,v]=gc(p,"=");c[b]=v.slice(1,v.length-1)}return c}function ds(s,c,f=[]){let p="";for(;c<s.length&&(hs(s[c])||f.includes(s[c]));)p+=s[c++];return p}function hA(s,c,f=[]){const p=B0(s,c),b=[];for(const v of p)b.push(ds(s,v+c.length,f));return b}function dA(s,c,f="$",p=":"){for(const b in c)s=D0(s,b,c[b],f,p);return s=L0(s),s}function D0(s,c,f,p="$",b=":"){if(f==="")return s;let v=s.indexOf(`${p}${c}`);for(;v!==-1;){if(s[v+c.length+1]===b)if(s[v+c.length+2]===b)s=s.replace(`${p}${c}${b}${b}`,f);else{const V=ds(s,v+c.length+2,["_"]);s=s.replace(`${p}${c}${b}${V}`,f)}else s=s.replace(`${p}${c}`,f);v=s.indexOf(`${p}${c}`,v+f.length)}return s}function L0(s,c="$",f=":"){let p=s.indexOf(c);for(;p!==-1;){const b=ds(s,p+1);if(s[p+b.length+1]===f)if(s[p+b.length+2]===f)s=s.replace(`${c}${b}${f}${f}`,"");else{const v=ds(s,p+b.length+2);s=s.replace(`${c}${b}${f}${v}`,v)}p=s.indexOf(c,p+1)}return s}function pA(s,c){let f=s.indexOf("](");for(;f!==-1;){const p=S0(s,"[",f),b=s.indexOf(")",f);if(p!==-1&&b!==-1){const[v,V]=s.slice(p+1,b).split("]("),te=c(v,V);s=s.slice(0,p)+te+s.slice(b+1)}f=s.indexOf("](",f+1)}return s}function U0(s,c=!0){const f=Object.entries(s).filter(([p,b])=>b!=null).map(([p,b])=>`${p}=${encodeURIComponent(b)}`).join("&");return f?(c?"?":"")+f:""}function mA(s){const c={},f=s.split("&");for(const p of f){const[b,v]=p.split("=");b&&v&&(c[b]=decodeURIComponent(v))}return c}function gA(s,c){return Object.prototype.hasOwnProperty.call(s,c)}function yA(s,c){let f=null,p=-1/0;for(const[b,v]of Object.entries(s)){const V=c(v);V>p&&(p=V,f=b)}return f?[f,s[f]]:null}function bA(s,c,f,p){const b=s.find(V=>V[c]===f),v=s.find(V=>V[c]===f+p);b&&v?(b[c]=f+p,v[c]=f):b&&(b[c]=f+p),s.sort((V,te)=>Je(V[c])-Je(te[c])),s.forEach((V,te)=>V[c]=te+1)}function xA(s){const c=Object.keys(s);if(c.length===1)return s[c[0]];throw new Error("Expected object to have a single key")}function wA(s,c=":"){return Object.fromEntries(s.map(f=>gc(f,c)).map(f=>f[0]&&f[1]?[fs(f[0]),fs(f[1])]:null).filter(f=>f))}function AA(s,c){if(!s)return!1;const f=s.message;return typeof f=="string"&&f.includes(c)}function EA(s,c,f){return V0([s,c])+U0(f||{})}function vA(s,c=",",f='"'){const p=[];let b="",v=!1;const V=s.split("");for(const te of V)te===c&&!v?(p.push(b),b=""):te===f&&(!b&&!v||v)?v=!v:b+=te;return p.push(b),p}function RA(s){return`[${Math.floor(s.progress*100)}%] ${So(s.deltaMs)} out of ${So(s.totalTimeMs)} (${So(s.remainingTimeMs)} left) [${Math.round(s.baseTimeMs)} ms each]`}async function TA(s,c){let f=c.requiredConsecutivePasses||1,p=0;for(let b=0;b<c.attempts;b++){try{if(await s()){if(p++,p>=f)return}else p=0}catch{p=0}b<c.attempts-1&&await o(c.waitMillis)}throw Error("Timed out waiting for predicate")}function BA(s,c){const f=[];for(let p=s.length-1;p>=0;p--)c(s[p])&&f.push(s.splice(p,1)[0]);return f}function SA(s){return JSON.parse(JSON.stringify(s))}function PA(s){return Math.ceil((s||Date.now())/1e3)}function OA(s){return(s||new Date).toISOString().slice(0,10)}function IA(s){return(s||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")}function kA(s){const c=new Date(s);return new Date(c.getTime()-c.getTimezoneOffset()*6e4)}function NA(s){return new Date(s)}function Cr(s){return String(Math.floor(s)).padStart(2,"0")}function CA(s){let[c,f]=s.split(":");Bt(parseInt(c,10))||(c="0"),Bt(parseInt(f,10))||(f="0");let p=Rc(Ze(c),0,23),b=Rc(Ze(f),0,59);return`${Cr(p)}:${Cr(b)}`}function So(s){const c=Math.floor(s/36e5);s=s%36e5;const f=Math.floor(s/6e4);s=s%6e4;const p=Math.floor(s/1e3);return c?`${Cr(c)}:${Cr(f)}:${Cr(p)}`:`${Cr(f)}:${Cr(p)}`}function Dn(s){return Math.floor((rr(s)?s.getTime():s)/864e5)}const _A={today:(s,c)=>Cr(s)+":"+Cr(c),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:s=>`${s}w`};function FA(s,c){const f=new Date(c?.now||Date.now()),p=c?.labels||_A,b=rr(s)?s:new Date(s);if(Dn(f)===Dn(b))return p.today(b.getUTCHours(),b.getUTCMinutes(),b.getUTCHours()>12);if(Dn(f)-Dn(b)===1)return p.yesterday();const v=Ec(b);return Dn(f)-Dn(b)<7?p[v.day]():p.weeks(Math.round((f.getTime()-b.getTime())/6048e5))}const M0={now:()=>"A few seconds",seconds:s=>`${s} seconds`,minutes:s=>`${s} minutes`,hours:s=>`${s} hours`,days:s=>`${s} days`,weeks:s=>`${s} weeks`};function z0(s,c){const f=c?.now??Date.now(),p=c?.labels||M0,b=t.Types.isDate(s)?s.getTime():s;let v=(f-b)/1e3;return v<10?p.now():v<120?p.seconds(Math.floor(v)):(v/=60,v<120?p.minutes(Math.floor(v)):(v/=60,v<48?p.hours(Math.floor(v)):(v/=24,v<14?p.days(Math.floor(v)):(v/=7,p.weeks(Math.floor(v))))))}function DA(s,c=M0){return z0(0,{now:s*1e3,labels:c})}function LA(s,c,f){const p=(f?.now??Date.now())-s,b=Math.floor(p/c),v=c/(f?.precision??1)-Math.ceil(p%c/(f?.precision??1));return{cycles:b,remaining:v}}const Ac={};function UA(s,c){return!Ac[s]||Date.now()>Ac[s]?(Ac[s]=Date.now()+c,!0):!1}const MA={s:1e3,m:6e4,h:36e5,d:864e5};function zA(s,c,f){return c=rr(c)?c.getTime():c,f=f?rr(f)?f.getTime():f:Date.now(),(f-c)/MA[s]}function $A(s,c,f,p){p||(p=Date.now());const b=c/f,v=p-s,V=v/c,te=V*f,Y=te-v;return{deltaMs:v,progress:b,baseTimeMs:V,totalTimeMs:te,remainingTimeMs:Y}}const VA={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function $0(s){return{zeroBasedIndex:s,day:VA[s]}}function Ec(s){return $0(s.getDay())}function GA(s){return Ec(new Date(s))}function jA(s){return s*1e3}function HA(s){return s*6e4}function qA(s){return s*36e5}function ZA(s){return s*864e5}const KA={ms:1,milli:1,millis:1,millisecond:1,milliseconds:1,s:1e3,sec:1e3,second:1e3,seconds:1e3,m:6e4,min:6e4,minute:6e4,minutes:6e4,h:36e5,hour:36e5,hours:36e5,d:864e5,day:864e5,days:864e5,w:6048e5,week:6048e5,weeks:6048e5,month:2592e6,months:2592e6,y:31536e6,year:31536e6,years:31536e6};function JA(s){const c=parseFloat(s);if(isNaN(c))throw Error("makeDate got NaN for input");const f=s.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),p=f===""?1:KA[f];if(!p)throw Error(`Unknown unit: "${f}"`);return Math.ceil(c*p)}const WA={b:0,byte:0,bytes:0,kb:1,kilobyte:1,kilobytes:1,mb:2,megabyte:2,megabytes:2,gb:3,gigabyte:3,gigabytes:3,tb:4,terabyte:4,terabytes:4};function QA(s,c=1024){const f=parseFloat(s);if(isNaN(f))throw Error("makeStorage got NaN for input");const p=s.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),b=p===""?0:WA[p];if(b==null)throw Error(`Unknown unit: "${p}"`);return Math.ceil(f*c**b)}function YA(s){return s.replace(/ +/g," ").replace(/^ /gm,"")}const _r=new Map;async function XA(s,c,f,p){const b=Date.now(),v=_r.get(s);if(v&&v.validUntil>b)return v.value;p?.onMiss?.();try{const V=await f();return _r.set(s,{value:V,validUntil:b+c}),V}catch(V){throw p?.onFailure?.(V),V}}function e3(s,c,f,p){const b=Date.now(),v=_r.get(s);if(v&&v.validUntil>b)return v.value;p?.onMiss?.();const V=f();return _r.set(s,{value:V,validUntil:b+c}),V.catch(te=>{_r.delete(s),p?.onFailure?.(te)}),V}function t3(s){_r.delete(s)}function r3(){_r.clear()}function n3(){const s=Date.now();for(const[c,f]of _r.entries())f.validUntil<=s&&_r.delete(c)}function i3(){return _r.size}function V0(s,c=!1){s=s.filter(v=>v),c&&at(s[1])&&(s[1]="../"+s[1]);let f="";at(s[0])&&s[0].includes("://")&&(f=pc(s[0],"://")??"",s[0]=To(s[0],"://")??"");const p=s.map(v=>String(v)).flatMap(v=>v.split("/")),b=[];for(let v=0;v<p.length;v++)p[v]!=="."&&(p[v]===".."?(!f||b.length>1)&&b.pop():b.push(p[v]));return(f?f+"://":"")+b.join("/").replaceAll(/\/{2,}/g,"/")}function s3(s,c,f,p,b=!0){const v=s.indexOf(c),V=s.indexOf(f,v+c.length);if(v===-1||V===-1)throw Error("Start or end not found");return b?s.substring(0,v+c.length)+p+s.substring(V):s.substring(0,v)+p+s.substring(V+f.length)}function o3(s){let c="p";s.startsWith("#")?(c="h1",s=s.slice(1).trim()):s.startsWith("-")&&(c="li",s=s.slice(1).trim());const f=s[0]===s[0].toUpperCase(),p=/[.?!]$/.test(s),b=/:$/.test(s);return{type:c,isCapitalized:f,hasPunctuation:p,endsWithColon:b}}function a3(s,c="(",f=")"){let p=0,b=0;for(;b<s.length;)if(s.startsWith(c,b)?(p++,b+=c.length):s.startsWith(f,b)?(p--,b+=f.length):b++,p<0)return!1;return c===f?p%2===0:p===0}function c3(s){s=s.normalize("NFD").replace(/[\u0300-\u036f]/g,"");let c=s.length;for(;s=s.replace(/(\w+)[\s,']+\w+/g,"$1"),s.length!==c;)c=s.length;return s=s.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A"),s=s.replaceAll(/[a-z][a-zA-Z0-9]*/g,"a"),s=s.replaceAll(/[\u4E00-\u9FA5]+/g,"Z"),s}function G0(s){const c=Object.keys(s).sort((p,b)=>p.localeCompare(b)),f={};for(const p of c)f[p]=Ln(s[p]);return f}function j0(s){const c=[];return s.sort((f,p)=>JSON.stringify(Ln(f)).localeCompare(JSON.stringify(Ln(p)))).forEach(f=>c.push(Ln(f))),c}function Ln(s){return Array.isArray(s)?j0(s):xt(s)?G0(s):s}function H0(s,c){return JSON.stringify(Ln(s))===JSON.stringify(Ln(c))}function u3(...s){for(let c=1;c<s.length;c++)if(!H0(s[c-1],s[c]))return!1;return!0}function l3(s){try{return JSON.parse(s)}catch{return null}}function f3(){let s=0;return{next:()=>s++}}function h3(s){let c=0;return{next:()=>s[c++%s.length]}}function d3(s){let c;return f=>{const p=f===s&&c!==s;return c=f,p}}function p3(s,c,f,p,b){const v={};for(const V of Object.keys(c))v[V]=[];v[p]=[],b&&(s=s.sort(b));for(const V of s){const te=V[f],Y=c[te]?te:p;v[Y].length>=c[Y]?v[p].push(V):v[Y].push(V)}return v}function m3(s,c){const f=Object.keys(s),p=Object.keys(c);return{uniqueToA:f.filter(b=>!p.includes(b)),uniqueToB:p.filter(b=>!f.includes(b))}}function q0(s){const c=Object.keys(s);return c[Math.floor(Math.random()*c.length)]}function g3(s,c){const f=q0(s);return s[f]=c(s[f]),f}function y3(s){return s=s.replace(/\r\n/g,`
10
+ `),s=s.replace(/(\w+)\((.+)\)/g,(c,f,p)=>`${f}(${p.replaceAll(",","&comma;")})`),s=s.replace(/(,)(\s+})/g,"$2"),s=s.replace(/\.\.\..+?,/g,""),s=s.replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),s=s.replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),s=s.replace(/:(.+)\?(.+):/g,(c,f,p)=>`: (${f.trim()} && ${p.trim()}) ||`),s=s.replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2'),s=s.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,(c,f,p,b)=>`"${f}":"${p.trim()}"${b}`),s=s.replace(/("'|'")/g,'"'),s=s.replaceAll("&comma;",","),JSON.parse(s)}const fn=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],b3=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],Z0=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function x3(s,c,f){let p=s.length-c;if(p<=0)return"0."+"0".repeat(-p)+s+(f?" "+f:"");let b=s.substring(0,p),v=s.substring(p);return b===""&&(b="0"),b+"."+v+(f?" "+f:"")}function w3(s,c){const f=c?.longForm??!1,p=c?.unit?` ${c.unit}`:"",b=f?b3:Z0,v=c?.precision??1;if(s<fn[0])return`${s}${p}`;for(let V=0;V<fn.length-1;V++)if(s<fn[V+1])return`${(s/fn[V]).toFixed(v)}${f?" ":""}${b[V]}${p}`;return`${(s/fn[fn.length-1]).toFixed(v)}${f?" ":""}${b[fn.length-1]}${p}`}function vc(s){const c=parseFloat(s);if(isNaN(c))throw Error("makeNumber got NaN for input");const f=s.replace(/^-?[0-9.]+/,"").trim(),p=Z0.findIndex(b=>b.toLowerCase()===f.toLowerCase());return p===-1?c:c*fn[p]}function Rc(s,c,f){return s<c?c:s>f?f:s}function A3(s,c,f){const p=s+c;return p>f?f:p}function E3(s,c,f){const p=s-c;return p<f?f:p}function v3(s,c){return c(s),s}function R3(s,c){s&&c(s)}function T3(s,c){const f=Object.keys(c);for(const p of f)Array.isArray(c[p])&&Array.isArray(s[p])&&vo(s[p],c[p])}function B3(s){return s.splice(0,s.length),s}function S3(s){for(const c of Object.keys(s))(qe(s[c])||Array.isArray(s[c])&&s[c].every(f=>f==null))&&delete s[c];return s}function P3(s){for(const c of Object.entries(s))(c[1]===null||c[1]===void 0||at(c[1])&&un(c[1]))&&delete s[c[0]];return s}function O3(s,c){const f={};for(const[p,b]of Object.entries(s))c(p)&&(f[p]=b);return f}function I3(s,c){const f={};for(const[p,b]of Object.entries(s))c(b)&&(f[p]=b);return f}function k3(s,c){const f={};for(const p of Object.entries(s))f[p[0]]=c(p[1]);return f}function N3(s,c){const f=[];let p=0;for(const b of s)f.push(c(b,p++));return f}async function C3(s,c){try{return await s()}catch{throw c}}function _3(s,c,f){f!=null&&(s[c]=f)}function F3(s,c,f,p){const b=Ae(f,p);b!=null&&Ee(s,c,b)}function D3(s){const c={};for(const[f,p]of Object.entries(s))c[p]=f;return c}function L3(s){const c=Object.keys(s),f=c.map(te=>s[te].length),p=f.reduce((te,Y)=>te*=Y);let b=1;const v=[1];for(let te=0;te<f.length-1;te++)b*=f[te],v.push(b);const V=[];for(let te=0;te<p;te++){const Y={};for(let we=0;we<c.length;we++){const Rt=s[c[we]],Ht=Math.floor(te/v[we])%Rt.length;Y[c[we]]=Rt[Ht]}V.push(Y)}return V}function U3(s){return Object.values(s).filter(c=>c).length}function M3(s,c,f){return s+(f?"["+c+"]":(s.length?".":"")+c)}function Po(s,c,f,p,b){if(!xt(c))return c;for(const[v,V]of Object.entries(c)){const te=M3(f,v,p);Array.isArray(V)?b?Po(s,V,te,!0,b):s[te]=V.map(Y=>Po(Array.isArray(Y)?[]:{},Y,"",!1,b)):xt(V)?Po(s,V,te,!1,b):s[te]=V}return s}function z3(s,c=!1,f){return Po({},s,f||"",!1,c)}function K0(s){if(!xt(s))return s;const c=Array.isArray(s)?[]:{};for(const[f,p]of Object.entries(s))Array.isArray(p)?Ee(c,f,p.map(b=>K0(b))):Ee(c,f,p);return c}function $3(s,c,f){return c[s]?c[s]:f}function J0(s,c){const f={};for(const p of s){const b=c(p);f[b]=p}return f}function V3(s,c){const f={};for(const p of s){const b=c(p);f[b]||(f[b]=[]),f[b].push(p)}return f}function G3(s,c){const f=[];for(let p=0;p<s.length;p+=c)f.push(s.slice(p,p+c));return f}function W0(s,c){const f=Math.ceil(s.length/c),p=[];for(let b=0;b<s.length;b+=f)p.push(s.slice(b,b+f));return p}function Q0(s,c){const f=[],p=Math.ceil(s.length/c);for(let b=0;b<p;b++)f.push(s.slice(b*c,b*c+c));return f}function j3(s,c){const f=Math.ceil(s.length/c);return Q0(s,f)}function H3(s,c){return Object.values(J0(s,c))}function q3(s,c,f,p,b){const v=c?s.map(c):s,V={};for(const Y of v)V[Y]=(V[Y]||0)+1;const te=p?Y0(V,b?(Y,we)=>Y[1]-we[1]:(Y,we)=>we[1]-Y[1]):V;return f?Object.keys(te):te}function Y0(s,c){return Object.fromEntries(Object.entries(s).sort(c))}function Z3(s){const c=[],f=Object.keys(s),p=s[f[0]].length;for(let b=0;b<p;b++){const v={};for(const V of f)v[V]=s[V][b];c.push(v)}return c}function K3(s,c,f=1){for(const p of s)p[c]+=f}function J3(s,c,f){for(const p of s)p[c]=f}function Tc(s,c){const f=[];let p=[];return s.forEach((b,v)=>{(v===0||!c(b,s[v-1]))&&(p=[],f.push(p)),p.push(b)}),f}function W3(){return{map:new Map,keys:[]}}function Q3(){return{map:new Map,keys:[]}}function X0(s,c,f,p=100){if(s.map.has(c)){const b=s.keys.indexOf(c);s.keys.splice(b,1)}if(s.map.set(c,f),s.keys.push(c),s.keys.length>p){const b=s.keys.shift();b&&s.map.delete(b)}}function Y3(s,c,f,p=100){if(s.map.has(c)){const b=s.keys.indexOf(c);s.keys.splice(b,1)}if(s.map.set(c,f),s.keys.unshift(c),s.keys.length>p){const b=s.keys.shift();b&&s.map.delete(b)}}function X3(s,c,f,p,b=100){X0(s,c,{validUntil:Date.now()+p,data:f},b)}function e8(s,c){const f=s.map.get(c);return f&&f.validUntil>Date.now()?f.data:null}class hn{constructor(c){this.value=c}static of(c){return new hn(c)}static empty(){return new hn(null)}map(c){return new hn(this.value!==null&&this.value!==void 0?c(this.value):null)}mapAsync(c){return this.value!==null&&this.value!==void 0?c(this.value).then(f=>hn.of(f)):Promise.resolve(hn.empty())}ifPresent(c){return this.value!==null&&this.value!==void 0&&c(this.value),this}ifPresentAsync(c){return this.value!==null&&this.value!==void 0?c(this.value).then(()=>this):Promise.resolve(this)}ifAbsent(c){return(this.value===null||this.value===void 0)&&c(),this}ifAbsentAsync(c){return this.value===null||this.value===void 0?c().then(()=>this):Promise.resolve(this)}getOrFallback(c){return this.value??c()}getOrFallbackAsync(c){return this.value!==null&&this.value!==void 0?Promise.resolve(this.value):c()}getOrThrow(){if(this.value===null||this.value===void 0)throw Error("Optional.value is empty");return this.value}}t.Optional=hn;class t8{constructor(c){this.supplier=c,this.value=null}get(){return this.value||(this.value=this.supplier()),this.value}}t.Lazy=t8;class r8{constructor(c){this.supplier=c,this.value=null}async get(){return this.value||(this.value=await this.supplier()),this.value}}t.AsyncLazy=r8;function n8(s){return()=>s.forEach(c=>c())}function i8(s,c){return s.reduce((f,p)=>c(f)>c(p)?f:p)}function s8(s,c){return s.reduce((f,p)=>c(f)<c(p)?f:p)}function o8(s,c){const f=[];return s.forEach((p,b)=>{c(p)&&f.push(b)}),f}function a8(s,c){const f=s.find(p=>p instanceof c);return hn.of(f)}function c8(s,c){return s.filter(f=>f instanceof c)}function u8(s,c){const f=[],p=Math.max(s.length,c.length);for(let b=0;b<p;b++)s[b]&&f.push(s[b]),c[b]&&f.push(c[b]);return f}function l8(s,c){return s.includes(c)?s.filter(f=>f!==c):[...s,c]}class f8{constructor(c){this.value=c,this.children=[]}}function h8(s,c,f,p,b=!1){const v=new Map,V=[];s.forEach(Y=>{const we=new f8(Y);v.set(Y[c],we)}),s.forEach(Y=>{const we=v.get(Y[c]);if(!we)return;const Rt=Y[f];if(Rt){const Ht=v.get(Rt);Ht&&Ht.children.push(we)}else V.push(we)});const te=Y=>{Y.children.sort((we,Rt)=>{const Ht=we.value[p],gi=Rt.value[p];return b?gi-Ht:Ht-gi}),Y.children.forEach(te)};return V.forEach(te),V}function ed(s,c){if(Math.log2(s.length)%1!==0)throw new Error("Array length must be a power of 2");let f=[...s];for(;f.length>1;){const p=[];for(let b=0;b<f.length;b+=2){const v=f[b+1];p.push(c(f[b],v))}f=p}return f[0]}function di(...s){const c=s.reduce((b,v)=>b+v.length,0),f=new Uint8Array(c);let p=0;return s.forEach(b=>{f.set(b,p),p+=b.length}),f}function td(s){return s[0]===137&&s[1]===80&&s[2]===78&&s[3]===71}function rd(s){return s[0]===255&&s[1]===216}function nd(s){return s[8]===87&&s[9]===69&&s[10]===66&&s[11]===80}function d8(s){return td(s)||rd(s)||nd(s)}function p8(s){return new Uint8Array([s])}function m8(s){return s[0]}function g8(s,c){const f=new ArrayBuffer(2);return new DataView(f).setUint16(0,s,c==="LE"),new Uint8Array(f)}function y8(s,c){return new DataView(s.buffer).getUint16(s.byteOffset,c==="LE")}function b8(s,c){const f=new ArrayBuffer(4);return new DataView(f).setUint32(0,s,c==="LE"),new Uint8Array(f)}function x8(s,c){return new DataView(s.buffer).getUint32(s.byteOffset,c==="LE")}function Bc(s,c){const f=new ArrayBuffer(8);return new DataView(f).setBigUint64(0,BigInt(s),c==="LE"),new Uint8Array(f)}function w8(s,c){return new DataView(s.buffer).getBigUint64(s.byteOffset,c==="LE")}function pi(s,c){const f=new Uint8Array(32);let p=s;if(c==="LE"){for(let b=0;b<32;b++)f[b]=Number(p&0xffn),p>>=8n;return f}for(let b=31;b>=0;b--)f[b]=Number(p&0xffn),p>>=8n;return f}function mi(s,c){let f=0n;if(c==="LE"){for(let p=31;p>=0;p--)f=f<<8n|BigInt(s[p]);return f}for(let p=0;p<32;p++)f=f<<8n|BigInt(s[p]);return f}function A8(s,c){const f=[];let p=0;for(const b of c)f.push(s.subarray(p,p+b)),p+=b;return f}function Sc(s,c){const f=[];for(let p=0;p<s.length;p+=c)f.push(s.subarray(p,p+c));return f}const id=[0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424];function E8(s){for(let c=0;c<24;c++){const f=s[0]^s[10]^s[20]^s[30]^s[40],p=s[1]^s[11]^s[21]^s[31]^s[41],b=s[2]^s[12]^s[22]^s[32]^s[42],v=s[3]^s[13]^s[23]^s[33]^s[43],V=s[4]^s[14]^s[24]^s[34]^s[44],te=s[5]^s[15]^s[25]^s[35]^s[45],Y=s[6]^s[16]^s[26]^s[36]^s[46],we=s[7]^s[17]^s[27]^s[37]^s[47],Rt=s[8]^s[18]^s[28]^s[38]^s[48],Ht=s[9]^s[19]^s[29]^s[39]^s[49],gi=b<<1|v>>>31,c4=v<<1|b>>>31,gs=Rt^gi,ys=Ht^c4,u4=V<<1|te>>>31,l4=te<<1|V>>>31,bs=f^u4,xs=p^l4,f4=Y<<1|we>>>31,h4=we<<1|Y>>>31,ws=b^f4,As=v^h4,d4=Rt<<1|Ht>>>31,p4=Ht<<1|Rt>>>31,Es=V^d4,vs=te^p4,m4=f<<1|p>>>31,g4=p<<1|f>>>31,Rs=Y^m4,Ts=we^g4;s[0]^=gs,s[1]^=ys,s[2]^=bs,s[3]^=xs,s[4]^=ws,s[5]^=As,s[6]^=Es,s[7]^=vs,s[8]^=Rs,s[9]^=Ts,s[10]^=gs,s[11]^=ys,s[12]^=bs,s[13]^=xs,s[14]^=ws,s[15]^=As,s[16]^=Es,s[17]^=vs,s[18]^=Rs,s[19]^=Ts,s[20]^=gs,s[21]^=ys,s[22]^=bs,s[23]^=xs,s[24]^=ws,s[25]^=As,s[26]^=Es,s[27]^=vs,s[28]^=Rs,s[29]^=Ts,s[30]^=gs,s[31]^=ys,s[32]^=bs,s[33]^=xs,s[34]^=ws,s[35]^=As,s[36]^=Es,s[37]^=vs,s[38]^=Rs,s[39]^=Ts,s[40]^=gs,s[41]^=ys,s[42]^=bs,s[43]^=xs,s[44]^=ws,s[45]^=As,s[46]^=Es,s[47]^=vs,s[48]^=Rs,s[49]^=Ts;const _c=s[0],Fc=s[1],Dc=s[2]<<1|s[3]>>>31,Lc=s[3]<<1|s[2]>>>31,Uc=s[5]<<30|s[4]>>>2,Mc=s[4]<<30|s[5]>>>2,zc=s[6]<<28|s[7]>>>4,$c=s[7]<<28|s[6]>>>4,Vc=s[8]<<27|s[9]>>>5,Gc=s[9]<<27|s[8]>>>5,jc=s[11]<<4|s[10]>>>28,Hc=s[10]<<4|s[11]>>>28,qc=s[13]<<12|s[12]>>>20,Zc=s[12]<<12|s[13]>>>20,Kc=s[14]<<6|s[15]>>>26,Jc=s[15]<<6|s[14]>>>26,Wc=s[17]<<23|s[16]>>>9,Qc=s[16]<<23|s[17]>>>9,Yc=s[18]<<20|s[19]>>>12,Xc=s[19]<<20|s[18]>>>12,eu=s[20]<<3|s[21]>>>29,tu=s[21]<<3|s[20]>>>29,ru=s[22]<<10|s[23]>>>22,nu=s[23]<<10|s[22]>>>22,iu=s[25]<<11|s[24]>>>21,su=s[24]<<11|s[25]>>>21,ou=s[26]<<25|s[27]>>>7,au=s[27]<<25|s[26]>>>7,cu=s[29]<<7|s[28]>>>25,uu=s[28]<<7|s[29]>>>25,lu=s[31]<<9|s[30]>>>23,fu=s[30]<<9|s[31]>>>23,hu=s[33]<<13|s[32]>>>19,du=s[32]<<13|s[33]>>>19,pu=s[34]<<15|s[35]>>>17,mu=s[35]<<15|s[34]>>>17,gu=s[36]<<21|s[37]>>>11,yu=s[37]<<21|s[36]>>>11,bu=s[38]<<8|s[39]>>>24,xu=s[39]<<8|s[38]>>>24,wu=s[40]<<18|s[41]>>>14,Au=s[41]<<18|s[40]>>>14,Eu=s[42]<<2|s[43]>>>30,vu=s[43]<<2|s[42]>>>30,Ru=s[45]<<29|s[44]>>>3,Tu=s[44]<<29|s[45]>>>3,Bu=s[47]<<24|s[46]>>>8,Su=s[46]<<24|s[47]>>>8,Pu=s[48]<<14|s[49]>>>18,Ou=s[49]<<14|s[48]>>>18;s[0]=_c^~qc&iu,s[1]=Fc^~Zc&su,s[2]=qc^~iu&gu,s[3]=Zc^~su&yu,s[4]=iu^~gu&Pu,s[5]=su^~yu&Ou,s[6]=gu^~Pu&_c,s[7]=yu^~Ou&Fc,s[8]=Pu^~_c&qc,s[9]=Ou^~Fc&Zc,s[10]=zc^~Yc&eu,s[11]=$c^~Xc&tu,s[12]=Yc^~eu&hu,s[13]=Xc^~tu&du,s[14]=eu^~hu&Ru,s[15]=tu^~du&Tu,s[16]=hu^~Ru&zc,s[17]=du^~Tu&$c,s[18]=Ru^~zc&Yc,s[19]=Tu^~$c&Xc,s[20]=Dc^~Kc&ou,s[21]=Lc^~Jc&au,s[22]=Kc^~ou&bu,s[23]=Jc^~au&xu,s[24]=ou^~bu&wu,s[25]=au^~xu&Au,s[26]=bu^~wu&Dc,s[27]=xu^~Au&Lc,s[28]=wu^~Dc&Kc,s[29]=Au^~Lc&Jc,s[30]=Vc^~jc&ru,s[31]=Gc^~Hc&nu,s[32]=jc^~ru&pu,s[33]=Hc^~nu&mu,s[34]=ru^~pu&Bu,s[35]=nu^~mu&Su,s[36]=pu^~Bu&Vc,s[37]=mu^~Su&Gc,s[38]=Bu^~Vc&jc,s[39]=Su^~Gc&Hc,s[40]=Uc^~Wc&cu,s[41]=Mc^~Qc&uu,s[42]=Wc^~cu&lu,s[43]=Qc^~uu&fu,s[44]=cu^~lu&Eu,s[45]=uu^~fu&vu,s[46]=lu^~Eu&Uc,s[47]=fu^~vu&Mc,s[48]=Eu^~Uc&Wc,s[49]=vu^~Mc&Qc,s[0]^=id[c*2],s[1]^=id[c*2+1]}}function sd(s){const c=[];for(let f=0;f<s.length;f+=4)c.push(s[f]|s[f+1]<<8|s[f+2]<<16|s[f+3]<<24);return c}function od(s,c){if(!s.length){const b=new Uint8Array(136);return b[0]=c,b[135]=128,[sd(b)]}const f=Sc(s,136),p=f[f.length-1];if(p.length<136){const b=new Uint8Array(136);b.set(p),b[p.length]=c,b[135]|=128,f[f.length-1]=b}if(p.length===136){const b=new Uint8Array(136);b[0]=c,b[135]=128,f.push(b)}return f.map(sd)}function ad(s,c){for(const f of c){for(let p=0;p<34;p+=2)s[p]^=f[p+1],s[p+1]^=f[p];E8(s)}return s}function cd(s){return new Uint8Array([s[1],s[1]>>-24,s[1]>>-16,s[1]>>-8,s[0],s[0]>>8,s[0]>>16,s[0]>>24,s[3],s[3]>>-24,s[3]>>-16,s[3]>>-8,s[2],s[2]>>8,s[2]>>16,s[2]>>24,s[5],s[5]>>-24,s[5]>>-16,s[5]>>-8,s[4],s[4]>>8,s[4]>>16,s[4]>>24,s[7],s[7]>>-24,s[7]>>-16,s[7]>>-8,s[6],s[6]>>8,s[6]>>16,s[6]>>24])}function dn(s){return cd(ad(new Array(50).fill(0),od(s,1)))}function v8(s){return cd(ad(new Array(50).fill(0),od(s,6)))}function R8(s,c){const f=Math.min(s.length,c.length);for(let p=0;p<f;p++){const b=s[p]^c[p];for(let v=0;v<8;v++)if(b>>7-v&1)return p*8+v}return Math.min(s.length,c.length)*8}function T8(s,c){const f=Math.min(s.length,c.length);for(let p=0;p<f;p++)if(s[p]!==c[p])return s.subarray(0,p);return s.subarray(0,f)}function B8(s,c,f,p){const b=Math.floor(c/8),v=c%8;f===1?s[b]|=1<<(p==="BE"?7-v:v):s[b]&=~(1<<(p==="BE"?7-v:v))}function S8(s,c,f){const p=Math.floor(c/8),b=c%8;return s[p]>>(f==="BE"?7-b:b)&1}function P8(s,c,f=0){for(let p=f;p<s.length;p++)for(let b=0;b<c.length&&s[p+b]===c[b];b++)if(b===c.length-1)return p;return-1}function ud(s,c,f=0){if(s.length>=c)return s;const p=new Uint8Array(c);return p.fill(f),p.set(s,c-s.length),p}function O8(s,c,f=0){const p=s.length%c;return p===0?s:ud(s,s.length+c-p,f)}function ld(s,c,f=0){if(s.length>=c)return s;const p=new Uint8Array(c);return p.fill(f),p.set(s,0),p}function I8(s,c,f=0){const p=s.length%c;return p===0?s:ld(s,s.length+c-p,f)}function k8(s,c){const f=new Uint8Array(s.length);for(let p=0;p<s.length;p++)f[p]=s[p]^c[p%c.length];return f}function N8(s){for(let c=0;c<s.length;c++){const f=s[c];if(!(f<128))if((f&224)===192){if(c+1>=s.length||(s[c+1]&192)!==128)return!1;c+=1}else if((f&240)===224){if(c+2>=s.length||(s[c+1]&192)!==128||(s[c+2]&192)!==128)return!1;c+=2}else if((f&248)===240){if(c+3>=s.length||(s[c+1]&192)!==128||(s[c+2]&192)!==128||(s[c+3]&192)!==128)return!1;c+=3}else return!1}return!0}function C8(s,c){if(s.length!==c.length)return!1;for(let f=0;f<s.length;f++)if(s[f]!==c[f])return!1;return!0}function nt(s,c){return(s%c+c)%c}function ps(s,c){s=nt(s,c);let[f,p]=[0n,1n],[b,v]=[c,s];for(;v!==0n;){const V=b/v;[f,p]=[p,f-V*p],[b,v]=[v,b-V*v]}if(b>1n)throw new Error("a is not invertible");return f<0n&&(f+=c),f}function _8(s,c,f){let p=1n;for(s=nt(s,f);c>0;)c%2n===1n&&(p=nt(p*s,f)),s=nt(s*s,f),c=c/2n;return p}function fd(s,c){return nt(s,c)===0n?0n:c%4n===3n?_8(s,(c+1n)/4n,c):null}const Ut=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,St=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,Oo=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Io=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;function Pc(s,c,f){if(c===0n)return[0n,0n];const p=nt(3n*s*s*ps(2n*c,f),f),b=nt(p*p-2n*s,f),v=nt(p*(s-b)-c,f);return[b,v]}function ko(s,c,f,p,b){if(s===0n&&c===0n)return[f,p];if(f===0n&&p===0n)return[s,c];if(s===f&&c===nt(-p,b))return[0n,0n];if(s===f&&c===p)return Pc(s,c,b);const v=nt((p-c)*ps(f-s,b),b),V=nt(v*v-s-f,b),te=nt(v*(s-V)-c,b);return[V,te]}function F8(s){if(s<=0n||s>=St)throw new Error("Invalid private key");return Un(Oo,Io,s,Ut)}function D8(s){const c=s[1]%2n===0n?2:3;return new Uint8Array([c,...pi(s[0],"BE")])}function L8(s){if(s.length!==33||s[0]!==2&&s[0]!==3)throw new Error("Invalid compressed public key");const c=mi(s.slice(1),"BE"),f=fd(nt(c**3n+7n,Ut),Ut);if(!f)throw Error("Invalid x: does not correspond to a valid curve point");const p=nt(-f,Ut),b=f%2n===0n;return[c,s[0]===2?b?f:p:b?p:f]}function U8(s){const c=new Uint8Array(20),f=dn(di(pi(s[0],"BE"),pi(s[1],"BE")));return c.set(f.subarray(12)),c}function M8(s){const c=t.Binary.uint8ArrayToHex(s),f=t.Binary.uint8ArrayToHex(t.Binary.keccak256(new Uint8Array([...c].map(b=>b.charCodeAt(0)))));let p="0x";for(let b=0;b<c.length;b++)parseInt(f[b],16)>7?p+=c[b].toUpperCase():p+=c[b];return p}function Un(s,c,f,p){let b=[0n,0n],v=[s,c];const V=f.toString(2);for(const te of V)te==="0"?(v=ko(b[0],b[1],v[0],v[1],p),b=Pc(b[0],b[1],p)):(b=ko(b[0],b[1],v[0],v[1],p),v=Pc(v[0],v[1],p));return b}function z8(s,c,f){return hd(mi(dn(s),"BE"),c,f)}function hd(s,c,f){if(c<=0n||c>=St)throw new Error("Invalid private key");if(f||(f=nt(mi(dn(di(dn(pi(c,"BE")),pi(s,"BE"))),"BE"),St)),f<=0n||f>=St)throw new Error("Invalid nonce");const p=nt(s,St),b=Un(Oo,Io,f,Ut),v=nt(b[0],St);let V=nt((p+nt(v,St)*c)*ps(f,St),St);if(v===0n||V===0n)throw new Error("Invalid r or s value");let te=b[1]%2n===0n?27n:28n;return V>St/2n&&(V=St-V,te=te===27n?28n:27n),[v,V,te]}function $8(s,c,f,p){const b=fd(nt(c**3n+7n,Ut),Ut);if(!b)throw new Error("Invalid r: does not correspond to a valid curve point");const v=p===27n?0n:1n,V=b%2n===v?b:Ut-b,te=nt(mi(dn(s),"BE"),St),Y=Un(c,V,f,Ut),we=Un(Oo,Io,te,Ut),Rt=ko(Y[0],Y[1],we[0],nt(-we[1],Ut),Ut);return Un(Rt[0],Rt[1],ps(c,St),Ut)}function V8(s,c,f,p){const b=nt(mi(dn(s),"BE"),St),v=ps(p,St),V=nt(b*v,St),te=nt(f*v,St),Y=Un(Oo,Io,V,Ut),we=Un(c[0],c[1],te,Ut),Rt=ko(Y[0],Y[1],we[0],we[1],Ut);return f===nt(Rt[0],St)}class dd{constructor(c){this.cursor=0,this.buffer=c}read(c){const f=this.buffer.subarray(this.cursor,this.cursor+c);return this.cursor+=c,f}max(){return this.buffer.length-this.cursor}}t.Uint8ArrayReader=dd;class pd{constructor(c){this.buffer=c,this.cursor=0}write(c){const f=Math.min(this.max(),c.max());return this.buffer.set(c.read(f),this.cursor),this.cursor+=f,f}max(){return this.buffer.length-this.cursor}}t.Uint8ArrayWriter=pd;class pn{constructor(c,f=0n){this.span=f,this.writer=new pd(new Uint8Array(c))}build(){return di(Bc(this.span,"LE"),this.writer.buffer)}hash(){const c=ed(Sc(this.writer.buffer,32),(f,p)=>pn.hashFunction(di(f,p)));return pn.hashFunction(di(Bc(this.span,"LE"),c))}}t.Chunk=pn,pn.hashFunction=dn;class Oc{constructor(c,f=4096){this.counters=[1],this.capacity=f,this.chunks=[new pn(f)],this.onChunk=c}static async root(c,f=4096){const p=new e(e.NOOP,f);return await p.append(c),p.finalize()}async append(c,f=0,p=0n){const b=new dd(c);for(;b.max()>0;){this.chunks[f].writer.max()===0&&await this.elevate(f);const v=this.chunks[f].writer.write(b);p?this.chunks[f].span+=p:this.chunks[0].span+=BigInt(v)}}async elevate(c){this.counters[c]=++this.counters[c]%(this.capacity/32),this.chunks[c+1]||(this.chunks.push(new pn(this.capacity)),this.counters.push(1)),await this.append(this.chunks[c].hash(),c+1,this.chunks[c].span),await this.onChunk(this.chunks[c]),this.chunks[c]=new pn(this.capacity)}async finalize(c=0){return this.chunks[c+1]?this.counters[c]===1?(await this.elevate(c+1),this.chunks[c+1]=this.chunks[c],this.finalize(c+1)):(await this.elevate(c),this.finalize(c+1)):(await this.onChunk(this.chunks[c]),this.chunks[c])}}t.MerkleTree=Oc,e=Oc,Oc.NOOP=async s=>{};class nr{constructor(c,f){if(f<0)throw Error("Scale must be non-negative");this.value=BigInt(c),this.scale=f}static cast(c){if(!c)throw Error("Cannot cast falsy value to FixedPointNumber");if(c instanceof nr)return c;const f=p0(c.value),p=Je(c.scale);return new nr(f,p)}static fromDecimalString(c,f){/e\-\d+$/i.test(c)&&(c=parseFloat(c).toFixed(f));let[p,b]=c.split(".");return b=(b||"").padEnd(f,"0").slice(0,f),new nr(BigInt(p+b),f)}static fromFloat(c,f){return nr.fromDecimalString(c.toString(),f)}add(c){return this.assertSameScale(c),new nr(this.value+c.value,this.scale)}subtract(c){return this.assertSameScale(c),new nr(this.value-c.value,this.scale)}multiply(c){return new nr(this.value*c,this.scale)}divmod(c){if(c===0n)throw new Error("Division by zero is not allowed");const f=this.value/c,p=this.value%c;return[new nr(f,this.scale),new nr(p,this.scale)]}exchange(c,f,p){if(c==="*"){const v=this.value*f.value/10n**BigInt(this.scale);return new nr(v,p)}this.assertSameScale(f);const b=this.value*10n**BigInt(p)/f.value;return new nr(b,p)}compare(c){return this.assertSameScale(c),this.value>c.value?1:this.value<c.value?-1:0}toDecimalString(){if(this.scale===0)return this.value.toString();const c=this.value.toString(),f=c.slice(0,-this.scale)||"0",p=c.slice(-this.scale).padStart(this.scale,"0");return`${f}.${p}`}toString(){return this.value.toString()}toJSON(){return this.toString()}toFloat(){return parseFloat(this.toDecimalString())}assertSameScale(c){if(this.scale!==c.scale)throw new Error(`Scale mismatch: expected ${this.scale}, but got ${c.scale}`)}}t.FixedPointNumber=nr;function G8(s){if(s.length===0)return null;const c=s[0];return c.ttlMax?--c.ttl<=0&&s.shift():c.ttlMax=c.ttl,{progress:(c.ttlMax-c.ttl)/c.ttlMax,data:c.data}}function No(s,c,f,p){const b=s.findIndex(te=>te===`--${c}`||te.startsWith(`--${c}=`)),v=s[b];if(!v)return(f||{})[p||c||""]||null;if(v.includes("="))return v.split("=")[1];const V=s[b+1];return V&&!V.startsWith("-")?V:(f||{})[p||c||""]||null}function j8(s,c,f,p){const b=No(s,c,f,p);if(!b)return null;try{return vc(b)}catch{throw new Error(`Invalid number argument ${c}: ${b}`)}}function H8(s,c,f,p){const b=s.some(Y=>Y.endsWith("-"+c)),v=No(s,c,f,p);if(!v&&b)return!0;if(!v&&!b)return null;const V=["true","1","yes","y","on"],te=["false","0","no","n","off"];if(V.includes(v.toLowerCase()))return!0;if(te.includes(v.toLowerCase()))return!1;throw Error(`Invalid boolean argument ${c}: ${v}`)}function md(s,c,f,p){const b=No(s,c,f,p);if(!b)throw new Error(`Missing argument ${c}`);return b}function q8(s,c,f,p){const b=md(s,c,f,p);try{return vc(b)}catch{throw new Error(`Invalid argument ${c}: ${b}`)}}function gd(s,c){const f=s[c];s.splice(c,1),s.unshift(f)}function Z8(s,c){const f=[...s];return gd(f,c),f}function yd(s,c){return{x:s.x+c.x,y:s.y+c.y}}function K8(s,c){return{x:s.x-c.x,y:s.y-c.y}}function Ic(s,c){return{x:s.x*c,y:s.y*c}}function J8(s){const c=Math.sqrt(s.x*s.x+s.y*s.y);return{x:s.x/c,y:s.y/c}}function bd(s,c,f){return{x:s.x+Math.cos(c)*f,y:s.y+Math.sin(c)*f}}function xd(s,c){return Math.sqrt((s.x-c.x)**2+(s.y-c.y)**2)}function ms(s,c,f="row-first"){const p=[];if(f==="column-first")for(let b=0;b<s.length;b++)for(let v=0;v<s[0].length;v++)c(b,v)&&p.push({x:b,y:v});else for(let b=0;b<s[0].length;b++)for(let v=0;v<s.length;v++)c(v,b)&&p.push({x:v,y:b});return p}function W8(s,c,f){return s[c+1]?.[f]&&s[c-1]?.[f]&&!s[c][f-1]&&!s[c][f+1]}function Q8(s,c,f){return s[c][f+1]&&s[c][f-1]&&!s[c-1]?.[f]&&!s[c+1]?.[f]}function wd(s,c,f){return!s[c-1]?.[f]}function Ad(s,c,f){return!s[c+1]?.[f]}function Ed(s,c,f){return!s[c][f-1]}function vd(s,c,f){return!s[c][f+1]}function Y8(s,c,f){const p=[];return s[c][f]?W8(s,c,f)||Q8(s,c,f)?[]:(!s[c-1]?.[f-1]&&wd(s,c,f)&&Ed(s,c,f)&&p.push({x:c,y:f}),!s[c+1]?.[f-1]&&Ad(s,c,f)&&Ed(s,c,f)&&p.push({x:c+1,y:f}),!s[c-1]?.[f+1]&&wd(s,c,f)&&vd(s,c,f)&&p.push({x:c,y:f+1}),!s[c+1]?.[f+1]&&Ad(s,c,f)&&vd(s,c,f)&&p.push({x:c+1,y:f+1}),p):(s[c-1]?.[f]&&s[c][f-1]&&p.push({x:c,y:f}),s[c+1]?.[f]&&s[c][f-1]&&p.push({x:c+1,y:f}),s[c-1]?.[f]&&s[c][f+1]&&p.push({x:c,y:f+1}),s[c+1]?.[f]&&s[c][f+1]&&p.push({x:c+1,y:f+1}),p)}function X8(s,c,f,p){const b=[{x:0,y:0},{x:f,y:0},{x:0,y:p},{x:f,y:p}];for(let v=0;v<s.length;v++)for(let V=0;V<s[0].length;V++){const te=Y8(s,v,V);for(const Y of te)b.some(we=>we.x===Y.x&&we.y===Y.y)||b.push(Y)}return b.map(v=>({x:v.x*c,y:v.y*c}))}function e4(s,c){const f=ms(s,(Y,we)=>s[Y][we]===0&&s[Y][we+1]!==0,"row-first").map(Y=>({...Y,dx:1,dy:0})),p=ms(s,(Y,we)=>s[Y][we]===0&&s[Y][we-1]!==0,"row-first").map(Y=>({...Y,dx:1,dy:0})),b=ms(s,(Y,we)=>s[Y][we]===0&&s[Y-1]?.[we]!==0,"column-first").map(Y=>({...Y,dx:0,dy:1})),v=ms(s,(Y,we)=>s[Y][we]===0&&s[Y+1]?.[we]!==0,"column-first").map(Y=>({...Y,dx:0,dy:1}));f.forEach(Y=>Y.y++),v.forEach(Y=>Y.x++);const V=Tc([...b,...v],(Y,we)=>Y.x===we.x&&Y.y-1===we.y),te=Tc([...p,...f],(Y,we)=>Y.y===we.y&&Y.x-1===we.x);return[...V,...te].map(Y=>({start:Y[0],end:ge(Y)})).map(Y=>({start:Ic(Y.start,c),end:Ic(yd(Y.end,{x:Y.start.dx,y:Y.start.dy}),c)}))}function t4(s,c){return Math.atan2(c.y-s.y,c.x-s.x)}function r4(s,c){return c.map(f=>t4(s,f)).sort((f,p)=>f-p)}function Rd(s,c,f,p){const b=(p.y-f.y)*(c.x-s.x)-(p.x-f.x)*(c.y-s.y);if(b===0)return null;let v=s.y-f.y,V=s.x-f.x;const te=(p.x-f.x)*v-(p.y-f.y)*V,Y=(c.x-s.x)*v-(c.y-s.y)*V;return v=te/b,V=Y/b,v>0&&v<1&&V>0&&V<1?{x:s.x+v*(c.x-s.x),y:s.y+v*(c.y-s.y)}:null}function kc(s,c,f){const p=[],b=bd(s,f,1e4);for(const v of c){const V=Rd(s,b,v.start,v.end);V&&p.push(V)}return p.length?p.reduce((v,V)=>{const te=xd(s,V),Y=xd(s,v);return te<Y?V:v}):null}function n4(s,c,f){const p=r4(s,f),b=[];for(const v of p){const V=kc(s,c,v-.001),te=kc(s,c,v+.001);V&&b.push(V),te&&b.push(te)}return b}class Nc{constructor(){this.subscribers=[]}subscribe(c){return this.subscribers.push(c),()=>{this.subscribers=this.subscribers.filter(f=>f!==c)}}publish(c){this.subscribers.forEach(f=>f(c))}clear(){this.subscribers=[]}getSubscriberCount(){return this.subscribers.length}}t.PubSubChannel=Nc;class i4{constructor(c,f){this.queue=[],this.running=0,this.onProcessed=new Nc,this.onDrained=new Nc,this.concurrency=c,this.capacity=f}process(){if(this.running>=this.concurrency)return;const c=this.queue.shift();c&&(this.running++,c().finally(()=>{this.running--,this.process(),this.onProcessed.publish(),this.running===0&&this.onDrained.publish()}))}enqueue(c){if(this.queue.length<this.capacity)return this.queue.push(c),this.process(),Promise.resolve();if(this.onProcessed.getSubscriberCount())throw Error("Queue capacity is full");return new Promise(f=>{this.onProcessed.subscribe(()=>{this.queue.length<this.capacity&&(this.queue.push(c),this.process(),this.onProcessed.clear(),f())})})}drain(){if(this.running===0)return Promise.resolve();if(this.onDrained.getSubscriberCount())throw Error("Already draining");return new Promise(c=>{this.onDrained.subscribe(()=>{this.onDrained.clear(),c()})})}}t.AsyncQueue=i4;class Cc{constructor(){this.forks=new Map}insert(c,f){if(c.length===0){this.handler=f;return}const p=c[0];let b=p,v;if(p.startsWith(":")&&(b=":",v=p.slice(1)),!this.forks.has(b)){const V=new Cc;v&&(V.variableName=v),this.forks.set(b,V)}this.forks.get(b).insert(c.slice(1),f)}async handle(c,f,p,b){if(c.length===0)return this.handler?(await this.handler(f,p,b),!0):!1;const v=c[0],V=this.forks.get(v);if(V)return V.handle(c.slice(1),f,p,b);const te=this.forks.get(":");if(te)return te.variableName&&b.set(te.variableName,decodeURIComponent(v)),te.handle(c.slice(1),f,p,b);const Y=this.forks.get("*");return Y?(b.set("wildcard",c.join("/")),Y.handler?(await Y.handler(f,p,b),!0):!1):!1}}t.TrieRouter=Cc;class s4{constructor(c){this.index=0,this.values=c}current(){return this.values[this.index]}next(){return this.index=(this.index+1)%this.values.length,this.values[this.index]}}t.RollingValueProvider=s4;class o4{constructor(){this.status="pending",this.steps=[],this.onStatusChange=async()=>{},this.onStepChange=async()=>{},this.onFinish=async()=>{},this.onError=async()=>{},this.context=new Map}getStatus(){return this.status}createInitialState(){return Object.fromEntries(this.steps.map(c=>[c.name,"pending"]))}setHooks(c){c.onStatusChange&&(this.onStatusChange=c.onStatusChange),c.onStepChange&&(this.onStepChange=c.onStepChange),c.onFinish&&(this.onFinish=c.onFinish),c.onError&&(this.onError=c.onError)}addStep(c){if(this.steps.find(f=>f.name===c.name))throw Error(`Step with name ${c.name} already exists`);this.steps.push(c)}async execute(){if(this.status!=="pending")throw Error(`Cannot execute solver in status ${this.status}`);this.status="in-progress",await this.onStatusChange(this.status);let c=this.createInitialState();for(const f of this.steps)try{if(f.transientSkipStepName){const p=c[f.transientSkipStepName];if(p==="skipped"||p==="failed"){c={...c,[f.name]:"skipped"},await this.onStepChange(c);continue}}if(!(!f.precondition||await f.precondition(this.context))){c={...c,[f.name]:"skipped"},await this.onStepChange(c);continue}c={...c,[f.name]:"in-progress"},await this.onStepChange(c);for(let p=0;await f.action(this.context,p)==="retry";p++);c={...c,[f.name]:"completed"},await this.onStepChange(c)}catch(p){throw c={...c,[f.name]:"failed"},this.status="failed",await this.onStatusChange(this.status),await this.onStepChange(c),await this.onError(p),p}return this.status="completed",await this.onStatusChange(this.status),await this.onFinish(),this.context}}t.Solver=o4;class a4{constructor(c){this.queryFunction=c.queryFunction,this.lockFunction=c.lockFunction,this.unlockFunction=c.unlockFunction,this.timeoutMillis=c.timeoutMillis}async couldLock(){const c=await this.queryFunction();try{const f=Ze(c);if(Date.now()<f+this.timeoutMillis)return new Date(f+this.timeoutMillis)}catch{}return await this.lockFunction(Date.now().toString()),!0}async unlock(){await this.unlockFunction()}}t.Lock=a4,t.Binary={hexToUint8Array:Q2,uint8ArrayToHex:Y2,binaryToUint8Array:eA,uint8ArrayToBinary:X2,base64ToUint8Array:Z2,uint8ArrayToBase64:K2,base32ToUint8Array:J2,uint8ArrayToBase32:W2,log2Reduce:ed,partition:Sc,concatBytes:di,numberToUint8:p8,uint8ToNumber:m8,numberToUint16:g8,uint16ToNumber:y8,numberToUint32:b8,uint32ToNumber:x8,numberToUint64:Bc,uint64ToNumber:w8,numberToUint256:pi,uint256ToNumber:mi,sliceBytes:A8,keccak256:dn,sha3_256:v8,proximity:R8,commonPrefix:T8,setBit:B8,getBit:S8,indexOf:P8,equals:C8,padStart:ud,padStartToMultiple:O8,padEnd:ld,padEndToMultiple:I8,xorCypher:k8,isUtf8:N8},t.Elliptic={privateKeyToPublicKey:F8,compressPublicKey:D8,publicKeyFromCompressed:L8,publicKeyToAddress:U8,signMessage:z8,signHash:hd,verifySignature:V8,recoverPublicKey:$8,checksumEncode:M8},t.Random={intBetween:I,floatBetween:B,chance:L,signed:S,makeSeededRng:A,point:_,procs:D},t.Arrays={countUnique:q3,makeUnique:H3,splitBySize:G3,splitByCount:W0,index:J0,indexCollection:V3,onlyOrThrow:u,onlyOrNull:l,firstOrThrow:d,firstOrNull:h,shuffle:a,initialize:m,initialize2D:w,rotate2D:y,containsShape:T,glue:r2,pluck:O,pick:H,pickMany:K,pickManyUnique:le,pickWeighted:ue,pickRandomIndices:R,pickGuaranteed:U,last:ge,pipe:Be,makePipe:ne,sortWeighted:ye,pushAll:vo,unshiftAll:e2,filterAndRemove:BA,merge:T3,empty:B3,pushToBucket:Qw,unshiftAndLimit:Yw,atRolling:Xw,group:Tc,createOscillator:h3,organiseWithLimits:p3,tickPlaybook:G8,getArgument:No,getBooleanArgument:H8,getNumberArgument:j8,requireStringArgument:md,requireNumberArgument:q8,bringToFront:Z8,bringToFrontInPlace:gd,findInstance:a8,filterInstances:c8,interleave:u8,toggle:l8,createHierarchy:h8,multicall:n8,maxBy:i8,minBy:s8,allIndexOf:o8},t.System={sleepMillis:o,forever:se,scheduleMany:u2,waitFor:TA,expandError:Zw,runAndSetInterval:M,whereAmI:z,withRetries:Q},t.Numbers={make:vc,sum:f2,average:h2,median:d2,getDistanceFromMidpoint:p2,clamp:Rc,range:y0,interpolate:l2,createSequence:f3,increment:A3,decrement:E3,format:w3,fromDecimals:x3,makeStorage:QA,asMegabytes:ie,convertBytes:oe,hexToRgb:P,rgbToHex:k,haversineDistanceToMeters:Z,roundToNearest:fe,formatDistance:Oe,triangularNumber:xe,searchFloat:Fe,binomialSample:Lt,toSignificantDigits:X},t.Promises={raceFulfilled:n,invert:r,runInParallelBatches:i},t.Dates={getTimestamp:FA,getTimeDelta:z0,secondsToHumanTime:DA,countCycles:LA,isoDate:OA,throttle:UA,timeSince:zA,dateTimeSlug:IA,unixTimestamp:PA,fromUtcString:kA,fromMillis:NA,getProgress:$A,humanizeTime:So,humanizeProgress:RA,createTimeDigits:Cr,mapDayNumber:$0,getDayInfoFromDate:Ec,getDayInfoFromDateTimeString:GA,seconds:jA,minutes:HA,hours:qA,days:ZA,make:JA,normalizeTime:CA,absoluteDays:Dn},t.Objects={safeParse:l3,deleteDeep:_e,getDeep:Ae,setDeep:Ee,incrementDeep:Se,ensureDeep:Ue,replaceDeep:j,getFirstDeep:J,deepMergeInPlace:Fn,deepMerge2:Kw,deepMerge3:Jw,mapAllAsync:t2,cloneWithJson:SA,sortObject:G0,sortArray:j0,sortAny:Ln,deepEquals:H0,deepEqualsEvery:u3,runOn:v3,ifPresent:R3,zip:g0,zipSum:Ww,removeEmptyArrays:S3,removeEmptyValues:P3,flatten:z3,unflatten:K0,match:$3,sort:Y0,map:k3,mapIterable:N3,filterKeys:O3,filterValues:I3,rethrow:C3,setSomeOnObject:_3,setSomeDeep:F3,flip:D3,getAllPermutations:L3,countTruthyValues:U3,transformToArray:Z3,setMulti:J3,incrementMulti:K3,createBidirectionalMap:W3,createTemporalBidirectionalMap:Q3,pushToBidirectionalMap:X0,unshiftToBidirectionalMap:Y3,addToTemporalBidirectionalMap:X3,getFromTemporalBidirectionalMap:e8,createStatefulToggle:d3,diffKeys:m3,pickRandomKey:q0,mapRandomKey:g3,fromObjectString:y3,toQueryString:U0,parseQueryString:mA,hasKey:gA,selectMax:yA,reposition:bA,unwrapSingleKey:xA,parseKeyValues:wA,errorMatches:AA},t.Types={isFunction:Er,isObject:xt,isStrictlyObject:wt,isEmptyArray:qe,isEmptyObject:st,isUndefined:jt,isString:at,isNumber:Bt,isBoolean:cr,isDate:rr,isBlank:un,isId:fi,isIntegerString:wo,isHexString:is,isUrl:h0,isBigint:d0,isNullable:Vw,asString:C,asHexString:$,asSafeString:q,asIntegerString:x,asNumber:Je,asFunction:Ne,asInteger:Ze,asBoolean:ct,asDate:Ke,asNullableString:Cw,asEmptiableString:_w,asId:Fw,asTime:Dw,asArray:Lw,asObject:Eo,asNullableObject:Uw,asStringMap:Mw,asNumericDictionary:zw,asUrl:$w,asBigint:p0,asEmptiable:jw,asNullable:Gw,asOptional:Hw,enforceObjectShape:m0,enforceArrayShape:qw,isPng:td,isJpg:rd,isWebp:nd,isImage:d8},t.Strings={tokenizeByCount:j3,tokenizeByLength:Q0,searchHex:hc,searchSubstring:E,randomHex:g,randomLetter:ur,randomAlphanumeric:us,randomRichAscii:fc,randomUnicode:Nr,includesAny:m2,slugify:dc,normalForm:y2,enumify:v2,escapeHtml:T2,decodeHtmlEntities:S2,after:To,afterLast:b0,before:pc,beforeLast:mc,betweenWide:P2,betweenNarrow:O2,getPreLine:YA,containsWord:wc,containsWords:lA,joinUrl:V0,getFuzzyMatchScore:Ro,sortByFuzzyScore:R2,splitOnce:gc,splitAll:x0,randomize:C2,expand:w0,shrinkTrim:fs,capitalize:Bo,decapitalize:A0,csvEscape:M2,parseCsv:vA,surroundInOut:E2,getExtension:yc,getBasename:bc,normalizeEmail:I2,normalizeFilename:k2,parseFilename:N2,camelToTitle:b2,slugToTitle:x2,slugToCamel:w2,joinHumanly:A2,findWeightedPair:P0,extractBlock:O0,extractAllBlocks:V2,replaceBlocks:G2,indexOfEarliest:hi,lastIndexOfBefore:S0,parseHtmlAttributes:fA,readNextWord:ds,readWordsAfterAll:hA,resolveVariables:dA,resolveVariableWithDefaultSyntax:D0,resolveRemainingVariablesWithDefaults:L0,isLetter:E0,isDigit:v0,isLetterOrDigit:hs,isValidObjectPathCharacter:D2,insert:L2,indexOfRegex:R0,allIndexOf:B0,lineMatches:T0,linesMatchInOrder:U2,represent:ls,resolveMarkdownLinks:pA,buildUrl:EA,isChinese:g2,replaceBetweenStrings:s3,describeMarkdown:o3,isBalanced:a3,textToFormat:c3,splitFormatting:j2,splitHashtags:H2,splitUrls:q2,route:tA,explodeReplace:xc,generateVariants:rA,replaceWord:nA,replacePascalCaseWords:iA,stripHtml:sA,breakLine:_0,measureTextWidth:oA,toLines:aA,levenshteinDistance:cA,findCommonPrefix:F0,findCommonDirectory:uA},t.Assertions={asEqual:n2,asTrue:i2,asTruthy:s2,asFalse:o2,asFalsy:a2,asEither:c2},t.Cache={get:XA,getDeferred:e3,delete:t3,deleteExpired:n3,size:i3,clear:r3},t.Vector={addPoint:yd,subtractPoint:K8,multiplyPoint:Ic,normalizePoint:J8,pushPoint:bd,filterCoordinates:ms,findCorners:X8,findLines:e4,raycast:kc,raycastCircle:n4,getLineIntersectionPoint:Rd}})(Iu)),Iu}var G=y4(),Sd;function W(t,e,r){function n(u,l){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(t))return;u._zod.traits.add(t),e(u,l);const h=a.prototype,d=Object.keys(h);for(let m=0;m<d.length;m++){const y=d[m];y in u||(u[y]=h[y].bind(u))}}const i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function a(u){var l;const h=r?.Parent?new o:this;n(h,u),(l=h._zod).deferred??(l.deferred=[]);for(const d of h._zod.deferred)d();return h}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}class Pi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ey extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Sd=globalThis).__zod_globalConfig??(Sd.__zod_globalConfig={});const fh=globalThis.__zod_globalConfig;function tn(t){return fh}function vy(t){const e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function _f(t,e){return typeof e=="bigint"?e.toString():e}function hh(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function dh(t){return t==null}function ph(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function b4(t,e){const r=t/e,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}const Pd=Symbol("evaluating");function Ye(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Pd)return n===void 0&&(n=Pd,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function ii(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Pn(...t){const e={};for(const r of t){const n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Od(t){return JSON.stringify(t)}function x4(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ry="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function pa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const w4=hh(()=>{if(fh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function _i(t){if(pa(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const r=e.prototype;return!(pa(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ty(t){return _i(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const A4=new Set(["string","number","symbol"]);function Fi(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function On(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Re(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function E4(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const v4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function R4(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Pn(t._zod.def,{get shape(){const a={};for(const u in e){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);e[u]&&(a[u]=r.shape[u])}return ii(this,"shape",a),a},checks:[]});return On(t,o)}function T4(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Pn(t._zod.def,{get shape(){const a={...t._zod.def.shape};for(const u in e){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);e[u]&&delete a[u]}return ii(this,"shape",a),a},checks:[]});return On(t,o)}function B4(t,e){if(!_i(e))throw new Error("Invalid input to extend: expected a plain object");const r=t._zod.def.checks;if(r&&r.length>0){const o=t._zod.def.shape;for(const a in e)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Pn(t._zod.def,{get shape(){const o={...t._zod.def.shape,...e};return ii(this,"shape",o),o}});return On(t,i)}function S4(t,e){if(!_i(e))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Pn(t._zod.def,{get shape(){const n={...t._zod.def.shape,...e};return ii(this,"shape",n),n}});return On(t,r)}function P4(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Pn(t._zod.def,{get shape(){const n={...t._zod.def.shape,...e._zod.def.shape};return ii(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return On(t,r)}function O4(t,e,r){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Pn(e._zod.def,{get shape(){const u=e._zod.def.shape,l={...u};if(r)for(const h in r){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);r[h]&&(l[h]=t?new t({type:"optional",innerType:u[h]}):u[h])}else for(const h in u)l[h]=t?new t({type:"optional",innerType:u[h]}):u[h];return ii(this,"shape",l),l},checks:[]});return On(e,a)}function I4(t,e,r){const n=Pn(e._zod.def,{get shape(){const i=e._zod.def.shape,o={...i};if(r)for(const a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new t({type:"nonoptional",innerType:i[a]}))}else for(const a in i)o[a]=new t({type:"nonoptional",innerType:i[a]});return ii(this,"shape",o),o}});return On(e,n)}function Ri(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function k4(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function En(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Co(t){return typeof t=="string"?t:t?.message}function rn(t,e,r){const n=t.message?t.message:Co(t.inst?._zod.def?.error?.(t))??Co(e?.error?.(t))??Co(r.customError?.(t))??Co(r.localeError?.(t))??"Invalid input",{inst:i,continue:o,input:a,...u}=t;return u.path??(u.path=[]),u.message=n,e?.reportInput&&(u.input=a),u}function mh(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function $s(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const By=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,_f,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Sy=W("$ZodError",By),_a=W("$ZodError",By,{Parent:Error});function N4(t,e=r=>r.message){const r={},n=[];for(const i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function C4(t,e=r=>r.message){const r={_errors:[]},n=(i,o=[])=>{for(const a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>n({issues:u},[...o,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...o,...a.path]);else{const u=[...o,...a.path];if(u.length===0)r._errors.push(e(a));else{let l=r,h=0;for(;h<u.length;){const d=u[h];h===u.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(e(a))):l[d]=l[d]||{_errors:[]},l=l[d],h++}}}};return n(t),r}const Fa=t=>(e,r,n,i)=>{const o=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new Pi;if(a.issues.length){const u=new(i?.Err??t)(a.issues.map(l=>rn(l,o,tn())));throw Ry(u,i?.callee),u}return a.value},Id=Fa(_a),Da=t=>async(e,r,n,i)=>{const o=n?{...n,async:!0}:{async:!0};let a=e._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new(i?.Err??t)(a.issues.map(l=>rn(l,o,tn())));throw Ry(u,i?.callee),u}return a.value},kd=Da(_a),La=t=>(e,r,n)=>{const i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Pi;return o.issues.length?{success:!1,error:new(t??Sy)(o.issues.map(a=>rn(a,i,tn())))}:{success:!0,data:o.value}},_4=La(_a),Ua=t=>async(e,r,n)=>{const i=n?{...n,async:!0}:{async:!0};let o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(a=>rn(a,i,tn())))}:{success:!0,data:o.value}},F4=Ua(_a),D4=t=>(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return Fa(t)(e,r,i)},L4=t=>(e,r,n)=>Fa(t)(e,r,n),U4=t=>async(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return Da(t)(e,r,i)},M4=t=>async(e,r,n)=>Da(t)(e,r,n),z4=t=>(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return La(t)(e,r,i)},$4=t=>(e,r,n)=>La(t)(e,r,n),V4=t=>async(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return Ua(t)(e,r,i)},G4=t=>async(e,r,n)=>Ua(t)(e,r,n),j4=/^[cC][0-9a-z]{6,}$/,H4=/^[0-9a-z]+$/,q4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z4=/^[0-9a-vA-V]{20}$/,K4=/^[A-Za-z0-9]{27}$/,J4=/^[a-zA-Z0-9_-]{21}$/,W4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Q4=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Nd=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Y4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,X4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function e6(){return new RegExp(X4,"u")}const t6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,r6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,n6=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,i6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,s6=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Py=/^[A-Za-z0-9_-]*$/,o6=/^https?$/,a6=/^\+[1-9]\d{6,14}$/,Oy="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",c6=new RegExp(`^${Oy}$`);function Iy(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function u6(t){return new RegExp(`^${Iy(t)}$`)}function l6(t){const e=Iy({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Oy}T(?:${n})$`)}const f6=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},h6=/^-?\d+n?$/,d6=/^-?\d+$/,ky=/^-?\d+(?:\.\d+)?$/,p6=/^(?:true|false)$/i,m6=/^[^A-Z]*$/,g6=/^[^a-z]*$/,tr=W("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Ny={number:"number",bigint:"bigint",object:"date"},Cy=W("$ZodCheckLessThan",(t,e)=>{tr.init(t,e);const r=Ny[typeof e.value];t._zod.onattach.push(n=>{const i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),_y=W("$ZodCheckGreaterThan",(t,e)=>{tr.init(t,e);const r=Ny[typeof e.value];t._zod.onattach.push(n=>{const i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),y6=W("$ZodCheckMultipleOf",(t,e)=>{tr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):b4(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),b6=W("$ZodCheckNumberFormat",(t,e)=>{tr.init(t,e),e.format=e.format||"float64";const r=e.format?.includes("int"),n=r?"int":"number",[i,o]=v4[e.format];t._zod.onattach.push(a=>{const u=a._zod.bag;u.format=e.format,u.minimum=i,u.maximum=o,r&&(u.pattern=d6)}),t._zod.check=a=>{const u=a.value;if(r){if(!Number.isInteger(u)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}u<i&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),u>o&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),x6=W("$ZodCheckMaxLength",(t,e)=>{var r;tr.init(t,e),(r=t._zod.def).when??(r.when=n=>{const i=n.value;return!dh(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{const i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const i=n.value;if(i.length<=e.maximum)return;const a=mh(i);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),w6=W("$ZodCheckMinLength",(t,e)=>{var r;tr.init(t,e),(r=t._zod.def).when??(r.when=n=>{const i=n.value;return!dh(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{const i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const i=n.value;if(i.length>=e.minimum)return;const a=mh(i);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),A6=W("$ZodCheckLengthEquals",(t,e)=>{var r;tr.init(t,e),(r=t._zod.def).when??(r.when=n=>{const i=n.value;return!dh(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{const i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{const i=n.value,o=i.length;if(o===e.length)return;const a=mh(i),u=o>e.length;n.issues.push({origin:a,...u?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Ma=W("$ZodCheckStringFormat",(t,e)=>{var r,n;tr.init(t,e),t._zod.onattach.push(i=>{const o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),E6=W("$ZodCheckRegex",(t,e)=>{Ma.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),v6=W("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=m6),Ma.init(t,e)}),R6=W("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=g6),Ma.init(t,e)}),T6=W("$ZodCheckIncludes",(t,e)=>{tr.init(t,e);const r=Fi(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),B6=W("$ZodCheckStartsWith",(t,e)=>{tr.init(t,e);const r=new RegExp(`^${Fi(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),S6=W("$ZodCheckEndsWith",(t,e)=>{tr.init(t,e);const r=new RegExp(`.*${Fi(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),P6=W("$ZodCheckOverwrite",(t,e)=>{tr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class O6{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const n=e.split(`
11
+ `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of o)this.content.push(a)}compile(){const e=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,i.join(`
12
+ `))}}const I6={major:4,minor:4,patch:3},Xe=W("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=I6;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const i of n)for(const o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const i=(a,u,l)=>{let h=Ri(a),d;for(const m of u){if(m._zod.def.when){if(k4(a)||!m._zod.def.when(a))continue}else if(h)continue;const y=a.issues.length,w=m._zod.check(a);if(w instanceof Promise&&l?.async===!1)throw new Pi;if(d||w instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await w,a.issues.length!==y&&(h||(h=Ri(a,y)))});else{if(a.issues.length===y)continue;h||(h=Ri(a,y))}}return d?d.then(()=>a):a},o=(a,u,l)=>{if(Ri(a))return a.aborted=!0,a;const h=i(u,n,l);if(h instanceof Promise){if(l.async===!1)throw new Pi;return h.then(d=>t._zod.parse(d,l))}return t._zod.parse(h,l)};t._zod.run=(a,u)=>{if(u.skipChecks)return t._zod.parse(a,u);if(u.direction==="backward"){const h=t._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return h instanceof Promise?h.then(d=>o(d,a,u)):o(h,a,u)}const l=t._zod.parse(a,u);if(l instanceof Promise){if(u.async===!1)throw new Pi;return l.then(h=>i(h,n,u))}return i(l,n,u)}}Ye(t,"~standard",()=>({validate:i=>{try{const o=_4(t,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return F4(t,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),gh=W("$ZodString",(t,e)=>{Xe.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??f6(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),ft=W("$ZodStringFormat",(t,e)=>{Ma.init(t,e),gh.init(t,e)}),k6=W("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Q4),ft.init(t,e)}),N6=W("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Nd(n))}else e.pattern??(e.pattern=Nd());ft.init(t,e)}),C6=W("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Y4),ft.init(t,e)}),_6=W("$ZodURL",(t,e)=>{ft.init(t,e),t._zod.check=r=>{try{const n=r.value.trim();if(!e.normalize&&e.protocol?.source===o6.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}const i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),F6=W("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=e6()),ft.init(t,e)}),D6=W("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=J4),ft.init(t,e)}),L6=W("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=j4),ft.init(t,e)}),U6=W("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=H4),ft.init(t,e)}),M6=W("$ZodULID",(t,e)=>{e.pattern??(e.pattern=q4),ft.init(t,e)}),z6=W("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Z4),ft.init(t,e)}),$6=W("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=K4),ft.init(t,e)}),V6=W("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=l6(e)),ft.init(t,e)}),G6=W("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=c6),ft.init(t,e)}),j6=W("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=u6(e)),ft.init(t,e)}),H6=W("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=W4),ft.init(t,e)}),q6=W("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=t6),ft.init(t,e),t._zod.bag.format="ipv4"}),Z6=W("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=r6),ft.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),K6=W("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=n6),ft.init(t,e)}),J6=W("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=i6),ft.init(t,e),t._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[i,o]=n;if(!o)throw new Error;const a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Fy(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const W6=W("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=s6),ft.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Fy(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Q6(t){if(!Py.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Fy(r)}const Y6=W("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Py),ft.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Q6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),X6=W("$ZodE164",(t,e)=>{e.pattern??(e.pattern=a6),ft.init(t,e)});function eE(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const tE=W("$ZodJWT",(t,e)=>{ft.init(t,e),t._zod.check=r=>{eE(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Dy=W("$ZodNumber",(t,e)=>{Xe.init(t,e),t._zod.pattern=t._zod.bag.pattern??ky,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),r}}),rE=W("$ZodNumberFormat",(t,e)=>{b6.init(t,e),Dy.init(t,e)}),nE=W("$ZodBoolean",(t,e)=>{Xe.init(t,e),t._zod.pattern=p6,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}const i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),iE=W("$ZodBigInt",(t,e)=>{Xe.init(t,e),t._zod.pattern=h6,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),sE=W("$ZodAny",(t,e)=>{Xe.init(t,e),t._zod.parse=r=>r}),oE=W("$ZodUnknown",(t,e)=>{Xe.init(t,e),t._zod.parse=r=>r}),aE=W("$ZodNever",(t,e)=>{Xe.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Cd(t,e,r){t.issues.length&&e.issues.push(...En(r,t.issues)),e.value[r]=t.value}const cE=W("$ZodArray",(t,e)=>{Xe.init(t,e),t._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);const o=[];for(let a=0;a<i.length;a++){const u=i[a],l=e.element._zod.run({value:u,issues:[]},n);l instanceof Promise?o.push(l.then(h=>Cd(h,r,a))):Cd(l,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function ma(t,e,r,n,i,o){const a=r in n;if(t.issues.length){if(i&&o&&!a)return;e.issues.push(...En(r,t.issues))}if(!a&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?a&&(e.value[r]=void 0):e.value[r]=t.value}function Ly(t){const e=Object.keys(t.shape);for(const n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=E4(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Uy(t,e,r,n,i,o){const a=[],u=i.keySet,l=i.catchall._zod,h=l.def.type,d=l.optin==="optional",m=l.optout==="optional";for(const y in e){if(y==="__proto__"||u.has(y))continue;if(h==="never"){a.push(y);continue}const w=l.run({value:e[y],issues:[]},n);w instanceof Promise?t.push(w.then(T=>ma(T,r,y,e,d,m))):ma(w,r,y,e,d,m)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}const uE=W("$ZodObject",(t,e)=>{if(Xe.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const u=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...u};return Object.defineProperty(e,"shape",{value:l}),l}})}const n=hh(()=>Ly(e));Ye(t._zod,"propValues",()=>{const u=e.shape,l={};for(const h in u){const d=u[h]._zod;if(d.values){l[h]??(l[h]=new Set);for(const m of d.values)l[h].add(m)}}return l});const i=pa,o=e.catchall;let a;t._zod.parse=(u,l)=>{a??(a=n.value);const h=u.value;if(!i(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),u;u.value={};const d=[],m=a.shape;for(const y of a.keys){const w=m[y],T=w._zod.optin==="optional",R=w._zod.optout==="optional",O=w._zod.run({value:h[y],issues:[]},l);O instanceof Promise?d.push(O.then(A=>ma(A,u,y,h,T,R))):ma(O,u,y,h,T,R)}return o?Uy(d,h,u,l,n.value,t):d.length?Promise.all(d).then(()=>u):u}}),lE=W("$ZodObjectJIT",(t,e)=>{uE.init(t,e);const r=t._zod.parse,n=hh(()=>Ly(e)),i=y=>{const w=new O6(["shape","payload","ctx"]),T=n.value,R=B=>{const S=Od(B);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};w.write("const input = payload.value;");const O=Object.create(null);let A=0;for(const B of T.keys)O[B]=`key_${A++}`;w.write("const newResult = {};");for(const B of T.keys){const S=O[B],N=Od(B),_=y[B],D=_?._zod?.optin==="optional",L=_?._zod?.optout==="optional";w.write(`const ${S} = ${R(B)};`),D&&L?w.write(`
13
+ if (${S}.issues.length) {
14
+ if (${N} in input) {
15
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
16
+ ...iss,
17
+ path: iss.path ? [${N}, ...iss.path] : [${N}]
18
+ })));
19
+ }
20
+ }
21
+
22
+ if (${S}.value === undefined) {
23
+ if (${N} in input) {
24
+ newResult[${N}] = undefined;
25
+ }
26
+ } else {
27
+ newResult[${N}] = ${S}.value;
28
+ }
29
+
30
+ `):D?w.write(`
31
+ if (${S}.issues.length) {
32
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
33
+ ...iss,
34
+ path: iss.path ? [${N}, ...iss.path] : [${N}]
35
+ })));
36
+ }
37
+
38
+ if (${S}.value === undefined) {
39
+ if (${N} in input) {
40
+ newResult[${N}] = undefined;
41
+ }
42
+ } else {
43
+ newResult[${N}] = ${S}.value;
44
+ }
45
+
46
+ `):w.write(`
47
+ const ${S}_present = ${N} in input;
48
+ if (${S}.issues.length) {
49
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
50
+ ...iss,
51
+ path: iss.path ? [${N}, ...iss.path] : [${N}]
52
+ })));
53
+ }
54
+ if (!${S}_present && !${S}.issues.length) {
55
+ payload.issues.push({
56
+ code: "invalid_type",
57
+ expected: "nonoptional",
58
+ input: undefined,
59
+ path: [${N}]
60
+ });
61
+ }
62
+
63
+ if (${S}_present) {
64
+ if (${S}.value === undefined) {
65
+ newResult[${N}] = undefined;
66
+ } else {
67
+ newResult[${N}] = ${S}.value;
68
+ }
69
+ }
70
+
71
+ `)}w.write("payload.value = newResult;"),w.write("return payload;");const I=w.compile();return(B,S)=>I(y,B,S)};let o;const a=pa,u=!fh.jitless,h=u&&w4.value,d=e.catchall;let m;t._zod.parse=(y,w)=>{m??(m=n.value);const T=y.value;return a(T)?u&&h&&w?.async===!1&&w.jitless!==!0?(o||(o=i(e.shape)),y=o(y,w),d?Uy([],T,y,w,m,t):y):r(y,w):(y.issues.push({expected:"object",code:"invalid_type",input:T,inst:t}),y)}});function _d(t,e,r,n){for(const o of t)if(o.issues.length===0)return e.value=o.value,e;const i=t.filter(o=>!Ri(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(a=>rn(a,n,tn())))}),e)}const fE=W("$ZodUnion",(t,e)=>{Xe.init(t,e),Ye(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ye(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ye(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),Ye(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){const n=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>ph(i.source)).join("|")})$`)}});const r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1;const a=[];for(const u of e.options){const l=u._zod.run({value:n.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}return o?Promise.all(a).then(u=>_d(u,n,t,i)):_d(a,n,t,i)}}),hE=W("$ZodIntersection",(t,e)=>{Xe.init(t,e),t._zod.parse=(r,n)=>{const i=r.value,o=e.left._zod.run({value:i,issues:[]},n),a=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,h])=>Fd(r,l,h)):Fd(r,o,a)}});function Ff(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(_i(t)&&_i(e)){const r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of n){const a=Ff(t[o],e[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],a=Ff(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Fd(t,e,r){const n=new Map;let i;for(const u of e.issues)if(u.code==="unrecognized_keys"){i??(i=u);for(const l of u.keys)n.has(l)||n.set(l,{}),n.get(l).l=!0}else t.issues.push(u);for(const u of r.issues)if(u.code==="unrecognized_keys")for(const l of u.keys)n.has(l)||n.set(l,{}),n.get(l).r=!0;else t.issues.push(u);const o=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(o.length&&i&&t.issues.push({...i,keys:o}),Ri(t))return t;const a=Ff(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}const My=W("$ZodTuple",(t,e)=>{Xe.init(t,e);const r=e.items;t._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];const a=[],u=Dd(r,"optin"),l=Dd(r,"optout");if(!e.rest){if(o.length<u)return n.issues.push({code:"too_small",minimum:u,inclusive:!0,input:o,inst:t,origin:"array"}),n;o.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:o,inst:t,origin:"array"})}const h=new Array(r.length);for(let d=0;d<r.length;d++){const m=r[d]._zod.run({value:o[d],issues:[]},i);m instanceof Promise?a.push(m.then(y=>{h[d]=y})):h[d]=m}if(e.rest){let d=r.length-1;const m=o.slice(r.length);for(const y of m){d++;const w=e.rest._zod.run({value:y,issues:[]},i);w instanceof Promise?a.push(w.then(T=>Ld(T,n,d))):Ld(w,n,d)}}return a.length?Promise.all(a).then(()=>Ud(h,n,r,o,l)):Ud(h,n,r,o,l)}});function Dd(t,e){for(let r=t.length-1;r>=0;r--)if(t[r]._zod[e]!=="optional")return r+1;return 0}function Ld(t,e,r){t.issues.length&&e.issues.push(...En(r,t.issues)),e.value[r]=t.value}function Ud(t,e,r,n,i){for(let o=0;o<r.length;o++){const a=t[o],u=o<n.length;if(a.issues.length){if(!u&&o>=i){e.value.length=o;break}e.issues.push(...En(o,a.issues))}e.value[o]=a.value}for(let o=e.value.length-1;o>=n.length&&(r[o]._zod.optout==="optional"&&e.value[o]===void 0);o--)e.value.length=o;return e}const dE=W("$ZodRecord",(t,e)=>{Xe.init(t,e),t._zod.parse=(r,n)=>{const i=r.value;if(!_i(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;const o=[],a=e.keyType._zod.values;if(a){r.value={};const u=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){u.add(typeof h=="number"?h.toString():h);const d=e.keyType._zod.run({value:h,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(w=>rn(w,n,tn())),input:h,path:[h],inst:t});continue}const m=d.value,y=e.valueType._zod.run({value:i[h],issues:[]},n);y instanceof Promise?o.push(y.then(w=>{w.issues.length&&r.issues.push(...En(h,w.issues)),r.value[m]=w.value})):(y.issues.length&&r.issues.push(...En(h,y.issues)),r.value[m]=y.value)}let l;for(const h in i)u.has(h)||(l=l??[],l.push(h));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(const u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=e.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&ky.test(u)&&l.issues.length){const m=e.keyType._zod.run({value:Number(u),issues:[]},n);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){e.mode==="loose"?r.value[u]=i[u]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>rn(m,n,tn())),input:u,path:[u],inst:t});continue}const d=e.valueType._zod.run({value:i[u],issues:[]},n);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...En(u,m.issues)),r.value[l.value]=m.value})):(d.issues.length&&r.issues.push(...En(u,d.issues)),r.value[l.value]=d.value)}}return o.length?Promise.all(o).then(()=>r):r}}),pE=W("$ZodEnum",(t,e)=>{Xe.init(t,e);const r=vy(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>A4.has(typeof i)).map(i=>typeof i=="string"?Fi(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{const a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:t}),i}}),mE=W("$ZodLiteral",(t,e)=>{if(Xe.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Fi(n):n?Fi(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{const o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}}),gE=W("$ZodTransform",(t,e)=>{Xe.init(t,e),t._zod.optin="optional",t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ey(t.constructor.name);const i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r.fallback=!0,r));if(i instanceof Promise)throw new Pi;return r.value=i,r.fallback=!0,r}});function Md(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const zy=W("$ZodOptional",(t,e)=>{Xe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Ye(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Ye(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ph(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){const i=r.value,o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>Md(a,i)):Md(o,i)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),yE=W("$ZodExactOptional",(t,e)=>{zy.init(t,e),Ye(t._zod,"values",()=>e.innerType._zod.values),Ye(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),bE=W("$ZodNullable",(t,e)=>{Xe.init(t,e),Ye(t._zod,"optin",()=>e.innerType._zod.optin),Ye(t._zod,"optout",()=>e.innerType._zod.optout),Ye(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ph(r.source)}|null)$`):void 0}),Ye(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),xE=W("$ZodDefault",(t,e)=>{Xe.init(t,e),t._zod.optin="optional",Ye(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>zd(o,e)):zd(i,e)}});function zd(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const wE=W("$ZodPrefault",(t,e)=>{Xe.init(t,e),t._zod.optin="optional",Ye(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),AE=W("$ZodNonOptional",(t,e)=>{Xe.init(t,e),Ye(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>$d(o,t)):$d(i,t)}});function $d(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const EE=W("$ZodCatch",(t,e)=>{Xe.init(t,e),t._zod.optin="optional",Ye(t._zod,"optout",()=>e.innerType._zod.optout),Ye(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(a=>rn(a,n,tn()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>rn(o,n,tn()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),vE=W("$ZodPipe",(t,e)=>{Xe.init(t,e),Ye(t._zod,"values",()=>e.in._zod.values),Ye(t._zod,"optin",()=>e.in._zod.optin),Ye(t._zod,"optout",()=>e.out._zod.optout),Ye(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=e.out._zod.run(r,n);return o instanceof Promise?o.then(a=>_o(a,e.in,n)):_o(o,e.in,n)}const i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>_o(o,e.out,n)):_o(i,e.out,n)}});function _o(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}const RE=W("$ZodReadonly",(t,e)=>{Xe.init(t,e),Ye(t._zod,"propValues",()=>e.innerType._zod.propValues),Ye(t._zod,"values",()=>e.innerType._zod.values),Ye(t._zod,"optin",()=>e.innerType?._zod?.optin),Ye(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(Vd):Vd(i)}});function Vd(t){return t.value=Object.freeze(t.value),t}const TE=W("$ZodFunction",(t,e)=>(Xe.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){const i=t._def.input?Id(t._def.input,n):n,o=Reflect.apply(r,this,i);return t._def.output?Id(t._def.output,o):o}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){const i=t._def.input?await kd(t._def.input,n):n,o=await Reflect.apply(r,this,i);return t._def.output?await kd(t._def.output,o):o}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{const n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new My({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{const n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),BE=W("$ZodCustom",(t,e)=>{tr.init(t,e),Xe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>Gd(o,r,n,t));Gd(i,r,n,t)}});function Gd(t,e,r,n){if(!t){const i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push($s(i))}}var jd;class SE{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function PE(){return new SE}(jd=globalThis).__zod_globalRegistry??(jd.__zod_globalRegistry=PE());const Os=globalThis.__zod_globalRegistry;function OE(t,e){return new t({type:"string",...Re(e)})}function IE(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Re(e)})}function Hd(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Re(e)})}function kE(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Re(e)})}function NE(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Re(e)})}function CE(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Re(e)})}function _E(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Re(e)})}function FE(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Re(e)})}function DE(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Re(e)})}function LE(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Re(e)})}function UE(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Re(e)})}function ME(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Re(e)})}function zE(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Re(e)})}function $E(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Re(e)})}function VE(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Re(e)})}function GE(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Re(e)})}function jE(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Re(e)})}function HE(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Re(e)})}function qE(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Re(e)})}function ZE(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Re(e)})}function KE(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Re(e)})}function JE(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Re(e)})}function WE(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Re(e)})}function QE(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Re(e)})}function YE(t,e){return new t({type:"string",format:"date",check:"string_format",...Re(e)})}function XE(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Re(e)})}function ev(t,e){return new t({type:"string",format:"duration",check:"string_format",...Re(e)})}function tv(t,e){return new t({type:"number",checks:[],...Re(e)})}function rv(t,e){return new t({type:"number",coerce:!0,checks:[],...Re(e)})}function nv(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Re(e)})}function iv(t,e){return new t({type:"boolean",...Re(e)})}function sv(t,e){return new t({type:"bigint",...Re(e)})}function ov(t){return new t({type:"any"})}function av(t){return new t({type:"unknown"})}function cv(t,e){return new t({type:"never",...Re(e)})}function ga(t,e){return new Cy({check:"less_than",...Re(e),value:t,inclusive:!1})}function Oi(t,e){return new Cy({check:"less_than",...Re(e),value:t,inclusive:!0})}function ya(t,e){return new _y({check:"greater_than",...Re(e),value:t,inclusive:!1})}function An(t,e){return new _y({check:"greater_than",...Re(e),value:t,inclusive:!0})}function Df(t,e){return new y6({check:"multiple_of",...Re(e),value:t})}function $y(t,e){return new x6({check:"max_length",...Re(e),maximum:t})}function ba(t,e){return new w6({check:"min_length",...Re(e),minimum:t})}function Vy(t,e){return new A6({check:"length_equals",...Re(e),length:t})}function uv(t,e){return new E6({check:"string_format",format:"regex",...Re(e),pattern:t})}function lv(t){return new v6({check:"string_format",format:"lowercase",...Re(t)})}function fv(t){return new R6({check:"string_format",format:"uppercase",...Re(t)})}function hv(t,e){return new T6({check:"string_format",format:"includes",...Re(e),includes:t})}function dv(t,e){return new B6({check:"string_format",format:"starts_with",...Re(e),prefix:t})}function pv(t,e){return new S6({check:"string_format",format:"ends_with",...Re(e),suffix:t})}function Ji(t){return new P6({check:"overwrite",tx:t})}function mv(t){return Ji(e=>e.normalize(t))}function gv(){return Ji(t=>t.trim())}function yv(){return Ji(t=>t.toLowerCase())}function bv(){return Ji(t=>t.toUpperCase())}function xv(){return Ji(t=>x4(t))}function wv(t,e,r){return new t({type:"array",element:e,...Re(r)})}function Av(t,e,r){return new t({type:"custom",check:"custom",fn:e,...Re(r)})}function Ev(t,e){const r=vv(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push($s(i,n.value,r._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push($s(o))}},t(n.value,n)),e);return r}function vv(t,e){const r=new tr({check:"custom",...Re(e)});return r._zod.check=t,r}function Gy(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Os,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function bt(t,e,r={path:[],schemaPath:[]}){var n;const i=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);const u=t._zod.toJSONSchema?.();if(u)a.schema=u;else{const d={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,d);else{const y=a.schema,w=e.processors[i.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);w(t,e,y,d)}const m=t._zod.parent;m&&(a.ref||(a.ref=m),bt(m,e,d),e.seen.get(m).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(a.schema,l),e.io==="input"&&qt(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&"_prefault"in a.schema&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function jy(t,e){const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const a of t.seen.entries()){const u=t.metadataRegistry.get(a[0])?.id;if(u){const l=n.get(u);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(u,a[0])}}const i=a=>{const u=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const m=t.external.registry.get(a[0])?.id,y=t.external.uri??(T=>T);if(m)return{ref:y(m)};const w=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=w,{defId:w,ref:`${y("__shared")}#/${u}/${w}`}}if(a[1]===r)return{ref:"#"};const h=`#/${u}/`,d=a[1].schema.id??`__schema${t.counter++}`;return{defId:d,ref:h+d}},o=a=>{if(a[1].schema.$ref)return;const u=a[1],{ref:l,defId:h}=i(a);u.def={...u.schema},h&&(u.defId=h);const d=u.schema;for(const m in d)delete d[m];d.$ref=l};if(t.cycles==="throw")for(const a of t.seen.entries()){const u=a[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
72
+
73
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of t.seen.entries()){const u=a[1];if(e===a[0]){o(a);continue}if(t.external){const h=t.external.registry.get(a[0])?.id;if(e!==a[0]&&h){o(a);continue}}if(t.metadataRegistry.get(a[0])?.id){o(a);continue}if(u.cycle){o(a);continue}if(u.count>1&&t.reused==="ref"){o(a);continue}}}function Hy(t,e){const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=u=>{const l=t.seen.get(u);if(l.ref===null)return;const h=l.def??l.schema,d={...h},m=l.ref;if(l.ref=null,m){n(m);const w=t.seen.get(m),T=w.schema;if(T.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(T)):Object.assign(h,T),Object.assign(h,d),u._zod.parent===m)for(const O in h)O==="$ref"||O==="allOf"||O in d||delete h[O];if(T.$ref&&w.def)for(const O in h)O==="$ref"||O==="allOf"||O in w.def&&JSON.stringify(h[O])===JSON.stringify(w.def[O])&&delete h[O]}const y=u._zod.parent;if(y&&y!==m){n(y);const w=t.seen.get(y);if(w?.schema.$ref&&(h.$ref=w.schema.$ref,w.def))for(const T in h)T==="$ref"||T==="allOf"||T in w.def&&JSON.stringify(h[T])===JSON.stringify(w.def[T])&&delete h[T]}t.override({zodSchema:u,jsonSchema:h,path:l.path??[]})};for(const u of[...t.seen.entries()].reverse())n(u[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const u=t.external.registry.get(e)?.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(u)}Object.assign(i,r.def??r.schema);const o=t.metadataRegistry.get(e)?.id;o!==void 0&&i.id===o&&delete i.id;const a=t.external?.defs??{};for(const u of t.seen.entries()){const l=u[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}t.external||Object.keys(a).length>0&&(t.target==="draft-2020-12"?i.$defs=a:i.definitions=a);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...e["~standard"],jsonSchema:{input:xa(e,"input",t.processors),output:xa(e,"output",t.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function qt(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return qt(n.element,r);if(n.type==="set")return qt(n.valueType,r);if(n.type==="lazy")return qt(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return qt(n.innerType,r);if(n.type==="intersection")return qt(n.left,r)||qt(n.right,r);if(n.type==="record"||n.type==="map")return qt(n.keyType,r)||qt(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:qt(n.in,r)||qt(n.out,r);if(n.type==="object"){for(const i in n.shape)if(qt(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(const i of n.options)if(qt(i,r))return!0;return!1}if(n.type==="tuple"){for(const i of n.items)if(qt(i,r))return!0;return!!(n.rest&&qt(n.rest,r))}return!1}const Rv=(t,e={})=>r=>{const n=Gy({...r,processors:e});return bt(t,n),jy(n,t),Hy(n,t)},xa=(t,e,r={})=>n=>{const{libraryOptions:i,target:o}=n??{},a=Gy({...i??{},target:o,io:e,processors:r});return bt(t,a),jy(a,t),Hy(a,t)},Tv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bv=(t,e,r,n)=>{const i=r;i.type="string";const{minimum:o,maximum:a,format:u,patterns:l,contentEncoding:h}=t._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),u&&(i.format=Tv[u]??u,i.format===""&&delete i.format,u==="time"&&delete i.format),h&&(i.contentEncoding=h),l&&l.size>0){const d=[...l];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(m=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Sv=(t,e,r,n)=>{const i=r,{minimum:o,maximum:a,format:u,multipleOf:l,exclusiveMaximum:h,exclusiveMinimum:d}=t._zod.bag;typeof u=="string"&&u.includes("int")?i.type="integer":i.type="number";const m=typeof d=="number"&&d>=(o??Number.NEGATIVE_INFINITY),y=typeof h=="number"&&h<=(a??Number.POSITIVE_INFINITY),w=e.target==="draft-04"||e.target==="openapi-3.0";m?w?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d:typeof o=="number"&&(i.minimum=o),y?w?(i.maximum=h,i.exclusiveMaximum=!0):i.exclusiveMaximum=h:typeof a=="number"&&(i.maximum=a),typeof l=="number"&&(i.multipleOf=l)},Pv=(t,e,r,n)=>{r.type="boolean"},Ov=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Iv=(t,e,r,n)=>{r.not={}},kv=(t,e,r,n)=>{},Nv=(t,e,r,n)=>{},Cv=(t,e,r,n)=>{const i=t._zod.def,o=vy(i.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},_v=(t,e,r,n)=>{const i=t._zod.def,o=[];for(const a of i.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){const a=o[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},Fv=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Dv=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Lv=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Uv=(t,e,r,n)=>{const i=r,o=t._zod.def,{minimum:a,maximum:u}=t._zod.bag;typeof a=="number"&&(i.minItems=a),typeof u=="number"&&(i.maxItems=u),i.type="array",i.items=bt(o.element,e,{...n,path:[...n.path,"items"]})},Mv=(t,e,r,n)=>{const i=r,o=t._zod.def;i.type="object",i.properties={};const a=o.shape;for(const h in a)i.properties[h]=bt(a[h],e,{...n,path:[...n.path,"properties",h]});const u=new Set(Object.keys(a)),l=new Set([...u].filter(h=>{const d=o.shape[h]._zod;return e.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(i.required=Array.from(l)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=bt(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},zv=(t,e,r,n)=>{const i=t._zod.def,o=i.inclusive===!1,a=i.options.map((u,l)=>bt(u,e,{...n,path:[...n.path,o?"oneOf":"anyOf",l]}));o?r.oneOf=a:r.anyOf=a},$v=(t,e,r,n)=>{const i=t._zod.def,o=bt(i.left,e,{...n,path:[...n.path,"allOf",0]}),a=bt(i.right,e,{...n,path:[...n.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,l=[...u(o)?o.allOf:[o],...u(a)?a.allOf:[a]];r.allOf=l},Vv=(t,e,r,n)=>{const i=r,o=t._zod.def;i.type="array";const a=e.target==="draft-2020-12"?"prefixItems":"items",u=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((y,w)=>bt(y,e,{...n,path:[...n.path,a,w]})),h=o.rest?bt(o.rest,e,{...n,path:[...n.path,u,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=l,h&&(i.items=h)):e.target==="openapi-3.0"?(i.items={anyOf:l},h&&i.items.anyOf.push(h),i.minItems=l.length,h||(i.maxItems=l.length)):(i.items=l,h&&(i.additionalItems=h));const{minimum:d,maximum:m}=t._zod.bag;typeof d=="number"&&(i.minItems=d),typeof m=="number"&&(i.maxItems=m)},Gv=(t,e,r,n)=>{const i=r,o=t._zod.def;i.type="object";const a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){const d=bt(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(const m of l)i.patternProperties[m.source]=d}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=bt(o.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=bt(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]});const h=a._zod.values;if(h){const d=[...h].filter(m=>typeof m=="string"||typeof m=="number");d.length>0&&(i.required=d)}},jv=(t,e,r,n)=>{const i=t._zod.def,o=bt(i.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Hv=(t,e,r,n)=>{const i=t._zod.def;bt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType},qv=(t,e,r,n)=>{const i=t._zod.def;bt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Zv=(t,e,r,n)=>{const i=t._zod.def;bt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Kv=(t,e,r,n)=>{const i=t._zod.def;bt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Jv=(t,e,r,n)=>{const i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),a=e.io==="input"?o?i.out:i.in:i.out;bt(a,e,n);const u=e.seen.get(t);u.ref=a},Wv=(t,e,r,n)=>{const i=t._zod.def;bt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType,r.readOnly=!0},qy=(t,e,r,n)=>{const i=t._zod.def;bt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType},Qv=W("ZodISODateTime",(t,e)=>{V6.init(t,e),gt.init(t,e)});function Yv(t){return QE(Qv,t)}const Xv=W("ZodISODate",(t,e)=>{G6.init(t,e),gt.init(t,e)});function e5(t){return YE(Xv,t)}const t5=W("ZodISOTime",(t,e)=>{j6.init(t,e),gt.init(t,e)});function r5(t){return XE(t5,t)}const n5=W("ZodISODuration",(t,e)=>{H6.init(t,e),gt.init(t,e)});function i5(t){return ev(n5,t)}const s5=(t,e)=>{Sy.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>C4(t,r)},flatten:{value:r=>N4(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,_f,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,_f,2)}},isEmpty:{get(){return t.issues.length===0}}})},Ar=W("ZodError",s5,{Parent:Error}),o5=Fa(Ar),a5=Da(Ar),c5=La(Ar),u5=Ua(Ar),l5=D4(Ar),f5=L4(Ar),h5=U4(Ar),d5=M4(Ar),p5=z4(Ar),m5=$4(Ar),g5=V4(Ar),y5=G4(Ar),qd=new WeakMap;function no(t,e,r){const n=Object.getPrototypeOf(t);let i=qd.get(n);if(i||(i=new Set,qd.set(n,i)),!i.has(e)){i.add(e);for(const o in r){const a=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!1,get(){const u=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}}const rt=W("ZodType",(t,e)=>(Xe.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:xa(t,"input"),output:xa(t,"output")}}),t.toJSONSchema=Rv(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>o5(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>c5(t,r,n),t.parseAsync=async(r,n)=>a5(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>u5(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>l5(t,r,n),t.decode=(r,n)=>f5(t,r,n),t.encodeAsync=async(r,n)=>h5(t,r,n),t.decodeAsync=async(r,n)=>d5(t,r,n),t.safeEncode=(r,n)=>p5(t,r,n),t.safeDecode=(r,n)=>m5(t,r,n),t.safeEncodeAsync=async(r,n)=>g5(t,r,n),t.safeDecodeAsync=async(r,n)=>y5(t,r,n),no(t,"ZodType",{check(...r){const n=this.def;return this.clone(Pn(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return On(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(g7(r,n))},superRefine(r,n){return this.check(y7(r,n))},overwrite(r){return this.check(Ji(r))},optional(){return Vs(this)},exactOptional(){return r7(this)},nullable(){return Wd(this)},nullish(){return Vs(Wd(this))},nonoptional(r){return c7(this,r)},array(){return Dt(this)},or(r){return q5([this,r])},and(r){return K5(this,r)},transform(r){return Qd(this,e7(r))},default(r){return s7(this,r)},prefault(r){return a7(this,r)},catch(r){return l7(this,r)},pipe(r){return Qd(this,r)},readonly(){return d7(this)},describe(r){const n=this.clone();return Os.add(n,{description:r}),n},meta(...r){if(r.length===0)return Os.get(this);const n=this.clone();return Os.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return Os.get(t)?.description},configurable:!0}),t)),Zy=W("_ZodString",(t,e)=>{gh.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Bv(t,n,i);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,no(t,"_ZodString",{regex(...n){return this.check(uv(...n))},includes(...n){return this.check(hv(...n))},startsWith(...n){return this.check(dv(...n))},endsWith(...n){return this.check(pv(...n))},min(...n){return this.check(ba(...n))},max(...n){return this.check($y(...n))},length(...n){return this.check(Vy(...n))},nonempty(...n){return this.check(ba(1,...n))},lowercase(n){return this.check(lv(n))},uppercase(n){return this.check(fv(n))},trim(){return this.check(gv())},normalize(...n){return this.check(mv(...n))},toLowerCase(){return this.check(yv())},toUpperCase(){return this.check(bv())},slugify(){return this.check(xv())}})}),b5=W("ZodString",(t,e)=>{gh.init(t,e),Zy.init(t,e),t.email=r=>t.check(IE(x5,r)),t.url=r=>t.check(FE(w5,r)),t.jwt=r=>t.check(WE(F5,r)),t.emoji=r=>t.check(DE(A5,r)),t.guid=r=>t.check(Hd(Zd,r)),t.uuid=r=>t.check(kE(Fo,r)),t.uuidv4=r=>t.check(NE(Fo,r)),t.uuidv6=r=>t.check(CE(Fo,r)),t.uuidv7=r=>t.check(_E(Fo,r)),t.nanoid=r=>t.check(LE(E5,r)),t.guid=r=>t.check(Hd(Zd,r)),t.cuid=r=>t.check(UE(v5,r)),t.cuid2=r=>t.check(ME(R5,r)),t.ulid=r=>t.check(zE(T5,r)),t.base64=r=>t.check(ZE(N5,r)),t.base64url=r=>t.check(KE(C5,r)),t.xid=r=>t.check($E(B5,r)),t.ksuid=r=>t.check(VE(S5,r)),t.ipv4=r=>t.check(GE(P5,r)),t.ipv6=r=>t.check(jE(O5,r)),t.cidrv4=r=>t.check(HE(I5,r)),t.cidrv6=r=>t.check(qE(k5,r)),t.e164=r=>t.check(JE(_5,r)),t.datetime=r=>t.check(Yv(r)),t.date=r=>t.check(e5(r)),t.time=r=>t.check(r5(r)),t.duration=r=>t.check(i5(r))});function ce(t){return OE(b5,t)}const gt=W("ZodStringFormat",(t,e)=>{ft.init(t,e),Zy.init(t,e)}),x5=W("ZodEmail",(t,e)=>{C6.init(t,e),gt.init(t,e)}),Zd=W("ZodGUID",(t,e)=>{k6.init(t,e),gt.init(t,e)}),Fo=W("ZodUUID",(t,e)=>{N6.init(t,e),gt.init(t,e)}),w5=W("ZodURL",(t,e)=>{_6.init(t,e),gt.init(t,e)}),A5=W("ZodEmoji",(t,e)=>{F6.init(t,e),gt.init(t,e)}),E5=W("ZodNanoID",(t,e)=>{D6.init(t,e),gt.init(t,e)}),v5=W("ZodCUID",(t,e)=>{L6.init(t,e),gt.init(t,e)}),R5=W("ZodCUID2",(t,e)=>{U6.init(t,e),gt.init(t,e)}),T5=W("ZodULID",(t,e)=>{M6.init(t,e),gt.init(t,e)}),B5=W("ZodXID",(t,e)=>{z6.init(t,e),gt.init(t,e)}),S5=W("ZodKSUID",(t,e)=>{$6.init(t,e),gt.init(t,e)}),P5=W("ZodIPv4",(t,e)=>{q6.init(t,e),gt.init(t,e)}),O5=W("ZodIPv6",(t,e)=>{Z6.init(t,e),gt.init(t,e)}),I5=W("ZodCIDRv4",(t,e)=>{K6.init(t,e),gt.init(t,e)}),k5=W("ZodCIDRv6",(t,e)=>{J6.init(t,e),gt.init(t,e)}),N5=W("ZodBase64",(t,e)=>{W6.init(t,e),gt.init(t,e)}),C5=W("ZodBase64URL",(t,e)=>{Y6.init(t,e),gt.init(t,e)}),_5=W("ZodE164",(t,e)=>{X6.init(t,e),gt.init(t,e)}),F5=W("ZodJWT",(t,e)=>{tE.init(t,e),gt.init(t,e)}),yh=W("ZodNumber",(t,e)=>{Dy.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Sv(t,n,i),no(t,"ZodNumber",{gt(n,i){return this.check(ya(n,i))},gte(n,i){return this.check(An(n,i))},min(n,i){return this.check(An(n,i))},lt(n,i){return this.check(ga(n,i))},lte(n,i){return this.check(Oi(n,i))},max(n,i){return this.check(Oi(n,i))},int(n){return this.check(Kd(n))},safe(n){return this.check(Kd(n))},positive(n){return this.check(ya(0,n))},nonnegative(n){return this.check(An(0,n))},negative(n){return this.check(ga(0,n))},nonpositive(n){return this.check(Oi(0,n))},multipleOf(n,i){return this.check(Df(n,i))},step(n,i){return this.check(Df(n,i))},finite(){return this}});const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function me(t){return tv(yh,t)}const D5=W("ZodNumberFormat",(t,e)=>{rE.init(t,e),yh.init(t,e)});function Kd(t){return nv(D5,t)}const L5=W("ZodBoolean",(t,e)=>{nE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Pv(t,r,n)});function Qe(t){return iv(L5,t)}const U5=W("ZodBigInt",(t,e)=>{iE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Ov(t,n),t.gte=(n,i)=>t.check(An(n,i)),t.min=(n,i)=>t.check(An(n,i)),t.gt=(n,i)=>t.check(ya(n,i)),t.gte=(n,i)=>t.check(An(n,i)),t.min=(n,i)=>t.check(An(n,i)),t.lt=(n,i)=>t.check(ga(n,i)),t.lte=(n,i)=>t.check(Oi(n,i)),t.max=(n,i)=>t.check(Oi(n,i)),t.positive=n=>t.check(ya(BigInt(0),n)),t.negative=n=>t.check(ga(BigInt(0),n)),t.nonpositive=n=>t.check(Oi(BigInt(0),n)),t.nonnegative=n=>t.check(An(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(Df(n,i));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function Ky(t){return sv(U5,t)}const M5=W("ZodAny",(t,e)=>{sE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>kv()});function Xn(){return ov(M5)}const z5=W("ZodUnknown",(t,e)=>{oE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Nv()});function Di(){return av(z5)}const $5=W("ZodNever",(t,e)=>{aE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Iv(t,r,n)});function V5(t){return cv($5,t)}const G5=W("ZodArray",(t,e)=>{cE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Uv(t,r,n,i),t.element=e.element,no(t,"ZodArray",{min(r,n){return this.check(ba(r,n))},nonempty(r){return this.check(ba(1,r))},max(r,n){return this.check($y(r,n))},length(r,n){return this.check(Vy(r,n))},unwrap(){return this.element}})});function Dt(t,e){return wv(G5,t,e)}const j5=W("ZodObject",(t,e)=>{lE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Mv(t,r,n,i),Ye(t,"shape",()=>e.shape),no(t,"ZodObject",{keyof(){return Wy(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Di()})},loose(){return this.clone({...this._zod.def,catchall:Di()})},strict(){return this.clone({...this._zod.def,catchall:V5()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return B4(this,r)},safeExtend(r){return S4(this,r)},merge(r){return P4(this,r)},pick(r){return R4(this,r)},omit(r){return T4(this,r)},partial(...r){return O4(Qy,this,r[0])},required(...r){return I4(Yy,this,r[0])}})});function ve(t,e){const r={type:"object",shape:t??{},...Re(e)};return new j5(r)}const H5=W("ZodUnion",(t,e)=>{fE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>zv(t,r,n,i),t.options=e.options});function q5(t,e){return new H5({type:"union",options:t,...Re(e)})}const Z5=W("ZodIntersection",(t,e)=>{hE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>$v(t,r,n,i)});function K5(t,e){return new Z5({type:"intersection",left:t,right:e})}const J5=W("ZodTuple",(t,e)=>{My.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Vv(t,r,n,i),t.rest=r=>t.clone({...t._zod.def,rest:r})});function W5(t,e,r){const n=e instanceof Xe,i=n?r:e,o=n?e:null;return new J5({type:"tuple",items:t,rest:o,...Re(i)})}const Jd=W("ZodRecord",(t,e)=>{dE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Gv(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType});function Jy(t,e,r){return!e||!e._zod?new Jd({type:"record",keyType:ce(),valueType:t,...Re(e)}):new Jd({type:"record",keyType:t,valueType:e,...Re(r)})}const Lf=W("ZodEnum",(t,e)=>{pE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Cv(t,n,i),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{const o={};for(const a of n)if(r.has(a))o[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Lf({...e,checks:[],...Re(i),entries:o})},t.exclude=(n,i)=>{const o={...e.entries};for(const a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new Lf({...e,checks:[],...Re(i),entries:o})}});function Wy(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Lf({type:"enum",entries:r,...Re(e)})}const Q5=W("ZodLiteral",(t,e)=>{mE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>_v(t,r,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Y5(t,e){return new Q5({type:"literal",values:Array.isArray(t)?t:[t],...Re(e)})}const X5=W("ZodTransform",(t,e)=>{gE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Lv(t,r),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ey(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push($s(o,r.value,e));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push($s(a))}};const i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function e7(t){return new X5({type:"transform",transform:t})}const Qy=W("ZodOptional",(t,e)=>{zy.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>qy(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Vs(t){return new Qy({type:"optional",innerType:t})}const t7=W("ZodExactOptional",(t,e)=>{yE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>qy(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function r7(t){return new t7({type:"optional",innerType:t})}const n7=W("ZodNullable",(t,e)=>{bE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>jv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Wd(t){return new n7({type:"nullable",innerType:t})}const i7=W("ZodDefault",(t,e)=>{xE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>qv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function s7(t,e){return new i7({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Ty(e)}})}const o7=W("ZodPrefault",(t,e)=>{wE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Zv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function a7(t,e){return new o7({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Ty(e)}})}const Yy=W("ZodNonOptional",(t,e)=>{AE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Hv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function c7(t,e){return new Yy({type:"nonoptional",innerType:t,...Re(e)})}const u7=W("ZodCatch",(t,e)=>{EE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Kv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function l7(t,e){return new u7({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const f7=W("ZodPipe",(t,e)=>{vE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Jv(t,r,n,i),t.in=e.in,t.out=e.out});function Qd(t,e){return new f7({type:"pipe",in:t,out:e})}const h7=W("ZodReadonly",(t,e)=>{RE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Wv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function d7(t){return new h7({type:"readonly",innerType:t})}const p7=W("ZodFunction",(t,e)=>{TE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Dv(t,r)});function Xy(t){return new p7({type:"function",input:Array.isArray(t?.input)?W5(t?.input):Dt(Di()),output:Di()})}const m7=W("ZodCustom",(t,e)=>{BE.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Fv(t,r)});function g7(t,e={}){return Av(m7,t,e)}function y7(t,e){return Ev(t,e)}function eb(t){return rv(yh,t)}var Do={exports:{}},ku,Yd;function b7(){if(Yd)return ku;Yd=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,o=n*365.25;ku=function(d,m){m=m||{};var y=typeof d;if(y==="string"&&d.length>0)return a(d);if(y==="number"&&isFinite(d))return m.long?l(d):u(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function a(d){if(d=String(d),!(d.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(m){var y=parseFloat(m[1]),w=(m[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return y*o;case"weeks":case"week":case"w":return y*i;case"days":case"day":case"d":return y*n;case"hours":case"hour":case"hrs":case"hr":case"h":return y*r;case"minutes":case"minute":case"mins":case"min":case"m":return y*e;case"seconds":case"second":case"secs":case"sec":case"s":return y*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return y;default:return}}}}function u(d){var m=Math.abs(d);return m>=n?Math.round(d/n)+"d":m>=r?Math.round(d/r)+"h":m>=e?Math.round(d/e)+"m":m>=t?Math.round(d/t)+"s":d+"ms"}function l(d){var m=Math.abs(d);return m>=n?h(d,m,n,"day"):m>=r?h(d,m,r,"hour"):m>=e?h(d,m,e,"minute"):m>=t?h(d,m,t,"second"):d+" ms"}function h(d,m,y,w){var T=m>=y*1.5;return Math.round(d/y)+" "+w+(T?"s":"")}return ku}var Nu,Xd;function x7(){if(Xd)return Nu;Xd=1;function t(e){n.debug=n,n.default=n,n.coerce=h,n.disable=u,n.enable=o,n.enabled=l,n.humanize=b7(),n.destroy=d,Object.keys(e).forEach(m=>{n[m]=e[m]}),n.names=[],n.skips=[],n.formatters={};function r(m){let y=0;for(let w=0;w<m.length;w++)y=(y<<5)-y+m.charCodeAt(w),y|=0;return n.colors[Math.abs(y)%n.colors.length]}n.selectColor=r;function n(m){let y,w=null,T,R;function O(...A){if(!O.enabled)return;const I=O,B=Number(new Date),S=B-(y||B);I.diff=S,I.prev=y,I.curr=B,y=B,A[0]=n.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let N=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(D,L)=>{if(D==="%%")return"%";N++;const H=n.formatters[L];if(typeof H=="function"){const K=A[N];D=H.call(I,K),A.splice(N,1),N--}return D}),n.formatArgs.call(I,A),(I.log||n.log).apply(I,A)}return O.namespace=m,O.useColors=n.useColors(),O.color=n.selectColor(m),O.extend=i,O.destroy=n.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(T!==n.namespaces&&(T=n.namespaces,R=n.enabled(m)),R),set:A=>{w=A}}),typeof n.init=="function"&&n.init(O),O}function i(m,y){const w=n(this.namespace+(typeof y>"u"?":":y)+m);return w.log=this.log,w}function o(m){n.save(m),n.namespaces=m,n.names=[],n.skips=[];const y=(typeof m=="string"?m:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const w of y)w[0]==="-"?n.skips.push(w.slice(1)):n.names.push(w)}function a(m,y){let w=0,T=0,R=-1,O=0;for(;w<m.length;)if(T<y.length&&(y[T]===m[w]||y[T]==="*"))y[T]==="*"?(R=T,O=w,T++):(w++,T++);else if(R!==-1)T=R+1,O++,w=O;else return!1;for(;T<y.length&&y[T]==="*";)T++;return T===y.length}function u(){const m=[...n.names,...n.skips.map(y=>"-"+y)].join(",");return n.enable(""),m}function l(m){for(const y of n.skips)if(a(m,y))return!1;for(const y of n.names)if(a(m,y))return!0;return!1}function h(m){return m instanceof Error?m.stack||m.message:m}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return Nu=t,Nu}var ep;function w7(){return ep||(ep=1,(function(t,e){var r={};e.formatArgs=i,e.save=o,e.load=a,e.useColors=n,e.storage=u(),e.destroy=(()=>{let h=!1;return()=>{h||(h=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let h;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(h=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(h[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(h){if(h[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+h[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;h.splice(1,0,d,"color: inherit");let m=0,y=0;h[0].replace(/%[a-zA-Z%]/g,w=>{w!=="%%"&&(m++,w==="%c"&&(y=m))}),h.splice(y,0,d)}e.log=console.debug||console.log||(()=>{});function o(h){try{h?e.storage.setItem("debug",h):e.storage.removeItem("debug")}catch{}}function a(){let h;try{h=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!h&&typeof Ce<"u"&&"env"in Ce&&(h=r.DEBUG),h}function u(){try{return localStorage}catch{}}t.exports=x7()(e);const{formatters:l}=t.exports;l.j=function(h){try{return JSON.stringify(h)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(Do,Do.exports)),Do.exports}var A7=w7();const bh=lh(A7),tp=ce().regex(/^(?:0x)?[0-9a-fA-F]*$/i,"expected hex string").refine(t=>t.replace(/^0x/i,"").length%2===0,"expected even-length hex string"),E7=bh("bee-js:bytes"),v7=new TextDecoder,R7=new TextEncoder;class Le{constructor(e,r){if(!e)throw Error(`Bytes#constructor: constructor parameter is falsy: ${e}`);if(e instanceof Le)this.bytes=e.bytes;else if(typeof e=="string")this.bytes=G.Binary.hexToUint8Array(tp.parse(e));else if(e instanceof ArrayBuffer)this.bytes=new Uint8Array(e);else if(e instanceof Uint8Array)this.bytes=e;else{const n=e,i=G.Objects.getDeep(n,"toHex");if(Xy().safeParse(i).success){const o=i.call(n);this.bytes=G.Binary.hexToUint8Array(tp.parse(o))}else throw E7("bytes",e),new Error(`Bytes#constructor: unsupported type: ${typeof e}`)}if(this.length=this.bytes.length,r){if(Array.isArray(r)){if(!r.includes(this.length))throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${r.join(" or ")}`)}else if(this.length!==r)throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${r}`)}}static keccak256(e){return new Le(G.Binary.keccak256(new Le(e).toUint8Array()))}static fromUtf8(e){return new Le(R7.encode(e))}static fromSlice(e,r,n){return n===void 0?new Le(e.slice(r)):new Le(e.slice(r,r+n))}offset(e){return new Uint8Array(this.bytes.slice(e))}toUint8Array(){return new Uint8Array(this.bytes)}toHex(){return G.Binary.uint8ArrayToHex(this.bytes)}toBase64(){return G.Binary.uint8ArrayToBase64(this.bytes)}toBase32(){return G.Binary.uint8ArrayToBase32(this.bytes)}toString(){return this.toHex()}toUtf8(){return v7.decode(this.bytes)}toJSON(){return JSON.parse(this.toUtf8())}equals(e){return this.toHex()===new Le(e).toHex()}represent(){return this.toHex()}}function tb(t){const e={B:1,kB:1e3,MB:1e6,GB:1e9,TB:1e12,PB:1e15},r=t.match(/^([\d.]+)\s*(B|kB|MB|GB|TB|PB)$/);if(!r)throw new Error(`Invalid size format: ${t}`);const n=parseFloat(r[1]),i=r[2];return Math.ceil(n*e[i])}const rb=250,nb=251,rp={[rb]:"manifest",[nb]:"feed"};function T7(t,e){t=new Pe(t);const r="b",n=new Uint8Array([1]),i=new Uint8Array([e==="feed"?nb:rb]),o=new Uint8Array([1]),a=new Uint8Array([27]),u=new Uint8Array([32]),l=G.Binary.uint8ArrayToBase32(G.Binary.concatBytes(n,i,o,a,u)).replace(/\=+$/,""),h=t.toBase32().replace(/\=+$/,"");return`${r}${l}${h}`.toLowerCase()}function B7(t){const e=G.Binary.base32ToUint8Array(t.toUpperCase().slice(1)),r=e[1];if(!rp[r])throw new Error("Unknown codec");const n=new Pe(e.slice(-32));return{type:rp[r],reference:n}}const Li=new TextEncoder;class qr extends Le{constructor(e){super(e,32)}publicKey(){const[e,r]=G.Elliptic.privateKeyToPublicKey(G.Binary.uint256ToNumber(this.bytes,"BE"));return new br(G.Binary.concatBytes(G.Binary.numberToUint256(e,"BE"),G.Binary.numberToUint256(r,"BE")))}sign(e){const r=G.Binary.concatBytes(Li.encode(`Ethereum Signed Message:
74
+ 32`),G.Binary.keccak256(e instanceof Uint8Array?e:Li.encode(e))),[n,i,o]=G.Elliptic.signMessage(r,G.Binary.uint256ToNumber(this.bytes,"BE"));return new Sn(G.Binary.concatBytes(G.Binary.numberToUint256(n,"BE"),G.Binary.numberToUint256(i,"BE"),new Uint8Array([Number(o)])))}}qr.LENGTH=32;class br extends Le{constructor(e){const r=new Le(e);if(r.length===33){const[n,i]=G.Elliptic.publicKeyFromCompressed(r.toUint8Array());super(G.Binary.concatBytes(G.Binary.numberToUint256(n,"BE"),G.Binary.numberToUint256(i,"BE")),64)}else super(e,64)}address(){const e=G.Binary.uint256ToNumber(this.bytes.slice(0,32),"BE"),r=G.Binary.uint256ToNumber(this.bytes.slice(32,64),"BE");return new $t(G.Elliptic.publicKeyToAddress([e,r]))}toCompressedUint8Array(){const e=G.Binary.uint256ToNumber(this.bytes.slice(0,32),"BE"),r=G.Binary.uint256ToNumber(this.bytes.slice(32,64),"BE");return G.Elliptic.compressPublicKey([e,r])}toCompressedHex(){return G.Binary.uint8ArrayToHex(this.toCompressedUint8Array())}}br.LENGTH=64;class $t extends Le{constructor(e){super(e,20)}toChecksum(){return G.Elliptic.checksumEncode(this.bytes)}}$t.LENGTH=20;class kt extends Le{constructor(e){super(e,32)}static fromString(e){return new kt(G.Binary.keccak256(Li.encode(e)))}}kt.LENGTH=32;class Pe extends Le{constructor(e){if(typeof e=="string"&&e.startsWith("bah5")){const r=B7(e);super(r.reference.bytes,32)}else super(e,[32,64])}toCid(e){return T7(this.bytes,e)}static isValid(e){try{return new Pe(e),!0}catch{return!1}}}Pe.LENGTH=32;class Yr extends Le{constructor(e){super(e,32)}}Yr.LENGTH=32;class Tt extends Le{constructor(e){super(e,8)}static fromBigInt(e){return new Tt(G.Binary.numberToUint64(e,"LE"))}toBigInt(){return G.Binary.uint64ToNumber(this.bytes,"LE")}static fromSlice(e,r){return new Tt(e.slice(r,r+Tt.LENGTH))}}Tt.LENGTH=8;class vr extends Le{constructor(e){super(e,32)}}vr.LENGTH=32;class et extends Le{constructor(e){super(e,32)}}et.LENGTH=32;let Sn=class Uf extends Le{constructor(e){super(e,65)}static fromSlice(e,r){return new Uf(e.slice(r,r+Uf.LENGTH))}recoverPublicKey(e){const r=G.Binary.uint256ToNumber(this.bytes.slice(0,32),"BE"),n=G.Binary.uint256ToNumber(this.bytes.slice(32,64),"BE"),i=BigInt(this.bytes[64]),[o,a]=G.Elliptic.recoverPublicKey(G.Binary.concatBytes(Li.encode(`Ethereum Signed Message:
75
+ 32`),G.Binary.keccak256(e instanceof Uint8Array?e:Li.encode(e))),r,n,i);return new br(G.Binary.concatBytes(G.Binary.numberToUint256(o,"BE"),G.Binary.numberToUint256(a,"BE")))}isValid(e,r){return this.recoverPublicKey(e).address().equals(r)}};Sn.LENGTH=65;class Zr extends Le{constructor(e){super(e,32)}static fromString(e){return new Zr(G.Binary.keccak256(Li.encode(e)))}}Zr.LENGTH=32;const ib=new Uint8Array(8).fill(255,0,8);class Vt extends Le{constructor(e){super(e,8)}static fromBigInt(e){return new Vt(G.Binary.numberToUint64(e,"BE"))}toBigInt(){return G.Binary.uint64ToNumber(this.bytes,"BE")}next(){return G.Binary.equals(this.bytes,ib)?Vt.fromBigInt(0n):Vt.fromBigInt(this.toBigInt()+1n)}}Vt.LENGTH=8;Vt.MINUS_ONE=new Vt(ib);class Or extends Error{constructor(e){super(e)}}class Tr extends Or{constructor(e,r){super(e),this.value=r}}class Gs extends Or{constructor(e,r,n,i,o,a){super(n),this.method=e,this.url=r,this.responseBody=i,this.status=o,this.statusText=a,this.response={status:o,data:i,statusText:a}}}const Cu=4096,S7=32;function sb(t){const e=t.slice(0,Tt.LENGTH),r=t.slice(Tt.LENGTH),n=P7(r),i=G.Binary.keccak256(G.Binary.concatBytes(e,n));return new Pe(i)}function P7(t){if(t.length>Cu)throw new Tr(`payload size ${t.length} exceeds maximum chunk payload size ${Cu}`,t);const e=new Uint8Array(Cu);return e.set(t),G.Binary.log2Reduce(G.Binary.partition(e,S7),(r,n)=>G.Binary.keccak256(G.Binary.concatBytes(r,n)))}const si=ve({reference:ce().transform(t=>new Pe(t))});var Ti;(function(t){t.FULL="full",t.LIGHT="light",t.ULTRA_LIGHT="ultra-light",t.DEV="dev"})(Ti||(Ti={}));function ob(t){switch(t){case"full":return Ti.FULL;case"light":return Ti.LIGHT;case"ultra-light":return Ti.ULTRA_LIGHT;case"dev":return Ti.DEV;default:throw new Error(`Unknown Bee mode: ${t}`)}}const O7=32,I7=128,Lo=O7*I7,np=17,ip=255,k7=1,N7=1e3;var Mt;(function(t){t[t.OFF=0]="OFF",t[t.MEDIUM=1]="MEDIUM",t[t.STRONG=2]="STRONG",t[t.INSANE=3]="INSANE",t[t.PARANOID=4]="PARANOID"})(Mt||(Mt={}));var sp;(function(t){t[t.NONE=0]="NONE",t[t.DATA=1]="DATA",t[t.PROX=2]="PROX",t[t.RACE=3]="RACE"})(sp||(sp={}));const ab={ENCRYPTION_OFF:{[Mt.OFF]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"44.70 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.66 MB",batchDepth:18,utilizationRate:"0.61%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"112.06 MB",batchDepth:19,utilizationRate:"5.09%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"687.62 MB",batchDepth:20,utilizationRate:"15.65%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.60 GB",batchDepth:21,utilizationRate:"30.27%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.73 GB",batchDepth:22,utilizationRate:"44.99%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"19.94 GB",batchDepth:23,utilizationRate:"58.03%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"47.06 GB",batchDepth:24,utilizationRate:"68.48%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"105.51 GB",batchDepth:25,utilizationRate:"76.77%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"227.98 GB",batchDepth:26,utilizationRate:"82.94%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"476.68 GB",batchDepth:27,utilizationRate:"86.71%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"993.65 GB",batchDepth:28,utilizationRate:"88.37%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"2.04 TB",batchDepth:29,utilizationRate:"92.88%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"4.17 TB",batchDepth:30,utilizationRate:"94.81%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"8.45 TB",batchDepth:31,utilizationRate:"96.06%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"17.07 TB",batchDepth:32,utilizationRate:"97.01%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"34.36 TB",batchDepth:33,utilizationRate:"97.65%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"69.04 TB",batchDepth:34,utilizationRate:"98.11%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"138.54 TB",batchDepth:35,utilizationRate:"98.44%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"277.72 TB",batchDepth:36,utilizationRate:"98.67%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"556.35 TB",batchDepth:37,utilizationRate:"98.83%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.11 PB",batchDepth:38,utilizationRate:"98.91%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.23 PB",batchDepth:39,utilizationRate:"98.96%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.46 PB",batchDepth:40,utilizationRate:"98.98%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.93 PB",batchDepth:41,utilizationRate:"99.11%"}],[Mt.MEDIUM]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"41.56 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.19 MB",batchDepth:18,utilizationRate:"0.57%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"104.18 MB",batchDepth:19,utilizationRate:"4.73%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"639.27 MB",batchDepth:20,utilizationRate:"14.54%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.41 GB",batchDepth:21,utilizationRate:"28.11%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.18 GB",batchDepth:22,utilizationRate:"41.79%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"18.54 GB",batchDepth:23,utilizationRate:"53.95%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"43.75 GB",batchDepth:24,utilizationRate:"63.66%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"98.09 GB",batchDepth:25,utilizationRate:"71.37%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"211.95 GB",batchDepth:26,utilizationRate:"77.11%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"443.16 GB",batchDepth:27,utilizationRate:"80.61%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"923.78 GB",batchDepth:28,utilizationRate:"82.16%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.90 TB",batchDepth:29,utilizationRate:"86.30%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.88 TB",batchDepth:30,utilizationRate:"88.14%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.86 TB",batchDepth:31,utilizationRate:"89.26%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"15.87 TB",batchDepth:32,utilizationRate:"90.21%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"31.94 TB",batchDepth:33,utilizationRate:"90.77%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"64.19 TB",batchDepth:34,utilizationRate:"91.22%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"128.80 TB",batchDepth:35,utilizationRate:"91.52%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"258.19 TB",batchDepth:36,utilizationRate:"91.73%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"517.23 TB",batchDepth:37,utilizationRate:"91.88%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.04 PB",batchDepth:38,utilizationRate:"91.95%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.07 PB",batchDepth:39,utilizationRate:"92.00%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.15 PB",batchDepth:40,utilizationRate:"92.15%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.30 PB",batchDepth:41,utilizationRate:"92.14%"}],[Mt.STRONG]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"37.37 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.57 MB",batchDepth:18,utilizationRate:"0.51%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"93.68 MB",batchDepth:19,utilizationRate:"4.25%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"574.81 MB",batchDepth:20,utilizationRate:"13.07%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.17 GB",batchDepth:21,utilizationRate:"25.26%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"6.46 GB",batchDepth:22,utilizationRate:"37.58%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"16.67 GB",batchDepth:23,utilizationRate:"48.50%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"39.34 GB",batchDepth:24,utilizationRate:"57.24%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"88.20 GB",batchDepth:25,utilizationRate:"64.17%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"190.58 GB",batchDepth:26,utilizationRate:"69.33%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"398.47 GB",batchDepth:27,utilizationRate:"72.48%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"830.63 GB",batchDepth:28,utilizationRate:"73.85%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.71 TB",batchDepth:29,utilizationRate:"77.59%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.49 TB",batchDepth:30,utilizationRate:"79.27%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.07 TB",batchDepth:31,utilizationRate:"80.34%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"14.27 TB",batchDepth:32,utilizationRate:"81.12%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"28.72 TB",batchDepth:33,utilizationRate:"81.63%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"57.71 TB",batchDepth:34,utilizationRate:"82.01%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"115.81 TB",batchDepth:35,utilizationRate:"82.29%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"232.16 TB",batchDepth:36,utilizationRate:"82.48%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"465.07 TB",batchDepth:37,utilizationRate:"82.61%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"931.23 TB",batchDepth:38,utilizationRate:"82.67%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.86 PB",batchDepth:39,utilizationRate:"82.71%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.73 PB",batchDepth:40,utilizationRate:"82.78%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"7.46 PB",batchDepth:41,utilizationRate:"82.79%"}],[Mt.INSANE]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"33.88 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.05 MB",batchDepth:18,utilizationRate:"0.46%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"84.92 MB",batchDepth:19,utilizationRate:"3.86%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"521.09 MB",batchDepth:20,utilizationRate:"11.85%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"1.97 GB",batchDepth:21,utilizationRate:"22.90%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"5.86 GB",batchDepth:22,utilizationRate:"34.09%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"15.11 GB",batchDepth:23,utilizationRate:"43.97%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"35.66 GB",batchDepth:24,utilizationRate:"51.90%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"79.96 GB",batchDepth:25,utilizationRate:"58.18%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"172.77 GB",batchDepth:26,utilizationRate:"62.85%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"361.23 GB",batchDepth:27,utilizationRate:"65.70%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"753.00 GB",batchDepth:28,utilizationRate:"66.95%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.55 TB",batchDepth:29,utilizationRate:"70.38%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.16 TB",batchDepth:30,utilizationRate:"71.92%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.41 TB",batchDepth:31,utilizationRate:"72.85%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"12.93 TB",batchDepth:32,utilizationRate:"73.53%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"26.04 TB",batchDepth:33,utilizationRate:"74.01%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"52.32 TB",batchDepth:34,utilizationRate:"74.35%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"104.99 TB",batchDepth:35,utilizationRate:"74.60%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"210.46 TB",batchDepth:36,utilizationRate:"74.77%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"421.61 TB",batchDepth:37,utilizationRate:"74.89%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"844.20 TB",batchDepth:38,utilizationRate:"74.94%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.69 PB",batchDepth:39,utilizationRate:"74.98%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.38 PB",batchDepth:40,utilizationRate:"75.03%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"6.77 PB",batchDepth:41,utilizationRate:"75.10%"}],[Mt.PARANOID]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"13.27 kB",batchDepth:17,utilizationRate:"0.00%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"1.98 MB",batchDepth:18,utilizationRate:"0.18%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"33.27 MB",batchDepth:19,utilizationRate:"1.51%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"204.14 MB",batchDepth:20,utilizationRate:"4.64%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"771.13 MB",batchDepth:21,utilizationRate:"8.75%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"2.29 GB",batchDepth:22,utilizationRate:"13.34%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"5.92 GB",batchDepth:23,utilizationRate:"17.22%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"13.97 GB",batchDepth:24,utilizationRate:"20.33%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"31.32 GB",batchDepth:25,utilizationRate:"22.79%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"67.68 GB",batchDepth:26,utilizationRate:"24.62%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"141.51 GB",batchDepth:27,utilizationRate:"25.74%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"294.99 GB",batchDepth:28,utilizationRate:"26.23%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"606.90 GB",batchDepth:29,utilizationRate:"27.56%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"1.24 TB",batchDepth:30,utilizationRate:"28.15%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"2.51 TB",batchDepth:31,utilizationRate:"28.54%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"5.07 TB",batchDepth:32,utilizationRate:"28.82%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"10.20 TB",batchDepth:33,utilizationRate:"28.99%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"20.50 TB",batchDepth:34,utilizationRate:"29.13%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"41.13 TB",batchDepth:35,utilizationRate:"29.22%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"82.45 TB",batchDepth:36,utilizationRate:"29.29%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"165.17 TB",batchDepth:37,utilizationRate:"29.34%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"330.72 TB",batchDepth:38,utilizationRate:"29.37%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"661.97 TB",batchDepth:39,utilizationRate:"29.39%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"1.32 PB",batchDepth:40,utilizationRate:"29.41%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"2.65 PB",batchDepth:41,utilizationRate:"29.43%"}]},ENCRYPTION_ON:{[Mt.OFF]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"44.35 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.61 MB",batchDepth:18,utilizationRate:"0.60%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"111.18 MB",batchDepth:19,utilizationRate:"5.05%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"682.21 MB",batchDepth:20,utilizationRate:"15.52%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.58 GB",batchDepth:21,utilizationRate:"30.04%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.67 GB",batchDepth:22,utilizationRate:"44.62%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"19.78 GB",batchDepth:23,utilizationRate:"57.56%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"46.69 GB",batchDepth:24,utilizationRate:"67.93%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"104.68 GB",batchDepth:25,utilizationRate:"76.16%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"226.19 GB",batchDepth:26,utilizationRate:"82.29%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"472.93 GB",batchDepth:27,utilizationRate:"86.02%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"985.83 GB",batchDepth:28,utilizationRate:"87.66%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"2.03 TB",batchDepth:29,utilizationRate:"92.25%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"4.14 TB",batchDepth:30,utilizationRate:"94.21%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"8.39 TB",batchDepth:31,utilizationRate:"95.37%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"16.93 TB",batchDepth:32,utilizationRate:"96.22%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"34.09 TB",batchDepth:33,utilizationRate:"96.88%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"68.50 TB",batchDepth:34,utilizationRate:"97.34%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"137.45 TB",batchDepth:35,utilizationRate:"97.67%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"275.53 TB",batchDepth:36,utilizationRate:"97.89%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"551.97 TB",batchDepth:37,utilizationRate:"98.05%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.11 PB",batchDepth:38,utilizationRate:"98.13%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.21 PB",batchDepth:39,utilizationRate:"98.18%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.43 PB",batchDepth:40,utilizationRate:"98.36%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.86 PB",batchDepth:41,utilizationRate:"98.37%"}],[Mt.MEDIUM]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"40.89 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.09 MB",batchDepth:18,utilizationRate:"0.56%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"102.49 MB",batchDepth:19,utilizationRate:"4.65%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"628.91 MB",batchDepth:20,utilizationRate:"14.30%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.38 GB",batchDepth:21,utilizationRate:"27.68%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.07 GB",batchDepth:22,utilizationRate:"41.15%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"18.24 GB",batchDepth:23,utilizationRate:"53.09%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"43.04 GB",batchDepth:24,utilizationRate:"62.63%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"96.50 GB",batchDepth:25,utilizationRate:"70.21%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"208.52 GB",batchDepth:26,utilizationRate:"75.86%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"435.98 GB",batchDepth:27,utilizationRate:"79.30%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"908.81 GB",batchDepth:28,utilizationRate:"80.82%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.87 TB",batchDepth:29,utilizationRate:"84.98%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.81 TB",batchDepth:30,utilizationRate:"86.67%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.73 TB",batchDepth:31,utilizationRate:"87.84%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"15.61 TB",batchDepth:32,utilizationRate:"88.74%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"31.43 TB",batchDepth:33,utilizationRate:"89.34%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"63.15 TB",batchDepth:34,utilizationRate:"89.74%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"126.71 TB",batchDepth:35,utilizationRate:"90.03%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"254.01 TB",batchDepth:36,utilizationRate:"90.24%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"508.85 TB",batchDepth:37,utilizationRate:"90.39%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.02 PB",batchDepth:38,utilizationRate:"90.47%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.04 PB",batchDepth:39,utilizationRate:"90.51%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.08 PB",batchDepth:40,utilizationRate:"90.64%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.17 PB",batchDepth:41,utilizationRate:"90.65%"}],[Mt.STRONG]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"36.73 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.47 MB",batchDepth:18,utilizationRate:"0.50%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"92.07 MB",batchDepth:19,utilizationRate:"4.18%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"564.95 MB",batchDepth:20,utilizationRate:"12.85%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.13 GB",batchDepth:21,utilizationRate:"24.86%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"6.35 GB",batchDepth:22,utilizationRate:"36.97%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"16.38 GB",batchDepth:23,utilizationRate:"47.67%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"38.66 GB",batchDepth:24,utilizationRate:"56.26%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"86.69 GB",batchDepth:25,utilizationRate:"63.07%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"187.31 GB",batchDepth:26,utilizationRate:"68.14%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"391.64 GB",batchDepth:27,utilizationRate:"71.24%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"816.39 GB",batchDepth:28,utilizationRate:"72.59%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.68 TB",batchDepth:29,utilizationRate:"76.34%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.43 TB",batchDepth:30,utilizationRate:"77.89%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.94 TB",batchDepth:31,utilizationRate:"78.86%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"14.02 TB",batchDepth:32,utilizationRate:"79.71%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"28.23 TB",batchDepth:33,utilizationRate:"80.23%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"56.72 TB",batchDepth:34,utilizationRate:"80.60%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"113.82 TB",batchDepth:35,utilizationRate:"80.88%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"228.18 TB",batchDepth:36,utilizationRate:"81.06%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"457.10 TB",batchDepth:37,utilizationRate:"81.20%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"915.26 TB",batchDepth:38,utilizationRate:"81.26%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.83 PB",batchDepth:39,utilizationRate:"81.30%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.67 PB",batchDepth:40,utilizationRate:"81.43%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"7.34 PB",batchDepth:41,utilizationRate:"81.45%"}],[Mt.INSANE]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"33.26 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"4.96 MB",batchDepth:18,utilizationRate:"0.45%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"83.38 MB",batchDepth:19,utilizationRate:"3.79%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"511.65 MB",batchDepth:20,utilizationRate:"11.64%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"1.93 GB",batchDepth:21,utilizationRate:"22.52%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"5.75 GB",batchDepth:22,utilizationRate:"33.50%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"14.84 GB",batchDepth:23,utilizationRate:"43.19%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"35.02 GB",batchDepth:24,utilizationRate:"50.96%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"78.51 GB",batchDepth:25,utilizationRate:"57.12%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"169.64 GB",batchDepth:26,utilizationRate:"61.71%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"354.69 GB",batchDepth:27,utilizationRate:"64.52%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"739.37 GB",batchDepth:28,utilizationRate:"65.74%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.52 TB",batchDepth:29,utilizationRate:"69.15%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.10 TB",batchDepth:30,utilizationRate:"70.56%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.29 TB",batchDepth:31,utilizationRate:"71.48%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"12.70 TB",batchDepth:32,utilizationRate:"72.18%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"25.57 TB",batchDepth:33,utilizationRate:"72.67%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"51.37 TB",batchDepth:34,utilizationRate:"73.00%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"103.08 TB",batchDepth:35,utilizationRate:"73.24%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"206.65 TB",batchDepth:36,utilizationRate:"73.42%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"413.98 TB",batchDepth:37,utilizationRate:"73.54%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"828.91 TB",batchDepth:38,utilizationRate:"73.59%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.66 PB",batchDepth:39,utilizationRate:"73.62%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.32 PB",batchDepth:40,utilizationRate:"73.72%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"6.64 PB",batchDepth:41,utilizationRate:"73.74%"}],[Mt.PARANOID]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"13.17 kB",batchDepth:17,utilizationRate:"0.00%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"1.96 MB",batchDepth:18,utilizationRate:"0.18%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"33.01 MB",batchDepth:19,utilizationRate:"1.50%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"202.53 MB",batchDepth:20,utilizationRate:"4.61%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"765.05 MB",batchDepth:21,utilizationRate:"8.68%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"2.28 GB",batchDepth:22,utilizationRate:"13.27%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"5.87 GB",batchDepth:23,utilizationRate:"17.08%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"13.86 GB",batchDepth:24,utilizationRate:"20.17%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"31.08 GB",batchDepth:25,utilizationRate:"22.61%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"67.15 GB",batchDepth:26,utilizationRate:"24.43%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"140.40 GB",batchDepth:27,utilizationRate:"25.54%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"292.67 GB",batchDepth:28,utilizationRate:"26.03%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"602.12 GB",batchDepth:29,utilizationRate:"27.35%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"1.23 TB",batchDepth:30,utilizationRate:"27.94%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"2.49 TB",batchDepth:31,utilizationRate:"28.32%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"5.03 TB",batchDepth:32,utilizationRate:"28.60%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"10.12 TB",batchDepth:33,utilizationRate:"28.77%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"20.34 TB",batchDepth:34,utilizationRate:"28.91%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"40.80 TB",batchDepth:35,utilizationRate:"29.00%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"81.80 TB",batchDepth:36,utilizationRate:"29.06%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"163.87 TB",batchDepth:37,utilizationRate:"29.11%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"328.11 TB",batchDepth:38,utilizationRate:"29.14%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"656.76 TB",batchDepth:39,utilizationRate:"29.16%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"1.31 PB",batchDepth:40,utilizationRate:"29.18%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"2.63 PB",batchDepth:41,utilizationRate:"29.19%"}]}};class sr{constructor(e){this.seconds=Math.ceil(e),e<0&&(this.seconds=0)}static fromMilliseconds(e){return new sr(e/1e3)}static fromSeconds(e){return new sr(e)}static fromHours(e){return new sr(e*60*60)}static fromDays(e){return new sr(e*24*60*60)}static fromWeeks(e){return new sr(e*7*24*60*60)}static fromYears(e){return new sr(e*365*24*60*60)}static fromEndDate(e,r){return new sr((e.getTime()-(r??new Date).getTime())/1e3)}static parseFromString(e){return sr.fromSeconds(G.Dates.make(e)/1e3)}toSeconds(){return this.seconds}toHours(){return this.seconds/60/60}toDays(){return this.seconds/24/60/60}toWeeks(){return this.seconds/7/24/60/60}toYears(){return this.seconds/365/24/60/60}toEndDate(e){return new Date((e??new Date).getTime()+this.seconds*1e3)}represent(){return G.Dates.secondsToHumanTime(this.seconds)}isZero(){return this.seconds===0}}sr.ZERO=new sr(0);class Sr{constructor(e){if(this.bytes=Math.ceil(e),e<0)throw Error("Size must be at least 0")}static fromBytes(e){return new Sr(e)}static fromKilobytes(e){return new Sr(e*1e3)}static fromMegabytes(e){return new Sr(e*1e3*1e3)}static fromGigabytes(e){return new Sr(e*1e3*1e3*1e3)}static parseFromString(e){return Sr.fromBytes(G.Numbers.makeStorage(e,1e3))}toBytes(){return this.bytes}toGigabytes(){return this.bytes/1e3/1e3/1e3}toFormattedString(){return G.Numbers.convertBytes(this.bytes,1e3)}represent(){return this.toFormattedString()}}class De{constructor(e){this.state=e}static fromDecimalString(e){return new De(G.FixedPointNumber.fromDecimalString(e,De.DIGITS))}static fromPLUR(e){return new De(new G.FixedPointNumber(e,De.DIGITS))}static fromFloat(e){return new De(G.FixedPointNumber.fromFloat(e,De.DIGITS))}toPLURString(){return this.state.toString()}toPLURBigInt(){return this.state.value}toDecimalString(){return this.state.toDecimalString()}toFloat(){return this.state.toFloat()}toSignificantDigits(e){return this.toDecimalString().slice(0,this.toDecimalString().indexOf(".")+e+1)}plus(e){return new De(this.state.add(e instanceof De?e.state:new G.FixedPointNumber(e,De.DIGITS)))}minus(e){return new De(this.state.subtract(e instanceof De?e.state:new G.FixedPointNumber(e,De.DIGITS)))}divide(e){return new De(this.state.divmod(e)[0])}gt(e){return this.state.compare(e.state)===1}gte(e){return this.state.compare(e.state)!==-1}lt(e){return this.state.compare(e.state)===-1}lte(e){return this.state.compare(e.state)!==1}eq(e){return this.state.compare(e.state)===0}exchangeToDAI(e){return ut.fromWei(this.state.exchange("*",new G.FixedPointNumber(e.toWeiBigInt(),ut.DIGITS),ut.DIGITS).value)}}De.DIGITS=16;class ut{constructor(e){this.state=e}static fromDecimalString(e){return new ut(G.FixedPointNumber.fromDecimalString(e,ut.DIGITS))}static fromWei(e){return new ut(new G.FixedPointNumber(e,ut.DIGITS))}static fromFloat(e){return new ut(G.FixedPointNumber.fromFloat(e,ut.DIGITS))}toWeiString(){return this.state.toString()}toWeiBigInt(){return this.state.value}toDecimalString(){return this.state.toDecimalString()}toSignificantDigits(e){return this.toDecimalString().slice(0,this.toDecimalString().indexOf(".")+e+1)}toFloat(){return this.state.toFloat()}plus(e){return new ut(this.state.add(e instanceof ut?e.state:new G.FixedPointNumber(e,ut.DIGITS)))}minus(e){return new ut(this.state.subtract(e instanceof ut?e.state:new G.FixedPointNumber(e,ut.DIGITS)))}divide(e){return new ut(this.state.divmod(e)[0])}gt(e){return this.state.compare(e.state)===1}gte(e){return this.state.compare(e.state)!==-1}lt(e){return this.state.compare(e.state)===-1}lte(e){return this.state.compare(e.state)!==1}eq(e){return this.state.compare(e.state)===0}exchangeToBZZ(e){return De.fromPLUR(this.state.exchange("/",new G.FixedPointNumber(e.toWeiBigInt(),ut.DIGITS),De.DIGITS).value)}}ut.DIGITS=18;var Uo={exports:{}},op;function xh(){if(op)return Uo.exports;op=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(N,_,D){return Function.prototype.apply.call(N,_,D)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(N){return Object.getOwnPropertyNames(N).concat(Object.getOwnPropertySymbols(N))}:r=function(N){return Object.getOwnPropertyNames(N)};function n(S){console&&console.warn&&console.warn(S)}var i=Number.isNaN||function(N){return N!==N};function o(){o.init.call(this)}Uo.exports=o,Uo.exports.once=A,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function u(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(S){if(typeof S!="number"||S<0||i(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");a=S}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(N){if(typeof N!="number"||N<0||i(N))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+N+".");return this._maxListeners=N,this};function l(S){return S._maxListeners===void 0?o.defaultMaxListeners:S._maxListeners}o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(N){for(var _=[],D=1;D<arguments.length;D++)_.push(arguments[D]);var L=N==="error",H=this._events;if(H!==void 0)L=L&&H.error===void 0;else if(!L)return!1;if(L){var K;if(_.length>0&&(K=_[0]),K instanceof Error)throw K;var le=new Error("Unhandled error."+(K?" ("+K.message+")":""));throw le.context=K,le}var U=H[N];if(U===void 0)return!1;if(typeof U=="function")e(U,this,_);else for(var ge=U.length,Be=T(U,ge),D=0;D<ge;++D)e(Be[D],this,_);return!0};function h(S,N,_,D){var L,H,K;if(u(_),H=S._events,H===void 0?(H=S._events=Object.create(null),S._eventsCount=0):(H.newListener!==void 0&&(S.emit("newListener",N,_.listener?_.listener:_),H=S._events),K=H[N]),K===void 0)K=H[N]=_,++S._eventsCount;else if(typeof K=="function"?K=H[N]=D?[_,K]:[K,_]:D?K.unshift(_):K.push(_),L=l(S),L>0&&K.length>L&&!K.warned){K.warned=!0;var le=new Error("Possible EventEmitter memory leak detected. "+K.length+" "+String(N)+" listeners added. Use emitter.setMaxListeners() to increase limit");le.name="MaxListenersExceededWarning",le.emitter=S,le.type=N,le.count=K.length,n(le)}return S}o.prototype.addListener=function(N,_){return h(this,N,_,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(N,_){return h(this,N,_,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(S,N,_){var D={fired:!1,wrapFn:void 0,target:S,type:N,listener:_},L=d.bind(D);return L.listener=_,D.wrapFn=L,L}o.prototype.once=function(N,_){return u(_),this.on(N,m(this,N,_)),this},o.prototype.prependOnceListener=function(N,_){return u(_),this.prependListener(N,m(this,N,_)),this},o.prototype.removeListener=function(N,_){var D,L,H,K,le;if(u(_),L=this._events,L===void 0)return this;if(D=L[N],D===void 0)return this;if(D===_||D.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete L[N],L.removeListener&&this.emit("removeListener",N,D.listener||_));else if(typeof D!="function"){for(H=-1,K=D.length-1;K>=0;K--)if(D[K]===_||D[K].listener===_){le=D[K].listener,H=K;break}if(H<0)return this;H===0?D.shift():R(D,H),D.length===1&&(L[N]=D[0]),L.removeListener!==void 0&&this.emit("removeListener",N,le||_)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(N){var _,D,L;if(D=this._events,D===void 0)return this;if(D.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):D[N]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete D[N]),this;if(arguments.length===0){var H=Object.keys(D),K;for(L=0;L<H.length;++L)K=H[L],K!=="removeListener"&&this.removeAllListeners(K);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(_=D[N],typeof _=="function")this.removeListener(N,_);else if(_!==void 0)for(L=_.length-1;L>=0;L--)this.removeListener(N,_[L]);return this};function y(S,N,_){var D=S._events;if(D===void 0)return[];var L=D[N];return L===void 0?[]:typeof L=="function"?_?[L.listener||L]:[L]:_?O(L):T(L,L.length)}o.prototype.listeners=function(N){return y(this,N,!0)},o.prototype.rawListeners=function(N){return y(this,N,!1)},o.listenerCount=function(S,N){return typeof S.listenerCount=="function"?S.listenerCount(N):w.call(S,N)},o.prototype.listenerCount=w;function w(S){var N=this._events;if(N!==void 0){var _=N[S];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function T(S,N){for(var _=new Array(N),D=0;D<N;++D)_[D]=S[D];return _}function R(S,N){for(;N+1<S.length;N++)S[N]=S[N+1];S.pop()}function O(S){for(var N=new Array(S.length),_=0;_<N.length;++_)N[_]=S[_].listener||S[_];return N}function A(S,N){return new Promise(function(_,D){function L(K){S.removeListener(N,H),D(K)}function H(){typeof S.removeListener=="function"&&S.removeListener("error",L),_([].slice.call(arguments))}B(S,N,H,{once:!0}),N!=="error"&&I(S,L,{once:!0})})}function I(S,N,_){typeof S.on=="function"&&B(S,"error",N,_)}function B(S,N,_,D){if(typeof S.on=="function")D.once?S.once(N,_):S.on(N,_);else if(typeof S.addEventListener=="function")S.addEventListener(N,function L(H){D.once&&S.removeEventListener(N,L),_(H)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}return Uo.exports}var Mo={exports:{}},ap;function oi(){return ap||(ap=1,typeof Object.create=="function"?Mo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mo.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}),Mo.exports}var _u,cp;function cb(){return cp||(cp=1,_u=xh().EventEmitter),_u}var Fu={},up;function za(){return up||(up=1,(function(t){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e={},r={};r.byteLength=d,r.toByteArray=y,r.fromByteArray=R;for(var n=[],i=[],o=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,l=a.length;u<l;++u)n[u]=a[u],i[a.charCodeAt(u)]=u;i[45]=62,i[95]=63;function h(I){var B=I.length;if(B%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=I.indexOf("=");S===-1&&(S=B);var N=S===B?0:4-S%4;return[S,N]}function d(I){var B=h(I),S=B[0],N=B[1];return(S+N)*3/4-N}function m(I,B,S){return(B+S)*3/4-S}function y(I){var B,S=h(I),N=S[0],_=S[1],D=new o(m(I,N,_)),L=0,H=_>0?N-4:N,K;for(K=0;K<H;K+=4)B=i[I.charCodeAt(K)]<<18|i[I.charCodeAt(K+1)]<<12|i[I.charCodeAt(K+2)]<<6|i[I.charCodeAt(K+3)],D[L++]=B>>16&255,D[L++]=B>>8&255,D[L++]=B&255;return _===2&&(B=i[I.charCodeAt(K)]<<2|i[I.charCodeAt(K+1)]>>4,D[L++]=B&255),_===1&&(B=i[I.charCodeAt(K)]<<10|i[I.charCodeAt(K+1)]<<4|i[I.charCodeAt(K+2)]>>2,D[L++]=B>>8&255,D[L++]=B&255),D}function w(I){return n[I>>18&63]+n[I>>12&63]+n[I>>6&63]+n[I&63]}function T(I,B,S){for(var N,_=[],D=B;D<S;D+=3)N=(I[D]<<16&16711680)+(I[D+1]<<8&65280)+(I[D+2]&255),_.push(w(N));return _.join("")}function R(I){for(var B,S=I.length,N=S%3,_=[],D=16383,L=0,H=S-N;L<H;L+=D)_.push(T(I,L,L+D>H?H:L+D));return N===1?(B=I[S-1],_.push(n[B>>2]+n[B<<4&63]+"==")):N===2&&(B=(I[S-2]<<8)+I[S-1],_.push(n[B>>10]+n[B>>4&63]+n[B<<2&63]+"=")),_.join("")}var O={};O.read=function(I,B,S,N,_){var D,L,H=_*8-N-1,K=(1<<H)-1,le=K>>1,U=-7,ge=S?_-1:0,Be=S?-1:1,ne=I[B+ge];for(ge+=Be,D=ne&(1<<-U)-1,ne>>=-U,U+=H;U>0;D=D*256+I[B+ge],ge+=Be,U-=8);for(L=D&(1<<-U)-1,D>>=-U,U+=N;U>0;L=L*256+I[B+ge],ge+=Be,U-=8);if(D===0)D=1-le;else{if(D===K)return L?NaN:(ne?-1:1)*(1/0);L=L+Math.pow(2,N),D=D-le}return(ne?-1:1)*L*Math.pow(2,D-N)},O.write=function(I,B,S,N,_,D){var L,H,K,le=D*8-_-1,U=(1<<le)-1,ge=U>>1,Be=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,ne=N?0:D-1,ue=N?1:-1,ye=B<0||B===0&&1/B<0?1:0;for(B=Math.abs(B),isNaN(B)||B===1/0?(H=isNaN(B)?1:0,L=U):(L=Math.floor(Math.log(B)/Math.LN2),B*(K=Math.pow(2,-L))<1&&(L--,K*=2),L+ge>=1?B+=Be/K:B+=Be*Math.pow(2,1-ge),B*K>=2&&(L++,K/=2),L+ge>=U?(H=0,L=U):L+ge>=1?(H=(B*K-1)*Math.pow(2,_),L=L+ge):(H=B*Math.pow(2,ge-1)*Math.pow(2,_),L=0));_>=8;I[S+ne]=H&255,ne+=ue,H/=256,_-=8);for(L=L<<_|H,le+=_;le>0;I[S+ne]=L&255,ne+=ue,L/=256,le-=8);I[S+ne-ue]|=ye*128};(function(I){const B=r,S=O,N=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;I.Buffer=U,I.SlowBuffer=j,I.INSPECT_MAX_BYTES=50;const _=2147483647;I.kMaxLength=_;const{Uint8Array:D,ArrayBuffer:L,SharedArrayBuffer:H}=globalThis;U.TYPED_ARRAY_SUPPORT=K(),!U.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{const E=new D(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,D.prototype),Object.setPrototypeOf(E,g),E.foo()===42}catch{return!1}}Object.defineProperty(U.prototype,"parent",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.buffer}}),Object.defineProperty(U.prototype,"offset",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.byteOffset}});function le(E){if(E>_)throw new RangeError('The value "'+E+'" is invalid for option "size"');const g=new D(E);return Object.setPrototypeOf(g,U.prototype),g}function U(E,g,x){if(typeof E=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ue(E)}return ge(E,g,x)}U.poolSize=8192;function ge(E,g,x){if(typeof E=="string")return ye(E,g);if(L.isView(E))return Ee(E);if(E==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(ur(E,L)||E&&ur(E.buffer,L)||typeof H<"u"&&(ur(E,H)||E&&ur(E.buffer,H)))return Se(E,g,x);if(typeof E=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const C=E.valueOf&&E.valueOf();if(C!=null&&C!==E)return U.from(C,g,x);const $=Ue(E);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof E[Symbol.toPrimitive]=="function")return U.from(E[Symbol.toPrimitive]("string"),g,x);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E)}U.from=function(E,g,x){return ge(E,g,x)},Object.setPrototypeOf(U.prototype,D.prototype),Object.setPrototypeOf(U,D);function Be(E){if(typeof E!="number")throw new TypeError('"size" argument must be of type number');if(E<0)throw new RangeError('The value "'+E+'" is invalid for option "size"')}function ne(E,g,x){return Be(E),E<=0?le(E):g!==void 0?typeof x=="string"?le(E).fill(g,x):le(E).fill(g):le(E)}U.alloc=function(E,g,x){return ne(E,g,x)};function ue(E){return Be(E),le(E<0?0:_e(E)|0)}U.allocUnsafe=function(E){return ue(E)},U.allocUnsafeSlow=function(E){return ue(E)};function ye(E,g){if((typeof g!="string"||g==="")&&(g="utf8"),!U.isEncoding(g))throw new TypeError("Unknown encoding: "+g);const x=J(E,g)|0;let C=le(x);const $=C.write(E,g);return $!==x&&(C=C.slice(0,$)),C}function Ae(E){const g=E.length<0?0:_e(E.length)|0,x=le(g);for(let C=0;C<g;C+=1)x[C]=E[C]&255;return x}function Ee(E){if(ur(E,D)){const g=new D(E);return Se(g.buffer,g.byteOffset,g.byteLength)}return Ae(E)}function Se(E,g,x){if(g<0||E.byteLength<g)throw new RangeError('"offset" is outside of buffer bounds');if(E.byteLength<g+(x||0))throw new RangeError('"length" is outside of buffer bounds');let C;return g===void 0&&x===void 0?C=new D(E):x===void 0?C=new D(E,g):C=new D(E,g,x),Object.setPrototypeOf(C,U.prototype),C}function Ue(E){if(U.isBuffer(E)){const g=_e(E.length)|0,x=le(g);return x.length===0||E.copy(x,0,0,g),x}if(E.length!==void 0)return typeof E.length!="number"||us(E.length)?le(0):Ae(E);if(E.type==="Buffer"&&Array.isArray(E.data))return Ae(E.data)}function _e(E){if(E>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return E|0}function j(E){return+E!=E&&(E=0),U.alloc(+E)}U.isBuffer=function(g){return g!=null&&g._isBuffer===!0&&g!==U.prototype},U.compare=function(g,x){if(ur(g,D)&&(g=U.from(g,g.offset,g.byteLength)),ur(x,D)&&(x=U.from(x,x.offset,x.byteLength)),!U.isBuffer(g)||!U.isBuffer(x))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(g===x)return 0;let C=g.length,$=x.length;for(let q=0,ee=Math.min(C,$);q<ee;++q)if(g[q]!==x[q]){C=g[q],$=x[q];break}return C<$?-1:$<C?1:0},U.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},U.concat=function(g,x){if(!Array.isArray(g))throw new TypeError('"list" argument must be an Array of Buffers');if(g.length===0)return U.alloc(0);let C;if(x===void 0)for(x=0,C=0;C<g.length;++C)x+=g[C].length;const $=U.allocUnsafe(x);let q=0;for(C=0;C<g.length;++C){let ee=g[C];if(ur(ee,D))q+ee.length>$.length?(U.isBuffer(ee)||(ee=U.from(ee)),ee.copy($,q)):D.prototype.set.call($,ee,q);else if(U.isBuffer(ee))ee.copy($,q);else throw new TypeError('"list" argument must be an Array of Buffers');q+=ee.length}return $};function J(E,g){if(U.isBuffer(E))return E.length;if(L.isView(E)||ur(E,L))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);const x=E.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&x===0)return 0;let $=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return x;case"utf8":case"utf-8":return os(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x*2;case"hex":return x>>>1;case"base64":return cs(E).length;default:if($)return C?-1:os(E).length;g=(""+g).toLowerCase(),$=!0}}U.byteLength=J;function se(E,g,x){let C=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0,g>>>=0,x<=g))return"";for(E||(E="utf8");;)switch(E){case"hex":return xt(this,g,x);case"utf8":case"utf-8":return Oe(this,g,x);case"ascii":return Lt(this,g,x);case"latin1":case"binary":return X(this,g,x);case"base64":return fe(this,g,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wt(this,g,x);default:if(C)throw new TypeError("Unknown encoding: "+E);E=(E+"").toLowerCase(),C=!0}}U.prototype._isBuffer=!0;function M(E,g,x){const C=E[g];E[g]=E[x],E[x]=C}U.prototype.swap16=function(){const g=this.length;if(g%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let x=0;x<g;x+=2)M(this,x,x+1);return this},U.prototype.swap32=function(){const g=this.length;if(g%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let x=0;x<g;x+=4)M(this,x,x+3),M(this,x+1,x+2);return this},U.prototype.swap64=function(){const g=this.length;if(g%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let x=0;x<g;x+=8)M(this,x,x+7),M(this,x+1,x+6),M(this,x+2,x+5),M(this,x+3,x+4);return this},U.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?Oe(this,0,g):se.apply(this,arguments)},U.prototype.toLocaleString=U.prototype.toString,U.prototype.equals=function(g){if(!U.isBuffer(g))throw new TypeError("Argument must be a Buffer");return this===g?!0:U.compare(this,g)===0},U.prototype.inspect=function(){let g="";const x=I.INSPECT_MAX_BYTES;return g=this.toString("hex",0,x).replace(/(.{2})/g,"$1 ").trim(),this.length>x&&(g+=" ... "),"<Buffer "+g+">"},N&&(U.prototype[N]=U.prototype.inspect),U.prototype.compare=function(g,x,C,$,q){if(ur(g,D)&&(g=U.from(g,g.offset,g.byteLength)),!U.isBuffer(g))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof g);if(x===void 0&&(x=0),C===void 0&&(C=g?g.length:0),$===void 0&&($=0),q===void 0&&(q=this.length),x<0||C>g.length||$<0||q>this.length)throw new RangeError("out of range index");if($>=q&&x>=C)return 0;if($>=q)return-1;if(x>=C)return 1;if(x>>>=0,C>>>=0,$>>>=0,q>>>=0,this===g)return 0;let ee=q-$,Ne=C-x;const Je=Math.min(ee,Ne),Ze=this.slice($,q),ct=g.slice(x,C);for(let Ke=0;Ke<Je;++Ke)if(Ze[Ke]!==ct[Ke]){ee=Ze[Ke],Ne=ct[Ke];break}return ee<Ne?-1:Ne<ee?1:0};function z(E,g,x,C,$){if(E.length===0)return-1;if(typeof x=="string"?(C=x,x=0):x>2147483647?x=2147483647:x<-2147483648&&(x=-2147483648),x=+x,us(x)&&(x=$?0:E.length-1),x<0&&(x=E.length+x),x>=E.length){if($)return-1;x=E.length-1}else if(x<0)if($)x=0;else return-1;if(typeof g=="string"&&(g=U.from(g,C)),U.isBuffer(g))return g.length===0?-1:Q(E,g,x,C,$);if(typeof g=="number")return g=g&255,typeof D.prototype.indexOf=="function"?$?D.prototype.indexOf.call(E,g,x):D.prototype.lastIndexOf.call(E,g,x):Q(E,[g],x,C,$);throw new TypeError("val must be string, number or Buffer")}function Q(E,g,x,C,$){let q=1,ee=E.length,Ne=g.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if(E.length<2||g.length<2)return-1;q=2,ee/=2,Ne/=2,x/=2}function Je(ct,Ke){return q===1?ct[Ke]:ct.readUInt16BE(Ke*q)}let Ze;if($){let ct=-1;for(Ze=x;Ze<ee;Ze++)if(Je(E,Ze)===Je(g,ct===-1?0:Ze-ct)){if(ct===-1&&(ct=Ze),Ze-ct+1===Ne)return ct*q}else ct!==-1&&(Ze-=Ze-ct),ct=-1}else for(x+Ne>ee&&(x=ee-Ne),Ze=x;Ze>=0;Ze--){let ct=!0;for(let Ke=0;Ke<Ne;Ke++)if(Je(E,Ze+Ke)!==Je(g,Ke)){ct=!1;break}if(ct)return Ze}return-1}U.prototype.includes=function(g,x,C){return this.indexOf(g,x,C)!==-1},U.prototype.indexOf=function(g,x,C){return z(this,g,x,C,!0)},U.prototype.lastIndexOf=function(g,x,C){return z(this,g,x,C,!1)};function ie(E,g,x,C){x=Number(x)||0;const $=E.length-x;C?(C=Number(C),C>$&&(C=$)):C=$;const q=g.length;C>q/2&&(C=q/2);let ee;for(ee=0;ee<C;++ee){const Ne=parseInt(g.substr(ee*2,2),16);if(us(Ne))return ee;E[x+ee]=Ne}return ee}function oe(E,g,x,C){return _n(os(g,E.length-x),E,x,C)}function P(E,g,x,C){return _n(as(g),E,x,C)}function k(E,g,x,C){return _n(cs(g),E,x,C)}function Z(E,g,x,C){return _n(Ao(g,E.length-x),E,x,C)}U.prototype.write=function(g,x,C,$){if(x===void 0)$="utf8",C=this.length,x=0;else if(C===void 0&&typeof x=="string")$=x,C=this.length,x=0;else if(isFinite(x))x=x>>>0,isFinite(C)?(C=C>>>0,$===void 0&&($="utf8")):($=C,C=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const q=this.length-x;if((C===void 0||C>q)&&(C=q),g.length>0&&(C<0||x<0)||x>this.length)throw new RangeError("Attempt to write outside buffer bounds");$||($="utf8");let ee=!1;for(;;)switch($){case"hex":return ie(this,g,x,C);case"utf8":case"utf-8":return oe(this,g,x,C);case"ascii":case"latin1":case"binary":return P(this,g,x,C);case"base64":return k(this,g,x,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,g,x,C);default:if(ee)throw new TypeError("Unknown encoding: "+$);$=(""+$).toLowerCase(),ee=!0}},U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fe(E,g,x){return g===0&&x===E.length?B.fromByteArray(E):B.fromByteArray(E.slice(g,x))}function Oe(E,g,x){x=Math.min(E.length,x);const C=[];let $=g;for(;$<x;){const q=E[$];let ee=null,Ne=q>239?4:q>223?3:q>191?2:1;if($+Ne<=x){let Je,Ze,ct,Ke;switch(Ne){case 1:q<128&&(ee=q);break;case 2:Je=E[$+1],(Je&192)===128&&(Ke=(q&31)<<6|Je&63,Ke>127&&(ee=Ke));break;case 3:Je=E[$+1],Ze=E[$+2],(Je&192)===128&&(Ze&192)===128&&(Ke=(q&15)<<12|(Je&63)<<6|Ze&63,Ke>2047&&(Ke<55296||Ke>57343)&&(ee=Ke));break;case 4:Je=E[$+1],Ze=E[$+2],ct=E[$+3],(Je&192)===128&&(Ze&192)===128&&(ct&192)===128&&(Ke=(q&15)<<18|(Je&63)<<12|(Ze&63)<<6|ct&63,Ke>65535&&Ke<1114112&&(ee=Ke))}}ee===null?(ee=65533,Ne=1):ee>65535&&(ee-=65536,C.push(ee>>>10&1023|55296),ee=56320|ee&1023),C.push(ee),$+=Ne}return Fe(C)}const xe=4096;function Fe(E){const g=E.length;if(g<=xe)return String.fromCharCode.apply(String,E);let x="",C=0;for(;C<g;)x+=String.fromCharCode.apply(String,E.slice(C,C+=xe));return x}function Lt(E,g,x){let C="";x=Math.min(E.length,x);for(let $=g;$<x;++$)C+=String.fromCharCode(E[$]&127);return C}function X(E,g,x){let C="";x=Math.min(E.length,x);for(let $=g;$<x;++$)C+=String.fromCharCode(E[$]);return C}function xt(E,g,x){const C=E.length;(!g||g<0)&&(g=0),(!x||x<0||x>C)&&(x=C);let $="";for(let q=g;q<x;++q)$+=fc[E[q]];return $}function wt(E,g,x){const C=E.slice(g,x);let $="";for(let q=0;q<C.length-1;q+=2)$+=String.fromCharCode(C[q]+C[q+1]*256);return $}U.prototype.slice=function(g,x){const C=this.length;g=~~g,x=x===void 0?C:~~x,g<0?(g+=C,g<0&&(g=0)):g>C&&(g=C),x<0?(x+=C,x<0&&(x=0)):x>C&&(x=C),x<g&&(x=g);const $=this.subarray(g,x);return Object.setPrototypeOf($,U.prototype),$};function qe(E,g,x){if(E%1!==0||E<0)throw new RangeError("offset is not uint");if(E+g>x)throw new RangeError("Trying to access beyond buffer length")}U.prototype.readUintLE=U.prototype.readUIntLE=function(g,x,C){g=g>>>0,x=x>>>0,C||qe(g,x,this.length);let $=this[g],q=1,ee=0;for(;++ee<x&&(q*=256);)$+=this[g+ee]*q;return $},U.prototype.readUintBE=U.prototype.readUIntBE=function(g,x,C){g=g>>>0,x=x>>>0,C||qe(g,x,this.length);let $=this[g+--x],q=1;for(;x>0&&(q*=256);)$+=this[g+--x]*q;return $},U.prototype.readUint8=U.prototype.readUInt8=function(g,x){return g=g>>>0,x||qe(g,1,this.length),this[g]},U.prototype.readUint16LE=U.prototype.readUInt16LE=function(g,x){return g=g>>>0,x||qe(g,2,this.length),this[g]|this[g+1]<<8},U.prototype.readUint16BE=U.prototype.readUInt16BE=function(g,x){return g=g>>>0,x||qe(g,2,this.length),this[g]<<8|this[g+1]},U.prototype.readUint32LE=U.prototype.readUInt32LE=function(g,x){return g=g>>>0,x||qe(g,4,this.length),(this[g]|this[g+1]<<8|this[g+2]<<16)+this[g+3]*16777216},U.prototype.readUint32BE=U.prototype.readUInt32BE=function(g,x){return g=g>>>0,x||qe(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},U.prototype.readBigUInt64LE=Nr(function(g){g=g>>>0,ln(g,"offset");const x=this[g],C=this[g+7];(x===void 0||C===void 0)&&Cn(g,this.length-8);const $=x+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,q=this[++g]+this[++g]*2**8+this[++g]*2**16+C*2**24;return BigInt($)+(BigInt(q)<<BigInt(32))}),U.prototype.readBigUInt64BE=Nr(function(g){g=g>>>0,ln(g,"offset");const x=this[g],C=this[g+7];(x===void 0||C===void 0)&&Cn(g,this.length-8);const $=x*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],q=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+C;return(BigInt($)<<BigInt(32))+BigInt(q)}),U.prototype.readIntLE=function(g,x,C){g=g>>>0,x=x>>>0,C||qe(g,x,this.length);let $=this[g],q=1,ee=0;for(;++ee<x&&(q*=256);)$+=this[g+ee]*q;return q*=128,$>=q&&($-=Math.pow(2,8*x)),$},U.prototype.readIntBE=function(g,x,C){g=g>>>0,x=x>>>0,C||qe(g,x,this.length);let $=x,q=1,ee=this[g+--$];for(;$>0&&(q*=256);)ee+=this[g+--$]*q;return q*=128,ee>=q&&(ee-=Math.pow(2,8*x)),ee},U.prototype.readInt8=function(g,x){return g=g>>>0,x||qe(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},U.prototype.readInt16LE=function(g,x){g=g>>>0,x||qe(g,2,this.length);const C=this[g]|this[g+1]<<8;return C&32768?C|4294901760:C},U.prototype.readInt16BE=function(g,x){g=g>>>0,x||qe(g,2,this.length);const C=this[g+1]|this[g]<<8;return C&32768?C|4294901760:C},U.prototype.readInt32LE=function(g,x){return g=g>>>0,x||qe(g,4,this.length),this[g]|this[g+1]<<8|this[g+2]<<16|this[g+3]<<24},U.prototype.readInt32BE=function(g,x){return g=g>>>0,x||qe(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},U.prototype.readBigInt64LE=Nr(function(g){g=g>>>0,ln(g,"offset");const x=this[g],C=this[g+7];(x===void 0||C===void 0)&&Cn(g,this.length-8);const $=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(C<<24);return(BigInt($)<<BigInt(32))+BigInt(x+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),U.prototype.readBigInt64BE=Nr(function(g){g=g>>>0,ln(g,"offset");const x=this[g],C=this[g+7];(x===void 0||C===void 0)&&Cn(g,this.length-8);const $=(x<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt($)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+C)}),U.prototype.readFloatLE=function(g,x){return g=g>>>0,x||qe(g,4,this.length),S.read(this,g,!0,23,4)},U.prototype.readFloatBE=function(g,x){return g=g>>>0,x||qe(g,4,this.length),S.read(this,g,!1,23,4)},U.prototype.readDoubleLE=function(g,x){return g=g>>>0,x||qe(g,8,this.length),S.read(this,g,!0,52,8)},U.prototype.readDoubleBE=function(g,x){return g=g>>>0,x||qe(g,8,this.length),S.read(this,g,!1,52,8)};function st(E,g,x,C,$,q){if(!U.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>$||g<q)throw new RangeError('"value" argument is out of bounds');if(x+C>E.length)throw new RangeError("Index out of range")}U.prototype.writeUintLE=U.prototype.writeUIntLE=function(g,x,C,$){if(g=+g,x=x>>>0,C=C>>>0,!$){const Ne=Math.pow(2,8*C)-1;st(this,g,x,C,Ne,0)}let q=1,ee=0;for(this[x]=g&255;++ee<C&&(q*=256);)this[x+ee]=g/q&255;return x+C},U.prototype.writeUintBE=U.prototype.writeUIntBE=function(g,x,C,$){if(g=+g,x=x>>>0,C=C>>>0,!$){const Ne=Math.pow(2,8*C)-1;st(this,g,x,C,Ne,0)}let q=C-1,ee=1;for(this[x+q]=g&255;--q>=0&&(ee*=256);)this[x+q]=g/ee&255;return x+C},U.prototype.writeUint8=U.prototype.writeUInt8=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,1,255,0),this[x]=g&255,x+1},U.prototype.writeUint16LE=U.prototype.writeUInt16LE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,2,65535,0),this[x]=g&255,this[x+1]=g>>>8,x+2},U.prototype.writeUint16BE=U.prototype.writeUInt16BE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,2,65535,0),this[x]=g>>>8,this[x+1]=g&255,x+2},U.prototype.writeUint32LE=U.prototype.writeUInt32LE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,4,4294967295,0),this[x+3]=g>>>24,this[x+2]=g>>>16,this[x+1]=g>>>8,this[x]=g&255,x+4},U.prototype.writeUint32BE=U.prototype.writeUInt32BE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,4,4294967295,0),this[x]=g>>>24,this[x+1]=g>>>16,this[x+2]=g>>>8,this[x+3]=g&255,x+4};function jt(E,g,x,C,$){is(g,C,$,E,x,7);let q=Number(g&BigInt(4294967295));E[x++]=q,q=q>>8,E[x++]=q,q=q>>8,E[x++]=q,q=q>>8,E[x++]=q;let ee=Number(g>>BigInt(32)&BigInt(4294967295));return E[x++]=ee,ee=ee>>8,E[x++]=ee,ee=ee>>8,E[x++]=ee,ee=ee>>8,E[x++]=ee,x}function Er(E,g,x,C,$){is(g,C,$,E,x,7);let q=Number(g&BigInt(4294967295));E[x+7]=q,q=q>>8,E[x+6]=q,q=q>>8,E[x+5]=q,q=q>>8,E[x+4]=q;let ee=Number(g>>BigInt(32)&BigInt(4294967295));return E[x+3]=ee,ee=ee>>8,E[x+2]=ee,ee=ee>>8,E[x+1]=ee,ee=ee>>8,E[x]=ee,x+8}U.prototype.writeBigUInt64LE=Nr(function(g,x=0){return jt(this,g,x,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeBigUInt64BE=Nr(function(g,x=0){return Er(this,g,x,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeIntLE=function(g,x,C,$){if(g=+g,x=x>>>0,!$){const Je=Math.pow(2,8*C-1);st(this,g,x,C,Je-1,-Je)}let q=0,ee=1,Ne=0;for(this[x]=g&255;++q<C&&(ee*=256);)g<0&&Ne===0&&this[x+q-1]!==0&&(Ne=1),this[x+q]=(g/ee>>0)-Ne&255;return x+C},U.prototype.writeIntBE=function(g,x,C,$){if(g=+g,x=x>>>0,!$){const Je=Math.pow(2,8*C-1);st(this,g,x,C,Je-1,-Je)}let q=C-1,ee=1,Ne=0;for(this[x+q]=g&255;--q>=0&&(ee*=256);)g<0&&Ne===0&&this[x+q+1]!==0&&(Ne=1),this[x+q]=(g/ee>>0)-Ne&255;return x+C},U.prototype.writeInt8=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,1,127,-128),g<0&&(g=255+g+1),this[x]=g&255,x+1},U.prototype.writeInt16LE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,2,32767,-32768),this[x]=g&255,this[x+1]=g>>>8,x+2},U.prototype.writeInt16BE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,2,32767,-32768),this[x]=g>>>8,this[x+1]=g&255,x+2},U.prototype.writeInt32LE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,4,2147483647,-2147483648),this[x]=g&255,this[x+1]=g>>>8,this[x+2]=g>>>16,this[x+3]=g>>>24,x+4},U.prototype.writeInt32BE=function(g,x,C){return g=+g,x=x>>>0,C||st(this,g,x,4,2147483647,-2147483648),g<0&&(g=4294967295+g+1),this[x]=g>>>24,this[x+1]=g>>>16,this[x+2]=g>>>8,this[x+3]=g&255,x+4},U.prototype.writeBigInt64LE=Nr(function(g,x=0){return jt(this,g,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),U.prototype.writeBigInt64BE=Nr(function(g,x=0){return Er(this,g,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function at(E,g,x,C,$,q){if(x+C>E.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("Index out of range")}function Bt(E,g,x,C,$){return g=+g,x=x>>>0,$||at(E,g,x,4),S.write(E,g,x,C,23,4),x+4}U.prototype.writeFloatLE=function(g,x,C){return Bt(this,g,x,!0,C)},U.prototype.writeFloatBE=function(g,x,C){return Bt(this,g,x,!1,C)};function cr(E,g,x,C,$){return g=+g,x=x>>>0,$||at(E,g,x,8),S.write(E,g,x,C,52,8),x+8}U.prototype.writeDoubleLE=function(g,x,C){return cr(this,g,x,!0,C)},U.prototype.writeDoubleBE=function(g,x,C){return cr(this,g,x,!1,C)},U.prototype.copy=function(g,x,C,$){if(!U.isBuffer(g))throw new TypeError("argument should be a Buffer");if(C||(C=0),!$&&$!==0&&($=this.length),x>=g.length&&(x=g.length),x||(x=0),$>0&&$<C&&($=C),$===C||g.length===0||this.length===0)return 0;if(x<0)throw new RangeError("targetStart out of bounds");if(C<0||C>=this.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("sourceEnd out of bounds");$>this.length&&($=this.length),g.length-x<$-C&&($=g.length-x+C);const q=$-C;return this===g&&typeof D.prototype.copyWithin=="function"?this.copyWithin(x,C,$):D.prototype.set.call(g,this.subarray(C,$),x),q},U.prototype.fill=function(g,x,C,$){if(typeof g=="string"){if(typeof x=="string"?($=x,x=0,C=this.length):typeof C=="string"&&($=C,C=this.length),$!==void 0&&typeof $!="string")throw new TypeError("encoding must be a string");if(typeof $=="string"&&!U.isEncoding($))throw new TypeError("Unknown encoding: "+$);if(g.length===1){const ee=g.charCodeAt(0);($==="utf8"&&ee<128||$==="latin1")&&(g=ee)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(x<0||this.length<x||this.length<C)throw new RangeError("Out of range index");if(C<=x)return this;x=x>>>0,C=C===void 0?this.length:C>>>0,g||(g=0);let q;if(typeof g=="number")for(q=x;q<C;++q)this[q]=g;else{const ee=U.isBuffer(g)?g:U.from(g,$),Ne=ee.length;if(Ne===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for(q=0;q<C-x;++q)this[q+x]=ee[q%Ne]}return this};const rr={};function un(E,g,x){rr[E]=class extends x{constructor(){super(),Object.defineProperty(this,"message",{value:g.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${E}]`,this.stack,delete this.name}get code(){return E}set code($){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:$,writable:!0})}toString(){return`${this.name} [${E}]: ${this.message}`}}}un("ERR_BUFFER_OUT_OF_BOUNDS",function(E){return E?`${E} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),un("ERR_INVALID_ARG_TYPE",function(E,g){return`The "${E}" argument must be of type number. Received type ${typeof g}`},TypeError),un("ERR_OUT_OF_RANGE",function(E,g,x){let C=`The value of "${E}" is out of range.`,$=x;return Number.isInteger(x)&&Math.abs(x)>2**32?$=fi(String(x)):typeof x=="bigint"&&($=String(x),(x>BigInt(2)**BigInt(32)||x<-(BigInt(2)**BigInt(32)))&&($=fi($)),$+="n"),C+=` It must be ${g}. Received ${$}`,C},RangeError);function fi(E){let g="",x=E.length;const C=E[0]==="-"?1:0;for(;x>=C+4;x-=3)g=`_${E.slice(x-3,x)}${g}`;return`${E.slice(0,x)}${g}`}function wo(E,g,x){ln(g,"offset"),(E[g]===void 0||E[g+x]===void 0)&&Cn(g,E.length-(x+1))}function is(E,g,x,C,$,q){if(E>x||E<g){const ee=typeof g=="bigint"?"n":"";let Ne;throw g===0||g===BigInt(0)?Ne=`>= 0${ee} and < 2${ee} ** ${(q+1)*8}${ee}`:Ne=`>= -(2${ee} ** ${(q+1)*8-1}${ee}) and < 2 ** ${(q+1)*8-1}${ee}`,new rr.ERR_OUT_OF_RANGE("value",Ne,E)}wo(C,$,q)}function ln(E,g){if(typeof E!="number")throw new rr.ERR_INVALID_ARG_TYPE(g,"number",E)}function Cn(E,g,x){throw Math.floor(E)!==E?(ln(E,x),new rr.ERR_OUT_OF_RANGE("offset","an integer",E)):g<0?new rr.ERR_BUFFER_OUT_OF_BOUNDS:new rr.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${g}`,E)}const ss=/[^+/0-9A-Za-z-_]/g;function lc(E){if(E=E.split("=")[0],E=E.trim().replace(ss,""),E.length<2)return"";for(;E.length%4!==0;)E=E+"=";return E}function os(E,g){g=g||1/0;let x;const C=E.length;let $=null;const q=[];for(let ee=0;ee<C;++ee){if(x=E.charCodeAt(ee),x>55295&&x<57344){if(!$){if(x>56319){(g-=3)>-1&&q.push(239,191,189);continue}else if(ee+1===C){(g-=3)>-1&&q.push(239,191,189);continue}$=x;continue}if(x<56320){(g-=3)>-1&&q.push(239,191,189),$=x;continue}x=($-55296<<10|x-56320)+65536}else $&&(g-=3)>-1&&q.push(239,191,189);if($=null,x<128){if((g-=1)<0)break;q.push(x)}else if(x<2048){if((g-=2)<0)break;q.push(x>>6|192,x&63|128)}else if(x<65536){if((g-=3)<0)break;q.push(x>>12|224,x>>6&63|128,x&63|128)}else if(x<1114112){if((g-=4)<0)break;q.push(x>>18|240,x>>12&63|128,x>>6&63|128,x&63|128)}else throw new Error("Invalid code point")}return q}function as(E){const g=[];for(let x=0;x<E.length;++x)g.push(E.charCodeAt(x)&255);return g}function Ao(E,g){let x,C,$;const q=[];for(let ee=0;ee<E.length&&!((g-=2)<0);++ee)x=E.charCodeAt(ee),C=x>>8,$=x%256,q.push($),q.push(C);return q}function cs(E){return B.toByteArray(lc(E))}function _n(E,g,x,C){let $;for($=0;$<C&&!($+x>=g.length||$>=E.length);++$)g[$+x]=E[$];return $}function ur(E,g){return E instanceof g||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===g.name}function us(E){return E!==E}const fc=(function(){const E="0123456789abcdef",g=new Array(256);for(let x=0;x<16;++x){const C=x*16;for(let $=0;$<16;++$)g[C+$]=E[x]+E[$]}return g})();function Nr(E){return typeof BigInt>"u"?hc:E}function hc(){throw new Error("BigInt not supported")}})(e);const A=e.Buffer;t.Blob=e.Blob,t.BlobOptions=e.BlobOptions,t.Buffer=e.Buffer,t.File=e.File,t.FileOptions=e.FileOptions,t.INSPECT_MAX_BYTES=e.INSPECT_MAX_BYTES,t.SlowBuffer=e.SlowBuffer,t.TranscodeEncoding=e.TranscodeEncoding,t.atob=e.atob,t.btoa=e.btoa,t.constants=e.constants,t.default=A,t.isAscii=e.isAscii,t.isUtf8=e.isUtf8,t.kMaxLength=e.kMaxLength,t.kStringMaxLength=e.kStringMaxLength,t.resolveObjectURL=e.resolveObjectURL,t.transcode=e.transcode})(Fu)),Fu}var Du={},Lu={},Uu,lp;function ub(){return lp||(lp=1,Uu=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,r);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),Uu}var Mu,fp;function $a(){if(fp)return Mu;fp=1;var t=ub();return Mu=function(){return t()&&!!Symbol.toStringTag},Mu}var zu,hp;function lb(){return hp||(hp=1,zu=Object),zu}var $u,dp;function C7(){return dp||(dp=1,$u=Error),$u}var Vu,pp;function _7(){return pp||(pp=1,Vu=EvalError),Vu}var Gu,mp;function F7(){return mp||(mp=1,Gu=RangeError),Gu}var ju,gp;function D7(){return gp||(gp=1,ju=ReferenceError),ju}var Hu,yp;function fb(){return yp||(yp=1,Hu=SyntaxError),Hu}var qu,bp;function io(){return bp||(bp=1,qu=TypeError),qu}var Zu,xp;function L7(){return xp||(xp=1,Zu=URIError),Zu}var Ku,wp;function U7(){return wp||(wp=1,Ku=Math.abs),Ku}var Ju,Ap;function M7(){return Ap||(Ap=1,Ju=Math.floor),Ju}var Wu,Ep;function z7(){return Ep||(Ep=1,Wu=Math.max),Wu}var Qu,vp;function $7(){return vp||(vp=1,Qu=Math.min),Qu}var Yu,Rp;function V7(){return Rp||(Rp=1,Yu=Math.pow),Yu}var Xu,Tp;function G7(){return Tp||(Tp=1,Xu=Math.round),Xu}var el,Bp;function j7(){return Bp||(Bp=1,el=Number.isNaN||function(e){return e!==e}),el}var tl,Sp;function H7(){if(Sp)return tl;Sp=1;var t=j7();return tl=function(r){return t(r)||r===0?r:r<0?-1:1},tl}var rl,Pp;function q7(){return Pp||(Pp=1,rl=Object.getOwnPropertyDescriptor),rl}var nl,Op;function Wi(){if(Op)return nl;Op=1;var t=q7();if(t)try{t([],"length")}catch{t=null}return nl=t,nl}var il,Ip;function Va(){if(Ip)return il;Ip=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return il=t,il}var sl,kp;function Z7(){if(kp)return sl;kp=1;var t=typeof Symbol<"u"&&Symbol,e=ub();return sl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},sl}var ol,Np;function hb(){return Np||(Np=1,ol=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),ol}var al,Cp;function db(){if(Cp)return al;Cp=1;var t=lb();return al=t.getPrototypeOf||null,al}var cl,_p;function K7(){if(_p)return cl;_p=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(l,h){for(var d=[],m=0;m<l.length;m+=1)d[m]=l[m];for(var y=0;y<h.length;y+=1)d[y+l.length]=h[y];return d},o=function(l,h){for(var d=[],m=h,y=0;m<l.length;m+=1,y+=1)d[y]=l[m];return d},a=function(u,l){for(var h="",d=0;d<u.length;d+=1)h+=u[d],d+1<u.length&&(h+=l);return h};return cl=function(l){var h=this;if(typeof h!="function"||e.apply(h)!==n)throw new TypeError(t+h);for(var d=o(arguments,1),m,y=function(){if(this instanceof m){var A=h.apply(this,i(d,arguments));return Object(A)===A?A:this}return h.apply(l,i(d,arguments))},w=r(0,h.length-d.length),T=[],R=0;R<w;R++)T[R]="$"+R;if(m=Function("binder","return function ("+a(T,",")+"){ return binder.apply(this,arguments); }")(y),h.prototype){var O=function(){};O.prototype=h.prototype,m.prototype=new O,O.prototype=null}return m},cl}var ul,Fp;function so(){if(Fp)return ul;Fp=1;var t=K7();return ul=Function.prototype.bind||t,ul}var ll,Dp;function wh(){return Dp||(Dp=1,ll=Function.prototype.call),ll}var fl,Lp;function Ah(){return Lp||(Lp=1,fl=Function.prototype.apply),fl}var hl,Up;function J7(){return Up||(Up=1,hl=typeof Reflect<"u"&&Reflect&&Reflect.apply),hl}var dl,Mp;function pb(){if(Mp)return dl;Mp=1;var t=so(),e=Ah(),r=wh(),n=J7();return dl=n||t.call(r,e),dl}var pl,zp;function Eh(){if(zp)return pl;zp=1;var t=so(),e=io(),r=wh(),n=pb();return pl=function(o){if(o.length<1||typeof o[0]!="function")throw new e("a function is required");return n(t,r,o)},pl}var ml,$p;function W7(){if($p)return ml;$p=1;var t=Eh(),e=Wi(),r;try{r=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var n=!!r&&e&&e(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return ml=n&&typeof n.get=="function"?t([n.get]):typeof o=="function"?function(u){return o(u==null?u:i(u))}:!1,ml}var gl,Vp;function vh(){if(Vp)return gl;Vp=1;var t=hb(),e=db(),r=W7();return gl=t?function(i){return t(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:r?function(i){return r(i)}:null,gl}var yl,Gp;function mb(){if(Gp)return yl;Gp=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=so();return yl=r.call(t,e),yl}var bl,jp;function gb(){if(jp)return bl;jp=1;var t,e=lb(),r=C7(),n=_7(),i=F7(),o=D7(),a=fb(),u=io(),l=L7(),h=U7(),d=M7(),m=z7(),y=$7(),w=V7(),T=G7(),R=H7(),O=Function,A=function(ie){try{return O('"use strict"; return ('+ie+").constructor;")()}catch{}},I=Wi(),B=Va(),S=function(){throw new u},N=I?(function(){try{return arguments.callee,S}catch{try{return I(arguments,"callee").get}catch{return S}}})():S,_=Z7()(),D=vh(),L=db(),H=hb(),K=Ah(),le=wh(),U={},ge=typeof Uint8Array>"u"||!D?t:D(Uint8Array),Be={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":_&&D?D([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":U,"%AsyncGenerator%":U,"%AsyncGeneratorFunction%":U,"%AsyncIteratorPrototype%":U,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":O,"%GeneratorFunction%":U,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":_&&D?D(D([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!_||!D?t:D(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":I,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":i,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!_||!D?t:D(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":_&&D?D(""[Symbol.iterator]()):t,"%Symbol%":_?Symbol:t,"%SyntaxError%":a,"%ThrowTypeError%":N,"%TypedArray%":ge,"%TypeError%":u,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":le,"%Function.prototype.apply%":K,"%Object.defineProperty%":B,"%Object.getPrototypeOf%":L,"%Math.abs%":h,"%Math.floor%":d,"%Math.max%":m,"%Math.min%":y,"%Math.pow%":w,"%Math.round%":T,"%Math.sign%":R,"%Reflect.getPrototypeOf%":H};if(D)try{null.error}catch(ie){var ne=D(D(ie));Be["%Error.prototype%"]=ne}var ue=function ie(oe){var P;if(oe==="%AsyncFunction%")P=A("async function () {}");else if(oe==="%GeneratorFunction%")P=A("function* () {}");else if(oe==="%AsyncGeneratorFunction%")P=A("async function* () {}");else if(oe==="%AsyncGenerator%"){var k=ie("%AsyncGeneratorFunction%");k&&(P=k.prototype)}else if(oe==="%AsyncIteratorPrototype%"){var Z=ie("%AsyncGenerator%");Z&&D&&(P=D(Z.prototype))}return Be[oe]=P,P},ye={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ae=so(),Ee=mb(),Se=Ae.call(le,Array.prototype.concat),Ue=Ae.call(K,Array.prototype.splice),_e=Ae.call(le,String.prototype.replace),j=Ae.call(le,String.prototype.slice),J=Ae.call(le,RegExp.prototype.exec),se=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,M=/\\(\\)?/g,z=function(oe){var P=j(oe,0,1),k=j(oe,-1);if(P==="%"&&k!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(k==="%"&&P!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Z=[];return _e(oe,se,function(fe,Oe,xe,Fe){Z[Z.length]=xe?_e(Fe,M,"$1"):Oe||fe}),Z},Q=function(oe,P){var k=oe,Z;if(Ee(ye,k)&&(Z=ye[k],k="%"+Z[0]+"%"),Ee(Be,k)){var fe=Be[k];if(fe===U&&(fe=ue(k)),typeof fe>"u"&&!P)throw new u("intrinsic "+oe+" exists, but is not available. Please file an issue!");return{alias:Z,name:k,value:fe}}throw new a("intrinsic "+oe+" does not exist!")};return bl=function(oe,P){if(typeof oe!="string"||oe.length===0)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof P!="boolean")throw new u('"allowMissing" argument must be a boolean');if(J(/^%?[^%]*%?$/,oe)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var k=z(oe),Z=k.length>0?k[0]:"",fe=Q("%"+Z+"%",P),Oe=fe.name,xe=fe.value,Fe=!1,Lt=fe.alias;Lt&&(Z=Lt[0],Ue(k,Se([0,1],Lt)));for(var X=1,xt=!0;X<k.length;X+=1){var wt=k[X],qe=j(wt,0,1),st=j(wt,-1);if((qe==='"'||qe==="'"||qe==="`"||st==='"'||st==="'"||st==="`")&&qe!==st)throw new a("property names with quotes must have matching quotes");if((wt==="constructor"||!xt)&&(Fe=!0),Z+="."+wt,Oe="%"+Z+"%",Ee(Be,Oe))xe=Be[Oe];else if(xe!=null){if(!(wt in xe)){if(!P)throw new u("base intrinsic for "+oe+" exists, but the property is not available.");return}if(I&&X+1>=k.length){var jt=I(xe,wt);xt=!!jt,xt&&"get"in jt&&!("originalValue"in jt.get)?xe=jt.get:xe=xe[wt]}else xt=Ee(xe,wt),xe=xe[wt];xt&&!Fe&&(Be[Oe]=xe)}}return xe},bl}var xl,Hp;function oo(){if(Hp)return xl;Hp=1;var t=gb(),e=Eh(),r=e([t("%String.prototype.indexOf%")]);return xl=function(i,o){var a=t(i,!!o);return typeof a=="function"&&r(i,".prototype.")>-1?e([a]):a},xl}var wl,qp;function Q7(){if(qp)return wl;qp=1;var t=$a()(),e=oo(),r=e("Object.prototype.toString"),n=function(u){return t&&u&&typeof u=="object"&&Symbol.toStringTag in u?!1:r(u)==="[object Arguments]"},i=function(u){return n(u)?!0:u!==null&&typeof u=="object"&&"length"in u&&typeof u.length=="number"&&u.length>=0&&r(u)!=="[object Array]"&&"callee"in u&&r(u.callee)==="[object Function]"},o=(function(){return n(arguments)})();return n.isLegacyArguments=i,wl=o?n:i,wl}var Al,Zp;function Y7(){if(Zp)return Al;Zp=1;var t=oo(),e=$a()(),r=mb(),n=Wi(),i;if(e){var o=t("RegExp.prototype.exec"),a={},u=function(){throw a},l={toString:u,valueOf:u};typeof Symbol.toPrimitive=="symbol"&&(l[Symbol.toPrimitive]=u),i=function(y){if(!y||typeof y!="object")return!1;var w=n(y,"lastIndex"),T=w&&r(w,"value");if(!T)return!1;try{o(y,l)}catch(R){return R===a}}}else{var h=t("Object.prototype.toString"),d="[object RegExp]";i=function(y){return!y||typeof y!="object"&&typeof y!="function"?!1:h(y)===d}}return Al=i,Al}var El,Kp;function X7(){if(Kp)return El;Kp=1;var t=oo(),e=Y7(),r=t("RegExp.prototype.exec"),n=io();return El=function(o){if(!e(o))throw new n("`regex` must be a RegExp");return function(u){return r(o,u)!==null}},El}var vl,Jp;function e9(){if(Jp)return vl;Jp=1;const t=(function*(){}).constructor;return vl=()=>t,vl}var Rl,Wp;function t9(){if(Wp)return Rl;Wp=1;var t=oo(),e=X7(),r=e(/^\s*(?:function)?\*/),n=$a()(),i=vh(),o=t("Object.prototype.toString"),a=t("Function.prototype.toString"),u=e9();return Rl=function(h){if(typeof h!="function")return!1;if(r(a(h)))return!0;if(!n){var d=o(h);return d==="[object GeneratorFunction]"}if(!i)return!1;var m=u();return m&&i(h)===m.prototype},Rl}var Tl,Qp;function r9(){if(Qp)return Tl;Qp=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},e(function(){throw 42},null,r)}catch(I){I!==n&&(e=null)}else e=null;var i=/^\s*class\b/,o=function(B){try{var S=t.call(B);return i.test(S)}catch{return!1}},a=function(B){try{return o(B)?!1:(t.call(B),!0)}catch{return!1}},u=Object.prototype.toString,l="[object Object]",h="[object Function]",d="[object GeneratorFunction]",m="[object HTMLAllCollection]",y="[object HTML document.all class]",w="[object HTMLCollection]",T=typeof Symbol=="function"&&!!Symbol.toStringTag,R=!(0 in[,]),O=function(){return!1};if(typeof document=="object"){var A=document.all;u.call(A)===u.call(document.all)&&(O=function(B){if((R||!B)&&(typeof B>"u"||typeof B=="object"))try{var S=u.call(B);return(S===m||S===y||S===w||S===l)&&B("")==null}catch{}return!1})}return Tl=e?function(B){if(O(B))return!0;if(!B||typeof B!="function"&&typeof B!="object")return!1;try{e(B,null,r)}catch(S){if(S!==n)return!1}return!o(B)&&a(B)}:function(B){if(O(B))return!0;if(!B||typeof B!="function"&&typeof B!="object")return!1;if(T)return a(B);if(o(B))return!1;var S=u.call(B);return S!==h&&S!==d&&!/^\[object HTML/.test(S)?!1:a(B)},Tl}var Bl,Yp;function n9(){if(Yp)return Bl;Yp=1;var t=r9(),e=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(l,h,d){for(var m=0,y=l.length;m<y;m++)r.call(l,m)&&(d==null?h(l[m],m,l):h.call(d,l[m],m,l))},i=function(l,h,d){for(var m=0,y=l.length;m<y;m++)d==null?h(l.charAt(m),m,l):h.call(d,l.charAt(m),m,l)},o=function(l,h,d){for(var m in l)r.call(l,m)&&(d==null?h(l[m],m,l):h.call(d,l[m],m,l))};function a(u){return e.call(u)==="[object Array]"}return Bl=function(l,h,d){if(!t(h))throw new TypeError("iterator must be a function");var m;arguments.length>=3&&(m=d),a(l)?n(l,h,m):typeof l=="string"?i(l,h,m):o(l,h,m)},Bl}var Sl,Xp;function i9(){return Xp||(Xp=1,Sl=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Sl}var Pl,em;function s9(){if(em)return Pl;em=1;var t=i9(),e=typeof globalThis>"u"?Ir:globalThis;return Pl=function(){for(var n=[],i=0;i<t.length;i++)typeof e[t[i]]=="function"&&(n[n.length]=t[i]);return n},Pl}var Ol={exports:{}},Il,tm;function o9(){if(tm)return Il;tm=1;var t=Va(),e=fb(),r=io(),n=Wi();return Il=function(o,a,u){if(!o||typeof o!="object"&&typeof o!="function")throw new r("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,m=arguments.length>6?arguments[6]:!1,y=!!n&&n(o,a);if(t)t(o,a,{configurable:d===null&&y?y.configurable:!d,enumerable:l===null&&y?y.enumerable:!l,value:u,writable:h===null&&y?y.writable:!h});else if(m||!l&&!h&&!d)o[a]=u;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Il}var kl,rm;function a9(){if(rm)return kl;rm=1;var t=Va(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},kl=e,kl}var Nl,nm;function c9(){if(nm)return Nl;nm=1;var t=gb(),e=o9(),r=a9()(),n=Wi(),i=io(),o=t("%Math.floor%");return Nl=function(u,l){if(typeof u!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new i("`length` must be a positive 32-bit integer");var h=arguments.length>2&&!!arguments[2],d=!0,m=!0;if("length"in u&&n){var y=n(u,"length");y&&!y.configurable&&(d=!1),y&&!y.writable&&(m=!1)}return(d||m||!h)&&(r?e(u,"length",l,!0,!0):e(u,"length",l)),u},Nl}var Cl,im;function u9(){if(im)return Cl;im=1;var t=so(),e=Ah(),r=pb();return Cl=function(){return r(t,e,arguments)},Cl}var sm;function l9(){return sm||(sm=1,(function(t){var e=c9(),r=Va(),n=Eh(),i=u9();t.exports=function(a){var u=n(arguments),l=1+a.length-(arguments.length-1);return e(u,l>0?l:0,!0)},r?r(t.exports,"apply",{value:i}):t.exports.apply=i})(Ol)),Ol.exports}var _l,om;function yb(){if(om)return _l;om=1;var t=n9(),e=s9(),r=l9(),n=oo(),i=Wi(),o=vh(),a=n("Object.prototype.toString"),u=$a()(),l=typeof globalThis>"u"?Ir:globalThis,h=e(),d=n("String.prototype.slice"),m=n("Array.prototype.indexOf",!0)||function(A,I){for(var B=0;B<A.length;B+=1)if(A[B]===I)return B;return-1},y={__proto__:null};u&&i&&o?t(h,function(O){var A=new l[O];if(Symbol.toStringTag in A&&o){var I=o(A),B=i(I,Symbol.toStringTag);if(!B&&I){var S=o(I);B=i(S,Symbol.toStringTag)}if(B&&B.get){var N=r(B.get);y["$"+O]=N}}}):t(h,function(O){var A=new l[O],I=A.slice||A.set;if(I){var B=r(I);y["$"+O]=B}});function w(O){var A=!1;return t(y,function(I,B){if(!A)try{"$"+I(O)===B&&(A=d(B,1))}catch{}}),A}function T(O){var A=!1;return t(y,function(I,B){if(!A)try{I(O),A=d(B,1)}catch{}}),A}function R(O){return m(h,O)>-1}return _l=function(A){if(!A||typeof A!="object")return!1;if(!u){var I=d(a(A),8,-1);return R(I)?I:I!=="Object"?!1:T(A)}return i?w(A):null},_l}var Fl,am;function f9(){if(am)return Fl;am=1;var t=yb();return Fl=function(r){return!!t(r)},Fl}var cm;function h9(){return cm||(cm=1,(function(t){var e=Q7(),r=t9(),n=yb(),i=f9();function o(X){return X.call.bind(X)}var a=typeof BigInt<"u",u=typeof Symbol<"u",l=o(Object.prototype.toString),h=o(Number.prototype.valueOf),d=o(String.prototype.valueOf),m=o(Boolean.prototype.valueOf);if(a)var y=o(BigInt.prototype.valueOf);if(u)var w=o(Symbol.prototype.valueOf);function T(X,xt){if(typeof X!="object")return!1;try{return xt(X),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=i;function R(X){return typeof Promise<"u"&&X instanceof Promise||X!==null&&typeof X=="object"&&typeof X.then=="function"&&typeof X.catch=="function"}t.isPromise=R;function O(X){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(X):i(X)||j(X)}t.isArrayBufferView=O;function A(X){return n(X)==="Uint8Array"}t.isUint8Array=A;function I(X){return n(X)==="Uint8ClampedArray"}t.isUint8ClampedArray=I;function B(X){return n(X)==="Uint16Array"}t.isUint16Array=B;function S(X){return n(X)==="Uint32Array"}t.isUint32Array=S;function N(X){return n(X)==="Int8Array"}t.isInt8Array=N;function _(X){return n(X)==="Int16Array"}t.isInt16Array=_;function D(X){return n(X)==="Int32Array"}t.isInt32Array=D;function L(X){return n(X)==="Float32Array"}t.isFloat32Array=L;function H(X){return n(X)==="Float64Array"}t.isFloat64Array=H;function K(X){return n(X)==="BigInt64Array"}t.isBigInt64Array=K;function le(X){return n(X)==="BigUint64Array"}t.isBigUint64Array=le;function U(X){return l(X)==="[object Map]"}U.working=typeof Map<"u"&&U(new Map);function ge(X){return typeof Map>"u"?!1:U.working?U(X):X instanceof Map}t.isMap=ge;function Be(X){return l(X)==="[object Set]"}Be.working=typeof Set<"u"&&Be(new Set);function ne(X){return typeof Set>"u"?!1:Be.working?Be(X):X instanceof Set}t.isSet=ne;function ue(X){return l(X)==="[object WeakMap]"}ue.working=typeof WeakMap<"u"&&ue(new WeakMap);function ye(X){return typeof WeakMap>"u"?!1:ue.working?ue(X):X instanceof WeakMap}t.isWeakMap=ye;function Ae(X){return l(X)==="[object WeakSet]"}Ae.working=typeof WeakSet<"u"&&Ae(new WeakSet);function Ee(X){return Ae(X)}t.isWeakSet=Ee;function Se(X){return l(X)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function Ue(X){return typeof ArrayBuffer>"u"?!1:Se.working?Se(X):X instanceof ArrayBuffer}t.isArrayBuffer=Ue;function _e(X){return l(X)==="[object DataView]"}_e.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&_e(new DataView(new ArrayBuffer(1),0,1));function j(X){return typeof DataView>"u"?!1:_e.working?_e(X):X instanceof DataView}t.isDataView=j;var J=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function se(X){return l(X)==="[object SharedArrayBuffer]"}function M(X){return typeof J>"u"?!1:(typeof se.working>"u"&&(se.working=se(new J)),se.working?se(X):X instanceof J)}t.isSharedArrayBuffer=M;function z(X){return l(X)==="[object AsyncFunction]"}t.isAsyncFunction=z;function Q(X){return l(X)==="[object Map Iterator]"}t.isMapIterator=Q;function ie(X){return l(X)==="[object Set Iterator]"}t.isSetIterator=ie;function oe(X){return l(X)==="[object Generator]"}t.isGeneratorObject=oe;function P(X){return l(X)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=P;function k(X){return T(X,h)}t.isNumberObject=k;function Z(X){return T(X,d)}t.isStringObject=Z;function fe(X){return T(X,m)}t.isBooleanObject=fe;function Oe(X){return a&&T(X,y)}t.isBigIntObject=Oe;function xe(X){return u&&T(X,w)}t.isSymbolObject=xe;function Fe(X){return k(X)||Z(X)||fe(X)||Oe(X)||xe(X)}t.isBoxedPrimitive=Fe;function Lt(X){return typeof Uint8Array<"u"&&(Ue(X)||M(X))}t.isAnyArrayBuffer=Lt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(X){Object.defineProperty(t,X,{enumerable:!1,value:function(){throw new Error(X+" is not supported in userland")}})})})(Lu)),Lu}var Dl,um;function d9(){return um||(um=1,Dl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Dl}var lm;function bb(){return lm||(lm=1,(function(t){var e={},r=Object.getOwnPropertyDescriptors||function(J){for(var se=Object.keys(J),M={},z=0;z<se.length;z++)M[se[z]]=Object.getOwnPropertyDescriptor(J,se[z]);return M},n=/%[sdj%]/g;t.format=function(j){if(!_(j)){for(var J=[],se=0;se<arguments.length;se++)J.push(u(arguments[se]));return J.join(" ")}for(var se=1,M=arguments,z=M.length,Q=String(j).replace(n,function(oe){if(oe==="%%")return"%";if(se>=z)return oe;switch(oe){case"%s":return String(M[se++]);case"%d":return Number(M[se++]);case"%j":try{return JSON.stringify(M[se++])}catch{return"[Circular]"}default:return oe}}),ie=M[se];se<z;ie=M[++se])B(ie)||!K(ie)?Q+=" "+ie:Q+=" "+u(ie);return Q},t.deprecate=function(j,J){if(typeof Ce<"u"&&Ce.noDeprecation===!0)return j;if(typeof Ce>"u")return function(){return t.deprecate(j,J).apply(this,arguments)};var se=!1;function M(){if(!se){if(Ce.throwDeprecation)throw new Error(J);Ce.traceDeprecation?console.trace(J):console.error(J),se=!0}return j.apply(this,arguments)}return M};var i={},o=/^$/;if(e.NODE_DEBUG){var a=e.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+a+"$","i")}t.debuglog=function(j){if(j=j.toUpperCase(),!i[j])if(o.test(j)){var J=Ce.pid;i[j]=function(){var se=t.format.apply(t,arguments);console.error("%s %d: %s",j,J,se)}}else i[j]=function(){};return i[j]};function u(j,J){var se={seen:[],stylize:h};return arguments.length>=3&&(se.depth=arguments[2]),arguments.length>=4&&(se.colors=arguments[3]),I(J)?se.showHidden=J:J&&t._extend(se,J),L(se.showHidden)&&(se.showHidden=!1),L(se.depth)&&(se.depth=2),L(se.colors)&&(se.colors=!1),L(se.customInspect)&&(se.customInspect=!0),se.colors&&(se.stylize=l),m(se,j,se.depth)}t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(j,J){var se=u.styles[J];return se?"\x1B["+u.colors[se][0]+"m"+j+"\x1B["+u.colors[se][1]+"m":j}function h(j,J){return j}function d(j){var J={};return j.forEach(function(se,M){J[se]=!0}),J}function m(j,J,se){if(j.customInspect&&J&&ge(J.inspect)&&J.inspect!==t.inspect&&!(J.constructor&&J.constructor.prototype===J)){var M=J.inspect(se,j);return _(M)||(M=m(j,M,se)),M}var z=y(j,J);if(z)return z;var Q=Object.keys(J),ie=d(Q);if(j.showHidden&&(Q=Object.getOwnPropertyNames(J)),U(J)&&(Q.indexOf("message")>=0||Q.indexOf("description")>=0))return w(J);if(Q.length===0){if(ge(J)){var oe=J.name?": "+J.name:"";return j.stylize("[Function"+oe+"]","special")}if(H(J))return j.stylize(RegExp.prototype.toString.call(J),"regexp");if(le(J))return j.stylize(Date.prototype.toString.call(J),"date");if(U(J))return w(J)}var P="",k=!1,Z=["{","}"];if(A(J)&&(k=!0,Z=["[","]"]),ge(J)){var fe=J.name?": "+J.name:"";P=" [Function"+fe+"]"}if(H(J)&&(P=" "+RegExp.prototype.toString.call(J)),le(J)&&(P=" "+Date.prototype.toUTCString.call(J)),U(J)&&(P=" "+w(J)),Q.length===0&&(!k||J.length==0))return Z[0]+P+Z[1];if(se<0)return H(J)?j.stylize(RegExp.prototype.toString.call(J),"regexp"):j.stylize("[Object]","special");j.seen.push(J);var Oe;return k?Oe=T(j,J,se,ie,Q):Oe=Q.map(function(xe){return R(j,J,se,ie,xe,k)}),j.seen.pop(),O(Oe,P,Z)}function y(j,J){if(L(J))return j.stylize("undefined","undefined");if(_(J)){var se="'"+JSON.stringify(J).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return j.stylize(se,"string")}if(N(J))return j.stylize(""+J,"number");if(I(J))return j.stylize(""+J,"boolean");if(B(J))return j.stylize("null","null")}function w(j){return"["+Error.prototype.toString.call(j)+"]"}function T(j,J,se,M,z){for(var Q=[],ie=0,oe=J.length;ie<oe;++ie)Ee(J,String(ie))?Q.push(R(j,J,se,M,String(ie),!0)):Q.push("");return z.forEach(function(P){P.match(/^\d+$/)||Q.push(R(j,J,se,M,P,!0))}),Q}function R(j,J,se,M,z,Q){var ie,oe,P;if(P=Object.getOwnPropertyDescriptor(J,z)||{value:J[z]},P.get?P.set?oe=j.stylize("[Getter/Setter]","special"):oe=j.stylize("[Getter]","special"):P.set&&(oe=j.stylize("[Setter]","special")),Ee(M,z)||(ie="["+z+"]"),oe||(j.seen.indexOf(P.value)<0?(B(se)?oe=m(j,P.value,null):oe=m(j,P.value,se-1),oe.indexOf(`
76
+ `)>-1&&(Q?oe=oe.split(`
77
+ `).map(function(k){return" "+k}).join(`
78
+ `).slice(2):oe=`
79
+ `+oe.split(`
80
+ `).map(function(k){return" "+k}).join(`
81
+ `))):oe=j.stylize("[Circular]","special")),L(ie)){if(Q&&z.match(/^\d+$/))return oe;ie=JSON.stringify(""+z),ie.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(ie=ie.slice(1,-1),ie=j.stylize(ie,"name")):(ie=ie.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),ie=j.stylize(ie,"string"))}return ie+": "+oe}function O(j,J,se){var M=j.reduce(function(z,Q){return Q.indexOf(`
82
+ `)>=0,z+Q.replace(/\u001b\[\d\d?m/g,"").length+1},0);return M>60?se[0]+(J===""?"":J+`
83
+ `)+" "+j.join(`,
84
+ `)+" "+se[1]:se[0]+J+" "+j.join(", ")+" "+se[1]}t.types=h9();function A(j){return Array.isArray(j)}t.isArray=A;function I(j){return typeof j=="boolean"}t.isBoolean=I;function B(j){return j===null}t.isNull=B;function S(j){return j==null}t.isNullOrUndefined=S;function N(j){return typeof j=="number"}t.isNumber=N;function _(j){return typeof j=="string"}t.isString=_;function D(j){return typeof j=="symbol"}t.isSymbol=D;function L(j){return j===void 0}t.isUndefined=L;function H(j){return K(j)&&ne(j)==="[object RegExp]"}t.isRegExp=H,t.types.isRegExp=H;function K(j){return typeof j=="object"&&j!==null}t.isObject=K;function le(j){return K(j)&&ne(j)==="[object Date]"}t.isDate=le,t.types.isDate=le;function U(j){return K(j)&&(ne(j)==="[object Error]"||j instanceof Error)}t.isError=U,t.types.isNativeError=U;function ge(j){return typeof j=="function"}t.isFunction=ge;function Be(j){return j===null||typeof j=="boolean"||typeof j=="number"||typeof j=="string"||typeof j=="symbol"||typeof j>"u"}t.isPrimitive=Be,t.isBuffer=d9();function ne(j){return Object.prototype.toString.call(j)}function ue(j){return j<10?"0"+j.toString(10):j.toString(10)}var ye=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ae(){var j=new Date,J=[ue(j.getHours()),ue(j.getMinutes()),ue(j.getSeconds())].join(":");return[j.getDate(),ye[j.getMonth()],J].join(" ")}t.log=function(){console.log("%s - %s",Ae(),t.format.apply(t,arguments))},t.inherits=oi(),t._extend=function(j,J){if(!J||!K(J))return j;for(var se=Object.keys(J),M=se.length;M--;)j[se[M]]=J[se[M]];return j};function Ee(j,J){return Object.prototype.hasOwnProperty.call(j,J)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(J){if(typeof J!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&J[Se]){var se=J[Se];if(typeof se!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(se,Se,{value:se,enumerable:!1,writable:!1,configurable:!0}),se}function se(){for(var M,z,Q=new Promise(function(P,k){M=P,z=k}),ie=[],oe=0;oe<arguments.length;oe++)ie.push(arguments[oe]);ie.push(function(P,k){P?z(P):M(k)});try{J.apply(this,ie)}catch(P){z(P)}return Q}return Object.setPrototypeOf(se,Object.getPrototypeOf(J)),Se&&Object.defineProperty(se,Se,{value:se,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(se,r(J))},t.promisify.custom=Se;function Ue(j,J){if(!j){var se=new Error("Promise was rejected with a falsy value");se.reason=j,j=se}return J(j)}function _e(j){if(typeof j!="function")throw new TypeError('The "original" argument must be of type Function');function J(){for(var se=[],M=0;M<arguments.length;M++)se.push(arguments[M]);var z=se.pop();if(typeof z!="function")throw new TypeError("The last argument must be of type Function");var Q=this,ie=function(){return z.apply(Q,arguments)};j.apply(this,se).then(function(oe){Ce.nextTick(ie.bind(null,null,oe))},function(oe){Ce.nextTick(Ue.bind(null,oe,ie))})}return Object.setPrototypeOf(J,Object.getPrototypeOf(j)),Object.defineProperties(J,r(j)),J}t.callbackify=_e})(Du)),Du}var Ll,fm;function p9(){if(fm)return Ll;fm=1;function t(T,R){var O=Object.keys(T);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(T);R&&(A=A.filter(function(I){return Object.getOwnPropertyDescriptor(T,I).enumerable})),O.push.apply(O,A)}return O}function e(T){for(var R=1;R<arguments.length;R++){var O=arguments[R]!=null?arguments[R]:{};R%2?t(Object(O),!0).forEach(function(A){r(T,A,O[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(O)):t(Object(O)).forEach(function(A){Object.defineProperty(T,A,Object.getOwnPropertyDescriptor(O,A))})}return T}function r(T,R,O){return R=a(R),R in T?Object.defineProperty(T,R,{value:O,enumerable:!0,configurable:!0,writable:!0}):T[R]=O,T}function n(T,R){if(!(T instanceof R))throw new TypeError("Cannot call a class as a function")}function i(T,R){for(var O=0;O<R.length;O++){var A=R[O];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(T,a(A.key),A)}}function o(T,R,O){return R&&i(T.prototype,R),Object.defineProperty(T,"prototype",{writable:!1}),T}function a(T){var R=u(T,"string");return typeof R=="symbol"?R:String(R)}function u(T,R){if(typeof T!="object"||T===null)return T;var O=T[Symbol.toPrimitive];if(O!==void 0){var A=O.call(T,R);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(T)}var l=za(),h=l.Buffer,d=bb(),m=d.inspect,y=m&&m.custom||"inspect";function w(T,R,O){h.prototype.copy.call(T,R,O)}return Ll=(function(){function T(){n(this,T),this.head=null,this.tail=null,this.length=0}return o(T,[{key:"push",value:function(O){var A={data:O,next:null};this.length>0?this.tail.next=A:this.head=A,this.tail=A,++this.length}},{key:"unshift",value:function(O){var A={data:O,next:this.head};this.length===0&&(this.tail=A),this.head=A,++this.length}},{key:"shift",value:function(){if(this.length!==0){var O=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,O}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(O){if(this.length===0)return"";for(var A=this.head,I=""+A.data;A=A.next;)I+=O+A.data;return I}},{key:"concat",value:function(O){if(this.length===0)return h.alloc(0);for(var A=h.allocUnsafe(O>>>0),I=this.head,B=0;I;)w(I.data,A,B),B+=I.data.length,I=I.next;return A}},{key:"consume",value:function(O,A){var I;return O<this.head.data.length?(I=this.head.data.slice(0,O),this.head.data=this.head.data.slice(O)):O===this.head.data.length?I=this.shift():I=A?this._getString(O):this._getBuffer(O),I}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(O){var A=this.head,I=1,B=A.data;for(O-=B.length;A=A.next;){var S=A.data,N=O>S.length?S.length:O;if(N===S.length?B+=S:B+=S.slice(0,O),O-=N,O===0){N===S.length?(++I,A.next?this.head=A.next:this.head=this.tail=null):(this.head=A,A.data=S.slice(N));break}++I}return this.length-=I,B}},{key:"_getBuffer",value:function(O){var A=h.allocUnsafe(O),I=this.head,B=1;for(I.data.copy(A),O-=I.data.length;I=I.next;){var S=I.data,N=O>S.length?S.length:O;if(S.copy(A,A.length-O,0,N),O-=N,O===0){N===S.length?(++B,I.next?this.head=I.next:this.head=this.tail=null):(this.head=I,I.data=S.slice(N));break}++B}return this.length-=B,A}},{key:y,value:function(O,A){return m(this,e(e({},A),{},{depth:0,customInspect:!1}))}}]),T})(),Ll}var Ul,hm;function xb(){if(hm)return Ul;hm=1;function t(a,u){var l=this,h=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return h||d?(u?u(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ce.nextTick(i,this,a)):Ce.nextTick(i,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(m){!u&&m?l._writableState?l._writableState.errorEmitted?Ce.nextTick(r,l):(l._writableState.errorEmitted=!0,Ce.nextTick(e,l,m)):Ce.nextTick(e,l,m):u?(Ce.nextTick(r,l),u(m)):Ce.nextTick(r,l)}),this)}function e(a,u){i(a,u),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function n(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(a,u){a.emit("error",u)}function o(a,u){var l=a._readableState,h=a._writableState;l&&l.autoDestroy||h&&h.autoDestroy?a.destroy(u):a.emit("error",u)}return Ul={destroy:t,undestroy:n,errorOrDestroy:o},Ul}var Ml={},dm;function Qi(){if(dm)return Ml;dm=1;function t(u,l){u.prototype=Object.create(l.prototype),u.prototype.constructor=u,u.__proto__=l}var e={};function r(u,l,h){h||(h=Error);function d(y,w,T){return typeof l=="string"?l:l(y,w,T)}var m=(function(y){t(w,y);function w(T,R,O){return y.call(this,d(T,R,O))||this}return w})(h);m.prototype.name=h.name,m.prototype.code=u,e[u]=m}function n(u,l){if(Array.isArray(u)){var h=u.length;return u=u.map(function(d){return String(d)}),h>2?"one of ".concat(l," ").concat(u.slice(0,h-1).join(", "),", or ")+u[h-1]:h===2?"one of ".concat(l," ").concat(u[0]," or ").concat(u[1]):"of ".concat(l," ").concat(u[0])}else return"of ".concat(l," ").concat(String(u))}function i(u,l,h){return u.substr(0,l.length)===l}function o(u,l,h){return(h===void 0||h>u.length)&&(h=u.length),u.substring(h-l.length,h)===l}function a(u,l,h){return typeof h!="number"&&(h=0),h+l.length>u.length?!1:u.indexOf(l,h)!==-1}return r("ERR_INVALID_OPT_VALUE",function(u,l){return'The value "'+l+'" is invalid for option "'+u+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(u,l,h){var d;typeof l=="string"&&i(l,"not ")?(d="must not be",l=l.replace(/^not /,"")):d="must be";var m;if(o(u," argument"))m="The ".concat(u," ").concat(d," ").concat(n(l,"type"));else{var y=a(u,".")?"property":"argument";m='The "'.concat(u,'" ').concat(y," ").concat(d," ").concat(n(l,"type"))}return m+=". Received type ".concat(typeof h),m},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(u){return"The "+u+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(u){return"Cannot call "+u+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(u){return"Unknown encoding: "+u},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ml.codes=e,Ml}var zl,pm;function wb(){if(pm)return zl;pm=1;var t=Qi().codes.ERR_INVALID_OPT_VALUE;function e(n,i,o){return n.highWaterMark!=null?n.highWaterMark:i?n[o]:null}function r(n,i,o,a){var u=e(i,a,o);if(u!=null){if(!(isFinite(u)&&Math.floor(u)===u)||u<0){var l=a?o:"highWaterMark";throw new t(l,u)}return Math.floor(u)}return n.objectMode?16:16*1024}return zl={getHighWaterMark:r},zl}var $l,mm;function m9(){if(mm)return $l;mm=1,$l=t;function t(r,n){if(e("noDeprecation"))return r;var i=!1;function o(){if(!i){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),i=!0}return r.apply(this,arguments)}return o}function e(r){try{if(!Ir.localStorage)return!1}catch{return!1}var n=Ir.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return $l}var Vl,gm;function Ab(){if(gm)return Vl;gm=1,Vl=L;function t(M){var z=this;this.next=null,this.entry=null,this.finish=function(){se(z,M)}}var e;L.WritableState=_;var r={deprecate:m9()},n=cb(),i=za().Buffer,o=(typeof Ir<"u"?Ir:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(M){return i.from(M)}function u(M){return i.isBuffer(M)||M instanceof o}var l=xb(),h=wb(),d=h.getHighWaterMark,m=Qi().codes,y=m.ERR_INVALID_ARG_TYPE,w=m.ERR_METHOD_NOT_IMPLEMENTED,T=m.ERR_MULTIPLE_CALLBACK,R=m.ERR_STREAM_CANNOT_PIPE,O=m.ERR_STREAM_DESTROYED,A=m.ERR_STREAM_NULL_VALUES,I=m.ERR_STREAM_WRITE_AFTER_END,B=m.ERR_UNKNOWN_ENCODING,S=l.errorOrDestroy;oi()(L,n);function N(){}function _(M,z,Q){e=e||Ui(),M=M||{},typeof Q!="boolean"&&(Q=z instanceof e),this.objectMode=!!M.objectMode,Q&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=d(this,M,"writableHighWaterMark",Q),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ie=M.decodeStrings===!1;this.decodeStrings=!ie,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(oe){ue(z,oe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}_.prototype.getBuffer=function(){for(var z=this.bufferedRequest,Q=[];z;)Q.push(z),z=z.next;return Q},(function(){try{Object.defineProperty(_.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var D;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(D=Function.prototype[Symbol.hasInstance],Object.defineProperty(L,Symbol.hasInstance,{value:function(z){return D.call(this,z)?!0:this!==L?!1:z&&z._writableState instanceof _}})):D=function(z){return z instanceof this};function L(M){e=e||Ui();var z=this instanceof e;if(!z&&!D.call(L,this))return new L(M);this._writableState=new _(M,this,z),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),n.call(this)}L.prototype.pipe=function(){S(this,new R)};function H(M,z){var Q=new I;S(M,Q),Ce.nextTick(z,Q)}function K(M,z,Q,ie){var oe;return Q===null?oe=new A:typeof Q!="string"&&!z.objectMode&&(oe=new y("chunk",["string","Buffer"],Q)),oe?(S(M,oe),Ce.nextTick(ie,oe),!1):!0}L.prototype.write=function(M,z,Q){var ie=this._writableState,oe=!1,P=!ie.objectMode&&u(M);return P&&!i.isBuffer(M)&&(M=a(M)),typeof z=="function"&&(Q=z,z=null),P?z="buffer":z||(z=ie.defaultEncoding),typeof Q!="function"&&(Q=N),ie.ending?H(this,Q):(P||K(this,ie,M,Q))&&(ie.pendingcb++,oe=U(this,ie,P,M,z,Q)),oe},L.prototype.cork=function(){this._writableState.corked++},L.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&Ee(this,M))},L.prototype.setDefaultEncoding=function(z){if(typeof z=="string"&&(z=z.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((z+"").toLowerCase())>-1))throw new B(z);return this._writableState.defaultEncoding=z,this},Object.defineProperty(L.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function le(M,z,Q){return!M.objectMode&&M.decodeStrings!==!1&&typeof z=="string"&&(z=i.from(z,Q)),z}Object.defineProperty(L.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function U(M,z,Q,ie,oe,P){if(!Q){var k=le(z,ie,oe);ie!==k&&(Q=!0,oe="buffer",ie=k)}var Z=z.objectMode?1:ie.length;z.length+=Z;var fe=z.length<z.highWaterMark;if(fe||(z.needDrain=!0),z.writing||z.corked){var Oe=z.lastBufferedRequest;z.lastBufferedRequest={chunk:ie,encoding:oe,isBuf:Q,callback:P,next:null},Oe?Oe.next=z.lastBufferedRequest:z.bufferedRequest=z.lastBufferedRequest,z.bufferedRequestCount+=1}else ge(M,z,!1,Z,ie,oe,P);return fe}function ge(M,z,Q,ie,oe,P,k){z.writelen=ie,z.writecb=k,z.writing=!0,z.sync=!0,z.destroyed?z.onwrite(new O("write")):Q?M._writev(oe,z.onwrite):M._write(oe,P,z.onwrite),z.sync=!1}function Be(M,z,Q,ie,oe){--z.pendingcb,Q?(Ce.nextTick(oe,ie),Ce.nextTick(j,M,z),M._writableState.errorEmitted=!0,S(M,ie)):(oe(ie),M._writableState.errorEmitted=!0,S(M,ie),j(M,z))}function ne(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}function ue(M,z){var Q=M._writableState,ie=Q.sync,oe=Q.writecb;if(typeof oe!="function")throw new T;if(ne(Q),z)Be(M,Q,ie,z,oe);else{var P=Se(Q)||M.destroyed;!P&&!Q.corked&&!Q.bufferProcessing&&Q.bufferedRequest&&Ee(M,Q),ie?Ce.nextTick(ye,M,Q,P,oe):ye(M,Q,P,oe)}}function ye(M,z,Q,ie){Q||Ae(M,z),z.pendingcb--,ie(),j(M,z)}function Ae(M,z){z.length===0&&z.needDrain&&(z.needDrain=!1,M.emit("drain"))}function Ee(M,z){z.bufferProcessing=!0;var Q=z.bufferedRequest;if(M._writev&&Q&&Q.next){var ie=z.bufferedRequestCount,oe=new Array(ie),P=z.corkedRequestsFree;P.entry=Q;for(var k=0,Z=!0;Q;)oe[k]=Q,Q.isBuf||(Z=!1),Q=Q.next,k+=1;oe.allBuffers=Z,ge(M,z,!0,z.length,oe,"",P.finish),z.pendingcb++,z.lastBufferedRequest=null,P.next?(z.corkedRequestsFree=P.next,P.next=null):z.corkedRequestsFree=new t(z),z.bufferedRequestCount=0}else{for(;Q;){var fe=Q.chunk,Oe=Q.encoding,xe=Q.callback,Fe=z.objectMode?1:fe.length;if(ge(M,z,!1,Fe,fe,Oe,xe),Q=Q.next,z.bufferedRequestCount--,z.writing)break}Q===null&&(z.lastBufferedRequest=null)}z.bufferedRequest=Q,z.bufferProcessing=!1}L.prototype._write=function(M,z,Q){Q(new w("_write()"))},L.prototype._writev=null,L.prototype.end=function(M,z,Q){var ie=this._writableState;return typeof M=="function"?(Q=M,M=null,z=null):typeof z=="function"&&(Q=z,z=null),M!=null&&this.write(M,z),ie.corked&&(ie.corked=1,this.uncork()),ie.ending||J(this,ie,Q),this},Object.defineProperty(L.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Se(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function Ue(M,z){M._final(function(Q){z.pendingcb--,Q&&S(M,Q),z.prefinished=!0,M.emit("prefinish"),j(M,z)})}function _e(M,z){!z.prefinished&&!z.finalCalled&&(typeof M._final=="function"&&!z.destroyed?(z.pendingcb++,z.finalCalled=!0,Ce.nextTick(Ue,M,z)):(z.prefinished=!0,M.emit("prefinish")))}function j(M,z){var Q=Se(z);if(Q&&(_e(M,z),z.pendingcb===0&&(z.finished=!0,M.emit("finish"),z.autoDestroy))){var ie=M._readableState;(!ie||ie.autoDestroy&&ie.endEmitted)&&M.destroy()}return Q}function J(M,z,Q){z.ending=!0,j(M,z),Q&&(z.finished?Ce.nextTick(Q):M.once("finish",Q)),z.ended=!0,M.writable=!1}function se(M,z,Q){var ie=M.entry;for(M.entry=null;ie;){var oe=ie.callback;z.pendingcb--,oe(Q),ie=ie.next}z.corkedRequestsFree.next=M}return Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(z){this._writableState&&(this._writableState.destroyed=z)}}),L.prototype.destroy=l.destroy,L.prototype._undestroy=l.undestroy,L.prototype._destroy=function(M,z){z(M)},Vl}var Gl,ym;function Ui(){if(ym)return Gl;ym=1;var t=Object.keys||function(h){var d=[];for(var m in h)d.push(m);return d};Gl=a;var e=Eb(),r=Ab();oi()(a,e);for(var n=t(r.prototype),i=0;i<n.length;i++){var o=n[i];a.prototype[o]||(a.prototype[o]=r.prototype[o])}function a(h){if(!(this instanceof a))return new a(h);e.call(this,h),r.call(this,h),this.allowHalfOpen=!0,h&&(h.readable===!1&&(this.readable=!1),h.writable===!1&&(this.writable=!1),h.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||Ce.nextTick(l,this)}function l(h){h.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),Gl}var jl={},zo={exports:{}};var bm;function g9(){return bm||(bm=1,(function(t,e){var r=za(),n=r.Buffer;function i(a,u){for(var l in a)u[l]=a[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o);function o(a,u,l){return n(a,u,l)}o.prototype=Object.create(n.prototype),i(n,o),o.from=function(a,u,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,u,l)},o.alloc=function(a,u,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return u!==void 0?typeof l=="string"?h.fill(u,l):h.fill(u):h.fill(0),h},o.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},o.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(zo,zo.exports)),zo.exports}var xm;function wm(){if(xm)return jl;xm=1;var t=g9().Buffer,e=t.isEncoding||function(A){switch(A=""+A,A&&A.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(A){if(!A)return"utf8";for(var I;;)switch(A){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return A;default:if(I)return;A=(""+A).toLowerCase(),I=!0}}function n(A){var I=r(A);if(typeof I!="string"&&(t.isEncoding===e||!e(A)))throw new Error("Unknown encoding: "+A);return I||A}jl.StringDecoder=i;function i(A){this.encoding=n(A);var I;switch(this.encoding){case"utf16le":this.text=m,this.end=y,I=4;break;case"utf8":this.fillLast=l,I=4;break;case"base64":this.text=w,this.end=T,I=3;break;default:this.write=R,this.end=O;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(I)}i.prototype.write=function(A){if(A.length===0)return"";var I,B;if(this.lastNeed){if(I=this.fillLast(A),I===void 0)return"";B=this.lastNeed,this.lastNeed=0}else B=0;return B<A.length?I?I+this.text(A,B):this.text(A,B):I||""},i.prototype.end=d,i.prototype.text=h,i.prototype.fillLast=function(A){if(this.lastNeed<=A.length)return A.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,this.lastTotal-this.lastNeed,0,A.length),this.lastNeed-=A.length};function o(A){return A<=127?0:A>>5===6?2:A>>4===14?3:A>>3===30?4:A>>6===2?-1:-2}function a(A,I,B){var S=I.length-1;if(S<B)return 0;var N=o(I[S]);return N>=0?(N>0&&(A.lastNeed=N-1),N):--S<B||N===-2?0:(N=o(I[S]),N>=0?(N>0&&(A.lastNeed=N-2),N):--S<B||N===-2?0:(N=o(I[S]),N>=0?(N>0&&(N===2?N=0:A.lastNeed=N-3),N):0))}function u(A,I,B){if((I[0]&192)!==128)return A.lastNeed=0,"�";if(A.lastNeed>1&&I.length>1){if((I[1]&192)!==128)return A.lastNeed=1,"�";if(A.lastNeed>2&&I.length>2&&(I[2]&192)!==128)return A.lastNeed=2,"�"}}function l(A){var I=this.lastTotal-this.lastNeed,B=u(this,A);if(B!==void 0)return B;if(this.lastNeed<=A.length)return A.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,I,0,A.length),this.lastNeed-=A.length}function h(A,I){var B=a(this,A,I);if(!this.lastNeed)return A.toString("utf8",I);this.lastTotal=B;var S=A.length-(B-this.lastNeed);return A.copy(this.lastChar,0,S),A.toString("utf8",I,S)}function d(A){var I=A&&A.length?this.write(A):"";return this.lastNeed?I+"�":I}function m(A,I){if((A.length-I)%2===0){var B=A.toString("utf16le",I);if(B){var S=B.charCodeAt(B.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1],B.slice(0,-1)}return B}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=A[A.length-1],A.toString("utf16le",I,A.length-1)}function y(A){var I=A&&A.length?this.write(A):"";if(this.lastNeed){var B=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,B)}return I}function w(A,I){var B=(A.length-I)%3;return B===0?A.toString("base64",I):(this.lastNeed=3-B,this.lastTotal=3,B===1?this.lastChar[0]=A[A.length-1]:(this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1]),A.toString("base64",I,A.length-B))}function T(A){var I=A&&A.length?this.write(A):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function R(A){return A.toString(this.encoding)}function O(A){return A&&A.length?this.write(A):""}return jl}var Hl,Am;function Rh(){if(Am)return Hl;Am=1;var t=Qi().codes.ERR_STREAM_PREMATURE_CLOSE;function e(o){var a=!1;return function(){if(!a){a=!0;for(var u=arguments.length,l=new Array(u),h=0;h<u;h++)l[h]=arguments[h];o.apply(this,l)}}}function r(){}function n(o){return o.setHeader&&typeof o.abort=="function"}function i(o,a,u){if(typeof a=="function")return i(o,null,a);a||(a={}),u=e(u||r);var l=a.readable||a.readable!==!1&&o.readable,h=a.writable||a.writable!==!1&&o.writable,d=function(){o.writable||y()},m=o._writableState&&o._writableState.finished,y=function(){h=!1,m=!0,l||u.call(o)},w=o._readableState&&o._readableState.endEmitted,T=function(){l=!1,w=!0,h||u.call(o)},R=function(B){u.call(o,B)},O=function(){var B;if(l&&!w)return(!o._readableState||!o._readableState.ended)&&(B=new t),u.call(o,B);if(h&&!m)return(!o._writableState||!o._writableState.ended)&&(B=new t),u.call(o,B)},A=function(){o.req.on("finish",y)};return n(o)?(o.on("complete",y),o.on("abort",O),o.req?A():o.on("request",A)):h&&!o._writableState&&(o.on("end",d),o.on("close",d)),o.on("end",T),o.on("finish",y),a.error!==!1&&o.on("error",R),o.on("close",O),function(){o.removeListener("complete",y),o.removeListener("abort",O),o.removeListener("request",A),o.req&&o.req.removeListener("finish",y),o.removeListener("end",d),o.removeListener("close",d),o.removeListener("finish",y),o.removeListener("end",T),o.removeListener("error",R),o.removeListener("close",O)}}return Hl=i,Hl}var ql,Em;function y9(){if(Em)return ql;Em=1;var t;function e(B,S,N){return S=r(S),S in B?Object.defineProperty(B,S,{value:N,enumerable:!0,configurable:!0,writable:!0}):B[S]=N,B}function r(B){var S=n(B,"string");return typeof S=="symbol"?S:String(S)}function n(B,S){if(typeof B!="object"||B===null)return B;var N=B[Symbol.toPrimitive];if(N!==void 0){var _=N.call(B,S);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(B)}var i=Rh(),o=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),d=Symbol("handlePromise"),m=Symbol("stream");function y(B,S){return{value:B,done:S}}function w(B){var S=B[o];if(S!==null){var N=B[m].read();N!==null&&(B[h]=null,B[o]=null,B[a]=null,S(y(N,!1)))}}function T(B){Ce.nextTick(w,B)}function R(B,S){return function(N,_){B.then(function(){if(S[l]){N(y(void 0,!0));return}S[d](N,_)},_)}}var O=Object.getPrototypeOf(function(){}),A=Object.setPrototypeOf((t={get stream(){return this[m]},next:function(){var S=this,N=this[u];if(N!==null)return Promise.reject(N);if(this[l])return Promise.resolve(y(void 0,!0));if(this[m].destroyed)return new Promise(function(H,K){Ce.nextTick(function(){S[u]?K(S[u]):H(y(void 0,!0))})});var _=this[h],D;if(_)D=new Promise(R(_,this));else{var L=this[m].read();if(L!==null)return Promise.resolve(y(L,!1));D=new Promise(this[d])}return this[h]=D,D}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var S=this;return new Promise(function(N,_){S[m].destroy(null,function(D){if(D){_(D);return}N(y(void 0,!0))})})}),t),O),I=function(S){var N,_=Object.create(A,(N={},e(N,m,{value:S,writable:!0}),e(N,o,{value:null,writable:!0}),e(N,a,{value:null,writable:!0}),e(N,u,{value:null,writable:!0}),e(N,l,{value:S._readableState.endEmitted,writable:!0}),e(N,d,{value:function(L,H){var K=_[m].read();K?(_[h]=null,_[o]=null,_[a]=null,L(y(K,!1))):(_[o]=L,_[a]=H)},writable:!0}),N));return _[h]=null,i(S,function(D){if(D&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"){var L=_[a];L!==null&&(_[h]=null,_[o]=null,_[a]=null,L(D)),_[u]=D;return}var H=_[o];H!==null&&(_[h]=null,_[o]=null,_[a]=null,H(y(void 0,!0))),_[l]=!0}),S.on("readable",T.bind(null,_)),_};return ql=I,ql}var Zl,vm;function b9(){return vm||(vm=1,Zl=function(){throw new Error("Readable.from is not available in the browser")}),Zl}var Kl,Rm;function Eb(){if(Rm)return Kl;Rm=1,Kl=H;var t;H.ReadableState=L,xh().EventEmitter;var e=function(k,Z){return k.listeners(Z).length},r=cb(),n=za().Buffer,i=(typeof Ir<"u"?Ir:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(P){return n.from(P)}function a(P){return n.isBuffer(P)||P instanceof i}var u=bb(),l;u&&u.debuglog?l=u.debuglog("stream"):l=function(){};var h=p9(),d=xb(),m=wb(),y=m.getHighWaterMark,w=Qi().codes,T=w.ERR_INVALID_ARG_TYPE,R=w.ERR_STREAM_PUSH_AFTER_EOF,O=w.ERR_METHOD_NOT_IMPLEMENTED,A=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,I,B,S;oi()(H,r);var N=d.errorOrDestroy,_=["error","close","destroy","pause","resume"];function D(P,k,Z){if(typeof P.prependListener=="function")return P.prependListener(k,Z);!P._events||!P._events[k]?P.on(k,Z):Array.isArray(P._events[k])?P._events[k].unshift(Z):P._events[k]=[Z,P._events[k]]}function L(P,k,Z){t=t||Ui(),P=P||{},typeof Z!="boolean"&&(Z=k instanceof t),this.objectMode=!!P.objectMode,Z&&(this.objectMode=this.objectMode||!!P.readableObjectMode),this.highWaterMark=y(this,P,"readableHighWaterMark",Z),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=P.emitClose!==!1,this.autoDestroy=!!P.autoDestroy,this.destroyed=!1,this.defaultEncoding=P.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,P.encoding&&(I||(I=wm().StringDecoder),this.decoder=new I(P.encoding),this.encoding=P.encoding)}function H(P){if(t=t||Ui(),!(this instanceof H))return new H(P);var k=this instanceof t;this._readableState=new L(P,this,k),this.readable=!0,P&&(typeof P.read=="function"&&(this._read=P.read),typeof P.destroy=="function"&&(this._destroy=P.destroy)),r.call(this)}Object.defineProperty(H.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(k){this._readableState&&(this._readableState.destroyed=k)}}),H.prototype.destroy=d.destroy,H.prototype._undestroy=d.undestroy,H.prototype._destroy=function(P,k){k(P)},H.prototype.push=function(P,k){var Z=this._readableState,fe;return Z.objectMode?fe=!0:typeof P=="string"&&(k=k||Z.defaultEncoding,k!==Z.encoding&&(P=n.from(P,k),k=""),fe=!0),K(this,P,k,!1,fe)},H.prototype.unshift=function(P){return K(this,P,null,!0,!1)};function K(P,k,Z,fe,Oe){l("readableAddChunk",k);var xe=P._readableState;if(k===null)xe.reading=!1,ue(P,xe);else{var Fe;if(Oe||(Fe=U(xe,k)),Fe)N(P,Fe);else if(xe.objectMode||k&&k.length>0)if(typeof k!="string"&&!xe.objectMode&&Object.getPrototypeOf(k)!==n.prototype&&(k=o(k)),fe)xe.endEmitted?N(P,new A):le(P,xe,k,!0);else if(xe.ended)N(P,new R);else{if(xe.destroyed)return!1;xe.reading=!1,xe.decoder&&!Z?(k=xe.decoder.write(k),xe.objectMode||k.length!==0?le(P,xe,k,!1):Ee(P,xe)):le(P,xe,k,!1)}else fe||(xe.reading=!1,Ee(P,xe))}return!xe.ended&&(xe.length<xe.highWaterMark||xe.length===0)}function le(P,k,Z,fe){k.flowing&&k.length===0&&!k.sync?(k.awaitDrain=0,P.emit("data",Z)):(k.length+=k.objectMode?1:Z.length,fe?k.buffer.unshift(Z):k.buffer.push(Z),k.needReadable&&ye(P)),Ee(P,k)}function U(P,k){var Z;return!a(k)&&typeof k!="string"&&k!==void 0&&!P.objectMode&&(Z=new T("chunk",["string","Buffer","Uint8Array"],k)),Z}H.prototype.isPaused=function(){return this._readableState.flowing===!1},H.prototype.setEncoding=function(P){I||(I=wm().StringDecoder);var k=new I(P);this._readableState.decoder=k,this._readableState.encoding=this._readableState.decoder.encoding;for(var Z=this._readableState.buffer.head,fe="";Z!==null;)fe+=k.write(Z.data),Z=Z.next;return this._readableState.buffer.clear(),fe!==""&&this._readableState.buffer.push(fe),this._readableState.length=fe.length,this};var ge=1073741824;function Be(P){return P>=ge?P=ge:(P--,P|=P>>>1,P|=P>>>2,P|=P>>>4,P|=P>>>8,P|=P>>>16,P++),P}function ne(P,k){return P<=0||k.length===0&&k.ended?0:k.objectMode?1:P!==P?k.flowing&&k.length?k.buffer.head.data.length:k.length:(P>k.highWaterMark&&(k.highWaterMark=Be(P)),P<=k.length?P:k.ended?k.length:(k.needReadable=!0,0))}H.prototype.read=function(P){l("read",P),P=parseInt(P,10);var k=this._readableState,Z=P;if(P!==0&&(k.emittedReadable=!1),P===0&&k.needReadable&&((k.highWaterMark!==0?k.length>=k.highWaterMark:k.length>0)||k.ended))return l("read: emitReadable",k.length,k.ended),k.length===0&&k.ended?Q(this):ye(this),null;if(P=ne(P,k),P===0&&k.ended)return k.length===0&&Q(this),null;var fe=k.needReadable;l("need readable",fe),(k.length===0||k.length-P<k.highWaterMark)&&(fe=!0,l("length less than watermark",fe)),k.ended||k.reading?(fe=!1,l("reading or ended",fe)):fe&&(l("do read"),k.reading=!0,k.sync=!0,k.length===0&&(k.needReadable=!0),this._read(k.highWaterMark),k.sync=!1,k.reading||(P=ne(Z,k)));var Oe;return P>0?Oe=z(P,k):Oe=null,Oe===null?(k.needReadable=k.length<=k.highWaterMark,P=0):(k.length-=P,k.awaitDrain=0),k.length===0&&(k.ended||(k.needReadable=!0),Z!==P&&k.ended&&Q(this)),Oe!==null&&this.emit("data",Oe),Oe};function ue(P,k){if(l("onEofChunk"),!k.ended){if(k.decoder){var Z=k.decoder.end();Z&&Z.length&&(k.buffer.push(Z),k.length+=k.objectMode?1:Z.length)}k.ended=!0,k.sync?ye(P):(k.needReadable=!1,k.emittedReadable||(k.emittedReadable=!0,Ae(P)))}}function ye(P){var k=P._readableState;l("emitReadable",k.needReadable,k.emittedReadable),k.needReadable=!1,k.emittedReadable||(l("emitReadable",k.flowing),k.emittedReadable=!0,Ce.nextTick(Ae,P))}function Ae(P){var k=P._readableState;l("emitReadable_",k.destroyed,k.length,k.ended),!k.destroyed&&(k.length||k.ended)&&(P.emit("readable"),k.emittedReadable=!1),k.needReadable=!k.flowing&&!k.ended&&k.length<=k.highWaterMark,M(P)}function Ee(P,k){k.readingMore||(k.readingMore=!0,Ce.nextTick(Se,P,k))}function Se(P,k){for(;!k.reading&&!k.ended&&(k.length<k.highWaterMark||k.flowing&&k.length===0);){var Z=k.length;if(l("maybeReadMore read 0"),P.read(0),Z===k.length)break}k.readingMore=!1}H.prototype._read=function(P){N(this,new O("_read()"))},H.prototype.pipe=function(P,k){var Z=this,fe=this._readableState;switch(fe.pipesCount){case 0:fe.pipes=P;break;case 1:fe.pipes=[fe.pipes,P];break;default:fe.pipes.push(P);break}fe.pipesCount+=1,l("pipe count=%d opts=%j",fe.pipesCount,k);var Oe=(!k||k.end!==!1)&&P!==Ce.stdout&&P!==Ce.stderr,xe=Oe?Lt:at;fe.endEmitted?Ce.nextTick(xe):Z.once("end",xe),P.on("unpipe",Fe);function Fe(Bt,cr){l("onunpipe"),Bt===Z&&cr&&cr.hasUnpiped===!1&&(cr.hasUnpiped=!0,wt())}function Lt(){l("onend"),P.end()}var X=Ue(Z);P.on("drain",X);var xt=!1;function wt(){l("cleanup"),P.removeListener("close",jt),P.removeListener("finish",Er),P.removeListener("drain",X),P.removeListener("error",st),P.removeListener("unpipe",Fe),Z.removeListener("end",Lt),Z.removeListener("end",at),Z.removeListener("data",qe),xt=!0,fe.awaitDrain&&(!P._writableState||P._writableState.needDrain)&&X()}Z.on("data",qe);function qe(Bt){l("ondata");var cr=P.write(Bt);l("dest.write",cr),cr===!1&&((fe.pipesCount===1&&fe.pipes===P||fe.pipesCount>1&&oe(fe.pipes,P)!==-1)&&!xt&&(l("false write response, pause",fe.awaitDrain),fe.awaitDrain++),Z.pause())}function st(Bt){l("onerror",Bt),at(),P.removeListener("error",st),e(P,"error")===0&&N(P,Bt)}D(P,"error",st);function jt(){P.removeListener("finish",Er),at()}P.once("close",jt);function Er(){l("onfinish"),P.removeListener("close",jt),at()}P.once("finish",Er);function at(){l("unpipe"),Z.unpipe(P)}return P.emit("pipe",Z),fe.flowing||(l("pipe resume"),Z.resume()),P};function Ue(P){return function(){var Z=P._readableState;l("pipeOnDrain",Z.awaitDrain),Z.awaitDrain&&Z.awaitDrain--,Z.awaitDrain===0&&e(P,"data")&&(Z.flowing=!0,M(P))}}H.prototype.unpipe=function(P){var k=this._readableState,Z={hasUnpiped:!1};if(k.pipesCount===0)return this;if(k.pipesCount===1)return P&&P!==k.pipes?this:(P||(P=k.pipes),k.pipes=null,k.pipesCount=0,k.flowing=!1,P&&P.emit("unpipe",this,Z),this);if(!P){var fe=k.pipes,Oe=k.pipesCount;k.pipes=null,k.pipesCount=0,k.flowing=!1;for(var xe=0;xe<Oe;xe++)fe[xe].emit("unpipe",this,{hasUnpiped:!1});return this}var Fe=oe(k.pipes,P);return Fe===-1?this:(k.pipes.splice(Fe,1),k.pipesCount-=1,k.pipesCount===1&&(k.pipes=k.pipes[0]),P.emit("unpipe",this,Z),this)},H.prototype.on=function(P,k){var Z=r.prototype.on.call(this,P,k),fe=this._readableState;return P==="data"?(fe.readableListening=this.listenerCount("readable")>0,fe.flowing!==!1&&this.resume()):P==="readable"&&!fe.endEmitted&&!fe.readableListening&&(fe.readableListening=fe.needReadable=!0,fe.flowing=!1,fe.emittedReadable=!1,l("on readable",fe.length,fe.reading),fe.length?ye(this):fe.reading||Ce.nextTick(j,this)),Z},H.prototype.addListener=H.prototype.on,H.prototype.removeListener=function(P,k){var Z=r.prototype.removeListener.call(this,P,k);return P==="readable"&&Ce.nextTick(_e,this),Z},H.prototype.removeAllListeners=function(P){var k=r.prototype.removeAllListeners.apply(this,arguments);return(P==="readable"||P===void 0)&&Ce.nextTick(_e,this),k};function _e(P){var k=P._readableState;k.readableListening=P.listenerCount("readable")>0,k.resumeScheduled&&!k.paused?k.flowing=!0:P.listenerCount("data")>0&&P.resume()}function j(P){l("readable nexttick read 0"),P.read(0)}H.prototype.resume=function(){var P=this._readableState;return P.flowing||(l("resume"),P.flowing=!P.readableListening,J(this,P)),P.paused=!1,this};function J(P,k){k.resumeScheduled||(k.resumeScheduled=!0,Ce.nextTick(se,P,k))}function se(P,k){l("resume",k.reading),k.reading||P.read(0),k.resumeScheduled=!1,P.emit("resume"),M(P),k.flowing&&!k.reading&&P.read(0)}H.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function M(P){var k=P._readableState;for(l("flow",k.flowing);k.flowing&&P.read()!==null;);}H.prototype.wrap=function(P){var k=this,Z=this._readableState,fe=!1;P.on("end",function(){if(l("wrapped end"),Z.decoder&&!Z.ended){var Fe=Z.decoder.end();Fe&&Fe.length&&k.push(Fe)}k.push(null)}),P.on("data",function(Fe){if(l("wrapped data"),Z.decoder&&(Fe=Z.decoder.write(Fe)),!(Z.objectMode&&Fe==null)&&!(!Z.objectMode&&(!Fe||!Fe.length))){var Lt=k.push(Fe);Lt||(fe=!0,P.pause())}});for(var Oe in P)this[Oe]===void 0&&typeof P[Oe]=="function"&&(this[Oe]=(function(Lt){return function(){return P[Lt].apply(P,arguments)}})(Oe));for(var xe=0;xe<_.length;xe++)P.on(_[xe],this.emit.bind(this,_[xe]));return this._read=function(Fe){l("wrapped _read",Fe),fe&&(fe=!1,P.resume())},this},typeof Symbol=="function"&&(H.prototype[Symbol.asyncIterator]=function(){return B===void 0&&(B=y9()),B(this)}),Object.defineProperty(H.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(H.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(H.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(k){this._readableState&&(this._readableState.flowing=k)}}),H._fromList=z,Object.defineProperty(H.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function z(P,k){if(k.length===0)return null;var Z;return k.objectMode?Z=k.buffer.shift():!P||P>=k.length?(k.decoder?Z=k.buffer.join(""):k.buffer.length===1?Z=k.buffer.first():Z=k.buffer.concat(k.length),k.buffer.clear()):Z=k.buffer.consume(P,k.decoder),Z}function Q(P){var k=P._readableState;l("endReadable",k.endEmitted),k.endEmitted||(k.ended=!0,Ce.nextTick(ie,k,P))}function ie(P,k){if(l("endReadableNT",P.endEmitted,P.length),!P.endEmitted&&P.length===0&&(P.endEmitted=!0,k.readable=!1,k.emit("end"),P.autoDestroy)){var Z=k._writableState;(!Z||Z.autoDestroy&&Z.finished)&&k.destroy()}}typeof Symbol=="function"&&(H.from=function(P,k){return S===void 0&&(S=b9()),S(H,P,k)});function oe(P,k){for(var Z=0,fe=P.length;Z<fe;Z++)if(P[Z]===k)return Z;return-1}return Kl}var Jl,Tm;function vb(){if(Tm)return Jl;Tm=1,Jl=u;var t=Qi().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,o=Ui();oi()(u,o);function a(d,m){var y=this._transformState;y.transforming=!1;var w=y.writecb;if(w===null)return this.emit("error",new r);y.writechunk=null,y.writecb=null,m!=null&&this.push(m),w(d);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function u(d){if(!(this instanceof u))return new u(d);o.call(this,d),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",l)}function l(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(m,y){h(d,m,y)}):h(this,null,null)}u.prototype.push=function(d,m){return this._transformState.needTransform=!1,o.prototype.push.call(this,d,m)},u.prototype._transform=function(d,m,y){y(new e("_transform()"))},u.prototype._write=function(d,m,y){var w=this._transformState;if(w.writecb=y,w.writechunk=d,w.writeencoding=m,!w.transforming){var T=this._readableState;(w.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},u.prototype._read=function(d){var m=this._transformState;m.writechunk!==null&&!m.transforming?(m.transforming=!0,this._transform(m.writechunk,m.writeencoding,m.afterTransform)):m.needTransform=!0},u.prototype._destroy=function(d,m){o.prototype._destroy.call(this,d,function(y){m(y)})};function h(d,m,y){if(m)return d.emit("error",m);if(y!=null&&d.push(y),d._writableState.length)throw new i;if(d._transformState.transforming)throw new n;return d.push(null)}return Jl}var Wl,Bm;function x9(){if(Bm)return Wl;Bm=1,Wl=e;var t=vb();oi()(e,t);function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return e.prototype._transform=function(r,n,i){i(null,r)},Wl}var Ql,Sm;function w9(){if(Sm)return Ql;Sm=1;var t;function e(y){var w=!1;return function(){w||(w=!0,y.apply(void 0,arguments))}}var r=Qi().codes,n=r.ERR_MISSING_ARGS,i=r.ERR_STREAM_DESTROYED;function o(y){if(y)throw y}function a(y){return y.setHeader&&typeof y.abort=="function"}function u(y,w,T,R){R=e(R);var O=!1;y.on("close",function(){O=!0}),t===void 0&&(t=Rh()),t(y,{readable:w,writable:T},function(I){if(I)return R(I);O=!0,R()});var A=!1;return function(I){if(!O&&!A){if(A=!0,a(y))return y.abort();if(typeof y.destroy=="function")return y.destroy();R(I||new i("pipe"))}}}function l(y){y()}function h(y,w){return y.pipe(w)}function d(y){return!y.length||typeof y[y.length-1]!="function"?o:y.pop()}function m(){for(var y=arguments.length,w=new Array(y),T=0;T<y;T++)w[T]=arguments[T];var R=d(w);if(Array.isArray(w[0])&&(w=w[0]),w.length<2)throw new n("streams");var O,A=w.map(function(I,B){var S=B<w.length-1,N=B>0;return u(I,S,N,function(_){O||(O=_),_&&A.forEach(l),!S&&(A.forEach(l),R(O))})});return w.reduce(h)}return Ql=m,Ql}var Yl,Pm;function A9(){if(Pm)return Yl;Pm=1,Yl=r;var t=xh().EventEmitter,e=oi();e(r,t),r.Readable=Eb(),r.Writable=Ab(),r.Duplex=Ui(),r.Transform=vb(),r.PassThrough=x9(),r.finished=Rh(),r.pipeline=w9(),r.Stream=r;function r(){t.call(this)}return r.prototype.pipe=function(n,i){var o=this;function a(w){n.writable&&n.write(w)===!1&&o.pause&&o.pause()}o.on("data",a);function u(){o.readable&&o.resume&&o.resume()}n.on("drain",u),!n._isStdio&&(!i||i.end!==!1)&&(o.on("end",h),o.on("close",d));var l=!1;function h(){l||(l=!0,n.end())}function d(){l||(l=!0,typeof n.destroy=="function"&&n.destroy())}function m(w){if(y(),t.listenerCount(this,"error")===0)throw w}o.on("error",m),n.on("error",m);function y(){o.removeListener("data",a),n.removeListener("drain",u),o.removeListener("end",h),o.removeListener("close",d),o.removeListener("error",m),n.removeListener("error",m),o.removeListener("end",y),o.removeListener("close",y),n.removeListener("close",y)}return o.on("end",y),o.on("close",y),n.on("close",y),n.emit("pipe",o),n},Yl}var Om=A9();function Rb(t){if(typeof File=="function"&&t instanceof File)return!0;const e=t;return typeof e=="object"&&typeof e.name=="string"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")}async function Tb(t){return t.arrayBuffer?t.arrayBuffer():new Promise(e=>{const r=new FileReader;r.onload=()=>e(r.result),r.readAsArrayBuffer(t)})}const Jn=Xn().refine(t=>Xy().safeParse(t).success,"expected a function"),E9=Xn().transform(t=>(Ky().safeParse(t).success&&(t=String(t)),ce().regex(/^-?\d+$/,"expected integer string").parse(t))),Im=Xn().transform(t=>(Ky().safeParse(t).success&&(t=String(t)),ce().regex(/^\d+$/,"expected non-negative integer string").parse(t))),v9=ve({baseURL:ce().optional(),timeout:me().int().min(0).optional(),headers:Jy(ce(),ce()).optional(),onRequest:Jn.optional(),httpAgent:Di().optional(),httpsAgent:Di().optional(),endlesslyRetry:Qe().optional(),signal:Xn().optional()}),wn=ve({redundancyStrategy:me().int().optional(),fallback:Qe().optional(),timeoutMs:me().int().min(0).optional(),actPublisher:Vs(Xn().transform(t=>new br(t))),actHistoryAddress:Vs(Xn().transform(t=>new Pe(t))),actTimestamp:eb().optional()}),js=ve({act:Qe().optional(),actHistoryAddress:Vs(Xn().transform(t=>new Pe(t))),deferred:Qe().optional(),encrypt:Qe().optional(),pin:Qe().optional(),tag:me().int().min(0).optional()}),R9=js.extend({redundancyLevel:me().int().min(0).optional()}),T9=js.extend({size:me().int().min(0).optional(),contentType:ce().optional(),redundancyLevel:me().int().min(0).optional()}),Xl=js.extend({errorDocument:ce().optional(),indexDocument:ce().optional(),redundancyLevel:me().int().min(0).optional()}),B9=ve({uid:me().int()}),S9=eb().min(0),P9=ve({onMessage:Jn,onError:Jn,onClose:Jn}),O9=ve({onMessage:Jn,onError:Jn,onClose:Jn}),km=ve({gasPrice:E9.optional(),immutableFlag:Qe().optional(),label:ce().optional(),waitForUsable:Qe().optional(),waitForUsableTimeout:me().int().min(0).optional()}),Nm=ve({gasLimit:Im.optional(),gasPrice:Im.optional()}),I9=ve({limit:me().int().min(k7).max(N7).optional(),offset:me().int().min(0).optional()});function Bb(t){return typeof Om.Readable<"u"&&t instanceof Om.Readable}function He(t,e){if(typeof t=="bigint"&&(t=t.toString()),typeof t!="string"||!/^-?\d+$/.test(t))throw new TypeError(`${e?.name??"value"} is not a valid integer string, got: ${t}`);if(e?.min!==void 0&&BigInt(t)<e.min)throw new RangeError(`${e?.name??"value"} must be >= ${e.min}, got: ${t}`);if(e?.max!==void 0&&BigInt(t)>e.max)throw new RangeError(`${e?.name??"value"} must be <= ${e.max}, got: ${t}`);return t}function k9(t){return B9.safeParse(t).success}function Cm(t){if(typeof t!="string"&&!(t instanceof Uint8Array))throw new TypeError("Data must be either string or Uint8Array!")}function N9(t){if(typeof t!="string"&&!(t instanceof Uint8Array)&&!Rb(t)&&!Bb(t))throw new TypeError("Data must be either string, Readable, Uint8Array or File!")}function Rn(t){if(t==null)throw new TypeError(`Expected number | Tag | string from tagUid, got: ${t}`);if(k9(t))return t.uid;if(typeof t=="number"||typeof t=="string")return S9.parse(t);throw new TypeError(`Expected number | Tag | string from tagUid, got: ${t}`)}function C9(t){return!Number.isInteger(t)||t<1?1:t>3155695200?3155695200:t}function _9(t){return!Number.isInteger(t)||t<24e3?24e3:t}const F9=.9;function D9(t,e,r){return t/Math.pow(2,e-r)}function Sb(t){return 4096*2**t}const Pb=[[17,4089e-8],[18,.00609],[19,.10249],[20,.62891],[21,2.38],[22,7.07],[23,18.24],[24,43.04],[25,96.5],[26,208.52],[27,435.98],[28,908.81],[29,1870],[30,3810],[31,7730],[32,15610],[33,31430],[34,63150]];function na(t,e,r){if(t<17)return 0;if(e!==void 0&&r!==void 0){const o=ab[e?"ENCRYPTION_ON":"ENCRYPTION_OFF"][r].find(a=>a.batchDepth===t);if(o?.effectiveVolume)return tb(o.effectiveVolume)}else{const n=Pb.find(([i,o])=>{if(t===i)return o});if(n)return n[1]*1e3*1e3*1e3}return Math.ceil(Sb(t)*F9)}function FN(t,e){const r=new Map;for(let n=17;n<35;n++)r.set(n,na(n,t,e));return r}function yi(t,e){return De.fromPLUR(2n**BigInt(t)*BigInt(e))}function L9(t,e,r){const n=BigInt(He(t));return sr.fromSeconds(Number(n*BigInt(r)/BigInt(e)))}function Fr(t,e,r){return BigInt(t.toSeconds())/BigInt(r)*BigInt(e)+1n}function bi(t,e,r){if(e!==void 0&&r!==void 0){const o=ab[e?"ENCRYPTION_ON":"ENCRYPTION_OFF"][r].find(a=>t.toBytes()<=tb(a.effectiveVolume));if(o?.effectiveVolume)return o.batchDepth}else for(const[n,i]of Pb)if(t.toBytes()<=i*1e3*1e3*1e3)return n;return 35}function U9(t){return M9(t.signature,t.batchId.toUint8Array(),t.timestamp,t.index)}function M9(t,e,r,n){if(t.length!==65)throw Error("invalid signature length");if(e.length!==32)throw Error("invalid batch ID length");if(r.length!==8)throw Error("invalid timestamp length");if(n.length!==8)throw Error("invalid index length");return new Le(G.Binary.concatBytes(e,n,r,t))}function Ob(t,e,r){const n=C9(t.batchTTL),i=sr.fromSeconds(n),o=na(t.depth,e,r),a=t.utilizationRatio??D9(t.utilization,t.depth,t.bucketDepth);return{batchID:new et(t.batchID),utilization:t.utilization,usable:t.usable,label:t.label,depth:t.depth,amount:He(t.amount),bucketDepth:t.bucketDepth,blockNumber:t.blockNumber,immutableFlag:t.immutableFlag,usage:a,usageText:`${Math.round(a*100)}%`,size:Sr.fromBytes(o),remainingSize:Sr.fromBytes(Math.ceil(o*(1-a))),theoreticalSize:Sr.fromBytes(Sb(t.depth)),duration:i,calculateSize(u,l){const h=na(t.depth,u,l);return Sr.fromBytes(h)},calculateRemainingSize(u,l){const h=na(t.depth,u,l);return Sr.fromBytes(Math.ceil(h*(1-this.usage)))}}}function Ib(t){const e=z9(t["content-disposition"]),r=$9(t["swarm-tag-uid"]),n=t["content-type"]||void 0;return{name:e,tagUid:r,contentType:n}}function z9(t){if(!t)throw new Or("missing content-disposition header");const e=t.match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/i);if(e&&e.length>0)return e[1];throw new Or("invalid content-disposition header")}function $9(t){if(t)return parseInt(t,10)}function Gt(t,e){const r={};if(V9(t)?r["swarm-postage-stamp"]=U9(t).toHex():t&&(t=new et(t),r["swarm-postage-batch-id"]=t.toHex()),!e)return r;const n=e;n.size&&(r["content-length"]=String(n.size)),n.contentType&&(r["content-type"]=String(n.contentType)),n.redundancyLevel&&(r["swarm-redundancy-level"]=String(n.redundancyLevel));const i=Qe().safeParse(n.act);i.success&&(r["swarm-act"]=String(i.data));const o=Qe().safeParse(n.pin);o.success&&(r["swarm-pin"]=String(o.data));const a=Qe().safeParse(n.encrypt);a.success&&(r["swarm-encrypt"]=String(a.data)),n.tag&&(r["swarm-tag"]=String(n.tag));const u=Qe().safeParse(n.deferred);u.success&&(r["swarm-deferred-upload"]=String(u.data)),n.redundancyStrategy&&(r["swarm-redundancy-strategy"]=String(n.redundancyStrategy));const l=Qe().safeParse(n.fallback);return l.success&&(r["swarm-redundancy-fallback-mode"]=String(l.data)),n.timeoutMs&&(r["swarm-chunk-retrieval-timeout"]=String(n.timeoutMs)),n.indexDocument&&(r["swarm-index-document"]=String(n.indexDocument)),n.errorDocument&&(r["swarm-error-document"]=String(n.errorDocument)),n.actPublisher&&(r["swarm-act-publisher"]=new br(n.actPublisher).toCompressedHex()),n.actHistoryAddress&&(r["swarm-act-history-address"]=new Pe(n.actHistoryAddress).toHex()),n.actTimestamp&&(r["swarm-act-timestamp"]=String(n.actTimestamp)),(n.actPublisher||n.actHistoryAddress||n.actTimestamp)&&(r["swarm-act"]="true"),n.gasPrice&&(r["gas-price"]=String(n.gasPrice)),n.gasLimit&&(r["gas-limit"]=String(n.gasLimit)),r}function V9(t){if(!ve({}).safeParse(t).success)return!1;const r=t;return r.issuer!==void 0&&r.index!==void 0&&r.signature!==void 0&&r.timestamp!==void 0&&r.batchId!==void 0}const G9=bh("bee-js:http"),j9=1e5,H9=200,q9=1e3,Z9=300,K9={headers:{accept:"application/json, text/plain, */*"}};async function he(t,e){const r=G.Objects.deepMerge3(K9,e,t);if(t.signal&&(r.signal=t.signal),J9(r),r.params)for(const a of Object.keys(r.params))r.params[a]===void 0&&delete r.params[a];const n=Y9(r),i=(r.method||"GET").toUpperCase();r.method=i,t.onRequest?.({method:i,url:G.Strings.joinUrl([r.baseURL??"",r.url??""]),headers:{...r.headers},params:r.params});let o=0;for(;o<j9;)try{G9(`${i} ${n}`,{headers:r.headers,params:r.params});const a=await fetch(n,r);return a.ok||await W9(i,n,a,r.responseType),kb(a,r.responseType)}catch(a){if(a instanceof Gs)throw a;const u=a;if(u.name==="TimeoutError"&&t.endlesslyRetry)o++,await G.System.sleepMillis(o<Z9?H9:q9);else throw Q9(u,i,n)}throw Error("Max number of failed attempts reached")}function J9(t){if(t.data===void 0)return;const e=t.data;if(e!==null&&typeof e=="object"&&e.constructor===Object||Array.isArray(e))t.body=JSON.stringify(e),t.headers={"content-type":"application/json",...t.headers};else{t.body=e,t.duplex="half";const n=e instanceof Blob&&e.type?e.type:"application/octet-stream";t.headers={"content-type":n,...t.headers}}}async function W9(t,e,r,n){const i=await kb(r,n).catch(()=>({data:void 0})),o=typeof i.data=="string"?i.data:JSON.stringify(i.data),a=o&&o!=="undefined"?`${r.statusText}: ${o}`:r.statusText;throw new Gs(t,e,a,i.data,r.status,r.statusText)}function Q9(t,e,r){if(t.name==="AbortError")return new Gs(e,r,"Request aborted",void 0,void 0,"ERR_CANCELED");const n=t.cause,i=n?.message?`${t.message}: ${n.message}`:t.message;return new Gs(e,r,i)}async function kb(t,e="json"){let r;switch(e){case"arraybuffer":r=await t.arrayBuffer();break;case"text":r=await t.text();break;case"blob":r=await t.blob();break;case"stream":r=t.body;break;default:{const n=await t.text();r=n?JSON.parse(n):null}}return{data:r,status:t.status,statusText:t.statusText,headers:Object.fromEntries(t.headers.entries()),raw:t}}function Y9(t){let e=G.Strings.joinUrl([t.baseURL??"",t.url??""]);if(t.params){const r=new URLSearchParams(Object.entries(t.params).filter(([,n])=>n!==void 0).map(([n,i])=>[n,String(i)])).toString();r&&(e+=`?${r}`)}return e}const Nb="chunks";async function X9(t,e,r,n){const i=await he(t,{method:"post",url:`${Nb}`,data:e,headers:{"content-type":"application/octet-stream",...Gt(r,n)},responseType:"json"});return{reference:si.parse(i.data).reference,tagUid:i.headers["swarm-tag"]?Rn(i.headers["swarm-tag"]):void 0,historyAddress:i.headers["swarm-act-history-address"]?G.Optional.of(new Pe(i.headers["swarm-act-history-address"])):G.Optional.empty()}}async function ao(t,e,r){e=new Pe(e);const n=await he(t,{responseType:"arraybuffer",url:`${Nb}/${e}`,headers:Gt(null,r)});return new Uint8Array(n.data)}const eR="soc";async function tR(t,e,r,n,i,o,a){const u=await he(t,{method:"post",url:`${eR}/${e}/${r}`,data:i,headers:{"content-type":"application/octet-stream",...Gt(o,a)},responseType:"json",params:{sig:n.toHex()}});return{reference:si.parse(u.data).reference,tagUid:u.headers["swarm-tag"]?Rn(u.headers["swarm-tag"]):void 0,historyAddress:u.headers["swarm-act-history-address"]?G.Optional.of(new Pe(u.headers["swarm-act-history-address"])):G.Optional.empty()}}const Cb=kt.LENGTH,_b=kt.LENGTH+Sn.LENGTH,rR=kt.LENGTH+Sn.LENGTH+Tt.LENGTH;function nR(t){const e=t.slice(_b),r=sb(e),n=Sn.fromSlice(t,Cb),i=Le.fromSlice(t,0,kt.LENGTH),o=G.Binary.concatBytes(i.toUint8Array(),r.toUint8Array());return n.recoverPublicKey(o).address()}function Ga(t,e){t=t instanceof Le?t.toUint8Array():t,e=new Pe(e);const r=nR(t),n=Le.fromSlice(t,0,kt.LENGTH),i=new Pe(G.Binary.keccak256(G.Binary.concatBytes(n.toUint8Array(),r.toUint8Array())));if(!G.Binary.equals(e.toUint8Array(),i.toUint8Array()))throw new Or("SOC data does not match given address!");const o=Sn.fromSlice(t,Cb),a=Tt.fromSlice(t,_b),u=Le.fromSlice(t,rR);return{data:t,identifier:n,signature:o,span:a,payload:u,address:i,owner:r}}function Ls(t,e){return new Pe(G.Binary.keccak256(G.Binary.concatBytes(t.toUint8Array(),e.toUint8Array())))}function Fb(t,e,r,n,i){n=new kt(n),i=new qr(i);const o=Ls(n,i.publicKey().address()),a=i.sign(G.Binary.concatBytes(n.toUint8Array(),t.toUint8Array()));return{data:G.Binary.concatBytes(n.toUint8Array(),a.toUint8Array(),e.toUint8Array(),r.toUint8Array()),identifier:n,signature:a,span:e,payload:r,address:o,owner:i.publicKey().address()}}async function Th(t,e,r,n){const i=G.Binary.concatBytes(e.span.toUint8Array(),e.payload.toUint8Array());return tR(t,e.owner,e.identifier,e.signature,i,r,n)}async function Bh(t,e,r,n,i,o){e=new qr(e),n=new kt(n);const u=Hs(i).toSingleOwnerChunk(n,e);return Th(t,u,r,o)}async function iR(t,e,r,n,i,o){e=new qr(e),n=new kt(n);const a=i.toSingleOwnerChunk(n,e);return Th(t,a,r,o)}async function sR(t,e,r){r=new kt(r),e=new $t(e);const n=Ls(r,e),i=await ao(t,n.toHex());return Ga(i,n)}const _m=1,Fm=4096;function Db(t){return t=new Le(t),Hs(t.toUint8Array().slice(Tt.LENGTH),Tt.fromSlice(t.toUint8Array(),0))}function Hs(t,e){const r=ce().safeParse(t);if(r.success&&(t=Le.fromUtf8(r.data)),t.length<_m||t.length>Fm)throw new RangeError(`payload size ${t.length} exceeds limits [${_m}, ${Fm}]`);const n=e?typeof e=="bigint"?Tt.fromBigInt(e):e:Tt.fromBigInt(BigInt(t.length)),i=new Le(t),o=G.Binary.concatBytes(n.toUint8Array(),i.toUint8Array()),a=sb(o);return{data:o,span:n,payload:i,address:a,toSingleOwnerChunk:(u,l)=>Fb(a,n,i,u,l)}}const ja="bytes";async function Lb(t,e,r,n){const i=await he(t,{url:ja,method:"post",responseType:"json",data:e,headers:{"content-type":"application/octet-stream",...Gt(r,n)}});return{reference:si.parse(i.data).reference,tagUid:i.headers["swarm-tag"]?Rn(i.headers["swarm-tag"]):void 0,historyAddress:i.headers["swarm-act-history-address"]?G.Optional.of(new Pe(i.headers["swarm-act-history-address"])):G.Optional.empty()}}async function oR(t,e){e=new Pe(e);const r=await he(t,{url:`${ja}/${e}`,method:"head",responseType:"json"});return{contentLength:parseInt(r.headers["content-length"])}}async function Ub(t,e,r){r&&(r=wn.parse(r));const n=await he(t,{responseType:"arraybuffer",url:`${ja}/${e}`,headers:Gt(null,r)});return new Le(n.data)}async function aR(t,e,r){return r&&(r=wn.parse(r)),(await he(t,{responseType:"stream",url:`${ja}/${e}`,headers:Gt(null,r)})).data}const Sh="feeds";async function cR(t,e,r,n,i){const o=await he(t,{method:"post",responseType:"json",url:`${Sh}/${e}/${r}`,headers:Gt(n,i)});return si.parse(o.data).reference}function Mb(t){const e=t["swarm-feed-index"],r=t["swarm-feed-index-next"];if(!e)throw new Or("Response did not contain expected swarm-feed-index!");if(!r)throw new Or("Response did not contain expected swarm-feed-index-next!");return{feedIndex:new Vt(e),feedIndexNext:new Vt(r)}}async function wa(t,e,r,n){const i=await he(t,{responseType:"arraybuffer",url:`${Sh}/${e}/${r}`,params:{...n}});return{payload:new Le(i.data),...Mb(i.headers)}}async function uR(t,e,r){const n=await he(t,{responseType:"arraybuffer",url:`${Sh}/${e}/${r}`,params:{"Swarm-Only-Root-Chunk":!0}});return Mb(n.headers)}class ia{constructor(e){this.raw=e}toString(){const e=ce().safeParse(this.raw);return e.success&&e.data.includes(".eth")?e.data:new Pe(this.raw).toHex()}}function Ph(t,e){return e=typeof e=="number"?Vt.fromBigInt(BigInt(e)):e,new kt(G.Binary.keccak256(G.Binary.concatBytes(t.toUint8Array(),e.toUint8Array())))}const lR=0,zb=8,fR=zb;async function $b(t,e,r){try{const n=await wa(t,e,r);if(!n.feedIndexNext)throw Error("Feed index next is not defined. This should happen when fetching an exact index.");return n.feedIndexNext}catch(n){if(n instanceof Gs)return Vt.fromBigInt(0n);throw n}}async function hR(t,e,r,n,i,o){n=new Pe(n);const a=o?.index??await $b(t,e.publicKey().address(),r),u=Ph(r,a),l=o?.at??Date.now()/1e3,h=G.Binary.numberToUint64(BigInt(Math.floor(l)),"BE"),d=G.Binary.concatBytes(h,n.toUint8Array());return Bh(t,e,i,u,d,o)}async function dR(t,e,r,n,i,o){const a=o?.index??await $b(t,e.publicKey().address(),r),u=Ph(r,a);if(n.length>4096){const h=await Lb(t,n,i,o),d=Db(await ao(t,h.reference));return iR(t,e,i,u,d,o)}const l=ce().safeParse(n);return Bh(t,e,i,u,l.success?Le.fromUtf8(l.data).toUint8Array():n,o)}function Oh(t,e,r){const n=Ph(e,r);return new Pe(G.Binary.keccak256(G.Binary.concatBytes(n.toUint8Array(),t.toUint8Array())))}async function pR(t,e,r,n,i=!1){n=typeof n=="number"?Vt.fromBigInt(BigInt(n)):n;const o=Oh(e,r,n),a=await ao(t,o.toHex()),u=Ga(a,o);let l=G.Optional.empty();if(i){const h=Le.fromSlice(u.payload.toUint8Array(),lR,zb);l=G.Optional.of(Number(G.Binary.uint64ToNumber(h.toUint8Array(),"BE")))}return{timestamp:l,payload:new Le(u.payload.offset(i?fR:0))}}async function mR(t,e,r,n){n=typeof n=="number"?Vt.fromBigInt(BigInt(n)):n;const i=Oh(e,r,n),o=await ao(t,i),a=Ga(o,i);return Hs(a.payload,a.span)}function Vb(t,e,r){const n=async a=>{if(a?.index===void 0)return wa(t,r,e);const u=await pR(t,r,e,a.index,a.hasTimestamp??!0),l=typeof a.index=="number"?Vt.fromBigInt(BigInt(a.index)):a.index;return{payload:u.payload,feedIndex:l,feedIndexNext:l.next()}};return{download:n,downloadPayload:async a=>{if(a?.index===void 0)return wa(t,r,e);const u=await mR(t,r,e,a.index),l=u.span.toBigInt()<=4096n?u.payload:await Ub(t,new ia(u.address)),h=typeof a.index=="number"?Vt.fromBigInt(BigInt(a.index)):a.index;return{payload:l,feedIndex:h,feedIndexNext:h.next()}},downloadReference:async a=>{let u=a?.index;u===void 0&&(u=(await uR(t,r,e)).feedIndex);const l=await n({...a,index:u});return{reference:new Pe(l.payload.toUint8Array()),feedIndex:l.feedIndex,feedIndexNext:l.feedIndexNext??l.feedIndex.next()}},owner:r,topic:e}}function gR(t,e,r){const n=async(o,a,u)=>hR(t,r,e,a,o,u),i=async(o,a,u)=>dR(t,r,e,a,o,u);return{...Vb(t,e,r.publicKey().address()),upload:n,uploadReference:n,uploadPayload:i}}async function yR(t,e,r,n){try{return await t.downloadChunk(e,r,n),!0}catch(i){const o=G.Objects.getDeep(i,"status");if(o===404||o===500)return!1;throw i}}function bR(t,e,r){const n=r.toBigInt(),i=[];for(let o=0n;o<=n;o++)i.push(Oh(t,e,Vt.fromBigInt(o)));return i}async function xR(t,e,r,n,i,o){const a=bR(e,r,n).map(async u=>yR(t,u,i,o));return(await Promise.all(a)).every(u=>u)}function wR(t){return Array.isArray(t)?t.every(e=>typeof e=="object"&&e.path&&e.size!==void 0):!1}function Gb(t){if(!wR(t))throw new Tr("invalid collection",t)}function jb(t){if(t.webkitRelativePath&&t.webkitRelativePath!=="")return t.webkitRelativePath.replace(/.*?\//i,"");if(t.name)return t.name;throw new TypeError("file is not valid File object")}function AR(t){return Array.from(t).map(e=>({path:jb(e),size:e.size,file:e}))}class ER{constructor(){this.pieces=[],this.currentFileSize=0}get output(){return this.pieces.reduce((e,r)=>{const n=new Uint8Array(e.length+r.length);return n.set(e),n.set(r,e.length),n})}beginFile(e,r){const{name:n,prefix:i,longLink:o}=vR(e);if(o){const l=new TextEncoder().encode(e+"\0");this.pieces.push(RR(l.length)),this.pieces.push(l);const h=l.length%512===0?0:512-l.length%512;h>0&&this.pieces.push(new Uint8Array(h))}const a=TR(n,i,r);this.pieces.push(a),this.currentFileSize=0}async appendFile(e){this.pieces.push(e),this.currentFileSize+=e.length}async endFile(){const e=this.currentFileSize%512===0?0:512-this.currentFileSize%512;e>0&&this.pieces.push(new Uint8Array(e))}async end(){this.pieces.push(BR())}}function vR(t){if(t.length<=100)return{name:t,prefix:"",longLink:!1};for(let n=t.length-1;n>=0;n--)if(t[n]==="/"){const i=t.substring(n+1),o=t.substring(0,n);if(i.length<=100&&o.length<=155)return{name:i,prefix:o,longLink:!1}}const e=t.lastIndexOf("/");return{name:(e>=0?t.substring(e+1):t).slice(0,100),prefix:"",longLink:!0}}function RR(t){const e=new TextEncoder;function r(o,a,u){const l=e.encode(o);n.set(l.slice(0,u),a)}const n=new Uint8Array(512);n.fill(0),r("././@LongLink",0,100),r("0000644\0",100,8),r("0000000\0",108,8),r("0000000\0",116,8),r(t.toString(8).padStart(11,"0")+"\0",124,12),r("00000000000\0",136,12),r(" ",148,8),r("L",156,1),r("ustar\0\0",257,8);let i=0;for(let o=0;o<512;o++)i+=n[o];return r(i.toString(8).padStart(6,"0")+"\0 ",148,8),n}function TR(t,e,r){const n=new TextEncoder;function i(l,h,d){const m=n.encode(l);o.set(m.slice(0,d),h)}const o=new Uint8Array(512);o.fill(0,0,512),i(t.slice(0,100).padEnd(100,"\0"),0,100),i("0000777\0",100,8),i("0001750\0",108,8),i("0001750\0",116,8),i(r.toString(8).padStart(11,"0")+"\0",124,12);const a=Math.floor(new Date().getTime()/1e3);i(a.toString(8).padStart(11,"0")+"\0",136,12),i(" ",148,8),i("0",156,1),i("ustar\0\0",257,8),e&&i(e.slice(0,155).padEnd(155,"\0"),345,155);let u=0;for(let l=0;l<512;l++)u+=o[l];return i(u.toString(8).padStart(6,"0")+"\0 ",148,8),o}function BR(){return new Uint8Array(1024)}async function SR(t,e){for(const r of t)if(r.file)e.beginFile(r.path,r.file.size),await e.appendFile(new Uint8Array(await Tb(r.file))),await e.endFile();else throw new Error("Invalid collection item")}const PR="bzz";async function OR(t,e,r,n){const i=new ER;return await SR(e,i),await i.end(),await he(t,{method:"post",url:PR,data:i.output,responseType:"json",headers:{"content-type":"application/x-tar","swarm-collection":"true",...Gt(r,n)}})}const Ih="bzz";async function Dm(t,e,r,n,i){Bb(e)&&!i?.contentType&&(i||(i={}),i.contentType="application/octet-stream");const o=await he(t,{method:"post",url:Ih,data:e,headers:Gt(r,i),params:{name:n},responseType:"json"});return{reference:si.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?Rn(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?G.Optional.of(new Pe(o.headers["swarm-act-history-address"])):G.Optional.empty()}}async function IR(t,e,r="",n){const i=await he(t,{method:"GET",responseType:"arraybuffer",url:`${Ih}/${e}/${r}`,headers:Gt(null,n)});return{...Ib(i.headers),data:new Le(i.data)}}async function kR(t,e,r="",n){e=new Pe(e);const i=await he(t,{method:"GET",responseType:"stream",url:`${Ih}/${e}/${r}`,headers:Gt(null,n)});return{...Ib(i.headers),data:i.data}}async function ef(t,e,r,n){Gb(e);const i=await OR(t,e,r,n);return{reference:si.parse(i.data).reference,tagUid:i.headers["swarm-tag"]?Rn(i.headers["swarm-tag"]):void 0,historyAddress:i.headers["swarm-act-history-address"]?G.Optional.of(new Pe(i.headers["swarm-act-history-address"])):G.Optional.empty()}}const Hb=ve({peer:ce(),balance:ce().transform(t=>De.fromPLUR(He(t,{name:"balance"})))}),qb=ve({balances:Dt(Hb)}),Zb=Hb,Kb="balances",Jb="consumed";async function NR(t){const e=await he(t,{url:Kb,responseType:"json"});return qb.parse(e.data)}async function CR(t,e){const r=await he(t,{url:`${Kb}/${e}`,responseType:"json"});return Zb.parse(r.data)}async function _R(t){const e=await he(t,{url:Jb,responseType:"json"});return qb.parse(e.data)}async function FR(t,e){const r=await he(t,{url:`${Jb}/${e}`,responseType:"json"});return Zb.parse(r.data)}const qs=ve({beneficiary:ce().transform(t=>new $t(t)),chequebook:ce().transform(t=>new $t(t)),payout:ce().transform(t=>De.fromPLUR(He(t,{name:"payout"})))}),DR=ve({recipient:ce(),lastPayout:ce().transform(t=>De.fromPLUR(He(t,{name:"lastPayout"}))),bounced:Qe()}),LR=ve({chequebookAddress:ce().transform(t=>new $t(t))}),UR=ve({availableBalance:ce().transform(t=>De.fromPLUR(He(t,{name:"availableBalance"}))),totalBalance:ce().transform(t=>De.fromPLUR(He(t,{name:"totalBalance"})))}),MR=ve({peer:ce(),uncashedAmount:ce().transform(t=>De.fromPLUR(He(t,{name:"uncashedAmount"}))),transactionHash:ce().nullish().transform(t=>t??null),lastCashedCheque:qs.nullish().transform(t=>t??null),result:DR.nullish().transform(t=>t??null)}),zR=ve({peer:ce(),lastreceived:qs.nullish().transform(t=>t??null),lastsent:qs.nullish().transform(t=>t??null)}),$R=ve({lastcheques:Dt(ve({peer:ce(),lastreceived:qs.nullish().transform(t=>t??null),lastsent:qs.nullish().transform(t=>t??null)}))}),kh=ve({transactionHash:ce().transform(t=>new Yr(t))}),In="chequebook";async function VR(t){const e=await he(t,{url:In+"/address",responseType:"json"});return LR.parse(e.data)}async function GR(t){const e=await he(t,{url:In+"/balance",responseType:"json"});return UR.parse(e.data)}async function jR(t,e){const r=await he(t,{url:In+`/cashout/${e}`,responseType:"json"});return MR.parse(r.data)}async function HR(t,e,r){const n=await he(t,{method:"post",url:In+`/cashout/${e}`,responseType:"json",headers:Gt(null,r)});return kh.parse(n.data).transactionHash}async function qR(t,e){const r=await he(t,{url:In+`/cheque/${e}`,responseType:"json"});return zR.parse(r.data)}async function ZR(t){const e=await he(t,{url:In+"/cheque",responseType:"json"});return $R.parse(e.data)}async function KR(t,e,r){const n={};r&&(n["gas-price"]=r.toString());const i=await he(t,{method:"post",url:In+"/deposit",responseType:"json",params:{amount:e.toString(10)},headers:n});return kh.parse(i.data).transactionHash}async function JR(t,e,r){const n={};r&&(n["gas-price"]=r.toString());const i=await he(t,{method:"post",url:In+"/withdraw",responseType:"json",params:{amount:e.toString(10)},headers:n});return kh.parse(i.data).transactionHash}const Wb=ve({address:ce(),fullNode:Qe()}),WR=ve({population:me(),connected:me(),connectedPeers:Dt(ve({address:ce()})).nullish().transform(t=>t??[]),disconnectedPeers:Dt(ve({address:ce()})).nullish().transform(t=>t??[])}),QR=Jy(ce(),WR),YR=ve({overlay:ce().transform(t=>new vr(t)),underlay:Dt(ce()),ethereum:ce().transform(t=>new $t(t)),publicKey:ce().transform(t=>new br(t)),pssPublicKey:ce().transform(t=>new br(t))}),XR=ve({peers:Dt(Wb)}),eT=ve({peers:Dt(Wb)}),tT=ve({baseAddr:ce(),population:me(),connected:me(),timestamp:ce(),nnLowWatermark:me(),depth:me(),reachability:ce(),networkAvailability:ce(),bins:QR});async function rT(t){const e=await he(t,{url:"addresses",responseType:"json"});return YR.parse(e.data)}async function nT(t){const e=await he(t,{url:"peers",responseType:"json"});return XR.parse(e.data).peers}async function iT(t){const e=await he(t,{url:"blocklist",responseType:"json"});return eT.parse(e.data).peers}async function sT(t,e){return(await he(t,{url:`peers/${e}`,responseType:"json",method:"DELETE"})).data}async function oT(t){const e=await he(t,{url:"topology",responseType:"json"});return tT.parse(e.data)}async function aT(t,e){return(await he(t,{url:`pingpong/${e}`,responseType:"json",method:"POST"})).data}const Qb=ve({peer:ce(),sent:ce().transform(t=>De.fromPLUR(He(t,{name:"sent"}))),received:ce().transform(t=>De.fromPLUR(He(t,{name:"received"})))}),cT=Qb,uT=ve({totalSent:ce().transform(t=>De.fromPLUR(He(t,{name:"totalSent"}))),totalReceived:ce().transform(t=>De.fromPLUR(He(t,{name:"totalReceived"}))),settlements:Dt(Qb)}),Yb="settlements";async function lT(t,e){const r=await he(t,{url:`${Yb}/${e}`,responseType:"json"});return cT.parse(r.data)}async function fT(t){const e=await he(t,{url:Yb,responseType:"json"});return uT.parse(e.data)}const hT=ve({stakedAmount:ce().transform(t=>De.fromPLUR(He(t,{name:"stakedAmount"})))}),dT=ve({withdrawableAmount:ce().transform(t=>De.fromPLUR(He(t,{name:"withdrawableAmount"})))}),Nh=ve({txHash:ce().transform(t=>new Yr(t))}),pT=ve({minimumGasFunds:ce().transform(t=>ut.fromWei(He(t,{name:"minimumGasFunds"}))),hasSufficientFunds:Qe(),isFrozen:Qe(),isFullySynced:Qe(),phase:ce(),round:me(),lastWonRound:me(),lastPlayedRound:me(),lastFrozenRound:me(),lastSelectedRound:me(),lastSampleDurationSeconds:me(),block:me(),reward:ce().transform(t=>De.fromPLUR(He(t,{name:"reward"}))),fees:ce().transform(t=>ut.fromWei(He(t,{name:"fees"}))),isHealthy:Qe()}),co="stake",mT="redistributionstate";async function gT(t){const e=await he(t,{method:"get",responseType:"json",url:`${co}`});return hT.parse(e.data).stakedAmount}async function yT(t){const e=await he(t,{method:"get",responseType:"json",url:`${co}/withdrawable`});return dT.parse(e.data).withdrawableAmount}async function bT(t){const e=await he(t,{method:"delete",responseType:"json",url:`${co}/withdrawable`});return Nh.parse(e.data).txHash}async function xT(t){const e=await he(t,{method:"delete",responseType:"json",url:co});return Nh.parse(e.data).txHash}async function wT(t,e,r){const n=await he(t,{method:"post",responseType:"json",url:`${co}/${e}`,headers:Gt(null,r)});return Nh.parse(n.data).txHash}async function AT(t){const e=await he(t,{method:"get",responseType:"json",url:mT});return pT.parse(e.data)}const Xb=ve({batchID:ce(),utilization:me(),utilizationRatio:me().optional(),usable:Qe(),label:ce(),depth:me(),amount:ce(),bucketDepth:me(),blockNumber:me(),immutableFlag:Qe(),batchTTL:me()}),ex=ve({batchID:ce().transform(t=>new et(t)),batchTTL:me(),bucketDepth:me(),depth:me(),immutable:Qe(),owner:ce().transform(t=>new $t(t)),start:me(),value:ce().transform(t=>He(t,{name:"value"}))}),ET=ve({batches:Dt(ex)}),vT=ve({stamps:Dt(Xb)}),RT=Xb,TT=ve({depth:me(),bucketDepth:me(),bucketUpperBound:me(),buckets:Dt(ve({bucketID:me(),collisions:me()}))}),Ch=ve({batchID:ce().transform(t=>new et(t))}),ai="stamps",tx="batches";async function Lm(t){const e=await he(t,{method:"get",url:`${tx}`,responseType:"json"});return ET.parse(e.data).batches}async function BT(t,e){const r=await he(t,{method:"get",url:`${tx}/${e}`,responseType:"json"});return ex.parse(r.data)}async function Um(t){const e=await he(t,{method:"get",url:`${ai}`,responseType:"json"});return vT.parse(e.data).stamps.map(r=>Ob(r))}async function ST(t,e,r,n){const i=await he(t,{method:"get",url:`${ai}/${e}`,responseType:"json"});return Ob(RT.parse(i.data),r,n)}async function PT(t,e){const r=await he(t,{method:"get",url:`${ai}/${e}/buckets`,responseType:"json"});return TT.parse(r.data)}async function OT(t,e,r,n){const i={};n?.gasPrice&&(i["gas-price"]=n.gasPrice.toString()),n?.immutableFlag!==void 0&&(i.immutable=String(n.immutableFlag));const o=await he(t,{method:"post",url:`${ai}/${e}/${r}`,responseType:"json",params:{label:n?.label},headers:i});return Ch.parse(o.data).batchID}async function IT(t,e,r){await he(t,{method:"patch",url:`${ai}/${e}`,responseType:"json",data:{label:r}})}async function kT(t,e,r){const n=await he(t,{method:"patch",url:`${ai}/topup/${e}/${r}`,responseType:"json"});return Ch.parse(n.data).batchID}async function NT(t,e,r){const n=await he(t,{method:"patch",url:`${ai}/dilute/${e}/${r}`,responseType:"json"});return Ch.parse(n.data).batchID}const CT=ve({commitment:me(),radius:me(),storageRadius:me(),reserveCapacityDoubling:me()}),_T=ve({block:me(),chainTip:me(),totalAmount:ce().transform(t=>He(t,{name:"totalAmount"})),currentPrice:ce().transform(Number).transform(t=>_9(t)),minimumValidityBlocks:me().optional()}),FT=ve({bzzBalance:ce().transform(t=>De.fromPLUR(He(t,{name:"bzzBalance"}))),nativeTokenBalance:ce().transform(t=>ut.fromWei(He(t,{name:"nativeTokenBalance"}))),chainID:me(),chequebookContractAddress:ce(),walletAddress:ce()}),rx=ve({transactionHash:ce().transform(t=>new Yr(t))}),DT="reservestate",_h="wallet",LT="chainstate";async function UT(t){const e=await he(t,{method:"get",url:`${DT}`,responseType:"json"});return CT.parse(e.data)}async function MT(t){const e=await he(t,{method:"get",url:`${LT}`,responseType:"json"});return _T.parse(e.data)}async function zT(t){const e=await he(t,{method:"get",url:`${_h}`,responseType:"json"});return FT.parse(e.data)}async function $T(t,e,r){const n=await he(t,{method:"post",url:`${_h}/withdraw/bzz`,responseType:"json",params:{amount:e.toPLURString(),address:r.toHex()}});return rx.parse(n.data).transactionHash}async function VT(t,e,r){const n=await he(t,{method:"post",url:`${_h}/withdraw/nativetoken`,responseType:"json",params:{amount:e.toWeiString(),address:r.toHex()}});return rx.parse(n.data).transactionHash}var tf,Mm;function nx(){if(Mm)return tf;Mm=1;var t={};return tf=typeof Ce=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},tf}var rf,zm;function ix(){if(zm)return rf;zm=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=e-6;return rf={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rf}var $o={exports:{}},$m;function GT(){return $m||($m=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=ix(),o=nx();e=t.exports={};const a=e.re=[],u=e.safeRe=[],l=e.src=[],h=e.safeSrc=[],d=e.t={};let m=0;const y="[a-zA-Z0-9-]",w=[["\\s",1],["\\d",i],[y,n]],T=O=>{for(const[A,I]of w)O=O.split(`${A}*`).join(`${A}{0,${I}}`).split(`${A}+`).join(`${A}{1,${I}}`);return O},R=(O,A,I)=>{const B=T(A),S=m++;o(O,S,A),d[O]=S,l[S]=A,h[S]=B,a[S]=new RegExp(A,I?"g":void 0),u[S]=new RegExp(B,I?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*"),R("NUMERICIDENTIFIERLOOSE","\\d+"),R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y}*`),R("MAINVERSION",`(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})`),R("MAINVERSIONLOOSE",`(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})`),R("PRERELEASEIDENTIFIER",`(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIER]})`),R("PRERELEASEIDENTIFIERLOOSE",`(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIERLOOSE]})`),R("PRERELEASE",`(?:-(${l[d.PRERELEASEIDENTIFIER]}(?:\\.${l[d.PRERELEASEIDENTIFIER]})*))`),R("PRERELEASELOOSE",`(?:-?(${l[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[d.PRERELEASEIDENTIFIERLOOSE]})*))`),R("BUILDIDENTIFIER",`${y}+`),R("BUILD",`(?:\\+(${l[d.BUILDIDENTIFIER]}(?:\\.${l[d.BUILDIDENTIFIER]})*))`),R("FULLPLAIN",`v?${l[d.MAINVERSION]}${l[d.PRERELEASE]}?${l[d.BUILD]}?`),R("FULL",`^${l[d.FULLPLAIN]}$`),R("LOOSEPLAIN",`[v=\\s]*${l[d.MAINVERSIONLOOSE]}${l[d.PRERELEASELOOSE]}?${l[d.BUILD]}?`),R("LOOSE",`^${l[d.LOOSEPLAIN]}$`),R("GTLT","((?:<|>)?=?)"),R("XRANGEIDENTIFIERLOOSE",`${l[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),R("XRANGEIDENTIFIER",`${l[d.NUMERICIDENTIFIER]}|x|X|\\*`),R("XRANGEPLAIN",`[v=\\s]*(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:${l[d.PRERELEASE]})?${l[d.BUILD]}?)?)?`),R("XRANGEPLAINLOOSE",`[v=\\s]*(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:${l[d.PRERELEASELOOSE]})?${l[d.BUILD]}?)?)?`),R("XRANGE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAIN]}$`),R("XRANGELOOSE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAINLOOSE]}$`),R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),R("COERCE",`${l[d.COERCEPLAIN]}(?:$|[^\\d])`),R("COERCEFULL",l[d.COERCEPLAIN]+`(?:${l[d.PRERELEASE]})?(?:${l[d.BUILD]})?(?:$|[^\\d])`),R("COERCERTL",l[d.COERCE],!0),R("COERCERTLFULL",l[d.COERCEFULL],!0),R("LONETILDE","(?:~>?)"),R("TILDETRIM",`(\\s*)${l[d.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",R("TILDE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAIN]}$`),R("TILDELOOSE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAINLOOSE]}$`),R("LONECARET","(?:\\^)"),R("CARETTRIM",`(\\s*)${l[d.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",R("CARET",`^${l[d.LONECARET]}${l[d.XRANGEPLAIN]}$`),R("CARETLOOSE",`^${l[d.LONECARET]}${l[d.XRANGEPLAINLOOSE]}$`),R("COMPARATORLOOSE",`^${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]})$|^$`),R("COMPARATOR",`^${l[d.GTLT]}\\s*(${l[d.FULLPLAIN]})$|^$`),R("COMPARATORTRIM",`(\\s*)${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]}|${l[d.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",R("HYPHENRANGE",`^\\s*(${l[d.XRANGEPLAIN]})\\s+-\\s+(${l[d.XRANGEPLAIN]})\\s*$`),R("HYPHENRANGELOOSE",`^\\s*(${l[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[d.XRANGEPLAINLOOSE]})\\s*$`),R("STAR","(<|>)?=?\\s*\\*"),R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})($o,$o.exports)),$o.exports}var nf,Vm;function jT(){if(Vm)return nf;Vm=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return nf=n=>n?typeof n!="object"?t:n:e,nf}var sf,Gm;function HT(){if(Gm)return sf;Gm=1;const t=/^[0-9]+$/,e=(n,i)=>{if(typeof n=="number"&&typeof i=="number")return n===i?0:n<i?-1:1;const o=t.test(n),a=t.test(i);return o&&a&&(n=+n,i=+i),n===i?0:o&&!a?-1:a&&!o?1:n<i?-1:1};return sf={compareIdentifiers:e,rcompareIdentifiers:(n,i)=>e(i,n)},sf}var of,jm;function qT(){if(jm)return of;jm=1;const t=nx(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:r}=ix(),{safeRe:n,t:i}=GT(),o=jT(),{compareIdentifiers:a}=HT(),u=(h,d)=>{const m=d.split(".");if(m.length>h.length)return!1;for(let y=0;y<m.length;y++)if(a(h[y],m[y])!==0)return!1;return!0};class l{constructor(d,m){if(m=o(m),d instanceof l){if(d.loose===!!m.loose&&d.includePrerelease===!!m.includePrerelease)return d;d=d.version}else if(typeof d!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof d}".`);if(d.length>e)throw new TypeError(`version is longer than ${e} characters`);t("SemVer",d,m),this.options=m,this.loose=!!m.loose,this.includePrerelease=!!m.includePrerelease;const y=d.trim().match(m.loose?n[i.LOOSE]:n[i.FULL]);if(!y)throw new TypeError(`Invalid Version: ${d}`);if(this.raw=d,this.major=+y[1],this.minor=+y[2],this.patch=+y[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");y[4]?this.prerelease=y[4].split(".").map(w=>{if(/^[0-9]+$/.test(w)){const T=+w;if(T>=0&&T<r)return T}return w}):this.prerelease=[],this.build=y[5]?y[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(d){if(t("SemVer.compare",this.version,this.options,d),!(d instanceof l)){if(typeof d=="string"&&d===this.version)return 0;d=new l(d,this.options)}return d.version===this.version?0:this.compareMain(d)||this.comparePre(d)}compareMain(d){return d instanceof l||(d=new l(d,this.options)),this.major<d.major?-1:this.major>d.major?1:this.minor<d.minor?-1:this.minor>d.minor?1:this.patch<d.patch?-1:this.patch>d.patch?1:0}comparePre(d){if(d instanceof l||(d=new l(d,this.options)),this.prerelease.length&&!d.prerelease.length)return-1;if(!this.prerelease.length&&d.prerelease.length)return 1;if(!this.prerelease.length&&!d.prerelease.length)return 0;let m=0;do{const y=this.prerelease[m],w=d.prerelease[m];if(t("prerelease compare",m,y,w),y===void 0&&w===void 0)return 0;if(w===void 0)return 1;if(y===void 0)return-1;if(y===w)continue;return a(y,w)}while(++m)}compareBuild(d){d instanceof l||(d=new l(d,this.options));let m=0;do{const y=this.build[m],w=d.build[m];if(t("build compare",m,y,w),y===void 0&&w===void 0)return 0;if(w===void 0)return 1;if(y===void 0)return-1;if(y===w)continue;return a(y,w)}while(++m)}inc(d,m,y){if(d.startsWith("pre")){if(!m&&y===!1)throw new Error("invalid increment argument: identifier is empty");if(m){const w=`-${m}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!w||w[1]!==m)throw new Error(`invalid identifier: ${m}`)}}switch(d){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",m,y);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",m,y);break;case"prepatch":this.prerelease.length=0,this.inc("patch",m,y),this.inc("pre",m,y);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",m,y),this.inc("pre",m,y);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const w=Number(y)?1:0;if(this.prerelease.length===0)this.prerelease=[w];else{let T=this.prerelease.length;for(;--T>=0;)typeof this.prerelease[T]=="number"&&(this.prerelease[T]++,T=-2);if(T===-1){if(m===this.prerelease.join(".")&&y===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(w)}}if(m){let T=[m,w];if(y===!1&&(T=[m]),u(this.prerelease,m)){const R=this.prerelease[m.split(".").length];isNaN(R)&&(this.prerelease=T)}else this.prerelease=T}break}default:throw new Error(`invalid increment argument: ${d}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return of=l,of}var af,Hm;function ZT(){if(Hm)return af;Hm=1;const t=qT();return af=(r,n)=>new t(r,n).major,af}var KT=ZT();const qm=lh(KT),JT=ve({overlay:ce(),proximity:me(),beeMode:ce().transform(ob),reserveSize:me(),reserveSizeWithinRadius:me(),pullsyncRate:me(),storageRadius:me(),connectedPeers:me(),neighborhoodSize:me(),batchCommitment:me(),isReachable:Qe(),lastSyncedBlock:me(),committedDepth:me(),isWarmingUp:Qe()}),WT=ve({apiVersion:ce(),version:ce(),status:Y5("ok")}),QT=ve({apiVersion:ce(),version:ce(),status:Wy(["ready","notReady"])}),YT=ve({beeMode:ce().transform(ob),chequebookEnabled:Qe(),swapEnabled:Qe()}),XT=ve({gateway:Qe()}),Fh="2.8.1-7cf53193";Fh.split("-")[0];const sx="8.1.0",eB="node",tB="status",rB="health",nB="readiness";async function iB(t){const e=await he(t,{method:"get",url:tB,responseType:"json"});return JT.parse(e.data)}async function Ha(t){const e=await he(t,{method:"get",url:rB,responseType:"json"});return WT.parse(e.data)}async function sB(t){const e=await he(t,{method:"get",url:nB});return QT.parse(e.data)}async function oB(t){const e=await he(t,{method:"get",url:eB,responseType:"json"});return YT.parse(e.data)}async function aB(t){const{version:e}=await Ha(t);return e===Fh}async function cB(t){const{apiVersion:e}=await Ha(t);return qm(e)===qm(sx)}async function uB(t){const{version:e,apiVersion:r}=await Ha(t);return{supportedBeeVersion:Fh,supportedBeeApiVersion:sx,beeVersion:e,beeApiVersion:r}}const ox=ve({transactionHash:ce().transform(t=>new Yr(t)),to:ce(),nonce:me(),gasPrice:ce().transform(t=>He(t,{name:"gasPrice"})),gasLimit:me(),data:ce(),created:ce(),description:ce(),value:ce().transform(t=>He(t,{name:"value"}))}),lB=ve({pendingTransactions:Dt(ox)}),fB=ox,ax=ve({transactionHash:ce().transform(t=>new Yr(t))}),qa="transactions";async function hB(t){const e=await he(t,{url:qa,responseType:"json"});return lB.parse(e.data).pendingTransactions}async function dB(t,e){const r=await he(t,{url:`${qa}/${e}`,responseType:"json"});return fB.parse(r.data)}async function pB(t,e){const r=await he(t,{method:"post",url:`${qa}/${e}`,responseType:"json"});return ax.parse(r.data).transactionHash}async function mB(t,e,r){const n={};r&&(n["gas-price"]=r.toString());const i=await he(t,{method:"delete",headers:n,url:`${qa}/${e}`,responseType:"json"});return ax.parse(i.data).transactionHash}const gB=ve({issuer:ce().transform(t=>G.Binary.hexToUint8Array(t)),index:ce().transform(t=>G.Binary.hexToUint8Array(t)),timestamp:ce().transform(t=>G.Binary.hexToUint8Array(t)),signature:ce().transform(t=>G.Binary.hexToUint8Array(t))}),yB="envelope";async function bB(t,e,r){const n=await he(t,{method:"post",responseType:"json",url:`${yB}/${r}`,headers:{"swarm-postage-batch-id":e.toHex()}}),i=gB.parse(n.data);return{issuer:i.issuer,index:i.index,timestamp:i.timestamp,signature:i.signature,batchId:e}}const xB=Dt(ce().transform(t=>new br(t))),cx=ve({ref:ce().transform(t=>new Pe(t)),historyref:ce().transform(t=>new Pe(t))}),Dh="grantee";async function wB(t,e){const r=await he(e,{method:"get",url:`${Dh}/${t}`,responseType:"json"});return{status:r.status,statusText:r.statusText,grantees:xB.parse(r.data)}}async function AB(t,e,r){const n=await he(t,{method:"post",url:Dh,data:{grantees:r.map(o=>o.toCompressedHex())},headers:Gt(e),responseType:"json"}),i=cx.parse(n.data);return{status:n.status,statusText:n.statusText,ref:i.ref,historyref:i.historyref}}async function EB(t,e,r,n,i){const o=await he(i,{method:"patch",url:`${Dh}/${e}`,data:{add:n.add?.map(u=>u.toCompressedHex()),revoke:n.revoke?.map(u=>u.toCompressedHex())},headers:{...Gt(t),"swarm-act-history-address":r.toHex()},responseType:"json"}),a=cx.parse(o.data);return{status:o.status,statusText:o.statusText,ref:a.ref,historyref:a.historyref}}var cf,Zm;function vB(){if(Zm)return cf;Zm=1;var t=null;return typeof WebSocket<"u"?t=WebSocket:typeof MozWebSocket<"u"?t=MozWebSocket:typeof Ir<"u"?t=Ir.WebSocket||Ir.MozWebSocket:typeof window<"u"?t=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(t=self.WebSocket||self.MozWebSocket),cf=t,cf}var RB=vB();const Aa=lh(RB),Km="gsoc";async function TB(t,e,r,n){return Th(t,e,r,n)}function BB(t,e,r){const n=t.replace(/^http/i,"ws");return G.System.whereAmI()==="browser"?new Aa(`${n}/${Km}/subscribe/${e.toHex()}`):new Aa(`${n}/${Km}/subscribe/${e.toHex()}`,{headers:r})}const SB=ve({references:Dt(ce()).nullable()}),Za="pins";async function PB(t,e){await he(t,{method:"post",responseType:"json",url:`${Za}/${e}`})}async function OB(t,e){await he(t,{method:"delete",responseType:"json",url:`${Za}/${e}`})}async function IB(t,e){const r=await he(t,{method:"get",responseType:"json",url:`${Za}/${e}`});return si.parse(r.data)}async function kB(t){const e=await he(t,{method:"get",responseType:"json",url:`${Za}`}),{references:r}=SB.parse(e.data);return(r??[]).map(n=>new Pe(n))}const Mf="pss";async function Jm(t,e,r,n,i,o){await he(t,{method:"post",url:`${Mf}/send/${e}/${r}`,data:n,responseType:"json",params:{recipient:o},headers:Gt(i)})}function NB(t,e,r){const n=t.replace(/^http/i,"ws");return G.System.whereAmI()==="browser"?new Aa(`${n}/${Mf}/subscribe/${e.toHex()}`):new Aa(`${n}/${Mf}/subscribe/${e.toHex()}`,{headers:r})}const CB=ve({durationSeconds:me()}),_B="rchash";async function FB(t,e,r,n){const i=await he(t,{responseType:"json",url:`${_B}/${e}/${r}/${n}`});return CB.parse(i.data).durationSeconds}async function Wm(t){await he(t,{url:"",responseType:"text"})}async function DB(t){try{const e=await he(t,{url:"/gateway"});return XT.parse(e.data).gateway}catch{return!1}}const LB=ve({isRetrievable:Qe()}),ux="stewardship";async function UB(t,e,r){await he(t,{method:"put",url:`${ux}/${r}`,headers:{"swarm-postage-batch-id":e.toHex()}})}async function MB(t,e){e=new Pe(e);const r=await he(t,{method:"get",responseType:"json",url:`${ux}/${e}`});return LB.parse(r.data).isRetrievable}const Lh=ve({address:ce().nullish().transform(t=>t??""),seen:me(),sent:me(),split:me(),startedAt:ce(),stored:me(),synced:me(),uid:me()}),zB=ve({tags:Dt(Lh)}),uo="tags";async function $B(t){const e=await he(t,{method:"post",url:uo,responseType:"json"});return Lh.parse(e.data)}async function VB(t,e){const r=await he(t,{url:`${uo}/${e}`,responseType:"json"});return Lh.parse(r.data)}async function GB(t,e,r){const n=await he(t,{url:uo,params:{offset:e,limit:r},responseType:"json"});return zB.parse(n.data).tags}async function jB(t,e){await he(t,{method:"delete",url:`${uo}/${e}`})}async function HB(t,e,r){await he(t,{method:"patch",url:`${uo}/${e}`,data:{reference:r}})}const zf=bh("bee-js:manifest"),sa=new TextEncoder,Us=new TextDecoder,qB=2,ZB=4,KB=8,lx=16,uf=new Uint8Array([47]),JB="5768b3b6a7db56d21d1abff40d41cebfc83448fed8d7e9b06ec0d3b073f28f7b",Qm=G.Binary.hexToUint8Array(JB);class vn{constructor(e,r){this.prefix=e,this.node=r}static split(e,r){const n=G.Binary.commonPrefix(e.prefix,r.prefix);if(n.length===e.prefix.length){const u=r.prefix.slice(n.length);return r.node.path=r.prefix.slice(n.length),r.prefix=r.prefix.slice(n.length),r.node.parent=e.node,e.node.forks.set(u[0],r),e}if(n.length===r.prefix.length){const u=e.prefix.slice(n.length);return e.node.path=e.prefix.slice(n.length),e.prefix=e.prefix.slice(n.length),e.node.parent=r.node,r.node.forks.set(u[0],e),r}const i=new Wn({path:n}),o=new vn(e.prefix.slice(n.length),e.node),a=new vn(r.prefix.slice(n.length),r.node);return e.node.path=e.prefix.slice(n.length),r.node.path=r.prefix.slice(n.length),e.prefix=e.prefix.slice(n.length),r.prefix=r.prefix.slice(n.length),i.forks.set(o.prefix[0],o),i.forks.set(a.prefix[0],a),o.node.parent=i,a.node.parent=i,new vn(n,i)}marshal(){if(!this.node.selfAddress)throw Error("Fork#marshal node.selfAddress is not set");const e=[];if(e.push(new Uint8Array([this.node.determineType()])),e.push(G.Binary.numberToUint8(this.prefix.length)),e.push(this.prefix),this.prefix.length<30&&e.push(new Uint8Array(30-this.prefix.length)),e.push(this.node.selfAddress),zf("marshalling fork",{prefixLength:this.prefix.length,prefix:Us.decode(this.prefix),address:G.Binary.uint8ArrayToHex(this.node.selfAddress)}),this.node.metadata){const r=G.Binary.padEndToMultiple(new Uint8Array([0,0,...sa.encode(JSON.stringify(this.node.metadata))]),32,10),n=G.Binary.numberToUint16(r.length-2,"BE");r.set(n,0),e.push(r)}return G.Binary.concatBytes(...e)}static unmarshal(e,r){const n=G.Binary.uint8ToNumber(e.read(1)),i=G.Binary.uint8ToNumber(e.read(1)),o=e.read(i);i<30&&e.read(30-i);const a=e.read(r);zf("unmarshalling fork",{type:n,prefixLength:i,prefix:Us.decode(o),addressLength:r,address:G.Binary.uint8ArrayToHex(a)});let u;if(WB(n,lx)){const l=G.Binary.uint16ToNumber(e.read(2),"BE");u=JSON.parse(Us.decode(e.read(l)))}return new vn(o,new Wn({selfAddress:a,metadata:u,path:o}))}}class Wn{constructor(e){this.obfuscationKey=new Uint8Array(32),this.selfAddress=null,this.targetAddress=new Uint8Array(32),this.metadata=null,this.path=new Uint8Array(0),this.forks=new Map,this.parent=null,e?.targetAddress&&(this.targetAddress=e.targetAddress),e?.selfAddress&&(this.selfAddress=e.selfAddress),e?.metadata&&(this.metadata=e.metadata),e?.obfuscationKey&&(this.obfuscationKey=e.obfuscationKey),e?.path&&(this.path=e.path),e?.parent&&(this.parent=e.parent)}get fullPath(){return G.Binary.concatBytes(this.parent?.fullPath??new Uint8Array(0),this.path)}get fullPathString(){return Us.decode(this.fullPath)}getRootMetadata(){const e=this.find("/");return e&&e.metadata?G.Optional.of(e.metadata):G.Optional.empty()}getDocsMetadata(){const e=this.find("/");return!e||!e.metadata?{indexDocument:null,errorDocument:null}:{indexDocument:e.metadata["website-index-document"]??null,errorDocument:e.metadata["website-error-document"]??null}}async resolveFeed(e,r){const n=this.find("/");if(!n||!n.metadata)return G.Optional.empty();const i=n.metadata["swarm-feed-owner"],o=n.metadata["swarm-feed-topic"];return!i||!o?G.Optional.empty():G.Optional.of(await e.fetchLatestFeedUpdate(o,i,r))}async marshal(){for(const o of this.forks.values())o.node.selfAddress||(o.node.selfAddress=(await o.node.calculateSelfAddress()).toUint8Array());const e=new Uint8Array(32);e.set(Qm,0),e.set(G.Binary.equals(this.targetAddress,Ei)&&G.Binary.equals(this.path,new Uint8Array([47]))?G.Binary.numberToUint8(0):G.Binary.numberToUint8(this.targetAddress.length),31);const r=new Uint8Array(32);for(const o of this.forks.keys())G.Binary.setBit(r,o,1,"LE");const n=[];for(let o=0;o<256;o++)G.Binary.getBit(r,o,"LE")&&n.push(this.forks.get(o).marshal());const i=G.Binary.xorCypher(G.Binary.concatBytes(e,G.Binary.equals(this.targetAddress,Ei)&&G.Binary.equals(this.path,new Uint8Array([47]))?new Uint8Array(0):this.targetAddress,r,...n),this.obfuscationKey);return G.Binary.concatBytes(this.obfuscationKey,i)}static async unmarshal(e,r,n,i){r=new Pe(r);const o=(await e.downloadData(r,n,i)).toUint8Array();return this.unmarshalFromData(o,r.toUint8Array())}static unmarshalFromData(e,r){const n=e.subarray(0,32),i=G.Binary.xorCypher(e.subarray(32),n),o=new G.Uint8ArrayReader(i),a=o.read(31);if(!G.Binary.equals(a,Qm.slice(0,31)))throw new Error("MantarayNode#unmarshal invalid version hash");const u=G.Binary.uint8ToNumber(o.read(1)),l=u?o.read(u):Ei,h=new Wn({selfAddress:r,targetAddress:l,obfuscationKey:n}),d=o.read(32);for(let m=0;m<256;m++)if(G.Binary.getBit(d,m,"LE")){const y=vn.unmarshal(o,r.length);h.forks.set(m,y),y.node.parent=h}return h}addFork(e,r,n){this.selfAddress=null,e=e instanceof Uint8Array?e:sa.encode(e),zf("adding fork",{path:Us.decode(e),reference:new Pe(r).represent()});let i=this;for(;e.length;){const o=e.slice(0,30);e=e.slice(30);const a=e.length===0,[u,l]=i.findClosest(o),h=o.slice(l.length);if(l.length&&(i=u),!h.length)continue;const d=new vn(h,new Wn({targetAddress:a?new Pe(r).toUint8Array():void 0,metadata:a?n:void 0,path:h})),m=u.forks.get(h[0]);if(m){const y=vn.split(d,m);i.forks.set(h[0],y),y.node.parent=i,i.selfAddress=null,i=d.node}else i.forks.set(h[0],d),d.node.parent=i,i.selfAddress=null,i=d.node}}removeFork(e){if(this.selfAddress=null,e=e instanceof Uint8Array?e:sa.encode(e),e.length===0)throw Error("MantarayNode#removeFork [path] parameter cannot be empty");const r=this.find(e);if(!r)throw Error("MantarayNode#removeFork fork not found");const[n,i]=this.findClosest(e.slice(0,e.length-1));n.forks.delete(e.slice(i.length)[0]);for(const o of r.forks.values())n.addFork(G.Binary.concatBytes(r.path,o.prefix),o.node.targetAddress,o.node.metadata)}async calculateSelfAddress(){return this.selfAddress?new Pe(this.selfAddress):new Pe((await G.MerkleTree.root(await this.marshal())).hash())}async saveRecursively(e,r,n,i){for(const a of this.forks.values()){const u=await a.node.saveRecursively(e,r,n,i);if(n?.act){let l;u.historyAddress.ifPresent(h=>l=h),l&&(a.node.metadata||(a.node.metadata={}),a.node.metadata["swarm-act-history-address"]=l.toHex())}}const o=await e.uploadData(r,await this.marshal(),n,i);return this.selfAddress=o.reference.toUint8Array(),o}async loadRecursively(e,r,n){for(const i of this.forks.values()){if(!i.node.selfAddress)throw Error("MantarayNode#loadRecursively fork.node.selfAddress is not set");let o=r;i.node.metadata&&i.node.metadata["swarm-act-history-address"]&&(o={...r,actHistoryAddress:i.node.metadata["swarm-act-history-address"]});const a=await Wn.unmarshal(e,i.node.selfAddress,o,n);i.node.targetAddress=a.targetAddress,i.node.forks=a.forks,i.node.path=i.prefix,i.node.parent=this,await i.node.loadRecursively(e,r,n)}}find(e){const[r,n]=this.findClosest(e);return n.length===e.length?r:null}findClosest(e,r=new Uint8Array){if(e=e instanceof Uint8Array?e:sa.encode(e),e.length===0)return[this,r];const n=this.forks.get(e[0]);return n&&G.Binary.commonPrefix(n.prefix,e).length===n.prefix.length?n.node.findClosest(e.slice(n.prefix.length),G.Binary.concatBytes(r,n.prefix)):[this,r]}collect(e=[]){for(const r of this.forks.values())G.Binary.equals(r.node.targetAddress,Ei)||e.push(r.node),r.node.collect(e);return e}collectAndMap(){const e=this.collect(),r={};for(const n of e)r[n.fullPathString]=new Pe(n.targetAddress).toHex();return r}determineType(){let e=0;return(!G.Binary.equals(this.targetAddress,Ei)||G.Binary.equals(this.path,uf))&&(e|=qB),this.forks.size>0&&(e|=ZB),G.Binary.indexOf(this.path,uf)!==-1&&!G.Binary.equals(this.path,uf)&&(e|=KB),this.metadata&&(e|=lx),e}}function WB(t,e){return(t&e)===e}function QB(t){function n(o){if(o<=1)return o;const a=Math.ceil(o/128);return o+n(a)}const i=Math.ceil(t/4096);return n(i)}const YB={aac:"audio/aac",abw:"application/x-abiword",ai:"application/postscript",arc:"application/octet-stream",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",dll:"application/octet-stream",dmg:"application/x-apple-diskimage",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"application/javascript",json:"application/json",mid:"audio/midi",midi:"audio/midi",mp2:"audio/mpeg",mp3:"audio/mpeg",mp4:"video/mp4",mpa:"video/mpeg",mpe:"video/mpeg",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",otf:"font/otf",png:"image/png",pdf:"application/pdf",ppt:"application/vnd.ms-powerpoint",rar:"application/x-rar-compressed",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"application/typescript",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/x-wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.ms-excel",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3gp2":"video/3gpp2","7z":"application/x-7z-compressed"};async function XB(t){throw new Error("Hashing directories is not supported in browsers!")}async function eS(t,e,r,n,i,o){throw new Error("Streaming directories is not supported in browsers!")}async function tS(t,e,r,n,i,o){const a=o?.signal;if(a?.aborted)throw new Error("Request aborted");const u=new G.AsyncQueue(64,64);let l=0,h=0;for(const y of e)l+=QB(y.size);r=new et(r);async function d(y){await u.enqueue(async()=>{if(!a?.aborted)try{await t.uploadChunk(r,y.build(),i,o),n?.({total:l,processed:++h})}catch(w){if(a?.aborted)return;throw w}})}const m=new Wn;for(const y of e){if(a?.aborted)throw new Error("Request aborted");const w=await new Promise((O,A)=>{const I=new G.MerkleTree(d);let B=0;const S=new FileReader;S.onerror=()=>{A(S.error)};const N=async()=>{if(a?.aborted){A(new Error("Request aborted"));return}if(B>=y.size){const D=await I.finalize();O(D);return}const _=y.slice(B,B+4096);S.readAsArrayBuffer(_)};S.onload=async _=>{if(!_.target){A("No event target");return}const D=_.target.result;D&&(await I.append(new Uint8Array(D)),B+=4096),N()},N()});await u.drain();const{filename:T,extension:R}=G.Strings.parseFilename(y.name);m.addFork(jb(y),w.hash(),{"Content-Type":rS(YB[R.toLowerCase()]||"application/octet-stream"),Filename:T}),y.name==="index.html"&&m.addFork("/",Ei,{"website-index-document":"index.html"})}if(a?.aborted)throw new Error("Request aborted");return m.saveRecursively(t,r,i,o)}function rS(t){return["text/html","text/css"].includes(t)?`${t}; charset=utf-8`:t}async function nS(t){throw new Error("Creating Collection from File System is not supported in browsers!")}async function Ym(t){if(typeof t=="string")return new TextEncoder().encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(t instanceof Blob)return new Uint8Array(await new Response(t).arrayBuffer());throw new TypeError("unknown websocket data type")}const iS=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"];function sS(t){try{if(typeof t!="string")return!1;const e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function oS(t){if(typeof t!="string"||iS.includes(t))return!1;const e=parseInt(t,10);return e>0&&e<65536&&!isNaN(e)}function aS(t){if(!sS(t))throw new Tr("URL is not valid!",t);const e=new URL(t).port;if(e&&!oS(e))throw new Tr("Port in URL is considered bad port and cannot be used!",e)}function cS(t){return t.endsWith("/")?t.slice(0,-1):t}class DN{constructor(e,r){aS(e),this.url=cS(e),r?.signer&&(this.signer=new qr(r.signer)),this.network=r?.network??"gnosis",this.requestOptions={baseURL:this.url,timeout:r?.timeout??0,headers:r?.headers,onRequest:r?.onRequest,httpAgent:r?.httpAgent,httpsAgent:r?.httpsAgent}}async uploadData(e,r,n,i){return e=new et(e),Cm(r),n&&(n=R9.parse(n)),Lb(this.getRequestOptionsForCall(i),r,e,n)}async probeData(e,r){return e=new Pe(e),oR(this.getRequestOptionsForCall(r),e)}async downloadData(e,r,n){return r&&(r=wn.parse(r)),Ub(this.getRequestOptionsForCall(n),new ia(e),r)}async downloadReadableData(e,r,n){return r&&(r=wn.parse(r)),aR(this.getRequestOptionsForCall(n),new ia(e),r)}async uploadChunk(e,r,n,i){const o="identifier"in r&&"signature"in r&&"owner"in r;if(r=r instanceof Uint8Array?r:r.data,n&&(n=js.parse(n)),r.length<Tt.LENGTH)throw new Tr(`Chunk has to have size of at least ${Tt.LENGTH}.`,r);if(!o&&r.length>Lo+Tt.LENGTH)throw new Tr(`Content Addressed Chunk must not exceed ${Lo+Tt.LENGTH} bytes.`,r);if(o&&r.length>Lo+Tt.LENGTH+Sn.LENGTH+kt.LENGTH)throw new Tr(`Single Owner Chunk must not exceed ${Lo+Tt.LENGTH+Sn.LENGTH+kt.LENGTH} bytes.`,r);return X9(this.getRequestOptionsForCall(i),r,e,n)}async downloadChunk(e,r,n){return e=new Pe(e),r&&(r=wn.parse(r)),ao(this.getRequestOptionsForCall(n),e,r)}async createGrantees(e,r,n){return e=new et(e),r=r.map(i=>new br(i)),AB(this.getRequestOptionsForCall(n),e,r)}async getGrantees(e,r){return e=new Pe(e),wB(e,this.getRequestOptionsForCall(r))}async patchGrantees(e,r,n,i,o){e=new et(e),r=new Pe(r),n=new Pe(n);const a={add:i.add?.map(u=>new br(u))??[],revoke:i.revoke?.map(u=>new br(u))??[]};return EB(e,r,n,a,this.getRequestOptionsForCall(o))}async uploadFile(e,r,n,i,o){if(e=new et(e),N9(r),i&&(i=T9.parse(i)),n&&typeof n!="string")throw new TypeError("name has to be string or undefined!");if(Rb(r)){const a=await Tb(r),u=n??r.name,l=r.type,h={...i,contentType:l};return Dm(this.getRequestOptionsForCall(o),a,e,u,h)}else return Dm(this.getRequestOptionsForCall(o),r,e,n,i)}async downloadFile(e,r="",n,i){return n&&(n=wn.parse(n)),IR(this.getRequestOptionsForCall(i),new ia(e),r,n)}async downloadReadableFile(e,r="",n,i){return e=new Pe(e),n&&(n=wn.parse(n)),kR(this.getRequestOptionsForCall(i),e,r,n)}async uploadFiles(e,r,n,i){e=new et(e),n&&(n=Xl.parse(n));const o=AR(r);return ef(this.getRequestOptionsForCall(i),o,e,n)}async hashDirectory(e){return XB()}async streamDirectory(e,r,n,i,o){return e=new et(e),eS(this,r,e,n,i,this.getRequestOptionsForCall(o))}async streamFiles(e,r,n,i,o){return e=new et(e),tS(this,r,e,n,i,this.getRequestOptionsForCall(o))}async uploadCollection(e,r,n,i){return e=new et(e),Gb(r),n&&(n=Xl.parse(n)),ef(this.getRequestOptionsForCall(i),r,e,n)}async uploadFilesFromDirectory(e,r,n,i){e=new et(e),n&&(n=Xl.parse(n));const o=await nS();return ef(this.getRequestOptionsForCall(i),o,e,n)}async createTag(e){return $B(this.getRequestOptionsForCall(e))}async getAllTags(e,r){return e&&(e=I9.parse(e)),GB(this.getRequestOptionsForCall(r),e?.offset,e?.limit)}async retrieveTag(e,r){return e=Rn(e),VB(this.getRequestOptionsForCall(r),e)}async deleteTag(e,r){return e=Rn(e),jB(this.getRequestOptionsForCall(r),e)}async updateTag(e,r,n){return r=new Pe(r),e=Rn(e),HB(this.getRequestOptionsForCall(n),e,r)}async pin(e,r){return e=new Pe(e),PB(this.getRequestOptionsForCall(r),e)}async unpin(e,r){return e=new Pe(e),OB(this.getRequestOptionsForCall(r),e)}async getAllPins(e){return kB(this.getRequestOptionsForCall(e))}async getPin(e,r){return e=new Pe(e),IB(this.getRequestOptionsForCall(r),e)}async reuploadPinnedData(e,r,n){e=new et(e),r=new Pe(r),await UB(this.getRequestOptionsForCall(n),e,r)}async isReferenceRetrievable(e,r){return e=new Pe(e),MB(this.getRequestOptionsForCall(r),e)}async isFeedRetrievable(e,r,n,i,o){if(e=new $t(e),r=new Zr(r),i&&(i=wn.parse(i)),!n)try{return await this.makeFeedReader(r,e,o).download(),!0}catch(a){const u=G.Objects.getDeep(a,"status");if(u===404||u===500)return!1;throw a}return xR(this,e,r,n,i,this.getRequestOptionsForCall(o))}async pssSend(e,r,n,i,o,a){return e=new et(e),Cm(i),o?(o=new br(o),Jm(this.getRequestOptionsForCall(a),r,n,i,e,o)):Jm(this.getRequestOptionsForCall(a),r,n,i,e)}pssSubscribe(e,r){r=P9.parse(r);const n=NB(this.url,e,this.requestOptions.headers);let i=!1;const a={topic:e,cancel:()=>{i||(i=!0,n.terminate?n.terminate():n.close())}};return n.onmessage=async u=>{const l=await Ym(u.data);l.length&&r.onMessage(new Le(l),a)},n.onerror=u=>{i||r.onError(new Or(u.message),a)},n.onclose=()=>{r.onClose(a)},a}async pssReceive(e,r=0){if(typeof r!="number")throw new TypeError("timeoutMsc parameter has to be a number!");return new Promise((n,i)=>{let o;const a=this.pssSubscribe(e,{onError:u=>{clearTimeout(o),a.cancel(),i(u.message)},onMessage:u=>{clearTimeout(o),a.cancel(),n(u)},onClose:()=>{clearTimeout(o),a.cancel()}});r>0&&(o=setTimeout(()=>{a.cancel(),i(new Or("pssReceive timeout"))},r))})}gsocMine(e,r,n=12){e=new vr(e),r=new kt(r);const i=0xb33n;for(let o=0n;o<0xffffn;o++){const a=new qr(G.Binary.numberToUint256(i+o,"BE")),u=Ls(r,a.publicKey().address());if(256-G.Binary.proximity(u.toUint8Array(),e.toUint8Array())<=256-n)return a}throw Error("Could not mine a valid signer")}async gsocSend(e,r,n,i,o,a){e=new et(e),r=new qr(r),n=new kt(n);const l=Hs(i).toSingleOwnerChunk(n,r);return TB(this.getRequestOptionsForCall(a),l,e,o)}gsocSubscribe(e,r,n){e=new $t(e),r=new kt(r),n=O9.parse(n);const i=Ls(r,e),o=BB(this.url,i,this.requestOptions.headers);let a=!1;const l={address:e,cancel:()=>{a||(a=!0,o.terminate?o.terminate():o.close())}};return o.onmessage=async h=>{const d=await Ym(h.data);d.length&&n.onMessage(new Le(d),l)},o.onerror=h=>{a||n.onError(new Or(h.message),l)},o.onclose=()=>{n.onClose(l)},l}async createFeedManifest(e,r,n,i,o){return e=new et(e),r=new Zr(r),n=new $t(n),i&&(i=js.parse(i)),cR(this.getRequestOptionsForCall(o),n,r,e,i)}makeFeedReader(e,r,n){return e=new Zr(e),r=new $t(r),Vb(this.getRequestOptionsForCall(n),e,r)}makeFeedWriter(e,r,n){if(e=new Zr(e),r=r?new qr(r):this.signer,!r)throw Error("No signer provided");return gR(this.getRequestOptionsForCall(n),e,r)}async fetchLatestFeedUpdate(e,r,n){return e=new Zr(e),r=new $t(r),wa(this.getRequestOptionsForCall(n),r,e)}makeContentAddressedChunk(e,r){return Hs(e,r)}unmarshalContentAddressedChunk(e){return Db(e)}makeSingleOwnerChunk(e,r,n,i,o){return Fb(e,r,n,i,o)}calculateSingleOwnerChunkAddress(e,r){return Ls(e,r)}unmarshalSingleOwnerChunk(e,r){return Ga(e,r)}makeSOCReader(e,r){return e=new $t(e),{owner:e,download:sR.bind(null,this.getRequestOptionsForCall(r),e)}}makeSOCWriter(e,r){if(e=e?new qr(e):this.signer,!e)throw Error("No signer provided");return{...this.makeSOCReader(e.publicKey().address(),r),upload:Bh.bind(null,this.getRequestOptionsForCall(r),e)}}async createEnvelope(e,r,n){return e=new et(e),r=new Pe(r),bB(this.getRequestOptionsForCall(n),e,r)}async rchash(e,r,n,i){return FB(this.getRequestOptionsForCall(i),e,r,n)}async checkConnection(e){return Wm(this.getRequestOptionsForCall(e))}async isConnected(e){try{await Wm(this.getRequestOptionsForCall(e))}catch{return!1}return!0}async isGateway(e){return DB(this.getRequestOptionsForCall(e))}async getNodeAddresses(e){return rT(this.getRequestOptionsForCall(e))}async getBlocklist(e){return iT(this.getRequestOptionsForCall(e))}async getPeers(e){return nT(this.getRequestOptionsForCall(e))}async removePeer(e,r){return e=new vr(e),sT(this.getRequestOptionsForCall(r),e)}async getTopology(e){return oT(this.getRequestOptionsForCall(e))}async pingPeer(e,r){return e=new vr(e),aT(this.getRequestOptionsForCall(r),e)}async getAllBalances(e){return NR(this.getRequestOptionsForCall(e))}async getPeerBalance(e,r){return e=new vr(e),CR(this.getRequestOptionsForCall(r),e)}async getPastDueConsumptionBalances(e){return _R(this.getRequestOptionsForCall(e))}async getPastDueConsumptionPeerBalance(e,r){return e=new vr(e),FR(this.getRequestOptionsForCall(r),e)}async getChequebookAddress(e){return VR(this.getRequestOptionsForCall(e))}async getChequebookBalance(e){return GR(this.getRequestOptionsForCall(e))}async getLastCheques(e){return ZR(this.getRequestOptionsForCall(e))}async getLastChequesForPeer(e,r){return e=new vr(e),qR(this.getRequestOptionsForCall(r),e)}async getLastCashoutAction(e,r){return e=new vr(e),jR(this.getRequestOptionsForCall(r),e)}async cashoutLastCheque(e,r,n){return e=new vr(e),r&&(r=Nm.parse(r)),HR(this.getRequestOptionsForCall(n),e,r)}async depositTokens(e,r,n){return this.depositBZZToChequebook(e,r,n)}async depositBZZToChequebook(e,r,n){const i=e instanceof De?e.toPLURString():He(e,{min:1n,name:"amount"});let o;return r&&(o=He(e,{min:0n,name:"gasPrice"})),KR(this.getRequestOptionsForCall(n),i,o)}async withdrawTokens(e,r,n){return this.withdrawBZZFromChequebook(e,r,n)}async withdrawBZZFromChequebook(e,r,n){const i=e instanceof De?e.toPLURString():He(e,{min:1n,name:"amount"});let o;return r&&(o=He(e,{min:0n,name:"gasPrice"})),JR(this.getRequestOptionsForCall(n),i,o)}async withdrawBZZToExternalWallet(e,r,n){return e=e instanceof De?e:De.fromPLUR(e),r=new $t(r),$T(this.getRequestOptionsForCall(n),e,r)}async withdrawDAIToExternalWallet(e,r,n){return e=e instanceof ut?e:ut.fromWei(e),r=new $t(r),VT(this.getRequestOptionsForCall(n),e,r)}async getSettlements(e,r){return e=new vr(e),lT(this.getRequestOptionsForCall(r),e)}async getAllSettlements(e){return fT(this.getRequestOptionsForCall(e))}async getStatus(e){return iB(this.getRequestOptionsForCall(e))}async getHealth(e){return Ha(this.getRequestOptionsForCall(e))}async getReadiness(e){return sB(this.getRequestOptionsForCall(e))}async getNodeInfo(e){return oB(this.getRequestOptionsForCall(e))}async isSupportedExactVersion(e){return aB(this.getRequestOptionsForCall(e))}async isSupportedApiVersion(e){return cB(this.getRequestOptionsForCall(e))}async getVersions(e){return uB(this.getRequestOptionsForCall(e))}async getReserveState(e){return UT(this.getRequestOptionsForCall(e))}async getChainState(e){return MT(this.getRequestOptionsForCall(e))}async getWalletBalance(e){return zT(this.getRequestOptionsForCall(e))}async createPostageBatch(e,r,n,i){const o=He(e,{min:0n,name:"amount"});if(n&&(n=km.parse(n)),r<np||r>ip)throw new Tr(`Depth has to be between ${np}..${ip}`,r);const a=await this.getChainState(),u=BigInt(a.currentPrice)*17280n+1n;if(BigInt(o)<u)throw new Tr(`Amount has to be at least ${u} (1 day at current price ${a.currentPrice})`,o);const l=await OT(this.getRequestOptionsForCall(i),o,r,n);return n?.waitForUsable!==!1&&await this.waitForUsablePostageStamp(l,n?.waitForUsableTimeout),l}async buyStorage(e,r,n,i,o,a){const u=await this.getChainState(i),l=Fr(r,u.currentPrice,this.network==="gnosis"?5:15),h=bi(e,o,a);return n&&(n=km.parse(n)),this.createPostageBatch(l,h,n,i)}async getStorageCost(e,r,n,i,o){const a=await this.getChainState(n),u=Fr(r,a.currentPrice,this.network==="gnosis"?5:15),l=bi(e,i,o);return yi(l,u)}async extendStorage(e,r,n,i,o,a){const u=await this.getPostageBatch(e,i),l=bi(r,o,a),h=await this.getChainState(i),d=l-u.depth,m=d<=0?1n:2n**BigInt(d),y=this.network==="gnosis"?5:15,w=Fr(n,h.currentPrice,y),T=Fr(u.duration,h.currentPrice,y),O=(n.isZero()?T*m:(T+w)*m)-T;let A;if(O>0n&&(A=await this.topUpBatch(u.batchID,O,i)),d>0)return this.diluteBatch(u.batchID,l,i);if(!A)throw new Error("Nothing to extend, both size and duration are already sufficient");return A}async extendStorageSize(e,r,n,i,o){const a=await this.getChainState(n),u=await this.getPostageBatch(e,n),l=bi(r,i,o),h=l-u.depth;if(h<=0)throw new Tr("New depth has to be greater than the original depth",l);const d=Fr(u.duration,a.currentPrice,this.network==="gnosis"?5:15);return await this.topUpBatch(u.batchID,d*(2n**BigInt(h)-1n)+1n,n),this.diluteBatch(u.batchID,l,n)}async extendStorageDuration(e,r,n){const i=await this.getPostageBatch(e,n),o=await this.getChainState(n),a=Fr(r,o.currentPrice,this.network==="gnosis"?5:15);return this.topUpBatch(i.batchID,a,n)}async getExtensionCost(e,r,n,i,o,a){const u=await this.getPostageBatch(e,i),l=await this.getChainState(i),h=this.network==="gnosis"?5:15,d=n.isZero()?0n:Fr(n,l.currentPrice,h),m=bi(r,o,a),y=Fr(u.duration,l.currentPrice,h),w=yi(u.depth,y);return yi(Math.max(u.depth,m),y+d).minus(w)}async getSizeExtensionCost(e,r,n,i,o){const a=await this.getPostageBatch(e,n),u=await this.getChainState(n),l=bi(r,i,o);if(l-a.depth<=0)throw new Tr("New depth has to be greater than the original depth",l);const d=Fr(a.duration,u.currentPrice,this.network==="gnosis"?5:15),m=yi(a.depth,d);return yi(l,d).minus(m)}async getDurationExtensionCost(e,r,n){const i=await this.getPostageBatch(e,n),o=await this.getChainState(n),a=Fr(r,o.currentPrice,this.network==="gnosis"?5:15);return yi(i.depth,a)}async updatePostageBatchLabel(e,r,n){return e=new et(e),IT(this.getRequestOptionsForCall(n),e,r)}async renameStorage(e,r,n){return this.updatePostageBatchLabel(e,r,n)}async calculateTopUpForBzz(e,r,n){const i=await this.getChainState(n),o=this.network==="gnosis"?5:15,a=r.toPLURBigInt()/2n**BigInt(e),u=L9(a,i.currentPrice,o);return{amount:a,duration:u}}async topUpBatch(e,r,n){e=new et(e);const i=He(r,{min:1n,name:"amount"});return kT(this.getRequestOptionsForCall(n),e,i)}async diluteBatch(e,r,n){return e=new et(e),r=me().int().min(18).max(255).parse(r),NT(this.getRequestOptionsForCall(n),e,r)}async getPostageBatch(e,r,n,i){return e=new et(e),ST(this.getRequestOptionsForCall(r),e,n,i)}async getGlobalPostageBatch(e,r){return e=new et(e),BT(this.getRequestOptionsForCall(r),e)}async getPostageBatchBuckets(e,r){return e=new et(e),PT(this.getRequestOptionsForCall(r),e)}async getAllPostageBatch(e){return Um(this.getRequestOptionsForCall(e))}async getAllGlobalPostageBatch(e){return Lm(this.getRequestOptionsForCall(e))}async getPostageBatches(e){return Um(this.getRequestOptionsForCall(e))}async getGlobalPostageBatches(e){return Lm(this.getRequestOptionsForCall(e))}async getAllPendingTransactions(e){return hB(this.getRequestOptionsForCall(e))}async getPendingTransaction(e,r){return e=new Yr(e),dB(this.getRequestOptionsForCall(r),e)}async rebroadcastPendingTransaction(e,r){return e=new Yr(e),pB(this.getRequestOptionsForCall(r),e)}async cancelPendingTransaction(e,r,n){e=new Yr(e);let i;return r&&(i=He(r,{min:0n,name:"gasPrice"})),mB(this.getRequestOptionsForCall(n),e,i)}async getStake(e){return gT(this.getRequestOptionsForCall(e))}async getWithdrawableStake(e){return yT(this.getRequestOptionsForCall(e))}async withdrawSurplusStake(e){return bT(this.getRequestOptionsForCall(e))}async migrateStake(e){return xT(this.getRequestOptionsForCall(e))}async depositStake(e,r,n){const i=e instanceof De?e.toPLURString():He(e,{min:1n,name:"amount"});return r&&(r=Nm.parse(r)),wT(this.getRequestOptionsForCall(n),i,r)}async getRedistributionState(e){return AT(this.getRequestOptionsForCall(e))}async waitForUsablePostageStamp(e,r=24e4){for(let i=0;i<r;i+=3e3){try{if((await this.getPostageBatch(e)).usable)return}catch{}await G.System.sleepMillis(3e3)}throw new Or("Timeout on waiting for postage stamp to become usable")}getRequestOptionsForCall(e){return e&&(e=v9.parse(e)),e?G.Objects.deepMerge2(this.requestOptions,e):this.requestOptions}}new et("0000000000000000000000000000000000000000000000000000000000000000");const LN=new Zr("0000000000000000000000000000000000000000000000000000000000000000"),Ei=new Uint8Array(32);Mt.MEDIUM;Mt.STRONG;Mt.INSANE;Mt.PARANOID;const fx="6.17.0";function uS(t,e,r){const n=e.split("|").map(o=>o.trim());for(let o=0;o<n.length;o++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const i=new Error(`invalid value for type ${e}`);throw i.code="INVALID_ARGUMENT",i.argument=`value.${r}`,i.value=t,i}async function zt(t){const e=Object.keys(t);return(await Promise.all(e.map(n=>Promise.resolve(t[n])))).reduce((n,i,o)=>(n[e[o]]=i,n),{})}function Te(t,e,r){for(let n in e){let i=e[n];const o=r?r[n]:null;o&&uS(i,o,n),Object.defineProperty(t,n,{enumerable:!0,value:i,writable:!1})}}function Bi(t,e){if(t==null)return"null";if(e==null&&(e=new Set),typeof t=="object"){if(e.has(t))return"[Circular]";e.add(t)}if(Array.isArray(t))return"[ "+t.map(r=>Bi(r,e)).join(", ")+" ]";if(t instanceof Uint8Array){const r="0123456789abcdef";let n="0x";for(let i=0;i<t.length;i++)n+=r[t[i]>>4],n+=r[t[i]&15];return n}if(typeof t=="object"&&typeof t.toJSON=="function")return Bi(t.toJSON(),e);switch(typeof t){case"boolean":case"number":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const r=Object.keys(t);return r.sort(),"{ "+r.map(n=>`${Bi(n,e)}: ${Bi(t[n],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function It(t,e){return t&&t.code===e}function Uh(t){return It(t,"CALL_EXCEPTION")}function ht(t,e,r){let n=t;{const o=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${Bi(r)}`);for(const a in r){if(a==="shortMessage")continue;const u=r[a];o.push(a+"="+Bi(u))}}o.push(`code=${e}`),o.push(`version=${fx}`),o.length&&(t+=" ("+o.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return Te(i,{code:e}),r&&Object.assign(i,r),i.shortMessage==null&&Te(i,{shortMessage:n}),i}function re(t,e,r,n){if(!t)throw ht(e,r,n)}function F(t,e,r,n){re(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function hx(t,e,r){r==null&&(r=""),r&&(r=": "+r),re(t>=e,"missing argument"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),re(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const lS=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function dx(t){re(lS.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function ci(t,e,r){if(r==null&&(r=""),t!==e){let n=r,i="new";r&&(n+=".",i+=" "+r),re(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function px(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.length%2===0&&t.match(/^0x[0-9a-f]*$/i)){const n=new Uint8Array((t.length-2)/2);let i=2;for(let o=0;o<n.length;o++)n[o]=parseInt(t.substring(i,i+2),16),i+=2;return n}F(!1,"invalid BytesLike value",e||"value",t)}function de(t,e){return px(t,e,!1)}function Ft(t,e){return px(t,e,!0)}function tt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function Ka(t){return tt(t,!0)||t instanceof Uint8Array}const Xm="0123456789abcdef";function ae(t){const e=de(t);let r="0x";for(let n=0;n<e.length;n++){const i=e[n];r+=Xm[(i&240)>>4]+Xm[i&15]}return r}function je(t){return"0x"+t.map(e=>ae(e).substring(2)).join("")}function Ii(t){return tt(t,!0)?(t.length-2)/2:de(t).length}function ot(t,e,r){const n=de(t);return r!=null&&r>n.length&&re(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),ae(n.slice(e??0,r??n.length))}function mx(t,e,r){const n=de(t);re(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),r?i.set(n,e-n.length):i.set(n,0),ae(i)}function nn(t,e){return mx(t,e,!0)}function fS(t,e){return mx(t,e,!1)}const lo=BigInt(0),Pr=BigInt(1),Si=9007199254740991;function hS(t,e){const r=Ja(t,"value"),n=BigInt(Ie(e,"width"));if(re(r>>n===lo,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Pr){const i=(Pr<<n)-Pr;return-((~r&i)+Pr)}return r}function gx(t,e){let r=pe(t,"value");const n=BigInt(Ie(e,"width")),i=Pr<<n-Pr;if(r<lo){r=-r,re(r<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const o=(Pr<<n)-Pr;return(~r&o)+Pr}else re(r<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return r}function Is(t,e){const r=Ja(t,"value"),n=BigInt(Ie(e,"bits"));return r&(Pr<<n)-Pr}function pe(t,e){switch(typeof t){case"bigint":return t;case"number":return F(Number.isInteger(t),"underflow",e||"value",t),F(t>=-Si&&t<=Si,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){F(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}F(!1,"invalid BigNumberish value",e||"value",t)}function Ja(t,e){const r=pe(t,e);return re(r>=lo,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const eg="0123456789abcdef";function Wa(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=eg[r>>4],e+=eg[r&15];return BigInt(e)}return pe(t)}function Ie(t,e){switch(typeof t){case"bigint":return F(t>=-Si&&t<=Si,"overflow",e||"value",t),Number(t);case"number":return F(Number.isInteger(t),"underflow",e||"value",t),F(t>=-Si&&t<=Si,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Ie(BigInt(t),e)}catch(r){F(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}F(!1,"invalid numeric value",e||"value",t)}function dS(t){return Ie(Wa(t))}function sn(t,e){const r=Ja(t,"value");let n=r.toString(16);if(e==null)n.length%2&&(n="0"+n);else{const i=Ie(e,"width");if(i===0&&r===lo)return"0x";for(re(i*2>=n.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length<i*2;)n="0"+n}return"0x"+n}function mt(t,e){const r=Ja(t,"value");if(r===lo)return new Uint8Array(0);let n=r.toString(16);n.length%2&&(n="0"+n);const i=new Uint8Array(n.length/2);for(let o=0;o<i.length;o++){const a=o*2;i[o]=parseInt(n.substring(a,a+2),16)}return i}function Br(t){let e=ae(Ka(t)?t:mt(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const Ea="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let Vo=null;function pS(t){if(Vo==null){Vo={};for(let r=0;r<Ea.length;r++)Vo[Ea[r]]=BigInt(r)}const e=Vo[t];return F(e!=null,"invalid base58 value","letter",t),e}const mS=BigInt(0),$f=BigInt(58);function yx(t){const e=de(t);let r=Wa(e),n="";for(;r;)n=Ea[Number(r%$f)]+n,r/=$f;for(let i=0;i<e.length&&!e[i];i++)n=Ea[0]+n;return n}function gS(t){let e=mS;for(let r=0;r<t.length;r++)e*=$f,e+=pS(t[r]);return e}function yS(t){t=atob(t);const e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return de(e)}function bS(t){const e=de(t);let r="";for(let n=0;n<e.length;n++)r+=String.fromCharCode(e[n]);return btoa(r)}class bx{filter;emitter;#e;constructor(e,r,n){this.#e=r,Te(this,{emitter:e,filter:n})}async removeListener(){this.#e!=null&&await this.emitter.off(this.filter,this.#e)}}function xS(t,e,r,n,i){F(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function xx(t,e,r,n,i){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let o=0;for(let a=e+1;a<r.length&&r[a]>>6===2;a++)o++;return o}return t==="OVERRUN"?r.length-e-1:0}function wS(t,e,r,n,i){return t==="OVERLONG"?(F(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),xx(t,e,r))}const AS=Object.freeze({error:xS,ignore:xx,replace:wS});function ES(t,e){e==null&&(e=AS.error);const r=de(t,"bytes"),n=[];let i=0;for(;i<r.length;){const o=r[i++];if(o>>7===0){n.push(o);continue}let a=null,u=null;if((o&224)===192)a=1,u=127;else if((o&240)===224)a=2,u=2047;else if((o&248)===240)a=3,u=65535;else{(o&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,r,n):i+=e("BAD_PREFIX",i-1,r,n);continue}if(i-1+a>=r.length){i+=e("OVERRUN",i-1,r,n);continue}let l=o&(1<<8-a-1)-1;for(let h=0;h<a;h++){let d=r[i];if((d&192)!=128){i+=e("MISSING_CONTINUE",i,r,n),l=null;break}l=l<<6|d&63,i++}if(l!==null){if(l>1114111){i+=e("OUT_OF_RANGE",i-1-a,r,n,l);continue}if(l>=55296&&l<=57343){i+=e("UTF16_SURROGATE",i-1-a,r,n,l);continue}if(l<=u){i+=e("OVERLONG",i-1-a,r,n,l);continue}n.push(l)}}return n}function Wt(t,e){F(typeof t=="string","invalid string value","str",t),e!=null&&(dx(e),t=t.normalize(e));let r=[];for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);F(n<t.length&&(o&64512)===56320,"invalid surrogate pair","str",t);const a=65536+((i&1023)<<10)+(o&1023);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(a&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return new Uint8Array(r)}function vS(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function va(t,e){return vS(ES(t,e))}function wx(t){async function e(r,n){re(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const i=r.url.split(":")[0].toLowerCase();re(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),re(i==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let o=null;const a=new AbortController,u=setTimeout(()=>{o=ht("request timeout","TIMEOUT"),a.abort()},r.timeout);n&&n.addListener(()=>{o=ht("request cancelled","CANCELLED"),a.abort()});const l=Object.assign({},t,{method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:a.signal});let h;try{h=await fetch(r.url,l)}catch(w){throw clearTimeout(u),o||w}clearTimeout(u);const d={};h.headers.forEach((w,T)=>{d[T.toLowerCase()]=w});const m=await h.arrayBuffer(),y=m==null?null:new Uint8Array(m);return{statusCode:h.status,statusMessage:h.statusText,headers:d,body:y}}return e}const RS=12,TS=250;let tg=wx();const BS=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),SS=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let lf=!1;async function Ax(t,e){try{const r=t.match(BS);if(!r)throw new Error("invalid data");return new Tn(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?yS(r[3]):OS(r[3]))}catch{return new Tn(599,"BAD REQUEST (invalid data: URI)",{},null,new Vr(t))}}function Ex(t){async function e(r,n){try{const i=r.match(SS);if(!i)throw new Error("invalid link");return new Vr(`${t}${i[2]}`)}catch{return new Tn(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Vr(r))}}return e}const Go={data:Ax,ipfs:Ex("https://gateway.ipfs.io/ipfs/")},vx=new WeakMap;class PS{#e;#t;constructor(e){this.#e=[],this.#t=!1,vx.set(e,()=>{if(!this.#t){this.#t=!0;for(const r of this.#e)setTimeout(()=>{r()},0);this.#e=[]}})}addListener(e){re(!this.#t,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#e.push(e)}get cancelled(){return this.#t}checkSignal(){re(!this.cancelled,"cancelled","CANCELLED",{})}}function jo(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}class Vr{#e;#t;#r;#n;#i;#o;#s;#a;#d;#u;#m;#p;#h;#l;#f;get url(){return this.#o}set url(e){this.#o=String(e)}get body(){return this.#s==null?null:new Uint8Array(this.#s)}set body(e){if(e==null)this.#s=void 0,this.#a=void 0;else if(typeof e=="string")this.#s=Wt(e),this.#a="text/plain";else if(e instanceof Uint8Array)this.#s=e,this.#a="application/octet-stream";else if(typeof e=="object")this.#s=Wt(JSON.stringify(e)),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(e){e==null&&(e=""),this.#n=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#r);return this.#d&&(e.authorization=`Basic ${bS(Wt(this.#d))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&this.#a&&(e["content-type"]=this.#a),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){this.#r[String(e).toLowerCase()]=String(r)}clearHeaders(){this.#r={}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n<r.length){const i=r[n++];return{value:[i,e[i]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#d||null}setCredentials(e,r){F(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#d=`${e}:${r}`}get allowGzip(){return this.#t}set allowGzip(e){this.#t=!!e}get allowInsecureAuthentication(){return!!this.#e}set allowInsecureAuthentication(e){this.#e=!!e}get timeout(){return this.#i}set timeout(e){F(e>=0,"timeout must be non-zero","timeout",e),this.#i=e}get preflightFunc(){return this.#u||null}set preflightFunc(e){this.#u=e}get processFunc(){return this.#m||null}set processFunc(e){this.#m=e}get retryFunc(){return this.#p||null}set retryFunc(e){this.#p=e}get getUrlFunc(){return this.#f||tg}set getUrlFunc(e){this.#f=e}constructor(e){this.#o=String(e),this.#e=!1,this.#t=!0,this.#r={},this.#n="",this.#i=3e5,this.#l={slotInterval:TS,maxAttempts:RS},this.#f=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#s?ae(this.#s):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(this.#l.slotInterval=e.slotInterval),e.maxAttempts!=null&&(this.#l.maxAttempts=e.maxAttempts)}async#c(e,r,n,i,o){if(e>=this.#l.maxAttempts)return o.makeServerError("exceeded maximum retry limit");re(rg()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),n>0&&await IS(n);let a=this.clone();const u=(a.url.split(":")[0]||"").toLowerCase();if(u in Go){const d=await Go[u](a.url,jo(i.#h));if(d instanceof Tn){let m=d;if(this.processFunc){jo(i.#h);try{m=await this.processFunc(a,m)}catch(y){(y.throttle==null||typeof y.stall!="number")&&m.makeServerError("error in post-processing function",y).assertOk()}}return m}a=d}this.preflightFunc&&(a=await this.preflightFunc(a));const l=await this.getUrlFunc(a,jo(i.#h));let h=new Tn(l.statusCode,l.statusMessage,l.headers,l.body,i);if([301,302,307,308].indexOf(h.statusCode)>=0){try{const d=h.headers.location||"";return a.redirect(d).#c(e+1,r,0,i,h)}catch{}return h}else if(h.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,h,e))){const d=h.headers["retry-after"];let m=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof d=="string"&&d.match(/^[1-9][0-9]*$/)&&(m=parseInt(d)),a.clone().#c(e+1,r,m,i,h)}if(this.processFunc){jo(i.#h);try{h=await this.processFunc(a,h)}catch(d){(d.throttle==null||typeof d.stall!="number")&&h.makeServerError("error in post-processing function",d).assertOk();let m=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return d.stall>=0&&(m=d.stall),a.clone().#c(e+1,r,m,i,h)}}return h}send(){return re(this.#h==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#h=new PS(this),this.#c(0,rg()+this.timeout,0,this,new Tn(0,"",{},null,this))}cancel(){re(this.#h!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=vx.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();re((r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new Vr(e);return i.method=this.method,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 e=new Vr(this.url);return e.#n=this.#n,this.#s&&(e.#s=this.#s),e.#a=this.#a,e.#r=Object.assign({},this.#r),e.#d=this.#d,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#u=this.#u,e.#m=this.#m,e.#p=this.#p,e.#l=Object.assign({},this.#l),e.#f=this.#f,e}static lockConfig(){lf=!0}static getGateway(e){return Go[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(lf)throw new Error("gateways locked");Go[e]=r}static registerGetUrl(e){if(lf)throw new Error("gateways locked");tg=e}static createGetUrlFunc(e){return wx(e)}static createDataGateway(){return Ax}static createIpfsGatewayFunc(e){return Ex(e)}}class Tn{#e;#t;#r;#n;#i;#o;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#n?ae(this.#n):"null"}>`}get statusCode(){return this.#e}get statusMessage(){return this.#t}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?"":va(this.#n)}catch{re(!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{re(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n<r.length){const i=r[n++];return{value:[i,e[i]],done:!1}}return{value:void 0,done:!0}}}}constructor(e,r,n,i,o){this.#e=e,this.#t=r,this.#r=Object.keys(n).reduce((a,u)=>(a[u.toLowerCase()]=String(n[u]),a),{}),this.#n=i==null?null:new Uint8Array(i),this.#i=o||null,this.#o={message:""}}makeServerError(e,r){let n;e?n=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,n=`CLIENT ESCALATED SERVER ERROR (${e})`);const i=new Tn(599,n,this.headers,this.body,this.#i||void 0);return i.#o={message:e,error:r},i}throwThrottleError(e,r){r==null?r=-1:F(Number.isInteger(r)&&r>=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw Te(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.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:e,error:r}=this.#o;e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let i=null;try{this.#n&&(i=va(this.#n))}catch{}re(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function rg(){return new Date().getTime()}function OS(t){return Wt(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function IS(t){return new Promise(e=>setTimeout(e,t))}function kS(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function ng(t,e,r){let n=0;for(let i=0;i<r;i++)n=n*256+t[e+i];return n}function ig(t,e,r,n){const i=[];for(;r<e+1+n;){const o=Rx(t,r);i.push(o.result),r+=o.consumed,re(r<=e+1+n,"child data too short","BUFFER_OVERRUN",{buffer:t,length:n,offset:e})}return{consumed:1+n,result:i}}function Rx(t,e){re(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const r=n=>{re(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const i=ng(t,e+1,n);return r(e+1+n+i),ig(t,e,e+1+n,n+i)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),ig(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const i=ng(t,e+1,n);r(e+1+n+i);const o=ae(t.slice(e+1+n,e+1+n+i));return{consumed:1+n+i,result:o}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const i=ae(t.slice(e+1,e+1+n));return{consumed:1+n,result:i}}return{consumed:1,result:kS(t[e])}}function fo(t){const e=de(t,"data"),r=Rx(e,0);return F(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function sg(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function Tx(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(o){n=n.concat(Tx(o))}),n.length<=55)return n.unshift(192+n.length),n;const i=sg(n.length);return i.unshift(247+i.length),i.concat(n)}const e=Array.prototype.slice.call(de(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=sg(e.length);return r.unshift(183+r.length),r.concat(e)}const og="0123456789abcdef";function $r(t){let e="0x";for(const r of Tx(t))e+=og[r>>4],e+=og[r&15];return e}function NS(t){const e=de(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=ae(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const Kt=32,Vf=new Uint8Array(Kt),CS=["then"],Ho={},Bx=new WeakMap;function Gn(t){return Bx.get(t)}function ag(t,e){Bx.set(t,e)}function Bs(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}function Gf(t,e,r){return t.indexOf(null)>=0?e.map((n,i)=>n instanceof Wr?Gf(Gn(n),n,r):n):t.reduce((n,i,o)=>{let a=e.getValue(i);return i in n||(r&&a instanceof Wr&&(a=Gf(Gn(a),a,r)),n[i]=a),n},{})}class Wr extends Array{#e;constructor(...e){const r=e[0];let n=e[1],i=(e[2]||[]).slice(),o=!0;r!==Ho&&(n=e,i=[],o=!1),super(n.length),n.forEach((l,h)=>{this[h]=l});const a=i.reduce((l,h)=>(typeof h=="string"&&l.set(h,(l.get(h)||0)+1),l),new Map);if(ag(this,Object.freeze(n.map((l,h)=>{const d=i[h];return d!=null&&a.get(d)===1?d:null}))),this.#e=[],this.#e==null&&this.#e,!o)return;Object.freeze(this);const u=new Proxy(this,{get:(l,h,d)=>{if(typeof h=="string"){if(h.match(/^[0-9]+$/)){const y=Ie(h,"%index");if(y<0||y>=this.length)throw new RangeError("out of result range");const w=l[y];return w instanceof Error&&Bs(`index ${y}`,w),w}if(CS.indexOf(h)>=0)return Reflect.get(l,h,d);const m=l[h];if(m instanceof Function)return function(...y){return m.apply(this===d?l:this,y)};if(!(h in l))return l.getValue.apply(this===d?l:this,[h])}return Reflect.get(l,h,d)}});return ag(u,Gn(this)),u}toArray(e){const r=[];return this.forEach((n,i)=>{n instanceof Error&&Bs(`index ${i}`,n),e&&n instanceof Wr&&(n=n.toArray(e)),r.push(n)}),r}toObject(e){const r=Gn(this);return r.reduce((n,i,o)=>(re(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Gf(r,this,e)),{})}slice(e,r){e==null&&(e=0),e<0&&(e+=this.length,e<0&&(e=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const n=Gn(this),i=[],o=[];for(let a=e;a<r;a++)i.push(this[a]),o.push(n[a]);return new Wr(Ho,i,o)}filter(e,r){const n=Gn(this),i=[],o=[];for(let a=0;a<this.length;a++){const u=this[a];u instanceof Error&&Bs(`index ${a}`,u),e.call(r,u,a,this)&&(i.push(u),o.push(n[a]))}return new Wr(Ho,i,o)}map(e,r){const n=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&Bs(`index ${i}`,o),n.push(e.call(r,o,i,this))}return n}getValue(e){const r=Gn(this).indexOf(e);if(r===-1)return;const n=this[r];return n instanceof Error&&Bs(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(e,r){return new Wr(Ho,e,r)}}function cg(t){let e=mt(t);return re(e.length<=Kt,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Kt,offset:e.length}),e.length!==Kt&&(e=Ft(je([Vf.slice(e.length%Kt),e]))),e}class cn{name;type;localName;dynamic;constructor(e,r,n,i){Te(this,{name:e,type:r,localName:n,dynamic:i},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,r){F(!1,e,this.localName,r)}}class jf{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return je(this.#e)}get length(){return this.#t}#r(e){return this.#e.push(e),this.#t+=e.length,e.length}appendWriter(e){return this.#r(Ft(e.data))}writeBytes(e){let r=Ft(e);const n=r.length%Kt;return n&&(r=Ft(je([r,Vf.slice(n)]))),this.#r(r)}writeValue(e){return this.#r(cg(e))}writeUpdatableValue(){const e=this.#e.length;return this.#e.push(Vf),this.#t+=Kt,r=>{this.#e[e]=cg(r)}}}class Mh{allowLoose;#e;#t;#r;#n;#i;constructor(e,r,n){Te(this,{allowLoose:!!r}),this.#e=Ft(e),this.#r=0,this.#n=null,this.#i=n??1024,this.#t=0}get data(){return ae(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#t}get bytes(){return new Uint8Array(this.#e)}#o(e){if(this.#n)return this.#n.#o(e);this.#r+=e,re(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:Ft(this.#e),offset:this.#t,length:e,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#s(e,r,n){let i=Math.ceil(r/Kt)*Kt;return this.#t+i>this.#e.length&&(this.allowLoose&&n&&this.#t+r<=this.#e.length?i=r:re(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Ft(this.#e),length:this.#e.length,offset:this.#t+i})),this.#e.slice(this.#t,this.#t+i)}subReader(e){const r=new Mh(this.#e.slice(this.#t+e),this.allowLoose,this.#i);return r.#n=this,r}readBytes(e,r){let n=this.#s(0,e,!!r);return this.#o(e),this.#t+=n.length,n.slice(0,e)}readValue(){return Wa(this.readBytes(Kt))}readIndex(){return dS(this.readBytes(Kt))}}function or(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function zh(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Sx(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");or(t.outputLen),or(t.blockLen)}function Mi(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Px(t,e){zh(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const ff=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const Ox=t=>t instanceof Uint8Array,oa=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),aa=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Dr=(t,e)=>t<<32-e|t>>>e,_S=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_S)throw new Error("Non little-endian hardware is not supported");const FS=async()=>{};async function ug(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);const o=Date.now()-n;o>=0&&o<e||(await FS(),n+=o)}}function DS(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function zi(t){if(typeof t=="string"&&(t=DS(t)),!Ox(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function LS(...t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;return t.forEach(n=>{if(!Ox(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}class $h{clone(){return this._cloneInto()}}const US={}.toString;function Ix(t,e){if(e!==void 0&&US.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function Qa(t){const e=n=>t().update(zi(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function MS(t=32){if(ff&&typeof ff.getRandomValues=="function")return ff.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class kx extends $h{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Sx(e);const n=zi(r);if(this.iHash=e.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(n.length>i?e.create().update(n).digest():n);for(let a=0;a<o.length;a++)o[a]^=54;this.iHash.update(o),this.oHash=e.create();for(let a=0;a<o.length;a++)o[a]^=106;this.oHash.update(o),o.fill(0)}update(e){return Mi(this),this.iHash.update(e),this}digestInto(e){Mi(this),zh(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:a,outputLen:u}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=a,e.outputLen=u,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ya=(t,e,r)=>new kx(t,e).update(r).digest();Ya.create=(t,e)=>new kx(t,e);function zS(t,e,r,n){Sx(t);const i=Ix({dkLen:32,asyncTick:10},n),{c:o,dkLen:a,asyncTick:u}=i;if(or(o),or(a),or(u),o<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=zi(e),h=zi(r),d=new Uint8Array(a),m=Ya.create(t,l),y=m._cloneInto().update(h);return{c:o,dkLen:a,asyncTick:u,DK:d,PRF:m,PRFSalt:y}}function $S(t,e,r,n,i){return t.destroy(),e.destroy(),n&&n.destroy(),i.fill(0),r}function Vh(t,e,r,n){const{c:i,dkLen:o,DK:a,PRF:u,PRFSalt:l}=zS(t,e,r,n);let h;const d=new Uint8Array(4),m=aa(d),y=new Uint8Array(u.outputLen);for(let w=1,T=0;T<o;w++,T+=u.outputLen){const R=a.subarray(T,T+u.outputLen);m.setInt32(0,w,!1),(h=l._cloneInto(h)).update(d).digestInto(y),R.set(y.subarray(0,R.length));for(let O=1;O<i;O++){u._cloneInto(h).update(y).digestInto(y);for(let A=0;A<R.length;A++)R[A]^=y[A]}}return $S(u,l,a,h,y)}function VS(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),u=Number(r&o),l=n?4:0,h=n?0:4;t.setUint32(e+l,a,n),t.setUint32(e+h,u,n)}class Gh extends $h{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=aa(this.buffer)}update(e){Mi(this);const{view:r,buffer:n,blockLen:i}=this;e=zi(e);const o=e.length;for(let a=0;a<o;){const u=Math.min(i-this.pos,o-a);if(u===i){const l=aa(e);for(;i<=o-a;a+=i)this.process(l,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Mi(this),Px(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:i,isLE:o}=this;let{pos:a}=this;r[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(n,0),a=0);for(let m=a;m<i;m++)r[m]=0;VS(n,i-8,BigInt(this.length*8),o),this.process(n,0);const u=aa(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)u.setUint32(4*m,d[m],o)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:i,finished:o,destroyed:a,pos:u}=this;return e.length=i,e.pos=u,e.finished=o,e.destroyed=a,i%r&&e.buffer.set(n),e}}const GS=(t,e,r)=>t&e^~t&r,jS=(t,e,r)=>t&e^t&r^e&r,HS=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]),mn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gn=new Uint32Array(64);class qS extends Gh{constructor(){super(64,32,8,!1),this.A=mn[0]|0,this.B=mn[1]|0,this.C=mn[2]|0,this.D=mn[3]|0,this.E=mn[4]|0,this.F=mn[5]|0,this.G=mn[6]|0,this.H=mn[7]|0}get(){const{A:e,B:r,C:n,D:i,E:o,F:a,G:u,H:l}=this;return[e,r,n,i,o,a,u,l]}set(e,r,n,i,o,a,u,l){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=a|0,this.G=u|0,this.H=l|0}process(e,r){for(let m=0;m<16;m++,r+=4)gn[m]=e.getUint32(r,!1);for(let m=16;m<64;m++){const y=gn[m-15],w=gn[m-2],T=Dr(y,7)^Dr(y,18)^y>>>3,R=Dr(w,17)^Dr(w,19)^w>>>10;gn[m]=R+gn[m-7]+T+gn[m-16]|0}let{A:n,B:i,C:o,D:a,E:u,F:l,G:h,H:d}=this;for(let m=0;m<64;m++){const y=Dr(u,6)^Dr(u,11)^Dr(u,25),w=d+y+GS(u,l,h)+HS[m]+gn[m]|0,R=(Dr(n,2)^Dr(n,13)^Dr(n,22))+jS(n,i,o)|0;d=h,h=l,l=u,u=a+w|0,a=o,o=i,i=n,n=w+R|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,a=a+this.D|0,u=u+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(n,i,o,a,u,l,h,d)}roundClean(){gn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Yi=Qa(()=>new qS),qo=BigInt(2**32-1),Hf=BigInt(32);function Nx(t,e=!1){return e?{h:Number(t&qo),l:Number(t>>Hf&qo)}:{h:Number(t>>Hf&qo)|0,l:Number(t&qo)|0}}function Cx(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:a}=Nx(t[i],e);[r[i],n[i]]=[o,a]}return[r,n]}const ZS=(t,e)=>BigInt(t>>>0)<<Hf|BigInt(e>>>0),KS=(t,e,r)=>t>>>r,JS=(t,e,r)=>t<<32-r|e>>>r,WS=(t,e,r)=>t>>>r|e<<32-r,QS=(t,e,r)=>t<<32-r|e>>>r,YS=(t,e,r)=>t<<64-r|e>>>r-32,XS=(t,e,r)=>t>>>r-32|e<<64-r,eP=(t,e)=>e,tP=(t,e)=>t,_x=(t,e,r)=>t<<r|e>>>32-r,Fx=(t,e,r)=>e<<r|t>>>32-r,Dx=(t,e,r)=>e<<r-32|t>>>64-r,Lx=(t,e,r)=>t<<r-32|e>>>64-r;function rP(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const nP=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),iP=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,sP=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),oP=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,aP=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),cP=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,ke={fromBig:Nx,split:Cx,toBig:ZS,shrSH:KS,shrSL:JS,rotrSH:WS,rotrSL:QS,rotrBH:YS,rotrBL:XS,rotr32H:eP,rotr32L:tP,rotlSH:_x,rotlSL:Fx,rotlBH:Dx,rotlBL:Lx,add:rP,add3L:nP,add3H:iP,add4L:sP,add4H:oP,add5H:cP,add5L:aP},[uP,lP]=ke.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(t=>BigInt(t))),yn=new Uint32Array(80),bn=new Uint32Array(80);class fP extends Gh{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:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:a,Dh:u,Dl:l,Eh:h,El:d,Fh:m,Fl:y,Gh:w,Gl:T,Hh:R,Hl:O}=this;return[e,r,n,i,o,a,u,l,h,d,m,y,w,T,R,O]}set(e,r,n,i,o,a,u,l,h,d,m,y,w,T,R,O){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=a|0,this.Dh=u|0,this.Dl=l|0,this.Eh=h|0,this.El=d|0,this.Fh=m|0,this.Fl=y|0,this.Gh=w|0,this.Gl=T|0,this.Hh=R|0,this.Hl=O|0}process(e,r){for(let B=0;B<16;B++,r+=4)yn[B]=e.getUint32(r),bn[B]=e.getUint32(r+=4);for(let B=16;B<80;B++){const S=yn[B-15]|0,N=bn[B-15]|0,_=ke.rotrSH(S,N,1)^ke.rotrSH(S,N,8)^ke.shrSH(S,N,7),D=ke.rotrSL(S,N,1)^ke.rotrSL(S,N,8)^ke.shrSL(S,N,7),L=yn[B-2]|0,H=bn[B-2]|0,K=ke.rotrSH(L,H,19)^ke.rotrBH(L,H,61)^ke.shrSH(L,H,6),le=ke.rotrSL(L,H,19)^ke.rotrBL(L,H,61)^ke.shrSL(L,H,6),U=ke.add4L(D,le,bn[B-7],bn[B-16]),ge=ke.add4H(U,_,K,yn[B-7],yn[B-16]);yn[B]=ge|0,bn[B]=U|0}let{Ah:n,Al:i,Bh:o,Bl:a,Ch:u,Cl:l,Dh:h,Dl:d,Eh:m,El:y,Fh:w,Fl:T,Gh:R,Gl:O,Hh:A,Hl:I}=this;for(let B=0;B<80;B++){const S=ke.rotrSH(m,y,14)^ke.rotrSH(m,y,18)^ke.rotrBH(m,y,41),N=ke.rotrSL(m,y,14)^ke.rotrSL(m,y,18)^ke.rotrBL(m,y,41),_=m&w^~m&R,D=y&T^~y&O,L=ke.add5L(I,N,D,lP[B],bn[B]),H=ke.add5H(L,A,S,_,uP[B],yn[B]),K=L|0,le=ke.rotrSH(n,i,28)^ke.rotrBH(n,i,34)^ke.rotrBH(n,i,39),U=ke.rotrSL(n,i,28)^ke.rotrBL(n,i,34)^ke.rotrBL(n,i,39),ge=n&o^n&u^o&u,Be=i&a^i&l^a&l;A=R|0,I=O|0,R=w|0,O=T|0,w=m|0,T=y|0,{h:m,l:y}=ke.add(h|0,d|0,H|0,K|0),h=u|0,d=l|0,u=o|0,l=a|0,o=n|0,a=i|0;const ne=ke.add3L(K,U,Be);n=ke.add3H(ne,H,le,ge),i=ne|0}({h:n,l:i}=ke.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:a}=ke.add(this.Bh|0,this.Bl|0,o|0,a|0),{h:u,l}=ke.add(this.Ch|0,this.Cl|0,u|0,l|0),{h,l:d}=ke.add(this.Dh|0,this.Dl|0,h|0,d|0),{h:m,l:y}=ke.add(this.Eh|0,this.El|0,m|0,y|0),{h:w,l:T}=ke.add(this.Fh|0,this.Fl|0,w|0,T|0),{h:R,l:O}=ke.add(this.Gh|0,this.Gl|0,R|0,O|0),{h:A,l:I}=ke.add(this.Hh|0,this.Hl|0,A|0,I|0),this.set(n,i,o,a,u,l,h,d,m,y,w,T,R,O,A,I)}roundClean(){yn.fill(0),bn.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 jh=Qa(()=>new fP);function hP(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof Td<"u")return Td;throw new Error("unable to locate global object")}const lg=hP(),fg=lg.crypto||lg.msCrypto;function dP(t){switch(t){case"sha256":return Yi.create();case"sha512":return jh.create()}F(!1,"invalid hashing algorithm name","algorithm",t)}function pP(t,e){const r={sha256:Yi,sha512:jh}[t];return F(r!=null,"invalid hmac algorithm","algorithm",t),Ya.create(r,e)}function mP(t,e,r,n,i){const o={sha256:Yi,sha512:jh}[i];return F(o!=null,"invalid pbkdf2 algorithm","algorithm",i),Vh(o,t,e,{c:r,dkLen:n})}function gP(t){re(fg!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),F(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return fg.getRandomValues(e),e}let Ux=!1;const Mx=function(t,e,r){return pP(t,e).update(r).digest()};let zx=Mx;function Xi(t,e,r){const n=de(e,"key"),i=de(r,"data");return ae(zx(t,n,i))}Xi._=Mx;Xi.lock=function(){Ux=!0};Xi.register=function(t){if(Ux)throw new Error("computeHmac is locked");zx=t};Object.freeze(Xi);const[$x,Vx,Gx]=[[],[],[]],yP=BigInt(0),Ss=BigInt(1),bP=BigInt(2),xP=BigInt(7),wP=BigInt(256),AP=BigInt(113);for(let t=0,e=Ss,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],$x.push(2*(5*n+r)),Vx.push((t+1)*(t+2)/2%64);let i=yP;for(let o=0;o<7;o++)e=(e<<Ss^(e>>xP)*AP)%wP,e&bP&&(i^=Ss<<(Ss<<BigInt(o))-Ss);Gx.push(i)}const[EP,vP]=Cx(Gx,!0),hg=(t,e,r)=>r>32?Dx(t,e,r):_x(t,e,r),dg=(t,e,r)=>r>32?Lx(t,e,r):Fx(t,e,r);function RP(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)r[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){const u=(a+8)%10,l=(a+2)%10,h=r[l],d=r[l+1],m=hg(h,d,1)^r[u],y=dg(h,d,1)^r[u+1];for(let w=0;w<50;w+=10)t[a+w]^=m,t[a+w+1]^=y}let i=t[2],o=t[3];for(let a=0;a<24;a++){const u=Vx[a],l=hg(i,o,u),h=dg(i,o,u),d=$x[a];i=t[d],o=t[d+1],t[d]=l,t[d+1]=h}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)r[u]=t[a+u];for(let u=0;u<10;u++)t[a+u]^=~r[(u+2)%10]&r[(u+4)%10]}t[0]^=EP[n],t[1]^=vP[n]}r.fill(0)}class Hh extends $h{constructor(e,r,n,i=!1,o=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,or(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=oa(this.state)}keccak(){RP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Mi(this);const{blockLen:r,state:n}=this;e=zi(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);for(let u=0;u<a;u++)n[this.pos++]^=e[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Mi(this,!1),zh(e),this.finish();const r=this.state,{blockLen:n}=this;for(let i=0,o=e.length;i<o;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,o-i);e.set(r.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return or(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Px(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return e||(e=new Hh(r,n,i,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}const TP=(t,e,r)=>Qa(()=>new Hh(e,t,r)),BP=TP(1,136,256/8);let jx=!1;const Hx=function(t){return BP(t)};let qx=Hx;function lt(t){const e=de(t,"data");return ae(qx(e))}lt._=Hx;lt.lock=function(){jx=!0};lt.register=function(t){if(jx)throw new TypeError("keccak256 is locked");qx=t};Object.freeze(lt);const SP=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Zx=Uint8Array.from({length:16},(t,e)=>e),PP=Zx.map(t=>(9*t+5)%16);let qh=[Zx],Zh=[PP];for(let t=0;t<4;t++)for(let e of[qh,Zh])e.push(e[t].map(r=>SP[r]));const Kx=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),OP=qh.map((t,e)=>t.map(r=>Kx[e][r])),IP=Zh.map((t,e)=>t.map(r=>Kx[e][r])),kP=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),NP=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Zo=(t,e)=>t<<e|t>>>32-e;function pg(t,e,r,n){return t===0?e^r^n:t===1?e&r|~e&n:t===2?(e|~r)^n:t===3?e&n|r&~n:e^(r|~n)}const Ko=new Uint32Array(16);class CP extends Gh{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:r,h2:n,h3:i,h4:o}=this;return[e,r,n,i,o]}set(e,r,n,i,o){this.h0=e|0,this.h1=r|0,this.h2=n|0,this.h3=i|0,this.h4=o|0}process(e,r){for(let w=0;w<16;w++,r+=4)Ko[w]=e.getUint32(r,!0);let n=this.h0|0,i=n,o=this.h1|0,a=o,u=this.h2|0,l=u,h=this.h3|0,d=h,m=this.h4|0,y=m;for(let w=0;w<5;w++){const T=4-w,R=kP[w],O=NP[w],A=qh[w],I=Zh[w],B=OP[w],S=IP[w];for(let N=0;N<16;N++){const _=Zo(n+pg(w,o,u,h)+Ko[A[N]]+R,B[N])+m|0;n=m,m=h,h=Zo(u,10)|0,u=o,o=_}for(let N=0;N<16;N++){const _=Zo(i+pg(T,a,l,d)+Ko[I[N]]+O,S[N])+y|0;i=y,y=d,d=Zo(l,10)|0,l=a,a=_}}this.set(this.h1+u+d|0,this.h2+h+y|0,this.h3+m+i|0,this.h4+n+a|0,this.h0+o+l|0)}roundClean(){Ko.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const _P=Qa(()=>new CP);let Jx=!1;const Wx=function(t){return _P(t)};let Qx=Wx;function es(t){const e=de(t,"data");return ae(Qx(e))}es._=Wx;es.lock=function(){Jx=!0};es.register=function(t){if(Jx)throw new TypeError("ripemd160 is locked");Qx=t};Object.freeze(es);let Yx=!1;const Xx=function(t,e,r,n,i){return mP(t,e,r,n,i)};let e1=Xx;function kn(t,e,r,n,i){const o=de(t,"password"),a=de(e,"salt");return ae(e1(o,a,r,n,i))}kn._=Xx;kn.lock=function(){Yx=!0};kn.register=function(t){if(Yx)throw new Error("pbkdf2 is locked");e1=t};Object.freeze(kn);let t1=!1;const r1=function(t){return new Uint8Array(gP(t))};let n1=r1;function Xr(t){return n1(t)}Xr._=r1;Xr.lock=function(){t1=!0};Xr.register=function(t){if(t1)throw new Error("randomBytes is locked");n1=t};Object.freeze(Xr);const Ve=(t,e)=>t<<e|t>>>32-e;function mg(t,e,r,n,i,o){let a=t[e++]^r[n++],u=t[e++]^r[n++],l=t[e++]^r[n++],h=t[e++]^r[n++],d=t[e++]^r[n++],m=t[e++]^r[n++],y=t[e++]^r[n++],w=t[e++]^r[n++],T=t[e++]^r[n++],R=t[e++]^r[n++],O=t[e++]^r[n++],A=t[e++]^r[n++],I=t[e++]^r[n++],B=t[e++]^r[n++],S=t[e++]^r[n++],N=t[e++]^r[n++],_=a,D=u,L=l,H=h,K=d,le=m,U=y,ge=w,Be=T,ne=R,ue=O,ye=A,Ae=I,Ee=B,Se=S,Ue=N;for(let _e=0;_e<8;_e+=2)K^=Ve(_+Ae|0,7),Be^=Ve(K+_|0,9),Ae^=Ve(Be+K|0,13),_^=Ve(Ae+Be|0,18),ne^=Ve(le+D|0,7),Ee^=Ve(ne+le|0,9),D^=Ve(Ee+ne|0,13),le^=Ve(D+Ee|0,18),Se^=Ve(ue+U|0,7),L^=Ve(Se+ue|0,9),U^=Ve(L+Se|0,13),ue^=Ve(U+L|0,18),H^=Ve(Ue+ye|0,7),ge^=Ve(H+Ue|0,9),ye^=Ve(ge+H|0,13),Ue^=Ve(ye+ge|0,18),D^=Ve(_+H|0,7),L^=Ve(D+_|0,9),H^=Ve(L+D|0,13),_^=Ve(H+L|0,18),U^=Ve(le+K|0,7),ge^=Ve(U+le|0,9),K^=Ve(ge+U|0,13),le^=Ve(K+ge|0,18),ye^=Ve(ue+ne|0,7),Be^=Ve(ye+ue|0,9),ne^=Ve(Be+ye|0,13),ue^=Ve(ne+Be|0,18),Ae^=Ve(Ue+Se|0,7),Ee^=Ve(Ae+Ue|0,9),Se^=Ve(Ee+Ae|0,13),Ue^=Ve(Se+Ee|0,18);i[o++]=a+_|0,i[o++]=u+D|0,i[o++]=l+L|0,i[o++]=h+H|0,i[o++]=d+K|0,i[o++]=m+le|0,i[o++]=y+U|0,i[o++]=w+ge|0,i[o++]=T+Be|0,i[o++]=R+ne|0,i[o++]=O+ue|0,i[o++]=A+ye|0,i[o++]=I+Ae|0,i[o++]=B+Ee|0,i[o++]=S+Se|0,i[o++]=N+Ue|0}function ki(t,e,r,n,i){let o=n+0,a=n+16*i;for(let u=0;u<16;u++)r[a+u]=t[e+(2*i-1)*16+u];for(let u=0;u<i;u++,o+=16,e+=16)mg(r,a,t,e,r,o),u>0&&(a+=16),mg(r,o,t,e+=16,r,a)}function i1(t,e,r){const n=Ix({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:i,r:o,p:a,dkLen:u,asyncTick:l,maxmem:h,onProgress:d}=n;if(or(i),or(o),or(a),or(u),or(l),or(h),d!==void 0&&typeof d!="function")throw new Error("progressCb should be function");const m=128*o,y=m/4;if(i<=1||(i&i-1)!==0||i>=2**(m/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>(2**32-1)*32/m)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(u<0||u>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const w=m*(i+a);if(w>h)throw new Error(`Scrypt: parameters too large, ${w} (128 * r * (N + p)) > ${h} (maxmem)`);const T=Vh(Yi,t,e,{c:1,dkLen:m*a}),R=oa(T),O=oa(new Uint8Array(m*i)),A=oa(new Uint8Array(m));let I=()=>{};if(d){const B=2*i*a,S=Math.max(Math.floor(B/1e4),1);let N=0;I=()=>{N++,d&&(!(N%S)||N===B)&&d(N/B)}}return{N:i,r:o,p:a,dkLen:u,blockSize32:y,V:O,B32:R,B:T,tmp:A,blockMixCb:I,asyncTick:l}}function s1(t,e,r,n,i){const o=Vh(Yi,t,r,{c:1,dkLen:e});return r.fill(0),n.fill(0),i.fill(0),o}function FP(t,e,r){const{N:n,r:i,p:o,dkLen:a,blockSize32:u,V:l,B32:h,B:d,tmp:m,blockMixCb:y}=i1(t,e,r);for(let w=0;w<o;w++){const T=u*w;for(let R=0;R<u;R++)l[R]=h[T+R];for(let R=0,O=0;R<n-1;R++)ki(l,O,l,O+=u,i),y();ki(l,(n-1)*u,h,T,i),y();for(let R=0;R<n;R++){const O=h[T+u-16]%n;for(let A=0;A<u;A++)m[A]=h[T+A]^l[O*u+A];ki(m,0,h,T,i),y()}}return s1(t,a,d,l,m)}async function DP(t,e,r){const{N:n,r:i,p:o,dkLen:a,blockSize32:u,V:l,B32:h,B:d,tmp:m,blockMixCb:y,asyncTick:w}=i1(t,e,r);for(let T=0;T<o;T++){const R=u*T;for(let A=0;A<u;A++)l[A]=h[R+A];let O=0;await ug(n-1,w,()=>{ki(l,O,l,O+=u,i),y()}),ki(l,(n-1)*u,h,R,i),y(),await ug(n,w,()=>{const A=h[R+u-16]%n;for(let I=0;I<u;I++)m[I]=h[R+I]^l[A*u+I];ki(m,0,h,R,i),y()})}return s1(t,a,d,l,m)}let o1=!1,a1=!1;const c1=async function(t,e,r,n,i,o,a){return await DP(t,e,{N:r,r:n,p:i,dkLen:o,onProgress:a})},u1=function(t,e,r,n,i,o){return FP(t,e,{N:r,r:n,p:i,dkLen:o})};let l1=c1,f1=u1;async function ts(t,e,r,n,i,o,a){const u=de(t,"passwd"),l=de(e,"salt");return ae(await l1(u,l,r,n,i,o,a))}ts._=c1;ts.lock=function(){a1=!0};ts.register=function(t){if(a1)throw new Error("scrypt is locked");l1=t};Object.freeze(ts);function rs(t,e,r,n,i,o){const a=de(t,"passwd"),u=de(e,"salt");return ae(f1(a,u,r,n,i,o))}rs._=u1;rs.lock=function(){o1=!0};rs.register=function(t){if(o1)throw new Error("scryptSync is locked");f1=t};Object.freeze(rs);const h1=function(t){return dP("sha256").update(t).digest()};let d1=h1,p1=!1;function xr(t){const e=de(t,"data");return ae(d1(e))}xr._=h1;xr.lock=function(){p1=!0};xr.register=function(t){if(p1)throw new Error("sha256 is locked");d1=t};Object.freeze(xr);Object.freeze(xr);BigInt(0);const LP=BigInt(1),UP=BigInt(2),Xa=t=>t instanceof Uint8Array,MP=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function $i(t){if(!Xa(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=MP[t[r]];return e}function Kh(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Zs(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(e/2);for(let n=0;n<r.length;n++){const i=n*2,o=t.slice(i,i+2),a=Number.parseInt(o,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");r[n]=a}return r}function Qn(t){return Kh($i(t))}function Jh(t){if(!Xa(t))throw new Error("Uint8Array expected");return Kh($i(Uint8Array.from(t).reverse()))}function Vi(t,e){return Zs(t.toString(16).padStart(e*2,"0"))}function Wh(t,e){return Vi(t,e).reverse()}function Rr(t,e,r){let n;if(typeof e=="string")try{n=Zs(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(Xa(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function Ks(...t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;return t.forEach(n=>{if(!Xa(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}const Qh=t=>(UP<<BigInt(t-1))-LP,hf=t=>new Uint8Array(t),gg=t=>Uint8Array.from(t);function m1(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=hf(t),i=hf(t),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},u=(...m)=>r(i,n,...m),l=(m=hf())=>{i=u(gg([0]),m),n=u(),m.length!==0&&(i=u(gg([1]),m),n=u())},h=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let m=0;const y=[];for(;m<e;){n=u();const w=n.slice();y.push(w),m+=n.length}return Ks(...y)};return(m,y)=>{a(),l(m);let w;for(;!(w=y(h()));)l();return a(),w}}const zP={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function ho(t,e,r={}){const n=(i,o,a)=>{const u=zP[o];if(typeof u!="function")throw new Error(`Invalid validator "${o}", expected function`);const l=t[i];if(!(a&&l===void 0)&&!u(l,t))throw new Error(`Invalid param ${String(i)}=${l} (${typeof l}), expected ${o}`)};for(const[i,o]of Object.entries(e))n(i,o,!1);for(const[i,o]of Object.entries(r))n(i,o,!0);return t}const $P=Object.freeze(Object.defineProperty({__proto__:null,bitMask:Qh,bytesToHex:$i,bytesToNumberBE:Qn,bytesToNumberLE:Jh,concatBytes:Ks,createHmacDrbg:m1,ensureBytes:Rr,hexToBytes:Zs,hexToNumber:Kh,numberToBytesBE:Vi,numberToBytesLE:Wh,validateObject:ho},Symbol.toStringTag,{value:"Module"}));const Nt=BigInt(0),vt=BigInt(1),jn=BigInt(2),VP=BigInt(3),qf=BigInt(4),yg=BigInt(5),bg=BigInt(8);BigInt(9);BigInt(16);function Qt(t,e){const r=t%e;return r>=Nt?r:e+r}function GP(t,e,r){if(r<=Nt||e<Nt)throw new Error("Expected power/modulo > 0");if(r===vt)return Nt;let n=vt;for(;e>Nt;)e&vt&&(n=n*t%r),t=t*t%r,e>>=vt;return n}function lr(t,e,r){let n=t;for(;e-- >Nt;)n*=n,n%=r;return n}function Zf(t,e){if(t===Nt||e<=Nt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Qt(t,e),n=e,i=Nt,o=vt;for(;r!==Nt;){const u=n/r,l=n%r,h=i-o*u;n=r,r=l,i=o,o=h}if(n!==vt)throw new Error("invert: does not exist");return Qt(i,e)}function jP(t){const e=(t-vt)/jn;let r,n,i;for(r=t-vt,n=0;r%jn===Nt;r/=jn,n++);for(i=jn;i<t&&GP(i,e,t)!==t-vt;i++);if(n===1){const a=(t+vt)/qf;return function(l,h){const d=l.pow(h,a);if(!l.eql(l.sqr(d),h))throw new Error("Cannot find square root");return d}}const o=(r+vt)/jn;return function(u,l){if(u.pow(l,e)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,d=u.pow(u.mul(u.ONE,i),r),m=u.pow(l,o),y=u.pow(l,r);for(;!u.eql(y,u.ONE);){if(u.eql(y,u.ZERO))return u.ZERO;let w=1;for(let R=u.sqr(y);w<h&&!u.eql(R,u.ONE);w++)R=u.sqr(R);const T=u.pow(d,vt<<BigInt(h-w-1));d=u.sqr(T),m=u.mul(m,T),y=u.mul(y,d),h=w}return m}}function HP(t){if(t%qf===VP){const e=(t+vt)/qf;return function(n,i){const o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%bg===yg){const e=(t-yg)/bg;return function(n,i){const o=n.mul(i,jn),a=n.pow(o,e),u=n.mul(i,a),l=n.mul(n.mul(u,jn),a),h=n.mul(u,n.sub(l,n.ONE));if(!n.eql(n.sqr(h),i))throw new Error("Cannot find square root");return h}}return jP(t)}const qP=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ZP(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=qP.reduce((n,i)=>(n[i]="function",n),e);return ho(t,r)}function KP(t,e,r){if(r<Nt)throw new Error("Expected power > 0");if(r===Nt)return t.ONE;if(r===vt)return e;let n=t.ONE,i=e;for(;r>Nt;)r&vt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=vt;return n}function JP(t,e){const r=new Array(e.length),n=e.reduce((o,a,u)=>t.is0(a)?o:(r[u]=o,t.mul(o,a)),t.ONE),i=t.inv(n);return e.reduceRight((o,a,u)=>t.is0(a)?o:(r[u]=t.mul(o,r[u]),t.mul(o,a)),i),r}function g1(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function WP(t,e,r=!1,n={}){if(t<=Nt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=g1(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=HP(t),u=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Qh(i),ZERO:Nt,ONE:vt,create:l=>Qt(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return Nt<=l&&l<t},is0:l=>l===Nt,isOdd:l=>(l&vt)===vt,neg:l=>Qt(-l,t),eql:(l,h)=>l===h,sqr:l=>Qt(l*l,t),add:(l,h)=>Qt(l+h,t),sub:(l,h)=>Qt(l-h,t),mul:(l,h)=>Qt(l*h,t),pow:(l,h)=>KP(u,l,h),div:(l,h)=>Qt(l*Zf(h,t),t),sqrN:l=>l*l,addN:(l,h)=>l+h,subN:(l,h)=>l-h,mulN:(l,h)=>l*h,inv:l=>Zf(l,t),sqrt:n.sqrt||(l=>a(u,l)),invertBatch:l=>JP(u,l),cmov:(l,h,d)=>d?h:l,toBytes:l=>r?Wh(l,o):Vi(l,o),fromBytes:l=>{if(l.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${l.length}`);return r?Jh(l):Qn(l)}});return Object.freeze(u)}function y1(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function b1(t){const e=y1(t);return e+Math.ceil(e/2)}function QP(t,e,r=!1){const n=t.length,i=y1(e),o=b1(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=r?Qn(t):Jh(t),u=Qt(a,e-vt)+vt;return r?Wh(u,i):Vi(u,i)}const YP=BigInt(0),df=BigInt(1);function XP(t,e){const r=(i,o)=>{const a=o.negate();return i?a:o},n=i=>{const o=Math.ceil(e/i)+1,a=2**(i-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(i,o){let a=t.ZERO,u=i;for(;o>YP;)o&df&&(a=a.add(u)),u=u.double(),o>>=df;return a},precomputeWindow(i,o){const{windows:a,windowSize:u}=n(o),l=[];let h=i,d=h;for(let m=0;m<a;m++){d=h,l.push(d);for(let y=1;y<u;y++)d=d.add(h),l.push(d);h=d.double()}return l},wNAF(i,o,a){const{windows:u,windowSize:l}=n(i);let h=t.ZERO,d=t.BASE;const m=BigInt(2**i-1),y=2**i,w=BigInt(i);for(let T=0;T<u;T++){const R=T*l;let O=Number(a&m);a>>=w,O>l&&(O-=y,a+=df);const A=R,I=R+Math.abs(O)-1,B=T%2!==0,S=O<0;O===0?d=d.add(r(B,o[A])):h=h.add(r(S,o[I]))}return{p:h,f:d}},wNAFCached(i,o,a,u){const l=i._WINDOW_SIZE||1;let h=o.get(i);return h||(h=this.precomputeWindow(i,l),l!==1&&o.set(i,u(h))),this.wNAF(l,h,a)}}}function x1(t){return ZP(t.Fp),ho(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...g1(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function eO(t){const e=x1(t);ho(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:tO,hexToBytes:rO}=$P,qn={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=qn;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:tO(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=qn,r=typeof t=="string"?rO(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=qn._parseInt(r.subarray(2)),{d:a,l:u}=qn._parseInt(o);if(u.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(t){const e=h=>Number.parseInt(h[0],16)&8?"00"+h:h,r=h=>{const d=h.toString(16);return d.length&1?`0${d}`:d},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,a=i.length/2,u=r(o),l=r(a);return`30${r(a+o+4)}02${l}${i}02${u}${n}`}},Kr=BigInt(0),mr=BigInt(1);BigInt(2);const xg=BigInt(3);BigInt(4);function nO(t){const e=eO(t),{Fp:r}=e,n=e.toBytes||((T,R,O)=>{const A=R.toAffine();return Ks(Uint8Array.from([4]),r.toBytes(A.x),r.toBytes(A.y))}),i=e.fromBytes||(T=>{const R=T.subarray(1),O=r.fromBytes(R.subarray(0,r.BYTES)),A=r.fromBytes(R.subarray(r.BYTES,2*r.BYTES));return{x:O,y:A}});function o(T){const{a:R,b:O}=e,A=r.sqr(T),I=r.mul(A,T);return r.add(r.add(I,r.mul(T,R)),O)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(T){return typeof T=="bigint"&&Kr<T&&T<e.n}function u(T){if(!a(T))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(T){const{allowedPrivateKeyLengths:R,nByteLength:O,wrapPrivateKey:A,n:I}=e;if(R&&typeof T!="bigint"){if(T instanceof Uint8Array&&(T=$i(T)),typeof T!="string"||!R.includes(T.length))throw new Error("Invalid key");T=T.padStart(O*2,"0")}let B;try{B=typeof T=="bigint"?T:Qn(Rr("private key",T,O))}catch{throw new Error(`private key must be ${O} bytes, hex or bigint, not ${typeof T}`)}return A&&(B=Qt(B,I)),u(B),B}const h=new Map;function d(T){if(!(T instanceof m))throw new Error("ProjectivePoint expected")}class m{constructor(R,O,A){if(this.px=R,this.py=O,this.pz=A,R==null||!r.isValid(R))throw new Error("x required");if(O==null||!r.isValid(O))throw new Error("y required");if(A==null||!r.isValid(A))throw new Error("z required")}static fromAffine(R){const{x:O,y:A}=R||{};if(!R||!r.isValid(O)||!r.isValid(A))throw new Error("invalid affine point");if(R instanceof m)throw new Error("projective point not allowed");const I=B=>r.eql(B,r.ZERO);return I(O)&&I(A)?m.ZERO:new m(O,A,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(R){const O=r.invertBatch(R.map(A=>A.pz));return R.map((A,I)=>A.toAffine(O[I])).map(m.fromAffine)}static fromHex(R){const O=m.fromAffine(i(Rr("pointHex",R)));return O.assertValidity(),O}static fromPrivateKey(R){return m.BASE.multiply(l(R))}_setWindowSize(R){this._WINDOW_SIZE=R,h.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:R,y:O}=this.toAffine();if(!r.isValid(R)||!r.isValid(O))throw new Error("bad point: x or y not FE");const A=r.sqr(O),I=o(R);if(!r.eql(A,I))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:R}=this.toAffine();if(r.isOdd)return!r.isOdd(R);throw new Error("Field doesn't support isOdd")}equals(R){d(R);const{px:O,py:A,pz:I}=this,{px:B,py:S,pz:N}=R,_=r.eql(r.mul(O,N),r.mul(B,I)),D=r.eql(r.mul(A,N),r.mul(S,I));return _&&D}negate(){return new m(this.px,r.neg(this.py),this.pz)}double(){const{a:R,b:O}=e,A=r.mul(O,xg),{px:I,py:B,pz:S}=this;let N=r.ZERO,_=r.ZERO,D=r.ZERO,L=r.mul(I,I),H=r.mul(B,B),K=r.mul(S,S),le=r.mul(I,B);return le=r.add(le,le),D=r.mul(I,S),D=r.add(D,D),N=r.mul(R,D),_=r.mul(A,K),_=r.add(N,_),N=r.sub(H,_),_=r.add(H,_),_=r.mul(N,_),N=r.mul(le,N),D=r.mul(A,D),K=r.mul(R,K),le=r.sub(L,K),le=r.mul(R,le),le=r.add(le,D),D=r.add(L,L),L=r.add(D,L),L=r.add(L,K),L=r.mul(L,le),_=r.add(_,L),K=r.mul(B,S),K=r.add(K,K),L=r.mul(K,le),N=r.sub(N,L),D=r.mul(K,H),D=r.add(D,D),D=r.add(D,D),new m(N,_,D)}add(R){d(R);const{px:O,py:A,pz:I}=this,{px:B,py:S,pz:N}=R;let _=r.ZERO,D=r.ZERO,L=r.ZERO;const H=e.a,K=r.mul(e.b,xg);let le=r.mul(O,B),U=r.mul(A,S),ge=r.mul(I,N),Be=r.add(O,A),ne=r.add(B,S);Be=r.mul(Be,ne),ne=r.add(le,U),Be=r.sub(Be,ne),ne=r.add(O,I);let ue=r.add(B,N);return ne=r.mul(ne,ue),ue=r.add(le,ge),ne=r.sub(ne,ue),ue=r.add(A,I),_=r.add(S,N),ue=r.mul(ue,_),_=r.add(U,ge),ue=r.sub(ue,_),L=r.mul(H,ne),_=r.mul(K,ge),L=r.add(_,L),_=r.sub(U,L),L=r.add(U,L),D=r.mul(_,L),U=r.add(le,le),U=r.add(U,le),ge=r.mul(H,ge),ne=r.mul(K,ne),U=r.add(U,ge),ge=r.sub(le,ge),ge=r.mul(H,ge),ne=r.add(ne,ge),le=r.mul(U,ne),D=r.add(D,le),le=r.mul(ue,ne),_=r.mul(Be,_),_=r.sub(_,le),le=r.mul(Be,U),L=r.mul(ue,L),L=r.add(L,le),new m(_,D,L)}subtract(R){return this.add(R.negate())}is0(){return this.equals(m.ZERO)}wNAF(R){return w.wNAFCached(this,h,R,O=>{const A=r.invertBatch(O.map(I=>I.pz));return O.map((I,B)=>I.toAffine(A[B])).map(m.fromAffine)})}multiplyUnsafe(R){const O=m.ZERO;if(R===Kr)return O;if(u(R),R===mr)return this;const{endo:A}=e;if(!A)return w.unsafeLadder(this,R);let{k1neg:I,k1:B,k2neg:S,k2:N}=A.splitScalar(R),_=O,D=O,L=this;for(;B>Kr||N>Kr;)B&mr&&(_=_.add(L)),N&mr&&(D=D.add(L)),L=L.double(),B>>=mr,N>>=mr;return I&&(_=_.negate()),S&&(D=D.negate()),D=new m(r.mul(D.px,A.beta),D.py,D.pz),_.add(D)}multiply(R){u(R);let O=R,A,I;const{endo:B}=e;if(B){const{k1neg:S,k1:N,k2neg:_,k2:D}=B.splitScalar(O);let{p:L,f:H}=this.wNAF(N),{p:K,f:le}=this.wNAF(D);L=w.constTimeNegate(S,L),K=w.constTimeNegate(_,K),K=new m(r.mul(K.px,B.beta),K.py,K.pz),A=L.add(K),I=H.add(le)}else{const{p:S,f:N}=this.wNAF(O);A=S,I=N}return m.normalizeZ([A,I])[0]}multiplyAndAddUnsafe(R,O,A){const I=m.BASE,B=(N,_)=>_===Kr||_===mr||!N.equals(I)?N.multiplyUnsafe(_):N.multiply(_),S=B(this,O).add(B(R,A));return S.is0()?void 0:S}toAffine(R){const{px:O,py:A,pz:I}=this,B=this.is0();R==null&&(R=B?r.ONE:r.inv(I));const S=r.mul(O,R),N=r.mul(A,R),_=r.mul(I,R);if(B)return{x:r.ZERO,y:r.ZERO};if(!r.eql(_,r.ONE))throw new Error("invZ was invalid");return{x:S,y:N}}isTorsionFree(){const{h:R,isTorsionFree:O}=e;if(R===mr)return!0;if(O)return O(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:R,clearCofactor:O}=e;return R===mr?this:O?O(m,this):this.multiplyUnsafe(e.h)}toRawBytes(R=!0){return this.assertValidity(),n(m,this,R)}toHex(R=!0){return $i(this.toRawBytes(R))}}m.BASE=new m(e.Gx,e.Gy,r.ONE),m.ZERO=new m(r.ZERO,r.ONE,r.ZERO);const y=e.nBitLength,w=XP(m,e.endo?Math.ceil(y/2):y);return{CURVE:e,ProjectivePoint:m,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:a}}function iO(t){const e=x1(t);return ho(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function sO(t){const e=iO(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function a(ne){return Kr<ne&&ne<r.ORDER}function u(ne){return Qt(ne,n)}function l(ne){return Zf(ne,n)}const{ProjectivePoint:h,normPrivateKeyToScalar:d,weierstrassEquation:m,isWithinCurveOrder:y}=nO({...e,toBytes(ne,ue,ye){const Ae=ue.toAffine(),Ee=r.toBytes(Ae.x),Se=Ks;return ye?Se(Uint8Array.from([ue.hasEvenY()?2:3]),Ee):Se(Uint8Array.from([4]),Ee,r.toBytes(Ae.y))},fromBytes(ne){const ue=ne.length,ye=ne[0],Ae=ne.subarray(1);if(ue===i&&(ye===2||ye===3)){const Ee=Qn(Ae);if(!a(Ee))throw new Error("Point is not on curve");const Se=m(Ee);let Ue=r.sqrt(Se);const _e=(Ue&mr)===mr;return(ye&1)===1!==_e&&(Ue=r.neg(Ue)),{x:Ee,y:Ue}}else if(ue===o&&ye===4){const Ee=r.fromBytes(Ae.subarray(0,r.BYTES)),Se=r.fromBytes(Ae.subarray(r.BYTES,2*r.BYTES));return{x:Ee,y:Se}}else throw new Error(`Point of length ${ue} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),w=ne=>$i(Vi(ne,e.nByteLength));function T(ne){const ue=n>>mr;return ne>ue}function R(ne){return T(ne)?u(-ne):ne}const O=(ne,ue,ye)=>Qn(ne.slice(ue,ye));class A{constructor(ue,ye,Ae){this.r=ue,this.s=ye,this.recovery=Ae,this.assertValidity()}static fromCompact(ue){const ye=e.nByteLength;return ue=Rr("compactSignature",ue,ye*2),new A(O(ue,0,ye),O(ue,ye,2*ye))}static fromDER(ue){const{r:ye,s:Ae}=qn.toSig(Rr("DER",ue));return new A(ye,Ae)}assertValidity(){if(!y(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!y(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(ue){return new A(this.r,this.s,ue)}recoverPublicKey(ue){const{r:ye,s:Ae,recovery:Ee}=this,Se=D(Rr("msgHash",ue));if(Ee==null||![0,1,2,3].includes(Ee))throw new Error("recovery id invalid");const Ue=Ee===2||Ee===3?ye+e.n:ye;if(Ue>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const _e=(Ee&1)===0?"02":"03",j=h.fromHex(_e+w(Ue)),J=l(Ue),se=u(-Se*J),M=u(Ae*J),z=h.BASE.multiplyAndAddUnsafe(j,se,M);if(!z)throw new Error("point at infinify");return z.assertValidity(),z}hasHighS(){return T(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return Zs(this.toDERHex())}toDERHex(){return qn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Zs(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}const I={isValidPrivateKey(ne){try{return d(ne),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const ne=b1(e.n);return QP(e.randomBytes(ne),e.n)},precompute(ne=8,ue=h.BASE){return ue._setWindowSize(ne),ue.multiply(BigInt(3)),ue}};function B(ne,ue=!0){return h.fromPrivateKey(ne).toRawBytes(ue)}function S(ne){const ue=ne instanceof Uint8Array,ye=typeof ne=="string",Ae=(ue||ye)&&ne.length;return ue?Ae===i||Ae===o:ye?Ae===2*i||Ae===2*o:ne instanceof h}function N(ne,ue,ye=!0){if(S(ne))throw new Error("first arg must be private key");if(!S(ue))throw new Error("second arg must be public key");return h.fromHex(ue).multiply(d(ne)).toRawBytes(ye)}const _=e.bits2int||function(ne){const ue=Qn(ne),ye=ne.length*8-e.nBitLength;return ye>0?ue>>BigInt(ye):ue},D=e.bits2int_modN||function(ne){return u(_(ne))},L=Qh(e.nBitLength);function H(ne){if(typeof ne!="bigint")throw new Error("bigint expected");if(!(Kr<=ne&&ne<L))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Vi(ne,e.nByteLength)}function K(ne,ue,ye=le){if(["recovered","canonical"].some(ie=>ie in ye))throw new Error("sign() legacy options not supported");const{hash:Ae,randomBytes:Ee}=e;let{lowS:Se,prehash:Ue,extraEntropy:_e}=ye;Se==null&&(Se=!0),ne=Rr("msgHash",ne),Ue&&(ne=Rr("prehashed msgHash",Ae(ne)));const j=D(ne),J=d(ue),se=[H(J),H(j)];if(_e!=null){const ie=_e===!0?Ee(r.BYTES):_e;se.push(Rr("extraEntropy",ie))}const M=Ks(...se),z=j;function Q(ie){const oe=_(ie);if(!y(oe))return;const P=l(oe),k=h.BASE.multiply(oe).toAffine(),Z=u(k.x);if(Z===Kr)return;const fe=u(P*u(z+Z*J));if(fe===Kr)return;let Oe=(k.x===Z?0:2)|Number(k.y&mr),xe=fe;return Se&&T(fe)&&(xe=R(fe),Oe^=1),new A(Z,xe,Oe)}return{seed:M,k2sig:Q}}const le={lowS:e.lowS,prehash:!1},U={lowS:e.lowS,prehash:!1};function ge(ne,ue,ye=le){const{seed:Ae,k2sig:Ee}=K(ne,ue,ye),Se=e;return m1(Se.hash.outputLen,Se.nByteLength,Se.hmac)(Ae,Ee)}h.BASE._setWindowSize(8);function Be(ne,ue,ye,Ae=U){const Ee=ne;if(ue=Rr("msgHash",ue),ye=Rr("publicKey",ye),"strict"in Ae)throw new Error("options.strict was renamed to lowS");const{lowS:Se,prehash:Ue}=Ae;let _e,j;try{if(typeof Ee=="string"||Ee instanceof Uint8Array)try{_e=A.fromDER(Ee)}catch(k){if(!(k instanceof qn.Err))throw k;_e=A.fromCompact(Ee)}else if(typeof Ee=="object"&&typeof Ee.r=="bigint"&&typeof Ee.s=="bigint"){const{r:k,s:Z}=Ee;_e=new A(k,Z)}else throw new Error("PARSE");j=h.fromHex(ye)}catch(k){if(k.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Se&&_e.hasHighS())return!1;Ue&&(ue=e.hash(ue));const{r:J,s:se}=_e,M=D(ue),z=l(se),Q=u(M*z),ie=u(J*z),oe=h.BASE.multiplyAndAddUnsafe(j,Q,ie)?.toAffine();return oe?u(oe.x)===J:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:N,sign:ge,verify:Be,ProjectivePoint:h,Signature:A,utils:I}}function oO(t){return{hash:t,hmac:(e,...r)=>Ya(t,e,LS(...r)),randomBytes:MS}}function aO(t,e){const r=n=>sO({...t,...oO(n)});return Object.freeze({...r(e),create:r})}const w1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),wg=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),cO=BigInt(1),Kf=BigInt(2),Ag=(t,e)=>(t+e/Kf)/e;function uO(t){const e=w1,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),u=BigInt(44),l=BigInt(88),h=t*t*t%e,d=h*h*t%e,m=lr(d,r,e)*d%e,y=lr(m,r,e)*d%e,w=lr(y,Kf,e)*h%e,T=lr(w,i,e)*w%e,R=lr(T,o,e)*T%e,O=lr(R,u,e)*R%e,A=lr(O,l,e)*O%e,I=lr(A,u,e)*R%e,B=lr(I,r,e)*d%e,S=lr(B,a,e)*T%e,N=lr(S,n,e)*h%e,_=lr(N,Kf,e);if(!Jf.eql(Jf.sqr(_),t))throw new Error("Cannot find square root");return _}const Jf=WP(w1,void 0,void 0,{sqrt:uO}),xn=aO({a:BigInt(0),b:BigInt(7),Fp:Jf,n:wg,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=wg,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-cO*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),u=Ag(o*t,e),l=Ag(-n*t,e);let h=Qt(t-u*r-l*i,e),d=Qt(-u*n-l*o,e);const m=h>a,y=d>a;if(m&&(h=e-h),y&&(d=e-d),h>a||d>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:m,k1:h,k2neg:y,k2:d}}}},Yi);BigInt(0);xn.ProjectivePoint;const Ra="0x0000000000000000000000000000000000000000",Eg="0x0000000000000000000000000000000000000000000000000000000000000000",lO=`Ethereum Signed Message:
85
+ `,vg=BigInt(0),Rg=BigInt(1),Wf=BigInt(2),Tg=BigInt(27),Bg=BigInt(28),Jo=BigInt(35),A1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),fO=A1/Wf,hO=Symbol.for("nodejs.util.inspect.custom"),Mn={};function pf(t){return nn(mt(t),32)}class dt{#e;#t;#r;#n;get r(){return this.#e}set r(e){F(Ii(e)===32,"invalid r","value",e),this.#e=ae(e)}get s(){return F(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){F(Ii(e)===32,"invalid s","value",e),this.#t=ae(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=fO}get v(){return this.#r}set v(e){const r=Ie(e,"value");F(r===27||r===28,"invalid v","v",e),this.#r=r}get networkV(){return this.#n}get legacyChainId(){const e=this.networkV;return e==null?null:dt.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=de(this.s);return this.yParity&&(e[0]|=128),ae(e)}get compactSerialized(){return je([this.r,this.yParityAndS])}get serialized(){return je([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,r,n,i){ci(e,Mn,"Signature"),this.#e=r,this.#t=n,this.#r=i,this.#n=null}getCanonical(){if(this.isValid())return this;const e=A1-BigInt(this._s),r=55-this.v,n=new dt(Mn,this.r,pf(e),r);return this.networkV&&(n.#n=this.networkV),n}clone(){const e=new dt(Mn,this.r,this._s,this.v);return this.networkV&&(e.#n=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this._s,v:this.v}}[hO](){return this.toString()}toString(){return this.isValid()?`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`:`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`}static getChainId(e){const r=pe(e,"v");return r==Tg||r==Bg?vg:(F(r>=Jo,"invalid EIP-155 v","v",e),(r-Jo)/Wf)}static getChainIdV(e,r){return pe(e)*Wf+BigInt(35+r-27)}static getNormalizedV(e){const r=pe(e);return r===vg||r===Tg?27:r===Rg||r===Bg?28:(F(r>=Jo,"invalid v","v",e),r&Rg?27:28)}static from(e){function r(h,d){F(h,d,"signature",e)}if(e==null)return new dt(Mn,Eg,Eg,27);if(typeof e=="string"){const h=de(e,"signature");if(h.length===64){const d=ae(h.slice(0,32)),m=h.slice(32,64),y=m[0]&128?28:27;return m[0]&=127,new dt(Mn,d,ae(m),y)}if(h.length===65){const d=ae(h.slice(0,32)),m=ae(h.slice(32,64)),y=dt.getNormalizedV(h[64]);return new dt(Mn,d,m,y)}r(!1,"invalid raw signature length")}if(e instanceof dt)return e.clone();const n=e.r;r(n!=null,"missing r");const i=pf(n),o=(function(h,d){if(h!=null)return pf(h);if(d!=null){r(tt(d,32),"invalid yParityAndS");const m=de(d);return m[0]&=127,ae(m)}r(!1,"missing s")})(e.s,e.yParityAndS),{networkV:a,v:u}=(function(h,d,m){if(h!=null){const y=pe(h);return{networkV:y>=Jo?y:void 0,v:dt.getNormalizedV(y)}}if(d!=null)return r(tt(d,32),"invalid yParityAndS"),{v:de(d)[0]&128?28:27};if(m!=null){switch(Ie(m,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")})(e.v,e.yParityAndS,e.yParity),l=new dt(Mn,i,o,u);return a&&(l.#n=a),r(e.yParity==null||Ie(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}}class Xt{#e;constructor(e){F(Ii(e)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=ae(e)}get privateKey(){return this.#e}get publicKey(){return Xt.computePublicKey(this.#e)}get compressedPublicKey(){return Xt.computePublicKey(this.#e,!0)}sign(e){F(Ii(e)===32,"invalid digest length","digest",e);const r=xn.sign(Ft(e),Ft(this.#e),{lowS:!0});return dt.from({r:sn(r.r,32),s:sn(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Xt.computePublicKey(e);return ae(xn.getSharedSecret(Ft(this.#e),de(r),!1))}static computePublicKey(e,r){let n=de(e,"key");if(n.length===32){const o=xn.getPublicKey(n,!!r);return ae(o)}if(n.length===64){const o=new Uint8Array(65);o[0]=4,o.set(n,1),n=o}const i=xn.ProjectivePoint.fromHex(n);return ae(i.toRawBytes(r))}static recoverPublicKey(e,r){F(Ii(e)===32,"invalid digest length","digest",e);const n=dt.from(r);let i=xn.Signature.fromCompact(Ft(je([n.r,n.s])));i=i.addRecoveryBit(n.yParity);const o=i.recoverPublicKey(Ft(e));return F(o!=null,"invalid signature for digest","signature",r),"0x"+o.toHex(!1)}static addPoints(e,r,n){const i=xn.ProjectivePoint.fromHex(Xt.computePublicKey(e).substring(2)),o=xn.ProjectivePoint.fromHex(Xt.computePublicKey(r).substring(2));return"0x"+i.add(o).toHex(!!n)}}const dO=BigInt(0),pO=BigInt(36);function Sg(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=de(lt(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yh={};for(let t=0;t<10;t++)Yh[String(t)]=String(t);for(let t=0;t<26;t++)Yh[String.fromCharCode(65+t)]=String(10+t);const Pg=15;function mO(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Yh[n]).join("");for(;e.length>=Pg;){let n=e.substring(0,Pg);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const gO=(function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t})();function yO(t){t=t.toLowerCase();let e=dO;for(let r=0;r<t.length;r++)e=e*pO+gO[t[r]];return e}function ze(t){if(F(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=Sg(t);return F(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){F(t.substring(2,4)===mO(t),"bad icap checksum","address",t);let e=yO(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return Sg("0x"+e)}F(!1,"invalid address","address",t)}function bO(t){const e=ze(t.from);let n=pe(t.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,ze(ot(lt($r([e,n])),12))}function E1(t){return t&&typeof t.getAddress=="function"}async function mf(t,e){const r=await e;return(r==null||r==="0x0000000000000000000000000000000000000000")&&(re(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),F(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),ze(r)}function Ct(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?ze(t):(re(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),mf(t,e.resolveName(t)));if(E1(t))return mf(t,t.getAddress());if(t&&typeof t.then=="function")return mf(t,t);F(!1,"unsupported addressable value","target",t)}const jr={};function be(t,e){let r=!1;return e<0&&(r=!0,e*=-1),new yt(jr,`${r?"":"u"}int${e}`,t,{signed:r,width:e})}function Ge(t,e){return new yt(jr,`bytes${e||""}`,t,{size:e})}const Og=Symbol.for("_ethers_typed");class yt{type;value;#e;_typedSymbol;constructor(e,r,n,i){i==null&&(i=null),ci(jr,e,"Typed"),Te(this,{_typedSymbol:Og,type:r,value:n}),this.#e=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(e=>e.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.#e}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#e===!0?-1:this.#e===!1?this.value.length:null}static from(e,r){return new yt(jr,e,r)}static uint8(e){return be(e,8)}static uint16(e){return be(e,16)}static uint24(e){return be(e,24)}static uint32(e){return be(e,32)}static uint40(e){return be(e,40)}static uint48(e){return be(e,48)}static uint56(e){return be(e,56)}static uint64(e){return be(e,64)}static uint72(e){return be(e,72)}static uint80(e){return be(e,80)}static uint88(e){return be(e,88)}static uint96(e){return be(e,96)}static uint104(e){return be(e,104)}static uint112(e){return be(e,112)}static uint120(e){return be(e,120)}static uint128(e){return be(e,128)}static uint136(e){return be(e,136)}static uint144(e){return be(e,144)}static uint152(e){return be(e,152)}static uint160(e){return be(e,160)}static uint168(e){return be(e,168)}static uint176(e){return be(e,176)}static uint184(e){return be(e,184)}static uint192(e){return be(e,192)}static uint200(e){return be(e,200)}static uint208(e){return be(e,208)}static uint216(e){return be(e,216)}static uint224(e){return be(e,224)}static uint232(e){return be(e,232)}static uint240(e){return be(e,240)}static uint248(e){return be(e,248)}static uint256(e){return be(e,256)}static uint(e){return be(e,256)}static int8(e){return be(e,-8)}static int16(e){return be(e,-16)}static int24(e){return be(e,-24)}static int32(e){return be(e,-32)}static int40(e){return be(e,-40)}static int48(e){return be(e,-48)}static int56(e){return be(e,-56)}static int64(e){return be(e,-64)}static int72(e){return be(e,-72)}static int80(e){return be(e,-80)}static int88(e){return be(e,-88)}static int96(e){return be(e,-96)}static int104(e){return be(e,-104)}static int112(e){return be(e,-112)}static int120(e){return be(e,-120)}static int128(e){return be(e,-128)}static int136(e){return be(e,-136)}static int144(e){return be(e,-144)}static int152(e){return be(e,-152)}static int160(e){return be(e,-160)}static int168(e){return be(e,-168)}static int176(e){return be(e,-176)}static int184(e){return be(e,-184)}static int192(e){return be(e,-192)}static int200(e){return be(e,-200)}static int208(e){return be(e,-208)}static int216(e){return be(e,-216)}static int224(e){return be(e,-224)}static int232(e){return be(e,-232)}static int240(e){return be(e,-240)}static int248(e){return be(e,-248)}static int256(e){return be(e,-256)}static int(e){return be(e,-256)}static bytes1(e){return Ge(e,1)}static bytes2(e){return Ge(e,2)}static bytes3(e){return Ge(e,3)}static bytes4(e){return Ge(e,4)}static bytes5(e){return Ge(e,5)}static bytes6(e){return Ge(e,6)}static bytes7(e){return Ge(e,7)}static bytes8(e){return Ge(e,8)}static bytes9(e){return Ge(e,9)}static bytes10(e){return Ge(e,10)}static bytes11(e){return Ge(e,11)}static bytes12(e){return Ge(e,12)}static bytes13(e){return Ge(e,13)}static bytes14(e){return Ge(e,14)}static bytes15(e){return Ge(e,15)}static bytes16(e){return Ge(e,16)}static bytes17(e){return Ge(e,17)}static bytes18(e){return Ge(e,18)}static bytes19(e){return Ge(e,19)}static bytes20(e){return Ge(e,20)}static bytes21(e){return Ge(e,21)}static bytes22(e){return Ge(e,22)}static bytes23(e){return Ge(e,23)}static bytes24(e){return Ge(e,24)}static bytes25(e){return Ge(e,25)}static bytes26(e){return Ge(e,26)}static bytes27(e){return Ge(e,27)}static bytes28(e){return Ge(e,28)}static bytes29(e){return Ge(e,29)}static bytes30(e){return Ge(e,30)}static bytes31(e){return Ge(e,31)}static bytes32(e){return Ge(e,32)}static address(e){return new yt(jr,"address",e)}static bool(e){return new yt(jr,"bool",!!e)}static bytes(e){return new yt(jr,"bytes",e)}static string(e){return new yt(jr,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new yt(jr,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===Og}static dereference(e,r){if(yt.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}}class xO extends cn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=yt.dereference(r,"string");try{n=ze(n)}catch(i){return this._throwError(i.message,r)}return e.writeValue(n)}decode(e){return ze(sn(e.readValue(),20))}}class wO extends cn{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}function v1(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let l={};n=e.map(h=>{const d=h.localName;return re(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:h},value:r}),re(!l[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:h},value:r}),l[d]=!0,r[d]})}else F(!1,"invalid tuple value","tuple",r);F(e.length===n.length,"types/value length mismatch","tuple",r);let i=new jf,o=new jf,a=[];e.forEach((l,h)=>{let d=n[h];if(l.dynamic){let m=o.length;l.encode(o,d);let y=i.writeUpdatableValue();a.push(w=>{y(w+m)})}else l.encode(i,d)}),a.forEach(l=>{l(i.length)});let u=t.appendWriter(i);return u+=t.appendWriter(o),u}function R1(t,e){let r=[],n=[],i=t.subReader(0);return e.forEach(o=>{let a=null;if(o.dynamic){let u=t.readIndex(),l=i.subReader(u);try{a=o.decode(l)}catch(h){if(It(h,"BUFFER_OVERRUN"))throw h;a=h,a.baseType=o.name,a.name=o.localName,a.type=o.type}}else try{a=o.decode(t)}catch(u){if(It(u,"BUFFER_OVERRUN"))throw u;a=u,a.baseType=o.name,a.name=o.localName,a.type=o.type}if(a==null)throw new Error("investigate");r.push(a),n.push(o.localName||null)}),Wr.fromItems(r,n)}class AO extends cn{coder;length;constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),Te(this,{coder:e,length:r})}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;n<this.length;n++)r.push(e);return r}encode(e,r){const n=yt.dereference(r,"array");Array.isArray(n)||this._throwError("expected array value",n);let i=this.length;i===-1&&(i=n.length,e.writeValue(n.length)),hx(n.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<n.length;a++)o.push(this.coder);return v1(e,o,n)}decode(e){let r=this.length;r===-1&&(r=e.readIndex(),re(r*Kt<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:r*Kt,length:e.dataLength}));let n=[];for(let i=0;i<r;i++)n.push(new wO(this.coder));return R1(e,n)}}class EO extends cn{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,r){const n=yt.dereference(r,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class T1 extends cn{constructor(e,r){super(e,e,r,!0)}defaultValue(){return"0x"}encode(e,r){r=Ft(r);let n=e.writeValue(r.length);return n+=e.writeBytes(r),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class vO extends T1{constructor(e){super("bytes",e)}decode(e){return ae(super.decode(e))}}class RO extends cn{size;constructor(e,r){let n="bytes"+String(e);super(n,n,r,!1),Te(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let n=Ft(yt.dereference(r,this.type));return n.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(n)}decode(e){return ae(e.readBytes(this.size))}}const TO=new Uint8Array([]);class BO extends cn{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes(TO)}decode(e){return e.readBytes(0),null}}const SO=BigInt(0),PO=BigInt(1),OO=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class IO extends cn{size;signed;constructor(e,r,n){const i=(r?"int":"uint")+e*8;super(i,i,n,!1),Te(this,{size:e,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,r){let n=pe(yt.dereference(r,this.type)),i=Is(OO,Kt*8);if(this.signed){let o=Is(i,this.size*8-1);(n>o||n<-(o+PO))&&this._throwError("value out-of-bounds",r),n=gx(n,8*Kt)}else(n<SO||n>Is(i,this.size*8))&&this._throwError("value out-of-bounds",r);return e.writeValue(n)}decode(e){let r=Is(e.readValue(),this.size*8);return this.signed&&(r=hS(r,this.size*8)),r}}class kO extends T1{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Wt(yt.dereference(r,"string")))}decode(e){return va(super.decode(e))}}class Wo extends cn{coders;constructor(e,r){let n=!1;const i=[];e.forEach(a=>{a.dynamic&&(n=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),Te(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){const n=yt.dereference(r,"tuple");return v1(e,this.coders,n)}decode(e){return R1(e,this.coders)}}function gf(t,e){return{address:ze(t),storageKeys:e.map((r,n)=>(F(tt(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function ui(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(F(r.length===2,"invalid slot set",`value[${n}]`,r),gf(r[0],r[1])):(F(r!=null&&typeof r=="object","invalid address-slot set","value",t),gf(r.address,r.storageKeys)));F(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return gf(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function B1(t){return{address:ze(t.address),nonce:pe(t.nonce!=null?t.nonce:0),chainId:pe(t.chainId!=null?t.chainId:0),signature:dt.from(t.signature)}}function po(t){let e;return typeof t=="string"?e=Xt.computePublicKey(t,!1):e=t.publicKey,ze(lt("0x"+e.substring(4)).substring(26))}function NO(t,e){return po(Xt.recoverPublicKey(t,e))}const Pt=BigInt(0),CO=BigInt(2),_O=BigInt(27),FO=BigInt(28),DO=BigInt(35),LO=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),UO=Symbol.for("nodejs.util.inspect.custom"),yf=4096*32,ca=128;function MO(t){return{blobToKzgCommitment:n=>{if("computeBlobProof"in t){if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return de(t.blobToKzgCommitment(ae(n)))}else if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return de(t.blobToKzgCommitment(n));if("blobToKZGCommitment"in t&&typeof t.blobToKZGCommitment=="function")return de(t.blobToKZGCommitment(ae(n)));F(!1,"unsupported KZG library","kzg",t)},computeBlobKzgProof:(n,i)=>{if("computeBlobProof"in t&&typeof t.computeBlobProof=="function")return de(t.computeBlobProof(ae(n),ae(i)));if("computeBlobKzgProof"in t&&typeof t.computeBlobKzgProof=="function")return t.computeBlobKzgProof(n,i);if("computeBlobKZGProof"in t&&typeof t.computeBlobKZGProof=="function")return de(t.computeBlobKZGProof(ae(n),ae(i)));F(!1,"unsupported KZG library","kzg",t)}}}function Ig(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=xr(e).substring(4),"0x"+r}function ns(t){return t==="0x"?null:ze(t)}function ec(t,e){try{return ui(t)}catch(r){F(!1,r.message,e,t)}}function zO(t,e){try{if(!Array.isArray(t))throw new Error("authorizationList: invalid array");const r=[];for(let n=0;n<t.length;n++){const i=t[n];if(!Array.isArray(i))throw new Error(`authorization[${n}]: invalid array`);if(i.length!==6)throw new Error(`authorization[${n}]: wrong length`);if(!i[1])throw new Error(`authorization[${n}]: null address`);r.push({address:ns(i[1]),nonce:We(i[2],"nonce"),chainId:We(i[0],"chainId"),signature:dt.from({yParity:li(i[3],"yParity"),r:nn(i[4],32),s:nn(i[5],32)})})}return r}catch(r){F(!1,r.message,e,t)}}function li(t,e){return t==="0x"?0:Ie(t,e)}function We(t,e){if(t==="0x")return Pt;const r=pe(t,e);return F(r<=LO,"value exceeds uint size",e,r),r}function $e(t,e){const r=pe(t,"value"),n=mt(r);return F(n.length<=32,"value too large",`tx.${e}`,r),n}function tc(t){return ui(t).map(e=>[e.address,e.storageKeys])}function $O(t){return t.map(e=>[$e(e.chainId,"chainId"),e.address,$e(e.nonce,"nonce"),$e(e.signature.yParity,"yParity"),mt(e.signature.r),mt(e.signature._s)])}function VO(t,e){F(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;r<t.length;r++)F(tt(t[r],32),"invalid ${ param } hash",`value[${r}]`,t[r]);return t}function GO(t){const e=fo(t);F(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const r={type:0,nonce:li(e[0],"nonce"),gasPrice:We(e[1],"gasPrice"),gasLimit:We(e[2],"gasLimit"),to:ns(e[3]),value:We(e[4],"value"),data:ae(e[5]),chainId:Pt};if(e.length===6)return r;const n=We(e[6],"v"),i=We(e[7],"r"),o=We(e[8],"s");if(i===Pt&&o===Pt)r.chainId=n;else{let a=(n-DO)/CO;a<Pt&&(a=Pt),r.chainId=a,F(a!==Pt||n===_O||n===FO,"non-canonical legacy v","v",e[6]),r.signature=dt.from({r:nn(e[7],32),s:nn(e[8],32),v:n})}return r}function jO(t,e){const r=[$e(t.nonce,"nonce"),$e(t.gasPrice||0,"gasPrice"),$e(t.gasLimit,"gasLimit"),t.to||"0x",$e(t.value,"value"),t.data];let n=Pt;if(t.chainId!=Pt)n=pe(t.chainId,"tx.chainId"),F(!e||e.networkV==null||e.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const o=t.signature.legacyChainId;o!=null&&(n=o)}if(!e)return n!==Pt&&(r.push(mt(n)),r.push("0x"),r.push("0x")),$r(r);let i=BigInt(27+e.yParity);return n!==Pt?i=dt.getChainIdV(n,e.v):BigInt(e.v)!==i&&F(!1,"tx.chainId/sig.v mismatch","sig",e),r.push(mt(i)),r.push(mt(e.r)),r.push(mt(e._s)),$r(r)}function rc(t,e){let r;try{if(r=li(e[0],"yParity"),r!==0&&r!==1)throw new Error("bad yParity")}catch{F(!1,"invalid yParity","yParity",e[0])}const n=nn(e[1],32),i=nn(e[2],32),o=dt.from({r:n,s:i,yParity:r});t.signature=o}function HO(t){const e=fo(de(t).slice(1));F(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",ae(t));const r={type:2,chainId:We(e[0],"chainId"),nonce:li(e[1],"nonce"),maxPriorityFeePerGas:We(e[2],"maxPriorityFeePerGas"),maxFeePerGas:We(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:We(e[4],"gasLimit"),to:ns(e[5]),value:We(e[6],"value"),data:ae(e[7]),accessList:ec(e[8],"accessList")};return e.length===9||rc(r,e.slice(9)),r}function qO(t,e){const r=[$e(t.chainId,"chainId"),$e(t.nonce,"nonce"),$e(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),$e(t.maxFeePerGas||0,"maxFeePerGas"),$e(t.gasLimit,"gasLimit"),t.to||"0x",$e(t.value,"value"),t.data,tc(t.accessList||[])];return e&&(r.push($e(e.yParity,"yParity")),r.push(mt(e.r)),r.push(mt(e.s))),je(["0x02",$r(r)])}function ZO(t){const e=fo(de(t).slice(1));F(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",ae(t));const r={type:1,chainId:We(e[0],"chainId"),nonce:li(e[1],"nonce"),gasPrice:We(e[2],"gasPrice"),gasLimit:We(e[3],"gasLimit"),to:ns(e[4]),value:We(e[5],"value"),data:ae(e[6]),accessList:ec(e[7],"accessList")};return e.length===8||rc(r,e.slice(8)),r}function KO(t,e){const r=[$e(t.chainId,"chainId"),$e(t.nonce,"nonce"),$e(t.gasPrice||0,"gasPrice"),$e(t.gasLimit,"gasLimit"),t.to||"0x",$e(t.value,"value"),t.data,tc(t.accessList||[])];return e&&(r.push($e(e.yParity,"recoveryParam")),r.push(mt(e.r)),r.push(mt(e.s))),je(["0x01",$r(r)])}function JO(t){let e=fo(de(t).slice(1)),r="3",n=null,i=null;if(e.length===4&&Array.isArray(e[0])){r="3 (network format)";const a=e[1],u=e[2],l=e[3];F(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),F(Array.isArray(u),"invalid network format: commitments not an array","fields[2]",u),F(Array.isArray(l),"invalid network format: proofs not an array","fields[3]",l),F(a.length===u.length,"invalid network format: blobs/commitments length mismatch","fields",e),F(a.length===l.length,"invalid network format: blobs/proofs length mismatch","fields",e),i=[];for(let h=0;h<e[1].length;h++)i.push({data:a[h],commitment:u[h],proof:l[h]});e=e[0]}else if(e.length===5&&Array.isArray(e[0])){r="3 (EIP-7594 network format)",n=Ie(e[1]);const a=e[2],u=e[3],l=e[4];F(n===1,`unsupported EIP-7594 network format version: ${n}`,"fields[1]",n),F(Array.isArray(a),"invalid EIP-7594 network format: blobs not an array","fields[2]",a),F(Array.isArray(u),"invalid EIP-7594 network format: commitments not an array","fields[3]",u),F(Array.isArray(l),"invalid EIP-7594 network format: proofs not an array","fields[4]",l),F(a.length===u.length,"invalid network format: blobs/commitments length mismatch","fields",e),F(a.length*ca===l.length,"invalid network format: blobs/proofs length mismatch","fields",e),i=[];for(let h=0;h<a.length;h++){const d=[];for(let m=0;m<ca;m++)d.push(l[h*ca+m]);i.push({data:a[h],commitment:u[h],proof:je(d)})}e=e[0]}F(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${r}`,"data",ae(t));const o={type:3,chainId:We(e[0],"chainId"),nonce:li(e[1],"nonce"),maxPriorityFeePerGas:We(e[2],"maxPriorityFeePerGas"),maxFeePerGas:We(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:We(e[4],"gasLimit"),to:ns(e[5]),value:We(e[6],"value"),data:ae(e[7]),accessList:ec(e[8],"accessList"),maxFeePerBlobGas:We(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10],blobWrapperVersion:n};i&&(o.blobs=i),F(o.to!=null,`invalid address for transaction type: ${r}`,"data",t),F(Array.isArray(o.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let a=0;a<o.blobVersionedHashes.length;a++)F(tt(o.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",t);return e.length===11||rc(o,e.slice(11)),o}function WO(t,e,r){const n=[$e(t.chainId,"chainId"),$e(t.nonce,"nonce"),$e(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),$e(t.maxFeePerGas||0,"maxFeePerGas"),$e(t.gasLimit,"gasLimit"),t.to||Ra,$e(t.value,"value"),t.data,tc(t.accessList||[]),$e(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),VO(t.blobVersionedHashes||[],"blobVersionedHashes")];if(e&&(n.push($e(e.yParity,"yParity")),n.push(mt(e.r)),n.push(mt(e.s)),r)){if(t.blobWrapperVersion!=null){const i=mt(t.blobWrapperVersion),o=[];for(const{proof:a}of r){const u=de(a),l=u.length/ca;for(let h=0;h<u.length;h+=l)o.push(u.subarray(h,h+l))}return je(["0x03",$r([n,i,r.map(a=>a.data),r.map(a=>a.commitment),o])])}return je(["0x03",$r([n,r.map(i=>i.data),r.map(i=>i.commitment),r.map(i=>i.proof)])])}return je(["0x03",$r(n)])}function QO(t){const e=fo(de(t).slice(1));F(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",ae(t));const r={type:4,chainId:We(e[0],"chainId"),nonce:li(e[1],"nonce"),maxPriorityFeePerGas:We(e[2],"maxPriorityFeePerGas"),maxFeePerGas:We(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:We(e[4],"gasLimit"),to:ns(e[5]),value:We(e[6],"value"),data:ae(e[7]),accessList:ec(e[8],"accessList"),authorizationList:zO(e[9],"authorizationList")};return e.length===10||rc(r,e.slice(10)),r}function YO(t,e){const r=[$e(t.chainId,"chainId"),$e(t.nonce,"nonce"),$e(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),$e(t.maxFeePerGas||0,"maxFeePerGas"),$e(t.gasLimit,"gasLimit"),t.to||"0x",$e(t.value,"value"),t.data,tc(t.accessList||[]),$O(t.authorizationList||[])];return e&&(r.push($e(e.yParity,"yParity")),r.push(mt(e.r)),r.push(mt(e.s))),je(["0x04",$r(r)])}class gr{#e;#t;#r;#n;#i;#o;#s;#a;#d;#u;#m;#p;#h;#l;#f;#c;#y;#b;get type(){return this.#e}set type(e){switch(e){case null:this.#e=null;break;case 0:case"legacy":this.#e=0;break;case 1:case"berlin":case"eip-2930":this.#e=1;break;case 2:case"london":case"eip-1559":this.#e=2;break;case 3:case"cancun":case"eip-4844":this.#e=3;break;case 4:case"pectra":case"eip-7702":this.#e=4;break;default:F(!1,"unsupported transaction type","type",e)}}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 e=this.#t;return e==null&&this.type===3?Ra:e}set to(e){this.#t=e==null?null:ze(e)}get nonce(){return this.#n}set nonce(e){this.#n=Ie(e,"value")}get gasLimit(){return this.#i}set gasLimit(e){this.#i=pe(e)}get gasPrice(){const e=this.#o;return e==null&&(this.type===0||this.type===1)?Pt:e}set gasPrice(e){this.#o=e==null?null:pe(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#s;return e??(this.type===2||this.type===3?Pt:null)}set maxPriorityFeePerGas(e){this.#s=e==null?null:pe(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#a;return e??(this.type===2||this.type===3?Pt:null)}set maxFeePerGas(e){this.#a=e==null?null:pe(e,"maxFeePerGas")}get data(){return this.#r}set data(e){this.#r=ae(e)}get value(){return this.#d}set value(e){this.#d=pe(e,"value")}get chainId(){return this.#u}set chainId(e){this.#u=pe(e)}get signature(){return this.#m||null}set signature(e){this.#m=e==null?null:dt.from(e)}isValid(){const e=this.signature;if(e&&!e.isValid())return!1;const r=this.authorizationList;if(r){for(const n of r)if(!n.signature.isValid())return!1}return!0}get accessList(){const e=this.#p||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){this.#p=e==null?null:ui(e)}get authorizationList(){const e=this.#y||null;return e==null&&this.type===4?[]:e}set authorizationList(e){this.#y=e==null?null:e.map(r=>B1(r))}get maxFeePerBlobGas(){const e=this.#h;return e==null&&this.type===3?Pt:e}set maxFeePerBlobGas(e){this.#h=e==null?null:pe(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#l;return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){F(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;r<e.length;r++)F(tt(e[r],32),"invalid blobVersionedHash",`value[${r}]`,e[r])}this.#l=e}get blobs(){return this.#c==null?null:this.#c.map(e=>Object.assign({},e))}set blobs(e){if(e==null){this.#c=null;return}const r=[],n=[];for(let i=0;i<e.length;i++){const o=e[i];if(Ka(o)){re(this.#f,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let a=de(o);if(F(a.length<=yf,"blob is too large",`blobs[${i}]`,o),a.length!==yf){const h=new Uint8Array(yf);h.set(a),a=h}const u=this.#f.blobToKzgCommitment(a),l=ae(this.#f.computeBlobKzgProof(a,u));r.push({data:ae(a),commitment:ae(u),proof:l}),n.push(Ig(1,u))}else{const a=ae(o.data),u=ae(o.commitment),l=ae(o.proof);r.push({data:a,commitment:u,proof:l}),n.push(Ig(1,u))}}this.#c=r,this.#l=n}get kzg(){return this.#f}set kzg(e){e==null?this.#f=null:this.#f=MO(e)}get blobWrapperVersion(){return this.#b}set blobWrapperVersion(e){this.#b=e}constructor(){this.#e=null,this.#t=null,this.#n=0,this.#i=Pt,this.#o=null,this.#s=null,this.#a=null,this.#r="0x",this.#d=Pt,this.#u=Pt,this.#m=null,this.#p=null,this.#h=null,this.#l=null,this.#f=null,this.#c=null,this.#y=null,this.#b=null}get hash(){return this.signature==null?null:lt(this.#g(!0,!1))}get unsignedHash(){return lt(this.unsignedSerialized)}get from(){return this.signature==null?null:NO(this.unsignedHash,this.signature.getCanonical())}get fromPublicKey(){return this.signature==null?null:Xt.recoverPublicKey(this.unsignedHash,this.signature.getCanonical())}isSigned(){return this.signature!=null}#g(e,r){re(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return jO(this,n);case 1:return KO(this,n);case 2:return qO(this,n);case 3:return WO(this,n,r?this.blobs:null);case 4:return YO(this,n)}re(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#g(!0,!0)}get unsignedSerialized(){return this.#g(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,i=this.#h!=null||this.#l;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&re(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),re(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),re(this.type!==0||!n,"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):r?o.push(2):e?(o.push(1),n||o.push(0)):n?(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 gr.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}[UO](){return this.toString()}toString(){const e=[],r=i=>{let o=this[i];typeof o=="string"&&(o=JSON.stringify(o)),e.push(`${i}: ${o}`)};this.type&&r("type"),r("to"),r("data"),r("nonce"),r("gasLimit"),r("value"),this.chainId!=null&&r("chainId"),this.signature&&(r("from"),e.push(`signature: ${this.signature.toString()}`));const n=this.authorizationList;if(n){const i=[];for(const o of n){const a=[];a.push(`address: ${JSON.stringify(o.address)}`),o.nonce!=null&&a.push(`nonce: ${o.nonce}`),o.chainId!=null&&a.push(`chainId: ${o.chainId}`),o.signature&&a.push(`signature: ${o.signature.toString()}`),i.push(`Authorization { ${a.join(", ")} }`)}e.push(`authorizations: [ ${i.join(", ")} ]`)}return`Transaction { ${e.join(", ")} }`}static from(e){if(e==null)return new gr;if(typeof e=="string"){const n=de(e);if(n[0]>=127)return gr.from(GO(n));switch(n[0]){case 1:return gr.from(ZO(n));case 2:return gr.from(HO(n));case 3:return gr.from(JO(n));case 4:return gr.from(QO(n))}re(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new gr;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=dt.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.authorizationList!=null&&(r.authorizationList=e.authorizationList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobWrapperVersion!=null&&(r.blobWrapperVersion=e.blobWrapperVersion),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(F(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),F(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(F(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),F(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}}function XO(t){return F(typeof t.address=="string","invalid address for hashAuthorization","auth.address",t),lt(je(["0x05",$r([t.chainId!=null?mt(t.chainId):"0x",ze(t.address),t.nonce!=null?mt(t.nonce):"0x"])]))}function on(t){return lt(Wt(t))}var eI="AEkVMQnvDV0B0wKWAQYBQgDpATQAoQDcAIUApwBsAOMAcACTAEUAigBRAHkAPgA/ACwANwAoAGIAHgAvACsAJQAXAC8AHAAhACIALwAVACsAEQAiAAsAGwARABgAFwA7ACoAKwAsADQAFgAtABIAHAAhAA4AHQAdABUAFgAZAA0ADgAXABAAGQAUABIEtAYQASIUOjfDBdMAsQCuPwFnAKUBA10jAK5/Ly8vLwE/pwUJ6/0HPwbkMQVXBVgAPSs5APa2EQbIwQuUCkEDyJ4zAsUKLwKOoQKG2D+Ob4kCxcsCg/IBH98JAPKtAUECLY0KP48A4wDiChUAF9S5yAwLPZ0EG3cA/QI5GL0P6wkGKekFBIFnDRsHLQCrAGmR76WcfwBbBpMjBukAGwA7DJMAWxVbqft7uycM2yDPCLspA7EUOwD3LWujAKF9GAAXBCXXFgEdALkZzQT6CSBMNwmXCYgeG1ZZTOODQgATAAwAFQAOa1QAIQAOAEfuFdg98zlYypXmLgoQHV9NWD3sABMADAAVAA5rIFxAlwDD6wAbADkMxQAbFVup+3EB224cHQVbBeIC0J8CxLAKTBykZRRzGm1M9QC7DWcC4QALLTSJF8mRAoF7ARMbAL0NZwLhAAstAUhQJZFMCgMt+wUyCddpF60B10MASSsSdwIxFiEC6ye5N2sAOeEB9SUAxw7LtQEbY4EAsQUABQCK00kFG8MfBxcAqCfRAaErLQObAGcBChk+7Td0BBgXAKoBxwIhANMrEnM681CwBZA6dyc1SAX6JwVZBVivuAVpO11CEjpYQZd7k2ZfofgLEwPFByXxdyMEo0sCU1MCdRurJwGPo6U1WwNFFwSDYQkA0QarPy8jBykCOV0AawFhH3EAgx0ZAJUBSbcAJ2kXAa/FAzctIUNTAW9ZBmUCZQDxSRcDKQEFAElBAKsAXQBzACu1Bgfz7xmNfwAJIQApALMbRwHRAdsHCzGXeIHoAAoAEQA0AD0AODN3edPAEF8QXAFNCUxsOhULAqwPpgvlERUM0SrL09gANKkH6wNTB+sDUwNTB+sH6wNTB+sDUwNTA1MDUxwK8BrTwBBfD0gEbQWOBYsE1giDJkkRgQcoCNJUDXQeHEcDRQD8IyVJHDuTMwslQkwMTQMH/DZCbKd9OANHMatU9ZCiA8syTzlsAR5xEqAAKg9zHDW1Tn56R3GgCktPrrV/SWJOZwK+Oqg/+AohCZNvu3dOBj0QFyehEPMMLwGxATcN6UvUBO0GNwTFH3kZFQ/JlZgIoS3ZDOkm3y6dgFYj8Sp/BelL8DzZC0lRZA9VC2EJ3zpfgUoDHQEJIocK2Q01CGkQ7wrFZw3hEUEHNQPRSZYAoQb9Cw0dMRWxJgxiqAsFOXMG9xryC4smqxMlevgFzxodBkkBJRr7AMsu44WsWi1cGE9bBf8LISPDFKRQHA0hQLN4RBoXBxElpQKNQ2xKg1EyHo8h8jw5DWIuD1F4B/E8ARlLC308mkanRQoRzj6JPUQiRUwoBDF7LCsnhwnLD4EMtXxuAVUJHQmtDG0TLRETN8EINQcVKZcgJxEIHUaRYJYE85sD7xPNAwcFOwk9Bw8DsRwpEyoVJQUJgSDTAu820S6vAotWfAETBccPIR/bEExH3A7lCJcCYQN/JecAKRUdABMilwg/XwBbj9RTAS7HCMNqaCNwA2MU410RbweNDlMHoxwvFbsc3XDEXgeGBCifqwlXAXEJlQFbBN8IBTVXjJwgPWdPi1QYlyBdQTtd+AItDGEVm0S5h3QChw9nEhcBMQFvBzUM/QJzEekRZxCRCOeGADWxM/Q6IQRLIX8gDQojA0tsygsjJvUM9GUBnxJeAwg0OXfqZ6dgsiAX+QcVMsFBXCHtC45PyQyYGr0YPlQqGeAHuwPvGu8n5kFTBfsDnw86STPqBLkLZQiHCTsARQ6fEwfTGGYKbYzMAS2HAbOVA1ONfwJriwYzBwcAYweDBXXhABkCowifAAEAywNTADUCqQeZABUAgT0BOQMjKwEd4QKLA48ILccBkSsB7yUEF78MEQDzM25GAsOtAoBmZp4F2VQCigJFMQFJIQQBSkNNA6tt3QDXAEcGD9tDARGnRscW3z8B22snAMMA9wABMQcBPQHJAe9pALMBWwstCZ6vsQFJ5SUAfwARZwHTAoUA2QAxAHvtAU8ASQVV9QXPAktFAQ0tFCdTXQG3AxsBLwEJAHUGx4mhxQMbBGkHzwIQFxXdAu8qB7EDItsTyULBAr3aUQAyEgo0CrUKtB9f81wvAi1uPUwACh+kPsM/SgVNO087VDtPO1Q7TztUO087VDtPO1QDk7veu94KaF9BYecMog3QRMQ6RRPXYE1gLhPELbMUvRXKJVIZORq4JwEl4FUFDwAtz2YsCCg0cRe4ADspZIM9Y4IeLApHHONTjVT0LRcArUueM6sNqBsRRDwFQ3XpYiYWCgoeAmR9AmI+V0mrVzccAqHzAmiUAmYFAp+AOBcHAmY3AmYiBGoEewN/DwN+jjkCOXMTOX46Hx8CbBkCMjI4BgJtwwJtquuGL2NBJwFjANoA3QBGAQeUDIkA+ge+AAmxAncrAnaeOwJ5Rz8CeLYZWNdFqkbTAnw7AnrEAn0FAnzsBVUFHEf8SHlfIAAnEUlUSlcRE0rIAtD9AtDISyMDiEsDh+JEwZEuAvKdXP8DA6pLykwpIctNSE2rAos7AorUvRcDGT9jAbMCjjMCjlg8k30CjtUCjlh0UbBTMQZS0FSBApP3ApMIAOUAGFUaVatVzAIsFymRgjLdeGJFNzUCl5sC765YHaQAVSEClosClniYAKVZqFoFfUkANwKWsQKWSlxAXM0CmccCmWBcxl0DFQKclzm+OpkCnBICn5cCnrSGABkLLSYLAp3tAp6OALE5YTBh6wKezwKgagGlAp6bGwKeSqFjxGQjIScCJ6sCJnoCoPcCoEgCotkCocACpisCpcoCp/sAeQKn7mh4aK3/RWoYas0CrN8CrKoCrWMCrP4CVxkCVdgCsd3TAx9KbJMCsrkJArLkE2zcbV9tRFsDJckCtlg3O26MAylBArhaArlDEQK5JnNwMnDdAr0VArvWcJIDMg0CvoRx/gMzbQK+FnMec0sCw8cCwwBzfnRHMUF03AM8owM8lgM9uwLFeALGQwLGDIUCyGVNAshAAslLAskqAmSZAt3OeHVdeKp5IUvMAxifZv4CYfAZ75Ugewdejl63DQLPZwLPaCtHT87vD5sAwqkCz28BJeYDTg5+RwEC3CMC24YC0ksDUlgDU1sA/QNViICFO8cS6VxBghiCz4LKg4kC2sMC2dqEDIRFpzgDhqEAKwNkCoZtVfUAUQLfYQLetG9zAuIr7RAB8ywjAfSXAfLOgwLr7wLpbHUC6vUC6uAA9UMBtQLuhQLrmJamlv8C7jsDhdyYdXDccZ0C8v8AZQOOEpmPAvcPA5FqA5KDAveUAvnVAvhimhiap7czmxoDnX8C/vYBFwA1nxifrwMFiQOmZgOm1QDNwQMGZqGEogEFAwxFAQsBGwdpBl21YwEAtwRnuw2HHq8JABNxNQAfAy8SSQOFewFfIx0AjOsAHQDmnwObjQizBhufwQCnBRG76R09PhZ4BWg3PkArQiFCtF9xEV+8AJbFBTIAkEwZm7k7JmAyEbrPDi8YxhiJyfYFVwVYBVcFWAVjBVgFVwVYBVcFWAVXBVgFVwVYRhUI14VnAgICCmRe6SsEyQOxBi+7uwC7BKe7AOdAKRayBUY+aT5wQj9Ctl91N1/oAFgRM6sAjP7Ma8v8pudGej0mIwQrFic2NX5t32rB8RnCLGkBa9duMBcFXwVqycHJuAjPSVsAAAAKfF59i74AMz+BAAMW0QblrSMFAIzDCwMBDQDlZR09JB9KQrFCvEE4I18nYDYnOCMJwT0KRD9DPng+gT5wPnECiUK8SUI7X8tOT2pNCixrVC9qC24fX+AzOhsJZ5sKYiMrPB0mQqtCvCvMAcv8X8kOHy4JCAkifp3fajotShfJq8msCWXBy8wKYEFfD+UQoxEAk40dRUIlG6ltOc44CjM/Qz5wQj8cBwodTEdsWywtWuG8Egp97R0rQj8cXQhKCQ4zVENCNwQ7Q5wsCoEbLUI/G/UIUyIjGDAxAAWPYfBeCnFkyWALYC0jbkNgGTkCGx5gswYCaxBlTmBNEQFk52AVYJVgfWCzYEtgkWgWFwa1DtxVqbxaC0MWqwG7K83BAh8VABwDHgF5AmwvMJVSgAGKCrhHGgDkI3SOCsoNpk3qAZsCh5xPBUBfAPf3BwA0FlcMC6UMJB+6r0eAgQw0ABUTnyuCCHoC0gtLZREbANhOBnUECh5aADEAtritAJQnCxZvqyQ4nxkBWwGGCfwD2e0PBqoGSga5AB3LValaCbthE4kLLT8OuwG7ASICR1ooKCggHh8hLBImBiEMjQBUAm5XkEmVAW4fD3FHAdN1D85RIBmpsE3qBxEFTF8A9/cHAHoGJGwKKwulODAtx69WDQsAX7wLAGNAlQh6AOpN7yIbvwAxALa4rQCUJy07Ds4CkBh7ULtYyHRyjsOlmw/ZFUkb7AEpEFwSBh/lAccJOhCTBQ8rDDYLABEAs+AiAQIApADhAJiCCrJrOS8AFABbG8YubHYqDcEQAjskHNPhHB4LG30CewTBCqrxbAAnLQ6mLs6hHAe7CQAQOg+7GkcczaF3HgE9Kl8cLs4RGQB9q9ocAuugCAHCAULz5B9lAb4Jtwz6CDwKPgAFwAs9AksNuwi8DTwKvAk8DrsFmAEbawouzqEqD4sa4QHDAREWOwCgCzsLuxC7BBiqe9wAO2sMPAACpgm8BRvQ9QUBvgH6bsoGewG7D00RErwBAQDqAQAAdBVbBhbLFPxvF7sYOxjbL7ZtvgNIqLsAB7sALrsC6w5WAAq7BAAeuwJVICp/FTwVuwG+J+QAsloBvSjgo7vIAAFbAAG7AAJbAALjAAg7AA67AgAbu6VbDr/EAPQAaPuoOwMBu5UnSwDn3Rm7CBp7CKEFCv9wAN+7p7sau6OLeXIG+6mbgwASuwYbCwG8AACGAG27BgALu6c7ARo7ugihnMoBuwvtB8CpOwDhewG/AADlABW7AAb7AAm7AGmLABq7GLuOaRX7AA5rAC5LHgAGuwAXuwghAA1KAcIAt68mAcAAALQADpsAHBsBv/7hCqEABcYLFRXbAAebAEK7AQIAabsAC3sAHbsACLsJoQAFygBunxnVAJEIIQAFygABOwAH2wAdmwghAAaaAAl7ABsrAG0bAOa7gAAIWwAUuwkhAAbKAOOLAAk7C6EOxPtfAAc7AG6cQEgARwADOwAJrQM3AAcbABl7Abv/Aab7AAobAAo7AAn7p+sGuwAJGwADCwAQOwAIPAAUOwARawAPiwAN6wANuwAZCwYWGwAVOwBumxm7ALobLgATOwMAaSsKAOFLAAI7AARSABd7BRsABtAAGLsAC/sAX7sAa/sA5IsBuwAXdgG8AAFyC6EABUoAbXYAB/sA5XsAHGseAXsoUgA5RQD+Bw0McgAoKnABpAUIXgG8XiMMCQdvS2xfKokfPBRiLTYDoQq0AdgAFgLRA24BdnJHUhQhA08CFT4BLAYDc0a8e1J6QAApADEB+wBTCtsAe5AsASsAduUNETJGAUoAVwUAAVABB4rMAHg7BCClAFoA1hUAlWg3H4sAzWuxAM/UFgjCdXMbGFYdCdEBiJCrIlNTTUgSPMKJ+QB/HDdAKSvgEZdPAHIBKSwwKUIZDwMwVQT3xe4AS2XcAGoCcQI/EXo6x3guNdUGBQAQGx0KCAwqBB8dKU5TTgi5ugAKEs0AJgABGgCGAIkAjjUA7gC0AOAAnTwAuwCrAKYAoQDyAJ8A0wCcAOsBDAEHAMAAeQBaAMsAzQEHANcA6wCIAKIBNQDjANgA1QMBByoz1NTU1LbA3M3QzkMyFwFNAVcvRwFVAWQBYwFWAUdLQ0VoDQFOFQcIAzI2DAcAIg0kJiksODo6PT09Pj8OQB5RUVFRU1NSUylUVVdWVhxdYWFgYmEjZmhwb3JycnJycnR0dHR0dHR0dHR0dnZ3dnVbAEDsAEUAlgB0AC4AYvIAigBTAFMAMwJz6QCH//LyAGAAj+wAmwBLAF4AYPn5qgCBAIEAZQBSAK0AHgCyAH8CPAI/APgA4wD6APoA5AD7AOUA5QDkAOIAKQJ3AU0BPAE6AVABOgE6AToBNQE0ATQBNAEYAVQPACsIAABNFwoWAxUWDgCKAJIAogBLAGQYAi0AcABpAJEDEgMkKgMeQT5HKQCLAksAwwJTAqAAugKSApICkgKSApICkgKHApICkgKSApICkgKSApECkQKUApwCkwKSApICkAKQApACkAKOApECcQHQApMCmwKSApICkRZ5CwD6BQOnAl0CNhcBUBA1At4RCisTAUo3E02RAXekPAFlWQD/Az1HAQAAkykeGI9qAClgAGkALgCJA5TMi/CuhFoFuisOwhEBndV0KgsEIzFsATNabAGyAN5+gH9+gH6BgoJ+g4aEfoWIhoCHgoiCiX6Kfot+jIqNfo5+j4KQfpF+kn6TfpSDlYiWgpd+2gLabOEC2GwAgmwkbKAAg2xsBEkERgRIBEsESQRPBEwERwRNBE8ETgRKBEwETwCWZmwAowOIbAC0ZgEFbADJUWxsAM9sAgxsAPZabAD2ARkA9gD0APQA9QD0A31ebNSEI2XAAPYA9AD0APUA9BxsbACJWmwA9gCJARkA9gCJAL4A6AAIAPYAiQN9XmzUhCNlwBxsAPdabAEZAPYA9gD0APQA9QD0APcA9AD0APUA9AN9XmzUhCNlwBxsbACJWmwBGQD2AIkA9gCJAu0A9gCJAL4CNwD3AIkDfV5s1IQjZcAcbAJDATZsAkoBOWwCS8FsbAJXbGwDnwLtA58DnwOgA6ADoAOg1IQjZcAGA31ebBxsbACJWmwBGQOfAIkDnwCJAu0DnwCJAL4CNwOfAInUhCNlwAYDfV5sHGwEPmwAiQQ/AIkGjTFtIDFs1m4DKGwDrAJsbABVWv4VMgJsbACJAmwAVAEAul5sAmxebGwAiV5sAmxebD3YAEls1gJsbEbCxxP/x5BApA0KYFA89AsjTx97EHmJQPyocItC2JnNFRCEnFU6SFTDoI0PxeRNRoNRWkpzVnWW8pTagkNmgf+jGupqZ3eu50LAFnc+OzfJwdub1AdpOy76VnijWNR/CMEevikQkFyQuLuPajxWi9chqOoMJ7qpCN4sx3LJG4Myu8kD68wC6+iAwt+pU1JEeY13rpCVkXSZfinVKn4xZpxsI3Lp8bJLrJ9ujkrIalMRBAcv/GSKEtowzcEn5XmJw2BagB8V2UWJoJHZ14SXhM7p0XeGFOuw6mlvyq99WYp5XxrO6ru9nn4RHcOkJ7hx5UqWtman7yVMLzYXQefQRUdIY70RYQE8+aAzCNSGQkXiHfnHYRMi+xczKDdZLk3AV1gzxkkSHLjBwuq8shIJ+/RAbqjqQbugFhe0rqklu432EERkM5k9y1DXzds46oLqKAx6OhPT2WiqEfhaITn7OF9Y694AmKmUvbpWp0xJqDaf3jeNJXnK6NpnGcFOmbclbARC+5+5U52ufw5b0Hh+2LrrNimvZe4eYmApRsZnJE310SqB+1xB6rSJfnV1f2D0awB18Oc0sXAFqIlgHgWiaZGdvP5CJUSsCTCQUC335+iSkwPlLJJ5lwjTSn9Lw22NbK1Tu8w+bUpHtDRDPho7Gun8aw2Jzu9i+N0Ot/kPMbLAb/rUQ82kfpk85qLDkfxLl39QPDngo72GYh/Xigbpcm1pA23D2ywt3D8GgMOao040wDqkHxOEx0OhC+ZmHiIdjK7yRbfJD2ouZbAedhD3p7s8WDmCJfNforgDYPGAXSI08fTjPZ5B37lc5VXGzc1vJmibDwBNVzXuaUzg7N5H4BxqjhJ+kz9HLUJys7bpBDYAPvbut13AwJCWd059tS8YTYgC8HwrkewBfa1LSSpmMr9uR2EekTiAMH+Mx4AGzgbquccwBDlLmRhgXL/YiLPCEb6d2k5qJ6o800qddABkpqt7NG+sc2uvHZwZs57W1AHTFM1KkMShasADAh2FvzbzJOzVDMS3ZlT2BSFKdnkZFB6JyqJbhm6XANis9TrtzJdlPVp+rl8v3nIke6Jou7m2TKu53Vounupgkz2LzrQPhhatLIG7rfF/gUKWp15X3LKt+ZvuCDSqPUigF9yJntimC1HJR7Yj/dUrLAXWrT+1tnwPJJLGKAlQ5VeNDWRKCTt2vz3rJuo4+gIt75/Mkfl/gSZblZ9r/SEeeosZXneli/xNh1WVCvkRt2RnyyjtMkMqhzXh1PVOCbILqv0r7rGYm0CHIyKdhHL90cl9E1I6eEtQTCt6RXj8M0HHrHCHLVRpNM6WIbT5BCMGVnL0o5895qSRbCJz+5I8PGMhAN/Xrj4BgIdlKqlHtBHqTJwmK169toZ2IWxNzrAbIG7zh85Q/LG2A4yBcaBel52zdunokB0lv3A7kXnTI7M6ZnfZ7nwuj5lkGhqSpW+w5CI/FmRlplBEbnZy1ZxS3DL8rf1YWhO5XivWZBSRh1gFsjjyj3qRG1cm/6ors7WsEif6WRxns1MKDZa6KrbfMQ/swIb+2nb0tqxHeii6FcgVeAjE/Xwac1owx04dJKG8R5YQgHNnEfHf0qb8WOnU0eQSjazq+IK7cSuCqYzPEUB/x+QgGZqM3dBoYvNvZVOHDkbgdilWdagqO5bkybXfLpyMPuGq8mvAAEZGbR6RwXGlW9ErOWTfnjfx6dXFJqBj0OBSGFz4lWQasNOmVJeN4SFWSLfOGB/7ehV5YuoNNROHZEG9ElVuMnqbDMMuDleOt/cN/gsWxGw128mwU8/HxkOKqdTZnI7dHka67WCTf/FmBrxpNCaKJ1GxBTCSS7MNfhNj8S4Gtotg6Z3AM9cAeVROnppUMaiV5jjudLnNqoVrKO1/FijLlAc74kxydxKX1RQuMqHR63eecYr5o6MJ+B78VsLlCrpelWh6GOrCOBIoQmIcdpJL1pwE2zzZqBkecGTdK8KMOB6r1eNRURyrz6M899TZaoS/vNOxHf+5gORU+OyYIcIW6diP25GHF6u8TNjuL/GJzCnLLXd01KrsjRa51v4+O/VIAWXESJxfxWjv628J+cWUQpoD+Yytzs3jSMRJ23/XT+vUdtUMLDQq1vnIoeg/GjWh88MT6k9dRqDaQ+vodilFgvjuNw5pJpId9mfwyYeLCGb3BmHXdfQfhfPRQaupe/f8TG4Bk3eDKlYBaEK3kZYNN2Sdxz47m/vYBxvIOKtnqplB1pebzuXmAr/MuzQCknKe653dzaWQQ7MUhWYWvzIZwLe1v0rXxImLaz+AkAu+sYikhouNF3EW6w4crZ6MuUiDbIAx8XhAfegcvW6x9BPb3/sCxGWu9YyatqExB+TSm69qIkI9IwhjrcnzME+jWBx4mNQm5WwLzUjSyY4FZ0aMF5YFlXUD4hL4XfOeYv5rDe2s2D/Cn+28fZ9UCnOQvXFMnQqfc0G+ZqOWWD9l/liqUPaNQzZjxCHpUAD8Rcc90MniQ02ugHWsUupFUvhC9usY7zNPt5F2jO7qgzhafsQSd50jgLrC6Qx6bpHbXR3WNAu1BzGmwbz+ebGmwTjdy006Y6zipP7n/OJlvSmbq+SY+nefAVKK6EBMPbce5n3IdRI8+vbxCpN53rw3TvgNds1SuMiuLGxt89L71mxPDeanGhyHvOjmO56tnVpoHalQnL6TqNuqKsHjHCIKB4pCgj4WyYPvRvYvqi5EMr7lN3MotPR/KH7JUD1lZbU0QzfbrEBJnuQiVAyAC9vwXWp2TRU1/0aapyAH2cbglEHVAdl+1rb1u147uV0td1eNoQZsqHrIMIYVPXtLk2TIU3cJE08PjoYNDpfF/IcJnYQHl6nsplczX3Rgah4NbJJHl//5scUufqsSd//kbIS406ZWoMP//+jhGUswX/5nVNz/jAj9KmXPtAmMiK+khhbn1w/mELzZMT/WxcW//y/jsHaOM/61oAW/CjYhJtY622/TtMYuP7bilBvbiT3vB9n8IcFPnwM78H0KfhYDRdY5PhWJ4jWRQzB+HT5NVZV56LG82hcQms+jOTT/c9Y9sx5rPi1/wB7f/+c5UfUCKk3iwwCuywUc2MGnAwsXf1E5hoI55x1Q/Qby+sWH8NRjavZ8VaDsdi1NUVhH86BJHX1yaFt1w1OYeL5LVmdN+5Q+KuTvXEPDzUCg6xp0HhsUhTWSe7MZMM/6rsTUb0/nbUE3YQlGGt48kT1/6cnf6yHnvHtQx9EosOXN077yyEq/jE3YTiG/5SEJmXFeocJJ1EAd6vKeK6VEdJLOZ1km/EwOnZWCQpzCLKPHxrfh4yJhGq//2dos2E/3+MOcdW5EsgIdmTQUQetzRy5fQHhDBl37XbWzsqO/cASEDjyst1/8NEROqVAxWnddQV+umJ8IrKVgKvGaTc0GsQ4s8h0Osql5QKwlddPDjJhKInyWqYUKmmlIts+FIcXZ6yM6cljbsjUG2ksSOkuIw4sYHffRNgBOLApvD6XrR6Rt0rV2Uf8IpnIUVnb9Twt91QjAaD/dStSWDxg7aYY+VXIgnuowYdOkjywa2hlgrnI6PjaU3e3UjQ5Yk5mdIJGyHnv3/P+1EkMav1yFyF+FeJE/RXnWBw+Nh0aOo6TGlKX7d+dkP9+brvr79SdtXJtcD/aXBGiMNfG6/NQniQHYQlK78FEHDqOh+bDI0o+2Ub0h53EL/vlzjrBczVEZz2bOtvIL+DIzDkk9nCWt7tlqsq3l9JMtJk3r5HG2iJ9b/X11TG6wwMAjHLQ2oasaMEsydh88QPvI+hmqIHhvalpKoKOueJR0eZ9J8G2alNOIOy98jwvbc87Ewk9d+5G/tUijTmlbjFlDKXV05HalKxaRTrucc73On7yzAPS6f2v4ogiaWyWeV73dv/MsQT5HjRrsYV9dLAcI3T+zC2qEVINyNpEhoKV+xVSuWtT4AhBfpnZ7unIM+HX3msI0HiI+P+z2PFgkjGi5PqEbG/wNIWeRUjPtDEgbbubN+I4JaDLrW9borRBDob7ZFx+JdKeFVUKVeWqb/c88Ol7DhM0suLtuEd8tkDSMTD3DFx8UphPINHMHi51hAPttXL4Ektt/lKEUG/R4qZKohHjVpAcPIMiHyWr6xR8/EWnNJvBFET76yCdk5er7ADB/1bgoImhpSiZ/omZjPKPCEeZsOwvPmXL+1vlJNeGO3TzySmGA1X6e58gLrazDM71jywM1XL8zKHN6G3kB31Y8vLtP982N975SZXk2JwDvmv7AY/aDsFFk1v+nE7/hbvuOWhBH4kuemeYozPk2K22Vx/YGiDTLU7YilpOt29u3RZMBh4UJjlTP5ItxTzWv6ebL9b+GSU1Vsm2S8LMfVfJczaBSqE8J1A4YUjpsALL7++bwCPXFhaufdpDFtBlHb9makeYbqdg9ltvK/HwF/rNE6KrtWUkEcxmTB7Iyu5TiVaIgW/YxzQhpArliIMkOoK5L7ShVtF+DYqV01mk7fwop04hQRwg4KFmr5z9nYf05VVqkSe7gfnx5bxxlQ0qEV0jiwzf064qG11iEqjHcUgDWWsDs/LEGlzX31T5KVL+7D4EoKim7HBagiqRo5JI3WfDBgpKIruWz9j/J6Hp5Q/EJbMWB8NeSMuFarNw3AEYPBJtYQO/4oD/ZgPTSQ06di0EeumX5EbrdThO+fvYEVSxLtZ3AJkee0Xn0sDwNtiiZhJjJRDuG1YRKB1vOulfd9JjHeyu+UHTmrtra/pm+8Rixh4WKiLaLOCxIbZNoWRZSyyUGLPjAaAo+SQBpfO2uruWrzFxLlpvrXJNMCWtlJDKGAnlWK5xpU2tcxXbeD+sbdfwYXt/qTwDk6UqXR/aUt099DhSNl4Nk8mXwpw+b0nvjKOG6Mg1PRXjrMUMANvNgEArv8nMJs3vj1aHi8MHz/UfJWWzkcrSpZTNBhduXlGR7i+ip/THDp5R9KRNcDKECgtwgXg4EFN5HHfikP/XvsoCkHTg+NbsD8Gl6eknk4Arwn/BWGJ0hgW0/gUKrzuGZhub7igRP3abetpIm+24xEOlWl3YKpm2qTBFvX8ddDRvm1LcwnCJuEfZx12qPY9TrntMIQsv316zvpyWnyStX8VU4j6tQk+CWlLBUCJR6MdH9Cp7g2qdn2WM9qFbREmejH09dlWEPm8hPF0L7RxwRRdiCs0DP8ewk6ApoELkKU9hckSdbnXm8UHJmaNXjxv/q0fTTpu8rnl9lN0vQCpDRbCtcz12rGRFEA7Cfg7FhZn5QFkNmv1ZURKEsiZce1nS9K7HrwpC7yJV4Xt3eAVbLJfoXHrtwG60Z8gwaSnmxoL3s2ZlRqggZN/MHo1oUS4L+GwObFI596Ld4Mvi8l+cQmF1gJpkpnDio7TuO35npaMHiWzFqPSX3qNgkIPGuX0qGYnPIVsM901Yu8oZnOZOY1TbtIdFUNKNq2dP8SJ4F/VCEzIjF0/Rh+7UrZj80tC6rognVH3mqa8eCs/lcQU1Pjj98kBmAKDbZUTwosv02UunRR3n0X6c+f73mtwB7/WbQ16gO431EtwZbNG1SM4TZPBnsQSESlsfG2JLQXx5xWf4bmQ/xcVCPISAX5897JxHKLD/Xkgu57+ABR2+MMtEbX64+MNlBHpKC7sjlWVEShf5qA+dGc59LFVlZrX/Enq9z/v+wnZ1HErmxmjJjxOA+hAjVUWgtq6ygAi/8ewJDjUMFw3zhQFtbyTLDPFd21Ji5S5QPZo9nMSxdg1+DGFSN0wlWt7XeYPbHqLfliV0J1kOhQNp0VbUPy0MS2Ms66OxtSWvaULaWHnfAA+sieVVgtjDwN3nKonWapkSKRN8BKKJQpCfqo8RQI5udhfu5s5+7vwsppmAJDgz2GNA7d43VdbV2l/SrvEu4RYslmNJmfSOVbssxAhSYy6WxpIQdDB0FVBpZ6IM8yr81QN+XLZ3n/wed/R+s6LslkxKbzzst/GkRbe6rFmtvJCwr1T44ETM+IMgOnjUO0eG6a1n2w7lwM1oFBvzMUWRkNFOvKcx3oSb5XdenZ5dXsute6nkRypBiSdAtA2fxAd8UdLOZW/MB7fZoEuFheQXijdaF8kuaRZoSeWdKOkKsGYEGaXfaDKTu0WMTcLniQs7KRCz9iK3SP+Y2xIjkfVGqFLSQ6vh+A1u6FdfwXsv1VPMfi2cxmdM+/xTgMXEyo2ZGcQ2YmPsghnYdv2+z48JpGZA4tUK1p1q2VdVxyfypXEXcrxKKtmt8UdW7sHWmKMqDuBBM3J/JUQx8eUYN4pJ5oRqvdiPHU1o/WPjiKvnlCqOdyxlxF54L9PrtLD1NejZ9aZDivVr6ZfMFK1/psVygoPIAnphcJWWb9+5IKMKmgRQULsTPZi6Bw4wP32zVEoKcHpP73CkFAqS98nSaGoWDjDJiaACJn4p5o1jq9R4Q4VcibhXF//LHP0bdf63kRVZdRbbhGe7sDQcyWS5tpkfeYHnff25WK+4FpzLlAcbaKmHdIBqOw3fImx1uqQIADH0TyHzFlqTG6nMoY81svP0T6BIyELMS8tMe+E1p6TFP6sVpZa6VNaTumufD5aj9goRa9SAmdJT4HhI2r0egj8UrgFb8L59wGLnYlzkLAiUd3m/WWIIEU61kPoEjd3gIVy/fiBcgqQqHnoXpL0SqLGdGGgn7DQeVMSYWHfjno1FngIKP9cjYaTlcRP6bZunjHP13/lbVm4awti894pTf/ZNNqr4OR+tDVie/m+rC8QpVnRbsCMPukOH87B2jM4AG6pHuXl1x9SiKdhYJVOhfo/+SCaGjUW2CoogL1FFhFGN9o+acoVLl0SXs/3vrSccmZeAF3NewFuOg/P12QYKQF+SH+KYcNnsAhIAELPBUgre/KRUJEA+KPD0MHRjv+3J/j2Z23MuJmkfy7leWcMsti8wXLSHgXFJTaksx1Woi6oljwxFVIJG12SBSZLNJDbXMYPekmiXT4FclKI35BFgqnYpKfcsr+f8HUXQoHJ9UYZ4J5YMiHHyAxg6eidhodgqJ2Htf/xYEx+G0zXchuzlt8hcAl+AT8NCQ4orFc4DerabF1enA7NTLnvtZh3FUwqIOvY7Q4DYmoDHwXTSw5UNNh6r7j0B/ezMYJMDcw4+6gCTZX4YQ+7Xs8de72vsR3cmfpxIX64/6KR1p3VX4F6vfHEzxzarh8aDH4G1DFoBBM6npXFpK+Rh+WrcFclAeAxi0PoaR9CpOxxGLSdvxKVSw8oOOanG/soKImRopN38AdcUhhM2GT/PgQeSQrG12njuJJD5Z7vWfAZmFybYLdSA91kB4aoBhoj1Z//KNIVVujqaLLRwCkbyn4vh0739C9V9iSjybeOIeSOvNs7LW1a7EUtNoKAnOGML4U8KBXpfrw73WjAszJG4Qscq+Xr3kZWR4Omm0xT6qE9y6FNSpstV4onMZSqCEJ+3VX9qjvdx5QVrM0WXxmPZxejdfnihcFAjzv5PjlTl6ickDbHe6+Lch52pjOPqk+m3RZ+bh2JSMGtFBuODbMchrpRVlt16NTQ05Ps0IDtWlUmWfP2vX8M4YDynIuOZ4Ck91+591B98Gw9fw+yQogTR8CSg0zaJu+rlBo/mr3A+1NziF+kdubz+whc857AZt6DwIBIF5+5yiaaf3ByQp1Fm3sOkZDAzwsYSQTM/Kv6idkugF63FDobDdUY3huruU+sCaBuRR+HmOowvmZoBjZHNh77SXFtmY/oOUE7ifN7nBHAo83S/xvcS6H4Ci2u/9Id62Wv6Ui+zMNLAzhfkTkVcW2BwrnYvpur0ZDlzs+ZLsmGTWvd1892t78gx1YjEJusGcxphjLkV0UfAKlekfSBVWHE2ahk4AbbRmHyL7GYdtKfdlINwrcdJuf3Cee1nfUojDQn/YmItESOFhtLzrkEv4k2XpMU9oaJQ3VUC+1INh6BE68pkHameGJm4Gvdb24Q0fXWxd9Tp3A9mzFSe4qXDGGDIV4AAGV1jIDfveknH1TwWpUT6HiQxKP3AAHJNkJeRlj/mXBmS4S1j8FK6YmpK7jyyAiRbsMCCLoJcx01fvgpMvKQRxu9IOwymconQjD56g7ksOrcOeoTbius4JnGesAS1DtgdaophYsw1wGIsMS3P7K6doE3K5czznqPQLSRRF/Ylzb5NtSKsL33SgskFNCF4khn5LWaDxI23ZRi2hzqN8uW8UzZEBYy68+VtGLSymQrXGUlr2nO2BbBIT5Vh1RmGAyDXaW0FPrpx3wv2UYdFk9tSl+906bMxCuXQaKDQP/U19UEcVGK4gmksL8lAorxQSAOwpeYX9xrZsh6yoGaL/X5O3tgQC8OM+/GvxnW9XvAtu/JxAigydfSmZfqZfg1XOcHNOpLlN8j64OZ36l5qawDBJ62YaTvxeNmm5gowCdBosgcpHOgNgwA+sknN8XmsR2IYChcafl9bGNMZ/nB5guWuvEziv6QI2bP2DtyKWG/qUjZMaxy+wASkkVGtuwGtywkTYG6MYrZBo18vYcww48G/+f+eITA/qMwbLlJC0S3+/ai2pPvkOhRRVmGTuSupaxhIk0xoXLtixCxSAn4Z3OnUS3wBqVscLI4P3GP7i/6gxYsswsVmkvDXFLhO/OKcur8flegCSKiqmVpIRvCzgbjEA0mXPn+RExXY/2OE1f/BYuWpRQY8gCDpMOYBx9Gn4tL3hihSIR1ixh2PIIT7cr2gUJbfs76EKYG52Jk0UZF/PQkBxGuFCEWXnG6ue/hTIqjTRq1sotVrKrwIGHDrITyuanUzbIYdgdEeV88K1VD82TYB2B61Ft+tB1KqHPmT9+hWoaV+iF3SuvtJqvnoLaA8wxrD56AUMULEgzO9SvBcBAfqz/dzMYzwMt/YLszDbmGe1bcHHfFMcvGql9bf/tp+Hrj4q18aNnftGjmXTfws39emn7/5IBxog9MrmftAA5Oq4awenm8HimWO72dwVlHcHmutVMdrMHw+p2vzpzT+B0iIZ+IEpplwWhClcXlxhxAsF3CHRnnaUEqq3ByQ+cqhe5SvR4SFxh/LZoQwtj8QZQGT1BzY2EMpYnUcZWQEPlwFZw+7UryK9qV8KgruYsvyMoK16KI2sN4SOblrVwhyiL8+IBZ8cpUhsJQSU7TFHAi+L2F0sn0y+FtDODlnuif2Mba8QddPZYYxjTsIgkMe3M6+7kXxUfZvbCUlyq71J1eNczGk6Vqw6rSx2K3vM+DjLxDRGzWepTO2qTT/W8S7u0QXcyFUahcB4vq8xCYTpy8iswtnyz7Kx6lgTEQJ9RqkgEIN6DOUqB0uRdeYuDa7AP7Zy9z+ZlTsmVR5vtV71m3dmdtNeWghbr5PnPJtjXAzcvZjxyV96VEx/B1TA0IEQSI50ywGuIbmAYdQg/l/rxhQLX+6uOLyFsaUt6mtjpAJkLfehnB6MlOHnNOrWLvCBqVBS07jcM+4RzLEed3f3/0Xwp92U+nataNHyEgnnuYR6PXEjRLETz0xrt3UglfK7Bn4aNlXG7cZco4lMziLv5+Mh2JCww3mz69Z9ZMRR/xv5EKJ38IFxKd9dw5CgPIXja/gzAshMbF14/qBIgNkdUQeP8YE7SrICGtiTnAKTyA9cXa3OauDHxZOdTP7yuYBzD1UcHstIO16FxF1bRUAlSkszI83YufTchU8OPnnozDl9bS0y6CnnjGwgj9M61cXcZsljjhLeT/Vq+30ScN2PcT/dOoxUDqDS38+OpCCzLDdnwHQc3ECQVIkaxmdPaZTSdfp2jjGzSdNLM5yPQsgJDl+ZnhclDQi8ltUnkqWJ323IvTZPN8rn0+EshL1cx9PiaLTzUsryn9Zp2Nt/detUAh4N/2I3dlMQqjHFxSihv0uykzflq5clMy2ZBaxoEb0/QMp03IQQus3vnZd/NOmSsmgqXqKFP3ozyDgY7RQS+npabe/hNG+5sa5FtvL8v0uYuag2NewYkcol3TOTadpuncCnDgOGpmLnTQ1PEPUN2cNsrW8LYfIv+hzfb7vod+ipXHzmbgj5Fzc6RcT/5PD7VQ8nTJBNj1urkVUx9uJvTWmqY08OC80rGDLaWXv243VB16gjt4Xtwp5H2UDR0LiKW24Ed/sOO8jl1yEU/XAb3h7ScKnCFy/V3sICrkY1D0K9fSokHIL0s5/7DLShLAPXRbV7fbv4qj6OwHC9d5PlEOX3LRpQ3P7hcSAKlIKPDM83ypz56U5+rJeo0cyUtC7wltL8wqEiNSgZsDWzACc7RFoZqhlD0+sihIBQlkQTXmvUyIOZhkQX2zqME5VRC7ms1sa3CY+odMn3mMBiTvCMKnnCxg5ZPLq4GUDB4jF8Br2K4x4sxfWjGXQatJ25I1JyrIv2Z4bP1jKw5C+B2/s0v4dGUOsaS6IPIQV3ETQ+F2fSl2BPBXHzyYN8VmwWIrKeMX9pyGWuAOVXwkxJsRBaBVzLhZDP8ONGncknL5DpTxHN32GgFWMwsc0GmL0oRDmRT8u2lvjAKUIi0MmXhIHSlFeh3Qh5pP6ap4YUd6b569ZIaHgya2AyD12cPxY0In/PBjzDctTaKJCU+xc6m9RkNLDEE8guvxtJP8sl8N9bLqw0F/qejaBlcHYqw31zYpsutQp07hsP1vhGdl4hJ1wA7OCsAHnKj9879uSHILEmuZ6vI1lT4tvnWCVKZhhYrWHW9oPKPKpbOC6FTjf/OtUvwmiXr2ykvyLzHGQeyS7BenZpL3N/CaF5T7Gkml7JXN5cj0PKaDpZVImD61FuMgFHPqSHvt4Ej4KBdAfdcoO3AjQPLwwtKsgGM+ty4lNZMBEItJSRLunG5ckrM/BeoXWoPZVvEoIzLgFQYPupMwZCXis4W2SCJ2zsefZqCj+aTfSq1FYdUj2UeJALvVTf7vuuikOE1Hit3UIAGUi/sqgMum9vw218y1FlY/9XnOji9nqhGAcMYICc7BiqLZj5N+cKEuSAuiyWbMg81ZD1lHovy/we2eaCcCv4MzEW3O0mVA/t2xdA0cxTVbXmFhn+tARDpvDz5ftLr15OAAmvo2QiAky+feVO4bGibv2nlBmBzqx0lEDfEm4UnEs11pbnwZlJ/0Y73/wBPYfTNZiJKR73TzdCW1BffiJq9bLjQmaKnU0+gN8sfe25IKSUCooQwxePDrFn3a/zUgWxvPoTYVXfobY/GV2qqTkeVDV9D8657fhY0/wiaJ5NfLxhXbE/naxs34N0hd6vxNfdm1TCnozm/NKSCThchoYgMF7Z2tzXFovRfsNVkf86JjrM60r7UIuV3bsmfrMOqzjXjN6HPBG25zCJ3QLueySbj9oFvX/HxWBqh31PBPxduCVAxMqC9HK+YL3oBZqBruoh6LKvdMqoz0PYXUBrwbiioyE8Tj5ImjJmiOOWLbAZvIZ/l9rIPljx3T5glJ2ewlfuIT5GlodQsAf/IEtmYkML5SRQGxxwW+rlZkD8belJNu09Itwx9xDULTnemVDeojdbgcd2gKGM9aO00Jivtbs7ZyOSE8IPh98GfvatD8Ud5uHcZfAfMiPSlIxd4UqeSDzuNfbKDuFepkyC/s3j9fawmhY1b9NqDi0ZS5eP35l7rL2eK5QlWLlyCmxx8AFaFiTuD2pMUxZV5mBSJuJduOaq2ZrWpu28DE8jl/hisBz7bGWH6qLF0ayWNq1Sejtcs8KQrQqJk5P9QHDYHOIolgNsMDmEaWcTelghbfFCDqWrq6YLwDWy+m68ec5nShgq2fduUBpQUuKKKgnttaUX9PRfMmxqJyU7e0RLr1bev+ge1KK0bZyhHKKDE8gQX9Vf7rNHWOxBtZcxwwGusyMpH77qWZxXsQmbgIGhtiO+gSSRCyu/ek+OFsz1HMiQH0IHV7PjJi3dszYfFp8ue9h4+AfKte4MTiehPvxNcm/T1t9vsFZx8rHN5ie77r2jzZOq/Em4Q+H9sNcZakf9HnzCc1fJixppxP8FQABmVnqa6GbJhwaka7WH7Wdoz1WxOjSNV8N9sgW5S3Ppgkut+TTCkjA+AodUOk1KIR+8G8S3WrSZG4nyqfJ6FEjXl6a/LEoRMHZUqfPRWvwqrtXYy9IUsmUGzkqi76ib4NANCe5DnyOxnFRZ9d8FdBVBjra3iNuZhJuWW5Omi/hBigqDsg0mu2AhfJDXdwyMIJ33HHHPfS2JtjegRejX11m41TbNL+Qp7mR0g9CPKTj9PIjuSycGN/YPozXI4zarXuAeLv5CHKtKcJKRbd6R2oLNiEt0T8+QIVJH7zt9ncKMgd49vV2P1AyScZ9Qzbu3m3LBnuu6dw7aE0b6r4kzVkI/GUS88mA53L/rLtntkFlZXGtIoqNP2mD3eVv08AVVPT3wJn81zpbJV9SuqZ6Pd1ge0Zz2RFHeCdV5CLPftH9V5o9+VzFu4R0QeumqDwUhXn3IyYotdJnxr1l3BqWnQVAeDBEOtPyJQx1q5+mODiClXtYeBLTWtsJ42AMBcf/IFIhpfhYO08hsg0Ik+DpQFNOKReK3o3cudkxWX0soPtI5eSFOA6yNylS+IQjrQtYQ/5s4UcixJfokumBUjpH9ofSjUTwPCapGFndfqqG5IHeMMvfg+88SXm7bNyjk6pGKzL+WxDAdqKtQ72WWVbOk3I+ueGuammmB2pvFZvqIcU/lvW3n9+r2lycnQLE4OX9R1jIgW4cDjJ3v8dAa66mVcfC7ptCr5io6mCaA9qI9T9FFWqo1ZAaMxgxAu8aXqmaOYryMND2sTUfoHvxcYK7hEiJhCLYFDx3PBhE97c2a0ub1/ePJcyJOqr7UaTAPTJ+xvZtjb/40sloY1ltRnTkWILmIP2b7S3AdXCR+YiArMUHwdncpjpyDGfzqGOUoAuaamWzAMacQtb34/M32FEgR5lUEf8fRzFrZUhzQj0fR7/6gdzdnVVvcSneLmtqJ930VCCDORY8CVdQWdo/S3PNkX3pQsPVKWIYGAMrFZoq8bQ/OJBDSXP7KSBdL3QN0Zqd393p6VFc7DnlnFiN00SY5Nux7yadeIM0Upl2rVsu8/VAI";const kg=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Ng=4;function tI(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let N=1;N<n;N++)o.push(i+=r());let a=r(),u=e;e+=a;let l=0,h=0;function d(){return l==0&&(h=h<<8|t[e++],l=8),h>>--l&1}const m=31,y=2**m,w=y>>>1,T=w>>1,R=y-1;let O=0;for(let N=0;N<m;N++)O=O<<1|d();let A=[],I=0,B=y;for(;;){let N=Math.floor(((O-I+1)*i-1)/B),_=0,D=n;for(;D-_>1;){let K=_+D>>>1;N<o[K]?D=K:_=K}if(_==0)break;A.push(_);let L=I+Math.floor(B*o[_]/i),H=I+Math.floor(B*o[_+1]/i)-1;for(;((L^H)&w)==0;)O=O<<1&R|d(),L=L<<1&R,H=H<<1&R|1;for(;L&~H&T;)O=O&w|O<<1&R>>>1|d(),L=L<<1^w,H=(H^w)<<1|w|1;I=L,B=1+H-L}let S=n-4;return A.map(N=>{switch(N-S){case 3:return S+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return S+256+(t[u++]<<8|t[u++]);case 1:return S+t[u++];default:return N-1}})}function rI(t){let e=0;return()=>t[e++]}function S1(t){return rI(tI(nI(t)))}function nI(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,o)=>e[i.charCodeAt(0)]=o);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,o=0,a=0,u=0;i<r;i++)u=u<<6|e[t.charCodeAt(i)],a+=6,a>=8&&(n[o++]=u>>(a-=8));return n}function iI(t){return t&1?~t>>1:t>>1}function sI(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=iI(e());return r}function Js(t,e=0){let r=[];for(;;){let n=t(),i=t();if(!i)break;e+=n;for(let o=0;o<i;o++)r.push(e+o);e+=i+1}return r}function P1(t){return Ws(()=>{let e=Js(t);if(e.length)return e})}function O1(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(oI(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(aI(r,t))}return e.flat()}function Ws(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function I1(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;i<e;i++)sI(t,r).forEach((o,a)=>n[a].push(o));return n}function oI(t,e){let r=1+e(),n=e(),i=Ws(e);return I1(i.length,1+t,e).flatMap((a,u)=>{let[l,...h]=a;return Array(i[u]).fill().map((d,m)=>{let y=m*n;return[l+m*r,h.map(w=>w+y)]})})}function aI(t,e){let r=1+e();return I1(r,1+t,e).map(i=>[i[0],i.slice(1)])}function cI(t){let e=[],r=Js(t);return i(n([]),[]),e;function n(o){let a=t(),u=Ws(()=>{let l=Js(t).map(h=>r[h]);if(l.length)return n(l)});return{S:a,B:u,Q:o}}function i({S:o,B:a},u,l){if(!(o&4&&l===u[u.length-1])){o&2&&(l=u[u.length-1]),o&1&&e.push(u);for(let h of a)for(let d of h.Q)i(h,[...u,d],l)}}}function uI(t){return t.toString(16).toUpperCase().padStart(2,"0")}function k1(t){return`{${uI(t)}}`}function lI(t){let e=[];for(let r=0,n=t.length;r<n;){let i=t.codePointAt(r);r+=i<65536?1:2,e.push(i)}return e}function Gi(t){let r=t.length;if(r<4096)return String.fromCodePoint(...t);let n=[];for(let i=0;i<r;)n.push(String.fromCodePoint(...t.slice(i,i+=4096)));return n.join("")}function fI(t,e){let r=t.length,n=r-e.length;for(let i=0;n==0&&i<r;i++)n=t[i]-e[i];return n}var hI="AEUDWAHSCGYATwDVADIAdgAiADQAFAAtABQAIQAPACcADQASAAsAGQAJABIACQARAAUACwAFAAwABQAQAAMABwAEAAoABQAJAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACwANAA0AAwAKAAkABAAdAAYAZwDTAecDNACxCmIB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgPi89uj00MsvBXxEPAGPCDwBnQKoEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJEMAJpIBpob5AERSMAKNoAXqaQLRBMCzEiC+AZ4EWRJJFbEu7QDQLARtEbgECxDwAb/RyAk1AV4nD2cEQQKTAzsAGpobPgAahAGPCrysdy0OAKwAfFIcBAQFUmoA/PtZADkBIadVj2UMUgx5Il4ANQC9vLIBDAHUGVsQ8wCzfQIbGVcCHBZHAZ8CBAgXOhG7AqMZ4M7+1M0UAPDNAWsC+mcJDe8AAQA99zkEXLICyQozAo6lAobcP5JvjQLFzwKD9gU/OD8FEQCtEQL6bW+nAKUEvzjDHsuRyUvOFHcacUz5AqIFRSE2kzsBEQCuaQL5DQTlcgO6twSpTiUgCwIFCAUXBHQEqQV6swAVxUlmTmsCwjqsP/wKJQmXb793UgZBEBsnpRD3DDMBtQE7De1L2ATxBjsEyR99GRkPzZWcCKUt3QztJuMuoYBaI/UqgwXtS/Q83QtNUWgPWQtlCeM6Y4FOAyEBDSKLCt0NOQhtEPMKyWsN5RFFBzkD1UmaAKUHAQsRHTUVtSYQYqwLCTl3Bvsa9guPJq8TKXr8BdMaIQZNASka/wDPLueFsFoxXBxPXwYDCyUjxxSoUCANJUC3eEgaGwcVJakCkUNwSodRNh6TIfY8PQ1mLhNRfAf1PAUZTwuBPJ5Gq0UOEdI+jT1IIklMLAQ1fywvJ4sJzw+FDLl8cgFZCSEJsQxxEzERFzfFCDkHGS2XJCcVCCFGlWCaBPefA/MT0QMLBT8JQQcTA7UcLRMuFSkFDYEk1wLzNtUuswKPVoABFwXLDyUf3xBQR+AO6QibAmUDgyXrAC0VIQAXIpsIQ2MAX4/YUwUuywjHamwjdANnFOdhEXMHkQ5XB6ccMxW/HOFwyF4Lhggoo68JWwF1CZkBXwTjCAk1W4ygIEFnU4tYGJsgYUE/XfwCMQxlFZ9EvYd4AosPaxIbATUBcwc5DQECdxHtEWsQlQjrhgQ1tTP4OiUETyGDIBEKJwNPbM4LJyb5DPhpAaMSYgMMND137merYLYkF/0HGTLFQWAh8QuST80MnBrBGEJULhnkB78D8xrzJ+pBVwX/A6MDEzpNM+4EvQtpCIsJPwBJDqMXB9cYagpxjNABMYsBt5kDV5GDAm+PBjcHCwBnC4cFeeUAHQKnCKMABQDPA1cAOQKtB50AGQCFQQE9AycvASHlAo8DkwgxywGVLwHzKQQbwwwVAPc3bkoCw7ECgGpmogXdWAKOAkk1AU0lBAVOR1EDr3HhANsASwYT30cBFatKyxrjQwHfbysAxwD7AAU1BwVBAc0B820AtwFfCzEJorO1AU3pKQCDABVrAdcCiQDdADUAf/EBUwBNBVn5BdMCT0kBETEYK1dhAbsDHwEzAQ0AeQbLjaXJBx8EbQfTAhAbFeEC7y4HtQEDIt8TzULFAr3eVaFgAmSBAmJCW02vWzcgAqH3AmiYAmYJAp+EOBsLAmY7AmYmBG4EfwN/EwN+kjkGOXcXOYI6IyMCbB0CMjY4CgJtxwJtru+KM2dFKwFnAN4A4QBKBQeYDI0A/gvCAA21AncvAnaiPwJ5S0MCeLodXNtFrkbXAnw/AnrIAn0JAnzwBVkFIEgASH1jJAKBbQKAAAKABQJ/rklYSlsVF0rMAtEBAtDMSycDiE8Dh+ZExZEyAvKhXQMDA65LzkwtJQPPTUxNrwKLPwKK2MEbBx1DZwW3Ao43Ao5cQJeBAo7ZAo5ceFG0UzUKUtRUhQKT+wKTDADpABxVHlWvVdAGLBsplYYy4XhmRTs5ApefAu+yWCGoAFklApaPApZ8nACpWaxaCYFNADsClrUClk5cRFzRApnLAplkXMpdBxkCnJs5wjqdApwWAp+bAp64igAdDzEqDwKd8QKekgC1PWE0Ye8CntMCoG4BqQKenx8Cnk6lY8hkJyUrAievAiZ+AqD7AqBMAqLdAqHEAqYvAqXOAqf/AH0Cp/JofGixAANJahxq0QKs4wKsrgKtZwKtAgJXHQJV3AKx4dcDH05slwKyvQ0CsugXbOBtY21IXwMlzQK2XDs/bpADKUUCuF4CuUcVArkqd3A2cOECvRkCu9pwlgMyEQK+iHICAzNxAr4acyJzTwLDywLDBHOCdEs1RXTgAzynAzyaAz2/AsV8AsZHAsYQiQLIaVECyEQCyU8CyS4CZJ0C3dJ4eWF4rnklS9ADGKNnAgJh9BnzlSR7C16SXrsRAs9rAs9sL0tT0vMTnwDGrQLPcwEp6gNOEn5LBQLcJwLbigLSTwNSXANTXwEBA1WMgIk/AMsW7WBFghyC04LOg40C2scC2d6EEIRJpzwDhqUALwNkDoZxWfkAVQLfZQLeuHN3AuIv7RQB8zAnAfSbAfLShwLr8wLpcHkC6vkC6uQA+UcBuQLuiQLrnJaqlwMC7j8DheCYeXDgcaEC8wMAaQOOFpmTAvcTA5FuA5KHAveYAvnZAvhmmhyaq7s3mx4DnYMC/voBGwA5nxyfswMFjQOmagOm2QDRxQMGaqGIogUJAwxJAtQAPwMA4UEXUwER8wNrB5dnBQCTLSu3r73bAYmZFH8RBDkB+ykFIQ6dCZ8Akv0TtRQrxQL3LScApQC3BbmOkRc/xqdtQS4UJo0uAUMBgPwBtSYAdQMOBG0ALAIWDKEAAAoCPQJqA90DfgSRASBFBSF8CgAFAEQAEwA2EgJ3AQAF1QNr7wrFAgD3Cp8nv7G35QGRIUFCAekUfxE0wIkABAAbAFoCRQKEiwAGOlM6lI1tALg6jzrQAI04wTrcAKUA6ADLATqBOjs5/Dn5O3aJOls7nok6bzkYAVYBMwFsBS81XTWeNa01ZjV1NbY1xTWCNZE10jXhNZ41rTXuNf01sjXBNgI2ETXGNdU2FjYnNd417TYuNj02LjUtITY6Nj02PDbJNwgEkDxXNjg23TcgNw82yiA3iTcwCgSwPGc2JDcZN2w6jTchQtRDB0LgQwscDw8JmyhtKFFVBgDpfwDpsAD+mxQ91wLpNSMArQC9BbeOkRdLxptzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgELgEaJZkC7aMAoQCjBcGOmxdNxrsBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUHqSvAj5Gqwr7YrMUACT9AN3rpF27H7fsd/twPt4l+UW1yQYKBt2Cgy7qJpGiLcdE2P1cQSImUbqJ6ICH27H4knQMIRMrFkHu3sx6tC35Y+eLIh4e4CMKJ4DfyV+8mfta499RCAJ0xfeZR8PsoYOApva9pjGn4PhvyZS7/h5JLuhaucfjuU+Z584wwqNO4hWYmaBCcjgQPale1bjoHzMUbut/zTgxHxBnAyrdKpF4IRMASLBtD/jviyLeCgj8twWjAd3HchN/uqaeRYeHJgl7JEY9/cTrvtfybx/r3Y/NtxJ9dp+MTVmiS9bwBH73s8Di56/Ma+mTPMHq4T1yEG1fWcqr0u+hrGnJEvU1JJAm/maQSrKrazIyvSkDFkj8UUlfBq8baniTGPng6YZRL661rDNw4w/1g2figG0IhXnL7wosd/sVNo5dYSmMBTP5c7rYLjRdCwg8quwljOMPf63D8ICAL0r71XRiyFHdgwHbwfgnPOf4Lzjf2v+j+IiDHG2isp5yUnzSDyDRb4i/Vs0qHSHq8PiEQ/JnBP7PxnjN0j6gT4AVAeRx/1o9VnEUlUwvFrzJqHk9jxAw4sYxCnrxaeBdCFFKbnE7z+x54F5W7ZZsU6kx8Qocul6FoAHHy01FGL/nne61mn4+uYXfQ1Uccn+HMLKE+cZzT8BB1E3FRskOgJrRsq25rauLm8+uamXpkS/bTy6y1wDbCrW4eD532kTWrtNUmVVZOIn/C+/JR9KVR5iG9TY8iaT67ubm/whL1xbKZoqtY+a6fNxMJrg211bGYJDUkYMNWA0BMB++9zOm6Eik4roqs9CCEFW0lyAK0PbvlzvoxrZuY/OEhNW/l/63U15Od/RSvmDvXpGLiVmeGi5PDSH2bYz5o2g6wFDQ2FbZgYgTF8rPlvA1ifjZD3NLtFdXdpSIJvgKR7GpjJWG7GZGawPomIH8B5tUmtHH9LpM+/KQKunEPa1GiQkCXv4Cnm9DLORo2joicHdPDZ64obQrPZ5bgqckkj0G6/NEiPYBY4bCkL7W8G5YzsUb6GakFjykSPkT7JGeLeB6uJOGMm+x7N381BCDfbJFx0dtLgV9Q477BfL1fvitX5anV/oYfxeYl+eF5x5bB8+Ep/L2nsmd56aKF4aAD4GbJWsdKyBW22xEmAD3XdbtsMyAFoR5mOla0gEd9U/YVB7zvHGpHbQonay9Sv0bQ8iZ8piaXVrKc5AG1AmqqgaEvzHSP2Wux7aZTWh6quVDVU01JtMIVRdCFwlSbbqqhoFlyzsotQzRexFvZ/MqUSFu3OhRIuNBbufvBpdVgb8XdGJ48/lJPCZ7dsOujTTbKPSEvGXkOnG2Xdi8/nM3EMRqITd5QeU7iOjKqC7URJY6TnLsHij22xAHKnVRD5MDtBYnoGFqZGMDmXCW6Oj+BAWw14hESY/xLF6bLku06AHkiXTHPCFZ0f9YSqqo27eAhhS67OrA2Het4M9JM3jm/yRX6bYxnfmzYl5qQdHxN08FsNuWDrWd4vMUY2QD3hr8vS73SCTkFoXZR3xNzOQt8d/6HfjBmXqvrE6EGkLzK6YK2U2/ksU/iUH+LvVIsJI+ri2AL/klo+ShdDyfs5A83i2prkMs51IKR7ZcqjZJi5X3+bd8GlyWvtddxKEoEqSgEO7A8jIgf2nH0h8FjM7oB6yte3X5mpL0i/E4Rx0CotKnILJj/vJqo4VkPQ93jRtRVfaitQPqldl5xRYPq8387Z0DcnZvOeION0Ht1+P27kFLGQIcLBX4FG3sffccNHh5cPfzp9INoRtqVtdViJfg8RjnXiIz/MNqEN6zvzX3hMzyWC7oSoXIT14ubc0abPX8Rp9GVa5NI/8iv+6ela1oTncbdimRKnrbRffDR/X4nH+bgqAuHWl7hOaeXPWVzIeRl7ga+JzD4Sx3mlj/q6Ra/E2HhDf21eEzTLNGfCZsY+/yxZzQzIAuijG65ii4O/waAJCrEJaWd/DRAKMQ5678Dw5AT7RCKzdadIwd8LsD+DgPBASmWsUlf8R0k1w/2k4lO2Wpb4zMI6EJVJs0xk/wn8/fRUPqrDKhbjHR41SqgFMx5RGMPuduFwlu5lK89tW11sTqiX/5EfGs5nO+y9FKvgXKPOEmgE05EKNL6Sjb3xS40H3BVPhm0ESOZgAjZoymc8be0inDVo4JdJVf+NKd3tN/CaB7GShhH27qf95NoFZVX/6ZkR2lX+CgWrQ2INgkh+bbMz68+uJ3Clsh8HSMPEQtAt+BBE6fXDab7KIlsKxU1lIXW/KWVstpdPanJ0pdXpQinDyUQjtY7ZVcfiecRxRDMAUhHFU2cEaciQ+htiPMPx1kdvtWG9T44w3r037ljHBFJdYR0r55qvMRixtAEFJAqA4T1ES87FAx7UozXasytg8MftZYt0rjYgLe6EJ5aWvy2qscBSBQ7yehoJIA3wIIZ9ukfkyBb6qnue5ko8W50rpV4kXqWjI5nbGRXrNW0tBZHXlY48nSgcUXBHWT4GcgLZJoLlKJnV96kCYpq9eWHh7xJzkCAyrQuQ5AJ0qq/uZ3toJglNterev+Qm0KXxPg/+YbFRJdfhbp1wOnVOEYdVHTya6CtO0afhEaBhx3oHwCb5Kq6RwHDzFMl2vfjL8GwzcCoTj7wZe+UFnYDV2yKpPU9dba29gYBdNqJg/KXozO+CJTlKmlKhnqTf5doeS35DZFV+cYJQVjd+oVY/Gtc/6XPzUxb1gMqf6cEjNNoRC8AObrp+fx0cVtGu4ffC2TgXRC8zPl8moUHCB5HZ25d87mlsiiK0aNwBtcEQjRNBT/QrXbw/8aVXdKMHn9EqYEKEyxSGTpYQOaes1G1Qq8pDgqkZtlO2HRyCXpmeM7TSrRPkAh004BfisVpF6zP44n2Jvxz/gOVocNCyy9V6lkod28QM4pbaMvVJigD/w3BrsjSJrXlqc4ulBYOCceiBN4b/gHajYyupbhEt63a619Ay4wsL6a6w6B+A7TnoyE7BliWHJfzVxxIKM/W3M/J8Bx99Op863Q8eNuIMGRx++VbYfjm+VGYBA3Ap/KEu/wxBNBpJJncwHPG45V8Gh98ZIrGCc20MwijGowZbcS7d1nEgcOW5cddZpHL2XPAIRbColiheZzXTvBxZOY3iMSDSKDrICyJ/iQs1vdplVdH/JrLJsQ2jtTnfCrITIghq3KFX3qAgLWAIp8IffNSdTYptnbGfc8s+qcr3zyzyHp1aJg+jxTF4kD1ry5Wauv5V3xnOGwTFecNzXSLHBW20/pCQjk4uorD0plIhMSTc79+/r4RKPClRYTBYex1Ob5crtfvRQBBv6re/6FhtCqtduag67glqRA77/3ulblh9YRtMdDxkCyJDeNnAuCLPQFmdRRWJtH20Z8DstfJf+5oj5SSB64d0iF5/Ya4KfTWxfivj9Ap2/zbYaTo/1gO3tM6RYsCZharMBFr7Fm61mLSrQnEI4OF1gbVS4k/JE9UotOrnLJZuswoWodCSV8zbybkJSVIP7n8UaE9xCR39rJZmf27HOAPVOGc9pdkQUcRrI0qyVF9Z3j1RHDbxIfwbWzmPVjwIdPJvtmBYwEQIUsIW1S939hcVikK00ozPRI02cqhzVUNzpOxVdrwRPvlh1aIOf0xFEqD3YkGnCnFah/cFN3J2gB7N+bZSGawwkKFu1tpQMrp1W+27YNkyT0TpcFpTqgOqqLabrgcCUPxh97mREOGy4xItzQ9xSl6rq+8BZsHcrQFReS+QeMxJ3P6CnL9EP/eOLDjumLhvrcQrpPiknsofbzBv9gTP0lU+TIVwE6E7CcKfT36q+ZiEOHJ9ayf0dyUJLezAb2M8aNHwd0+OJmsVgTzRWA";const Qs=44032,Ta=4352,Ba=4449,Sa=4519,N1=19,C1=21,ji=28,Pa=C1*ji,dI=N1*Pa,pI=Qs+dI,mI=Ta+N1,gI=Ba+C1,yI=Sa+ji;function ks(t){return t>>24&255}function _1(t){return t&16777215}let Qf,Cg,Yf,ua;function bI(){let t=S1(hI);Qf=new Map(P1(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),Cg=new Set(Js(t)),Yf=new Map,ua=new Map;for(let[e,r]of O1(t)){if(!Cg.has(e)&&r.length==2){let[n,i]=r,o=ua.get(n);o||(o=new Map,ua.set(n,o)),o.set(i,e)}Yf.set(e,r.reverse())}}function F1(t){return t>=Qs&&t<pI}function xI(t,e){if(t>=Ta&&t<mI&&e>=Ba&&e<gI)return Qs+(t-Ta)*Pa+(e-Ba)*ji;if(F1(t)&&e>Sa&&e<yI&&(t-Qs)%ji==0)return t+(e-Sa);{let r=ua.get(t);return r&&(r=r.get(e),r)?r:-1}}function D1(t){Qf||bI();let e=[],r=[],n=!1;function i(o){let a=Qf.get(o);a&&(n=!0,o|=a),e.push(o)}for(let o of t)for(;;){if(o<128)e.push(o);else if(F1(o)){let a=o-Qs,u=a/Pa|0,l=a%Pa/ji|0,h=a%ji;i(Ta+u),i(Ba+l),h>0&&i(Sa+h)}else{let a=Yf.get(o);a?r.push(...a):i(o)}if(!r.length)break;o=r.pop()}if(n&&e.length>1){let o=ks(e[0]);for(let a=1;a<e.length;a++){let u=ks(e[a]);if(u==0||o<=u){o=u;continue}let l=a-1;for(;;){let h=e[l+1];if(e[l+1]=e[l],e[l]=h,!l||(o=ks(e[--l]),o<=u))break}o=ks(e[a])}}return e}function wI(t){let e=[],r=[],n=-1,i=0;for(let o of t){let a=ks(o),u=_1(o);if(n==-1)a==0?n=u:e.push(u);else if(i>0&&i>=a)a==0?(e.push(n,...r),r.length=0,n=u):r.push(u),i=a;else{let l=xI(n,u);l>=0?n=l:i==0&&a==0?(e.push(n),n=u):(r.push(u),i=a)}}return n>=0&&e.push(n,...r),e}function L1(t){return D1(t).map(_1)}function AI(t){return wI(D1(t))}const _g=45,U1=".",M1=65039,z1=1,Oa=t=>Array.from(t);function Ys(t,e){return t.P.has(e)||t.Q.has(e)}class EI extends Array{get is_emoji(){return!0}}let Xf,$1,Zn,eh,V1,Ni,bf,vi,$n,Fg,th;function Xh(){if(Xf)return;let t=S1(eI);const e=()=>Js(t),r=()=>new Set(e()),n=(d,m)=>m.forEach(y=>d.add(y));Xf=new Map(O1(t)),$1=r(),Zn=e(),eh=new Set(e().map(d=>Zn[d])),Zn=new Set(Zn),V1=r(),r();let i=P1(t),o=t();const a=()=>{let d=new Set;return e().forEach(m=>n(d,i[m])),n(d,e()),d};Ni=Ws(d=>{let m=Ws(t).map(y=>y+96);if(m.length){let y=d>=o;m[0]-=32,m=Gi(m),y&&(m=`Restricted[${m}]`);let w=a(),T=a(),R=!t();return{N:m,P:w,Q:T,M:R,R:y}}}),bf=r(),vi=new Map;let u=e().concat(Oa(bf)).sort((d,m)=>d-m);u.forEach((d,m)=>{let y=t(),w=u[m]=y?u[m-y]:{V:[],M:new Map};w.V.push(d),bf.has(d)||vi.set(d,w)});for(let{V:d,M:m}of new Set(vi.values())){let y=[];for(let T of d){let R=Ni.filter(A=>Ys(A,T)),O=y.find(({G:A})=>R.some(I=>A.has(I)));O||(O={G:new Set,V:[]},y.push(O)),O.V.push(T),n(O.G,R)}let w=y.flatMap(T=>Oa(T.G));for(let{G:T,V:R}of y){let O=new Set(w.filter(A=>!T.has(A)));for(let A of R)m.set(A,O)}}$n=new Set;let l=new Set;const h=d=>$n.has(d)?l.add(d):$n.add(d);for(let d of Ni){for(let m of d.P)h(m);for(let m of d.Q)h(m)}for(let d of $n)!vi.has(d)&&!l.has(d)&&vi.set(d,z1);n($n,L1($n)),Fg=cI(t).map(d=>EI.from(d)).sort(fI),th=new Map;for(let d of Fg){let m=[th];for(let y of d){let w=m.map(T=>{let R=T.get(y);return R||(R=new Map,T.set(y,R)),R});y===M1?m.push(...w):m=w}for(let y of m)y.V=d}}function e0(t){return(G1(t)?"":`${t0(nc([t]))} `)+k1(t)}function t0(t){return`"${t}"‎`}function vI(t){if(t.length>=4&&t[2]==_g&&t[3]==_g)throw new Error(`invalid label extension: "${Gi(t.slice(0,4))}"`)}function RI(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function TI(t){let e=t[0],r=kg.get(e);if(r)throw Ms(`leading ${r}`);let n=t.length,i=-1;for(let o=1;o<n;o++){e=t[o];let a=kg.get(e);if(a){if(i==o)throw Ms(`${r} + ${a}`);i=o+1,r=a}}if(i==n)throw Ms(`trailing ${r}`)}function nc(t,e=1/0,r=k1){let n=[];BI(t[0])&&n.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,o=t.length;for(let a=0;a<o;a++){let u=t[a];G1(u)&&(n.push(Gi(t.slice(i,a))),n.push(r(u)),i=a+1)}return n.push(Gi(t.slice(i,o))),n.join("")}function BI(t,e){return Xh(),Zn.has(t)}function G1(t){return Xh(),V1.has(t)}function SI(t){return kI(PI(t,AI,_I))}function PI(t,e,r){if(!t)return[];Xh();let n=0;return t.split(U1).map(i=>{let o=lI(i),a={input:o,offset:n};n+=o.length+1;try{let u=a.tokens=CI(o,e,r),l=u.length,h;if(!l)throw new Error("empty label");let d=a.output=u.flat();if(RI(d),!(a.emoji=l>1||u[0].is_emoji)&&d.every(y=>y<128))vI(d),h="ASCII";else{let y=u.flatMap(w=>w.is_emoji?[]:w);if(!y.length)h="Emoji";else{if(Zn.has(d[0]))throw Ms("leading combining mark");for(let R=1;R<l;R++){let O=u[R];if(!O.is_emoji&&Zn.has(O[0]))throw Ms(`emoji + combining mark: "${Gi(u[R-1])} + ${nc([O[0]])}"`)}TI(d);let w=Oa(new Set(y)),[T]=II(w);NI(T,y),OI(T,w),h=T.N}}a.type=h}catch(u){a.error=u}return a})}function OI(t,e){let r,n=[];for(let i of e){let o=vi.get(i);if(o===z1)return;if(o){let a=o.M.get(i);if(r=r?r.filter(u=>a.has(u)):Oa(a),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(o=>Ys(i,o)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function II(t){let e=Ni;for(let r of t){let n=e.filter(i=>Ys(i,r));if(!n.length)throw Ni.some(i=>Ys(i,r))?H1(e[0],r):j1(r);if(e=n,n.length==1)break}return e}function kI(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${t0(nc(e,63))}: ${i}`)}return Gi(n)}).join(U1)}function j1(t){return new Error(`disallowed character: ${e0(t)}`)}function H1(t,e){let r=e0(e),n=Ni.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function Ms(t){return new Error(`illegal placement: ${t}`)}function NI(t,e){for(let r of e)if(!Ys(t,r))throw H1(t,r);if(t.M){let r=L1(e);for(let n=1,i=r.length;n<i;n++)if(eh.has(r[n])){let o=n+1;for(let a;o<i&&eh.has(a=r[o]);o++)for(let u=n;u<o;u++)if(r[u]==a)throw new Error(`duplicate non-spacing marks: ${e0(a)}`);if(o-n>Ng)throw new Error(`excessive non-spacing marks: ${t0(nc(r.slice(n-1,o)))} (${o-n}/${Ng})`);n=o}}}function CI(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let o=FI(t);if(o)i.length&&(n.push(e(i)),i=[]),n.push(r(o));else{let a=t.pop();if($n.has(a))i.push(a);else{let u=Xf.get(a);if(u)i.push(...u);else if(!$1.has(a))throw j1(a)}}}return i.length&&n.push(e(i)),n}function _I(t){return t.filter(e=>e!=M1)}function FI(t,e){let r=th,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:o}=r;o&&(n=o,t.length=i)}return n}const q1=new Uint8Array(32);q1.fill(0);function Dg(t){return F(t.length!==0,"invalid ENS name; empty component","comp",t),t}function r0(t){const e=Wt(Z1(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i<e.length;i++)e[i]===46&&(r.push(Dg(e.slice(n,i))),n=i+1);return F(n<e.length,"invalid ENS name; empty component","name",t),r.push(Dg(e.slice(n))),r}function Z1(t){try{if(t.length===0)throw new Error("empty label");return SI(t)}catch(e){F(!1,`invalid ENS name (${e.message})`,"name",t)}}function Lg(t){try{return r0(t).length!==0}catch{}return!1}function Ug(t){F(typeof t=="string","invalid ENS name; not a string","name",t),F(t.length,"invalid ENS name (empty label)","name",t);let e=q1;const r=r0(t);for(;r.length;)e=lt(je([e,lt(r.pop())]));return ae(e)}function Mg(t,e){const r=e;return F(r<=255,"DNS encoded label cannot exceed 255","length",r),ae(je(r0(t).map(n=>{F(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const i=new Uint8Array(n.length+1);return i.set(n,1),i[0]=i.length-1,i})))+"00"}function DI(t){return typeof t=="string"&&(t=Wt(t)),lt(je([Wt(lO),Wt(String(t.length)),t]))}const K1=new Uint8Array(32);K1.fill(0);const LI=BigInt(-1),J1=BigInt(0),W1=BigInt(1),UI=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function MI(t){const e=de(t),r=e.length%32;return r?je([e,K1.slice(r)]):ae(e)}const zI=sn(W1,32),$I=sn(J1,32),zg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},xf=["name","version","chainId","verifyingContract","salt"];function $g(t){return function(e){return F(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const VI={name:$g("name"),version:$g("version"),chainId:function(t){const e=pe(t,"domain.chainId");return F(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):Br(e)},verifyingContract:function(t){try{return ze(t).toLowerCase()}catch{}F(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=de(t,"domain.salt");return F(e.length===32,'invalid domain value "salt"',"domain.salt",t),ae(e)}};function wf(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);F(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const i=Is(UI,r?n-1:n),o=r?(i+W1)*LI:J1;return function(a){const u=pe(a,"value");return F(u>=o&&u<=i,`value out-of-bounds for ${t}`,"value",u),sn(r?gx(u,256):u,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return F(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const i=de(n);return F(i.length===r,`invalid length for ${t}`,"value",n),MI(n)}}}switch(t){case"address":return function(e){return nn(ze(e),32)};case"bool":return function(e){return e?zI:$I};case"bytes":return function(e){return lt(e)};case"string":return function(e){return on(e)}}return null}function Vg(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function Qo(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}class Zt{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#r;constructor(e){this.#t=new Map,this.#r=new Map;const r=new Map,n=new Map,i=new Map,o={};Object.keys(e).forEach(l=>{o[l]=e[l].map(({name:h,type:d})=>{let{base:m,index:y}=Qo(d);return m==="int"&&!e.int&&(m="int256"),m==="uint"&&!e.uint&&(m="uint256"),{name:h,type:m+(y||"")}}),r.set(l,new Set),n.set(l,[]),i.set(l,new Set)}),this.#e=JSON.stringify(o);for(const l in o){const h=new Set;for(const d of o[l]){F(!h.has(d.name),`duplicate variable name ${JSON.stringify(d.name)} in ${JSON.stringify(l)}`,"types",e),h.add(d.name);const m=Qo(d.type).base;F(m!==l,`circular type reference to ${JSON.stringify(m)}`,"types",e),!wf(m)&&(F(n.has(m),`unknown type ${JSON.stringify(m)}`,"types",e),n.get(m).push(l),r.get(l).add(m))}}const a=Array.from(n.keys()).filter(l=>n.get(l).length===0);F(a.length!==0,"missing primary type","types",e),F(a.length===1,`ambiguous primary types or unused types: ${a.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Te(this,{primaryType:a[0]});function u(l,h){F(!h.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),h.add(l);for(const d of r.get(l))if(n.has(d)){u(d,h);for(const m of h)i.get(m).add(d)}h.delete(l)}u(this.primaryType,new Set);for(const[l,h]of i){const d=Array.from(h);d.sort(),this.#t.set(l,Vg(l,o[l])+d.map(m=>Vg(m,o[m])).join(""))}}getEncoder(e){let r=this.#r.get(e);return r||(r=this.#n(e),this.#r.set(e,r)),r}#n(e){{const i=wf(e);if(i)return i}const r=Qo(e).array;if(r){const i=r.prefix,o=this.getEncoder(i);return a=>{F(r.count===-1||r.count===a.length,`array length mismatch; expected length ${r.count}`,"value",a);let u=a.map(o);return this.#t.has(i)&&(u=u.map(lt)),lt(je(u))}}const n=this.types[e];if(n){const i=on(this.#t.get(e));return o=>{const a=n.map(({name:u,type:l})=>{const h=this.getEncoder(l)(o[u]);return this.#t.has(l)?lt(h):h});return a.unshift(i),je(a)}}F(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const r=this.#t.get(e);return F(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return lt(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(wf(e))return n(e,r);const i=Qo(e).array;if(i)return F(i.count===-1||i.count===r.length,`array length mismatch; expected length ${i.count}`,"value",r),r.map(a=>this._visit(i.prefix,a,n));const o=this.types[e];if(o)return o.reduce((a,{name:u,type:l})=>(a[u]=this._visit(l,r[u],n),a),{});F(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Zt(e)}static getPrimaryType(e){return Zt.from(e).primaryType}static hashStruct(e,r,n){return Zt.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const i=zg[n];F(i,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>xf.indexOf(n.name)-xf.indexOf(i.name)),Zt.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return je(["0x1901",Zt.hashDomain(e),Zt.from(r).hash(n)])}static hash(e,r,n){return lt(Zt.encode(e,r,n))}static async resolveNames(e,r,n,i){e=Object.assign({},e);for(const u in e)e[u]==null&&delete e[u];const o={};e.verifyingContract&&!tt(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const a=Zt.from(r);a.visit(n,(u,l)=>(u==="address"&&!tt(l,20)&&(o[l]="0x"),l));for(const u in o)o[u]=await i(u);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=a.visit(n,(u,l)=>u==="address"&&o[l]?o[l]:l),{domain:e,value:n}}static getPayload(e,r,n){Zt.hashDomain(e);const i={},o=[];xf.forEach(l=>{const h=e[l];h!=null&&(i[l]=VI[l](h),o.push({name:l,type:zg[l]}))});const a=Zt.from(r);r=a.types;const u=Object.assign({},r);return F(u.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),u.EIP712Domain=o,a.encode(n),{types:u,domain:i,primaryType:a.primaryType,message:a.visit(n,(l,h)=>{if(l.match(/^bytes(\d*)/))return ae(de(h));if(l.match(/^u?int/))return pe(h).toString();switch(l){case"address":return h.toLowerCase();case"bool":return!!h;case"string":return F(typeof h=="string","invalid string","value",h),h}F(!1,"unsupported type","type",l)})}}}function Jt(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const GI="external public payable override",jI=Jt(GI.split(" ")),Q1="constant external internal payable private public pure view override",HI=Jt(Q1.split(" ")),Y1="constructor error event fallback function receive struct",X1=Jt(Y1.split(" ")),ew="calldata memory storage payable indexed",qI=Jt(ew.split(" ")),ZI="tuple returns",KI=[Y1,ew,ZI,Q1].join(" "),JI=Jt(KI.split(" ")),WI={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},QI=new RegExp("^(\\s*)"),YI=new RegExp("^([0-9]+)"),XI=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),tw=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),rw=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class wr{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(e){this.#e=0,this.#t=e.slice()}clone(){return new wr(this.#t)}reset(){this.#e=0}#r(e=0,r=0){return new wr(this.#t.slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=this.#r(this.#e+1,e.match+1);return this.#e=e.match+1,r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;this.#e<e.match-1;){const n=this.peek().linkNext;r.push(this.#r(this.#e+1,n)),this.#e=n}return this.#e=e.match+1,r}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return this.#e++,e}toString(){const e=[];for(let r=this.#e;r<this.#t.length;r++){const n=this.#t[r];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}}function Nn(t){const e=[],r=a=>{const u=o<t.length?JSON.stringify(t[o]):"$EOI";throw new Error(`invalid token ${u} at ${o}: ${a}`)};let n=[],i=[],o=0;for(;o<t.length;){let a=t.substring(o),u=a.match(QI);u&&(o+=u[1].length,a=t.substring(o));const l={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:o,value:-1};e.push(l);let h=WI[a[0]]||"";if(h){if(l.type=h,l.text=a[0],o++,h==="OPEN_PAREN")n.push(e.length-1),i.push(e.length-1);else if(h=="CLOSE_PAREN")n.length===0&&r("no matching open bracket"),l.match=n.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=i.pop(),e[l.linkBack].linkNext=e.length-1;else if(h==="COMMA")l.linkBack=i.pop(),e[l.linkBack].linkNext=e.length-1,i.push(e.length-1);else if(h==="OPEN_BRACKET")l.type="BRACKET";else if(h==="CLOSE_BRACKET"){let d=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const m=e.pop().text;d=m+d,e[e.length-1].value=Ie(m)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=d}continue}if(u=a.match(XI),u){if(l.text=u[1],o+=l.text.length,JI.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(rw)){l.type="TYPE";continue}l.type="ID";continue}if(u=a.match(YI),u){l.text=u[1],l.type="NUMBER",o+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${o}`)}return new wr(e.map(a=>Object.freeze(a)))}function Gg(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function ic(t,e){if(e.peekKeyword(X1)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function an(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function nw(t){let e=an(t,HI);return Gg(e,Jt("constant payable nonpayable".split(" "))),Gg(e,Jt("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function en(t,e){return t.popParams().map(r=>it.from(r,e))}function iw(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return pe(t.pop().text);throw new Error("invalid gas")}return null}function ei(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const ek=new RegExp(/^(.*)\[([0-9]*)\]$/);function jg(t){const e=t.match(rw);if(F(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);F(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);F(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const pt={},er=Symbol.for("_ethers_internal"),Hg="_ParamTypeInternal",qg="_ErrorInternal",Zg="_EventInternal",Kg="_ConstructorInternal",Jg="_FallbackInternal",Wg="_FunctionInternal",Qg="_StructInternal";class it{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,r,n,i,o,a,u,l){if(ci(e,pt,"ParamType"),Object.defineProperty(this,er,{value:Hg}),a&&(a=Object.freeze(a.slice())),i==="array"){if(u==null||l==null)throw new Error("")}else if(u!=null||l!=null)throw new Error("");if(i==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Te(this,{name:r,type:n,baseType:i,indexed:o,components:a,arrayLength:u,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const o=JSON.parse(this.arrayChildren.format("json"));return o.name=n,o.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(o)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(o=>JSON.parse(o.format(e)))),JSON.stringify(i)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){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 n=this;return e.map(i=>n.arrayChildren.walk(i,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((i,o)=>n.components[o].walk(i,r))}return r(this.type,e)}#e(e,r,n,i){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,u=r.slice();u.forEach((l,h)=>{a.#e(e,l,n,d=>{u[h]=d})}),i(u);return}if(this.isTuple()){const a=this.components;let u;if(Array.isArray(r))u=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");u=a.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in r))throw new Error(`missing value for component ${l.name}`);return r[l.name]})}if(u.length!==this.components.length)throw new Error("array is wrong length");u.forEach((l,h)=>{a[h].#e(e,l,n,d=>{u[h]=d})}),i(u);return}const o=n(this.type,r);o.then?e.push((async function(){i(await o)})()):i(o)}async walkAsync(e,r){const n=[],i=[e];return this.#e(n,e,r,o=>{i[0]=o}),n.length&&await Promise.all(n),i[0]}static from(e,r){if(it.isParamType(e))return e;if(typeof e=="string")try{return it.from(Nn(e),r)}catch{F(!1,"invalid param type","obj",e)}else if(e instanceof wr){let u="",l="",h=null;an(e,Jt(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",h=e.popParams().map(R=>it.from(R)),u=`tuple(${h.map(R=>R.format()).join(",")})`):(u=jg(e.popType("TYPE")),l=u);let d=null,m=null;for(;e.length&&e.peekType("BRACKET");){const R=e.pop();d=new it(pt,"",u,l,null,h,m,d),m=R.value,u+=R.text,l="array",h=null}let y=null;if(an(e,qI).has("indexed")){if(!r)throw new Error("");y=!0}const T=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new it(pt,T,u,l,y,h,m,d)}const n=e.name;F(!n||typeof n=="string"&&n.match(tw),"invalid name","obj.name",n);let i=e.indexed;i!=null&&(F(r,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let o=e.type,a=o.match(ek);if(a){const u=parseInt(a[2]||"-1"),l=it.from({type:a[1],components:e.components});return new it(pt,n||"",o,"array",i,null,u,l)}if(o==="tuple"||o.startsWith("tuple(")||o.startsWith("(")){const u=e.components!=null?e.components.map(h=>it.from(h)):null;return new it(pt,n||"",o,"tuple",i,u,null,null)}return o=jg(e.type),new it(pt,n||"",o,o,i,null,null,null)}static isParamType(e){return e&&e[er]===Hg}}class ti{type;inputs;constructor(e,r,n){ci(e,pt,"Fragment"),n=Object.freeze(n.slice()),Te(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{ti.from(JSON.parse(e))}catch{}return ti.from(Nn(e))}if(e instanceof wr)switch(e.peekKeyword(X1)){case"constructor":return Qr.from(e);case"error":return Yt.from(e);case"event":return Mr.from(e);case"fallback":case"receive":return Hr.from(e);case"function":return zr.from(e);case"struct":return Yn.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Qr.from(e);case"error":return Yt.from(e);case"event":return Mr.from(e);case"fallback":case"receive":return Hr.from(e);case"function":return zr.from(e);case"struct":return Yn.from(e)}re(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}F(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Qr.isFragment(e)}static isError(e){return Yt.isFragment(e)}static isEvent(e){return Mr.isFragment(e)}static isFunction(e){return zr.isFragment(e)}static isStruct(e){return Yn.isFragment(e)}}class sc extends ti{name;constructor(e,r,n,i){super(e,r,i),F(typeof n=="string"&&n.match(tw),"invalid identifier","name",n),i=Object.freeze(i.slice()),Te(this,{name:n})}}function Xs(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class Yt extends sc{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,er,{value:qg})}get selector(){return on(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+Xs(e,this.inputs)),r.join(" ")}static from(e){if(Yt.isFragment(e))return e;if(typeof e=="string")return Yt.from(Nn(e));if(e instanceof wr){const r=ic("error",e),n=en(e);return ei(e),new Yt(pt,r,n)}return new Yt(pt,e.name,e.inputs?e.inputs.map(it.from):[])}static isFragment(e){return e&&e[er]===qg}}class Mr extends sc{anonymous;constructor(e,r,n,i){super(e,"event",r,n),Object.defineProperty(this,er,{value:Zg}),Te(this,{anonymous:i})}get topicHash(){return on(this.format("sighash"))}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("event"),r.push(this.name+Xs(e,this.inputs)),e!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(e,r){return r=(r||[]).map(i=>it.from(i)),new Mr(pt,e,r,!1).topicHash}static from(e){if(Mr.isFragment(e))return e;if(typeof e=="string")try{return Mr.from(Nn(e))}catch{F(!1,"invalid event fragment","obj",e)}else if(e instanceof wr){const r=ic("event",e),n=en(e,!0),i=!!an(e,Jt(["anonymous"])).has("anonymous");return ei(e),new Mr(pt,r,n,i)}return new Mr(pt,e.name,e.inputs?e.inputs.map(r=>it.from(r,!0)):[],!!e.anonymous)}static isFragment(e){return e&&e[er]===Zg}}class Qr extends ti{payable;gas;constructor(e,r,n,i,o){super(e,r,n),Object.defineProperty(this,er,{value:Kg}),Te(this,{payable:i,gas:o})}format(e){if(re(e!=null&&e!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),e==="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(n=>JSON.parse(n.format(e)))});const r=[`constructor${Xs(e,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(e){if(Qr.isFragment(e))return e;if(typeof e=="string")try{return Qr.from(Nn(e))}catch{F(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof wr){an(e,Jt(["constructor"]));const r=en(e),n=!!an(e,jI).has("payable"),i=iw(e);return ei(e),new Qr(pt,"constructor",r,n,i)}return new Qr(pt,"constructor",e.inputs?e.inputs.map(it.from):[],!!e.payable,e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[er]===Kg}}class Hr extends ti{payable;constructor(e,r,n){super(e,"fallback",r),Object.defineProperty(this,er,{value:Jg}),Te(this,{payable:n})}format(e){const r=this.inputs.length===0?"receive":"fallback";if(e==="json"){const n=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:n})}return`${r}()${this.payable?" payable":""}`}static from(e){if(Hr.isFragment(e))return e;if(typeof e=="string")try{return Hr.from(Nn(e))}catch{F(!1,"invalid fallback fragment","obj",e)}else if(e instanceof wr){const r=e.toString(),n=e.peekKeyword(Jt(["fallback","receive"]));if(F(n,"type must be fallback or receive","obj",r),e.popKeyword(Jt(["fallback","receive"]))==="receive"){const u=en(e);return F(u.length===0,"receive cannot have arguments","obj.inputs",u),an(e,Jt(["payable"])),ei(e),new Hr(pt,[],!0)}let o=en(e);o.length?F(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(u=>u.format("minimal")).join(", ")):o=[it.from("bytes")];const a=nw(e);if(F(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),an(e,Jt(["returns"])).has("returns")){const u=en(e);F(u.length===1&&u[0].type==="bytes","invalid fallback outputs","obj.outputs",u.map(l=>l.format("minimal")).join(", "))}return ei(e),new Hr(pt,o,a==="payable")}if(e.type==="receive")return new Hr(pt,[],!0);if(e.type==="fallback"){const r=[it.from("bytes")],n=e.stateMutability==="payable";return new Hr(pt,r,n)}F(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[er]===Jg}}class zr extends sc{constant;outputs;stateMutability;payable;gas;constructor(e,r,n,i,o,a){super(e,"function",r,i),Object.defineProperty(this,er,{value:Wg}),o=Object.freeze(o.slice()),Te(this,{constant:n==="view"||n==="pure",gas:a,outputs:o,payable:n==="payable",stateMutability:n})}get selector(){return on(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="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(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("function"),r.push(this.name+Xs(e,this.inputs)),e!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(Xs(e,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(e,r){return r=(r||[]).map(i=>it.from(i)),new zr(pt,e,"view",r,[],null).selector}static from(e){if(zr.isFragment(e))return e;if(typeof e=="string")try{return zr.from(Nn(e))}catch{F(!1,"invalid function fragment","obj",e)}else if(e instanceof wr){const n=ic("function",e),i=en(e),o=nw(e);let a=[];an(e,Jt(["returns"])).has("returns")&&(a=en(e));const u=iw(e);return ei(e),new zr(pt,n,o,i,a,u)}let r=e.stateMutability;return r==null&&(r="payable",typeof e.constant=="boolean"?(r="view",e.constant||(r="payable",typeof e.payable=="boolean"&&!e.payable&&(r="nonpayable"))):typeof e.payable=="boolean"&&!e.payable&&(r="nonpayable")),new zr(pt,e.name,r,e.inputs?e.inputs.map(it.from):[],e.outputs?e.outputs.map(it.from):[],e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[er]===Wg}}class Yn extends sc{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,er,{value:Qg})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Yn.from(Nn(e))}catch{F(!1,"invalid struct fragment","obj",e)}else if(e instanceof wr){const r=ic("struct",e),n=en(e);return ei(e),new Yn(pt,r,n)}return new Yn(pt,e.name,e.inputs?e.inputs.map(it.from):[])}static isFragment(e){return e&&e[er]===Qg}}const kr=new Map;kr.set(0,"GENERIC_PANIC");kr.set(1,"ASSERT_FALSE");kr.set(17,"OVERFLOW");kr.set(18,"DIVIDE_BY_ZERO");kr.set(33,"ENUM_RANGE_ERROR");kr.set(34,"BAD_STORAGE_DATA");kr.set(49,"STACK_UNDERFLOW");kr.set(50,"ARRAY_RANGE_ERROR");kr.set(65,"OUT_OF_MEMORY");kr.set(81,"UNINITIALIZED_FUNCTION_CALL");const tk=new RegExp(/^bytes([0-9]*)$/),rk=new RegExp(/^(u?int)([0-9]*)$/);let Af=null,Yg=1024;function nk(t,e,r,n){let i="missing revert data",o=null;const a=null;let u=null;if(r){i="execution reverted";const h=de(r);if(r=ae(r),h.length===0)i+=" (no data present; likely require(false) occurred",o="require(false)";else if(h.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(ae(h.slice(0,4))==="0x08c379a0")try{o=n.decode(["string"],h.slice(4))[0],u={signature:"Error(string)",name:"Error",args:[o]},i+=`: ${JSON.stringify(o)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(ae(h.slice(0,4))==="0x4e487b71")try{const d=Number(n.decode(["uint256"],h.slice(4))[0]);u={signature:"Panic(uint256)",name:"Panic",args:[d]},o=`Panic due to ${kr.get(d)||"UNKNOWN"}(${d})`,i+=`: ${o}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const l={to:e.to?ze(e.to):null,data:e.data||"0x"};return e.from&&(l.from=ze(e.from)),ht(i,"CALL_EXCEPTION",{action:t,data:r,reason:o,transaction:l,invocation:a,revert:u})}class Hi{#e(e){if(e.isArray())return new AO(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new Wo(e.components.map(n=>this.#e(n)),e.name);switch(e.baseType){case"address":return new xO(e.name);case"bool":return new EO(e.name);case"string":return new kO(e.name);case"bytes":return new vO(e.name);case"":return new BO(e.name)}let r=e.type.match(rk);if(r){let n=parseInt(r[2]||"256");return F(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new IO(n/8,r[1]==="int",e.name)}if(r=e.type.match(tk),r){let n=parseInt(r[1]);return F(n!==0&&n<=32,"invalid bytes length","param",e),new RO(n,e.name)}F(!1,"invalid type","type",e.type)}getDefaultValue(e){const r=e.map(i=>this.#e(it.from(i)));return new Wo(r,"_").defaultValue()}encode(e,r){hx(r.length,e.length,"types/values length mismatch");const n=e.map(a=>this.#e(it.from(a))),i=new Wo(n,"_"),o=new jf;return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(a=>this.#e(it.from(a)));return new Wo(i,"_").decode(new Mh(r,n,Yg))}static _setDefaultMaxInflation(e){F(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Yg=e}static defaultAbiCoder(){return Af==null&&(Af=new Hi),Af}static getBuiltinCallException(e,r,n){return nk(e,r,n,Hi.defaultAbiCoder())}}class ik{fragment;name;signature;topic;args;constructor(e,r,n){const i=e.name,o=e.format();Te(this,{fragment:e,name:i,signature:o,topic:r,args:n})}}class sk{fragment;name;args;signature;selector;value;constructor(e,r,n,i){const o=e.name,a=e.format();Te(this,{fragment:e,name:o,args:n,signature:a,selector:r,value:i})}}class ok{fragment;name;args;signature;selector;constructor(e,r,n){const i=e.name,o=e.format();Te(this,{fragment:e,name:i,args:n,signature:o,selector:r})}}class Xg{hash;_isIndexed;static isIndexed(e){return!!(e&&e._isIndexed)}constructor(e){Te(this,{hash:e,_isIndexed:!0})}}const ey={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"},ty={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&ey[t.toString()]&&(e=ey[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};class Hn{fragments;deploy;fallback;receive;#e;#t;#r;#n;constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,this.#r=new Map,this.#e=new Map,this.#t=new Map;const n=[];for(const a of r)try{n.push(ti.from(a))}catch(u){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,u.message)}Te(this,{fragments:Object.freeze(n)});let i=null,o=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((a,u)=>{let l;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Te(this,{deploy:a});return;case"fallback":a.inputs.length===0?o=!0:(F(!i||a.payable!==i.payable,"conflicting fallback fragments",`fragments[${u}]`,a),i=a,o=i.payable);return;case"function":l=this.#r;break;case"event":l=this.#t;break;case"error":l=this.#e;break;default:return}const h=a.format();l.has(h)||l.set(h,a)}),this.deploy||Te(this,{deploy:Qr.from("constructor()")}),Te(this,{fallback:i,receive:o})}format(e){const r=e?"minimal":"full";return this.fragments.map(i=>i.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return Hi.defaultAbiCoder()}#i(e,r,n){if(tt(e)){const o=e.toLowerCase();for(const a of this.#r.values())if(o===a.selector)return a;return null}if(e.indexOf("(")===-1){const o=[];for(const[a,u]of this.#r)a.split("(")[0]===e&&o.push(u);if(r){const a=r.length>0?r[r.length-1]:null;let u=r.length,l=!0;yt.isTyped(a)&&a.type==="overrides"&&(l=!1,u--);for(let h=o.length-1;h>=0;h--){const d=o[h].inputs.length;d!==u&&(!l||d!==u-1)&&o.splice(h,1)}for(let h=o.length-1;h>=0;h--){const d=o[h].inputs;for(let m=0;m<r.length;m++)if(yt.isTyped(r[m])){if(m>=d.length){if(r[m].type==="overrides")continue;o.splice(h,1);break}if(r[m].type!==d[m].baseType){o.splice(h,1);break}}}}if(o.length===1&&r&&r.length!==o[0].inputs.length){const a=r[r.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&o.splice(0,1)}if(o.length===0)return null;if(o.length>1&&n){const a=o.map(u=>JSON.stringify(u.format())).join(", ");F(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return o[0]}const i=this.#r.get(zr.from(e).format());return i||null}getFunctionName(e){const r=this.#i(e,null,!1);return F(r,"no matching function","key",e),r.name}hasFunction(e){return!!this.#i(e,null,!1)}getFunction(e,r){return this.#i(e,r||null,!0)}forEachFunction(e){const r=Array.from(this.#r.keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;n<r.length;n++){const i=r[n];e(this.#r.get(i),n)}}#o(e,r,n){if(tt(e)){const o=e.toLowerCase();for(const a of this.#t.values())if(o===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const o=[];for(const[a,u]of this.#t)a.split("(")[0]===e&&o.push(u);if(r){for(let a=o.length-1;a>=0;a--)o[a].inputs.length<r.length&&o.splice(a,1);for(let a=o.length-1;a>=0;a--){const u=o[a].inputs;for(let l=0;l<r.length;l++)if(yt.isTyped(r[l])&&r[l].type!==u[l].baseType){o.splice(a,1);break}}}if(o.length===0)return null;if(o.length>1&&n){const a=o.map(u=>JSON.stringify(u.format())).join(", ");F(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return o[0]}const i=this.#t.get(Mr.from(e).format());return i||null}getEventName(e){const r=this.#o(e,null,!1);return F(r,"no matching event","key",e),r.name}hasEvent(e){return!!this.#o(e,null,!1)}getEvent(e,r){return this.#o(e,r||null,!0)}forEachEvent(e){const r=Array.from(this.#t.keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;n<r.length;n++){const i=r[n];e(this.#t.get(i),n)}}getError(e,r){if(tt(e)){const i=e.toLowerCase();if(ty[i])return Yt.from(ty[i].signature);for(const o of this.#e.values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of this.#e)o.split("(")[0]===e&&i.push(a);if(i.length===0)return e==="Error"?Yt.from("error Error(string)"):e==="Panic"?Yt.from("error Panic(uint256)"):null;if(i.length>1){const o=i.map(a=>JSON.stringify(a.format())).join(", ");F(!1,`ambiguous error description (i.e. ${o})`,"name",e)}return i[0]}if(e=Yt.from(e).format(),e==="Error(string)")return Yt.from("error Error(string)");if(e==="Panic(uint256)")return Yt.from("error Panic(uint256)");const n=this.#e.get(e);return n||null}forEachError(e){const r=Array.from(this.#e.keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;n<r.length;n++){const i=r[n];e(this.#e.get(i),n)}}_decodeParams(e,r){return this.#n.decode(e,r)}_encodeParams(e,r){return this.#n.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){if(typeof e=="string"){const n=this.getError(e);F(n,"unknown error","fragment",e),e=n}return F(ot(r,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",r),this._decodeParams(e.inputs,ot(r,4))}encodeErrorResult(e,r){if(typeof e=="string"){const n=this.getError(e);F(n,"unknown error","fragment",e),e=n}return je([e.selector,this._encodeParams(e.inputs,r||[])])}decodeFunctionData(e,r){if(typeof e=="string"){const n=this.getFunction(e);F(n,"unknown function","fragment",e),e=n}return F(ot(r,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",r),this._decodeParams(e.inputs,ot(r,4))}encodeFunctionData(e,r){if(typeof e=="string"){const n=this.getFunction(e);F(n,"unknown function","fragment",e),e=n}return je([e.selector,this._encodeParams(e.inputs,r||[])])}decodeFunctionResult(e,r){if(typeof e=="string"){const o=this.getFunction(e);F(o,"unknown function","fragment",e),e=o}let n="invalid length for result data";const i=Ft(r);if(i.length%32===0)try{return this.#n.decode(e.outputs,i)}catch{n="could not decode result data"}re(!1,n,"BAD_DATA",{value:ae(i),info:{method:e.name,signature:e.format()}})}makeError(e,r){const n=de(e,"data"),i=Hi.getBuiltinCallException("call",r,n);if(i.message.startsWith("execution reverted (unknown custom error)")){const u=ae(n.slice(0,4)),l=this.getError(u);if(l)try{const h=this.#n.decode(l.inputs,n.slice(4));i.revert={name:l.name,signature:l.format(),args:h},i.reason=i.revert.signature,i.message=`execution reverted: ${i.reason}`}catch{i.message="execution reverted (coult not decode custom error)"}}const a=this.parseTransaction(r);return a&&(i.invocation={method:a.name,signature:a.signature,args:a.args}),i}encodeFunctionResult(e,r){if(typeof e=="string"){const n=this.getFunction(e);F(n,"unknown function","fragment",e),e=n}return ae(this.#n.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){if(typeof e=="string"){const o=this.getEvent(e);F(o,"unknown event","eventFragment",e),e=o}re(r.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:r.length,expectedCount:e.inputs.length});const n=[];e.anonymous||n.push(e.topicHash);const i=(o,a)=>o.type==="string"?on(a):o.type==="bytes"?lt(ae(a)):(o.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":o.type.match(/^u?int/)?a=sn(a):o.type.match(/^bytes/)?a=fS(a,32):o.type==="address"&&this.#n.encode(["address"],[a]),nn(ae(a),32));for(r.forEach((o,a)=>{const u=e.inputs[a];if(!u.indexed){F(o==null,"cannot filter non-indexed parameters; must be null","contract."+u.name,o);return}o==null?n.push(null):u.baseType==="array"||u.baseType==="tuple"?F(!1,"filtering with tuples or arrays not supported","contract."+u.name,o):Array.isArray(o)?n.push(o.map(l=>i(u,l))):n.push(i(u,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const a=this.getEvent(e);F(a,"unknown event","eventFragment",e),e=a}const n=[],i=[],o=[];return e.anonymous||n.push(e.topicHash),F(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((a,u)=>{const l=r[u];if(a.indexed)if(a.type==="string")n.push(on(l));else if(a.type==="bytes")n.push(lt(l));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(this.#n.encode([a.type],[l]))}else i.push(a),o.push(l)}),{data:this.#n.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const w=this.getEvent(e);F(w,"unknown event","eventFragment",e),e=w}if(n!=null&&!e.anonymous){const w=e.topicHash;F(tt(n[0],32)&&n[0].toLowerCase()===w,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const i=[],o=[],a=[];e.inputs.forEach((w,T)=>{w.indexed?w.type==="string"||w.type==="bytes"||w.baseType==="tuple"||w.baseType==="array"?(i.push(it.from({type:"bytes32",name:w.name})),a.push(!0)):(i.push(w),a.push(!1)):(o.push(w),a.push(!1))});const u=n!=null?this.#n.decode(i,je(n)):null,l=this.#n.decode(o,r,!0),h=[],d=[];let m=0,y=0;return e.inputs.forEach((w,T)=>{let R=null;if(w.indexed)if(u==null)R=new Xg(null);else if(a[T])R=new Xg(u[y++]);else try{R=u[y++]}catch(O){R=O}else try{R=l[m++]}catch(O){R=O}h.push(R),d.push(w.name||null)}),Wr.fromItems(h,d)}parseTransaction(e){const r=de(e.data,"tx.data"),n=pe(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(ae(r.slice(0,4)));if(!i)return null;const o=this.#n.decode(i.inputs,r.slice(4));return new sk(i,i.selector,o,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ik(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=ae(e),n=this.getError(ot(r,0,4));if(!n)return null;const i=this.#n.decode(n.inputs,ot(r,4));return new ok(n,n.selector,i)}static from(e){return e instanceof Hn?e:typeof e=="string"?new Hn(JSON.parse(e)):typeof e.formatJson=="function"?new Hn(e.formatJson()):typeof e.format=="function"?new Hn(e.format("json")):new Hn(e)}}const sw=BigInt(0);function Ci(t){return t??null}function Et(t){return t==null?null:t.toString()}class ry{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,r,n){Te(this,{gasPrice:Ci(e),maxFeePerGas:Ci(r),maxPriorityFeePerGas:Ci(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Et(e),maxFeePerGas:Et(r),maxPriorityFeePerGas:Et(n)}}}function eo(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=ae(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=pe(t[i],`request.${i}`));const n="type,nonce".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=Ie(t[i],`request.${i}`));return t.accessList&&(e.accessList=ui(t.accessList)),t.authorizationList&&(e.authorizationList=t.authorizationList.slice()),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobWrapperVersion"in t&&(e.blobWrapperVersion=t.blobWrapperVersion),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(i=>Ka(i)?ae(i):Object.assign({},i))),e}class ak{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;transactionsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#e;constructor(e,r){this.#e=e.transactions.map(n=>typeof n!="string"?new go(n,r):n),Te(this,{provider:r,hash:Ci(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Ci(e.prevRandao),extraData:e.extraData,baseFeePerGas:Ci(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot,transactionsRoot:e.transactionsRoot})}get transactions(){return this.#e.map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=this.#e.slice();return e.length===0?[]:(re(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:i,gasUsed:o,hash:a,miner:u,prevRandao:l,nonce:h,number:d,parentHash:m,parentBeaconBlockRoot:y,stateRoot:w,receiptsRoot:T,transactionsRoot:R,timestamp:O,transactions:A}=this;return{_type:"Block",baseFeePerGas:Et(e),difficulty:Et(r),extraData:n,gasLimit:Et(i),gasUsed:Et(o),blobGasUsed:Et(this.blobGasUsed),excessBlobGas:Et(this.excessBlobGas),hash:a,miner:u,prevRandao:l,nonce:h,number:d,parentHash:m,timestamp:O,parentBeaconBlockRoot:y,stateRoot:w,receiptsRoot:T,transactionsRoot:R,transactions:A}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>e<this.length?{value:r[e++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#e.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let r;if(typeof e=="number")r=this.#e[e];else{const n=e.toLowerCase();for(const i of this.#e)if(typeof i=="string"){if(i!==n)continue;r=i;break}else{if(i.hash!==n)continue;r=i;break}}if(r==null)throw new Error("no such tx");return typeof r=="string"?await this.provider.getTransaction(r):r}getPrefetchedTransaction(e){const r=this.prefetchedTransactions;if(typeof e=="number")return r[e];e=e.toLowerCase();for(const n of r)if(n.hash===e)return n;F(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return ck(this)}}class mo{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(e,r){this.provider=r;const n=Object.freeze(e.topics.slice());Te(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:n,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:r,blockNumber:n,data:i,index:o,removed:a,topics:u,transactionHash:l,transactionIndex:h}=this;return{_type:"log",address:e,blockHash:r,blockNumber:n,data:i,index:o,removed:a,topics:u,transactionHash:l,transactionIndex:h}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return re(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return re(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return re(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return uk(this)}}class ow{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#e;constructor(e,r){this.#e=Object.freeze(e.logs.map(i=>new mo(i,r)));let n=sw;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Te(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#e}toJSON(){const{to:e,from:r,contractAddress:n,hash:i,index:o,blockHash:a,blockNumber:u,logsBloom:l,logs:h,status:d,root:m}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:u,contractAddress:n,cumulativeGasUsed:Et(this.cumulativeGasUsed),from:r,gasPrice:Et(this.gasPrice),blobGasUsed:Et(this.blobGasUsed),blobGasPrice:Et(this.blobGasPrice),gasUsed:Et(this.gasUsed),hash:i,index:o,logs:h,logsBloom:l,root:m,status:d,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return cw(this)}reorderedEvent(e){return re(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),aw(this,e)}}class go{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;authorizationList;#e;constructor(e,r){this.provider=r,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,this.authorizationList=e.authorizationList!=null?e.authorizationList:null,this.#e=-1}toJSON(){const{blockNumber:e,blockHash:r,index:n,hash:i,type:o,to:a,from:u,nonce:l,data:h,signature:d,accessList:m,blobVersionedHashes:y}=this;return{_type:"TransactionResponse",accessList:m,blockNumber:e,blockHash:r,blobVersionedHashes:y,chainId:Et(this.chainId),data:h,from:u,gasLimit:Et(this.gasLimit),gasPrice:Et(this.gasPrice),hash:i,maxFeePerGas:Et(this.maxFeePerGas),maxPriorityFeePerGas:Et(this.maxPriorityFeePerGas),maxFeePerBlobGas:Et(this.maxFeePerBlobGas),nonce:l,signature:d,to:a,index:n,type:o,value:Et(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const n=await this.getTransaction();n&&(e=n.blockNumber)}if(e==null)return null;const r=this.provider.getBlock(e);if(r==null)throw new Error("TODO");return r}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:r,blockNumber:n}=await zt({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return r==null||r.blockNumber==null?0:n-r.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,r){const n=e??1,i=r??0;let o=this.#e,a=-1,u=o===-1;const l=async()=>{if(u)return null;const{blockNumber:y,nonce:w}=await zt({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(w<this.nonce){o=y;return}if(u)return null;const T=await this.getTransaction();if(!(T&&T.blockNumber!=null))for(a===-1&&(a=o-3,a<this.#e&&(a=this.#e));a<=y;){if(u)return null;const R=await this.provider.getBlock(a,!0);if(R==null)return;for(const O of R)if(O===this.hash)return;for(let O=0;O<R.length;O++){const A=await R.getTransaction(O);if(A.from===this.from&&A.nonce===this.nonce){if(u)return null;const I=await this.provider.getTransactionReceipt(A.hash);if(I==null||y-I.blockNumber+1<n)return;let B="replaced";A.data===this.data&&A.to===this.to&&A.value===this.value?B="repriced":A.data==="0x"&&A.from===A.to&&A.value===sw&&(B="cancelled"),re(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:B==="replaced"||B==="cancelled",reason:B,replacement:A.replaceableTransaction(o),hash:A.hash,receipt:I})}}a++}},h=y=>{if(y==null||y.status!==0)return y;re(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:y.to,from:y.from,data:""},receipt:y})},d=await this.provider.getTransactionReceipt(this.hash);if(n===0)return h(d);if(d){if(n===1||await d.confirmations()>=n)return h(d)}else if(await l(),n===0)return null;return await new Promise((y,w)=>{const T=[],R=()=>{T.forEach(A=>A())};if(T.push(()=>{u=!0}),i>0){const A=setTimeout(()=>{R(),w(ht("wait for transaction timeout","TIMEOUT"))},i);T.push(()=>{clearTimeout(A)})}const O=async A=>{if(await A.confirmations()>=n){R();try{y(h(A))}catch(I){w(I)}}};if(T.push(()=>{this.provider.off(this.hash,O)}),this.provider.on(this.hash,O),o>=0){const A=async()=>{try{await l()}catch(I){if(It(I,"TRANSACTION_REPLACED")){R(),w(I);return}}u||this.provider.once("block",A)};T.push(()=>{this.provider.off("block",A)}),this.provider.once("block",A)}})}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 re(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),cw(this)}reorderedEvent(e){return re(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),re(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),aw(this,e)}replaceableTransaction(e){F(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new go(this,this.provider);return r.#e=e,r}}function ck(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function aw(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function cw(t){return{orphan:"drop-transaction",tx:t}}function uk(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class n0 extends mo{interface;fragment;args;constructor(e,r,n){super(e,e.provider);const i=r.decodeEventLog(n,e.data,e.topics);Te(this,{args:i,fragment:n,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class uw extends mo{error;constructor(e,r){super(e,e.provider),Te(this,{error:r})}}class lk extends ow{#e;constructor(e,r,n){super(n,r),this.#e=e}get logs(){return super.logs.map(e=>{const r=e.topics.length?this.#e.getEvent(e.topics[0]):null;if(r)try{return new n0(e,this.#e,r)}catch(n){return new uw(e,n)}return e})}}class i0 extends go{#e;constructor(e,r,n){super(n,r),this.#e=e}async wait(e,r){const n=await super.wait(e,r);return n==null?null:new lk(this.#e,this.provider,n)}}class lw extends bx{log;constructor(e,r,n,i){super(e,r,n),Te(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 fk extends lw{constructor(e,r,n,i,o){super(e,r,n,new n0(o,e.interface,i));const a=e.interface.decodeEventLog(i,this.log.data,this.log.topics);Te(this,{args:a,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const ny=BigInt(0);function fw(t){return t&&typeof t.call=="function"}function hw(t){return t&&typeof t.estimateGas=="function"}function oc(t){return t&&typeof t.resolveName=="function"}function dw(t){return t&&typeof t.sendTransaction=="function"}function pw(t){if(t!=null){if(oc(t))return t;if(t.provider)return t.provider}}class hk{#e;fragment;constructor(e,r,n){if(Te(this,{fragment:r}),r.inputs.length<n.length)throw new Error("too many arguments");const i=ri(e.runner,"resolveName"),o=oc(i)?i:null;this.#e=(async function(){const a=await Promise.all(r.inputs.map((u,l)=>n[l]==null?null:u.walkAsync(n[l],(d,m)=>d==="address"?Array.isArray(m)?Promise.all(m.map(y=>Ct(y,o))):Ct(m,o):m)));return e.interface.encodeFilterTopics(r,a)})()}getTopicFilter(){return this.#e}}function ri(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Kn(t){return t==null?null:t.provider||null}async function mw(t,e){const r=yt.dereference(t,"overrides");F(typeof r=="object","invalid overrides parameter","overrides",t);const n=eo(r);return F(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),F(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function dk(t,e,r){const n=ri(t,"resolveName"),i=oc(n)?n:null;return await Promise.all(e.map((o,a)=>o.walkAsync(r[a],(u,l)=>(l=yt.dereference(l,u),u==="address"?Ct(l,i):l))))}function pk(t){const e=async function(a){const u=await mw(a,["data"]);u.to=await t.getAddress(),u.from&&(u.from=await Ct(u.from,pw(t.runner)));const l=t.interface,h=pe(u.value||ny,"overrides.value")===ny,d=(u.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!d&&!h&&F(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),F(l.fallback||d,"cannot send data to receive-only contract","overrides.data",u.data);const m=l.receive||l.fallback&&l.fallback.payable;return F(m||h,"cannot send value to non-payable fallback","overrides.value",u.value),F(l.fallback||d,"cannot send data to receive-only contract","overrides.data",u.data),u},r=async function(a){const u=ri(t.runner,"call");re(fw(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(a);try{return await u.call(l)}catch(h){throw Uh(h)&&h.data?t.interface.makeError(h.data,l):h}},n=async function(a){const u=t.runner;re(dw(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await u.sendTransaction(await e(a)),h=Kn(t.runner);return new i0(t.interface,h,l)},i=async function(a){const u=ri(t.runner,"estimateGas");return re(hw(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await e(a))},o=async a=>await n(a);return Te(o,{_contract:t,estimateGas:i,populateTransaction:e,send:n,staticCall:r}),o}function mk(t,e){const r=function(...h){const d=t.interface.getFunction(e,h);return re(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:h}}),d},n=async function(...h){const d=r(...h);let m={};if(d.inputs.length+1===h.length&&(m=await mw(h.pop()),m.from&&(m.from=await Ct(m.from,pw(t.runner)))),d.inputs.length!==h.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const y=await dk(t.runner,d.inputs,h);return Object.assign({},m,await zt({to:t.getAddress(),data:t.interface.encodeFunctionData(d,y)}))},i=async function(...h){const d=await u(...h);return d.length===1?d[0]:d},o=async function(...h){const d=t.runner;re(dw(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const m=await d.sendTransaction(await n(...h)),y=Kn(t.runner);return new i0(t.interface,y,m)},a=async function(...h){const d=ri(t.runner,"estimateGas");return re(hw(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await n(...h))},u=async function(...h){const d=ri(t.runner,"call");re(fw(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const m=await n(...h);let y="0x";try{y=await d.call(m)}catch(T){throw Uh(T)&&T.data?t.interface.makeError(T.data,m):T}const w=r(...h);return t.interface.decodeFunctionResult(w,y)},l=async(...h)=>r(...h).constant?await i(...h):await o(...h);return Te(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:a,populateTransaction:n,send:o,staticCall:i,staticCallResult:u}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const h=t.interface.getFunction(e);return re(h,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),h}}),l}function gk(t,e){const r=function(...i){const o=t.interface.getEvent(e,i);return re(o,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),o},n=function(...i){return new hk(t,r(...i),i)};return Te(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return re(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),n}const Ia=Symbol.for("_ethersInternal_contract"),gw=new WeakMap;function yk(t,e){gw.set(t[Ia],e)}function ir(t){return gw.get(t[Ia])}function bk(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function s0(t,e){let r,n=null;if(Array.isArray(e)){const o=function(a){if(tt(a,32))return a;const u=t.interface.getEvent(a);return F(u,"unknown fragment","name",a),u.topicHash};r=e.map(a=>a==null?null:Array.isArray(a)?a.map(o):o(a))}else e==="*"?r=[null]:typeof e=="string"?tt(e,32)?r=[e]:(n=t.interface.getEvent(e),F(n,"unknown fragment","event",e),r=[n.topicHash]):bk(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):F(!1,"unknown event name","event",e);r=r.map(o=>{if(o==null)return null;if(Array.isArray(o)){const a=Array.from(new Set(o.map(u=>u.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return o.toLowerCase()});const i=r.map(o=>o==null?"null":Array.isArray(o)?o.join("|"):o).join("&");return{fragment:n,tag:i,topics:r}}async function Ns(t,e){const{subs:r}=ir(t);return r.get((await s0(t,e)).tag)||null}async function iy(t,e,r){const n=Kn(t.runner);re(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:o,topics:a}=await s0(t,r),{addr:u,subs:l}=ir(t);let h=l.get(o);if(!h){const m={address:u||t,topics:a},y=O=>{let A=i;if(A==null)try{A=t.interface.getEvent(O.topics[0])}catch{}if(A){const I=A,B=i?t.interface.decodeEventLog(i,O.data,O.topics):[];nh(t,r,B,S=>new fk(t,S,r,I,O))}else nh(t,r,[],I=>new lw(t,I,r,O))};let w=[];h={tag:o,listeners:[],start:()=>{w.length||w.push(n.on(m,y))},stop:async()=>{if(w.length==0)return;let O=w;w=[],await Promise.all(O),n.off(m,y)}},l.set(o,h)}return h}let rh=Promise.resolve();async function xk(t,e,r,n){await rh;const i=await Ns(t,e);if(!i)return!1;const o=i.listeners.length;return i.listeners=i.listeners.filter(({listener:a,once:u})=>{const l=Array.from(r);n&&l.push(n(u?null:a));try{a.call(t,...l)}catch{}return!u}),i.listeners.length===0&&(i.stop(),ir(t).subs.delete(i.tag)),o>0}async function nh(t,e,r,n){try{await rh}catch{}const i=xk(t,e,r,n);return rh=i,await i}const Yo=["then"];class zs{target;interface;runner;filters;[Ia];fallback;constructor(e,r,n,i){F(typeof e=="string"||E1(e),"invalid value for Contract target","target",e),n==null&&(n=null);const o=Hn.from(r);Te(this,{target:e,runner:n,interface:o}),Object.defineProperty(this,Ia,{value:{}});let a,u=null,l=null;if(i){const m=Kn(n);l=new i0(this.interface,m,i)}let h=new Map;if(typeof e=="string")if(tt(e))u=e,a=Promise.resolve(e);else{const m=ri(n,"resolveName");if(!oc(m))throw ht("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=m.resolveName(e).then(y=>{if(y==null)throw ht("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return ir(this).addr=y,y})}else a=e.getAddress().then(m=>{if(m==null)throw new Error("TODO");return ir(this).addr=m,m});yk(this,{addrPromise:a,addr:u,deployTx:l,subs:h});const d=new Proxy({},{get:(m,y,w)=>{if(typeof y=="symbol"||Yo.indexOf(y)>=0)return Reflect.get(m,y,w);try{return this.getEvent(y)}catch(T){if(!It(T,"INVALID_ARGUMENT")||T.argument!=="key")throw T}},has:(m,y)=>Yo.indexOf(y)>=0?Reflect.has(m,y):Reflect.has(m,y)||this.interface.hasEvent(String(y))});return Te(this,{filters:d}),Te(this,{fallback:o.receive||o.fallback?pk(this):null}),new Proxy(this,{get:(m,y,w)=>{if(typeof y=="symbol"||y in m||Yo.indexOf(y)>=0)return Reflect.get(m,y,w);try{return m.getFunction(y)}catch(T){if(!It(T,"INVALID_ARGUMENT")||T.argument!=="key")throw T}},has:(m,y)=>typeof y=="symbol"||y in m||Yo.indexOf(y)>=0?Reflect.has(m,y):m.interface.hasFunction(y)})}connect(e){return new zs(this.target,this.interface,e)}attach(e){return new zs(e,this.interface,this.runner)}async getAddress(){return await ir(this).addrPromise}async getDeployedCode(){const e=Kn(this.runner);re(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Kn(this.runner);return re(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,o)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);n.once("block",a)}catch(u){o(u)}};a()})}deploymentTransaction(){return ir(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),mk(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),gk(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:i,addrPromise:o}=ir(this),a=i||await o,{fragment:u,topics:l}=await s0(this,e),h={address:a,topics:l,fromBlock:r,toBlock:n},d=Kn(this.runner);return re(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(h)).map(m=>{let y=u;if(y==null)try{y=this.interface.getEvent(m.topics[0])}catch{}if(y)try{return new n0(m,this.interface,y)}catch(w){return new uw(m,w)}return new mo(m,d)})}async on(e,r){const n=await iy(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await iy(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await nh(this,e,r,null)}async listenerCount(e){if(e){const i=await Ns(this,e);return i?i.listeners.length:0}const{subs:r}=ir(this);let n=0;for(const{listeners:i}of r.values())n+=i.length;return n}async listeners(e){if(e){const i=await Ns(this,e);return i?i.listeners.map(({listener:o})=>o):[]}const{subs:r}=ir(this);let n=[];for(const{listeners:i}of r.values())n=n.concat(i.map(({listener:o})=>o));return n}async off(e,r){const n=await Ns(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:o})=>o).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(r==null||n.listeners.length===0)&&(n.stop(),ir(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await Ns(this,e);if(!r)return this;r.stop(),ir(this).subs.delete(r.tag)}else{const{subs:r}=ir(this);for(const{tag:n,stop:i}of r.values())i(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends zs{constructor(i,o=null){super(i,e,o)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}}function wk(){return zs}class la extends wk(){}const Cs=BigInt(60);function Ef(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):F(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Ak{name;constructor(e){Te(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const yw=new RegExp("^(ipfs)://(.*)$","i"),sy=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),yw,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function oy(t){return t===Cs||t>=2147483648&&t<=4294967295}class Jr{provider;address;name;#e;#t;constructor(e,r,n,i){Te(this,{provider:e,address:r,name:n}),this.#e=i!=null?Promise.resolve(i):null,this.#t=new la(r,["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)","function name(bytes32) view returns (string)"],e)}async supportsWildcard(){return this.#e==null&&(this.#e=(async()=>{try{return await this.#t.supportsInterface("0x9061b923")}catch(e){if(It(e,"CALL_EXCEPTION"))return!1;throw this.#e=null,e}})()),await this.#e}async#r(e,r){r=(r||[]).slice();const n=this.#t.interface;r.unshift(Ug(this.name));let i=null;await this.supportsWildcard()&&(i=n.getFunction(e),re(i,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),r=[Mg(this.name,255),n.encodeFunctionData(i,r)],e="resolve(bytes,bytes)"),r.push({enableCcipRead:!0});try{const o=await this.#t[e](...r);return i?n.decodeFunctionResult(i,o)[0]:o}catch(o){if(!It(o,"CALL_EXCEPTION"))throw o}return null}async getAddress(e){const r=e==null?Cs:pe(e);if(r===Cs)try{const o=await this.#r("addr(bytes32)");return o==null||o===Ra?null:o}catch(o){if(It(o,"CALL_EXCEPTION"))return null;throw o}if(oy(r)){const o=await this.#r("addr(bytes32,uint)",[r]);return tt(o,20)?ze(o):null}if(r>=0&&r<2147483648){let o=r+BigInt(2147483648);const a=await this.#r("addr(bytes32,uint)",[o]);if(tt(a,20))return ze(a)}let n=null;for(const o of this.provider.plugins)if(o instanceof Ak&&r<=2147483648&&o.supportsCoinType(Number(r))){n=o;break}if(n==null)return null;const i=await this.#r("addr(bytes32,uint)",[r]);if(i==null||i==="0x")return null;if(r<2147483648){const o=await n.decodeAddress(Number(r),i);if(o!=null)return o}re(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${r})`,info:{coinType:r,data:i}})}async getText(e){const r=await this.#r("text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await this.#r("contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const i=r[1]==="e3010170"?"ipfs":"ipns",o=parseInt(r[4],16);if(r[5].length===o*2)return`${i}://${yx("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;re(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getName(){return await this.#r("name(bytes32)")}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n<sy.length;n++){const i=r.match(sy[n]);if(i==null)continue;const o=i[1].toLowerCase();switch(o){case"https":case"data":return e.push({type:"url",value:r}),{linkage:e,url:r};case"ipfs":{const a=Ef(r);return e.push({type:"ipfs",value:r}),e.push({type:"url",value:a}),{linkage:e,url:a}}case"erc721":case"erc1155":{const a=o==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:o,value:r});const u=await this.getAddress();if(u==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(i[2]||"").split("/");if(l.length!==2)return e.push({type:`!${o}caip`,value:i[2]||""}),{url:null,linkage:e};const h=l[1],d=new la(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 R=await d.ownerOf(h);if(u!==R)return e.push({type:"!owner",value:R}),{url:null,linkage:e};e.push({type:"owner",value:R})}else if(o==="erc1155"){const R=await d.balanceOf(u,h);if(!R)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:R.toString()})}let m=await d[a](h);if(m==null||m==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:m}),o==="erc1155"&&(m=m.replace("{id}",sn(h,32).substring(2)),e.push({type:"metadata-url-expanded",value:m})),m.match(/^ipfs:/i)&&(m=Ef(m)),e.push({type:"metadata-url",value:m});let y={};const w=await new Vr(m).send();w.assertOk();try{y=w.bodyJson}catch{try{e.push({type:"!metadata",value:w.bodyText})}catch{const A=w.body;return A&&e.push({type:"!metadata",value:ae(A)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!y)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(y)});let T=y.image;if(typeof T!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!T.match(/^(https:\/\/|data:)/i)){if(T.match(yw)==null)return e.push({type:"!imageUrl-ipfs",value:T}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:T}),T=Ef(T)}return e.push({type:"url",value:T}),{linkage:e,url:T}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const r=await e.getNetwork(),n=r.getPlugin("org.ethers.plugins.network.Ens");return re(n,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:r}}),n.address}static async getUniversalResolverAddress(e){const n=(await e.getNetwork()).getPlugin("org.ethers.plugins.network.Ens");return n&&n.universalResolver?n.universalResolver:null}static async#n(e,r){const n=await Jr.getEnsAddress(e);try{const o=await new la(n,["function resolver(bytes32) view returns (address)"],e).resolver(Ug(r),{enableCcipRead:!0});return o===Ra?null:o}catch(i){throw i}return null}static async lookupAddress(e,r,n){const i=n==null?Cs:pe(n);oy(i)&&(r=ze(r));const o=await ay(e);if(o)try{const u=(await o.reverse(r,i,{enableCcipRead:!0})).primary;return Lg(u)?u:null}catch(a){if(It(a,"CALL_EXCEPTION")&&a.reason==="ResolverNotFound(bytes)")return null;throw a}re(i===Cs,"lookupAddress coinType requires ENS Universal Resolver","UNSUPPORTED_OPERATION",{operation:"lookupAddress"});try{const a=await Jr.fromName(e,`${r.toLowerCase().substring(2)}.addr.reverse`);if(!a)return null;const u=await a.getName();return u==null||!Lg(u)||await e.resolveName(u)!==r?null:u}catch(a){if(It(a,"BAD_DATA")&&a.value==="0x"||It(a,"CALL_EXCEPTION"))return null;throw a}}static async fromName(e,r){const n=await ay(e);if(n){let o;try{o=Mg(Z1(r),255)}catch{return null}const a=await n.requireResolver(o);return new Jr(e,a.resolver,r,a.extended)}let i=r;for(;;){if(i===""||i==="."||r!=="eth"&&i==="eth")return null;const o=await Jr.#n(e,i);if(o!=null){const a=new Jr(e,o,r);return i!==r&&!await a.supportsWildcard()?null:a}i=i.split(".").slice(1).join(".")}}}async function ay(t){const e=await Jr.getUniversalResolverAddress(t);return e?new la(e,["function requireResolver(bytes) view returns ((bytes name, uint256 offset, bytes32 node, address resolver, bool extended))","function findResolver(bytes) view returns (address resolver, bytes32 node, uint offset)","function resolve(bytes name, bytes data) view returns (bytes result, address resolver)","function reverse(bytes name, uint coinType) view returns (string primary, address resolver, address reverseResolver)","error ResolverNotFound(bytes name)","error ResolverNotContract(bytes name, address resolver)","error ReverseAddressMismatch(string primary, bytes primaryAddress)","error HttpError(uint16 statusCode, string statusMessage)"],t):null}const cy=BigInt(0);function Me(t,e){return(function(r){return r==null?e:t(r)})}function to(t,e){return(r=>{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))})}function yo(t,e){return(r=>{const n={};for(const i in t){let o=i;if(e&&i in e&&!(o in r)){for(const a of e[i])if(a in r){o=a;break}}try{const a=t[i](r[o]);a!==void 0&&(n[i]=a)}catch(a){const u=a instanceof Error?a.message:"not-an-error";re(!1,`invalid value for value.${i} (${u})`,"BAD_DATA",{value:r})}}return n})}function Ek(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}F(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function qi(t){return F(tt(t,!0),"invalid data","value",t),t}function Ot(t){return F(tt(t,32),"invalid hash","value",t),t}const vk=yo({address:ze,blockHash:Ot,blockNumber:Ie,data:qi,index:Ie,removed:Me(Ek,!1),topics:to(Ot),transactionHash:Ot,transactionIndex:Ie},{index:["logIndex"]});function Rk(t){return vk(t)}const Tk=yo({hash:Me(Ot),parentHash:Ot,parentBeaconBlockRoot:Me(Ot,null),number:Ie,timestamp:Ie,nonce:Me(qi),difficulty:pe,gasLimit:pe,gasUsed:pe,stateRoot:Me(Ot,null),receiptsRoot:Me(Ot,null),transactionsRoot:Me(Ot,null),blobGasUsed:Me(pe,null),excessBlobGas:Me(pe,null),miner:Me(ze),prevRandao:Me(Ot,null),extraData:qi,baseFeePerGas:Me(pe)},{prevRandao:["mixHash"]});function Bk(t){const e=Tk(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:bw(r)),e}const Sk=yo({transactionIndex:Ie,blockNumber:Ie,transactionHash:Ot,address:ze,topics:to(Ot),data:qi,index:Ie,blockHash:Ot},{index:["logIndex"]});function Pk(t){return Sk(t)}const Ok=yo({to:Me(ze,null),from:Me(ze,null),contractAddress:Me(ze,null),index:Ie,root:Me(ae),gasUsed:pe,blobGasUsed:Me(pe,null),logsBloom:Me(qi),blockHash:Ot,hash:Ot,logs:to(Pk),blockNumber:Ie,cumulativeGasUsed:pe,effectiveGasPrice:Me(pe),blobGasPrice:Me(pe,null),status:Me(Ie),type:Me(Ie,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Ik(t){return Ok(t)}function bw(t){t.to&&pe(t.to)===cy&&(t.to="0x0000000000000000000000000000000000000000");const e=yo({hash:Ot,index:Me(Ie,void 0),type:r=>r==="0x"||r==null?0:Ie(r),accessList:Me(ui,null),blobVersionedHashes:Me(to(Ot,!0),null),authorizationList:Me(to(r=>{let n;if(r.signature)n=r.signature;else{let i=r.yParity;i==="0x1b"?i=0:i==="0x1c"&&(i=1),n=Object.assign({},r,{yParity:i})}return{address:ze(r.address),chainId:pe(r.chainId),nonce:pe(r.nonce),signature:dt.from(n)}},!1),null),blockHash:Me(Ot,null),blockNumber:Me(Ie,null),transactionIndex:Me(Ie,null),from:ze,gasPrice:Me(pe),maxPriorityFeePerGas:Me(pe),maxFeePerGas:Me(pe),maxFeePerBlobGas:Me(pe,null),gasLimit:pe,to:Me(ze,null),value:pe,nonce:Ie,data:qi,creates:Me(ze,null),chainId:Me(pe,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=bO(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=dt.from(t.signature):e.signature=dt.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&pe(e.blockHash)===cy&&(e.blockHash=null),e}const kk="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",Nk=Symbol.for("nodejs.util.inspect.custom");class bo{name;constructor(e){Te(this,{name:e})}[Nk](){return this.toString()}toString(){return`${this.name} { }`}clone(){return new bo(this.name)}}class ac extends bo{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(e,r){e==null&&(e=0),super(`org.ethers.network.plugins.GasCost#${e||0}`);const n={effectiveBlock:e};function i(o,a){let u=(r||{})[o];u==null&&(u=a),F(typeof u=="number",`invalud value for ${o}`,"costs",r),n[o]=u}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Te(this,n)}toString(){return`${this.name} { txBase: ${this.txBase}, txCreate: ${this.txCreate}, txDataZero: ${this.txDataZero}, txAccessListStorageKey: ${this.txAccessListStorageKey}, txAccessListAddress: ${this.txAccessListAddress} }`}clone(){return new ac(this.effectiveBlock,this)}}class cc extends bo{address;targetNetwork;universalResolver;constructor(e,r,n){super("org.ethers.plugins.network.Ens"),Te(this,{address:e||kk,targetNetwork:r??1,universalResolver:n})}toString(){return`${this.name} { address: ${this.address}, targetNetwork: ${this.targetNetwork}, universalResolver: ${this.universalResolver} }`}clone(){return new cc(this.address,this.targetNetwork,this.universalResolver)}}class Ck extends bo{#e;#t;get url(){return this.#e}get processFunc(){return this.#t}constructor(e,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#e=e,this.#t=r}toString(){return`${this.name} { url: ${this.url} }`}clone(){return this}}const _k=Symbol.for("nodejs.util.inspect.custom"),vf=new Map;class ar{#e;#t;#r;constructor(e,r){this.#e=e,this.#t=pe(r),this.#r=new Map}[_k](){return this.toString()}toString(){const e=[];for(const r of this.#r.values())e.push(r.toString());return`Network { name: ${this.name}, chainId: ${this.chainId}, plugins: [ ${e.join(", ")} ] }`}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#e}set name(e){this.#e=e}get chainId(){return this.#t}set chainId(e){this.#t=pe(e,"chainId")}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===pe(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===pe(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===pe(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(this.#r.values())}attachPlugin(e){if(this.#r.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#r.set(e.name,e.clone()),this}getPlugin(e){return this.#r.get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new ar(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new ac;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let i=2;i<e.data.length;i+=2)e.data.substring(i,i+2)==="00"?n+=r.txDataZero:n+=r.txDataNonzero;if(e.accessList){const i=ui(e.accessList);for(const o in i)n+=r.txAccessListAddress+r.txAccessListStorageKey*i[o].storageKeys.length}return n}static from(e){if(Fk(),e==null)return ar.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const r=vf.get(e);if(r)return r();if(typeof e=="bigint")return new ar("unknown",e);F(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){F(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const r=new ar(e.name,e.chainId),n=e;return(n.ensAddress||n.ensNetwork!=null||n.ensUniversalResolver)&&r.attachPlugin(new cc(n.ensAddress,n.ensNetwork,n.ensUniversalResolver)),r}F(!1,"invalid network","network",e)}static register(e,r){typeof e=="number"&&(e=BigInt(e));const n=vf.get(e);n&&F(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",e),vf.set(e,r)}}function uy(t,e){const r=String(t);if(!r.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const n=r.split(".");if(n.length===1&&n.push(""),n.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;n[1].length<e;)n[1]+="0";if(n[1].length>9){let i=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||i++,n[1]=i.toString()}return BigInt(n[0]+n[1])}function ly(t){return new Ck(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let i;try{const[o,a]=await Promise.all([n.send(),e()]);i=o;const u=i.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:uy(u.maxFee,9),maxPriorityFeePerGas:uy(u.maxPriorityFee,9)}}catch(o){re(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:i,error:o})}})}let fy=!1;function Fk(){if(fy)return;fy=!0;function t(r,n,i){const o=function(){const a=new ar(r,n);return i.ensNetwork!=null&&a.attachPlugin(new cc(null,i.ensNetwork,i.ensUniversalResolver)),a.attachPlugin(new ac),(i.plugins||[]).forEach(u=>{a.attachPlugin(u)}),a};ar.register(r,o),ar.register(n,o),i.altNames&&i.altNames.forEach(a=>{ar.register(a,o)})}const e="0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe";t("mainnet",1,{ensUniversalResolver:e,ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensUniversalResolver:e,ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("filecoin",314,{}),t("filecoin-calibration",314159,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[ly("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[ly("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function ih(t){return JSON.parse(JSON.stringify(t))}class Dk{#e;#t;#r;#n;constructor(e){this.#e=e,this.#t=null,this.#r=4e3,this.#n=-2}get pollingInterval(){return this.#r}set pollingInterval(e){this.#r=e}async#i(){try{const e=await this.#e.getBlockNumber();if(this.#n===-2){this.#n=e;return}if(e!==this.#n){for(let r=this.#n+1;r<=e;r++){if(this.#t==null)return;await this.#e.emit("block",r)}this.#n=e}}catch{}this.#t!=null&&(this.#t=this.#e._setTimeout(this.#i.bind(this),this.#r))}start(){this.#t||(this.#t=this.#e._setTimeout(this.#i.bind(this),this.#r),this.#i())}stop(){this.#t&&(this.#e._clearTimeout(this.#t),this.#t=null)}pause(e){this.stop(),e&&(this.#n=-2)}resume(){this.start()}}class o0{#e;#t;#r;constructor(e){this.#e=e,this.#r=!1,this.#t=r=>{this._poll(r,this.#e)}}async _poll(e,r){throw new Error("sub-classes must override this")}start(){this.#r||(this.#r=!0,this.#t(-2),this.#e.on("block",this.#t))}stop(){this.#r&&(this.#r=!1,this.#e.off("block",this.#t))}pause(e){this.stop()}resume(){this.start()}}class Lk extends o0{#e;#t;constructor(e,r){super(e),this.#e=r,this.#t=-2}pause(e){e&&(this.#t=-2),super.pause(e)}async _poll(e,r){const n=await r.getBlock(this.#e);n!=null&&(this.#t===-2?this.#t=n.number:n.number>this.#t&&(r.emit(this.#e,n.number),this.#t=n.number))}}class Uk extends o0{#e;constructor(e,r){super(e),this.#e=ih(r)}async _poll(e,r){throw new Error("@TODO")}}class Mk extends o0{#e;constructor(e,r){super(e),this.#e=r}async _poll(e,r){const n=await r.getTransactionReceipt(this.#e);n&&r.emit(this.#e,n)}}class a0{#e;#t;#r;#n;#i;constructor(e,r){this.#e=e,this.#t=ih(r),this.#r=this.#o.bind(this),this.#n=!1,this.#i=-2}async#o(e){if(this.#i===-2)return;const r=ih(this.#t);r.fromBlock=this.#i+1,r.toBlock=e;const n=await this.#e.getLogs(r);if(n.length===0){this.#i<e-60&&(this.#i=e-60);return}for(const i of n)this.#e.emit(this.#t,i),this.#i=i.blockNumber}start(){this.#n||(this.#n=!0,this.#i===-2&&this.#e.getBlockNumber().then(e=>{this.#i=e}),this.#e.on("block",this.#r))}stop(){this.#n&&(this.#n=!1,this.#e.off("block",this.#r))}pause(e){this.stop(),e&&(this.#i=-2)}resume(){this.start()}}const zk=BigInt(2),$k=10;function Rf(t){return new Promise(e=>{setTimeout(e,t)})}function Xo(t){return t&&typeof t.then=="function"}function fa(t,e){return t+":"+JSON.stringify(e,(r,n)=>{if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);return i.sort(),i.reduce((o,a)=>(o[a]=n[a],o),{})}return n})}class xw{name;constructor(e){Te(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function Vk(t){return JSON.parse(JSON.stringify(t))}function sh(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function Tf(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(tt(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:fa("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:fa("orphan",r),filter:Vk(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(i=>i==null?null:Array.isArray(i)?sh(i.map(o=>o.toLowerCase())):i.toLowerCase())};if(r.address){const i=[],o=[],a=u=>{tt(u)?i.push(u):o.push((async()=>{i.push(await Ct(u,e))})())};Array.isArray(r.address)?r.address.forEach(a):a(r.address),o.length&&await Promise.all(o),n.address=sh(i.map(u=>u.toLowerCase()))}return{filter:n,tag:fa("event",n),type:"event"}}F(!1,"unknown ProviderEvent","event",t)}function ea(){return new Date().getTime()}const Gk={cacheTimeout:250,pollingInterval:4e3};class jk{#e;#t;#r;#n;#i;#o;#s;#a;#d;#u;#m;#p;#h;#l;constructor(e,r){if(this.#l=Object.assign({},Gk,r||{}),e==="any")this.#o=!0,this.#i=null;else if(e){const n=ar.from(e);this.#o=!1,this.#i=Promise.resolve(n),setTimeout(()=>{this.emit("network",n,null)},0)}else this.#o=!1,this.#i=null;this.#a=-1,this.#s=new Map,this.#e=new Map,this.#t=new Map,this.#r=null,this.#n=!1,this.#d=1,this.#u=new Map,this.#m=!1,this.#p=0,this.#h=[]}get _requestRate(){const e=this.#p;return e==0?null:e}set _requestRate(e){(e==null||e<0)&&(e=0),this.#p=Ie(e)}get pollingInterval(){return this.#l.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#t.values())}attachPlugin(e){if(this.#t.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#t.set(e.name,e.connect(this)),this}getPlugin(e){return this.#t.get(e)||null}get disableCcipRead(){return this.#m}set disableCcipRead(e){this.#m=!!e}#f(){let e=this.#p;if(e===0)return 0;const r=this.#h,n=ea();r.push(n);const i=n-1e3;for(;r.length&&r[0]<i;)r.shift();return r.length<e?0:r[0]+1e3-n}async#c(e){const r=this.#l.cacheTimeout;if(r<0){const o=this.#f();return o&&await Rf(o),await this._perform(e)}const n=fa(e.method,e);let i=this.#s.get(n);if(!i){const o=this.#f();o&&await Rf(o),i=this._perform(e),this.#s.set(n,i),setTimeout(()=>{this.#s.get(n)===i&&this.#s.delete(n)},r)}return await i}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),a=[];for(let u=0;u<n.length;u++){const l=n[u],h=l.replace("{sender}",i).replace("{data}",o),d=new Vr(h);l.indexOf("{data}")===-1&&(d.body={data:o,sender:i}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:d,index:u,urls:n});let m="unknown error",y;try{y=await d.send()}catch(w){a.push(w.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:{error:w}});continue}try{const w=y.bodyJson;if(w.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:d,result:w}),w.data;w.message&&(m=w.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:w})}catch{}re(y.statusCode<400||y.statusCode>=500,`response not found during CCIP fetch: ${m}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:m}}),a.push(m)}re(!1,`error encountered during CCIP fetch: ${a.map(u=>JSON.stringify(u)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:a}})}_wrapBlock(e,r){return new ak(Bk(e),this)}_wrapLog(e,r){return new mo(Rk(e),this)}_wrapTransactionReceipt(e,r){return new ow(Ik(e),this)}_wrapTransactionResponse(e,r){return new go(bw(e),this)}_detectNetwork(){re(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){re(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Ie(await this.#c({method:"getBlockNumber"}),"%response");return this.#a>=0&&(this.#a=e),e}_getAddress(e){return Ct(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(tt(e))return tt(e,32)?e:Br(e);if(typeof e=="bigint"&&(e=Ie(e,"blockTag")),typeof e=="number")return e>=0?Br(e):this.#a>=0?Br(this.#a+e):this.getBlockNumber().then(r=>Br(r+e));F(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?sh(l.map(h=>h.toLowerCase())):l.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,i=(l,h,d)=>{let m;switch(l.length){case 0:break;case 1:m=l[0];break;default:l.sort(),m=l}if(n&&(h!=null||d!=null))throw new Error("invalid filter");const y={};return m&&(y.address=m),r.length&&(y.topics=r),h&&(y.fromBlock=h),d&&(y.toBlock=d),n&&(y.blockHash=n),y};let o=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)o.push(this._getAddress(l));else o.push(this._getAddress(e.address));let a;"fromBlock"in e&&(a=this._getBlockTag(e.fromBlock));let u;return"toBlock"in e&&(u=this._getBlockTag(e.toBlock)),o.filter(l=>typeof l!="string").length||a!=null&&typeof a!="string"||u!=null&&typeof u!="string"?Promise.all([Promise.all(o),a,u]).then(l=>i(l[0],l[1],l[2])):i(o,a,u)}_getTransactionRequest(e){const r=eo(e),n=[];if(["to","from"].forEach(i=>{if(r[i]==null)return;const o=Ct(r[i],this);Xo(o)?n.push((async function(){r[i]=await o})()):r[i]=o}),r.blockTag!=null){const i=this._getBlockTag(r.blockTag);Xo(i)?n.push((async function(){r.blockTag=await i})()):r.blockTag=i}return n.length?(async function(){return await Promise.all(n),r})():r}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 e=this.#i,[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(this.#o?(this.emit("network",n,r),this.#i===e&&(this.#i=Promise.resolve(n))):re(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:i,gasPrice:o,priorityFee:a}=await zt({_block:this.#A("latest",!1),gasPrice:(async()=>{try{const d=await this.#c({method:"getGasPrice"});return pe(d,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const d=await this.#c({method:"getPriorityFee"});return pe(d,"%response")}catch{}return null})()});let u=null,l=null;const h=this._wrapBlock(i,e);return h&&h.baseFeePerGas&&(l=a??BigInt("1000000000"),u=h.baseFeePerGas*zk+l),new ry(o,u,l)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const i=new Vr(n.url),o=await n.processFunc(r,this,i);return new ry(o.gasPrice,o.maxFeePerGas,o.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return Xo(r)&&(r=await r),pe(await this.#c({method:"estimateGas",transaction:r}),"%response")}async#y(e,r,n){re(n<$k,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:r,enableCcipRead:!0})});const i=eo(e);try{const o=this.#f();return o&&await Rf(o),ae(await this._perform({method:"call",transaction:i,blockTag:r}))}catch(o){if(!this.disableCcipRead&&Uh(o)&&o.data&&n>=0&&r==="latest"&&i.to!=null&&ot(o.data,0,4)==="0x556f1830"){const a=o.data,u=await Ct(i.to,this);let l;try{l=Jk(ot(o.data,4))}catch(m){re(!1,m.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:a}})}re(l.sender.toLowerCase()===u.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const h=await this.ccipReadFetch(i,l.calldata,l.urls);re(h!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:o.data,errorArgs:l.errorArgs}});const d={to:u,data:je([l.selector,Kk([h,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:d});try{const m=await this.#y(d,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},d),result:m}),m}catch(m){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},d),error:m}),m}}throw o}}async#b(e){const{value:r}=await zt({network:this.getNetwork(),value:e});return r}async call(e){const{tx:r,blockTag:n}=await zt({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await this.#b(this.#y(r,n,e.enableCcipRead?0:-1))}async#g(e,r,n){let i=this._getAddress(r),o=this._getBlockTag(n);return(typeof i!="string"||typeof o!="string")&&([i,o]=await Promise.all([i,o])),await this.#b(this.#c(Object.assign(e,{address:i,blockTag:o})))}async getBalance(e,r){return pe(await this.#g({method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return Ie(await this.#g({method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return ae(await this.#g({method:"getCode"},e,r))}async getStorage(e,r,n){const i=pe(r,"position");return ae(await this.#g({method:"getStorage",position:i},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:i}=await zt({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),o=gr.from(e);if(o.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(o,i).replaceableTransaction(r)}async#A(e,r){if(tt(e,32))return await this.#c({method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await this.#c({method:"getBlock",blockTag:n,includeTransactions:r})}async getBlock(e,r){const{network:n,params:i}=await zt({network:this.getNetwork(),params:this.#A(e,!!r)});return i==null?null:this._wrapBlock(i,n)}async getTransaction(e){const{network:r,params:n}=await zt({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await zt({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const i=await this.#c({method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await zt({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:e})});return r==null?null:ae(r)}async getLogs(e){let r=this._getFilter(e);Xo(r)&&(r=await r);const{network:n,params:i}=await zt({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:r})});return i.map(o=>this._wrapLog(o,n))}_getProvider(e){re(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Jr.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e,r){const n=await this.getResolver(e);return n?await n.getAddress(r):null}async lookupAddress(e,r){return await Jr.lookupAddress(this,e,r)}async waitForTransaction(e,r,n){const i=r??1;return i===0?this.getTransactionReceipt(e):new Promise(async(o,a)=>{let u=null;const l=(async h=>{try{const d=await this.getTransactionReceipt(e);if(d!=null&&h-d.blockNumber+1>=i){o(d),u&&(clearTimeout(u),u=null);return}}catch(d){console.log("EEE",d)}this.once("block",l)});n!=null&&(u=setTimeout(()=>{u!=null&&(u=null,this.off("block",l),a(ht("timeout","TIMEOUT",{reason:"timeout"})))},n)),l(await this.getBlockNumber())})}async waitForBlock(e){re(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=this.#u.get(e);r&&(r.timer&&clearTimeout(r.timer),this.#u.delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=this.#d++,i=()=>{this.#u.delete(n),e()};if(this.paused)this.#u.set(n,{timer:null,func:i,time:r});else{const o=setTimeout(i,r);this.#u.set(n,{timer:o,func:i,time:ea()})}return n}_forEachSubscriber(e){for(const r of this.#e.values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new xw(e.type);case"block":{const r=new Dk(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new Lk(this,e.type);case"event":return new a0(this,e.filter);case"transaction":return new Mk(this,e.hash);case"orphan":return new Uk(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of this.#e.values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),this.#r!=null&&r.pause(this.#r);break}}async#x(e,r){let n=await Tf(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await Tf({orphan:"drop-log",log:r[0]},this)),this.#e.get(n.tag)||null}async#w(e){const r=await Tf(e,this),n=r.tag;let i=this.#e.get(n);return i||(i={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#e.set(n,i)),i}async on(e,r){const n=await this.#w(e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,this.#r!=null&&n.subscriber.pause(this.#r)),this}async once(e,r){const n=await this.#w(e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,this.#r!=null&&n.subscriber.pause(this.#r)),this}async emit(e,...r){const n=await this.#x(e,r);if(!n||n.listeners.length===0)return!1;const i=n.listeners.length;return n.listeners=n.listeners.filter(({listener:o,once:a})=>{const u=new bx(this,a?null:o,e);try{o.call(this,...r,u)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),this.#e.delete(n.tag)),i>0}async listenerCount(e){if(e){const n=await this.#x(e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of this.#e.values())r+=n.length;return r}async listeners(e){if(e){const n=await this.#x(e);return n?n.listeners.map(({listener:i})=>i):[]}let r=[];for(const{listeners:n}of this.#e.values())r=r.concat(n.map(({listener:i})=>i));return r}async off(e,r){const n=await this.#x(e);if(!n)return this;if(r){const i=n.listeners.map(({listener:o})=>o).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),this.#e.delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:i}=await this.#w(e);n&&i.stop(),this.#e.delete(r)}else for(const[r,{started:n,subscriber:i}]of this.#e)n&&i.stop(),this.#e.delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return this.#n}destroy(){this.removeAllListeners();for(const e of this.#u.keys())this._clearTimeout(e);this.#n=!0}get paused(){return this.#r!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(this.#a=-1,this.#r!=null){if(this.#r==!!e)return;re(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),this.#r=!!e;for(const r of this.#u.values())r.timer&&clearTimeout(r.timer),r.time=ea()-r.time}resume(){if(this.#r!=null){this._forEachSubscriber(e=>e.resume()),this.#r=null;for(const e of this.#u.values()){let r=e.time;r<0&&(r=0),e.time=ea(),setTimeout(e.func,r)}}}}function Hk(t,e){try{const r=oh(t,e);if(r)return va(r)}catch{}return null}function oh(t,e){if(t==="0x")return null;try{const r=Ie(ot(t,e,e+32)),n=Ie(ot(t,r,r+32));return ot(t,r+32,r+32+n)}catch{}return null}function hy(t){const e=mt(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function qk(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Zk=new Uint8Array([]);function Kk(t){const e=[];let r=0;for(let n=0;n<t.length;n++)e.push(Zk),r+=32;for(let n=0;n<t.length;n++){const i=de(t[n]);e[n]=hy(r),e.push(hy(i.length)),e.push(qk(i)),r+=32+Math.ceil(i.length/32)*32}return je(e)}const dy="0x0000000000000000000000000000000000000000000000000000000000000000";function Jk(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};re(Ii(t)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=ot(t,0,32);re(ot(r,0,12)===ot(dy,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=ot(r,12);try{const n=[],i=Ie(ot(t,32,64)),o=Ie(ot(t,i,i+32)),a=ot(t,i+32);for(let u=0;u<o;u++){const l=Hk(a,u*32);if(l==null)throw new Error("abort");n.push(l)}e.urls=n}catch{re(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const n=oh(t,64);if(n==null)throw new Error("abort");e.calldata=n}catch{re(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}re(ot(t,100,128)===ot(dy,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=ot(t,96,100);try{const n=oh(t,128);if(n==null)throw new Error("abort");e.extraData=n}catch{re(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(n=>e[n]),e}function zn(t,e){if(t.provider)return t.provider;re(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function py(t,e){let r=eo(e);if(r.to!=null&&(r.to=Ct(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),Ct(n,t)]).then(([i,o])=>(F(i.toLowerCase()===o.toLowerCase(),"transaction from mismatch","tx.from",o),i))}else r.from=t.getAddress();return await zt(r)}class c0{provider;constructor(e){Te(this,{provider:e||null})}async getNonce(e){return zn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await py(this,e)}async populateTransaction(e){const r=zn(this,"populateTransaction"),n=await py(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const i=await this.provider.getNetwork();if(n.chainId!=null){const a=pe(n.chainId);F(a===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=i.chainId;const o=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||o)?F(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&o&&F(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await r.getFeeData();re(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await r.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.authorizationList&&n.authorizationList.length?n.type=4:n.type=2,n.gasPrice!=null){const u=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=u,n.maxPriorityFeePerGas=u}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(re(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):re(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3||n.type===4)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await zt(n)}async populateAuthorization(e){const r=Object.assign({},e);return r.chainId==null&&(r.chainId=(await zn(this,"getNetwork").getNetwork()).chainId),r.nonce==null&&(r.nonce=await this.getNonce()),r}async estimateGas(e){return zn(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return zn(this,"call").call(await this.populateCall(e))}async resolveName(e){return await zn(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=zn(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const i=gr.from(n);return await r.broadcastTransaction(await this.signTransaction(i))}authorize(e){re(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class u0 extends c0{address;constructor(e,r){super(r),Te(this,{address:e})}async getAddress(){return this.address}connect(e){return new u0(this.address,e)}#e(e,r){re(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:r})}async signTransaction(e){this.#e("transactions","signTransaction")}async signMessage(e){this.#e("messages","signMessage")}async signTypedData(e,r,n){this.#e("typed-data","signTypedData")}}function Wk(t){return JSON.parse(JSON.stringify(t))}class ww{#e;#t;#r;#n;#i;#o;constructor(e){this.#e=e,this.#t=null,this.#r=this.#s.bind(this),this.#n=!1,this.#i=null,this.#o=!1}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}async#s(e){try{this.#t==null&&(this.#t=this._subscribe(this.#e));let r=null;try{r=await this.#t}catch(o){if(!It(o,"UNSUPPORTED_OPERATION")||o.operation!=="eth_newFilter")throw o}if(r==null){this.#t=null,this.#e._recoverSubscriber(this,this._recover(this.#e));return}const n=await this.#e.getNetwork();if(this.#i||(this.#i=n),this.#i.chainId!==n.chainId)throw new Error("chaid changed");if(this.#o)return;const i=await this.#e.send("eth_getFilterChanges",[r]);await this._emitResults(this.#e,i)}catch(r){console.log("@TODO",r)}this.#e.once("block",this.#r)}#a(){const e=this.#t;e&&(this.#t=null,e.then(r=>{this.#e.destroyed||this.#e.send("eth_uninstallFilter",[r])}))}start(){this.#n||(this.#n=!0,this.#s(-2))}stop(){this.#n&&(this.#n=!1,this.#o=!0,this.#a(),this.#e.off("block",this.#r))}pause(e){e&&this.#a(),this.#e.off("block",this.#r)}resume(){this.start()}}class Qk extends ww{#e;constructor(e,r){super(e),this.#e=Wk(r)}_recover(e){return new a0(e,this.#e)}async _subscribe(e){return await e.send("eth_newFilter",[this.#e])}async _emitResults(e,r){for(const n of r)e.emit(this.#e,e._wrapLog(n,e._network))}}class Yk extends ww{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const Xk="bigint,boolean,function,number,string,symbol".split(/,/g);function ha(t){if(t==null||Xk.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(ha);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function eN(t){return new Promise(e=>{setTimeout(e,t)})}function xi(t){return t&&t.toLowerCase()}function my(t){return t&&typeof t.pollingInterval=="number"}const Aw={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Bf extends c0{address;constructor(e,r){super(e),r=ze(r),Te(this,{address:r})}connect(e){re(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(e){return await this.populateCall(e)}async sendUncheckedTransaction(e){const r=ha(e),n=[];if(r.from){const o=r.from;n.push((async()=>{const a=await Ct(o,this.provider);F(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&n.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;n.push((async()=>{r.to=await Ct(o,this.provider)})())}n.length&&await Promise.all(n);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(e){const r=await this.provider.getBlockNumber(),n=await this.sendUncheckedTransaction(e);return await new Promise((i,o)=>{const a=[1e3,100];let u=0;const l=async()=>{try{const h=await this.provider.getTransaction(n);if(h!=null){i(h.replaceableTransaction(r));return}}catch(h){if(It(h,"CANCELLED")||It(h,"BAD_DATA")||It(h,"NETWORK_ERROR")||It(h,"UNSUPPORTED_OPERATION")){h.info==null&&(h.info={}),h.info.sendTransactionHash=n,o(h);return}if(It(h,"INVALID_ARGUMENT")&&(u++,h.info==null&&(h.info={}),h.info.sendTransactionHash=n,u>10)){o(h);return}this.provider.emit("error",ht("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:h}))}this.provider._setTimeout(()=>{l()},a.pop()||4e3)};l()})}async signTransaction(e){const r=ha(e);if(r.from){const i=await Ct(r.from,this.provider);F(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),r.from=i}else r.from=this.address;const n=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[n])}async signMessage(e){const r=typeof e=="string"?Wt(e):e;return await this.provider.send("personal_sign",[ae(r),this.address.toLowerCase()])}async signTypedData(e,r,n){const i=ha(n),o=await Zt.resolveNames(e,r,i,async a=>{const u=await Ct(a);return F(u!=null,"TypedData does not support null address","value",a),u});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Zt.getPayload(o.domain,r,o.value))])}async unlock(e){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),e,null])}async _legacySignMessage(e){const r=typeof e=="string"?Wt(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),ae(r)])}}class tN extends jk{#e;#t;#r;#n;#i;#o;#s;#a(){if(this.#n)return;const e=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#n=setTimeout(()=>{this.#n=null;const r=this.#r;for(this.#r=[];r.length;){const n=[r.shift()];for(;r.length&&n.length!==this.#e.batchMaxCount;)if(n.push(r.shift()),JSON.stringify(n.map(o=>o.payload)).length>this.#e.batchMaxSize){r.unshift(n.pop());break}(async()=>{const i=n.length===1?n[0].payload:n.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:a,reject:u,payload:l}of n){if(this.destroyed){u(ht("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const h=o.filter(d=>d.id===l.id)[0];if(h==null){const d=ht("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",d),u(d);continue}if("error"in h){u(this.getRpcError(l,h));continue}a(h.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of n)a(o)}})()}},e)}constructor(e,r){super(e,r),this.#t=1,this.#e=Object.assign({},Aw,r||{}),this.#r=[],this.#n=null,this.#o=null,this.#s=null;{let i=null;const o=new Promise(a=>{i=a});this.#i={promise:o,resolve:i}}const n=this._getOption("staticNetwork");typeof n=="boolean"?(F(!n||e!=="any","staticNetwork cannot be used on special network 'any'","options",r),n&&e!=null&&(this.#o=ar.from(e))):n&&(F(e==null||n.matches(e),"staticNetwork MUST match network object","options",r),this.#o=n)}_getOption(e){return this.#e[e]}get _network(){return re(this.#o,"network is not available yet","NETWORK_ERROR"),this.#o}async _perform(e){if(e.method==="call"||e.method==="estimateGas"){let n=e.transaction;if(n&&n.type!=null&&pe(n.type)&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(e=Object.assign({},e,{transaction:Object.assign({},n,{type:void 0})}))}}const r=this.getRpcRequest(e);return r!=null?await this.send(r.method,r.args):super._perform(e)}async _detectNetwork(){const e=this._getOption("staticNetwork");if(e)if(e===!0){if(this.#o)return this.#o}else return e;return this.#s?await this.#s:this.ready?(this.#s=(async()=>{try{const r=ar.from(pe(await this.send("eth_chainId",[])));return this.#s=null,r}catch(r){throw this.#s=null,r}})(),await this.#s):(this.#s=(async()=>{const r={id:this.#t++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let n;try{n=(await this._send(r))[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:n}),"result"in n)return ar.from(pe(n.result));throw this.getRpcError(r,n)})(),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(e){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",ht("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await eN(1e3)}this.#a()})())}async _waitUntilReady(){if(this.#i!=null)return await this.#i.promise}_getSubscriber(e){return e.type==="pending"?new Yk(this):e.type==="event"?this._getOption("polling")?new a0(this,e.filter):new Qk(this,e.filter):e.type==="orphan"&&e.filter.orphan==="drop-log"?new xw("orphan"):super._getSubscriber(e)}get ready(){return this.#i==null}getRpcTransaction(e){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(n=>{if(e[n]==null)return;let i=n;n==="gasLimit"&&(i="gas"),r[i]=Br(pe(e[n],`tx.${n}`))}),["from","to","data"].forEach(n=>{e[n]!=null&&(r[n]=ae(e[n]))}),e.accessList&&(r.accessList=ui(e.accessList)),e.blobVersionedHashes&&(r.blobVersionedHashes=e.blobVersionedHashes.map(n=>n.toLowerCase())),e.authorizationList&&(r.authorizationList=e.authorizationList.map(n=>{const i=B1(n);return{address:i.address,nonce:Br(i.nonce),chainId:Br(i.chainId),yParity:Br(i.signature.yParity),r:Br(i.signature.r),s:Br(i.signature.s)}})),r}getRpcRequest(e){switch(e.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:[xi(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[xi(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[xi(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[xi(e.address),"0x"+e.position.toString(16),e.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[e.signedTransaction]};case"getBlock":if("blockTag"in e)return{method:"eth_getBlockByNumber",args:[e.blockTag,!!e.includeTransactions]};if("blockHash"in e)return{method:"eth_getBlockByHash",args:[e.blockHash,!!e.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[e.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[e.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(e.transaction),e.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(e.transaction)]};case"getLogs":return e.filter&&e.filter.address!=null&&(Array.isArray(e.filter.address)?e.filter.address=e.filter.address.map(xi):e.filter.address=xi(e.filter.address)),{method:"eth_getLogs",args:[e.filter]}}return null}getRpcError(e,r){const{method:n}=e,{error:i}=r;if(n==="eth_estimateGas"&&i.message){const u=i.message;if(!u.match(/revert/i)&&u.match(/insufficient funds/i))return ht("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:i}});if(u.match(/nonce/i)&&u.match(/too low/i))return ht("nonce has already been used","NONCE_EXPIRED",{transaction:e.params[0],info:{payload:e,error:i}})}if(n==="eth_call"||n==="eth_estimateGas"){const u=ah(i),l=Hi.getBuiltinCallException(n==="eth_call"?"call":"estimateGas",e.params[0],u?u.data:null);return l.info={error:i,payload:e},l}const o=JSON.stringify(nN(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return ht("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"}[n]||"unknown",reason:"rejected",info:{payload:e,error:i}});if(n==="eth_sendRawTransaction"||n==="eth_sendTransaction"){const u=e.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return ht("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:u,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return ht("nonce has already been used","NONCE_EXPIRED",{transaction:u,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return ht("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:u,info:{error:i}});if(o.match(/only replay-protected/i))return ht("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:n,info:{transaction:u,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?ht("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:i,payload:e}}):ht("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:e})}send(e,r){if(this.destroyed)return Promise.reject(ht("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e}));const n=this.#t++,i=new Promise((o,a)=>{this.#r.push({resolve:o,reject:a,payload:{method:e,params:r,id:n,jsonrpc:"2.0"}})});return this.#a(),i}async getSigner(e){e==null&&(e=0);const r=this.send("eth_accounts",[]);if(typeof e=="number"){const i=await r;if(e>=i.length)throw new Error("no such account");return new Bf(this,i[e])}const{accounts:n}=await zt({network:this.getNetwork(),accounts:r});e=ze(e);for(const i of n)if(ze(i)===e)return new Bf(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new Bf(this,r))}destroy(){this.#n&&(clearTimeout(this.#n),this.#n=null);for(const{payload:e,reject:r}of this.#r)r(ht("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#r=[],super.destroy()}}class rN extends tN{#e;constructor(e,r){super(e,r);let n=this._getOption("pollingInterval");n==null&&(n=Aw.pollingInterval),this.#e=n}_getSubscriber(e){const r=super._getSubscriber(e);return my(r)&&(r.pollingInterval=this.#e),r}get pollingInterval(){return this.#e}set pollingInterval(e){if(!Number.isInteger(e)||e<0)throw new Error("invalid interval");this.#e=e,this._forEachSubscriber(r=>{my(r)&&(r.pollingInterval=this.#e)})}}class MN extends rN{#e;constructor(e,r,n){e==null&&(e="http://localhost:8545"),super(r,n),typeof e=="string"?this.#e=new Vr(e):this.#e=e.clone()}_getConnection(){return this.#e.clone()}async send(e,r){return await this._start(),await super.send(e,r)}async _send(e){const r=this._getConnection();r.body=JSON.stringify(e),r.setHeader("content-type","application/json");const n=await r.send();n.assertOk();let i=n.bodyJson;return Array.isArray(i)||(i=[i]),i}}function ah(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&tt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=ah(t[e]);if(r)return r}return null}if(typeof t=="string")try{return ah(JSON.parse(t))}catch{}return null}function ch(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)ch(t[r],e);if(typeof t=="string")try{return ch(JSON.parse(t),e)}catch{}}}function nN(t){const e=[];return ch(t,e),e}class uc extends c0{address;#e;constructor(e,r){super(r),F(e&&typeof e.sign=="function","invalid private key","privateKey","[ REDACTED ]"),this.#e=e;const n=po(this.signingKey.publicKey);Te(this,{address:n})}get signingKey(){return this.#e}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new uc(this.#e,e)}async signTransaction(e){e=eo(e);const{to:r,from:n}=await zt({to:e.to?Ct(e.to,this):void 0,from:e.from?Ct(e.from,this):void 0});r!=null&&(e.to=r),n!=null&&(e.from=n),e.from!=null&&(F(ze(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const i=gr.from(e);return i.signature=this.signingKey.sign(i.unsignedHash),i.serialized}async signMessage(e){return this.signMessageSync(e)}signMessageSync(e){return this.signingKey.sign(DI(e)).serialized}authorizeSync(e){F(typeof e.address=="string","invalid address for authorizeSync","auth.address",e);const r=this.signingKey.sign(XO(e));return Object.assign({},{address:ze(e.address),nonce:pe(e.nonce||0),chainId:pe(e.chainId||0)},{signature:r})}async authorize(e){return e=Object.assign({},e,{address:await Ct(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,r,n){const i=await Zt.resolveNames(e,r,n,async o=>{re(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const a=await this.provider.resolveName(o);return re(a!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),a});return this.signingKey.sign(Zt.hash(i.domain,r,i.value)).serialized}}const ka=" !#$%&'()*+,-./<=>?@[]^_`{|}~",iN=/^[a-z]*$/i;function gy(t,e){let r=97;return t.reduce((n,i)=>(i===e?r++:i.match(iN)?n.push(String.fromCharCode(r)+i):(r=97,n.push(i)),n),[])}function sN(t,e){for(let i=ka.length-1;i>=0;i--)t=t.split(ka[i]).join(e.substring(2*i,2*i+2));const r=[],n=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(i,o,a,u)=>{if(a)for(let l=parseInt(a);l>=0;l--)r.push(";");else r.push(o.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return gy(gy(r,";"),":")}function oN(t){return F(t[0]==="0","unsupported auwl data","data",t),sN(t.substring(1+2*ka.length),t.substring(1,1+2*ka.length))}class aN{locale;constructor(e){Te(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class cN extends aN{#e;#t;constructor(e,r,n){super(e),this.#e=r,this.#t=n,this.#r=null}get _data(){return this.#e}_decodeWords(){return oN(this.#e)}#r;#n(){if(this.#r==null){const e=this._decodeWords();if(on(e.join(`
86
+ `)+`
87
+ `)!==this.#t)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#r=e}return this.#r}getWord(e){const r=this.#n();return F(e>=0&&e<r.length,`invalid word index: ${e}`,"index",e),r[e]}getWordIndex(e){return this.#n().indexOf(e)}}const uN="0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN<aNn RRelyRga(R*lSeS-SketTt!3A^AnAutyCau'ComeEfF%eG(Ha=H(dLie=LowLtN^Nef./TrayTt Twe&Y#d3Cyc!DKeNdOlogyRdR`Tt _{AdeAmeAnketA,EakE[IndOodO[omOu'UeUrUsh_rdAtDyIlMbNeNusOkO,Rd R(gRrowSsTtomUn)XY_{etA(AndA[A=EadEezeI{Id+IefIghtIngIskOccoliOk&OnzeOomO` OwnUsh2Bb!DdyD+tFf$oIldLbLkL!tNd!Nk Rd&Rg R,SS(e[SyTt Y Zz:Bba+B(B!CtusGeKe~LmM aMpNN$N)lNdyNn#NoeNvasNy#Pab!P.$Pta(RRb#RdRgoRpetRryRtSeShS(o/!Su$TT$ogT^Teg%yTt!UghtU'Ut]Ve3Il(gL yM|NsusNturyRe$Rta(_irAlkAmp]An+AosApt Ar+A'AtEapE{Ee'EfErryE,I{&IefIldIm}yOi)Oo'R#-U{!UnkUrn0G?Nnam#Rc!Tiz&TyVil_imApArifyAwAyE<ErkEv I{I|IffImbIn-IpO{OgO'O`OudOwnUbUmpU, Ut^_^A,C#utDeFfeeIlInL!@L%LumnMb(eMeMf%tM-Mm#Mp<yNc tNdu@NfirmNg*[N}@Nsid NtrolNv()OkOlPp PyR$ReRnR*@/Tt#U^UntryUp!Ur'Us(V Yo>_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M<dMi'Ni$Nti,NyP?tP&dPos.P`PutyRi=ScribeS tSignSkSpair/royTailTe@VelopVi)Vo>3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-Eg<tEm|Eph<tEvat%I>Se0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-P<dPe@Pi*Pla(Po'P*[T&dTra0EEbrow:Br-CeCultyDeIntI`~L'MeMilyMousNNcyNtasyRmSh]TT$Th TigueUltV%.e3Atu*Bru?yD $EEdElMa!N)/iv$T^V W3B Ct]EldGu*LeLmLt N$NdNeNg NishReRmR,Sc$ShTT}[X_gAmeAshAtAv%EeIghtIpOatO{O%Ow UidUshY_mCusGIlLd~owOdOtR)Re,R+tRkRtu}RumRw?dSsil/ UndX_gi!AmeEqu|EshI&dIn+OgOntO,OwnOz&U.2ElNNnyRna)RyTu*:D+tInLaxy~ yMePRa+Rba+Rd&Rl-Rm|SSpTeTh U+Ze3N $NiusN*Nt!Nu(e/u*2O,0AntFtGg!Ng RaffeRlVe_dAn)A*A[IdeImp'ObeOomOryO=OwUe_tDde[LdOdO'RillaSpelSsipV nWn_bA)A(AntApeA[Av.yEatE&IdIefItOc yOupOwUnt_rdE[IdeIltIt?N3M:B.IrLfMm M, NdPpyRb%RdRshR=,TVeWkZ?d3AdAl`ArtAvyD+hogIght~oLmetLpNRo3Dd&Gh~NtPRe/%y5BbyCkeyLdLeLiday~owMeNeyOdPeRnRr%R'Sp.$/TelUrV 5BGeM<Mb!M%Nd*dNgryNtRd!RryRtSb<d3Brid:1EOn0EaEntifyLe2N%e4LLeg$L}[0A+Ita>M&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryF<tFl-tF%mHa!H .Iti$Je@JuryMa>N Noc|PutQuiryS<eSe@SideSpi*/$lTa@T e,ToVe,V.eVol=3On0L<dOla>Sue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurE<Tob 0Or1FF Fi)T&2L1Ay0DI=Ymp-0It0CeEI#L(eLy1EnEraIn]Po'T]1An+B.Ch?dD D(?yG<I|Ig($Ph<0Tr-h0H 0Tdo%T TputTside0AlEnEr0NN 0Yg&0/ 0O}:CtDd!GeIrLa)LmNdaNelN-N` P RadeR|RkRrotRtySsT^ThTi|TrolTt nU'VeYm|3A)AnutArAs<tL-<NN$tyNcilOp!Pp Rfe@Rm.Rs#T2O}OtoRa'Ys-$0AnoCn-Ctu*E)GGe#~LotNkO} Pe/olT^Zza_)A}tA,-A>AyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOg<OtOwUsh0AllArtI!OkeOo`0A{AkeApIffOw0ApCc Ci$CkDaFtL?Ldi LidLut]L=Me#eNgOnRryRtUlUndUpUr)U`0A)A*Ati$AwnEakEci$EedEllEndH eI)Id IkeInIr.L.OilOns%O#OrtOtRayReadR(gY0Ua*UeezeUir*l_b!AdiumAffA+AirsAmpAndArtA>AyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NN<tNnisNtRm/Xt_nkAtEmeEnE%yE*EyIngIsOughtReeRi=RowUmbUnd 0CketDeG LtMb MeNyPRedSsueT!5A,BaccoDayDdl EGe` I!tK&MatoM%rowNeNgueNightOlO`PP-Pp!R^RnadoRtoi'SsT$Uri,W?dW WnY_{AdeAff-Ag-A(Ansf ApAshA=lAyEatEeEndI$IbeI{Igg ImIpOphyOub!U{UeUlyUmpetU,U`Y2BeIt]Mb!NaN}lRkeyRnRt!1El=EntyI)InI,O1PeP-$:5Ly5B*lla0Ab!Awa*C!Cov D DoFairFoldHappyIf%mIqueItIv 'KnownLo{TilUsu$Veil1Da>GradeHoldOnP Set1B<Ge0A+EEdEfulE![U$0Il.y:C<tCuumGueLidL!yL=NNishP%Rious/Ult3H-!L=tNd%Ntu*NueRbRifyRs]RyS'lT <3Ab!Br<tCiousCt%yDeoEw~a+Nta+Ol(Rtu$RusSaS.Su$T$Vid5C$I)IdLc<oLumeTeYa+:GeG#ItLk~LnutNtRfa*RmRri%ShSp/eT VeY3Al`Ap#ArA'lA` BDd(gEk&dIrdLcome/T_!AtEatEelEnE*IpIsp 0DeD`FeLd~NNdowNeNgNkNn Nt ReSdomSeShT}[5LfM<Nd OdOlRdRkRldRryR`_pE{E,!I,I>Ong::Rd3Ar~ow9UUngU`:3BraRo9NeO",lN="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let Sf=null;class ni extends cN{constructor(){super("en",uN,lN)}static wordlist(){return Sf==null&&(Sf=new ni),Sf}}function Ew(t){return(1<<t)-1<<8-t&255}function fN(t){return(1<<t)-1&255}function Pf(t,e){dx("NFKD"),e==null&&(e=ni.wordlist());const r=e.split(t);F(r.length%3===0&&r.length>=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let i=0;for(let h=0;h<r.length;h++){let d=e.getWordIndex(r[h].normalize("NFKD"));F(d>=0,`invalid mnemonic word at index ${h}`,"mnemonic","[ REDACTED ]");for(let m=0;m<11;m++)d&1<<10-m&&(n[i>>3]|=1<<7-i%8),i++}const o=32*r.length/3,a=r.length/3,u=Ew(a),l=de(xr(n.slice(0,o/8)))[0]&u;return F(l===(n[n.length-1]&u),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ae(n.slice(0,o/8))}function Of(t,e){F(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=ni.wordlist());const r=[0];let n=11;for(let a=0;a<t.length;a++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=t[a],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[a]>>8-n,r.push(t[a]&fN(8-n)),n+=3);const i=t.length/4,o=parseInt(xr(t).substring(2,4),16)&Ew(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,e.join(r.map(a=>e.getWord(a)))}const If={};class Zi{phrase;password;wordlist;entropy;constructor(e,r,n,i,o){i==null&&(i=""),o==null&&(o=ni.wordlist()),ci(e,If,"Mnemonic"),Te(this,{phrase:n,password:i,wordlist:o,entropy:r})}computeSeed(){const e=Wt("mnemonic"+this.password,"NFKD");return kn(Wt(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,r,n){const i=Pf(e,n);return e=Of(de(i),n),new Zi(If,i,e,r,n)}static fromEntropy(e,r,n){const i=de(e,"entropy"),o=Of(i,n);return new Zi(If,ae(i),o,r,n)}static entropyToPhrase(e,r){const n=de(e,"entropy");return Of(n,r)}static phraseToEntropy(e,r){return Pf(e,r)}static isValidMnemonic(e,r){try{return Pf(e,r),!0}catch{}return!1}}var _t=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},kf=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},da,dr,Lr;const hN={16:10,24:12,32:14},dN=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fr=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],ta=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],pN=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],mN=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gN=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yN=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],bN=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],xN=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wN=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],AN=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],EN=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],vN=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],RN=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],TN=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Nf(t){const e=[];for(let r=0;r<t.length;r+=4)e.push(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);return e}class l0{get key(){return _t(this,da,"f").slice()}constructor(e){if(da.set(this,void 0),dr.set(this,void 0),Lr.set(this,void 0),!(this instanceof l0))throw Error("AES must be instanitated with `new`");kf(this,da,new Uint8Array(e),"f");const r=hN[this.key.length];if(r==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");kf(this,Lr,[],"f"),kf(this,dr,[],"f");for(let d=0;d<=r;d++)_t(this,Lr,"f").push([0,0,0,0]),_t(this,dr,"f").push([0,0,0,0]);const n=(r+1)*4,i=this.key.length/4,o=Nf(this.key);let a;for(let d=0;d<i;d++)a=d>>2,_t(this,Lr,"f")[a][d%4]=o[d],_t(this,dr,"f")[r-a][d%4]=o[d];let u=0,l=i,h;for(;l<n;){if(h=o[i-1],o[0]^=fr[h>>16&255]<<24^fr[h>>8&255]<<16^fr[h&255]<<8^fr[h>>24&255]^dN[u]<<24,u+=1,i!=8)for(let w=1;w<i;w++)o[w]^=o[w-1];else{for(let w=1;w<i/2;w++)o[w]^=o[w-1];h=o[i/2-1],o[i/2]^=fr[h&255]^fr[h>>8&255]<<8^fr[h>>16&255]<<16^fr[h>>24&255]<<24;for(let w=i/2+1;w<i;w++)o[w]^=o[w-1]}let d=0,m,y;for(;d<i&&l<n;)m=l>>2,y=l%4,_t(this,Lr,"f")[m][y]=o[d],_t(this,dr,"f")[r-m][y]=o[d++],l++}for(let d=1;d<r;d++)for(let m=0;m<4;m++)h=_t(this,dr,"f")[d][m],_t(this,dr,"f")[d][m]=EN[h>>24&255]^vN[h>>16&255]^RN[h>>8&255]^TN[h&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const r=_t(this,Lr,"f").length-1,n=[0,0,0,0];let i=Nf(e);for(let u=0;u<4;u++)i[u]^=_t(this,Lr,"f")[0][u];for(let u=1;u<r;u++){for(let l=0;l<4;l++)n[l]=pN[i[l]>>24&255]^mN[i[(l+1)%4]>>16&255]^gN[i[(l+2)%4]>>8&255]^yN[i[(l+3)%4]&255]^_t(this,Lr,"f")[u][l];i=n.slice()}const o=new Uint8Array(16);let a=0;for(let u=0;u<4;u++)a=_t(this,Lr,"f")[r][u],o[4*u]=(fr[i[u]>>24&255]^a>>24)&255,o[4*u+1]=(fr[i[(u+1)%4]>>16&255]^a>>16)&255,o[4*u+2]=(fr[i[(u+2)%4]>>8&255]^a>>8)&255,o[4*u+3]=(fr[i[(u+3)%4]&255]^a)&255;return o}decrypt(e){if(e.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const r=_t(this,dr,"f").length-1,n=[0,0,0,0];let i=Nf(e);for(let u=0;u<4;u++)i[u]^=_t(this,dr,"f")[0][u];for(let u=1;u<r;u++){for(let l=0;l<4;l++)n[l]=bN[i[l]>>24&255]^xN[i[(l+3)%4]>>16&255]^wN[i[(l+2)%4]>>8&255]^AN[i[(l+1)%4]&255]^_t(this,dr,"f")[u][l];i=n.slice()}const o=new Uint8Array(16);let a=0;for(let u=0;u<4;u++)a=_t(this,dr,"f")[r][u],o[4*u]=(ta[i[u]>>24&255]^a>>24)&255,o[4*u+1]=(ta[i[(u+3)%4]>>16&255]^a>>16)&255,o[4*u+2]=(ta[i[(u+2)%4]>>8&255]^a>>8)&255,o[4*u+3]=(ta[i[(u+1)%4]&255]^a)&255;return o}}da=new WeakMap,dr=new WeakMap,Lr=new WeakMap;class vw{constructor(e,r,n){if(n&&!(this instanceof n))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new l0(r)},name:{enumerable:!0,value:e}})}}var ra=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},wi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},_s,Gr;class f0 extends vw{constructor(e,r){if(super("ECC",e,f0),_s.set(this,void 0),Gr.set(this,void 0),r){if(r.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");ra(this,_s,new Uint8Array(r),"f")}else ra(this,_s,new Uint8Array(16),"f");ra(this,Gr,this.iv,"f")}get iv(){return new Uint8Array(wi(this,_s,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const r=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){for(let i=0;i<16;i++)wi(this,Gr,"f")[i]^=e[n+i];ra(this,Gr,this.aes.encrypt(wi(this,Gr,"f")),"f"),r.set(wi(this,Gr,"f"),n)}return r}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const r=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){const i=this.aes.decrypt(e.subarray(n,n+16));for(let o=0;o<16;o++)r[n+o]=i[o]^wi(this,Gr,"f")[o],wi(this,Gr,"f")[o]=e[n+o]}return r}}_s=new WeakMap,Gr=new WeakMap;var Ai=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},hr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Fs,Vn,pr;class Ki extends vw{constructor(e,r){super("CTR",e,Ki),Fs.set(this,void 0),Vn.set(this,void 0),pr.set(this,void 0),Ai(this,pr,new Uint8Array(16),"f"),hr(this,pr,"f").fill(0),Ai(this,Fs,hr(this,pr,"f"),"f"),Ai(this,Vn,16,"f"),r==null&&(r=1),typeof r=="number"?this.setCounterValue(r):this.setCounterBytes(r)}get counter(){return new Uint8Array(hr(this,pr,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let r=15;r>=0;--r)hr(this,pr,"f")[r]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(e.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");hr(this,pr,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(hr(this,pr,"f")[e]===255)hr(this,pr,"f")[e]=0;else{hr(this,pr,"f")[e]++;break}}encrypt(e){var r,n;const i=new Uint8Array(e);for(let o=0;o<i.length;o++)hr(this,Vn,"f")===16&&(Ai(this,Fs,this.aes.encrypt(hr(this,pr,"f")),"f"),Ai(this,Vn,0,"f"),this.increment()),i[o]^=hr(this,Fs,"f")[Ai(this,Vn,(n=hr(this,Vn,"f"),r=n++,n),"f"),r];return i}decrypt(e){return this.encrypt(e)}}Fs=new WeakMap,Vn=new WeakMap,pr=new WeakMap;function BN(t){if(t.length<16)throw new TypeError("PKCS#7 invalid length");const e=t[t.length-1];if(e>16)throw new TypeError("PKCS#7 padding byte out of range");const r=t.length-e;for(let n=0;n<e;n++)if(t[r+n]!==e)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(t.subarray(0,r))}function Rw(t){return typeof t=="string"&&!t.startsWith("0x")&&(t="0x"+t),Ft(t)}function Ps(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function xo(t){return typeof t=="string"?Wt(t,"NFKC"):Ft(t)}function At(t,e){const r=e.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);F(r!=null,"invalid path","path",e);const n=r[1],i=r[3],o=r[4]==="!";let a=t;for(const u of n.toLowerCase().split(".")){if(Array.isArray(a)){if(!u.match(/^[0-9]+$/))break;a=a[parseInt(u)]}else if(typeof a=="object"){let l=null;for(const h in a)if(h.toLowerCase()===u){l=a[h];break}a=l}else a=null;if(a==null)break}if(F(!o||a!=null,"missing required value","path",n),i&&a!=null){if(i==="int"){if(typeof a=="string"&&a.match(/^-?[0-9]+$/))return parseInt(a);if(Number.isSafeInteger(a))return a}if(i==="number"&&typeof a=="string"&&a.match(/^-?[0-9.]*$/))return parseFloat(a);if(i==="data"&&typeof a=="string")return Rw(a);if(i==="array"&&Array.isArray(a)||i===typeof a)return a;F(!1,`wrong type found for ${i} `,"path",n)}return a}const Tw="m/44'/60'/0'/0/0";function yy(t){try{const e=JSON.parse(t);if((e.version!=null?parseInt(e.version):0)===3)return!0}catch{}return!1}function SN(t,e,r){if(At(t,"crypto.cipher:string")==="aes-128-ctr"){const i=At(t,"crypto.cipherparams.iv:data!"),o=new Ki(e,i);return ae(o.decrypt(r))}re(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function Na(t,e){const r=de(e),n=At(t,"crypto.ciphertext:data!"),i=ae(lt(je([r.slice(16,32),n]))).substring(2);F(i===At(t,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=SN(t,r.slice(0,16),n),a=po(o);if(t.address){let h=t.address.toLowerCase();h.startsWith("0x")||(h="0x"+h),F(ze(h)===a,"keystore address/privateKey mismatch","address",t.address)}const u={address:a,privateKey:o};if(At(t,"x-ethers.version:string")==="0.1"){const h=r.slice(32,64),d=At(t,"x-ethers.mnemonicCiphertext:data!"),m=At(t,"x-ethers.mnemonicCounter:data!"),y=new Ki(h,m);u.mnemonic={path:At(t,"x-ethers.path:string")||Tw,locale:At(t,"x-ethers.locale:string")||"en",entropy:ae(de(y.decrypt(d)))}}return u}function Bw(t){const e=At(t,"crypto.kdf:string");if(e&&typeof e=="string"){if(e.toLowerCase()==="scrypt"){const r=At(t,"crypto.kdfparams.salt:data!"),n=At(t,"crypto.kdfparams.n:int!"),i=At(t,"crypto.kdfparams.r:int!"),o=At(t,"crypto.kdfparams.p:int!");F(n>0&&(n&n-1)===0,"invalid kdf.N","kdf.N",n),F(i>0&&o>0,"invalid kdf","kdf",e);const a=At(t,"crypto.kdfparams.dklen:int!");return F(a===32,"invalid kdf.dklen","kdf.dflen",a),{name:"scrypt",salt:r,N:n,r:i,p:o,dkLen:64}}else if(e.toLowerCase()==="pbkdf2"){const r=At(t,"crypto.kdfparams.salt:data!"),n=At(t,"crypto.kdfparams.prf:string!"),i=n.split("-").pop();F(i==="sha256"||i==="sha512","invalid kdf.pdf","kdf.pdf",n);const o=At(t,"crypto.kdfparams.c:int!"),a=At(t,"crypto.kdfparams.dklen:int!");return F(a===32,"invalid kdf.dklen","kdf.dklen",a),{name:"pbkdf2",salt:r,count:o,dkLen:a,algorithm:i}}}F(!1,"unsupported key-derivation function","kdf",e)}function PN(t,e){const r=JSON.parse(t),n=xo(e),i=Bw(r);if(i.name==="pbkdf2"){const{salt:m,count:y,dkLen:w,algorithm:T}=i,R=kn(n,m,y,w,T);return Na(r,R)}re(i.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:o,N:a,r:u,p:l,dkLen:h}=i,d=rs(n,o,a,u,l,h);return Na(r,d)}function by(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function ON(t,e,r){const n=JSON.parse(t),i=xo(e),o=Bw(n);if(o.name==="pbkdf2"){r&&(r(0),await by(0));const{salt:y,count:w,dkLen:T,algorithm:R}=o,O=kn(i,y,w,T,R);return r&&(r(1),await by(0)),Na(n,O)}re(o.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:a,N:u,r:l,p:h,dkLen:d}=o,m=await ts(i,a,u,l,h,d,r);return Na(n,m)}function Sw(t){const e=t.salt!=null?de(t.salt,"options.salt"):Xr(32);let r=1<<17,n=8,i=1;return t.scrypt&&(t.scrypt.N&&(r=t.scrypt.N),t.scrypt.r&&(n=t.scrypt.r),t.scrypt.p&&(i=t.scrypt.p)),F(typeof r=="number"&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),F(typeof n=="number"&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),F(typeof i=="number"&&i>0&&Number.isSafeInteger(i),"invalid scrypt p parameter","options.p",i),{name:"scrypt",dkLen:32,salt:e,N:r,r:n,p:i}}function Pw(t,e,r,n){const i=de(r.privateKey,"privateKey"),o=n.iv!=null?de(n.iv,"options.iv"):Xr(16);F(o.length===16,"invalid options.iv length","options.iv",n.iv);const a=n.uuid!=null?de(n.uuid,"options.uuid"):Xr(16);F(a.length===16,"invalid options.uuid length","options.uuid",n.iv);const u=t.slice(0,16),l=t.slice(16,32),h=new Ki(u,o),d=de(h.encrypt(i)),m=lt(je([l,d])),y={address:r.address.substring(2).toLowerCase(),id:NS(a),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ae(o).substring(2)},ciphertext:ae(d).substring(2),kdf:"scrypt",kdfparams:{salt:ae(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:m.substring(2)}};if(r.mnemonic){const w=n.client!=null?n.client:`ethers/${fx}`,T=r.mnemonic.path||Tw,R=r.mnemonic.locale||"en",O=t.slice(32,64),A=de(r.mnemonic.entropy,"account.mnemonic.entropy"),I=Xr(16),B=new Ki(O,I),S=de(B.encrypt(A)),N=new Date,D="UTC--"+(N.getUTCFullYear()+"-"+Ps(N.getUTCMonth()+1,2)+"-"+Ps(N.getUTCDate(),2)+"T"+Ps(N.getUTCHours(),2)+"-"+Ps(N.getUTCMinutes(),2)+"-"+Ps(N.getUTCSeconds(),2)+".0Z")+"--"+y.address;y["x-ethers"]={client:w,gethFilename:D,path:T,locale:R,mnemonicCounter:ae(I).substring(2),mnemonicCiphertext:ae(S).substring(2),version:"0.1"}}return JSON.stringify(y)}function Ow(t,e,r){r==null&&(r={});const n=xo(e),i=Sw(r),o=rs(n,i.salt,i.N,i.r,i.p,64);return Pw(de(o),i,t,r)}async function Iw(t,e,r){r==null&&(r={});const n=xo(e),i=Sw(r),o=await ts(n,i.salt,i.N,i.r,i.p,64,r.progressCallback);return Pw(de(o),i,t,r)}const Cf="m/44'/60'/0'/0/0",IN=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Bn=2147483648,kN=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),NN="0123456789abcdef";function Ca(t,e){let r="";for(;t;)r=NN[t%16]+r,t=Math.trunc(t/16);for(;r.length<e*2;)r="0"+r;return"0x"+r}function uh(t){const e=de(t),r=ot(xr(xr(e)),0,4),n=je([e,r]);return yx(n)}const Ur={};function kw(t,e,r,n){const i=new Uint8Array(37);t&Bn?(re(n!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),i.set(de(n),1)):i.set(de(r));for(let a=24;a>=0;a-=8)i[33+(a>>3)]=t>>24-a&255;const o=de(Xi("sha512",e,i));return{IL:o.slice(0,32),IR:o.slice(32)}}function Nw(t,e){const r=e.split("/");F(r.length>0,"invalid path","path",e),r[0]==="m"&&(F(t.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${t.depth}`,"path",e),r.shift());let n=t;for(let i=0;i<r.length;i++){const o=r[i];if(o.match(/^[0-9]+'$/)){const a=parseInt(o.substring(0,o.length-1));F(a<Bn,"invalid path index",`path[${i}]`,o),n=n.deriveChild(Bn+a)}else if(o.match(/^[0-9]+$/)){const a=parseInt(o);F(a<Bn,"invalid path index",`path[${i}]`,o),n=n.deriveChild(a)}else F(!1,"invalid path component",`path[${i}]`,o)}return n}class yr extends uc{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,r,n,i,o,a,u,l,h){super(r,h),ci(e,Ur,"HDNodeWallet"),Te(this,{publicKey:r.compressedPublicKey});const d=ot(es(xr(this.publicKey)),0,4);Te(this,{parentFingerprint:n,fingerprint:d,chainCode:i,path:o,index:a,depth:u}),Te(this,{mnemonic:l})}connect(e){return new yr(Ur,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#e(){const e={address:this.address,privateKey:this.privateKey},r=this.mnemonic;return this.path&&r&&r.wordlist.locale==="en"&&r.password===""&&(e.mnemonic={path:this.path,locale:"en",entropy:r.entropy}),e}async encrypt(e,r){return await Iw(this.#e(),e,{progressCallback:r})}encryptSync(e){return Ow(this.#e(),e)}get extendedKey(){return re(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),uh(je(["0x0488ADE4",Ca(this.depth,1),this.parentFingerprint,Ca(this.index,4),this.chainCode,je(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new ro(Ur,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const r=Ie(e,"index");F(r<=4294967295,"invalid index","index",r);let n=this.path;n&&(n+="/"+(r&~Bn),r&Bn&&(n+="'"));const{IR:i,IL:o}=kw(r,this.chainCode,this.publicKey,this.privateKey),a=new Xt(sn((Wa(o)+BigInt(this.privateKey))%kN,32));return new yr(Ur,a,this.fingerprint,ae(i),n,r,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Nw(this,e)}static#t(e,r){F(Ka(e),"invalid seed","seed","[REDACTED]");const n=de(e,"seed");F(n.length>=16&&n.length<=64,"invalid seed","seed","[REDACTED]");const i=de(Xi("sha512",IN,n)),o=new Xt(ae(i.slice(0,32)));return new yr(Ur,o,"0x00000000",ae(i.slice(32)),"m",0,0,r,null)}static fromExtendedKey(e){const r=mt(gS(e));F(r.length===82||uh(r.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const n=r[4],i=ae(r.slice(5,9)),o=parseInt(ae(r.slice(9,13)).substring(2),16),a=ae(r.slice(13,45)),u=r.slice(45,78);switch(ae(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const l=ae(u);return new ro(Ur,po(l),l,i,a,null,o,n,null)}case"0x0488ade4":case"0x04358394 ":if(u[0]!==0)break;return new yr(Ur,new Xt(u.slice(1)),i,a,null,o,n,null,null)}F(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,r,n){e==null&&(e=""),r==null&&(r=Cf),n==null&&(n=ni.wordlist());const i=Zi.fromEntropy(Xr(16),e,n);return yr.#t(i.computeSeed(),i).derivePath(r)}static fromMnemonic(e,r){return r||(r=Cf),yr.#t(e.computeSeed(),e).derivePath(r)}static fromPhrase(e,r,n,i){r==null&&(r=""),n==null&&(n=Cf),i==null&&(i=ni.wordlist());const o=Zi.fromPhrase(e,r,i);return yr.#t(o.computeSeed(),o).derivePath(n)}static fromSeed(e){return yr.#t(e,null)}}class ro extends u0{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,r,n,i,o,a,u,l,h){super(r,h),ci(e,Ur,"HDNodeVoidWallet"),Te(this,{publicKey:n});const d=ot(es(xr(n)),0,4);Te(this,{publicKey:n,fingerprint:d,parentFingerprint:i,chainCode:o,path:a,index:u,depth:l})}connect(e){return new ro(Ur,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return re(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),uh(je(["0x0488B21E",Ca(this.depth,1),this.parentFingerprint,Ca(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(e){const r=Ie(e,"index");F(r<=4294967295,"invalid index","index",r);let n=this.path;n&&(n+="/"+(r&~Bn),r&Bn&&(n+="'"));const{IR:i,IL:o}=kw(r,this.chainCode,this.publicKey,null),a=Xt.addPoints(o,this.publicKey,!0),u=po(a);return new ro(Ur,u,a,this.fingerprint,ae(i),n,r,this.depth+1,this.provider)}derivePath(e){return Nw(this,e)}}function xy(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function wy(t,e){const r=JSON.parse(t),n=xo(e),i=ze(At(r,"ethaddr:string!")),o=Rw(At(r,"encseed:string!"));F(o&&o.length%16===0,"invalid encseed","json",t);const a=de(kn(n,n,2e3,32,"sha256")).slice(0,16),u=o.slice(0,16),l=o.slice(16),h=new f0(a,u),d=BN(de(h.decrypt(l)));let m="";for(let y=0;y<d.length;y++)m+=String.fromCharCode(d[y]);return{address:i,privateKey:on(m)}}function Ay(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}class Ds extends uc{constructor(e,r){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let n=typeof e=="string"?new Xt(e):e;super(n,r)}connect(e){return new Ds(this.signingKey,e)}async encrypt(e,r){const n={address:this.address,privateKey:this.privateKey};return await Iw(n,e,{progressCallback:r})}encryptSync(e){const r={address:this.address,privateKey:this.privateKey};return Ow(r,e)}static#e(e){if(F(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const n=Zi.fromEntropy(e.mnemonic.entropy),i=yr.fromMnemonic(n,e.mnemonic.path);if(i.address===e.address&&i.privateKey===e.privateKey)return i;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const r=new Ds(e.privateKey);return F(r.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),r}static async fromEncryptedJson(e,r,n){let i=null;return yy(e)?i=await ON(e,r,n):xy(e)&&(n&&(n(0),await Ay(0)),i=wy(e,r),n&&(n(1),await Ay(0))),Ds.#e(i)}static fromEncryptedJsonSync(e,r){let n=null;return yy(e)?n=PN(e,r):xy(e)?n=wy(e,r):F(!1,"invalid JSON wallet","json","[ REDACTED ]"),Ds.#e(n)}static createRandom(e){const r=yr.createRandom();return e?r.connect(e):r}static fromPhrase(e,r){const n=yr.fromPhrase(e);return r?n.connect(r):n}}export{DN as B,la as C,ut as D,$t as E,Vt as F,kt as I,MN as J,Wn as M,LN as N,br as P,Pe as R,Sr as S,Zr as T,Ds as W,Ti as a,Gs as b,De as c,Le as d,qr as e,sr as f,ze as g,na as h,Mt as i,ab as j,et as k,Ei as l,FN as m,Sb as n,L9 as o,yi as p,bi as q,Xr as r,Fr as s};