@ethersphere/bee-dashboard 0.36.2 → 0.37.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.
- package/README.md +0 -3
- package/build/assets/__vite-browser-external-Gr5Ld13q.js +2 -0
- package/build/assets/{download.browser-CWBk9Xo5.js → download.browser-D7dY7Xjf.js} +1 -1
- package/build/assets/download.node-C_caoQb2.js +1 -0
- package/build/assets/{fs.node-ci1iNMw2.js → fs.node-BJ_fdVQd.js} +2 -2
- package/build/assets/index-BufCo-Bs.js +133 -0
- package/build/assets/upload.browser-OebZUAtX.js +1 -0
- package/build/assets/vendor-ethers-Dh545u0a.js +87 -0
- package/build/index.html +2 -2
- package/lib/{App-CwQdMHYW.mjs → App-B7H4Gpf0.mjs} +16139 -13010
- package/lib/{App-B3D1R6YS.js → App-DePYYc5z.js} +16139 -13010
- package/lib/App.cjs.js +1 -1
- package/lib/App.js +1 -1
- package/lib/assets/data/nodes-db.json.d.ts +2842 -3578
- package/lib/{download.browser-DVvlVttp.js → download.browser-Digctgve.js} +1 -1
- package/lib/{download.browser-1J0WA0ZY.mjs → download.browser-xiVKZT8G.mjs} +1 -1
- package/lib/{download.node-BvTcf4pA.mjs → download.node-By9OGw0L.mjs} +2 -2
- package/lib/{download.node-DNc4t8KE.js → download.node-FjFXjy_9.js} +2 -2
- package/lib/{fs.node-DnKAgPam.js → fs.node-Dirm_VZ-.js} +1 -1
- package/lib/{fs.node-C0eGUtLy.mjs → fs.node-OKThdsyd.mjs} +1 -1
- package/lib/{upload.browser-CN2aC0Ci.mjs → upload.browser-CDVEFDvf.mjs} +3 -3
- package/lib/{upload.browser-LvUP5AqY.js → upload.browser-DBraCRf7.js} +3 -3
- package/lib/{upload.node-BHNhyWDJ.mjs → upload.node-e8znhzCz.mjs} +6 -6
- package/lib/{upload.node-FJ4naJB8.js → upload.node-jidrJtgp.js} +6 -6
- package/package.json +9 -13
- package/build/assets/__vite-browser-external-DHc9oIIQ.js +0 -2
- package/build/assets/download.node-u9UJImpJ.js +0 -1
- package/build/assets/index-QjfIOSmO.js +0 -133
- package/build/assets/upload.browser-g14Y5rh3.js +0 -1
- package/build/assets/vendor-ethers-DdwEM-gK.js +0 -87
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import{p as Fe,g as My,c as Qr,a as bo}from"./vendor-react-mui-tUcmOwCz.js";var xl={},Fp;function EE(){return Fp||(Fp=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 n(o){return new Promise((u,f)=>o.then(f,u))}async function r(o){return n(Promise.all(o.map(n)))}async function i(o,u=1){const f=ap(o,u),p=[],y=f.map(async R=>{for(const H of R)p.push(await H())});return await Promise.all(y),p}async function s(o){return new Promise(u=>setTimeout(()=>{u(!0)},o))}function a(o,u=Math.random){for(let f=o.length-1;f>0;f--){const p=Math.floor(u()*(f+1)),y=o[f];o[f]=o[p],o[p]=y}return o}function c(o){if(o.length===1)return o[0];throw Error(`Expected exactly one element, actual: ${o.length}`)}function l(o){return o.length===1?o[0]:null}function h(o){return o.length>0?o[0]:null}function d(o){if(!o.length)throw Error("Received empty array");return o[0]}function g(o,u){const f=[];for(let p=0;p<o;p++)f.push(u(p));return f}function m(o){const u=[];for(let f=0;f<o[0].length;f++){u.push([]);for(let p=0;p<o.length;p++)u[f].push(o[p][f])}return u}function w(o,u,f){const p=[];for(let y=0;y<o;y++){p.push([]);for(let R=0;R<u;R++)p[y].push(f)}return p}function v(o,u,f,p){if(f<0||p<0||p+u[0].length>o[0].length||f+u.length>o.length)return!1;for(let y=0;y<u.length;y++)for(let R=0;R<u[y].length;R++)if(u[y][R]!==void 0&&o[f+y][p+R]!==u[y][R])return!1;return!0}function E(o,u,f=Math.random){return a(I0(0,o.length-1),f).slice(0,u)}function S(o,u){return o.map(f=>f[u])}function A(o){let u=o,f=3405648695,p=3735928559;return function(){return u+=f,f^=u<<7,u*=p,p^=u<<13,u^=f^p,(u>>>0)/4294967296}}function I(o,u,f=Math.random){return Math.floor(f()*(u-o+1))+o}function T(o,u,f=Math.random){return f()*(u-o)+o}function O(){return Math.random()*2-1}function k(o,u,f){return u>=o.x&&u<o.x+o.width&&f>=o.y&&f<o.y+o.height}function _(o,u,f,p=Math.random){let y,R;do y=I(0,o-1,p),R=I(0,u-1,p);while(f&&k(f,y,R));return[y,R]}function D(o,u=Math.random){const f=Math.floor(o),p=o-f;return $(p,u)?f+1:f}function $(o,u=Math.random){return u()<o}function j(o,u=Math.random){return o[Math.floor(o.length*u())]}function X(o,u,f=Math.random){if(u>o.length)throw new Error(`Count (${u}) is greater than array length (${o.length})`);return E(o,u,f).map(p=>o[p])}function de(o,u,f,p=Math.random){if(u>o.length)throw new Error(`Count (${u}) is greater than array length (${o.length})`);const y=[];for(;y.length<u;){const R=j(o,p);y.some(H=>f(H,R))||y.push(R)}return y}function U(o,u,f,p,y,R=Math.random){const H=o.filter(ie=>ie!==u&&ie!==f),ue=[];for(u!==null&&ue.push(u);H.length&&ue.length<p;){const ie=t.Random.intBetween(0,H.length-1,R);y(H[ie],ue)&&ue.push(H[ie]),H.splice(ie,1)}return a(ue,R),{values:ue,indexOfGuaranteed:u!==null?ue.indexOf(u):-1}}function Z(o){if(!o.length)throw Error("Received empty array");return o[o.length-1]}function J(o,u,f){return f(u.reduce((p,y)=>y(p),o))}function L(o,u){return f=>J(f,o,u)}function q(o,u,f){if(f===void 0&&(f=Math.random()),o.length!==u.length)throw new Error("Array length mismatch");let p=u.reduce((R,H)=>R+H,0);const y=f*p;for(let R=0;R<o.length-1;R++)if(p-=u[R],y>=p)return o[R];return Z(o)}function re(o,u,f=Math.random){const p=u.map(R=>f()*R),y=[];for(let R=0;R<o.length;R++)y.push([o[R],p[R]]);return y.sort((R,H)=>H[1]-R[1]).map(R=>R[0])}function le(o,u){if(o==null)return null;const f=u.split(".");let p=o;for(const y of f){if(p[y]===null||p[y]===void 0)return null;p=p[y]}return p}function ce(o,u,f){const p=u.split(/\.|\[/);let y=o;for(let R=0;R<p.length;R++){const H=p[R],ue=R<p.length-1&&p[R+1].includes("]"),ie=H.includes("]")?H.replace(/\[|\]/g,""):H;if(R===p.length-1)return y[ie]=f,f;at(y[ie])||(ue?y[ie]=[]:y[ie]={}),y=y[ie]}return f}function he(o,u,f=1){const p=le(o,u)||0;return ce(o,u,p+f),p}function be(o,u,f){return le(o,u)||ce(o,u,f)}function xe(o,u){const f=iu(u,"."),p=O0(u,".");if(!f||!p)return;const y=le(o,f);y&&delete y[p]}function V(o,u,f){const p=le(o,u);if(!p)throw new Error("Key '"+u+"' does not exist.");return ce(o,u,f),p}function K(o,u,f){for(const p of u){const y=le(o,p);if(y)return y}if(f){const p=Object.values(o);if(p.length)return p[0]}return null}async function Y(o,u,f){for(;;){try{await o()}catch(p){f&&f("Error in forever",p)}await s(u)}}function M(o,u){o();const f=setInterval(()=>{o()},u);return()=>clearInterval(f)}function z(){const o=globalThis.process;return o?o.browser===!0?"browser":"node":"browser"}async function W(o,u,f,p,y,R){let H=null;for(let ue=0;ue<=u;ue++)try{return await o()}catch(ie){if(H=ie,ue===u)break;const Re=f+(p-f)*(ue/(u-1));y&&y("Error in withRetries, retrying",{attempt:ue+1,allowedFailures:u,delayMillis:Re,error:ie}),R&&R(),await s(Re)}throw H}function te(o){return o/1024/1024}function se(o,u=1024){return o>=u*u*u*u?(o/u/u/u/u).toFixed(3)+" TB":o>=u*u*u?(o/u/u/u).toFixed(3)+" GB":o>=u*u?(o/u/u).toFixed(3)+" MB":o>=u?(o/u).toFixed(3)+" KB":o+" B"}function P(o){const u=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o.toLowerCase());if(!u)throw new Error("Invalid hex color: "+o);return[parseInt(u[1],16),parseInt(u[2],16),parseInt(u[3],16)]}function N(o){return"#"+o.map(u=>u.toString(16).padStart(2,"0")).join("")}function ee(o,u,f,p){const y=o*Math.PI/180,R=f*Math.PI/180,H=(f-o)*Math.PI/180,ue=(p-u)*Math.PI/180,ie=Math.sin(H/2)*Math.sin(H/2)+Math.cos(y)*Math.cos(R)*Math.sin(ue/2)*Math.sin(ue/2);return 6371e3*(2*Math.atan2(Math.sqrt(ie),Math.sqrt(1-ie)))}function ge(o,u){return Math.round(o/u)*u}function Pe(o){return o>1e3?(o/1e3).toFixed(0)+" km":o>=500?ge(o,100)+" m":o>=100?ge(o,50)+" m":ge(o,10)+" m"}function Ee(o){return o*(o+1)/2}function Ce(o){const u=o.match(/-?\d+(\.\d+)?/);if(!u)throw Error("No float found in "+o);return parseFloat(u[0])}function Rt(o,u,f=Math.random){const p=o*u,y=Math.sqrt(o*u*(1-u)),R=(f()+f()+f()+f()+f()+f()-3)*Math.SQRT2,H=Math.round(p+y*R);return Math.max(0,Math.min(o,H))}function oe(o,u){if(!o.includes("."))return o;if(parseFloat(o)===0)return"0";const[f,p]=o.split("."),y=f.replace("-",""),R=y.length;if(R>=u)return f;if(y!=="0"){const ie=u-R,Re=p.slice(0,ie);return/[1-9]/.test(Re)?`${f}.${Re.replace(/0+$/,"")}`:f}const H=p.match(/^0*/)?.[0].length??0,ue=u+H;return`${f}.${p.slice(0,ue)}`}function at(o,u=!0){return!o||u&&!Tt(o._readableState)||u&&o.constructor&&(o.constructor.isBuffer||o.constructor.name=="AbortController"||o.constructor.name=="AbortSignal"||o.constructor.name=="Uint8Array"||o.constructor.name==="ArrayBuffer"||o.constructor.name==="ReadableStream")?!1:typeof o=="object"}function ct(o){return at(o)&&!Array.isArray(o)}function Ge(o){return Array.isArray(o)&&o.length===0}function Ze(o){return ct(o)&&Object.keys(o).length===0}function Tt(o){return o===void 0}function qt(o){return Object.prototype.toString.call(o)==="[object Function]"||Object.prototype.toString.call(o)==="[object AsyncFunction]"}function We(o){return Object.prototype.toString.call(o)==="[object String]"}function xt(o){return typeof o=="number"&&isFinite(o)}function Mt(o){return o===!0||o===!1}function Dt(o){return Object.prototype.toString.call(o)==="[object Date]"}function pn(o){return!We(o)||o.trim().length===0}function $n(o){return xt(o)&&Number.isInteger(o)&&o>=1}function Pr(o){return We(o)&&o.match(/^-?\d+$/)!==null}function tr(o){return We(o)&&o.match(/^(0x)?[0-9a-f]+$/i)!==null}const gn="!@#$%^&*()_+-=[]{}|;:<>?,./",Pn="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),nr="abcdefghijklmnopqrstuvwxyz",ii="ABCDEFGHIJKLMNOPQRSTUVWXYZ",rr="1234567890",ir=nr+ii+rr,kr=ir+gn,sr=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],kn="0123456789abcdef";function $t(o,u=Math.random){let f="";for(let p=0;p<o;p++)f+=nr[Math.floor(u()*nr.length)];return f}function or(o,u=Math.random){let f="";for(let p=0;p<o;p++)f+=ir[Math.floor(u()*ir.length)];return f}function si(o,u=Math.random){let f="";for(let p=0;p<o;p++)f+=kr[Math.floor(u()*kr.length)];return f}function zn(o,u=Math.random){let f="";for(let p=0;p<o;p++)f+=sr[Math.floor(u()*sr.length)];return f}function tu(o,u){const f=new RegExp(`[0-9a-f]{${u}}`,"i"),p=o.match(f);return p?p[0]:null}function B(o,u,f=Pn){const p=P0(o,f);for(const y of p)if(u(y))return y;return null}function b(o,u=Math.random){let f="";for(let p=0;p<o;p++)f+=kn[Math.floor(u()*kn.length)];return f}function x(o,u){if(!Pr(o))throw new TypeError(`Expected integer string${u?.name?` for ${u.name}`:""}, got: `+o);const f=BigInt(o);if(u&&(u.min&&f<u.min||u.max&&f>u.max))throw RangeError(`Expected integer string${u?.name?` for ${u.name}`:""} in range: ${u.min??"-inf"}..${u.max??"inf"}; got: `+f);return o}function C(o,u){if(pn(o))throw new TypeError(`Expected string${u?.name?` for ${u.name}`:""}, got: `+o);if(u&&(u.min!==void 0&&o.length<u.min||u.max!==void 0&&o.length>u.max))throw RangeError(`Expected string${u?.name?` for ${u.name}`:""} length in range: ${u.min??"-inf"}..${u.max??"inf"}; got: ${o.length}`);return o}function G(o,u){if(!tr(o))throw new TypeError(`Expected hex string${u?.name?` for ${u.name}`:""}, got: `+o);if(u?.strictPrefix&&!o.startsWith("0x")&&!o.startsWith("0X"))throw new TypeError(`Expected hex string with 0x prefix${u?.name?` for ${u.name}`:""}, got: `+o);const f=o.replace(/^0x/i,"");if(f.length%2!==0&&!u?.uneven)throw RangeError(`Expected even number of hex digits${u?.name?` for ${u.name}`:""}; got: `+o);if(u&&u.byteLength&&f.length!==u.byteLength*2)throw RangeError(`Expected hex string${u?.name?` for ${u.name}`:""} of byte length ${u.byteLength}; got: `+f);return`0x${f}`}function Q(o,u){if(!C(o,u).split("").every(f=>f==="_"||zs(f)))throw new TypeError(`Expected safe string${u?.name?` for ${u.name}`:""}, got: `+o);return o}function ae(o,u){if(u.min!==void 0&&o<u.min||u.max!==void 0&&o>u.max)throw RangeError(`Expected value${u?.name?` for ${u.name}`:""} in range: ${u.min??"-inf"}..${u.max??"inf"}; got: ${o}`)}function De(o,u){if(!qt(o))throw new TypeError(`Expected function${u?.name?` for ${u.name}`:""}, got: `+o);return o}function Qe(o,u){if(xt(o))return u&&ae(o,u),o;if(!We(o)||!o.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${u?.name?` for ${u.name}`:""}, got: `+o);const f=parseFloat(o);return u&&ae(f,u),f}function Ke(o,u){return Math.trunc(Qe(o,u))}function lt(o,u){if(o==="true")return!0;if(o==="false")return!1;if(!Mt(o))throw new TypeError(`Expected boolean${u?.name?` for ${u.name}`:""}, got: `+o);return o}function Je(o,u){if(!Dt(o))throw new TypeError(`Expected date${u?.name?` for ${u.name}`:""}, got: `+o);return o}function L3(o){return pn(o)?null:o}function M3(o,u){if(!We(o))throw new TypeError(`Expected string${u?.name?` for ${u.name}`:""}, got: `+o);return o}function $3(o,u){if($n(o))return o;const f=parseInt(o,10);if(!$n(f))throw new TypeError(`Expected id${u?.name?` for ${u.name}`:""}, got: `+o);return f}function z3(o,u){if(!We(o))throw new TypeError(`Expected time${u?.name?` for ${u.name}`:""}, got: `+o);const f=o.split(":");if(f.length!==2)throw new TypeError(`Expected time${u?.name?` for ${u.name}`:""}, got: `+o);const p=parseInt(f[0],10),y=parseInt(f[1],10);if(!xt(p)||!xt(y)||p<0||p>23||y<0||y>59)throw new TypeError(`Expected time, got${u?.name?` for ${u.name}`:""}: `+o);return`${String(p).padStart(2,"0")}:${String(y).padStart(2,"0")}`}function G3(o,u){if(!Array.isArray(o))throw new TypeError(`Expected array${u?.name?` for ${u.name}`:""}, got: `+o);return o}function ra(o,u){if(!ct(o))throw new TypeError(`Expected object${u?.name?` for ${u.name}`:""}, got: `+o);return o}function V3(o,u){return o===null?null:ra(o,u)}function j3(o,u){const f=ra(o,u);for(const p of Object.keys(f))if(!We(f[p]))throw new TypeError(`Expected string map${u?.name?` for ${u.name}`:""}, got: `+o);return f}function H3(o,u){const f=ra(o),p=Object.keys(f),y=Object.values(f);if(!p.every(We)||!y.every(xt))throw new TypeError(`Expected numeric dictionary${u?.name?` for ${u.name}`:""}, got: `+o);return f}function v0(o){return We(o)&&o.match(/^https?:\/\/.+/)!==null}function q3(o,u){if(!v0(o))throw new TypeError(`Expected url${u?.name?` for ${u.name}`:""}, got: `+o);return o}function B0(o){return typeof o=="bigint"}function R0(o,u){if(!B0(o))throw new TypeError(`Expected bigint${u?.name?` for ${u.name}`:""}, got: `+o);if(u?.min!==void 0&&o<u?.min||u?.max!==void 0&&o>u?.max)throw RangeError(`Expected value${u?.name?` for ${u.name}`:""} in range: ${u.min??"-inf"}..${u.max??"inf"}; got: ${o}`);return o}function Z3(o,u){return u==null?!0:o(u)}function K3(o,u){return u==null?null:o(u)}function J3(o,u){return u===""?void 0:o(u)}function W3(o,u){return u==null?void 0:o(u)}function T0(o,u){for(const[f,p]of Object.entries(u))if(!p(o[f]))throw TypeError(`${f} in value does not exist or match shape`);for(const f of Object.keys(o))if(!u[f])throw TypeError(`${f} exists in value but not in shape`);return!0}function Q3(o,u){return o.every(f=>T0(f,u))}function Ms(o,u="json",f=0){if(o&&qt(o.represent)){const p=o.represent();if(We(p))return u==="json"&&f===0?JSON.stringify(p):p}if(at(o,!1)){if(f>1)return"[object Object]";if(u==="json"){if(Array.isArray(o)){const y=o.map(R=>Ms(R,"json",f+1));return f===0?JSON.stringify(y):y}const p={};o.message&&(p.message=Ms(o.message,"json",f+1));for(const[y,R]of Object.entries(o))p[y]=Ms(R,"json",f+1);return f===0?JSON.stringify(p):p}else if(u==="key-value"){const p=Object.keys(o);return o.message&&!p.includes("message")&&p.unshift("message"),p.map(y=>`${y}=${JSON.stringify(Ms(o[y],"json",f+1))}`).join(" ")}}return Tt(o)&&(o="undefined"),f===0?JSON.stringify(o):o}function Y3(o,u){if(We(o))return o;const f=Object.keys(o);o.message&&!f.includes("message")&&f.push("message");const p=f.map(y=>`${y}: ${o[y]}`).join("; ");return u&&o.stack?p+`
|
|
2
|
+
`+o.stack:p}function oi(o,u){if(ct(o)&&ct(u))for(const f in u)ct(u[f])?(o[f]||(o[f]={}),oi(o[f],u[f])):Array.isArray(u[f])?o[f]=[...u[f]]:(u[f]!==null&&u[f]!==void 0||o[f]===null||o[f]===void 0)&&(o[f]=u[f]);return o}function X3(o,u){const f={};return oi(f,o),oi(f,u),f}function e8(o,u,f){const p={};return oi(p,o),oi(p,u),oi(p,f),p}function S0(o,u){const f={};for(const p of o)for(const y of Object.keys(p))f[y]?f[y]=u(f[y],p[y]):f[y]=p[y];return f}function t8(o){return S0(o,(u,f)=>u+f)}function n8(o,u,f){o[u]||(o[u]=[]),o[u].push(f)}function r8(o,u,f){for(o.unshift(u);o.length>f;)o.pop()}function i8(o,u){let f=u%o.length;return f<0&&(f+=o.length),o[f]}function ia(o,u){Array.prototype.push.apply(o,u)}function s8(o,u){Array.prototype.unshift.apply(o,u)}async function o8(o,u){const f=[];for(const p of o)f.push(await u(p));return f}function a8(o,u){const f=[];for(let p=0;p<o.length;p++)f.push(o[p]),p<o.length-1&&(qt(u)?f.push(u()):f.push(u));return f}function c8(o,u){if(o!==u)throw Error(`Expected [${o}] to equal [${u}]`);return[o,u]}function u8(o){if(o!==!0)throw Error(`Expected [true], got: [${o}]`);return o}function l8(o){if(!o)throw Error(`Expected truthy value, got: [${o}]`);return o}function f8(o){if(o!==!1)throw Error(`Expected [false], got: [${o}]`);return o}function h8(o){if(o)throw Error(`Expected falsy value, got: [${o}]`);return o}function d8(o,u){if(!u.includes(o))throw Error(`Expected any of [${u.join(", ")}], got: [${o}]`);return o}function p8(o,u){for(let f=0;f<o.length;f++){const p=o[f],y=u[f],R=Math.max(0,y.getTime()-Date.now());setTimeout(p,R)}}function g8(o,u,f){return o+(u-o)*f}function m8(o){return o.reduce((u,f)=>u+f,0)}function b8(o){return o.reduce((u,f)=>u+f,0)/o.length}function y8(o){const u=[...o].sort((p,y)=>p-y),f=Math.floor(u.length/2);return u.length%2===0?(u[f]+u[f-1])/2:u[f]}function x8(o,u){return o-(u-1)/2}function I0(o,u){const f=[];for(let p=o;p<=u;p++)f.push(p);return f}function w8(o,u){return u.some(f=>o.includes(f))}function A8(o){return/^[\u4E00-\u9FA5]+$/.test(o)}function nu(o,u=()=>!1){return o.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").split("").map(f=>/[a-z0-9]/.test(f)||u(f)?f:"-").join("").replace(/-+/g,"-").replace(/^-|-$/g,"")}function E8(o){return nu(o).replaceAll("-","")}function v8(o){return aa(o.replace(/([A-Z])/g," $1"))}function B8(o){return o.split("-").map(aa).join(" ")}function R8(o){return N0(o.split("-").map(aa).join(""))}function T8(o,u=", ",f=" and "){return!o||!o.length?"":o.length===1?o[0]:o.length===2?`${o[0]}${f}${o[1]}`:`${o.slice(0,o.length-1).join(u)}${f}${o[o.length-1]}`}function S8(o,u){return u+o.split("").join(u)+u}function I8(o){return nu(o).replace(/-/g,"_").toUpperCase()}function sa(o,u){if(u.length===0)return 0;const f=o.toLowerCase(),p=u.toLowerCase();return o===u?1e4:f.startsWith(p)?1e4-o.length:f.includes(p)?5e3-o.length:new RegExp(".*"+p.split("").join(".*")+".*").test(f)?1e3-o.length:0}function O8(o,u){return o.filter(f=>sa(f,u)).sort((f,p)=>sa(p,u)-sa(f,u))}function P8(o){return o.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const k8={"&":"&",""":'"',"'":"'",">":">","<":"<"};function N8(o){let u=o.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(k8))u=u.replaceAll(f,p);return u}function ru(o,u){const f=o.indexOf(u);return f===-1?null:o.slice(0,f)}function oa(o,u){const f=o.indexOf(u);return f===-1?null:o.slice(f+u.length)}function iu(o,u){const f=o.lastIndexOf(u);return f===-1?null:o.slice(0,f)}function O0(o,u){const f=o.lastIndexOf(u);return f===-1?null:o.slice(f+u.length)}function C8(o,u,f){const p=iu(o,f);return p?oa(p,u):null}function _8(o,u,f){const p=oa(o,u);return p?ru(p,f):null}function su(o,u,f=!1){const p=f?o.lastIndexOf(u):o.indexOf(u);return p===-1?f?[null,o]:[o,null]:[o.slice(0,p),o.slice(p+u.length)]}function P0(o,u){let f=[o];for(const p of u)f=f.flatMap(y=>y.split(p));return f.filter(p=>p)}function ou(o){const u=Z(o.split(/\\|\//g)),f=u.lastIndexOf(".",u.length-1);return f<=0?"":u.slice(f+1)}function au(o){const u=Z(o.split(/\\|\//g)),f=u.lastIndexOf(".",u.length-1);return f<=0?u:u.slice(0,f)}function D8(o){let[u,f]=o.split("@");u=$s(u.replaceAll(".","").toLowerCase()).replaceAll(" ","");const[p]=u.split("+");if(!p||!f||f.indexOf(".")===-1||f.indexOf(".")===f.length-1)throw new Error("Invalid email");return f=$s(f.toLowerCase()).replaceAll(" ",""),`${p}@${f}`}function F8(o){const u=au(o),f=ou(o);return f?`${u}.${f}`:u}function U8(o){const u=au(o),f=ou(o);return{basename:u,extension:f,filename:f?`${u}.${f}`:u}}function L8(o,u=Math.random){return o.replace(/\{(.+?)\}/g,(f,p)=>j(p.split("|"),u))}function k0(o){const u=/\{(.+?)\}/,f=o.match(u);if(!f||!f.index)return[o];const p=f[1].split(","),y=o.slice(0,f.index),R=o.slice(f.index+f[0].length);let H=[];for(const ue of p){const ie=k0(y+ue+R);H=H.concat(ie)}return H}function $s(o){return o.split(`
|
|
3
|
+
`).map(u=>u.trim().replace(/\s+/g," ")).filter(u=>u.length>0).join(`
|
|
4
|
+
`)}function aa(o){return o.charAt(0).toUpperCase()+o.slice(1)}function N0(o){return o.charAt(0).toLowerCase()+o.slice(1)}function C0(o){if(!o)return!1;const u=o.charCodeAt(0);return u>=65&&u<=90||u>=97&&u<=122}function _0(o){if(!o)return!1;const u=o.charCodeAt(0);return u>=48&&u<=57}function zs(o){return C0(o)||_0(o)}const M8=`
|
|
5
|
+
\r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");function $8(o){return M8.includes(o)}function z8(o){return zs(o)||o==="."||o==="["||o==="]"||o==="_"}function G8(o,u,f,p,y){return o.slice(0,u)+p+o.slice(u,u+f)+y+o.slice(u+f)}function D0(o,u,f=0){const p=u.exec(o.slice(f));return p?{index:p.index,match:p[0]}:null}function F0(o,u,f=!0){if(!f)return u.every(y=>y instanceof RegExp?y.test(o):o.indexOf(y,0)!==-1);let p=0;for(const y of u)if(y instanceof RegExp){const R=D0(o,y,p);if(!R)return!1;p=R.index+R.match.length}else{const R=o.indexOf(y,p);if(R===-1)return!1;p=R+y.length}return!0}function V8(o,u,f=!0){let p=0;for(const y of u){let R=!1;for(;!R&&p<o.length;)F0(o[p],y,f)&&(R=!0),p++;if(!R)return!1}return!0}function j8(o){return o.match(/"|,/)?`"${o.replace(/"/g,'""')}"`:o}function U0(o,u,f=0){const p=[];let y=o.indexOf(u,f);for(;y!==-1;)p.push(y),y=o.indexOf(u,y+u.length);return p}function Mi(o,u,f=0){let p=-1;for(const y of u){const R=o.indexOf(y,f);R!==-1&&(p===-1||R<p)&&(p=R)}return p}function H8(o,u=0){for(let f=u;f<o.length;f++)if($8(o[f]))return f;return-1}function q8(o,u=0){for(let f=u;f<o.length;f++)if(o[f]==="#"&&zs(o[f+1]))return f;return-1}function L0(o,u,f=0){return o.slice(0,f).lastIndexOf(u)}function M0(o,u=0,f="{",p="}"){let y=1;for(let R=u;R<o.length;R++)if(o.slice(R,R+p.length)===p){if(--y===0)return R}else o.slice(R,R+f.length)===f&&y++;return-1}function $0(o,u){const f=u.wordBoundary?Mi(o,[`${u.opening} `,`${u.opening}
|
|
6
|
+
`],u.start||0):o.indexOf(u.opening,u.start||0);if(f===-1)return null;const p=M0(o,f+u.opening.length,u.opening,u.closing);return p===-1?null:u.exclusive?o.slice(f+u.opening.length,p):o.slice(f,p+u.closing.length)}function Z8(o,u){const f=[];let p=u.wordBoundary?Mi(o,[`${u.opening} `,`${u.opening}
|
|
7
|
+
`],u.start||0):o.indexOf(u.opening,u.start||0);for(;;){if(p===-1)return f;const y=$0(o,{...u,start:p});if(!y)return f;f.push(y),p=u.wordBoundary?Mi(o,[`${u.opening} `,`${u.opening}
|
|
8
|
+
`],p+y.length):o.indexOf(u.opening,p+y.length)}}function K8(o,u,f){let p=0;for(;;){const y=t.Strings.extractBlock(o,{...f,start:p});if(!y)return o;const R=u(y);p=o.indexOf(y,p)+R.length,o=o.replace(y,R)}}function J8(o,u){const f=[];let p=0;for(;p<o.length;){const y=o.indexOf(u,p);if(y===-1){f.push({string:o.slice(p),symbol:null});break}const R=o.indexOf(u,y+u.length);if(y>p&&R!==-1&&f.push({string:o.slice(p,y),symbol:null}),R===-1){f.push({string:o.slice(p),symbol:null});break}f.push({string:o.slice(y+u.length,R),symbol:u}),p=R+u.length}return f}function W8(o){const u=[];let f=0;for(;f<o.length;){const p=q8(o,f);if(p===-1){u.push({string:o.slice(f),symbol:null});break}const y=H8(o,p+1);if(y===-1){u.push({string:o.slice(f,p),symbol:null}),u.push({string:o.slice(p+1),symbol:"#"});break}p>f&&u.push({string:o.slice(f,p),symbol:null}),u.push({string:o.slice(p+1,y),symbol:"#"}),f=y}return u}function Q8(o){const u=[];let f=0;for(;f<o.length;){const p=Mi(o,["http://","https://"],f);if(p===-1){u.push({string:o.slice(f),symbol:null});break}const y=Mi(o,[" ",`
|
|
9
|
+
`],p);if(y===-1){p>f&&u.push({string:o.slice(f,p),symbol:null}),u.push({string:o.slice(p),symbol:"http"});break}p>f&&u.push({string:o.slice(f,p),symbol:null}),u.push({string:o.slice(p,y),symbol:"http"}),f=y}return u}const z0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",G0="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Y8(o){return V0(o,z0)}function X8(o){return j0(o,z0)}function e4(o){return V0(o,G0)}function t4(o){return j0(o,G0)}function V0(o,u){const p=u.length;let y=0,R=0;const H=[];for(let ue=0;ue<o.length;ue++){const ie=o[ue];if(ie==="=")break;const Re=u.indexOf(ie);if(Re===-1)throw new Error(`Invalid character: ${ie}`);R=R<<Math.log2(p)|Re,y+=Math.log2(p),y>=8&&(y-=8,H.push(R>>y&255))}return new Uint8Array(H)}function j0(o,u){const f=u.length;let p=0,y=0,R="";for(let H=0;H<o.length;H++)for(y=y<<8|o[H],p+=8;p>=Math.log2(f);)p-=Math.log2(f),R+=u[y>>p&f-1];return p>0&&(R+=u[y<<Math.log2(f)-p&f-1]),R.length%4!==0&&(R+="=".repeat(4-R.length%4)),R}function n4(o){(o.startsWith("0x")||o.startsWith("0X"))&&(o=o.slice(2));const u=o.length/2,f=new Uint8Array(u);for(let p=0;p<u;p++){const y=parseInt(o.slice(p*2,p*2+2),16);f[p]=y}return f}function r4(o){return Array.from(o).map(u=>u.toString(16).padStart(2,"0")).join("")}function i4(o){return Array.from(o).map(u=>u.toString(2).padStart(8,"0")).join("")}function s4(o){const u=Math.ceil(o.length/8),f=new Uint8Array(u);for(let p=0;p<u;p++){const y=parseInt(o.slice(p*8,p*8+8),2);f[p]=y}return f}function o4(o,u){const f=o.split("/").filter(R=>R),p=u.split("/").filter(R=>R);if(f.length!==p.length)return null;const y={};for(let R=0;R<f.length;R++){const H=f[R];if(H.startsWith(":"))y[H.slice(1)]=p[R];else if(H!==p[R])return null}return y}function cu(o,u,f){const p=[];for(const y of f)y!==u&&p.push(o.replace(u,y));return p}function a4(o,u,f,p=Math.random){const y=t.Arrays.shuffle(u.map(H=>({variants:t.Arrays.shuffle(H.variants.map(ue=>ue),p),avoid:H.avoid})),p),R=[];for(const H of y){const ue=H.variants.filter(Re=>Re!==H.avoid),ie=ue.find(Re=>o.includes(Re));if(ie&&(ia(R,cu(o,ie,ue)),R.length>=f))break}if(R.length<f)for(const H of y){const ue=H.variants.find(ie=>o.includes(ie));if(ue&&(ia(R,cu(o,ue,H.variants)),R.length>=f))break}return R.slice(0,f)}function c4(o,u,f,p=!1){const y=new RegExp(p?`(?<=\\s|^)${u}(?=\\s|$)`:`\\b${u}\\b`,"g");return o.replace(y,f)}function u4(o,u){const f=/\b[A-Z][a-zA-Z0-9]*\b/g;return o.replace(f,p=>p.toUpperCase()===p?p:u(p))}function l4(o){return o.replace(/<[^>]*>/g,"")}function H0(o){const u=o.lastIndexOf(" ");if(u===-1)return{line:o,rest:""};const f=o.slice(0,u),p=o.slice(u+1);return{line:f,rest:p}}function f4(o,u={}){return[...o].reduce((f,p)=>f+(u[p]||1),0)}function h4(o,u,f={}){const p=[];let y="",R=0;for(let H=0;H<o.length;H++){const ue=o[H],ie=f[ue]||1;if(y+=ue,R+=ie,R>u){const{line:Re,rest:St}=H0(y);p.push(Re),y=St,R=St.split("").map(Zt=>f[Zt]||1).reduce((Zt,Vi)=>Zt+Vi,0)}}return y&&p.push(y),p}function d4(o,u){const f=[];for(let p=0;p<=o.length;p++)f[p]=[p];for(let p=0;p<=u.length;p++)f[0][p]=p;for(let p=1;p<=o.length;p++)for(let y=1;y<=u.length;y++){const R=o[p-1]===u[y-1]?0:1;f[p][y]=Math.min(f[p-1][y]+1,f[p][y-1]+1,f[p-1][y-1]+R)}return f[o.length][u.length]}function q0(o){const u=o.reduce((p,y)=>p.length<y.length?p:y);let f="";for(let p=0;p<u.length;p++){const y=u[p];if(o.every(R=>R[p]===y))f+=y;else break}return f}function p4(o){const u=q0(o),f=u.lastIndexOf("/");return f===-1?"":u.slice(0,f+1)}function uu(o,u){return new RegExp(`\\b${u}\\b`).test(o)}function g4(o,u,f){return f==="any"?u.some(p=>uu(o,p)):u.every(p=>uu(o,p))}function m4(o){const u={},f=o.match(/([a-z\-]+)="([^"]+)"/g);if(f)for(const p of f){const[y,R]=su(p,"=");u[y]=R.slice(1,R.length-1)}return u}function Gs(o,u,f=[]){let p="";for(;u<o.length&&(zs(o[u])||f.includes(o[u]));)p+=o[u++];return p}function b4(o,u,f=[]){const p=U0(o,u),y=[];for(const R of p)y.push(Gs(o,R+u.length,f));return y}function y4(o,u,f="$",p=":"){for(const y in u)o=Z0(o,y,u[y],f,p);return o=K0(o),o}function Z0(o,u,f,p="$",y=":"){if(f==="")return o;let R=o.indexOf(`${p}${u}`);for(;R!==-1;){if(o[R+u.length+1]===y)if(o[R+u.length+2]===y)o=o.replace(`${p}${u}${y}${y}`,f);else{const H=Gs(o,R+u.length+2,["_"]);o=o.replace(`${p}${u}${y}${H}`,f)}else o=o.replace(`${p}${u}`,f);R=o.indexOf(`${p}${u}`,R+f.length)}return o}function K0(o,u="$",f=":"){let p=o.indexOf(u);for(;p!==-1;){const y=Gs(o,p+1);if(o[p+y.length+1]===f)if(o[p+y.length+2]===f)o=o.replace(`${u}${y}${f}${f}`,"");else{const R=Gs(o,p+y.length+2);o=o.replace(`${u}${y}${f}${R}`,R)}p=o.indexOf(u,p+1)}return o}function x4(o,u){let f=o.indexOf("](");for(;f!==-1;){const p=L0(o,"[",f),y=o.indexOf(")",f);if(p!==-1&&y!==-1){const[R,H]=o.slice(p+1,y).split("]("),ue=u(R,H);o=o.slice(0,p)+ue+o.slice(y+1)}f=o.indexOf("](",f+1)}return o}function J0(o,u=!0){const f=Object.entries(o).filter(([p,y])=>y!=null).map(([p,y])=>`${p}=${encodeURIComponent(y)}`).join("&");return f?(u?"?":"")+f:""}function w4(o){const u={},f=o.split("&");for(const p of f){const[y,R]=p.split("=");y&&R&&(u[y]=decodeURIComponent(R))}return u}function A4(o,u){return Object.prototype.hasOwnProperty.call(o,u)}function E4(o,u){let f=null,p=-1/0;for(const[y,R]of Object.entries(o)){const H=u(R);H>p&&(p=H,f=y)}return f?[f,o[f]]:null}function v4(o,u,f,p){const y=o.find(H=>H[u]===f),R=o.find(H=>H[u]===f+p);y&&R?(y[u]=f+p,R[u]=f):y&&(y[u]=f+p),o.sort((H,ue)=>Qe(H[u])-Qe(ue[u])),o.forEach((H,ue)=>H[u]=ue+1)}function B4(o){const u=Object.keys(o);if(u.length===1)return o[u[0]];throw new Error("Expected object to have a single key")}function R4(o,u=":"){return Object.fromEntries(o.map(f=>su(f,u)).map(f=>f[0]&&f[1]?[$s(f[0]),$s(f[1])]:null).filter(f=>f))}function T4(o,u){if(!o)return!1;const f=o.message;return typeof f=="string"&&f.includes(u)}function S4(o,u,f){return X0([o,u])+J0(f||{})}function I4(o,u=",",f='"'){const p=[];let y="",R=!1;const H=o.split("");for(const ue of H)ue===u&&!R?(p.push(y),y=""):ue===f&&(!y&&!R||R)?R=!R:y+=ue;return p.push(y),p}function O4(o){return`[${Math.floor(o.progress*100)}%] ${ca(o.deltaMs)} out of ${ca(o.totalTimeMs)} (${ca(o.remainingTimeMs)} left) [${Math.round(o.baseTimeMs)} ms each]`}async function P4(o,u){let f=u.requiredConsecutivePasses||1,p=0;for(let y=0;y<u.attempts;y++){try{if(await o()){if(p++,p>=f)return}else p=0}catch{p=0}y<u.attempts-1&&await s(u.waitMillis)}throw Error("Timed out waiting for predicate")}function k4(o,u){const f=[];for(let p=o.length-1;p>=0;p--)u(o[p])&&f.push(o.splice(p,1)[0]);return f}function N4(o){return JSON.parse(JSON.stringify(o))}function C4(o){return Math.ceil((o||Date.now())/1e3)}function _4(o){return(o||new Date).toISOString().slice(0,10)}function D4(o){return(o||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")}function F4(o){const u=new Date(o);return new Date(u.getTime()-u.getTimezoneOffset()*6e4)}function U4(o){return new Date(o)}function Gn(o){return String(Math.floor(o)).padStart(2,"0")}function L4(o){let[u,f]=o.split(":");xt(parseInt(u,10))||(u="0"),xt(parseInt(f,10))||(f="0");let p=du(Ke(u),0,23),y=du(Ke(f),0,59);return`${Gn(p)}:${Gn(y)}`}function ca(o){const u=Math.floor(o/36e5);o=o%36e5;const f=Math.floor(o/6e4);o=o%6e4;const p=Math.floor(o/1e3);return u?`${Gn(u)}:${Gn(f)}:${Gn(p)}`:`${Gn(f)}:${Gn(p)}`}function ai(o){return Math.floor((Dt(o)?o.getTime():o)/864e5)}const M4={today:(o,u)=>Gn(o)+":"+Gn(u),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:o=>`${o}w`};function $4(o,u){const f=new Date(u?.now||Date.now()),p=u?.labels||M4,y=Dt(o)?o:new Date(o);if(ai(f)===ai(y))return p.today(y.getUTCHours(),y.getUTCMinutes(),y.getUTCHours()>12);if(ai(f)-ai(y)===1)return p.yesterday();const R=fu(y);return ai(f)-ai(y)<7?p[R.day]():p.weeks(Math.round((f.getTime()-y.getTime())/6048e5))}const W0={now:()=>"A few seconds",seconds:o=>`${o} seconds`,minutes:o=>`${o} minutes`,hours:o=>`${o} hours`,days:o=>`${o} days`,weeks:o=>`${o} weeks`};function Q0(o,u){const f=u?.now??Date.now(),p=u?.labels||W0,y=t.Types.isDate(o)?o.getTime():o;let R=(f-y)/1e3;return R<10?p.now():R<120?p.seconds(Math.floor(R)):(R/=60,R<120?p.minutes(Math.floor(R)):(R/=60,R<48?p.hours(Math.floor(R)):(R/=24,R<14?p.days(Math.floor(R)):(R/=7,p.weeks(Math.floor(R))))))}function z4(o,u=W0){return Q0(0,{now:o*1e3,labels:u})}function G4(o,u,f){const p=(f?.now??Date.now())-o,y=Math.floor(p/u),R=u/(f?.precision??1)-Math.ceil(p%u/(f?.precision??1));return{cycles:y,remaining:R}}const lu={};function V4(o,u){return!lu[o]||Date.now()>lu[o]?(lu[o]=Date.now()+u,!0):!1}const j4={s:1e3,m:6e4,h:36e5,d:864e5};function H4(o,u,f){return u=Dt(u)?u.getTime():u,f=f?Dt(f)?f.getTime():f:Date.now(),(f-u)/j4[o]}function q4(o,u,f,p){p||(p=Date.now());const y=u/f,R=p-o,H=R/u,ue=H*f,ie=ue-R;return{deltaMs:R,progress:y,baseTimeMs:H,totalTimeMs:ue,remainingTimeMs:ie}}const Z4={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function Y0(o){return{zeroBasedIndex:o,day:Z4[o]}}function fu(o){return Y0(o.getDay())}function K4(o){return fu(new Date(o))}function J4(o){return o*1e3}function W4(o){return o*6e4}function Q4(o){return o*36e5}function Y4(o){return o*864e5}const X4={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 eA(o){const u=parseFloat(o);if(isNaN(u))throw Error("makeDate got NaN for input");const f=o.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),p=f===""?1:X4[f];if(!p)throw Error(`Unknown unit: "${f}"`);return Math.ceil(u*p)}const tA={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 nA(o,u=1024){const f=parseFloat(o);if(isNaN(f))throw Error("makeStorage got NaN for input");const p=o.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),y=p===""?0:tA[p];if(y==null)throw Error(`Unknown unit: "${p}"`);return Math.ceil(f*u**y)}function rA(o){return o.replace(/ +/g," ").replace(/^ /gm,"")}const Vn=new Map;async function iA(o,u,f,p){const y=Date.now(),R=Vn.get(o);if(R&&R.validUntil>y)return R.value;p?.onMiss?.();try{const H=await f();return Vn.set(o,{value:H,validUntil:y+u}),H}catch(H){throw p?.onFailure?.(H),H}}function sA(o,u,f,p){const y=Date.now(),R=Vn.get(o);if(R&&R.validUntil>y)return R.value;p?.onMiss?.();const H=f();return Vn.set(o,{value:H,validUntil:y+u}),H.catch(ue=>{Vn.delete(o),p?.onFailure?.(ue)}),H}function oA(o){Vn.delete(o)}function aA(){Vn.clear()}function cA(){const o=Date.now();for(const[u,f]of Vn.entries())f.validUntil<=o&&Vn.delete(u)}function uA(){return Vn.size}function X0(o,u=!1){o=o.filter(R=>R),u&&We(o[1])&&(o[1]="../"+o[1]);let f="";We(o[0])&&o[0].includes("://")&&(f=ru(o[0],"://")??"",o[0]=oa(o[0],"://")??"");const p=o.map(R=>String(R)).flatMap(R=>R.split("/")),y=[];for(let R=0;R<p.length;R++)p[R]!=="."&&(p[R]===".."?(!f||y.length>1)&&y.pop():y.push(p[R]));return(f?f+"://":"")+y.join("/").replaceAll(/\/{2,}/g,"/")}function lA(o,u,f,p,y=!0){const R=o.indexOf(u),H=o.indexOf(f,R+u.length);if(R===-1||H===-1)throw Error("Start or end not found");return y?o.substring(0,R+u.length)+p+o.substring(H):o.substring(0,R)+p+o.substring(H+f.length)}function fA(o){let u="p";o.startsWith("#")?(u="h1",o=o.slice(1).trim()):o.startsWith("-")&&(u="li",o=o.slice(1).trim());const f=o[0]===o[0].toUpperCase(),p=/[.?!]$/.test(o),y=/:$/.test(o);return{type:u,isCapitalized:f,hasPunctuation:p,endsWithColon:y}}function hA(o,u="(",f=")"){let p=0,y=0;for(;y<o.length;)if(o.startsWith(u,y)?(p++,y+=u.length):o.startsWith(f,y)?(p--,y+=f.length):y++,p<0)return!1;return u===f?p%2===0:p===0}function dA(o){o=o.normalize("NFD").replace(/[\u0300-\u036f]/g,"");let u=o.length;for(;o=o.replace(/(\w+)[\s,']+\w+/g,"$1"),o.length!==u;)u=o.length;return o=o.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A"),o=o.replaceAll(/[a-z][a-zA-Z0-9]*/g,"a"),o=o.replaceAll(/[\u4E00-\u9FA5]+/g,"Z"),o}function ep(o){const u=Object.keys(o).sort((p,y)=>p.localeCompare(y)),f={};for(const p of u)f[p]=ci(o[p]);return f}function tp(o){const u=[];return o.sort((f,p)=>JSON.stringify(ci(f)).localeCompare(JSON.stringify(ci(p)))).forEach(f=>u.push(ci(f))),u}function ci(o){return Array.isArray(o)?tp(o):at(o)?ep(o):o}function np(o,u){return JSON.stringify(ci(o))===JSON.stringify(ci(u))}function pA(...o){for(let u=1;u<o.length;u++)if(!np(o[u-1],o[u]))return!1;return!0}function gA(o){try{return JSON.parse(o)}catch{return null}}function mA(){let o=0;return{next:()=>o++}}function bA(o){let u=0;return{next:()=>o[u++%o.length]}}function yA(o){let u;return f=>{const p=f===o&&u!==o;return u=f,p}}function xA(o,u,f,p,y){const R={};for(const H of Object.keys(u))R[H]=[];R[p]=[],y&&(o=o.sort(y));for(const H of o){const ue=H[f],ie=u[ue]?ue:p;R[ie].length>=u[ie]?R[p].push(H):R[ie].push(H)}return R}function wA(o,u){const f=Object.keys(o),p=Object.keys(u);return{uniqueToA:f.filter(y=>!p.includes(y)),uniqueToB:p.filter(y=>!f.includes(y))}}function rp(o){const u=Object.keys(o);return u[Math.floor(Math.random()*u.length)]}function AA(o,u){const f=rp(o);return o[f]=u(o[f]),f}function EA(o){return o=o.replace(/\r\n/g,`
|
|
10
|
+
`),o=o.replace(/(\w+)\((.+)\)/g,(u,f,p)=>`${f}(${p.replaceAll(",",",")})`),o=o.replace(/(,)(\s+})/g,"$2"),o=o.replace(/\.\.\..+?,/g,""),o=o.replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),o=o.replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),o=o.replace(/:(.+)\?(.+):/g,(u,f,p)=>`: (${f.trim()} && ${p.trim()}) ||`),o=o.replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2'),o=o.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,(u,f,p,y)=>`"${f}":"${p.trim()}"${y}`),o=o.replace(/("'|'")/g,'"'),o=o.replaceAll(",",","),JSON.parse(o)}const Nr=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],vA=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],ip=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function BA(o,u,f){let p=o.length-u;if(p<=0)return"0."+"0".repeat(-p)+o+(f?" "+f:"");let y=o.substring(0,p),R=o.substring(p);return y===""&&(y="0"),y+"."+R+(f?" "+f:"")}function RA(o,u){const f=u?.longForm??!1,p=u?.unit?` ${u.unit}`:"",y=f?vA:ip,R=u?.precision??1;if(o<Nr[0])return`${o}${p}`;for(let H=0;H<Nr.length-1;H++)if(o<Nr[H+1])return`${(o/Nr[H]).toFixed(R)}${f?" ":""}${y[H]}${p}`;return`${(o/Nr[Nr.length-1]).toFixed(R)}${f?" ":""}${y[Nr.length-1]}${p}`}function hu(o){const u=parseFloat(o);if(isNaN(u))throw Error("makeNumber got NaN for input");const f=o.replace(/^-?[0-9.]+/,"").trim(),p=ip.findIndex(y=>y.toLowerCase()===f.toLowerCase());return p===-1?u:u*Nr[p]}function du(o,u,f){return o<u?u:o>f?f:o}function TA(o,u,f){const p=o+u;return p>f?f:p}function SA(o,u,f){const p=o-u;return p<f?f:p}function IA(o,u){return u(o),o}function OA(o,u){o&&u(o)}function PA(o,u){const f=Object.keys(u);for(const p of f)Array.isArray(u[p])&&Array.isArray(o[p])&&ia(o[p],u[p])}function kA(o){return o.splice(0,o.length),o}function NA(o){for(const u of Object.keys(o))(Ge(o[u])||Array.isArray(o[u])&&o[u].every(f=>f==null))&&delete o[u];return o}function CA(o){for(const u of Object.entries(o))(u[1]===null||u[1]===void 0||We(u[1])&&pn(u[1]))&&delete o[u[0]];return o}function _A(o,u){const f={};for(const[p,y]of Object.entries(o))u(p)&&(f[p]=y);return f}function DA(o,u){const f={};for(const[p,y]of Object.entries(o))u(y)&&(f[p]=y);return f}function FA(o,u){const f={};for(const p of Object.entries(o))f[p[0]]=u(p[1]);return f}function UA(o,u){const f=[];let p=0;for(const y of o)f.push(u(y,p++));return f}async function LA(o,u){try{return await o()}catch{throw u}}function MA(o,u,f){f!=null&&(o[u]=f)}function $A(o,u,f,p){const y=le(f,p);y!=null&&ce(o,u,y)}function zA(o){const u={};for(const[f,p]of Object.entries(o))u[p]=f;return u}function GA(o){const u=Object.keys(o),f=u.map(ue=>o[ue].length),p=f.reduce((ue,ie)=>ue*=ie);let y=1;const R=[1];for(let ue=0;ue<f.length-1;ue++)y*=f[ue],R.push(y);const H=[];for(let ue=0;ue<p;ue++){const ie={};for(let Re=0;Re<u.length;Re++){const St=o[u[Re]],Zt=Math.floor(ue/R[Re])%St.length;ie[u[Re]]=St[Zt]}H.push(ie)}return H}function VA(o){return Object.values(o).filter(u=>u).length}function jA(o,u,f){return o+(f?"["+u+"]":(o.length?".":"")+u)}function ua(o,u,f,p,y){if(!at(u))return u;for(const[R,H]of Object.entries(u)){const ue=jA(f,R,p);Array.isArray(H)?y?ua(o,H,ue,!0,y):o[ue]=H.map(ie=>ua(Array.isArray(ie)?[]:{},ie,"",!1,y)):at(H)?ua(o,H,ue,!1,y):o[ue]=H}return o}function HA(o,u=!1,f){return ua({},o,f||"",!1,u)}function sp(o){if(!at(o))return o;const u=Array.isArray(o)?[]:{};for(const[f,p]of Object.entries(o))Array.isArray(p)?ce(u,f,p.map(y=>sp(y))):ce(u,f,p);return u}function qA(o,u,f){return u[o]?u[o]:f}function op(o,u){const f={};for(const p of o){const y=u(p);f[y]=p}return f}function ZA(o,u){const f={};for(const p of o){const y=u(p);f[y]||(f[y]=[]),f[y].push(p)}return f}function KA(o,u){const f=[];for(let p=0;p<o.length;p+=u)f.push(o.slice(p,p+u));return f}function ap(o,u){const f=Math.ceil(o.length/u),p=[];for(let y=0;y<o.length;y+=f)p.push(o.slice(y,y+f));return p}function cp(o,u){const f=[],p=Math.ceil(o.length/u);for(let y=0;y<p;y++)f.push(o.slice(y*u,y*u+u));return f}function JA(o,u){const f=Math.ceil(o.length/u);return cp(o,f)}function WA(o,u){return Object.values(op(o,u))}function QA(o,u,f,p,y){const R=u?o.map(u):o,H={};for(const ie of R)H[ie]=(H[ie]||0)+1;const ue=p?up(H,y?(ie,Re)=>ie[1]-Re[1]:(ie,Re)=>Re[1]-ie[1]):H;return f?Object.keys(ue):ue}function up(o,u){return Object.fromEntries(Object.entries(o).sort(u))}function YA(o){const u=[],f=Object.keys(o),p=o[f[0]].length;for(let y=0;y<p;y++){const R={};for(const H of f)R[H]=o[H][y];u.push(R)}return u}function XA(o,u,f=1){for(const p of o)p[u]+=f}function e6(o,u,f){for(const p of o)p[u]=f}function pu(o,u){const f=[];let p=[];return o.forEach((y,R)=>{(R===0||!u(y,o[R-1]))&&(p=[],f.push(p)),p.push(y)}),f}function t6(){return{map:new Map,keys:[]}}function n6(){return{map:new Map,keys:[]}}function lp(o,u,f,p=100){if(o.map.has(u)){const y=o.keys.indexOf(u);o.keys.splice(y,1)}if(o.map.set(u,f),o.keys.push(u),o.keys.length>p){const y=o.keys.shift();y&&o.map.delete(y)}}function r6(o,u,f,p=100){if(o.map.has(u)){const y=o.keys.indexOf(u);o.keys.splice(y,1)}if(o.map.set(u,f),o.keys.unshift(u),o.keys.length>p){const y=o.keys.shift();y&&o.map.delete(y)}}function i6(o,u,f,p,y=100){lp(o,u,{validUntil:Date.now()+p,data:f},y)}function s6(o,u){const f=o.map.get(u);return f&&f.validUntil>Date.now()?f.data:null}class Cr{constructor(u){this.value=u}static of(u){return new Cr(u)}static empty(){return new Cr(null)}map(u){return new Cr(this.value!==null&&this.value!==void 0?u(this.value):null)}mapAsync(u){return this.value!==null&&this.value!==void 0?u(this.value).then(f=>Cr.of(f)):Promise.resolve(Cr.empty())}ifPresent(u){return this.value!==null&&this.value!==void 0&&u(this.value),this}ifPresentAsync(u){return this.value!==null&&this.value!==void 0?u(this.value).then(()=>this):Promise.resolve(this)}ifAbsent(u){return(this.value===null||this.value===void 0)&&u(),this}ifAbsentAsync(u){return this.value===null||this.value===void 0?u().then(()=>this):Promise.resolve(this)}getOrFallback(u){return this.value??u()}getOrFallbackAsync(u){return this.value!==null&&this.value!==void 0?Promise.resolve(this.value):u()}getOrThrow(){if(this.value===null||this.value===void 0)throw Error("Optional.value is empty");return this.value}}t.Optional=Cr;class o6{constructor(u){this.supplier=u,this.value=null}get(){return this.value||(this.value=this.supplier()),this.value}}t.Lazy=o6;class a6{constructor(u){this.supplier=u,this.value=null}async get(){return this.value||(this.value=await this.supplier()),this.value}}t.AsyncLazy=a6;function c6(o){return()=>o.forEach(u=>u())}function u6(o,u){return o.reduce((f,p)=>u(f)>u(p)?f:p)}function l6(o,u){return o.reduce((f,p)=>u(f)<u(p)?f:p)}function f6(o,u){const f=[];return o.forEach((p,y)=>{u(p)&&f.push(y)}),f}function h6(o,u){const f=o.find(p=>p instanceof u);return Cr.of(f)}function d6(o,u){return o.filter(f=>f instanceof u)}function p6(o,u){const f=[],p=Math.max(o.length,u.length);for(let y=0;y<p;y++)o[y]&&f.push(o[y]),u[y]&&f.push(u[y]);return f}function g6(o,u){return o.includes(u)?o.filter(f=>f!==u):[...o,u]}class m6{constructor(u){this.value=u,this.children=[]}}function b6(o,u,f,p,y=!1){const R=new Map,H=[];o.forEach(ie=>{const Re=new m6(ie);R.set(ie[u],Re)}),o.forEach(ie=>{const Re=R.get(ie[u]);if(!Re)return;const St=ie[f];if(St){const Zt=R.get(St);Zt&&Zt.children.push(Re)}else H.push(Re)});const ue=ie=>{ie.children.sort((Re,St)=>{const Zt=Re.value[p],Vi=St.value[p];return y?Vi-Zt:Zt-Vi}),ie.children.forEach(ue)};return H.forEach(ue),H}function fp(o,u){if(Math.log2(o.length)%1!==0)throw new Error("Array length must be a power of 2");let f=[...o];for(;f.length>1;){const p=[];for(let y=0;y<f.length;y+=2){const R=f[y+1];p.push(u(f[y],R))}f=p}return f[0]}function $i(...o){const u=o.reduce((y,R)=>y+R.length,0),f=new Uint8Array(u);let p=0;return o.forEach(y=>{f.set(y,p),p+=y.length}),f}function hp(o){return o[0]===137&&o[1]===80&&o[2]===78&&o[3]===71}function dp(o){return o[0]===255&&o[1]===216}function pp(o){return o[8]===87&&o[9]===69&&o[10]===66&&o[11]===80}function y6(o){return hp(o)||dp(o)||pp(o)}function x6(o){return new Uint8Array([o])}function w6(o){return o[0]}function A6(o,u){const f=new ArrayBuffer(2);return new DataView(f).setUint16(0,o,u==="LE"),new Uint8Array(f)}function E6(o,u){return new DataView(o.buffer).getUint16(o.byteOffset,u==="LE")}function v6(o,u){const f=new ArrayBuffer(4);return new DataView(f).setUint32(0,o,u==="LE"),new Uint8Array(f)}function B6(o,u){return new DataView(o.buffer).getUint32(o.byteOffset,u==="LE")}function gu(o,u){const f=new ArrayBuffer(8);return new DataView(f).setBigUint64(0,BigInt(o),u==="LE"),new Uint8Array(f)}function R6(o,u){return new DataView(o.buffer).getBigUint64(o.byteOffset,u==="LE")}function zi(o,u){const f=new Uint8Array(32);let p=o;if(u==="LE"){for(let y=0;y<32;y++)f[y]=Number(p&0xffn),p>>=8n;return f}for(let y=31;y>=0;y--)f[y]=Number(p&0xffn),p>>=8n;return f}function Gi(o,u){let f=0n;if(u==="LE"){for(let p=31;p>=0;p--)f=f<<8n|BigInt(o[p]);return f}for(let p=0;p<32;p++)f=f<<8n|BigInt(o[p]);return f}function T6(o,u){const f=[];let p=0;for(const y of u)f.push(o.subarray(p,p+y)),p+=y;return f}function mu(o,u){const f=[];for(let p=0;p<o.length;p+=u)f.push(o.subarray(p,p+u));return f}const gp=[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 S6(o){for(let u=0;u<24;u++){const f=o[0]^o[10]^o[20]^o[30]^o[40],p=o[1]^o[11]^o[21]^o[31]^o[41],y=o[2]^o[12]^o[22]^o[32]^o[42],R=o[3]^o[13]^o[23]^o[33]^o[43],H=o[4]^o[14]^o[24]^o[34]^o[44],ue=o[5]^o[15]^o[25]^o[35]^o[45],ie=o[6]^o[16]^o[26]^o[36]^o[46],Re=o[7]^o[17]^o[27]^o[37]^o[47],St=o[8]^o[18]^o[28]^o[38]^o[48],Zt=o[9]^o[19]^o[29]^o[39]^o[49],Vi=y<<1|R>>>31,dE=R<<1|y>>>31,Hs=St^Vi,qs=Zt^dE,pE=H<<1|ue>>>31,gE=ue<<1|H>>>31,Zs=f^pE,Ks=p^gE,mE=ie<<1|Re>>>31,bE=Re<<1|ie>>>31,Js=y^mE,Ws=R^bE,yE=St<<1|Zt>>>31,xE=Zt<<1|St>>>31,Qs=H^yE,Ys=ue^xE,wE=f<<1|p>>>31,AE=p<<1|f>>>31,Xs=ie^wE,eo=Re^AE;o[0]^=Hs,o[1]^=qs,o[2]^=Zs,o[3]^=Ks,o[4]^=Js,o[5]^=Ws,o[6]^=Qs,o[7]^=Ys,o[8]^=Xs,o[9]^=eo,o[10]^=Hs,o[11]^=qs,o[12]^=Zs,o[13]^=Ks,o[14]^=Js,o[15]^=Ws,o[16]^=Qs,o[17]^=Ys,o[18]^=Xs,o[19]^=eo,o[20]^=Hs,o[21]^=qs,o[22]^=Zs,o[23]^=Ks,o[24]^=Js,o[25]^=Ws,o[26]^=Qs,o[27]^=Ys,o[28]^=Xs,o[29]^=eo,o[30]^=Hs,o[31]^=qs,o[32]^=Zs,o[33]^=Ks,o[34]^=Js,o[35]^=Ws,o[36]^=Qs,o[37]^=Ys,o[38]^=Xs,o[39]^=eo,o[40]^=Hs,o[41]^=qs,o[42]^=Zs,o[43]^=Ks,o[44]^=Js,o[45]^=Ws,o[46]^=Qs,o[47]^=Ys,o[48]^=Xs,o[49]^=eo;const vu=o[0],Bu=o[1],Ru=o[2]<<1|o[3]>>>31,Tu=o[3]<<1|o[2]>>>31,Su=o[5]<<30|o[4]>>>2,Iu=o[4]<<30|o[5]>>>2,Ou=o[6]<<28|o[7]>>>4,Pu=o[7]<<28|o[6]>>>4,ku=o[8]<<27|o[9]>>>5,Nu=o[9]<<27|o[8]>>>5,Cu=o[11]<<4|o[10]>>>28,_u=o[10]<<4|o[11]>>>28,Du=o[13]<<12|o[12]>>>20,Fu=o[12]<<12|o[13]>>>20,Uu=o[14]<<6|o[15]>>>26,Lu=o[15]<<6|o[14]>>>26,Mu=o[17]<<23|o[16]>>>9,$u=o[16]<<23|o[17]>>>9,zu=o[18]<<20|o[19]>>>12,Gu=o[19]<<20|o[18]>>>12,Vu=o[20]<<3|o[21]>>>29,ju=o[21]<<3|o[20]>>>29,Hu=o[22]<<10|o[23]>>>22,qu=o[23]<<10|o[22]>>>22,Zu=o[25]<<11|o[24]>>>21,Ku=o[24]<<11|o[25]>>>21,Ju=o[26]<<25|o[27]>>>7,Wu=o[27]<<25|o[26]>>>7,Qu=o[29]<<7|o[28]>>>25,Yu=o[28]<<7|o[29]>>>25,Xu=o[31]<<9|o[30]>>>23,el=o[30]<<9|o[31]>>>23,tl=o[33]<<13|o[32]>>>19,nl=o[32]<<13|o[33]>>>19,rl=o[34]<<15|o[35]>>>17,il=o[35]<<15|o[34]>>>17,sl=o[36]<<21|o[37]>>>11,ol=o[37]<<21|o[36]>>>11,al=o[38]<<8|o[39]>>>24,cl=o[39]<<8|o[38]>>>24,ul=o[40]<<18|o[41]>>>14,ll=o[41]<<18|o[40]>>>14,fl=o[42]<<2|o[43]>>>30,hl=o[43]<<2|o[42]>>>30,dl=o[45]<<29|o[44]>>>3,pl=o[44]<<29|o[45]>>>3,gl=o[47]<<24|o[46]>>>8,ml=o[46]<<24|o[47]>>>8,bl=o[48]<<14|o[49]>>>18,yl=o[49]<<14|o[48]>>>18;o[0]=vu^~Du&Zu,o[1]=Bu^~Fu&Ku,o[2]=Du^~Zu&sl,o[3]=Fu^~Ku&ol,o[4]=Zu^~sl&bl,o[5]=Ku^~ol&yl,o[6]=sl^~bl&vu,o[7]=ol^~yl&Bu,o[8]=bl^~vu&Du,o[9]=yl^~Bu&Fu,o[10]=Ou^~zu&Vu,o[11]=Pu^~Gu&ju,o[12]=zu^~Vu&tl,o[13]=Gu^~ju&nl,o[14]=Vu^~tl&dl,o[15]=ju^~nl&pl,o[16]=tl^~dl&Ou,o[17]=nl^~pl&Pu,o[18]=dl^~Ou&zu,o[19]=pl^~Pu&Gu,o[20]=Ru^~Uu&Ju,o[21]=Tu^~Lu&Wu,o[22]=Uu^~Ju&al,o[23]=Lu^~Wu&cl,o[24]=Ju^~al&ul,o[25]=Wu^~cl&ll,o[26]=al^~ul&Ru,o[27]=cl^~ll&Tu,o[28]=ul^~Ru&Uu,o[29]=ll^~Tu&Lu,o[30]=ku^~Cu&Hu,o[31]=Nu^~_u&qu,o[32]=Cu^~Hu&rl,o[33]=_u^~qu&il,o[34]=Hu^~rl&gl,o[35]=qu^~il&ml,o[36]=rl^~gl&ku,o[37]=il^~ml&Nu,o[38]=gl^~ku&Cu,o[39]=ml^~Nu&_u,o[40]=Su^~Mu&Qu,o[41]=Iu^~$u&Yu,o[42]=Mu^~Qu&Xu,o[43]=$u^~Yu&el,o[44]=Qu^~Xu&fl,o[45]=Yu^~el&hl,o[46]=Xu^~fl&Su,o[47]=el^~hl&Iu,o[48]=fl^~Su&Mu,o[49]=hl^~Iu&$u,o[0]^=gp[u*2],o[1]^=gp[u*2+1]}}function mp(o){const u=[];for(let f=0;f<o.length;f+=4)u.push(o[f]|o[f+1]<<8|o[f+2]<<16|o[f+3]<<24);return u}function bp(o,u){if(!o.length){const y=new Uint8Array(136);return y[0]=u,y[135]=128,[mp(y)]}const f=mu(o,136),p=f[f.length-1];if(p.length<136){const y=new Uint8Array(136);y.set(p),y[p.length]=u,y[135]|=128,f[f.length-1]=y}if(p.length===136){const y=new Uint8Array(136);y[0]=u,y[135]=128,f.push(y)}return f.map(mp)}function yp(o,u){for(const f of u){for(let p=0;p<34;p+=2)o[p]^=f[p+1],o[p+1]^=f[p];S6(o)}return o}function xp(o){return new Uint8Array([o[1],o[1]>>-24,o[1]>>-16,o[1]>>-8,o[0],o[0]>>8,o[0]>>16,o[0]>>24,o[3],o[3]>>-24,o[3]>>-16,o[3]>>-8,o[2],o[2]>>8,o[2]>>16,o[2]>>24,o[5],o[5]>>-24,o[5]>>-16,o[5]>>-8,o[4],o[4]>>8,o[4]>>16,o[4]>>24,o[7],o[7]>>-24,o[7]>>-16,o[7]>>-8,o[6],o[6]>>8,o[6]>>16,o[6]>>24])}function _r(o){return xp(yp(new Array(50).fill(0),bp(o,1)))}function I6(o){return xp(yp(new Array(50).fill(0),bp(o,6)))}function O6(o,u){const f=Math.min(o.length,u.length);for(let p=0;p<f;p++){const y=o[p]^u[p];for(let R=0;R<8;R++)if(y>>7-R&1)return p*8+R}return Math.min(o.length,u.length)*8}function P6(o,u){const f=Math.min(o.length,u.length);for(let p=0;p<f;p++)if(o[p]!==u[p])return o.subarray(0,p);return o.subarray(0,f)}function k6(o,u,f,p){const y=Math.floor(u/8),R=u%8;f===1?o[y]|=1<<(p==="BE"?7-R:R):o[y]&=~(1<<(p==="BE"?7-R:R))}function N6(o,u,f){const p=Math.floor(u/8),y=u%8;return o[p]>>(f==="BE"?7-y:y)&1}function C6(o,u,f=0){for(let p=f;p<o.length;p++)for(let y=0;y<u.length&&o[p+y]===u[y];y++)if(y===u.length-1)return p;return-1}function wp(o,u,f=0){if(o.length>=u)return o;const p=new Uint8Array(u);return p.fill(f),p.set(o,u-o.length),p}function _6(o,u,f=0){const p=o.length%u;return p===0?o:wp(o,o.length+u-p,f)}function Ap(o,u,f=0){if(o.length>=u)return o;const p=new Uint8Array(u);return p.fill(f),p.set(o,0),p}function D6(o,u,f=0){const p=o.length%u;return p===0?o:Ap(o,o.length+u-p,f)}function F6(o,u){const f=new Uint8Array(o.length);for(let p=0;p<o.length;p++)f[p]=o[p]^u[p%u.length];return f}function U6(o){for(let u=0;u<o.length;u++){const f=o[u];if(!(f<128))if((f&224)===192){if(u+1>=o.length||(o[u+1]&192)!==128)return!1;u+=1}else if((f&240)===224){if(u+2>=o.length||(o[u+1]&192)!==128||(o[u+2]&192)!==128)return!1;u+=2}else if((f&248)===240){if(u+3>=o.length||(o[u+1]&192)!==128||(o[u+2]&192)!==128||(o[u+3]&192)!==128)return!1;u+=3}else return!1}return!0}function L6(o,u){if(o.length!==u.length)return!1;for(let f=0;f<o.length;f++)if(o[f]!==u[f])return!1;return!0}function it(o,u){return(o%u+u)%u}function Vs(o,u){o=it(o,u);let[f,p]=[0n,1n],[y,R]=[u,o];for(;R!==0n;){const H=y/R;[f,p]=[p,f-H*p],[y,R]=[R,y-H*R]}if(y>1n)throw new Error("a is not invertible");return f<0n&&(f+=u),f}function M6(o,u,f){let p=1n;for(o=it(o,f);u>0;)u%2n===1n&&(p=it(p*o,f)),o=it(o*o,f),u=u/2n;return p}function Ep(o,u){return it(o,u)===0n?0n:u%4n===3n?M6(o,(u+1n)/4n,u):null}const zt=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,Ot=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,la=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,fa=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;function bu(o,u,f){if(u===0n)return[0n,0n];const p=it(3n*o*o*Vs(2n*u,f),f),y=it(p*p-2n*o,f),R=it(p*(o-y)-u,f);return[y,R]}function ha(o,u,f,p,y){if(o===0n&&u===0n)return[f,p];if(f===0n&&p===0n)return[o,u];if(o===f&&u===it(-p,y))return[0n,0n];if(o===f&&u===p)return bu(o,u,y);const R=it((p-u)*Vs(f-o,y),y),H=it(R*R-o-f,y),ue=it(R*(o-H)-u,y);return[H,ue]}function $6(o){if(o<=0n||o>=Ot)throw new Error("Invalid private key");return ui(la,fa,o,zt)}function z6(o){const u=o[1]%2n===0n?2:3;return new Uint8Array([u,...zi(o[0],"BE")])}function G6(o){if(o.length!==33||o[0]!==2&&o[0]!==3)throw new Error("Invalid compressed public key");const u=Gi(o.slice(1),"BE"),f=Ep(it(u**3n+7n,zt),zt);if(!f)throw Error("Invalid x: does not correspond to a valid curve point");const p=it(-f,zt),y=f%2n===0n;return[u,o[0]===2?y?f:p:y?p:f]}function V6(o){const u=new Uint8Array(20),f=_r($i(zi(o[0],"BE"),zi(o[1],"BE")));return u.set(f.subarray(12)),u}function j6(o){const u=t.Binary.uint8ArrayToHex(o),f=t.Binary.uint8ArrayToHex(t.Binary.keccak256(new Uint8Array([...u].map(y=>y.charCodeAt(0)))));let p="0x";for(let y=0;y<u.length;y++)parseInt(f[y],16)>7?p+=u[y].toUpperCase():p+=u[y];return p}function ui(o,u,f,p){let y=[0n,0n],R=[o,u];const H=f.toString(2);for(const ue of H)ue==="0"?(R=ha(y[0],y[1],R[0],R[1],p),y=bu(y[0],y[1],p)):(y=ha(y[0],y[1],R[0],R[1],p),R=bu(R[0],R[1],p));return y}function H6(o,u,f){return vp(Gi(_r(o),"BE"),u,f)}function vp(o,u,f){if(u<=0n||u>=Ot)throw new Error("Invalid private key");if(f||(f=it(Gi(_r($i(_r(zi(u,"BE")),zi(o,"BE"))),"BE"),Ot)),f<=0n||f>=Ot)throw new Error("Invalid nonce");const p=it(o,Ot),y=ui(la,fa,f,zt),R=it(y[0],Ot);let H=it((p+it(R,Ot)*u)*Vs(f,Ot),Ot);if(R===0n||H===0n)throw new Error("Invalid r or s value");let ue=y[1]%2n===0n?27n:28n;return H>Ot/2n&&(H=Ot-H,ue=ue===27n?28n:27n),[R,H,ue]}function q6(o,u,f,p){const y=Ep(it(u**3n+7n,zt),zt);if(!y)throw new Error("Invalid r: does not correspond to a valid curve point");const R=p===27n?0n:1n,H=y%2n===R?y:zt-y,ue=it(Gi(_r(o),"BE"),Ot),ie=ui(u,H,f,zt),Re=ui(la,fa,ue,zt),St=ha(ie[0],ie[1],Re[0],it(-Re[1],zt),zt);return ui(St[0],St[1],Vs(u,Ot),zt)}function Z6(o,u,f,p){const y=it(Gi(_r(o),"BE"),Ot),R=Vs(p,Ot),H=it(y*R,Ot),ue=it(f*R,Ot),ie=ui(la,fa,H,zt),Re=ui(u[0],u[1],ue,zt),St=ha(ie[0],ie[1],Re[0],Re[1],zt);return f===it(St[0],Ot)}class Bp{constructor(u){this.cursor=0,this.buffer=u}read(u){const f=this.buffer.subarray(this.cursor,this.cursor+u);return this.cursor+=u,f}max(){return this.buffer.length-this.cursor}}t.Uint8ArrayReader=Bp;class Rp{constructor(u){this.buffer=u,this.cursor=0}write(u){const f=Math.min(this.max(),u.max());return this.buffer.set(u.read(f),this.cursor),this.cursor+=f,f}max(){return this.buffer.length-this.cursor}}t.Uint8ArrayWriter=Rp;class Dr{constructor(u,f=0n){this.span=f,this.writer=new Rp(new Uint8Array(u))}build(){return $i(gu(this.span,"LE"),this.writer.buffer)}hash(){const u=fp(mu(this.writer.buffer,32),(f,p)=>Dr.hashFunction($i(f,p)));return Dr.hashFunction($i(gu(this.span,"LE"),u))}}t.Chunk=Dr,Dr.hashFunction=_r;class yu{constructor(u,f=4096){this.counters=[1],this.capacity=f,this.chunks=[new Dr(f)],this.onChunk=u}static async root(u,f=4096){const p=new e(e.NOOP,f);return await p.append(u),p.finalize()}async append(u,f=0,p=0n){const y=new Bp(u);for(;y.max()>0;){this.chunks[f].writer.max()===0&&await this.elevate(f);const R=this.chunks[f].writer.write(y);p?this.chunks[f].span+=p:this.chunks[0].span+=BigInt(R)}}async elevate(u){this.counters[u]=++this.counters[u]%(this.capacity/32),this.chunks[u+1]||(this.chunks.push(new Dr(this.capacity)),this.counters.push(1)),await this.append(this.chunks[u].hash(),u+1,this.chunks[u].span),await this.onChunk(this.chunks[u]),this.chunks[u]=new Dr(this.capacity)}async finalize(u=0){return this.chunks[u+1]?this.counters[u]===1?(await this.elevate(u+1),this.chunks[u+1]=this.chunks[u],this.finalize(u+1)):(await this.elevate(u),this.finalize(u+1)):(await this.onChunk(this.chunks[u]),this.chunks[u])}}t.MerkleTree=yu,e=yu,yu.NOOP=async o=>{};class cn{constructor(u,f){if(f<0)throw Error("Scale must be non-negative");this.value=BigInt(u),this.scale=f}static cast(u){if(!u)throw Error("Cannot cast falsy value to FixedPointNumber");if(u instanceof cn)return u;const f=R0(u.value),p=Qe(u.scale);return new cn(f,p)}static fromDecimalString(u,f){/e\-\d+$/i.test(u)&&(u=parseFloat(u).toFixed(f));let[p,y]=u.split(".");return y=(y||"").padEnd(f,"0").slice(0,f),new cn(BigInt(p+y),f)}static fromFloat(u,f){return cn.fromDecimalString(u.toString(),f)}add(u){return this.assertSameScale(u),new cn(this.value+u.value,this.scale)}subtract(u){return this.assertSameScale(u),new cn(this.value-u.value,this.scale)}multiply(u){return new cn(this.value*u,this.scale)}divmod(u){if(u===0n)throw new Error("Division by zero is not allowed");const f=this.value/u,p=this.value%u;return[new cn(f,this.scale),new cn(p,this.scale)]}exchange(u,f,p){if(u==="*"){const R=this.value*f.value/10n**BigInt(this.scale);return new cn(R,p)}this.assertSameScale(f);const y=this.value*10n**BigInt(p)/f.value;return new cn(y,p)}compare(u){return this.assertSameScale(u),this.value>u.value?1:this.value<u.value?-1:0}toDecimalString(){if(this.scale===0)return this.value.toString();const u=this.value.toString(),f=u.slice(0,-this.scale)||"0",p=u.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(u){if(this.scale!==u.scale)throw new Error(`Scale mismatch: expected ${this.scale}, but got ${u.scale}`)}}t.FixedPointNumber=cn;function K6(o){if(o.length===0)return null;const u=o[0];return u.ttlMax?--u.ttl<=0&&o.shift():u.ttlMax=u.ttl,{progress:(u.ttlMax-u.ttl)/u.ttlMax,data:u.data}}function da(o,u,f,p){const y=o.findIndex(ue=>ue===`--${u}`||ue.startsWith(`--${u}=`)),R=o[y];if(!R)return(f||{})[p||u||""]||null;if(R.includes("="))return R.split("=")[1];const H=o[y+1];return H&&!H.startsWith("-")?H:(f||{})[p||u||""]||null}function J6(o,u,f,p){const y=da(o,u,f,p);if(!y)return null;try{return hu(y)}catch{throw new Error(`Invalid number argument ${u}: ${y}`)}}function W6(o,u,f,p){const y=o.some(ie=>ie.endsWith("-"+u)),R=da(o,u,f,p);if(!R&&y)return!0;if(!R&&!y)return null;const H=["true","1","yes","y","on"],ue=["false","0","no","n","off"];if(H.includes(R.toLowerCase()))return!0;if(ue.includes(R.toLowerCase()))return!1;throw Error(`Invalid boolean argument ${u}: ${R}`)}function Tp(o,u,f,p){const y=da(o,u,f,p);if(!y)throw new Error(`Missing argument ${u}`);return y}function Q6(o,u,f,p){const y=Tp(o,u,f,p);try{return hu(y)}catch{throw new Error(`Invalid argument ${u}: ${y}`)}}function Sp(o,u){const f=o[u];o.splice(u,1),o.unshift(f)}function Y6(o,u){const f=[...o];return Sp(f,u),f}function Ip(o,u){return{x:o.x+u.x,y:o.y+u.y}}function X6(o,u){return{x:o.x-u.x,y:o.y-u.y}}function xu(o,u){return{x:o.x*u,y:o.y*u}}function eE(o){const u=Math.sqrt(o.x*o.x+o.y*o.y);return{x:o.x/u,y:o.y/u}}function Op(o,u,f){return{x:o.x+Math.cos(u)*f,y:o.y+Math.sin(u)*f}}function Pp(o,u){return Math.sqrt((o.x-u.x)**2+(o.y-u.y)**2)}function js(o,u,f="row-first"){const p=[];if(f==="column-first")for(let y=0;y<o.length;y++)for(let R=0;R<o[0].length;R++)u(y,R)&&p.push({x:y,y:R});else for(let y=0;y<o[0].length;y++)for(let R=0;R<o.length;R++)u(R,y)&&p.push({x:R,y});return p}function tE(o,u,f){return o[u+1]?.[f]&&o[u-1]?.[f]&&!o[u][f-1]&&!o[u][f+1]}function nE(o,u,f){return o[u][f+1]&&o[u][f-1]&&!o[u-1]?.[f]&&!o[u+1]?.[f]}function kp(o,u,f){return!o[u-1]?.[f]}function Np(o,u,f){return!o[u+1]?.[f]}function Cp(o,u,f){return!o[u][f-1]}function _p(o,u,f){return!o[u][f+1]}function rE(o,u,f){const p=[];return o[u][f]?tE(o,u,f)||nE(o,u,f)?[]:(!o[u-1]?.[f-1]&&kp(o,u,f)&&Cp(o,u,f)&&p.push({x:u,y:f}),!o[u+1]?.[f-1]&&Np(o,u,f)&&Cp(o,u,f)&&p.push({x:u+1,y:f}),!o[u-1]?.[f+1]&&kp(o,u,f)&&_p(o,u,f)&&p.push({x:u,y:f+1}),!o[u+1]?.[f+1]&&Np(o,u,f)&&_p(o,u,f)&&p.push({x:u+1,y:f+1}),p):(o[u-1]?.[f]&&o[u][f-1]&&p.push({x:u,y:f}),o[u+1]?.[f]&&o[u][f-1]&&p.push({x:u+1,y:f}),o[u-1]?.[f]&&o[u][f+1]&&p.push({x:u,y:f+1}),o[u+1]?.[f]&&o[u][f+1]&&p.push({x:u+1,y:f+1}),p)}function iE(o,u,f,p){const y=[{x:0,y:0},{x:f,y:0},{x:0,y:p},{x:f,y:p}];for(let R=0;R<o.length;R++)for(let H=0;H<o[0].length;H++){const ue=rE(o,R,H);for(const ie of ue)y.some(Re=>Re.x===ie.x&&Re.y===ie.y)||y.push(ie)}return y.map(R=>({x:R.x*u,y:R.y*u}))}function sE(o,u){const f=js(o,(ie,Re)=>o[ie][Re]===0&&o[ie][Re+1]!==0,"row-first").map(ie=>({...ie,dx:1,dy:0})),p=js(o,(ie,Re)=>o[ie][Re]===0&&o[ie][Re-1]!==0,"row-first").map(ie=>({...ie,dx:1,dy:0})),y=js(o,(ie,Re)=>o[ie][Re]===0&&o[ie-1]?.[Re]!==0,"column-first").map(ie=>({...ie,dx:0,dy:1})),R=js(o,(ie,Re)=>o[ie][Re]===0&&o[ie+1]?.[Re]!==0,"column-first").map(ie=>({...ie,dx:0,dy:1}));f.forEach(ie=>ie.y++),R.forEach(ie=>ie.x++);const H=pu([...y,...R],(ie,Re)=>ie.x===Re.x&&ie.y-1===Re.y),ue=pu([...p,...f],(ie,Re)=>ie.y===Re.y&&ie.x-1===Re.x);return[...H,...ue].map(ie=>({start:ie[0],end:Z(ie)})).map(ie=>({start:xu(ie.start,u),end:xu(Ip(ie.end,{x:ie.start.dx,y:ie.start.dy}),u)}))}function oE(o,u){return Math.atan2(u.y-o.y,u.x-o.x)}function aE(o,u){return u.map(f=>oE(o,f)).sort((f,p)=>f-p)}function Dp(o,u,f,p){const y=(p.y-f.y)*(u.x-o.x)-(p.x-f.x)*(u.y-o.y);if(y===0)return null;let R=o.y-f.y,H=o.x-f.x;const ue=(p.x-f.x)*R-(p.y-f.y)*H,ie=(u.x-o.x)*R-(u.y-o.y)*H;return R=ue/y,H=ie/y,R>0&&R<1&&H>0&&H<1?{x:o.x+R*(u.x-o.x),y:o.y+R*(u.y-o.y)}:null}function wu(o,u,f){const p=[],y=Op(o,f,1e4);for(const R of u){const H=Dp(o,y,R.start,R.end);H&&p.push(H)}return p.length?p.reduce((R,H)=>{const ue=Pp(o,H),ie=Pp(o,R);return ue<ie?H:R}):null}function cE(o,u,f){const p=aE(o,f),y=[];for(const R of p){const H=wu(o,u,R-.001),ue=wu(o,u,R+.001);H&&y.push(H),ue&&y.push(ue)}return y}class Au{constructor(){this.subscribers=[]}subscribe(u){return this.subscribers.push(u),()=>{this.subscribers=this.subscribers.filter(f=>f!==u)}}publish(u){this.subscribers.forEach(f=>f(u))}clear(){this.subscribers=[]}getSubscriberCount(){return this.subscribers.length}}t.PubSubChannel=Au;class uE{constructor(u,f){this.queue=[],this.running=0,this.onProcessed=new Au,this.onDrained=new Au,this.concurrency=u,this.capacity=f}process(){if(this.running>=this.concurrency)return;const u=this.queue.shift();u&&(this.running++,u().finally(()=>{this.running--,this.process(),this.onProcessed.publish(),this.running===0&&this.onDrained.publish()}))}enqueue(u){if(this.queue.length<this.capacity)return this.queue.push(u),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(u),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(u=>{this.onDrained.subscribe(()=>{this.onDrained.clear(),u()})})}}t.AsyncQueue=uE;class Eu{constructor(){this.forks=new Map}insert(u,f){if(u.length===0){this.handler=f;return}const p=u[0];let y=p,R;if(p.startsWith(":")&&(y=":",R=p.slice(1)),!this.forks.has(y)){const H=new Eu;R&&(H.variableName=R),this.forks.set(y,H)}this.forks.get(y).insert(u.slice(1),f)}async handle(u,f,p,y){if(u.length===0)return this.handler?(await this.handler(f,p,y),!0):!1;const R=u[0],H=this.forks.get(R);if(H)return H.handle(u.slice(1),f,p,y);const ue=this.forks.get(":");if(ue)return ue.variableName&&y.set(ue.variableName,decodeURIComponent(R)),ue.handle(u.slice(1),f,p,y);const ie=this.forks.get("*");return ie?(y.set("wildcard",u.join("/")),ie.handler?(await ie.handler(f,p,y),!0):!1):!1}}t.TrieRouter=Eu;class lE{constructor(u){this.index=0,this.values=u}current(){return this.values[this.index]}next(){return this.index=(this.index+1)%this.values.length,this.values[this.index]}}t.RollingValueProvider=lE;class fE{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(u=>[u.name,"pending"]))}setHooks(u){u.onStatusChange&&(this.onStatusChange=u.onStatusChange),u.onStepChange&&(this.onStepChange=u.onStepChange),u.onFinish&&(this.onFinish=u.onFinish),u.onError&&(this.onError=u.onError)}addStep(u){if(this.steps.find(f=>f.name===u.name))throw Error(`Step with name ${u.name} already exists`);this.steps.push(u)}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 u=this.createInitialState();for(const f of this.steps)try{if(f.transientSkipStepName){const p=u[f.transientSkipStepName];if(p==="skipped"||p==="failed"){u={...u,[f.name]:"skipped"},await this.onStepChange(u);continue}}if(!(!f.precondition||await f.precondition(this.context))){u={...u,[f.name]:"skipped"},await this.onStepChange(u);continue}u={...u,[f.name]:"in-progress"},await this.onStepChange(u);for(let p=0;await f.action(this.context,p)==="retry";p++);u={...u,[f.name]:"completed"},await this.onStepChange(u)}catch(p){throw u={...u,[f.name]:"failed"},this.status="failed",await this.onStatusChange(this.status),await this.onStepChange(u),await this.onError(p),p}return this.status="completed",await this.onStatusChange(this.status),await this.onFinish(),this.context}}t.Solver=fE;class hE{constructor(u){this.queryFunction=u.queryFunction,this.lockFunction=u.lockFunction,this.unlockFunction=u.unlockFunction,this.timeoutMillis=u.timeoutMillis}async couldLock(){const u=await this.queryFunction();try{const f=Ke(u);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=hE,t.Binary={hexToUint8Array:n4,uint8ArrayToHex:r4,binaryToUint8Array:s4,uint8ArrayToBinary:i4,base64ToUint8Array:Y8,uint8ArrayToBase64:X8,base32ToUint8Array:e4,uint8ArrayToBase32:t4,log2Reduce:fp,partition:mu,concatBytes:$i,numberToUint8:x6,uint8ToNumber:w6,numberToUint16:A6,uint16ToNumber:E6,numberToUint32:v6,uint32ToNumber:B6,numberToUint64:gu,uint64ToNumber:R6,numberToUint256:zi,uint256ToNumber:Gi,sliceBytes:T6,keccak256:_r,sha3_256:I6,proximity:O6,commonPrefix:P6,setBit:k6,getBit:N6,indexOf:C6,equals:L6,padStart:wp,padStartToMultiple:_6,padEnd:Ap,padEndToMultiple:D6,xorCypher:F6,isUtf8:U6},t.Elliptic={privateKeyToPublicKey:$6,compressPublicKey:z6,publicKeyFromCompressed:G6,publicKeyToAddress:V6,signMessage:H6,signHash:vp,verifySignature:Z6,recoverPublicKey:q6,checksumEncode:j6},t.Random={intBetween:I,floatBetween:T,chance:$,signed:O,makeSeededRng:A,point:_,procs:D},t.Arrays={countUnique:QA,makeUnique:WA,splitBySize:KA,splitByCount:ap,index:op,indexCollection:ZA,onlyOrThrow:c,onlyOrNull:l,firstOrThrow:d,firstOrNull:h,shuffle:a,initialize:g,initialize2D:w,rotate2D:m,containsShape:v,glue:a8,pluck:S,pick:j,pickMany:X,pickManyUnique:de,pickWeighted:q,pickRandomIndices:E,pickGuaranteed:U,last:Z,pipe:J,makePipe:L,sortWeighted:re,pushAll:ia,unshiftAll:s8,filterAndRemove:k4,merge:PA,empty:kA,pushToBucket:n8,unshiftAndLimit:r8,atRolling:i8,group:pu,createOscillator:bA,organiseWithLimits:xA,tickPlaybook:K6,getArgument:da,getBooleanArgument:W6,getNumberArgument:J6,requireStringArgument:Tp,requireNumberArgument:Q6,bringToFront:Y6,bringToFrontInPlace:Sp,findInstance:h6,filterInstances:d6,interleave:p6,toggle:g6,createHierarchy:b6,multicall:c6,maxBy:u6,minBy:l6,allIndexOf:f6},t.System={sleepMillis:s,forever:Y,scheduleMany:p8,waitFor:P4,expandError:Y3,runAndSetInterval:M,whereAmI:z,withRetries:W},t.Numbers={make:hu,sum:m8,average:b8,median:y8,getDistanceFromMidpoint:x8,clamp:du,range:I0,interpolate:g8,createSequence:mA,increment:TA,decrement:SA,format:RA,fromDecimals:BA,makeStorage:nA,asMegabytes:te,convertBytes:se,hexToRgb:P,rgbToHex:N,haversineDistanceToMeters:ee,roundToNearest:ge,formatDistance:Pe,triangularNumber:Ee,searchFloat:Ce,binomialSample:Rt,toSignificantDigits:oe},t.Promises={raceFulfilled:r,invert:n,runInParallelBatches:i},t.Dates={getTimestamp:$4,getTimeDelta:Q0,secondsToHumanTime:z4,countCycles:G4,isoDate:_4,throttle:V4,timeSince:H4,dateTimeSlug:D4,unixTimestamp:C4,fromUtcString:F4,fromMillis:U4,getProgress:q4,humanizeTime:ca,humanizeProgress:O4,createTimeDigits:Gn,mapDayNumber:Y0,getDayInfoFromDate:fu,getDayInfoFromDateTimeString:K4,seconds:J4,minutes:W4,hours:Q4,days:Y4,make:eA,normalizeTime:L4,absoluteDays:ai},t.Objects={safeParse:gA,deleteDeep:xe,getDeep:le,setDeep:ce,incrementDeep:he,ensureDeep:be,replaceDeep:V,getFirstDeep:K,deepMergeInPlace:oi,deepMerge2:X3,deepMerge3:e8,mapAllAsync:o8,cloneWithJson:N4,sortObject:ep,sortArray:tp,sortAny:ci,deepEquals:np,deepEqualsEvery:pA,runOn:IA,ifPresent:OA,zip:S0,zipSum:t8,removeEmptyArrays:NA,removeEmptyValues:CA,flatten:HA,unflatten:sp,match:qA,sort:up,map:FA,mapIterable:UA,filterKeys:_A,filterValues:DA,rethrow:LA,setSomeOnObject:MA,setSomeDeep:$A,flip:zA,getAllPermutations:GA,countTruthyValues:VA,transformToArray:YA,setMulti:e6,incrementMulti:XA,createBidirectionalMap:t6,createTemporalBidirectionalMap:n6,pushToBidirectionalMap:lp,unshiftToBidirectionalMap:r6,addToTemporalBidirectionalMap:i6,getFromTemporalBidirectionalMap:s6,createStatefulToggle:yA,diffKeys:wA,pickRandomKey:rp,mapRandomKey:AA,fromObjectString:EA,toQueryString:J0,parseQueryString:w4,hasKey:A4,selectMax:E4,reposition:v4,unwrapSingleKey:B4,parseKeyValues:R4,errorMatches:T4},t.Types={isFunction:qt,isObject:at,isStrictlyObject:ct,isEmptyArray:Ge,isEmptyObject:Ze,isUndefined:Tt,isString:We,isNumber:xt,isBoolean:Mt,isDate:Dt,isBlank:pn,isId:$n,isIntegerString:Pr,isHexString:tr,isUrl:v0,isBigint:B0,isNullable:Z3,asString:C,asHexString:G,asSafeString:Q,asIntegerString:x,asNumber:Qe,asFunction:De,asInteger:Ke,asBoolean:lt,asDate:Je,asNullableString:L3,asEmptiableString:M3,asId:$3,asTime:z3,asArray:G3,asObject:ra,asNullableObject:V3,asStringMap:j3,asNumericDictionary:H3,asUrl:q3,asBigint:R0,asEmptiable:J3,asNullable:K3,asOptional:W3,enforceObjectShape:T0,enforceArrayShape:Q3,isPng:hp,isJpg:dp,isWebp:pp,isImage:y6},t.Strings={tokenizeByCount:JA,tokenizeByLength:cp,searchHex:tu,searchSubstring:B,randomHex:b,randomLetter:$t,randomAlphanumeric:or,randomRichAscii:si,randomUnicode:zn,includesAny:w8,slugify:nu,normalForm:E8,enumify:I8,escapeHtml:P8,decodeHtmlEntities:N8,after:oa,afterLast:O0,before:ru,beforeLast:iu,betweenWide:C8,betweenNarrow:_8,getPreLine:rA,containsWord:uu,containsWords:g4,joinUrl:X0,getFuzzyMatchScore:sa,sortByFuzzyScore:O8,splitOnce:su,splitAll:P0,randomize:L8,expand:k0,shrinkTrim:$s,capitalize:aa,decapitalize:N0,csvEscape:j8,parseCsv:I4,surroundInOut:S8,getExtension:ou,getBasename:au,normalizeEmail:D8,normalizeFilename:F8,parseFilename:U8,camelToTitle:v8,slugToTitle:B8,slugToCamel:R8,joinHumanly:T8,findWeightedPair:M0,extractBlock:$0,extractAllBlocks:Z8,replaceBlocks:K8,indexOfEarliest:Mi,lastIndexOfBefore:L0,parseHtmlAttributes:m4,readNextWord:Gs,readWordsAfterAll:b4,resolveVariables:y4,resolveVariableWithDefaultSyntax:Z0,resolveRemainingVariablesWithDefaults:K0,isLetter:C0,isDigit:_0,isLetterOrDigit:zs,isValidObjectPathCharacter:z8,insert:G8,indexOfRegex:D0,allIndexOf:U0,lineMatches:F0,linesMatchInOrder:V8,represent:Ms,resolveMarkdownLinks:x4,buildUrl:S4,isChinese:A8,replaceBetweenStrings:lA,describeMarkdown:fA,isBalanced:hA,textToFormat:dA,splitFormatting:J8,splitHashtags:W8,splitUrls:Q8,route:o4,explodeReplace:cu,generateVariants:a4,replaceWord:c4,replacePascalCaseWords:u4,stripHtml:l4,breakLine:H0,measureTextWidth:f4,toLines:h4,levenshteinDistance:d4,findCommonPrefix:q0,findCommonDirectory:p4},t.Assertions={asEqual:c8,asTrue:u8,asTruthy:l8,asFalse:f8,asFalsy:h8,asEither:d8},t.Cache={get:iA,getDeferred:sA,delete:oA,deleteExpired:cA,size:uA,clear:aA},t.Vector={addPoint:Ip,subtractPoint:X6,multiplyPoint:xu,normalizePoint:eE,pushPoint:Op,filterCoordinates:js,findCorners:iE,findLines:sE,raycast:wu,raycastCircle:cE,getLineIntersectionPoint:Dp}})(xl)),xl}var ke=EE();const ji=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Bc(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ph(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function ki(t,...e){if(!Bc(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function $y(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Ph(t.outputLen),Ph(t.blockLen)}function Qa(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 vE(t,e){ki(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ya(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function wl(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function jn(t,e){return t<<32-e|t>>>e}const zy=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",BE=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function is(t){if(ki(t),zy)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=BE[t[n]];return e}const ar={_0:48,_9:57,A:65,F:70,a:97,f:102};function Up(t){if(t>=ar._0&&t<=ar._9)return t-ar._0;if(t>=ar.A&&t<=ar.F)return t-(ar.A-10);if(t>=ar.a&&t<=ar.f)return t-(ar.a-10)}function Xa(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(zy)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const a=Up(t.charCodeAt(s)),c=Up(t.charCodeAt(s+1));if(a===void 0||c===void 0){const l=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[i]=a*16+c}return r}function RE(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function pd(t){return typeof t=="string"&&(t=RE(t)),ki(t),t}function Vr(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];ki(i),e+=i.length}const n=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const s=t[r];n.set(s,i),i+=s.length}return n}let Gy=class{};function TE(t){const e=r=>t().update(pd(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Vy(t=32){if(ji&&typeof ji.getRandomValues=="function")return ji.getRandomValues(new Uint8Array(t));if(ji&&typeof ji.randomBytes=="function")return Uint8Array.from(ji.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function SE(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),a=Number(n>>i&s),c=Number(n&s),l=r?4:0,h=r?0:4;t.setUint32(e+l,a,r),t.setUint32(e+h,c,r)}function IE(t,e,n){return t&e^~t&n}function OE(t,e,n){return t&e^t&n^e&n}class PE extends Gy{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=wl(this.buffer)}update(e){Qa(this),e=pd(e),ki(e);const{view:n,buffer:r,blockLen:i}=this,s=e.length;for(let a=0;a<s;){const c=Math.min(i-this.pos,s-a);if(c===i){const l=wl(e);for(;i<=s-a;a+=i)this.process(l,a);continue}r.set(e.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Qa(this),vE(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:a}=this;n[a++]=128,Ya(this.buffer.subarray(a)),this.padOffset>i-a&&(this.process(r,0),a=0);for(let g=a;g<i;g++)n[g]=0;SE(r,i-8,BigInt(this.length*8),s),this.process(r,0);const c=wl(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 g=0;g<h;g++)c.setUint32(4*g,d[g],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:a,pos:c}=this;return e.destroyed=a,e.finished=s,e.length=i,e.pos=c,i%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Fr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),kE=Uint32Array.from([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]),Ur=new Uint32Array(64);let NE=class extends PE{constructor(e=32){super(64,e,8,!1),this.A=Fr[0]|0,this.B=Fr[1]|0,this.C=Fr[2]|0,this.D=Fr[3]|0,this.E=Fr[4]|0,this.F=Fr[5]|0,this.G=Fr[6]|0,this.H=Fr[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:a,G:c,H:l}=this;return[e,n,r,i,s,a,c,l]}set(e,n,r,i,s,a,c,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=c|0,this.H=l|0}process(e,n){for(let g=0;g<16;g++,n+=4)Ur[g]=e.getUint32(n,!1);for(let g=16;g<64;g++){const m=Ur[g-15],w=Ur[g-2],v=jn(m,7)^jn(m,18)^m>>>3,E=jn(w,17)^jn(w,19)^w>>>10;Ur[g]=E+Ur[g-7]+v+Ur[g-16]|0}let{A:r,B:i,C:s,D:a,E:c,F:l,G:h,H:d}=this;for(let g=0;g<64;g++){const m=jn(c,6)^jn(c,11)^jn(c,25),w=d+m+IE(c,l,h)+kE[g]+Ur[g]|0,E=(jn(r,2)^jn(r,13)^jn(r,22))+OE(r,i,s)|0;d=h,h=l,l=c,c=a+w|0,a=s,s=i,i=r,r=w+E|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(r,i,s,a,c,l,h,d)}roundClean(){Ya(Ur)}destroy(){this.set(0,0,0,0,0,0,0,0),Ya(this.buffer)}};const CE=TE(()=>new NE);let jy=class extends Gy{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,$y(e);const r=pd(n);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,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let a=0;a<s.length;a++)s[a]^=54;this.iHash.update(s),this.oHash=e.create();for(let a=0;a<s.length;a++)s[a]^=106;this.oHash.update(s),Ya(s)}update(e){return Qa(this),this.iHash.update(e),this}digestInto(e){Qa(this),ki(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:n,iHash:r,finished:i,destroyed:s,blockLen:a,outputLen:c}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=a,e.outputLen=c,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Hy=(t,e,n)=>new jy(t,e).update(n).digest();Hy.create=(t,e)=>new jy(t,e);const gd=BigInt(0),kh=BigInt(1);function ec(t,e=""){if(typeof t!="boolean"){const n=e&&`"${e}"`;throw new Error(n+"expected boolean, got type="+typeof t)}return t}function bi(t,e,n=""){const r=Bc(t),i=t?.length,s=e!==void 0;if(!r||s&&i!==e){const a=n&&`"${n}" `,c=s?` of length ${e}`:"",l=r?`length=${i}`:`type=${typeof t}`;throw new Error(a+"expected Uint8Array"+c+", got "+l)}return t}function pa(t){const e=t.toString(16);return e.length&1?"0"+e:e}function qy(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?gd:BigInt("0x"+t)}function Rc(t){return qy(is(t))}function Zy(t){return ki(t),qy(is(Uint8Array.from(t).reverse()))}function md(t,e){return Xa(t.toString(16).padStart(e*2,"0"))}function Ky(t,e){return md(t,e).reverse()}function en(t,e,n){let r;if(typeof e=="string")try{r=Xa(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else if(Bc(e))r=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");return r.length,r}const Al=t=>typeof t=="bigint"&&gd<=t;function _E(t,e,n){return Al(t)&&Al(e)&&Al(n)&&e<=t&&t<n}function DE(t,e,n,r){if(!_E(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function Jy(t){let e;for(e=0;t>gd;t>>=kh,e+=1);return e}const Fo=t=>(kh<<BigInt(t))-kh;function FE(t,e,n){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 n!="function")throw new Error("hmacFn must be a function");const r=w=>new Uint8Array(w),i=w=>Uint8Array.of(w);let s=r(t),a=r(t),c=0;const l=()=>{s.fill(1),a.fill(0),c=0},h=(...w)=>n(a,s,...w),d=(w=r(0))=>{a=h(i(0),w),s=h(),w.length!==0&&(a=h(i(1),w),s=h())},g=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let w=0;const v=[];for(;w<e;){s=h();const E=s.slice();v.push(E),w+=s.length}return Vr(...v)};return(w,v)=>{l(),d(w);let E;for(;!(E=v(g()));)d();return l(),E}}function bd(t,e,n={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function r(i,s,a){const c=t[i];if(a&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${l}`)}Object.entries(e).forEach(([i,s])=>r(i,s,!1)),Object.entries(n).forEach(([i,s])=>r(i,s,!0))}function Lp(t){const e=new WeakMap;return(n,...r)=>{const i=e.get(n);if(i!==void 0)return i;const s=t(n,...r);return e.set(n,s),s}}const sn=BigInt(0),Yt=BigInt(1),yi=BigInt(2),Wy=BigInt(3),Qy=BigInt(4),Yy=BigInt(5),UE=BigInt(7),Xy=BigInt(8),LE=BigInt(9),ex=BigInt(16);function Nn(t,e){const n=t%e;return n>=sn?n:e+n}function mn(t,e,n){let r=t;for(;e-- >sn;)r*=r,r%=n;return r}function Mp(t,e){if(t===sn)throw new Error("invert: expected non-zero number");if(e<=sn)throw new Error("invert: expected positive modulus, got "+e);let n=Nn(t,e),r=e,i=sn,s=Yt;for(;n!==sn;){const c=r/n,l=r%n,h=i-s*c;r=n,n=l,i=s,s=h}if(r!==Yt)throw new Error("invert: does not exist");return Nn(i,e)}function yd(t,e,n){if(!t.eql(t.sqr(e),n))throw new Error("Cannot find square root")}function tx(t,e){const n=(t.ORDER+Yt)/Qy,r=t.pow(e,n);return yd(t,r,e),r}function ME(t,e){const n=(t.ORDER-Yy)/Xy,r=t.mul(e,yi),i=t.pow(r,n),s=t.mul(e,i),a=t.mul(t.mul(s,yi),i),c=t.mul(s,t.sub(a,t.ONE));return yd(t,c,e),c}function $E(t){const e=Uo(t),n=nx(t),r=n(e,e.neg(e.ONE)),i=n(e,r),s=n(e,e.neg(r)),a=(t+UE)/ex;return(c,l)=>{let h=c.pow(l,a),d=c.mul(h,r);const g=c.mul(h,i),m=c.mul(h,s),w=c.eql(c.sqr(d),l),v=c.eql(c.sqr(g),l);h=c.cmov(h,d,w),d=c.cmov(m,g,v);const E=c.eql(c.sqr(d),l),S=c.cmov(h,d,E);return yd(c,S,l),S}}function nx(t){if(t<Wy)throw new Error("sqrt is not defined for small field");let e=t-Yt,n=0;for(;e%yi===sn;)e/=yi,n++;let r=yi;const i=Uo(t);for(;$p(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return tx;let s=i.pow(r,e);const a=(e+Yt)/yi;return function(l,h){if(l.is0(h))return h;if($p(l,h)!==1)throw new Error("Cannot find square root");let d=n,g=l.mul(l.ONE,s),m=l.pow(h,e),w=l.pow(h,a);for(;!l.eql(m,l.ONE);){if(l.is0(m))return l.ZERO;let v=1,E=l.sqr(m);for(;!l.eql(E,l.ONE);)if(v++,E=l.sqr(E),v===d)throw new Error("Cannot find square root");const S=Yt<<BigInt(d-v-1),A=l.pow(g,S);d=v,g=l.sqr(A),m=l.mul(m,g),w=l.mul(w,A)}return w}}function zE(t){return t%Qy===Wy?tx:t%Xy===Yy?ME:t%ex===LE?$E(t):nx(t)}const GE=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function VE(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=GE.reduce((r,i)=>(r[i]="function",r),e);return bd(t,n),t}function jE(t,e,n){if(n<sn)throw new Error("invalid exponent, negatives unsupported");if(n===sn)return t.ONE;if(n===Yt)return e;let r=t.ONE,i=e;for(;n>sn;)n&Yt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=Yt;return r}function rx(t,e,n=!1){const r=new Array(e.length).fill(n?t.ZERO:void 0),i=e.reduce((a,c,l)=>t.is0(c)?a:(r[l]=a,t.mul(a,c)),t.ONE),s=t.inv(i);return e.reduceRight((a,c,l)=>t.is0(c)?a:(r[l]=t.mul(a,r[l]),t.mul(a,c)),s),r}function $p(t,e){const n=(t.ORDER-Yt)/yi,r=t.pow(e,n),i=t.eql(r,t.ONE),s=t.eql(r,t.ZERO),a=t.eql(r,t.neg(t.ONE));if(!i&&!s&&!a)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function ix(t,e){e!==void 0&&Ph(e);const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Uo(t,e,n=!1,r={}){if(t<=sn)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s,a=!1,c;if(typeof e=="object"&&e!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const m=e;m.BITS&&(i=m.BITS),m.sqrt&&(s=m.sqrt),typeof m.isLE=="boolean"&&(n=m.isLE),typeof m.modFromBytes=="boolean"&&(a=m.modFromBytes),c=m.allowedLengths}else typeof e=="number"&&(i=e),r.sqrt&&(s=r.sqrt);const{nBitLength:l,nByteLength:h}=ix(t,i);if(h>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let d;const g=Object.freeze({ORDER:t,isLE:n,BITS:l,BYTES:h,MASK:Fo(l),ZERO:sn,ONE:Yt,allowedLengths:c,create:m=>Nn(m,t),isValid:m=>{if(typeof m!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof m);return sn<=m&&m<t},is0:m=>m===sn,isValidNot0:m=>!g.is0(m)&&g.isValid(m),isOdd:m=>(m&Yt)===Yt,neg:m=>Nn(-m,t),eql:(m,w)=>m===w,sqr:m=>Nn(m*m,t),add:(m,w)=>Nn(m+w,t),sub:(m,w)=>Nn(m-w,t),mul:(m,w)=>Nn(m*w,t),pow:(m,w)=>jE(g,m,w),div:(m,w)=>Nn(m*Mp(w,t),t),sqrN:m=>m*m,addN:(m,w)=>m+w,subN:(m,w)=>m-w,mulN:(m,w)=>m*w,inv:m=>Mp(m,t),sqrt:s||(m=>(d||(d=zE(t)),d(g,m))),toBytes:m=>n?Ky(m,h):md(m,h),fromBytes:(m,w=!0)=>{if(c){if(!c.includes(m.length)||m.length>h)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+m.length);const E=new Uint8Array(h);E.set(m,n?0:E.length-m.length),m=E}if(m.length!==h)throw new Error("Field.fromBytes: expected "+h+" bytes, got "+m.length);let v=n?Zy(m):Rc(m);if(a&&(v=Nn(v,t)),!w&&!g.isValid(v))throw new Error("invalid field element: outside of range 0..ORDER");return v},invertBatch:m=>rx(g,m),cmov:(m,w,v)=>v?w:m});return Object.freeze(g)}function sx(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 ox(t){const e=sx(t);return e+Math.ceil(e/2)}function HE(t,e,n=!1){const r=t.length,i=sx(e),s=ox(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const a=n?Zy(t):Rc(t),c=Nn(a,e-Yt)+Yt;return n?Ky(c,i):md(c,i)}const hs=BigInt(0),xi=BigInt(1);function tc(t,e){const n=e.negate();return t?n:e}function El(t,e){const n=rx(t.Fp,e.map(r=>r.Z));return e.map((r,i)=>t.fromAffine(r.toAffine(n[i])))}function ax(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function vl(t,e){ax(t,e);const n=Math.ceil(e/t)+1,r=2**(t-1),i=2**t,s=Fo(t),a=BigInt(t);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:a}}function zp(t,e,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:a}=n;let c=Number(t&i),l=t>>a;c>r&&(c-=s,l+=xi);const h=e*r,d=h+Math.abs(c)-1,g=c===0,m=c<0,w=e%2!==0;return{nextN:l,offset:d,isZero:g,isNeg:m,isNegF:w,offsetF:h}}function qE(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,r)=>{if(!(n instanceof e))throw new Error("invalid point at index "+r)})}function ZE(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,r)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+r)})}const Bl=new WeakMap,cx=new WeakMap;function Rl(t){return cx.get(t)||1}function Gp(t){if(t!==hs)throw new Error("invalid wNAF")}let KE=class{constructor(e,n){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=n}_unsafeLadder(e,n,r=this.ZERO){let i=e;for(;n>hs;)n&xi&&(r=r.add(i)),i=i.double(),n>>=xi;return r}precomputeWindow(e,n){const{windows:r,windowSize:i}=vl(n,this.bits),s=[];let a=e,c=a;for(let l=0;l<r;l++){c=a,s.push(c);for(let h=1;h<i;h++)c=c.add(a),s.push(c);a=c.double()}return s}wNAF(e,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const a=vl(e,this.bits);for(let c=0;c<a.windows;c++){const{nextN:l,offset:h,isZero:d,isNeg:g,isNegF:m,offsetF:w}=zp(r,c,a);r=l,d?s=s.add(tc(m,n[w])):i=i.add(tc(g,n[h]))}return Gp(r),{p:i,f:s}}wNAFUnsafe(e,n,r,i=this.ZERO){const s=vl(e,this.bits);for(let a=0;a<s.windows&&r!==hs;a++){const{nextN:c,offset:l,isZero:h,isNeg:d}=zp(r,a,s);if(r=c,!h){const g=n[l];i=i.add(d?g.negate():g)}}return Gp(r),i}getPrecomputes(e,n,r){let i=Bl.get(n);return i||(i=this.precomputeWindow(n,e),e!==1&&(typeof r=="function"&&(i=r(i)),Bl.set(n,i))),i}cached(e,n,r){const i=Rl(e);return this.wNAF(i,this.getPrecomputes(i,e,r),n)}unsafe(e,n,r,i){const s=Rl(e);return s===1?this._unsafeLadder(e,n,i):this.wNAFUnsafe(s,this.getPrecomputes(s,e,r),n,i)}createCache(e,n){ax(n,this.bits),cx.set(e,n),Bl.delete(e)}hasCache(e){return Rl(e)!==1}};function JE(t,e,n,r){let i=e,s=t.ZERO,a=t.ZERO;for(;n>hs||r>hs;)n&xi&&(s=s.add(i)),r&xi&&(a=a.add(i)),i=i.double(),n>>=xi,r>>=xi;return{p1:s,p2:a}}function WE(t,e,n,r){qE(n,t),ZE(r,e);const i=n.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const a=t.ZERO,c=Jy(BigInt(i));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const h=Fo(l),d=new Array(Number(h)+1).fill(a),g=Math.floor((e.BITS-1)/l)*l;let m=a;for(let w=g;w>=0;w-=l){d.fill(a);for(let E=0;E<s;E++){const S=r[E],A=Number(S>>BigInt(w)&h);d[A]=d[A].add(n[E])}let v=a;for(let E=d.length-1,S=a;E>0;E--)S=S.add(d[E]),v=v.add(S);if(m=m.add(v),w!==0)for(let E=0;E<l;E++)m=m.double()}return m}function Vp(t,e,n){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return VE(e),e}else return Uo(t,{isLE:n})}function QE(t,e,n={},r){if(r===void 0&&(r=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const l of["p","n","h"]){const h=e[l];if(!(typeof h=="bigint"&&h>hs))throw new Error(`CURVE.${l} must be positive bigint`)}const i=Vp(e.p,n.Fp,r),s=Vp(e.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const l of c)if(!i.isValid(e[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:s}}const jp=(t,e)=>(t+(t>=0?e:-e)/ux)/e;function YE(t,e,n){const[[r,i],[s,a]]=e,c=jp(a*t,n),l=jp(-i*t,n);let h=t-c*r-l*s,d=-c*i-l*a;const g=h<gr,m=d<gr;g&&(h=-h),m&&(d=-d);const w=Fo(Math.ceil(Jy(n)/2))+ss;if(h<gr||h>=w||d<gr||d>=w)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:g,k1:h,k2neg:m,k2:d}}function Nh(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function Tl(t,e){const n={};for(let r of Object.keys(e))n[r]=t[r]===void 0?e[r]:t[r];return ec(n.lowS,"lowS"),ec(n.prehash,"prehash"),n.format!==void 0&&Nh(n.format),n}class XE extends Error{constructor(e=""){super(e)}}const fr={Err:XE,_tlv:{encode:(t,e)=>{const{Err:n}=fr;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const r=e.length/2,i=pa(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?pa(i.length/2|128):"";return pa(t)+s+i+e},decode(t,e){const{Err:n}=fr;let r=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new n("tlv.decode: wrong tlv");const i=e[r++],s=!!(i&128);let a=0;if(!s)a=i;else{const l=i&127;if(!l)throw new n("tlv.decode(long): indefinite length not supported");if(l>4)throw new n("tlv.decode(long): byte length is too big");const h=e.subarray(r,r+l);if(h.length!==l)throw new n("tlv.decode: length bytes not complete");if(h[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const d of h)a=a<<8|d;if(r+=l,a<128)throw new n("tlv.decode(long): not minimal encoding")}const c=e.subarray(r,r+a);if(c.length!==a)throw new n("tlv.decode: wrong value length");return{v:c,l:e.subarray(r+a)}}},_int:{encode(t){const{Err:e}=fr;if(t<gr)throw new e("integer: negative integers are not allowed");let n=pa(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=fr;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Rc(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=fr,i=en("signature",t),{v:s,l:a}=r.decode(48,i);if(a.length)throw new e("invalid signature: left bytes after parsing");const{v:c,l}=r.decode(2,s),{v:h,l:d}=r.decode(2,l);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(h)}},hexFromSig(t){const{_tlv:e,_int:n}=fr,r=e.encode(2,n.encode(t.r)),i=e.encode(2,n.encode(t.s)),s=r+i;return e.encode(48,s)}},gr=BigInt(0),ss=BigInt(1),ux=BigInt(2),ga=BigInt(3),ev=BigInt(4);function Xi(t,e){const{BYTES:n}=t;let r;if(typeof e=="bigint")r=e;else{let i=en("private key",e);try{r=t.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof e}`)}}if(!t.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function tv(t,e={}){const n=QE("weierstrass",t,e),{Fp:r,Fn:i}=n;let s=n.CURVE;const{h:a,n:c}=s;bd(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:l}=e;if(l&&(!r.is0(s.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const h=fx(r,i);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function g(U,Z,J){const{x:L,y:q}=Z.toAffine(),re=r.toBytes(L);if(ec(J,"isCompressed"),J){d();const le=!r.isOdd(q);return Vr(lx(le),re)}else return Vr(Uint8Array.of(4),re,r.toBytes(q))}function m(U){bi(U,void 0,"Point");const{publicKey:Z,publicKeyUncompressed:J}=h,L=U.length,q=U[0],re=U.subarray(1);if(L===Z&&(q===2||q===3)){const le=r.fromBytes(re);if(!r.isValid(le))throw new Error("bad point: is not on curve, wrong x");const ce=E(le);let he;try{he=r.sqrt(ce)}catch(V){const K=V instanceof Error?": "+V.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}d();const be=r.isOdd(he);return(q&1)===1!==be&&(he=r.neg(he)),{x:le,y:he}}else if(L===J&&q===4){const le=r.BYTES,ce=r.fromBytes(re.subarray(0,le)),he=r.fromBytes(re.subarray(le,le*2));if(!S(ce,he))throw new Error("bad point: is not on curve");return{x:ce,y:he}}else throw new Error(`bad point: got length ${L}, expected compressed=${Z} or uncompressed=${J}`)}const w=e.toBytes||g,v=e.fromBytes||m;function E(U){const Z=r.sqr(U),J=r.mul(Z,U);return r.add(r.add(J,r.mul(U,s.a)),s.b)}function S(U,Z){const J=r.sqr(Z),L=E(U);return r.eql(J,L)}if(!S(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const A=r.mul(r.pow(s.a,ga),ev),I=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(A,I)))throw new Error("bad curve params: a or b");function T(U,Z,J=!1){if(!r.isValid(Z)||J&&r.is0(Z))throw new Error(`bad point coordinate ${U}`);return Z}function O(U){if(!(U instanceof j))throw new Error("ProjectivePoint expected")}function k(U){if(!l||!l.basises)throw new Error("no endo");return YE(U,l.basises,i.ORDER)}const _=Lp((U,Z)=>{const{X:J,Y:L,Z:q}=U;if(r.eql(q,r.ONE))return{x:J,y:L};const re=U.is0();Z==null&&(Z=re?r.ONE:r.inv(q));const le=r.mul(J,Z),ce=r.mul(L,Z),he=r.mul(q,Z);if(re)return{x:r.ZERO,y:r.ZERO};if(!r.eql(he,r.ONE))throw new Error("invZ was invalid");return{x:le,y:ce}}),D=Lp(U=>{if(U.is0()){if(e.allowInfinityPoint&&!r.is0(U.Y))return;throw new Error("bad point: ZERO")}const{x:Z,y:J}=U.toAffine();if(!r.isValid(Z)||!r.isValid(J))throw new Error("bad point: x or y not field elements");if(!S(Z,J))throw new Error("bad point: equation left != right");if(!U.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function $(U,Z,J,L,q){return J=new j(r.mul(J.X,U),J.Y,J.Z),Z=tc(L,Z),J=tc(q,J),Z.add(J)}class j{constructor(Z,J,L){this.X=T("x",Z),this.Y=T("y",J,!0),this.Z=T("z",L),Object.freeze(this)}static CURVE(){return s}static fromAffine(Z){const{x:J,y:L}=Z||{};if(!Z||!r.isValid(J)||!r.isValid(L))throw new Error("invalid affine point");if(Z instanceof j)throw new Error("projective point not allowed");return r.is0(J)&&r.is0(L)?j.ZERO:new j(J,L,r.ONE)}static fromBytes(Z){const J=j.fromAffine(v(bi(Z,void 0,"point")));return J.assertValidity(),J}static fromHex(Z){return j.fromBytes(en("pointHex",Z))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(Z=8,J=!0){return de.createCache(this,Z),J||this.multiply(ga),this}assertValidity(){D(this)}hasEvenY(){const{y:Z}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(Z)}equals(Z){O(Z);const{X:J,Y:L,Z:q}=this,{X:re,Y:le,Z:ce}=Z,he=r.eql(r.mul(J,ce),r.mul(re,q)),be=r.eql(r.mul(L,ce),r.mul(le,q));return he&&be}negate(){return new j(this.X,r.neg(this.Y),this.Z)}double(){const{a:Z,b:J}=s,L=r.mul(J,ga),{X:q,Y:re,Z:le}=this;let ce=r.ZERO,he=r.ZERO,be=r.ZERO,xe=r.mul(q,q),V=r.mul(re,re),K=r.mul(le,le),Y=r.mul(q,re);return Y=r.add(Y,Y),be=r.mul(q,le),be=r.add(be,be),ce=r.mul(Z,be),he=r.mul(L,K),he=r.add(ce,he),ce=r.sub(V,he),he=r.add(V,he),he=r.mul(ce,he),ce=r.mul(Y,ce),be=r.mul(L,be),K=r.mul(Z,K),Y=r.sub(xe,K),Y=r.mul(Z,Y),Y=r.add(Y,be),be=r.add(xe,xe),xe=r.add(be,xe),xe=r.add(xe,K),xe=r.mul(xe,Y),he=r.add(he,xe),K=r.mul(re,le),K=r.add(K,K),xe=r.mul(K,Y),ce=r.sub(ce,xe),be=r.mul(K,V),be=r.add(be,be),be=r.add(be,be),new j(ce,he,be)}add(Z){O(Z);const{X:J,Y:L,Z:q}=this,{X:re,Y:le,Z:ce}=Z;let he=r.ZERO,be=r.ZERO,xe=r.ZERO;const V=s.a,K=r.mul(s.b,ga);let Y=r.mul(J,re),M=r.mul(L,le),z=r.mul(q,ce),W=r.add(J,L),te=r.add(re,le);W=r.mul(W,te),te=r.add(Y,M),W=r.sub(W,te),te=r.add(J,q);let se=r.add(re,ce);return te=r.mul(te,se),se=r.add(Y,z),te=r.sub(te,se),se=r.add(L,q),he=r.add(le,ce),se=r.mul(se,he),he=r.add(M,z),se=r.sub(se,he),xe=r.mul(V,te),he=r.mul(K,z),xe=r.add(he,xe),he=r.sub(M,xe),xe=r.add(M,xe),be=r.mul(he,xe),M=r.add(Y,Y),M=r.add(M,Y),z=r.mul(V,z),te=r.mul(K,te),M=r.add(M,z),z=r.sub(Y,z),z=r.mul(V,z),te=r.add(te,z),Y=r.mul(M,te),be=r.add(be,Y),Y=r.mul(se,te),he=r.mul(W,he),he=r.sub(he,Y),Y=r.mul(W,M),xe=r.mul(se,xe),xe=r.add(xe,Y),new j(he,be,xe)}subtract(Z){return this.add(Z.negate())}is0(){return this.equals(j.ZERO)}multiply(Z){const{endo:J}=e;if(!i.isValidNot0(Z))throw new Error("invalid scalar: out of range");let L,q;const re=le=>de.cached(this,le,ce=>El(j,ce));if(J){const{k1neg:le,k1:ce,k2neg:he,k2:be}=k(Z),{p:xe,f:V}=re(ce),{p:K,f:Y}=re(be);q=V.add(Y),L=$(J.beta,xe,K,le,he)}else{const{p:le,f:ce}=re(Z);L=le,q=ce}return El(j,[L,q])[0]}multiplyUnsafe(Z){const{endo:J}=e,L=this;if(!i.isValid(Z))throw new Error("invalid scalar: out of range");if(Z===gr||L.is0())return j.ZERO;if(Z===ss)return L;if(de.hasCache(this))return this.multiply(Z);if(J){const{k1neg:q,k1:re,k2neg:le,k2:ce}=k(Z),{p1:he,p2:be}=JE(j,L,re,ce);return $(J.beta,he,be,q,le)}else return de.unsafe(L,Z)}multiplyAndAddUnsafe(Z,J,L){const q=this.multiplyUnsafe(J).add(Z.multiplyUnsafe(L));return q.is0()?void 0:q}toAffine(Z){return _(this,Z)}isTorsionFree(){const{isTorsionFree:Z}=e;return a===ss?!0:Z?Z(j,this):de.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:Z}=e;return a===ss?this:Z?Z(j,this):this.multiplyUnsafe(a)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}toBytes(Z=!0){return ec(Z,"isCompressed"),this.assertValidity(),w(j,this,Z)}toHex(Z=!0){return is(this.toBytes(Z))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(Z=!0){return this.toBytes(Z)}_setWindowSize(Z){this.precompute(Z)}static normalizeZ(Z){return El(j,Z)}static msm(Z,J){return WE(j,i,Z,J)}static fromPrivateKey(Z){return j.BASE.multiply(Xi(i,Z))}}j.BASE=new j(s.Gx,s.Gy,r.ONE),j.ZERO=new j(r.ZERO,r.ONE,r.ZERO),j.Fp=r,j.Fn=i;const X=i.BITS,de=new KE(j,e.endo?Math.ceil(X/2):X);return j.BASE.precompute(8),j}function lx(t){return Uint8Array.of(t?2:3)}function fx(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function nv(t,e={}){const{Fn:n}=t,r=e.randomBytes||Vy,i=Object.assign(fx(t.Fp,n),{seed:ox(n.ORDER)});function s(w){try{return!!Xi(n,w)}catch{return!1}}function a(w,v){const{publicKey:E,publicKeyUncompressed:S}=i;try{const A=w.length;return v===!0&&A!==E||v===!1&&A!==S?!1:!!t.fromBytes(w)}catch{return!1}}function c(w=r(i.seed)){return HE(bi(w,i.seed,"seed"),n.ORDER)}function l(w,v=!0){return t.BASE.multiply(Xi(n,w)).toBytes(v)}function h(w){const v=c(w);return{secretKey:v,publicKey:l(v)}}function d(w){if(typeof w=="bigint")return!1;if(w instanceof t)return!0;const{secretKey:v,publicKey:E,publicKeyUncompressed:S}=i;if(n.allowedLengths||v===E)return;const A=en("key",w).length;return A===E||A===S}function g(w,v,E=!0){if(d(w)===!0)throw new Error("first arg must be private key");if(d(v)===!1)throw new Error("second arg must be public key");const S=Xi(n,w);return t.fromHex(v).multiply(S).toBytes(E)}return Object.freeze({getPublicKey:l,getSharedSecret:g,keygen:h,Point:t,utils:{isValidSecretKey:s,isValidPublicKey:a,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:w=>Xi(n,w),precompute(w=8,v=t.BASE){return v.precompute(w,!1)}},lengths:i})}function rv(t,e,n={}){$y(e),bd(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Vy,i=n.hmac||((J,...L)=>Hy(e,J,Vr(...L))),{Fp:s,Fn:a}=t,{ORDER:c,BITS:l}=a,{keygen:h,getPublicKey:d,getSharedSecret:g,utils:m,lengths:w}=nv(t,n),v={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},E="compact";function S(J){const L=c>>ss;return J>L}function A(J,L){if(!a.isValidNot0(L))throw new Error(`invalid signature ${J}: out of range 1..Point.Fn.ORDER`);return L}function I(J,L){Nh(L);const q=w.signature,re=L==="compact"?q:L==="recovered"?q+1:void 0;return bi(J,re,`${L} signature`)}class T{constructor(L,q,re){this.r=A("r",L),this.s=A("s",q),re!=null&&(this.recovery=re),Object.freeze(this)}static fromBytes(L,q=E){I(L,q);let re;if(q==="der"){const{r:be,s:xe}=fr.toSig(bi(L));return new T(be,xe)}q==="recovered"&&(re=L[0],q="compact",L=L.subarray(1));const le=a.BYTES,ce=L.subarray(0,le),he=L.subarray(le,le*2);return new T(a.fromBytes(ce),a.fromBytes(he),re)}static fromHex(L,q){return this.fromBytes(Xa(L),q)}addRecoveryBit(L){return new T(this.r,this.s,L)}recoverPublicKey(L){const q=s.ORDER,{r:re,s:le,recovery:ce}=this;if(ce==null||![0,1,2,3].includes(ce))throw new Error("recovery id invalid");if(c*ux<q&&ce>1)throw new Error("recovery id is ambiguous for h>1 curve");const be=ce===2||ce===3?re+c:re;if(!s.isValid(be))throw new Error("recovery id 2 or 3 invalid");const xe=s.toBytes(be),V=t.fromBytes(Vr(lx((ce&1)===0),xe)),K=a.inv(be),Y=k(en("msgHash",L)),M=a.create(-Y*K),z=a.create(le*K),W=t.BASE.multiplyUnsafe(M).add(V.multiplyUnsafe(z));if(W.is0())throw new Error("point at infinify");return W.assertValidity(),W}hasHighS(){return S(this.s)}toBytes(L=E){if(Nh(L),L==="der")return Xa(fr.hexFromSig(this));const q=a.toBytes(this.r),re=a.toBytes(this.s);if(L==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Vr(Uint8Array.of(this.recovery),q,re)}return Vr(q,re)}toHex(L){return is(this.toBytes(L))}assertValidity(){}static fromCompact(L){return T.fromBytes(en("sig",L),"compact")}static fromDER(L){return T.fromBytes(en("sig",L),"der")}normalizeS(){return this.hasHighS()?new T(this.r,a.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return is(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return is(this.toBytes("compact"))}}const O=n.bits2int||function(L){if(L.length>8192)throw new Error("input is too large");const q=Rc(L),re=L.length*8-l;return re>0?q>>BigInt(re):q},k=n.bits2int_modN||function(L){return a.create(O(L))},_=Fo(l);function D(J){return DE("num < 2^"+l,J,gr,_),a.toBytes(J)}function $(J,L){return bi(J,void 0,"message"),L?bi(e(J),void 0,"prehashed message"):J}function j(J,L,q){if(["recovered","canonical"].some(M=>M in q))throw new Error("sign() legacy options not supported");const{lowS:re,prehash:le,extraEntropy:ce}=Tl(q,v);J=$(J,le);const he=k(J),be=Xi(a,L),xe=[D(be),D(he)];if(ce!=null&&ce!==!1){const M=ce===!0?r(w.secretKey):ce;xe.push(en("extraEntropy",M))}const V=Vr(...xe),K=he;function Y(M){const z=O(M);if(!a.isValidNot0(z))return;const W=a.inv(z),te=t.BASE.multiply(z).toAffine(),se=a.create(te.x);if(se===gr)return;const P=a.create(W*a.create(K+se*be));if(P===gr)return;let N=(te.x===se?0:2)|Number(te.y&ss),ee=P;return re&&S(P)&&(ee=a.neg(P),N^=1),new T(se,ee,N)}return{seed:V,k2sig:Y}}function X(J,L,q={}){J=en("message",J);const{seed:re,k2sig:le}=j(J,L,q);return FE(e.outputLen,a.BYTES,i)(re,le)}function de(J){let L;const q=typeof J=="string"||Bc(J),re=!q&&J!==null&&typeof J=="object"&&typeof J.r=="bigint"&&typeof J.s=="bigint";if(!q&&!re)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(re)L=new T(J.r,J.s);else if(q){try{L=T.fromBytes(en("sig",J),"der")}catch(le){if(!(le instanceof fr.Err))throw le}if(!L)try{L=T.fromBytes(en("sig",J),"compact")}catch{return!1}}return L||!1}function U(J,L,q,re={}){const{lowS:le,prehash:ce,format:he}=Tl(re,v);if(q=en("publicKey",q),L=$(en("message",L),ce),"strict"in re)throw new Error("options.strict was renamed to lowS");const be=he===void 0?de(J):T.fromBytes(en("sig",J),he);if(be===!1)return!1;try{const xe=t.fromBytes(q);if(le&&be.hasHighS())return!1;const{r:V,s:K}=be,Y=k(L),M=a.inv(K),z=a.create(Y*M),W=a.create(V*M),te=t.BASE.multiplyUnsafe(z).add(xe.multiplyUnsafe(W));return te.is0()?!1:a.create(te.x)===V}catch{return!1}}function Z(J,L,q={}){const{prehash:re}=Tl(q,v);return L=$(L,re),T.fromBytes(J,"recovered").recoverPublicKey(L).toBytes()}return Object.freeze({keygen:h,getPublicKey:d,getSharedSecret:g,utils:m,lengths:w,Point:t,sign:X,verify:U,recoverPublicKey:Z,Signature:T,hash:e})}function iv(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},n=t.Fp;let r=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(a=>Math.ceil(a/2)))):void 0;const i=Uo(e.n,{BITS:t.nBitLength,allowedLengths:r,modFromBytes:t.wrapPrivateKey}),s={Fp:n,Fn:i,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:s}}function sv(t){const{CURVE:e,curveOpts:n}=iv(t),r={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:n,hash:t.hash,ecdsaOpts:r}}function ov(t,e){const n=e.Point;return Object.assign({},e,{ProjectivePoint:n,CURVE:Object.assign({},t,ix(n.Fn.ORDER,n.Fn.BITS))})}function av(t){const{CURVE:e,curveOpts:n,hash:r,ecdsaOpts:i}=sv(t),s=tv(e,n),a=rv(s,r,i);return ov(t,a)}function cv(t,e){const n=r=>av({...t,hash:r});return{...n(e),create:n}}const xd={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},uv={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Hp=BigInt(2);function lv(t){const e=xd.p,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),c=BigInt(44),l=BigInt(88),h=t*t*t%e,d=h*h*t%e,g=mn(d,n,e)*d%e,m=mn(g,n,e)*d%e,w=mn(m,Hp,e)*h%e,v=mn(w,i,e)*w%e,E=mn(v,s,e)*v%e,S=mn(E,c,e)*E%e,A=mn(S,l,e)*S%e,I=mn(A,c,e)*E%e,T=mn(I,n,e)*d%e,O=mn(T,a,e)*v%e,k=mn(O,r,e)*h%e,_=mn(k,Hp,e);if(!Ch.eql(Ch.sqr(_),t))throw new Error("Cannot find square root");return _}const Ch=Uo(xd.p,{sqrt:lv}),Lo=cv({...xd,Fp:Ch,lowS:!0,endo:uv},CE);function hx(t,e){const n=[];for(let r=0;r<t.length;r+=e)n.push(t.subarray(r,r+e));return n}function to(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function dx(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++)if(t[r]!==e[r])return t.subarray(0,r);return t.subarray(0,n)}function fv(t,e,n=0){for(let r=n;r<t.length;r++)for(let i=0;i<e.length&&t[r+i]===e[i];i++)if(i===e.length-1)return r;return-1}function ds(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function hn(t,e){const n=new Uint8Array(32);let r=t;for(let i=31;i>=0;i--)n[i]=Number(r&0xffn),r>>=8n;return n}function mr(t,e){let n=0n;for(let r=0;r<32;r++)n=n<<8n|BigInt(t[r]);return n}function Hr(t){const e=t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t,n=new Uint8Array(e.length/2);for(let r=0;r<n.length;r++)n[r]=parseInt(e.slice(r*2,r*2+2),16);return n}var hv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",px="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function dv(t,e){const r=e.length;let i=0,s=0;const a=[];for(let c=0;c<t.length;c++){const l=t.charAt(c);if(l==="=")break;const h=e.indexOf(l);if(h===-1)throw new Error(`Invalid character: ${l}`);s=s<<Math.log2(r)|h,i+=Math.log2(r),i>=8&&(i-=8,a.push(s>>i&255))}return new Uint8Array(a)}function gx(t,e){const n=e.length;let r=0,i=0,s="";for(const a of t)for(i=i<<8|a,r+=8;r>=Math.log2(n);)r-=Math.log2(n),s+=e.charAt(i>>r&n-1);return r>0&&(s+=e.charAt(i<<Math.log2(n)-r&n-1)),s.length%4!==0&&(s+="=".repeat(4-s.length%4)),s}function pv(t){return gx(t,hv)}function gv(t){return dv(t,px)}function mx(t){return gx(t,px)}function bx(t){return new Uint8Array([t])}function _h(t){return t[0]}function mv(t,e){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,t,e==="LE"),new Uint8Array(n)}function bv(t,e){return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint16(0,e==="LE")}function wo(t,e){const n=new ArrayBuffer(8);return new DataView(n).setBigUint64(0,t,e==="LE"),new Uint8Array(n)}function wd(t,e){return new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,e==="LE")}var qp=[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 jt(t){return Av(yv(new Array(50).fill(0),wv(t,1)))}function yv(t,e){for(const n of e){for(let r=0;r<34;r+=2)t[r]=t[r]^n[r+1],t[r+1]=t[r+1]^n[r];xv(t)}return t}function xv(t){for(let e=0;e<24;e++){const n=t[0]^t[10]^t[20]^t[30]^t[40],r=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],g=t[9]^t[19]^t[29]^t[39]^t[49],m=i<<1|s>>>31,w=s<<1|i>>>31,v=d^m,E=g^w,S=a<<1|c>>>31,A=c<<1|a>>>31,I=n^S,T=r^A,O=l<<1|h>>>31,k=h<<1|l>>>31,_=i^O,D=s^k,$=d<<1|g>>>31,j=g<<1|d>>>31,X=a^$,de=c^j,U=n<<1|r>>>31,Z=r<<1|n>>>31,J=l^U,L=h^Z;t[0]^=v,t[1]^=E,t[2]^=I,t[3]^=T,t[4]^=_,t[5]^=D,t[6]^=X,t[7]^=de,t[8]^=J,t[9]^=L,t[10]^=v,t[11]^=E,t[12]^=I,t[13]^=T,t[14]^=_,t[15]^=D,t[16]^=X,t[17]^=de,t[18]^=J,t[19]^=L,t[20]^=v,t[21]^=E,t[22]^=I,t[23]^=T,t[24]^=_,t[25]^=D,t[26]^=X,t[27]^=de,t[28]^=J,t[29]^=L,t[30]^=v,t[31]^=E,t[32]^=I,t[33]^=T,t[34]^=_,t[35]^=D,t[36]^=X,t[37]^=de,t[38]^=J,t[39]^=L,t[40]^=v,t[41]^=E,t[42]^=I,t[43]^=T,t[44]^=_,t[45]^=D,t[46]^=X,t[47]^=de,t[48]^=J,t[49]^=L;const q=t[0],re=t[1],le=t[2]<<1|t[3]>>>31,ce=t[3]<<1|t[2]>>>31,he=t[5]<<30|t[4]>>>2,be=t[4]<<30|t[5]>>>2,xe=t[6]<<28|t[7]>>>4,V=t[7]<<28|t[6]>>>4,K=t[8]<<27|t[9]>>>5,Y=t[9]<<27|t[8]>>>5,M=t[11]<<4|t[10]>>>28,z=t[10]<<4|t[11]>>>28,W=t[13]<<12|t[12]>>>20,te=t[12]<<12|t[13]>>>20,se=t[14]<<6|t[15]>>>26,P=t[15]<<6|t[14]>>>26,N=t[17]<<23|t[16]>>>9,ee=t[16]<<23|t[17]>>>9,ge=t[18]<<20|t[19]>>>12,Pe=t[19]<<20|t[18]>>>12,Ee=t[20]<<3|t[21]>>>29,Ce=t[21]<<3|t[20]>>>29,Rt=t[22]<<10|t[23]>>>22,oe=t[23]<<10|t[22]>>>22,at=t[25]<<11|t[24]>>>21,ct=t[24]<<11|t[25]>>>21,Ge=t[26]<<25|t[27]>>>7,Ze=t[27]<<25|t[26]>>>7,Tt=t[29]<<7|t[28]>>>25,qt=t[28]<<7|t[29]>>>25,We=t[31]<<9|t[30]>>>23,xt=t[30]<<9|t[31]>>>23,Mt=t[33]<<13|t[32]>>>19,Dt=t[32]<<13|t[33]>>>19,pn=t[34]<<15|t[35]>>>17,$n=t[35]<<15|t[34]>>>17,Pr=t[36]<<21|t[37]>>>11,tr=t[37]<<21|t[36]>>>11,gn=t[38]<<8|t[39]>>>24,Pn=t[39]<<8|t[38]>>>24,nr=t[40]<<18|t[41]>>>14,ii=t[41]<<18|t[40]>>>14,rr=t[42]<<2|t[43]>>>30,ir=t[43]<<2|t[42]>>>30,kr=t[45]<<29|t[44]>>>3,sr=t[44]<<29|t[45]>>>3,kn=t[47]<<24|t[46]>>>8,$t=t[46]<<24|t[47]>>>8,or=t[48]<<14|t[49]>>>18,si=t[49]<<14|t[48]>>>18;t[0]=q^~W&at,t[1]=re^~te&ct,t[2]=W^~at&Pr,t[3]=te^~ct&tr,t[4]=at^~Pr&or,t[5]=ct^~tr&si,t[6]=Pr^~or&q,t[7]=tr^~si&re,t[8]=or^~q&W,t[9]=si^~re&te,t[10]=xe^~ge&Ee,t[11]=V^~Pe&Ce,t[12]=ge^~Ee&Mt,t[13]=Pe^~Ce&Dt,t[14]=Ee^~Mt&kr,t[15]=Ce^~Dt&sr,t[16]=Mt^~kr&xe,t[17]=Dt^~sr&V,t[18]=kr^~xe&ge,t[19]=sr^~V&Pe,t[20]=le^~se&Ge,t[21]=ce^~P&Ze,t[22]=se^~Ge&gn,t[23]=P^~Ze&Pn,t[24]=Ge^~gn&nr,t[25]=Ze^~Pn&ii,t[26]=gn^~nr&le,t[27]=Pn^~ii&ce,t[28]=nr^~le&se,t[29]=ii^~ce&P,t[30]=K^~M&Rt,t[31]=Y^~z&oe,t[32]=M^~Rt&pn,t[33]=z^~oe&$n,t[34]=Rt^~pn&kn,t[35]=oe^~$n&$t,t[36]=pn^~kn&K,t[37]=$n^~$t&Y,t[38]=kn^~K&M,t[39]=$t^~Y&z,t[40]=he^~N&Tt,t[41]=be^~ee&qt,t[42]=N^~Tt&We,t[43]=ee^~qt&xt,t[44]=Tt^~We&rr,t[45]=qt^~xt&ir,t[46]=We^~rr&he,t[47]=xt^~ir&be,t[48]=rr^~he&N,t[49]=ir^~be&ee,t[0]^=qp[e*2],t[1]^=qp[e*2+1]}}function wv(t,e){if(!t.length){const i=new Uint8Array(136);return i[0]=e,i[135]=128,[Zp(i)]}const n=hx(t,136),r=n[n.length-1];if(r.length<136){const i=new Uint8Array(136);i.set(r),i[r.length]=e,i[135]=i[135]|128,n[n.length-1]=i}if(r.length===136){const i=new Uint8Array(136);i[0]=e,i[135]=128,n.push(i)}return n.map(Zp)}function Zp(t){const e=[];for(let n=0;n<t.length;n+=4)e.push(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24);return e}function Av(t){return new Uint8Array([t[1],t[1]>>-24,t[1]>>-16,t[1]>>-8,t[0],t[0]>>8,t[0]>>16,t[0]>>24,t[3],t[3]>>-24,t[3]>>-16,t[3]>>-8,t[2],t[2]>>8,t[2]>>16,t[2]>>24,t[5],t[5]>>-24,t[5]>>-16,t[5]>>-8,t[4],t[4]>>8,t[4]>>16,t[4]>>24,t[7],t[7]>>-24,t[7]>>-16,t[7]>>-8,t[6],t[6]>>8,t[6]>>16,t[6]>>24])}var Ev=new TextDecoder,vv=new TextEncoder,Bv=/^(0x)?[0-9a-fA-F]*$/i;function Rv(t){return typeof t=="object"&&t!==null&&typeof t.toHex=="function"}var Se=class cr{bytes;length;constructor(e,n){if(!e)throw new Error(`Bytes#constructor: constructor parameter is falsy: ${e}`);if(e instanceof cr)this.bytes=e.bytes;else if(typeof e=="string"){if(!Bv.test(e)||e.replace(/^0x/i,"").length%2!==0)throw new Error(`Bytes#constructor: invalid hex string: ${e}`);this.bytes=Hr(e)}else if(e instanceof ArrayBuffer)this.bytes=new Uint8Array(e);else if(e instanceof Uint8Array)this.bytes=e;else{const r=e;if(Rv(r))this.bytes=Hr(r.toHex());else throw new Error(`Bytes#constructor: unsupported type: ${typeof e}`)}if(this.length=this.bytes.length,n!==void 0){if(Array.isArray(n)){if(!n.includes(this.length))throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${n.join(" or ")}`)}else if(this.length!==n)throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${n}`)}}static keccak256(e){return new cr(jt(new cr(e).toUint8Array()))}static concat(...e){const n=e.map(a=>a instanceof cr?a.toUint8Array():a),r=n.reduce((a,c)=>a+c.length,0),i=new Uint8Array(r);let s=0;for(const a of n)i.set(a,s),s+=a.length;return i}static fromUtf8(e){return new cr(vv.encode(e))}static fromSlice(e,n,r){return r===void 0?new cr(e.slice(n)):new cr(e.slice(n,n+r))}offset(e){return new Uint8Array(this.bytes.slice(e))}toUint8Array(){return new Uint8Array(this.bytes)}toHex(){return ds(this.bytes)}toBase64(){return pv(this.bytes)}toBase32(){return mx(this.bytes)}toString(){return this.toHex()}toUtf8(){return Ev.decode(this.bytes)}toJSON(){return JSON.parse(this.toUtf8())}equals(e){return this.toHex()===new cr(e).toHex()}represent(){return this.toHex()}},ot=class extends Se{static LENGTH=32;constructor(t){super(t,32)}},Tv=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;function yx(t){if(t<=0n||t>=Tv)throw new Error("Invalid private key");const e=Lo.Point.BASE.multiply(t);return[e.x,e.y]}function Sv(t){return Lo.Point.fromAffine({x:t[0],y:t[1]}).toBytes(!0)}function Iv(t){if(t.length!==33||t[0]!==2&&t[0]!==3)throw new Error("Invalid compressed public key");const e=Lo.Point.fromBytes(t);return[e.x,e.y]}function Ad(t){const e=new Uint8Array(20),n=jt(Se.concat(hn(t[0]),hn(t[1])));return e.set(n.subarray(12)),e}function Ov(t){const e=ds(t),n=Uint8Array.from(e,s=>s.charCodeAt(0)),r=ds(jt(n));let i="0x";for(let s=0;s<e.length;s++)i+=parseInt(r.charAt(s),16)>7?e.charAt(s).toUpperCase():e.charAt(s);return i}var It=class extends Se{static LENGTH=20;constructor(t){super(t,20)}toChecksum(){return Ov(this.bytes)}},Kp=new Uint8Array(8).fill(255,0,8),Ar=class so extends Se{static LENGTH=8;static MINUS_ONE=new so(Kp);constructor(e){super(e,8)}static fromBigInt(e){return new so(wo(e,"BE"))}toBigInt(){return wd(this.bytes,"BE")}next(){return ds(this.bytes)===ds(Kp)?so.fromBigInt(0n):so.fromBigInt(this.toBigInt()+1n)}},Pv=new TextEncoder,Vt=class xx extends Se{static LENGTH=32;constructor(e){super(e,32)}static fromString(e){return new xx(jt(Pv.encode(e)))}},Qn=class extends Se{static LENGTH=32;constructor(t){super(t,32)}};function wx(t,e){const n=Lo.sign(jt(t),e,{prehash:!1}),r=n.recovery===0?27n:28n;return[n.r,n.s,r]}function Ax(t,e,n,r){const i=r===27n?0:1,a=new Lo.Signature(e,n,i).recoverPublicKey(jt(t));return[a.x,a.y]}var Un=class extends Se{static LENGTH=64;constructor(t){const e=new Se(t);if(e.length===33){const[n,r]=Iv(e.toUint8Array());super(Se.concat(hn(n),hn(r)),64)}else super(t,64)}address(){const t=mr(this.bytes.slice(0,32)),e=mr(this.bytes.slice(32,64));return new It(Ad([t,e]))}toCompressedUint8Array(){const t=mr(this.bytes.slice(0,32)),e=mr(this.bytes.slice(32,64));return Sv([t,e])}toCompressedHex(){return ds(this.toCompressedUint8Array())}},Ex=new TextEncoder,kv=Ex.encode(`Ethereum Signed Message:
|
|
11
|
+
32`);function vx(t){const e=t instanceof Uint8Array?t:Ex.encode(t);return Se.concat(kv,jt(e))}var ps=class Dh extends Se{static LENGTH=65;constructor(e){super(e,65)}static fromSlice(e,n){return new Dh(e.slice(n,n+Dh.LENGTH))}recoverPublicKey(e){const n=mr(this.bytes.slice(0,32)),r=mr(this.bytes.slice(32,64)),i=BigInt(this.bytes[64]),[s,a]=Ax(vx(e),n,r,i);return new Un(Se.concat(hn(s),hn(a)))}isValid(e,n){return this.recoverPublicKey(e).address().equals(n)}},Er=class extends Se{static LENGTH=32;constructor(t){super(t,32)}publicKey(){const[t,e]=yx(this.toBigInt());return new Un(Se.concat(hn(t),hn(e)))}sign(t){const[e,n,r]=wx(vx(t),this.toBigInt());return new ps(Se.concat(hn(e),hn(n),new Uint8Array([Number(r)])))}toBigInt(){return mr(this.bytes)}},Bx=250,Rx=251;function Nv(t){const e=gv(t.toUpperCase().slice(1)),n=e[1];if(n!==Bx&&n!==Rx)throw new Error("Unknown codec");return e.slice(-32)}var Ue=class Tx extends Se{static LENGTH=32;constructor(e){typeof e=="string"&&e.startsWith("bah5")?super(Nv(e),32):super(e,[32,64])}toCid(e){const n=Se.concat(new Uint8Array([1]),new Uint8Array([e==="feed"?Rx:Bx]),new Uint8Array([1]),new Uint8Array([27]),new Uint8Array([32]));return`b${mx(n).replace(/=+$/,"")}${this.toBase32().replace(/=+$/,"")}`.toLowerCase()}static isValid(e){try{return new Tx(e),!0}catch{return!1}}},Tn=class za extends Se{static LENGTH=8;constructor(e){super(e,8)}static fromBigInt(e){return new za(wo(e,"LE"))}toBigInt(){return wd(this.bytes,"LE")}static fromSlice(e,n){return new za(e.slice(n,n+za.LENGTH))}},Cv=new TextEncoder,Wi=class Sx extends Se{static LENGTH=32;constructor(e){super(e,32)}static fromString(e){return new Sx(jt(Cv.encode(e)))}},Zr=class extends Se{static LENGTH=32;constructor(t){super(t,32)}},Fh=class{cursor=0;buffer;constructor(t){this.buffer=t}read(t){const e=this.buffer.subarray(this.cursor,this.cursor+t);return this.cursor+=t,e}max(){return this.buffer.length-this.cursor}},_v=class{cursor=0;buffer;constructor(t){this.buffer=t}write(t){const e=Math.min(this.max(),t.max());return this.buffer.set(t.read(e),this.cursor),this.cursor+=e,e}max(){return this.buffer.length-this.cursor}},Dv=128;function Ix(t,e,n){const r=new Uint8Array(n.length),i=new Uint8Array(36);i.set(t);for(let s=0,a=0;a<n.length;s++,a+=32){const c=e+s>>>0;i[32]=c&255,i[33]=c>>>8&255,i[34]=c>>>16&255,i[35]=c>>>24&255;const l=jt(jt(i)),h=Math.min(a+32,n.length);for(let d=a;d<h;d++)r[d]=n[d]^l[d-a]}return r}function Fv(t,e){return Ix(t,Dv,e)}function Uv(t,e){return Ix(t,0,e)}var Sl=4096,Lv=32,Jp=8;function nc(t){const e=t.subarray(0,Jp),n=t.subarray(Jp),r=Mv(n);return new Ue(jt(Se.concat(e,r)))}function Mv(t){if(t.length>Sl)throw new Error(`payload size ${t.length} exceeds maximum chunk payload size ${Sl}`);const e=new Uint8Array(Sl);e.set(t);let n=hx(e,Lv);for(;n.length>1;){const r=[];for(let i=0;i<n.length;i+=2)r.push(jt(Se.concat(n[i],n[i+1])));n=r}return n[0]}Hr("dc5b20847f43d67928f49cd4f85d696b5a7617b5");var Ox=65,Wp=Vt.LENGTH,Uh=Vt.LENGTH+Ox,$v=Uh+Tn.LENGTH,zv=new TextEncoder().encode(`Ethereum Signed Message:
|
|
12
|
+
32`);function Px(t,e){const n=jt(Se.concat(t,e));return Se.concat(zv,n)}function Gv(t,e,n){const[r,i,s]=wx(Px(t,e),n);return Se.concat(hn(r),hn(i),new Uint8Array([Number(s)]))}function Vv(t,e,n){const r=mr(n.subarray(0,32)),i=mr(n.subarray(32,64)),s=BigInt(n[64]),a=Ax(Px(t,e),r,i,s);return Ad(a)}function gs(t,e){const n=new Vt(t),r=new It(e);return new Ue(jt(Se.concat(n.toUint8Array(),r.toUint8Array())))}function kx(t,e,n){const r=new Vt(e),i=Gv(r.toUint8Array(),t.address.toUint8Array(),n),s=new It(Ad(yx(n))),a=gs(r,s);return{data:Se.concat(r.toUint8Array(),i,t.data),identifier:r,signature:new ps(i),span:t.span,payload:t.payload,address:a,owner:s}}function jv(t,e){const n=t instanceof Se?t.toUint8Array():t,r=new Ue(e),i=new Vt(Se.fromSlice(n,0,Vt.LENGTH)),s=n.slice(Wp,Wp+Ox),a=nc(n.slice(Uh)),c=new It(Vv(i.toUint8Array(),a.toUint8Array(),s)),l=gs(i,c);if(!l.equals(r))throw new Error("SOC data does not match given address");const h=Tn.fromSlice(n,Uh),d=Se.fromSlice(n,$v);return{data:n,identifier:i,signature:new ps(s),span:h,payload:d,address:l,owner:c}}var Qp=1,Yp=4096;function Mo(t,e){if(typeof t=="string"&&(t=Se.fromUtf8(t)),t.length<Qp||t.length>Yp)throw new RangeError(`payload size ${t.length} exceeds limits [${Qp}, ${Yp}]`);const n=e?typeof e=="bigint"?Tn.fromBigInt(e):e:Tn.fromBigInt(BigInt(t.length)),r=new Se(t),i=Se.concat(n.toUint8Array(),r.toUint8Array()),s=nc(i),a={data:i,span:n,payload:r,address:s,toSingleOwnerChunk:(c,l)=>kx(a,c,new Er(l).toBigInt())};return a}function Nx(t){const e=new Se(t);return Mo(e.toUint8Array().slice(Tn.LENGTH),Tn.fromSlice(e.toUint8Array(),0))}var Il=class{span;writer;constructor(t=0n){this.span=t,this.writer=new _v(new Uint8Array(4096))}build(){return Se.concat(wo(this.span,"LE"),this.writer.buffer)}hash(){return nc(this.build())}encryptedHash(t){t||(t=new Uint8Array(32),crypto.getRandomValues(t));const e=Fv(t,wo(this.span,"LE")),n=Uv(t,this.writer.buffer);return{address:nc(Se.concat(e,n)),key:t}}},Lh=class oo{static NOOP=async e=>[];refSize;encrypted;maxShards;chunks;counters=[1];pending=[[]];onBatch;onIntermediateChunk;hasParity=[!1];pendingEntries=[];constructor(e,n,r=!1,i){this.encrypted=r,this.refSize=r?64:32,this.maxShards=n??4096/this.refSize,this.chunks=[new Il],this.onBatch=e,this.onIntermediateChunk=i}static async root(e){const n=new oo(oo.NOOP);return await n.append(e),n.finalize()}static async encryptedRoot(e){const n=new oo(oo.NOOP,void 0,!0);return await n.append(e),(await n.finalize()).encryptedHash()}async append(e,n=0,r=0n){const i=new Fh(e);for(;i.max()>0;){(this.chunks[n].writer.max()===0||r&&this.chunks[n].writer.max()<e.length)&&await this.elevate(n);const s=this.chunks[n].writer.write(i);r?this.chunks[n].span+=r:this.chunks[0].span+=BigInt(s)}}async elevate(e){this.counters[e]=(this.counters[e]+1)%(4096/this.refSize),this.pending[e]||(this.pending[e]=[]),await this.sealParities(e);const n=this.chunks[e].span;if(e>=1&&this.onIntermediateChunk&&(this.onIntermediateChunk(this.chunks[e],this.hasParity[e]??!1),this.hasParity[e]=!1),this.encrypted){const{address:r,key:i}=this.chunks[e].encryptedHash(),s=new Uint8Array(64);s.set(r.toUint8Array()),s.set(i,32),this.pending[e].push({entry:{chunk:this.chunks[e],key:i},ref:s,span:n})}else this.pending[e].push({entry:{chunk:this.chunks[e]},ref:this.chunks[e].hash().toUint8Array(),span:n});this.chunks[e]=new Il,this.pending[e].length>=this.maxShards&&await this.flushBatch(e)}async sealParities(e){const n=this.pendingEntries[e];if(!n?.length)return;this.pendingEntries[e]=[];const r=await this.onBatch(n);if(r.length>0){this.hasParity[e]=!0;for(const{chunk:i}of r)this.chunks[e].writer.write(new Fh(i.hash().toUint8Array()))}}async flushBatch(e){this.chunks[e+1]||(this.chunks.push(new Il),this.counters.push(1),this.pending.push([]),this.hasParity.push(!1));const n=this.pending[e];this.pending[e]=[];for(const{ref:r,span:i}of n)await this.append(r,e+1,i);this.pendingEntries[e+1]||(this.pendingEntries[e+1]=[]),this.pendingEntries[e+1].push(...n.map(r=>r.entry)),n.length>=this.maxShards&&await this.sealParities(e+1)}async finalize(e=0){return this.pending[e]?.length&&await this.flushBatch(e),this.chunks[e+1]?this.counters[e]===1?(await this.elevate(e+1),await this.flushBatch(e+1),this.chunks[e+1]=this.chunks[e],this.finalize(e+1)):(await this.elevate(e),await this.flushBatch(e),this.finalize(e+1)):(await this.sealParities(e),e>=1&&this.onIntermediateChunk&&this.onIntermediateChunk(this.chunks[e],this.hasParity[e]??!1),this.chunks[e])}};function Xp(t,e){const n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[r]^e[r%e.length];return n}var ma=new TextEncoder,Hv=new TextDecoder,qv=2,Zv=4,Kv=8,Jv=16,Wv=new Uint8Array([47]),eg=Hr("5768b3b6a7db56d21d1abff40d41cebfc83448fed8d7e9b06ec0d3b073f28f7b");function Qv(t,e){const n=Math.floor(e/8),r=e%8;t[n]=t[n]|1<<r}function tg(t,e){const n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}var Ao=class Mh{obfuscationKey=new Uint8Array(32);selfAddress=null;targetAddress=new Uint8Array(32);metadata=null;path=new Uint8Array(0);forks=new Map;parent=null;type=null;encrypt=!1;constructor(e){e?.encrypt&&(this.encrypt=!0),e?.targetAddress?this.targetAddress=e.targetAddress:this.encrypt&&(this.targetAddress=new Uint8Array(64)),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),this.type=e?.type??null}get fullPath(){return Se.concat(this.parent?.fullPath??new Uint8Array(0),this.path)}get fullPathString(){return Hv.decode(this.fullPath)}async marshal(){for(const l of this.forks.values())l.node.selfAddress||(l.node.selfAddress=(await l.node.calculateSelfAddress()).toUint8Array());this.encrypt&&to(this.obfuscationKey,new Uint8Array(32))&&(this.obfuscationKey=new Uint8Array(32),crypto.getRandomValues(this.obfuscationKey));const e=!to(this.targetAddress,new Uint8Array(this.targetAddress.length));let n=0;if(e)n=this.targetAddress.length;else for(const l of this.forks.values())if(l.node.selfAddress&&l.node.selfAddress.length>0){n=l.node.selfAddress.length;break}const r=new Uint8Array(32);r.set(eg,0),r.set(bx(n),31);const i=e?this.targetAddress:new Uint8Array(n),s=new Uint8Array(32);for(const l of this.forks.keys())Qv(s,l);const a=[];for(let l=0;l<256;l++)tg(s,l)&&a.push(this.forks.get(l).marshal());const c=Xp(Se.concat(r,i,s,...a),this.obfuscationKey);return Se.concat(this.obfuscationKey,c)}static unmarshalFromData(e,n){if(e.length<64)throw new Error("MantarayNode#unmarshalFromData data too short");const r=e.subarray(0,32),i=Xp(e.subarray(32),r),s=new Fh(i),a=s.read(31);if(!to(a,eg.slice(0,31)))throw new Error("MantarayNode#unmarshalFromData invalid version hash");const c=_h(s.read(1)),l=s.read(c),h=new Mh({selfAddress:n,targetAddress:l,obfuscationKey:r}),d=s.read(32),g=c===0?32:c;for(let m=0;m<256;m++)if(tg(d,m)){const w=Ol.unmarshal(s,g);h.forks.set(m,w),w.node.parent=h}return h}addFork(e,n,r){this.selfAddress=null,this.type=null,e=e instanceof Uint8Array?e:ma.encode(e);let i=this;for(;e.length;){const s=e.slice(0,30);e=e.slice(30);const a=e.length===0,[c,l]=i.findClosest(s),h=s.slice(l.length);if(l.length&&(i=c),!h.length)continue;const d=new Ol(h,new Mh({targetAddress:a?new Ue(n).toUint8Array():void 0,metadata:a?r:void 0,path:h,encrypt:this.encrypt})),g=c.forks.get(h[0]);if(g){const m=Ol.split(d,g);i.forks.set(h[0],m),m.node.parent=i}else i.forks.set(h[0],d),d.node.parent=i;i.selfAddress=null,i.type=null,i=d.node}}removeFork(e){if(this.selfAddress=null,this.type=null,e=e instanceof Uint8Array?e:ma.encode(e),e.length===0)throw new Error("MantarayNode#removeFork path cannot be empty");const n=this.find(e);if(!n)throw new Error("MantarayNode#removeFork fork not found");const[r,i]=this.findClosest(e.slice(0,e.length-1));r.forks.delete(e.slice(i.length)[0]);for(const s of n.forks.values())r.addFork(Se.concat(n.path,s.prefix),s.node.targetAddress,s.node.metadata)}async calculateSelfAddress(){if(this.selfAddress)return new Ue(this.selfAddress);if(this.encrypt)throw new Error("MantarayNode#calculateSelfAddress is not supported for encrypted nodes - use saveRecursively");return(await Lh.root(await this.marshal())).hash()}async saveRecursively(e){for(const s of this.forks.values())await s.node.saveRecursively(e);const n=async s=>{for(const{chunk:a,key:c}of s)await e(a,c);return[]},r=new Lh(n,void 0,this.encrypt);await r.append(await this.marshal());const i=await r.finalize();if(this.encrypt){const{address:s,key:a}=i.encryptedHash();return await e(i,a),this.selfAddress=Se.concat(s.toUint8Array(),a),{reference:this.selfAddress,rootChunk:i,encryptionKey:a}}return await e(i),this.selfAddress=i.hash().toUint8Array(),{reference:this.selfAddress,rootChunk:i}}find(e){const n=e instanceof Uint8Array?e:ma.encode(e),[r,i]=this.findClosest(n);return i.length===n.length?r:null}findClosest(e,n=new Uint8Array){if(e=e instanceof Uint8Array?e:ma.encode(e),e.length===0)return[this,n];const r=this.forks.get(e[0]);return r&&dx(r.prefix,e).length===r.prefix.length?r.node.findClosest(e.slice(r.prefix.length),Se.concat(n,r.prefix)):[this,n]}collect(e=[]){for(const n of this.forks.values())to(n.node.targetAddress,new Uint8Array(n.node.targetAddress.length))||e.push(n.node),n.node.collect(e);return e}collectAndMap(){const e={};for(const n of this.collect())e[n.fullPathString]=new Ue(n.targetAddress).toHex();return e}determineType(){let e=0;const n=new Uint8Array(this.targetAddress.length);return(!to(this.targetAddress,n)||this.forks.size===0)&&(e|=qv),this.forks.size>0&&(e|=Zv),fv(this.path,Wv)>0&&(e|=Kv),this.metadata&&(e|=Jv),e}},Yv=16,Xv=new TextEncoder,e5=new TextDecoder;function t5(t,e){return(t&e)===e}function n5(t,e,n){const r=t.length%e;if(r===0)return t;const i=new Uint8Array(t.length+e-r).fill(n);return i.set(t,0),i}var Ol=class ao{prefix;node;constructor(e,n){this.prefix=e,this.node=n}static split(e,n){const r=dx(e.prefix,n.prefix);if(r.length===e.prefix.length){const c=n.prefix.slice(r.length);return n.node.path=n.prefix.slice(r.length),n.prefix=n.prefix.slice(r.length),n.node.parent=e.node,e.node.forks.set(c[0],n),e}if(r.length===n.prefix.length){const c=e.prefix.slice(r.length);return e.node.path=e.prefix.slice(r.length),e.prefix=e.prefix.slice(r.length),e.node.parent=n.node,n.node.forks.set(c[0],e),n}const i=new Ao({path:r,encrypt:e.node.encrypt}),s=new ao(e.prefix.slice(r.length),e.node),a=new ao(n.prefix.slice(r.length),n.node);return e.node.path=e.prefix.slice(r.length),n.node.path=n.prefix.slice(r.length),e.prefix=e.prefix.slice(r.length),n.prefix=n.prefix.slice(r.length),i.forks.set(s.prefix[0],s),i.forks.set(a.prefix[0],a),s.node.parent=i,a.node.parent=i,new ao(r,i)}marshal(){if(!this.node.selfAddress)throw new Error("Fork#marshal node.selfAddress is not set");const e=[];if(e.push(new Uint8Array([this.node.type??this.node.determineType()])),e.push(bx(this.prefix.length)),e.push(this.prefix),this.prefix.length<30&&e.push(new Uint8Array(30-this.prefix.length)),e.push(this.node.selfAddress),this.node.metadata){const n=n5(Se.concat(new Uint8Array([0,0]),Xv.encode(JSON.stringify(this.node.metadata))),32,10);n.set(mv(n.length-2,"BE"),0),e.push(n)}return Se.concat(...e)}static unmarshal(e,n){const r=_h(e.read(1)),i=_h(e.read(1)),s=e.read(i);i<30&&e.read(30-i);const a=e.read(n);let c;if(t5(r,Yv)){const l=bv(e.read(2),"BE");if(l>e.max())throw new Error("Fork#unmarshal not enough bytes for metadata");c=JSON.parse(e5.decode(e.read(l)))}return new ao(s,new Ao({selfAddress:a,metadata:c,path:s,type:r}))}};function r5(t,e,n){return t/Math.pow(2,e-n)}function Cx(t){return 4096*2**t}var i5=.9;function rc(t){const e={B:1,kB:1e3,MB:1e6,GB:1e9,TB:1e12,PB:1e15},n=t.match(/^([\d.]+)\s*(B|kB|MB|GB|TB|PB)$/);if(!n)throw new Error(`Invalid size format: ${t}`);return Math.ceil(parseFloat(n[1])*e[n[2]])}var _x=[[17,"0.00004089 GB"],[18,"0.00609 GB"],[19,"0.10249 GB"],[20,"0.62891 GB"],[21,"2.38 GB"],[22,"7.07 GB"],[23,"18.24 GB"],[24,"43.04 GB"],[25,"96.5 GB"],[26,"208.52 GB"],[27,"435.98 GB"],[28,"908.81 GB"],[29,"1870 GB"],[30,"3810 GB"],[31,"7730 GB"],[32,"15610 GB"],[33,"31430 GB"],[34,"63150 GB"]],Dx=[[[17,"44.70 kB"],[18,"6.66 MB"],[19,"112.06 MB"],[20,"687.62 MB"],[21,"2.60 GB"],[22,"7.73 GB"],[23,"19.94 GB"],[24,"47.06 GB"],[25,"105.51 GB"],[26,"227.98 GB"],[27,"476.68 GB"],[28,"993.65 GB"],[29,"2.04 TB"],[30,"4.17 TB"],[31,"8.45 TB"],[32,"17.07 TB"],[33,"34.36 TB"],[34,"69.04 TB"],[35,"138.54 TB"],[36,"277.72 TB"],[37,"556.35 TB"],[38,"1.11 PB"],[39,"2.23 PB"],[40,"4.46 PB"],[41,"8.93 PB"]],[[17,"41.56 kB"],[18,"6.19 MB"],[19,"104.18 MB"],[20,"639.27 MB"],[21,"2.41 GB"],[22,"7.18 GB"],[23,"18.54 GB"],[24,"43.75 GB"],[25,"98.09 GB"],[26,"211.95 GB"],[27,"443.16 GB"],[28,"923.78 GB"],[29,"1.90 TB"],[30,"3.88 TB"],[31,"7.86 TB"],[32,"15.87 TB"],[33,"31.94 TB"],[34,"64.19 TB"],[35,"128.80 TB"],[36,"258.19 TB"],[37,"517.23 TB"],[38,"1.04 PB"],[39,"2.07 PB"],[40,"4.15 PB"],[41,"8.30 PB"]],[[17,"37.37 kB"],[18,"5.57 MB"],[19,"93.68 MB"],[20,"574.81 MB"],[21,"2.17 GB"],[22,"6.46 GB"],[23,"16.67 GB"],[24,"39.34 GB"],[25,"88.20 GB"],[26,"190.58 GB"],[27,"398.47 GB"],[28,"830.63 GB"],[29,"1.71 TB"],[30,"3.49 TB"],[31,"7.07 TB"],[32,"14.27 TB"],[33,"28.72 TB"],[34,"57.71 TB"],[35,"115.81 TB"],[36,"232.16 TB"],[37,"465.07 TB"],[38,"931.23 TB"],[39,"1.86 PB"],[40,"3.73 PB"],[41,"7.46 PB"]],[[17,"33.88 kB"],[18,"5.05 MB"],[19,"84.92 MB"],[20,"521.09 MB"],[21,"1.97 GB"],[22,"5.86 GB"],[23,"15.11 GB"],[24,"35.66 GB"],[25,"79.96 GB"],[26,"172.77 GB"],[27,"361.23 GB"],[28,"753.00 GB"],[29,"1.55 TB"],[30,"3.16 TB"],[31,"6.41 TB"],[32,"12.93 TB"],[33,"26.04 TB"],[34,"52.32 TB"],[35,"104.99 TB"],[36,"210.46 TB"],[37,"421.61 TB"],[38,"844.20 TB"],[39,"1.69 PB"],[40,"3.38 PB"],[41,"6.77 PB"]],[[17,"13.27 kB"],[18,"1.98 MB"],[19,"33.27 MB"],[20,"204.14 MB"],[21,"771.13 MB"],[22,"2.29 GB"],[23,"5.92 GB"],[24,"13.97 GB"],[25,"31.32 GB"],[26,"67.68 GB"],[27,"141.51 GB"],[28,"294.99 GB"],[29,"606.90 GB"],[30,"1.24 TB"],[31,"2.51 TB"],[32,"5.07 TB"],[33,"10.20 TB"],[34,"20.50 TB"],[35,"41.13 TB"],[36,"82.45 TB"],[37,"165.17 TB"],[38,"330.72 TB"],[39,"661.97 TB"],[40,"1.32 PB"],[41,"2.65 PB"]]],Fx=[[[17,"44.35 kB"],[18,"6.61 MB"],[19,"111.18 MB"],[20,"682.21 MB"],[21,"2.58 GB"],[22,"7.67 GB"],[23,"19.78 GB"],[24,"46.69 GB"],[25,"104.68 GB"],[26,"226.19 GB"],[27,"472.93 GB"],[28,"985.83 GB"],[29,"2.03 TB"],[30,"4.14 TB"],[31,"8.39 TB"],[32,"16.93 TB"],[33,"34.09 TB"],[34,"68.50 TB"],[35,"137.45 TB"],[36,"275.53 TB"],[37,"551.97 TB"],[38,"1.11 PB"],[39,"2.21 PB"],[40,"4.43 PB"],[41,"8.86 PB"]],[[17,"40.89 kB"],[18,"6.09 MB"],[19,"102.49 MB"],[20,"628.91 MB"],[21,"2.38 GB"],[22,"7.07 GB"],[23,"18.24 GB"],[24,"43.04 GB"],[25,"96.50 GB"],[26,"208.52 GB"],[27,"435.98 GB"],[28,"908.81 GB"],[29,"1.87 TB"],[30,"3.81 TB"],[31,"7.73 TB"],[32,"15.61 TB"],[33,"31.43 TB"],[34,"63.15 TB"],[35,"126.71 TB"],[36,"254.01 TB"],[37,"508.85 TB"],[38,"1.02 PB"],[39,"2.04 PB"],[40,"4.08 PB"],[41,"8.17 PB"]],[[17,"36.73 kB"],[18,"5.47 MB"],[19,"92.07 MB"],[20,"564.95 MB"],[21,"2.13 GB"],[22,"6.35 GB"],[23,"16.38 GB"],[24,"38.66 GB"],[25,"86.69 GB"],[26,"187.31 GB"],[27,"391.64 GB"],[28,"816.39 GB"],[29,"1.68 TB"],[30,"3.43 TB"],[31,"6.94 TB"],[32,"14.02 TB"],[33,"28.23 TB"],[34,"56.72 TB"],[35,"113.82 TB"],[36,"228.18 TB"],[37,"457.10 TB"],[38,"915.26 TB"],[39,"1.83 PB"],[40,"3.67 PB"],[41,"7.34 PB"]],[[17,"33.26 kB"],[18,"4.96 MB"],[19,"83.38 MB"],[20,"511.65 MB"],[21,"1.93 GB"],[22,"5.75 GB"],[23,"14.84 GB"],[24,"35.02 GB"],[25,"78.51 GB"],[26,"169.64 GB"],[27,"354.69 GB"],[28,"739.37 GB"],[29,"1.52 TB"],[30,"3.10 TB"],[31,"6.29 TB"],[32,"12.70 TB"],[33,"25.57 TB"],[34,"51.37 TB"],[35,"103.08 TB"],[36,"206.65 TB"],[37,"413.98 TB"],[38,"828.91 TB"],[39,"1.66 PB"],[40,"3.32 PB"],[41,"6.64 PB"]],[[17,"13.17 kB"],[18,"1.96 MB"],[19,"33.01 MB"],[20,"202.53 MB"],[21,"765.05 MB"],[22,"2.28 GB"],[23,"5.87 GB"],[24,"13.86 GB"],[25,"31.08 GB"],[26,"67.15 GB"],[27,"140.40 GB"],[28,"292.67 GB"],[29,"602.12 GB"],[30,"1.23 TB"],[31,"2.49 TB"],[32,"5.03 TB"],[33,"10.12 TB"],[34,"20.34 TB"],[35,"40.80 TB"],[36,"81.80 TB"],[37,"163.87 TB"],[38,"328.11 TB"],[39,"656.76 TB"],[40,"1.31 PB"],[41,"2.63 PB"]]];function Ga(t,e,n){if(t<17)return 0;if(e!==void 0&&n!==void 0){const i=(e?Fx:Dx)[n]?.find(([s])=>s===t);if(i)return rc(i[1])}else{const r=_x.find(([i])=>i===t);if(r)return rc(r[1])}return Math.ceil(Cx(t)*i5)}function zF(t,e){const n=new Map;for(let r=17;r<35;r++)n.set(r,Ga(r,t,e));return n}function s5(t,e,n){if(e!==void 0&&n!==void 0){const i=(e?Fx:Dx)[n]?.find(([,s])=>t<=rc(s));if(i)return i[0]}else for(const[r,i]of _x)if(t<=rc(i))return r;return 35}function o5(t,e,n,r){if(t.length!==65)throw new Error("invalid signature length");if(e.length!==32)throw new Error("invalid batch ID length");if(n.length!==8)throw new Error("invalid timestamp length");if(r.length!==8)throw new Error("invalid index length");return new Se(Se.concat(e,r,n,t))}function a5(t){return o5(t.signature.toUint8Array(),t.batchId.toUint8Array(),t.timestamp,t.index)}var ng;function ne(t,e,n){function r(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(t))return;c._zod.traits.add(t),e(c,l);const h=a.prototype,d=Object.keys(h);for(let g=0;g<d.length;g++){const m=d[g];m in c||(c[m]=h[m].bind(c))}}const i=n?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:t});function a(c){var l;const h=n?.Parent?new s:this;r(h,c),(l=h._zod).deferred??(l.deferred=[]);for(const d of h._zod.deferred)d();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}class os extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ux extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(ng=globalThis).__zod_globalConfig??(ng.__zod_globalConfig={});const Ed=globalThis.__zod_globalConfig;function vr(t){return Ed}function Lx(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function $h(t,e){return typeof e=="bigint"?e.toString():e}function vd(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Bd(t){return t==null}function Rd(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function c5(t,e){const n=t/e,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const rg=Symbol("evaluating");function et(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==rg)return r===void 0&&(r=rg,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Ni(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xr(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function ig(t){return JSON.stringify(t)}function u5(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Mx="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ic(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const l5=vd(()=>{if(Ed.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ms(t){if(ic(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(ic(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function $x(t){return ms(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const f5=new Set(["string","number","symbol"]);function bs(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function Ie(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 h5(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const d5={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 p5(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Xr(t._zod.def,{get shape(){const a={};for(const c in e){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&(a[c]=n.shape[c])}return Ni(this,"shape",a),a},checks:[]});return ei(t,s)}function g5(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Xr(t._zod.def,{get shape(){const a={...t._zod.def.shape};for(const c in e){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&delete a[c]}return Ni(this,"shape",a),a},checks:[]});return ei(t,s)}function m5(t,e){if(!ms(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=t._zod.def.shape;for(const a in e)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Xr(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return Ni(this,"shape",s),s}});return ei(t,i)}function b5(t,e){if(!ms(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Xr(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return Ni(this,"shape",r),r}});return ei(t,n)}function y5(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Xr(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Ni(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ei(t,n)}function x5(t,e,n){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=Xr(e._zod.def,{get shape(){const c=e._zod.def.shape,l={...c};if(n)for(const h in n){if(!(h in c))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(l[h]=t?new t({type:"optional",innerType:c[h]}):c[h])}else for(const h in c)l[h]=t?new t({type:"optional",innerType:c[h]}):c[h];return Ni(this,"shape",l),l},checks:[]});return ei(e,a)}function w5(t,e,n){const r=Xr(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new t({type:"nonoptional",innerType:i[a]}))}else for(const a in i)s[a]=new t({type:"nonoptional",innerType:i[a]});return Ni(this,"shape",s),s}});return ei(e,r)}function es(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function A5(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue===!1)return!0;return!1}function qr(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function ba(t){return typeof t=="string"?t:t?.message}function Br(t,e,n){const r=t.message?t.message:ba(t.inst?._zod.def?.error?.(t))??ba(e?.error?.(t))??ba(n.customError?.(t))??ba(n.localeError?.(t))??"Invalid input",{inst:i,continue:s,input:a,...c}=t;return c.path??(c.path=[]),c.message=r,e?.reportInput&&(c.input=a),c}function Td(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Eo(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const zx=(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,$h,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Gx=ne("$ZodError",zx),Tc=ne("$ZodError",zx,{Parent:Error});function E5(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}function v5(t,e=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...s,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...s,...a.path]);else{const c=[...s,...a.path];if(c.length===0)n._errors.push(e(a));else{let l=n,h=0;for(;h<c.length;){const d=c[h];h===c.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(e(a))):l[d]=l[d]||{_errors:[]},l=l[d],h++}}}};return r(t),n}const Sc=t=>(e,n,r,i)=>{const s=r?{...r,async:!1}:{async:!1},a=e._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new os;if(a.issues.length){const c=new(i?.Err??t)(a.issues.map(l=>Br(l,s,vr())));throw Mx(c,i?.callee),c}return a.value},sg=Sc(Tc),Ic=t=>async(e,n,r,i)=>{const s=r?{...r,async:!0}:{async:!0};let a=e._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new(i?.Err??t)(a.issues.map(l=>Br(l,s,vr())));throw Mx(c,i?.callee),c}return a.value},og=Ic(Tc),Oc=t=>(e,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new os;return s.issues.length?{success:!1,error:new(t??Gx)(s.issues.map(a=>Br(a,i,vr())))}:{success:!0,data:s.value}},B5=Oc(Tc),Pc=t=>async(e,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=e._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>Br(a,i,vr())))}:{success:!0,data:s.value}},R5=Pc(Tc),T5=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Sc(t)(e,n,i)},S5=t=>(e,n,r)=>Sc(t)(e,n,r),I5=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ic(t)(e,n,i)},O5=t=>async(e,n,r)=>Ic(t)(e,n,r),P5=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Oc(t)(e,n,i)},k5=t=>(e,n,r)=>Oc(t)(e,n,r),N5=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Pc(t)(e,n,i)},C5=t=>async(e,n,r)=>Pc(t)(e,n,r),_5=/^[cC][0-9a-z]{6,}$/,D5=/^[0-9a-z]+$/,F5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,U5=/^[0-9a-vA-V]{20}$/,L5=/^[A-Za-z0-9]{27}$/,M5=/^[a-zA-Z0-9_-]{21}$/,$5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,z5=/^([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})$/,ag=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)$/,G5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,V5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function j5(){return new RegExp(V5,"u")}const H5=/^(?:(?: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])$/,q5=/^(([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}|:))$/,Z5=/^((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])$/,K5=/^(([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])$/,J5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vx=/^[A-Za-z0-9_-]*$/,W5=/^https?$/,Q5=/^\+[1-9]\d{6,14}$/,jx="(?:(?:\\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])))",Y5=new RegExp(`^${jx}$`);function Hx(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 X5(t){return new RegExp(`^${Hx(t)}$`)}function e7(t){const e=Hx({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${jx}T(?:${r})$`)}const t7=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},n7=/^-?\d+n?$/,r7=/^-?\d+$/,qx=/^-?\d+(?:\.\d+)?$/,i7=/^(?:true|false)$/i,s7=/^[^A-Z]*$/,o7=/^[^a-z]*$/,an=ne("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Zx={number:"number",bigint:"bigint",object:"date"},Kx=ne("$ZodCheckLessThan",(t,e)=>{an.init(t,e);const n=Zx[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Jx=ne("$ZodCheckGreaterThan",(t,e)=>{an.init(t,e);const n=Zx[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),a7=ne("$ZodCheckMultipleOf",(t,e)=>{an.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):c5(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),c7=ne("$ZodCheckNumberFormat",(t,e)=>{an.init(t,e),e.format=e.format||"float64";const n=e.format?.includes("int"),r=n?"int":"number",[i,s]=d5[e.format];t._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,n&&(c.pattern=r7)}),t._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),u7=ne("$ZodCheckMaxLength",(t,e)=>{var n;an.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Bd(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const a=Td(i);r.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),l7=ne("$ZodCheckMinLength",(t,e)=>{var n;an.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Bd(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const a=Td(i);r.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),f7=ne("$ZodCheckLengthEquals",(t,e)=>{var n;an.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Bd(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const a=Td(i),c=s>e.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),kc=ne("$ZodCheckStringFormat",(t,e)=>{var n,r;an.init(t,e),t._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.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})}):(r=t._zod).check??(r.check=()=>{})}),h7=ne("$ZodCheckRegex",(t,e)=>{kc.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),d7=ne("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=s7),kc.init(t,e)}),p7=ne("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=o7),kc.init(t,e)}),g7=ne("$ZodCheckIncludes",(t,e)=>{an.init(t,e);const n=bs(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),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})}}),m7=ne("$ZodCheckStartsWith",(t,e)=>{an.init(t,e);const n=new RegExp(`^${bs(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),b7=ne("$ZodCheckEndsWith",(t,e)=>{an.init(t,e);const n=new RegExp(`.*${bs(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),y7=ne("$ZodCheckOverwrite",(t,e)=>{an.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class x7{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 r=e.split(`
|
|
13
|
+
`).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const e=Function,n=this?.args,i=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...n,i.join(`
|
|
14
|
+
`))}}const w7={major:4,minor:4,patch:3},tt=ne("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=w7;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const i of r)for(const s of i._zod.onattach)s(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const i=(a,c,l)=>{let h=es(a),d;for(const g of c){if(g._zod.def.when){if(A5(a)||!g._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,w=g._zod.check(a);if(w instanceof Promise&&l?.async===!1)throw new os;if(d||w instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await w,a.issues.length!==m&&(h||(h=es(a,m)))});else{if(a.issues.length===m)continue;h||(h=es(a,m))}}return d?d.then(()=>a):a},s=(a,c,l)=>{if(es(a))return a.aborted=!0,a;const h=i(c,r,l);if(h instanceof Promise){if(l.async===!1)throw new os;return h.then(d=>t._zod.parse(d,l))}return t._zod.parse(h,l)};t._zod.run=(a,c)=>{if(c.skipChecks)return t._zod.parse(a,c);if(c.direction==="backward"){const h=t._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(d=>s(d,a,c)):s(h,a,c)}const l=t._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new os;return l.then(h=>i(h,r,c))}return i(l,r,c)}}et(t,"~standard",()=>({validate:i=>{try{const s=B5(t,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R5(t,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Sd=ne("$ZodString",(t,e)=>{tt.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??t7(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),dt=ne("$ZodStringFormat",(t,e)=>{kc.init(t,e),Sd.init(t,e)}),A7=ne("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=z5),dt.init(t,e)}),E7=ne("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=ag(r))}else e.pattern??(e.pattern=ag());dt.init(t,e)}),v7=ne("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=G5),dt.init(t,e)}),B7=ne("$ZodURL",(t,e)=>{dt.init(t,e),t._zod.check=n=>{try{const r=n.value.trim();if(!e.normalize&&e.protocol?.source===W5.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}const i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.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)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),R7=ne("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=j5()),dt.init(t,e)}),T7=ne("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=M5),dt.init(t,e)}),S7=ne("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=_5),dt.init(t,e)}),I7=ne("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=D5),dt.init(t,e)}),O7=ne("$ZodULID",(t,e)=>{e.pattern??(e.pattern=F5),dt.init(t,e)}),P7=ne("$ZodXID",(t,e)=>{e.pattern??(e.pattern=U5),dt.init(t,e)}),k7=ne("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=L5),dt.init(t,e)}),N7=ne("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=e7(e)),dt.init(t,e)}),C7=ne("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Y5),dt.init(t,e)}),_7=ne("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=X5(e)),dt.init(t,e)}),D7=ne("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=$5),dt.init(t,e)}),F7=ne("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=H5),dt.init(t,e),t._zod.bag.format="ipv4"}),U7=ne("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=q5),dt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),L7=ne("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Z5),dt.init(t,e)}),M7=ne("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=K5),dt.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Wx(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const $7=ne("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=J5),dt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{Wx(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function z7(t){if(!Vx.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Wx(n)}const G7=ne("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Vx),dt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{z7(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),V7=ne("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Q5),dt.init(t,e)});function j7(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const H7=ne("$ZodJWT",(t,e)=>{dt.init(t,e),t._zod.check=n=>{j7(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Qx=ne("$ZodNumber",(t,e)=>{tt.init(t,e),t._zod.pattern=t._zod.bag.pattern??qx,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),n}}),q7=ne("$ZodNumberFormat",(t,e)=>{c7.init(t,e),Qx.init(t,e)}),Z7=ne("$ZodBoolean",(t,e)=>{tt.init(t,e),t._zod.pattern=i7,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),K7=ne("$ZodBigInt",(t,e)=>{tt.init(t,e),t._zod.pattern=n7,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}}),J7=ne("$ZodAny",(t,e)=>{tt.init(t,e),t._zod.parse=n=>n}),W7=ne("$ZodUnknown",(t,e)=>{tt.init(t,e),t._zod.parse=n=>n}),Q7=ne("$ZodNever",(t,e)=>{tt.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function cg(t,e,n){t.issues.length&&e.issues.push(...qr(n,t.issues)),e.value[n]=t.value}const Y7=ne("$ZodArray",(t,e)=>{tt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const s=[];for(let a=0;a<i.length;a++){const c=i[a],l=e.element._zod.run({value:c,issues:[]},r);l instanceof Promise?s.push(l.then(h=>cg(h,n,a))):cg(l,n,a)}return s.length?Promise.all(s).then(()=>n):n}});function sc(t,e,n,r,i,s){const a=n in r;if(t.issues.length){if(i&&s&&!a)return;e.issues.push(...qr(n,t.issues))}if(!a&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?a&&(e.value[n]=void 0):e.value[n]=t.value}function Yx(t){const e=Object.keys(t.shape);for(const r of e)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=h5(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Xx(t,e,n,r,i,s){const a=[],c=i.keySet,l=i.catchall._zod,h=l.def.type,d=l.optin==="optional",g=l.optout==="optional";for(const m in e){if(m==="__proto__"||c.has(m))continue;if(h==="never"){a.push(m);continue}const w=l.run({value:e[m],issues:[]},r);w instanceof Promise?t.push(w.then(v=>sc(v,n,m,e,d,g))):sc(w,n,m,e,d,g)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const X7=ne("$ZodObject",(t,e)=>{if(tt.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const c=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...c};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=vd(()=>Yx(e));et(t._zod,"propValues",()=>{const c=e.shape,l={};for(const h in c){const d=c[h]._zod;if(d.values){l[h]??(l[h]=new Set);for(const g of d.values)l[h].add(g)}}return l});const i=ic,s=e.catchall;let a;t._zod.parse=(c,l)=>{a??(a=r.value);const h=c.value;if(!i(h))return c.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),c;c.value={};const d=[],g=a.shape;for(const m of a.keys){const w=g[m],v=w._zod.optin==="optional",E=w._zod.optout==="optional",S=w._zod.run({value:h[m],issues:[]},l);S instanceof Promise?d.push(S.then(A=>sc(A,c,m,h,v,E))):sc(S,c,m,h,v,E)}return s?Xx(d,h,c,l,r.value,t):d.length?Promise.all(d).then(()=>c):c}}),e9=ne("$ZodObjectJIT",(t,e)=>{X7.init(t,e);const n=t._zod.parse,r=vd(()=>Yx(e)),i=m=>{const w=new x7(["shape","payload","ctx"]),v=r.value,E=T=>{const O=ig(T);return`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`};w.write("const input = payload.value;");const S=Object.create(null);let A=0;for(const T of v.keys)S[T]=`key_${A++}`;w.write("const newResult = {};");for(const T of v.keys){const O=S[T],k=ig(T),_=m[T],D=_?._zod?.optin==="optional",$=_?._zod?.optout==="optional";w.write(`const ${O} = ${E(T)};`),D&&$?w.write(`
|
|
15
|
+
if (${O}.issues.length) {
|
|
16
|
+
if (${k} in input) {
|
|
17
|
+
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
18
|
+
...iss,
|
|
19
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
20
|
+
})));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (${O}.value === undefined) {
|
|
25
|
+
if (${k} in input) {
|
|
26
|
+
newResult[${k}] = undefined;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
newResult[${k}] = ${O}.value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
`):D?w.write(`
|
|
33
|
+
if (${O}.issues.length) {
|
|
34
|
+
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
35
|
+
...iss,
|
|
36
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
37
|
+
})));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (${O}.value === undefined) {
|
|
41
|
+
if (${k} in input) {
|
|
42
|
+
newResult[${k}] = undefined;
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
newResult[${k}] = ${O}.value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
`):w.write(`
|
|
49
|
+
const ${O}_present = ${k} in input;
|
|
50
|
+
if (${O}.issues.length) {
|
|
51
|
+
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
52
|
+
...iss,
|
|
53
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
54
|
+
})));
|
|
55
|
+
}
|
|
56
|
+
if (!${O}_present && !${O}.issues.length) {
|
|
57
|
+
payload.issues.push({
|
|
58
|
+
code: "invalid_type",
|
|
59
|
+
expected: "nonoptional",
|
|
60
|
+
input: undefined,
|
|
61
|
+
path: [${k}]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (${O}_present) {
|
|
66
|
+
if (${O}.value === undefined) {
|
|
67
|
+
newResult[${k}] = undefined;
|
|
68
|
+
} else {
|
|
69
|
+
newResult[${k}] = ${O}.value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
`)}w.write("payload.value = newResult;"),w.write("return payload;");const I=w.compile();return(T,O)=>I(m,T,O)};let s;const a=ic,c=!Ed.jitless,h=c&&l5.value,d=e.catchall;let g;t._zod.parse=(m,w)=>{g??(g=r.value);const v=m.value;return a(v)?c&&h&&w?.async===!1&&w.jitless!==!0?(s||(s=i(e.shape)),m=s(m,w),d?Xx([],v,m,w,g,t):m):n(m,w):(m.issues.push({expected:"object",code:"invalid_type",input:v,inst:t}),m)}});function ug(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const i=t.filter(s=>!es(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(a=>Br(a,r,vr())))}),e)}const t9=ne("$ZodUnion",(t,e)=>{tt.init(t,e),et(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),et(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),et(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),et(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Rd(i.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const a=[];for(const c of e.options){const l=c._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)a.push(l),s=!0;else{if(l.issues.length===0)return l;a.push(l)}}return s?Promise.all(a).then(c=>ug(c,r,t,i)):ug(a,r,t,i)}}),n9=ne("$ZodIntersection",(t,e)=>{tt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,s=e.left._zod.run({value:i,issues:[]},r),a=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([l,h])=>lg(n,l,h)):lg(n,s,a)}});function zh(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(ms(t)&&ms(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),i={...t,...e};for(const s of r){const a=zh(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};i[s]=a.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=e[r],a=zh(i,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function lg(t,e,n){const r=new Map;let i;for(const c of e.issues)if(c.code==="unrecognized_keys"){i??(i=c);for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(c);const s=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&i&&t.issues.push({...i,keys:s}),es(t))return t;const a=zh(e.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}const e1=ne("$ZodTuple",(t,e)=>{tt.init(t,e);const n=e.items;t._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:t,expected:"tuple",code:"invalid_type"}),r;r.value=[];const a=[],c=fg(n,"optin"),l=fg(n,"optout");if(!e.rest){if(s.length<c)return r.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:t,origin:"array"}),r;s.length>n.length&&r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:t,origin:"array"})}const h=new Array(n.length);for(let d=0;d<n.length;d++){const g=n[d]._zod.run({value:s[d],issues:[]},i);g instanceof Promise?a.push(g.then(m=>{h[d]=m})):h[d]=g}if(e.rest){let d=n.length-1;const g=s.slice(n.length);for(const m of g){d++;const w=e.rest._zod.run({value:m,issues:[]},i);w instanceof Promise?a.push(w.then(v=>hg(v,r,d))):hg(w,r,d)}}return a.length?Promise.all(a).then(()=>dg(h,r,n,s,l)):dg(h,r,n,s,l)}});function fg(t,e){for(let n=t.length-1;n>=0;n--)if(t[n]._zod[e]!=="optional")return n+1;return 0}function hg(t,e,n){t.issues.length&&e.issues.push(...qr(n,t.issues)),e.value[n]=t.value}function dg(t,e,n,r,i){for(let s=0;s<n.length;s++){const a=t[s],c=s<r.length;if(a.issues.length){if(!c&&s>=i){e.value.length=s;break}e.issues.push(...qr(s,a.issues))}e.value[s]=a.value}for(let s=e.value.length-1;s>=r.length&&(n[s]._zod.optout==="optional"&&e.value[s]===void 0);s--)e.value.length=s;return e}const r9=ne("$ZodRecord",(t,e)=>{tt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!ms(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const s=[],a=e.keyType._zod.values;if(a){n.value={};const c=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){c.add(typeof h=="number"?h.toString():h);const d=e.keyType._zod.run({value:h,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(w=>Br(w,r,vr())),input:h,path:[h],inst:t});continue}const g=d.value,m=e.valueType._zod.run({value:i[h],issues:[]},r);m instanceof Promise?s.push(m.then(w=>{w.issues.length&&n.issues.push(...qr(h,w.issues)),n.value[g]=w.value})):(m.issues.length&&n.issues.push(...qr(h,m.issues)),n.value[g]=m.value)}let l;for(const h in i)c.has(h)||(l=l??[],l.push(h));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{n.value={};for(const c of Reflect.ownKeys(i)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,c))continue;let l=e.keyType._zod.run({value:c,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&qx.test(c)&&l.issues.length){const g=e.keyType._zod.run({value:Number(c),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){e.mode==="loose"?n.value[c]=i[c]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>Br(g,r,vr())),input:c,path:[c],inst:t});continue}const d=e.valueType._zod.run({value:i[c],issues:[]},r);d instanceof Promise?s.push(d.then(g=>{g.issues.length&&n.issues.push(...qr(c,g.issues)),n.value[l.value]=g.value})):(d.issues.length&&n.issues.push(...qr(c,d.issues)),n.value[l.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),i9=ne("$ZodEnum",(t,e)=>{tt.init(t,e);const n=Lx(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>f5.has(typeof i)).map(i=>typeof i=="string"?bs(i):i.toString()).join("|")})$`),t._zod.parse=(i,s)=>{const a=i.value;return r.has(a)||i.issues.push({code:"invalid_value",values:n,input:a,inst:t}),i}}),s9=ne("$ZodLiteral",(t,e)=>{if(tt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?bs(r):r?bs(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),o9=ne("$ZodTransform",(t,e)=>{tt.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ux(t.constructor.name);const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(n.value=a,n.fallback=!0,n));if(i instanceof Promise)throw new os;return n.value=i,n.fallback=!0,n}});function pg(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const t1=ne("$ZodOptional",(t,e)=>{tt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",et(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),et(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Rd(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const i=n.value,s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>pg(a,i)):pg(s,i)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),a9=ne("$ZodExactOptional",(t,e)=>{t1.init(t,e),et(t._zod,"values",()=>e.innerType._zod.values),et(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),c9=ne("$ZodNullable",(t,e)=>{tt.init(t,e),et(t._zod,"optin",()=>e.innerType._zod.optin),et(t._zod,"optout",()=>e.innerType._zod.optout),et(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${Rd(n.source)}|null)$`):void 0}),et(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),u9=ne("$ZodDefault",(t,e)=>{tt.init(t,e),t._zod.optin="optional",et(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>gg(s,e)):gg(i,e)}});function gg(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const l9=ne("$ZodPrefault",(t,e)=>{tt.init(t,e),t._zod.optin="optional",et(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),f9=ne("$ZodNonOptional",(t,e)=>{tt.init(t,e),et(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>mg(s,t)):mg(i,t)}});function mg(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 h9=ne("$ZodCatch",(t,e)=>{tt.init(t,e),t._zod.optin="optional",et(t._zod,"optout",()=>e.innerType._zod.optout),et(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(a=>Br(a,r,vr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(s=>Br(s,r,vr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),d9=ne("$ZodPipe",(t,e)=>{tt.init(t,e),et(t._zod,"values",()=>e.in._zod.values),et(t._zod,"optin",()=>e.in._zod.optin),et(t._zod,"optout",()=>e.out._zod.optout),et(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(a=>ya(a,e.in,r)):ya(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>ya(s,e.out,r)):ya(i,e.out,r)}});function ya(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const p9=ne("$ZodReadonly",(t,e)=>{tt.init(t,e),et(t._zod,"propValues",()=>e.innerType._zod.propValues),et(t._zod,"values",()=>e.innerType._zod.values),et(t._zod,"optin",()=>e.innerType?._zod?.optin),et(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(bg):bg(i)}});function bg(t){return t.value=Object.freeze(t.value),t}const g9=ne("$ZodFunction",(t,e)=>(tt.init(t,e),t._def=e,t._zod.def=e,t.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...r){const i=t._def.input?sg(t._def.input,r):r,s=Reflect.apply(n,this,i);return t._def.output?sg(t._def.output,s):s}},t.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...r){const i=t._def.input?await og(t._def.input,r):r,s=await Reflect.apply(n,this,i);return t._def.output?await og(t._def.output,s):s}},t._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:t}),n):(t._def.output&&t._def.output._zod.def.type==="promise"?n.value=t.implementAsync(n.value):n.value=t.implement(n.value),n),t.input=(...n)=>{const r=t.constructor;return Array.isArray(n[0])?new r({type:"function",input:new e1({type:"tuple",items:n[0],rest:n[1]}),output:t._def.output}):new r({type:"function",input:n[0],output:t._def.output})},t.output=n=>{const r=t.constructor;return new r({type:"function",input:t._def.input,output:n})},t)),m9=ne("$ZodCustom",(t,e)=>{an.init(t,e),tt.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>yg(s,n,r,t));yg(i,n,r,t)}});function yg(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(Eo(i))}}var xg;class b9{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...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 y9(){return new b9}(xg=globalThis).__zod_globalRegistry??(xg.__zod_globalRegistry=y9());const co=globalThis.__zod_globalRegistry;function x9(t,e){return new t({type:"string",...Ie(e)})}function w9(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Ie(e)})}function wg(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(e)})}function A9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(e)})}function E9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(e)})}function v9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(e)})}function B9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(e)})}function R9(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ie(e)})}function T9(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(e)})}function S9(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(e)})}function I9(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(e)})}function O9(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(e)})}function P9(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(e)})}function k9(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(e)})}function N9(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(e)})}function C9(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(e)})}function _9(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(e)})}function D9(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(e)})}function F9(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(e)})}function U9(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(e)})}function L9(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(e)})}function M9(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(e)})}function $9(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(e)})}function z9(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(e)})}function G9(t,e){return new t({type:"string",format:"date",check:"string_format",...Ie(e)})}function V9(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Ie(e)})}function j9(t,e){return new t({type:"string",format:"duration",check:"string_format",...Ie(e)})}function H9(t,e){return new t({type:"number",checks:[],...Ie(e)})}function q9(t,e){return new t({type:"number",coerce:!0,checks:[],...Ie(e)})}function Z9(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Ie(e)})}function K9(t,e){return new t({type:"boolean",...Ie(e)})}function J9(t,e){return new t({type:"bigint",...Ie(e)})}function W9(t){return new t({type:"any"})}function Q9(t){return new t({type:"unknown"})}function Y9(t,e){return new t({type:"never",...Ie(e)})}function oc(t,e){return new Kx({check:"less_than",...Ie(e),value:t,inclusive:!1})}function as(t,e){return new Kx({check:"less_than",...Ie(e),value:t,inclusive:!0})}function ac(t,e){return new Jx({check:"greater_than",...Ie(e),value:t,inclusive:!1})}function jr(t,e){return new Jx({check:"greater_than",...Ie(e),value:t,inclusive:!0})}function Gh(t,e){return new a7({check:"multiple_of",...Ie(e),value:t})}function n1(t,e){return new u7({check:"max_length",...Ie(e),maximum:t})}function cc(t,e){return new l7({check:"min_length",...Ie(e),minimum:t})}function r1(t,e){return new f7({check:"length_equals",...Ie(e),length:t})}function X9(t,e){return new h7({check:"string_format",format:"regex",...Ie(e),pattern:t})}function eB(t){return new d7({check:"string_format",format:"lowercase",...Ie(t)})}function tB(t){return new p7({check:"string_format",format:"uppercase",...Ie(t)})}function nB(t,e){return new g7({check:"string_format",format:"includes",...Ie(e),includes:t})}function rB(t,e){return new m7({check:"string_format",format:"starts_with",...Ie(e),prefix:t})}function iB(t,e){return new b7({check:"string_format",format:"ends_with",...Ie(e),suffix:t})}function Ps(t){return new y7({check:"overwrite",tx:t})}function sB(t){return Ps(e=>e.normalize(t))}function oB(){return Ps(t=>t.trim())}function aB(){return Ps(t=>t.toLowerCase())}function cB(){return Ps(t=>t.toUpperCase())}function uB(){return Ps(t=>u5(t))}function lB(t,e,n){return new t({type:"array",element:e,...Ie(n)})}function fB(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Ie(n)})}function hB(t,e){const n=dB(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Eo(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Eo(s))}},t(r.value,r)),e);return n}function dB(t,e){const n=new an({check:"custom",...Ie(e)});return n._zod.check=t,n}function i1(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??co,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 At(t,e,n={path:[],schemaPath:[]}){var r;const i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,a);const c=t._zod.toJSONSchema?.();if(c)a.schema=c;else{const d={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,d);else{const m=a.schema,w=e.processors[i.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);w(t,e,m,d)}const g=t._zod.parent;g&&(a.ref||(a.ref=g),At(g,e,d),e.seen.get(g).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(a.schema,l),e.io==="input"&&Kt(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function s1(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const a of t.seen.entries()){const c=t.metadataRegistry.get(a[0])?.id;if(c){const l=r.get(c);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,a[0])}}const i=a=>{const c=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const g=t.external.registry.get(a[0])?.id,m=t.external.uri??(v=>v);if(g)return{ref:m(g)};const w=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=w,{defId:w,ref:`${m("__shared")}#/${c}/${w}`}}if(a[1]===n)return{ref:"#"};const h=`#/${c}/`,d=a[1].schema.id??`__schema${t.counter++}`;return{defId:d,ref:h+d}},s=a=>{if(a[1].schema.$ref)return;const c=a[1],{ref:l,defId:h}=i(a);c.def={...c.schema},h&&(c.defId=h);const d=c.schema;for(const g in d)delete d[g];d.$ref=l};if(t.cycles==="throw")for(const a of t.seen.entries()){const c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
74
|
+
|
|
75
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of t.seen.entries()){const c=a[1];if(e===a[0]){s(a);continue}if(t.external){const h=t.external.registry.get(a[0])?.id;if(e!==a[0]&&h){s(a);continue}}if(t.metadataRegistry.get(a[0])?.id){s(a);continue}if(c.cycle){s(a);continue}if(c.count>1&&t.reused==="ref"){s(a);continue}}}function o1(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const l=t.seen.get(c);if(l.ref===null)return;const h=l.def??l.schema,d={...h},g=l.ref;if(l.ref=null,g){r(g);const w=t.seen.get(g),v=w.schema;if(v.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(v)):Object.assign(h,v),Object.assign(h,d),c._zod.parent===g)for(const S in h)S==="$ref"||S==="allOf"||S in d||delete h[S];if(v.$ref&&w.def)for(const S in h)S==="$ref"||S==="allOf"||S in w.def&&JSON.stringify(h[S])===JSON.stringify(w.def[S])&&delete h[S]}const m=c._zod.parent;if(m&&m!==g){r(m);const w=t.seen.get(m);if(w?.schema.$ref&&(h.$ref=w.schema.$ref,w.def))for(const v in h)v==="$ref"||v==="allOf"||v in w.def&&JSON.stringify(h[v])===JSON.stringify(w.def[v])&&delete h[v]}t.override({zodSchema:c,jsonSchema:h,path:l.path??[]})};for(const c of[...t.seen.entries()].reverse())r(c[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 c=t.external.registry.get(e)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(c)}Object.assign(i,n.def??n.schema);const s=t.metadataRegistry.get(e)?.id;s!==void 0&&i.id===s&&delete i.id;const a=t.external?.defs??{};for(const c of t.seen.entries()){const l=c[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 c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...e["~standard"],jsonSchema:{input:uc(e,"input",t.processors),output:uc(e,"output",t.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Kt(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Kt(r.element,n);if(r.type==="set")return Kt(r.valueType,n);if(r.type==="lazy")return Kt(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Kt(r.innerType,n);if(r.type==="intersection")return Kt(r.left,n)||Kt(r.right,n);if(r.type==="record"||r.type==="map")return Kt(r.keyType,n)||Kt(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Kt(r.in,n)||Kt(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Kt(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Kt(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Kt(i,n))return!0;return!!(r.rest&&Kt(r.rest,n))}return!1}const pB=(t,e={})=>n=>{const r=i1({...n,processors:e});return At(t,r),s1(r,t),o1(r,t)},uc=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},a=i1({...i??{},target:s,io:e,processors:n});return At(t,a),s1(a,t),o1(a,t)},gB={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mB=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:a,format:c,patterns:l,contentEncoding:h}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof a=="number"&&(i.maxLength=a),c&&(i.format=gB[c]??c,i.format===""&&delete i.format,c==="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(g=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},bB=(t,e,n,r)=>{const i=n,{minimum:s,maximum:a,format:c,multipleOf:l,exclusiveMaximum:h,exclusiveMinimum:d}=t._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number";const g=typeof d=="number"&&d>=(s??Number.NEGATIVE_INFINITY),m=typeof h=="number"&&h<=(a??Number.POSITIVE_INFINITY),w=e.target==="draft-04"||e.target==="openapi-3.0";g?w?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d:typeof s=="number"&&(i.minimum=s),m?w?(i.maximum=h,i.exclusiveMaximum=!0):i.exclusiveMaximum=h:typeof a=="number"&&(i.maximum=a),typeof l=="number"&&(i.multipleOf=l)},yB=(t,e,n,r)=>{n.type="boolean"},xB=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},wB=(t,e,n,r)=>{n.not={}},AB=(t,e,n,r)=>{},EB=(t,e,n,r)=>{},vB=(t,e,n,r)=>{const i=t._zod.def,s=Lx(i.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},BB=(t,e,n,r)=>{const i=t._zod.def,s=[];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");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},RB=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},TB=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},SB=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},IB=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:a,maximum:c}=t._zod.bag;typeof a=="number"&&(i.minItems=a),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=At(s.element,e,{...r,path:[...r.path,"items"]})},OB=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object",i.properties={};const a=s.shape;for(const h in a)i.properties[h]=At(a[h],e,{...r,path:[...r.path,"properties",h]});const c=new Set(Object.keys(a)),l=new Set([...c].filter(h=>{const d=s.shape[h]._zod;return e.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(i.required=Array.from(l)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=At(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},PB=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,a=i.options.map((c,l)=>At(c,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=a:n.anyOf=a},kB=(t,e,n,r)=>{const i=t._zod.def,s=At(i.left,e,{...r,path:[...r.path,"allOf",0]}),a=At(i.right,e,{...r,path:[...r.path,"allOf",1]}),c=h=>"allOf"in h&&Object.keys(h).length===1,l=[...c(s)?s.allOf:[s],...c(a)?a.allOf:[a]];n.allOf=l},NB=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="array";const a=e.target==="draft-2020-12"?"prefixItems":"items",c=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((m,w)=>At(m,e,{...r,path:[...r.path,a,w]})),h=s.rest?At(s.rest,e,{...r,path:[...r.path,c,...e.target==="openapi-3.0"?[s.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:g}=t._zod.bag;typeof d=="number"&&(i.minItems=d),typeof g=="number"&&(i.maxItems=g)},CB=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object";const a=s.keyType,l=a._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){const d=At(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const g of l)i.patternProperties[g.source]=d}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=At(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=At(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const h=a._zod.values;if(h){const d=[...h].filter(g=>typeof g=="string"||typeof g=="number");d.length>0&&(i.required=d)}},_B=(t,e,n,r)=>{const i=t._zod.def,s=At(i.innerType,e,r),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},DB=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},FB=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},UB=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},LB=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},MB=(t,e,n,r)=>{const i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),a=e.io==="input"?s?i.out:i.in:i.out;At(a,e,r);const c=e.seen.get(t);c.ref=a},$B=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},a1=(t,e,n,r)=>{const i=t._zod.def;At(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},zB=ne("ZodISODateTime",(t,e)=>{N7.init(t,e),yt.init(t,e)});function GB(t){return z9(zB,t)}const VB=ne("ZodISODate",(t,e)=>{C7.init(t,e),yt.init(t,e)});function jB(t){return G9(VB,t)}const HB=ne("ZodISOTime",(t,e)=>{_7.init(t,e),yt.init(t,e)});function qB(t){return V9(HB,t)}const ZB=ne("ZodISODuration",(t,e)=>{D7.init(t,e),yt.init(t,e)});function KB(t){return j9(ZB,t)}const JB=(t,e)=>{Gx.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>v5(t,n)},flatten:{value:n=>E5(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,$h,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,$h,2)}},isEmpty:{get(){return t.issues.length===0}}})},On=ne("ZodError",JB,{Parent:Error}),WB=Sc(On),QB=Ic(On),YB=Oc(On),XB=Pc(On),eR=T5(On),tR=S5(On),nR=I5(On),rR=O5(On),iR=P5(On),sR=k5(On),oR=N5(On),aR=C5(On),Ag=new WeakMap;function $o(t,e,n){const r=Object.getPrototypeOf(t);let i=Ag.get(r);if(i||(i=new Set,Ag.set(r,i)),!i.has(e)){i.add(e);for(const s in n){const a=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const c=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const rt=ne("ZodType",(t,e)=>(tt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:uc(t,"input"),output:uc(t,"output")}}),t.toJSONSchema=pB(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>WB(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>YB(t,n,r),t.parseAsync=async(n,r)=>QB(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>XB(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>eR(t,n,r),t.decode=(n,r)=>tR(t,n,r),t.encodeAsync=async(n,r)=>nR(t,n,r),t.decodeAsync=async(n,r)=>rR(t,n,r),t.safeEncode=(n,r)=>iR(t,n,r),t.safeDecode=(n,r)=>sR(t,n,r),t.safeEncodeAsync=async(n,r)=>oR(t,n,r),t.safeDecodeAsync=async(n,r)=>aR(t,n,r),$o(t,"ZodType",{check(...n){const r=this.def;return this.clone(Xr(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return ei(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(aT(n,r))},superRefine(n,r){return this.check(cT(n,r))},overwrite(n){return this.check(Ps(n))},optional(){return vo(this)},exactOptional(){return qR(this)},nullable(){return Rg(this)},nullish(){return vo(Rg(this))},nonoptional(n){return YR(this,n)},array(){return Lt(this)},or(n){return FR([this,n])},and(n){return LR(this,n)},transform(n){return Tg(this,jR(n))},default(n){return JR(this,n)},prefault(n){return QR(this,n)},catch(n){return eT(this,n)},pipe(n){return Tg(this,n)},readonly(){return rT(this)},describe(n){const r=this.clone();return co.add(r,{description:n}),r},meta(...n){if(n.length===0)return co.get(this);const r=this.clone();return co.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){return co.get(t)?.description},configurable:!0}),t)),c1=ne("_ZodString",(t,e)=>{Sd.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>mB(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,$o(t,"_ZodString",{regex(...r){return this.check(X9(...r))},includes(...r){return this.check(nB(...r))},startsWith(...r){return this.check(rB(...r))},endsWith(...r){return this.check(iB(...r))},min(...r){return this.check(cc(...r))},max(...r){return this.check(n1(...r))},length(...r){return this.check(r1(...r))},nonempty(...r){return this.check(cc(1,...r))},lowercase(r){return this.check(eB(r))},uppercase(r){return this.check(tB(r))},trim(){return this.check(oB())},normalize(...r){return this.check(sB(...r))},toLowerCase(){return this.check(aB())},toUpperCase(){return this.check(cB())},slugify(){return this.check(uB())}})}),cR=ne("ZodString",(t,e)=>{Sd.init(t,e),c1.init(t,e),t.email=n=>t.check(w9(uR,n)),t.url=n=>t.check(R9(lR,n)),t.jwt=n=>t.check($9(RR,n)),t.emoji=n=>t.check(T9(fR,n)),t.guid=n=>t.check(wg(Eg,n)),t.uuid=n=>t.check(A9(xa,n)),t.uuidv4=n=>t.check(E9(xa,n)),t.uuidv6=n=>t.check(v9(xa,n)),t.uuidv7=n=>t.check(B9(xa,n)),t.nanoid=n=>t.check(S9(hR,n)),t.guid=n=>t.check(wg(Eg,n)),t.cuid=n=>t.check(I9(dR,n)),t.cuid2=n=>t.check(O9(pR,n)),t.ulid=n=>t.check(P9(gR,n)),t.base64=n=>t.check(U9(ER,n)),t.base64url=n=>t.check(L9(vR,n)),t.xid=n=>t.check(k9(mR,n)),t.ksuid=n=>t.check(N9(bR,n)),t.ipv4=n=>t.check(C9(yR,n)),t.ipv6=n=>t.check(_9(xR,n)),t.cidrv4=n=>t.check(D9(wR,n)),t.cidrv6=n=>t.check(F9(AR,n)),t.e164=n=>t.check(M9(BR,n)),t.datetime=n=>t.check(GB(n)),t.date=n=>t.check(jB(n)),t.time=n=>t.check(qB(n)),t.duration=n=>t.check(KB(n))});function me(t){return x9(cR,t)}const yt=ne("ZodStringFormat",(t,e)=>{dt.init(t,e),c1.init(t,e)}),uR=ne("ZodEmail",(t,e)=>{v7.init(t,e),yt.init(t,e)}),Eg=ne("ZodGUID",(t,e)=>{A7.init(t,e),yt.init(t,e)}),xa=ne("ZodUUID",(t,e)=>{E7.init(t,e),yt.init(t,e)}),lR=ne("ZodURL",(t,e)=>{B7.init(t,e),yt.init(t,e)}),fR=ne("ZodEmoji",(t,e)=>{R7.init(t,e),yt.init(t,e)}),hR=ne("ZodNanoID",(t,e)=>{T7.init(t,e),yt.init(t,e)}),dR=ne("ZodCUID",(t,e)=>{S7.init(t,e),yt.init(t,e)}),pR=ne("ZodCUID2",(t,e)=>{I7.init(t,e),yt.init(t,e)}),gR=ne("ZodULID",(t,e)=>{O7.init(t,e),yt.init(t,e)}),mR=ne("ZodXID",(t,e)=>{P7.init(t,e),yt.init(t,e)}),bR=ne("ZodKSUID",(t,e)=>{k7.init(t,e),yt.init(t,e)}),yR=ne("ZodIPv4",(t,e)=>{F7.init(t,e),yt.init(t,e)}),xR=ne("ZodIPv6",(t,e)=>{U7.init(t,e),yt.init(t,e)}),wR=ne("ZodCIDRv4",(t,e)=>{L7.init(t,e),yt.init(t,e)}),AR=ne("ZodCIDRv6",(t,e)=>{M7.init(t,e),yt.init(t,e)}),ER=ne("ZodBase64",(t,e)=>{$7.init(t,e),yt.init(t,e)}),vR=ne("ZodBase64URL",(t,e)=>{G7.init(t,e),yt.init(t,e)}),BR=ne("ZodE164",(t,e)=>{V7.init(t,e),yt.init(t,e)}),RR=ne("ZodJWT",(t,e)=>{H7.init(t,e),yt.init(t,e)}),Id=ne("ZodNumber",(t,e)=>{Qx.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>bB(t,r,i),$o(t,"ZodNumber",{gt(r,i){return this.check(ac(r,i))},gte(r,i){return this.check(jr(r,i))},min(r,i){return this.check(jr(r,i))},lt(r,i){return this.check(oc(r,i))},lte(r,i){return this.check(as(r,i))},max(r,i){return this.check(as(r,i))},int(r){return this.check(vg(r))},safe(r){return this.check(vg(r))},positive(r){return this.check(ac(0,r))},nonnegative(r){return this.check(jr(0,r))},negative(r){return this.check(oc(0,r))},nonpositive(r){return this.check(as(0,r))},multipleOf(r,i){return this.check(Gh(r,i))},step(r,i){return this.check(Gh(r,i))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function ve(t){return H9(Id,t)}const TR=ne("ZodNumberFormat",(t,e)=>{q7.init(t,e),Id.init(t,e)});function vg(t){return Z9(TR,t)}const SR=ne("ZodBoolean",(t,e)=>{Z7.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>yB(t,n,r)});function Xe(t){return K9(SR,t)}const IR=ne("ZodBigInt",(t,e)=>{K7.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>xB(t,r),t.gte=(r,i)=>t.check(jr(r,i)),t.min=(r,i)=>t.check(jr(r,i)),t.gt=(r,i)=>t.check(ac(r,i)),t.gte=(r,i)=>t.check(jr(r,i)),t.min=(r,i)=>t.check(jr(r,i)),t.lt=(r,i)=>t.check(oc(r,i)),t.lte=(r,i)=>t.check(as(r,i)),t.max=(r,i)=>t.check(as(r,i)),t.positive=r=>t.check(ac(BigInt(0),r)),t.negative=r=>t.check(oc(BigInt(0),r)),t.nonpositive=r=>t.check(as(BigInt(0),r)),t.nonnegative=r=>t.check(jr(BigInt(0),r)),t.multipleOf=(r,i)=>t.check(Gh(r,i));const n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null});function u1(t){return J9(IR,t)}const OR=ne("ZodAny",(t,e)=>{J7.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>AB()});function Ti(){return W9(OR)}const PR=ne("ZodUnknown",(t,e)=>{W7.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>EB()});function ys(){return Q9(PR)}const kR=ne("ZodNever",(t,e)=>{Q7.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>wB(t,n,r)});function NR(t){return Y9(kR,t)}const CR=ne("ZodArray",(t,e)=>{Y7.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>IB(t,n,r,i),t.element=e.element,$o(t,"ZodArray",{min(n,r){return this.check(cc(n,r))},nonempty(n){return this.check(cc(1,n))},max(n,r){return this.check(n1(n,r))},length(n,r){return this.check(r1(n,r))},unwrap(){return this.element}})});function Lt(t,e){return lB(CR,t,e)}const _R=ne("ZodObject",(t,e)=>{e9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>OB(t,n,r,i),et(t,"shape",()=>e.shape),$o(t,"ZodObject",{keyof(){return f1(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:ys()})},loose(){return this.clone({...this._zod.def,catchall:ys()})},strict(){return this.clone({...this._zod.def,catchall:NR()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return m5(this,n)},safeExtend(n){return b5(this,n)},merge(n){return y5(this,n)},pick(n){return p5(this,n)},omit(n){return g5(this,n)},partial(...n){return x5(h1,this,n[0])},required(...n){return w5(d1,this,n[0])}})});function Te(t,e){const n={type:"object",shape:t??{},...Ie(e)};return new _R(n)}const DR=ne("ZodUnion",(t,e)=>{t9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>PB(t,n,r,i),t.options=e.options});function FR(t,e){return new DR({type:"union",options:t,...Ie(e)})}const UR=ne("ZodIntersection",(t,e)=>{n9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>kB(t,n,r,i)});function LR(t,e){return new UR({type:"intersection",left:t,right:e})}const MR=ne("ZodTuple",(t,e)=>{e1.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>NB(t,n,r,i),t.rest=n=>t.clone({...t._zod.def,rest:n})});function $R(t,e,n){const r=e instanceof tt,i=r?n:e,s=r?e:null;return new MR({type:"tuple",items:t,rest:s,...Ie(i)})}const Bg=ne("ZodRecord",(t,e)=>{r9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>CB(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function l1(t,e,n){return!e||!e._zod?new Bg({type:"record",keyType:me(),valueType:t,...Ie(e)}):new Bg({type:"record",keyType:t,valueType:e,...Ie(n)})}const Vh=ne("ZodEnum",(t,e)=>{i9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>vB(t,r,i),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const a of r)if(n.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Vh({...e,checks:[],...Ie(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Vh({...e,checks:[],...Ie(i),entries:s})}});function f1(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Vh({type:"enum",entries:n,...Ie(e)})}const zR=ne("ZodLiteral",(t,e)=>{s9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>BB(t,n,r),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 GR(t,e){return new zR({type:"literal",values:Array.isArray(t)?t:[t],...Ie(e)})}const VR=ne("ZodTransform",(t,e)=>{o9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>SB(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ux(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Eo(s,n.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),n.issues.push(Eo(a))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function jR(t){return new VR({type:"transform",transform:t})}const h1=ne("ZodOptional",(t,e)=>{t1.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>a1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function vo(t){return new h1({type:"optional",innerType:t})}const HR=ne("ZodExactOptional",(t,e)=>{a9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>a1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function qR(t){return new HR({type:"optional",innerType:t})}const ZR=ne("ZodNullable",(t,e)=>{c9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>_B(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Rg(t){return new ZR({type:"nullable",innerType:t})}const KR=ne("ZodDefault",(t,e)=>{u9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>FB(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function JR(t,e){return new KR({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():$x(e)}})}const WR=ne("ZodPrefault",(t,e)=>{l9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>UB(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function QR(t,e){return new WR({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():$x(e)}})}const d1=ne("ZodNonOptional",(t,e)=>{f9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>DB(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function YR(t,e){return new d1({type:"nonoptional",innerType:t,...Ie(e)})}const XR=ne("ZodCatch",(t,e)=>{h9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>LB(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function eT(t,e){return new XR({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const tT=ne("ZodPipe",(t,e)=>{d9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>MB(t,n,r,i),t.in=e.in,t.out=e.out});function Tg(t,e){return new tT({type:"pipe",in:t,out:e})}const nT=ne("ZodReadonly",(t,e)=>{p9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>$B(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function rT(t){return new nT({type:"readonly",innerType:t})}const iT=ne("ZodFunction",(t,e)=>{g9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>TB(t,n)});function sT(t){return new iT({type:"function",input:Array.isArray(t?.input)?$R(t?.input):Lt(ys()),output:ys()})}const oT=ne("ZodCustom",(t,e)=>{m9.init(t,e),rt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>RB(t,n)});function aT(t,e={}){return fB(oT,t,e)}function cT(t,e){return hB(t,e)}function p1(t){return q9(Id,t)}const uT=Te({issuer:me().transform(t=>Hr(t)),index:me().transform(t=>Hr(t)),timestamp:me().transform(t=>Hr(t)),signature:me().transform(t=>Hr(t))});var wa={exports:{}},Pl,Sg;function lT(){if(Sg)return Pl;Sg=1;var t=1e3,e=t*60,n=e*60,r=n*24,i=r*7,s=r*365.25;Pl=function(d,g){g=g||{};var m=typeof d;if(m==="string"&&d.length>0)return a(d);if(m==="number"&&isFinite(d))return g.long?l(d):c(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 g=/^(-?(?:\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(g){var m=parseFloat(g[1]),w=(g[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return m*s;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*r;case"hours":case"hour":case"hrs":case"hr":case"h":return m*n;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function c(d){var g=Math.abs(d);return g>=r?Math.round(d/r)+"d":g>=n?Math.round(d/n)+"h":g>=e?Math.round(d/e)+"m":g>=t?Math.round(d/t)+"s":d+"ms"}function l(d){var g=Math.abs(d);return g>=r?h(d,g,r,"day"):g>=n?h(d,g,n,"hour"):g>=e?h(d,g,e,"minute"):g>=t?h(d,g,t,"second"):d+" ms"}function h(d,g,m,w){var v=g>=m*1.5;return Math.round(d/m)+" "+w+(v?"s":"")}return Pl}var kl,Ig;function fT(){if(Ig)return kl;Ig=1;function t(e){r.debug=r,r.default=r,r.coerce=h,r.disable=c,r.enable=s,r.enabled=l,r.humanize=lT(),r.destroy=d,Object.keys(e).forEach(g=>{r[g]=e[g]}),r.names=[],r.skips=[],r.formatters={};function n(g){let m=0;for(let w=0;w<g.length;w++)m=(m<<5)-m+g.charCodeAt(w),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=n;function r(g){let m,w=null,v,E;function S(...A){if(!S.enabled)return;const I=S,T=Number(new Date),O=T-(m||T);I.diff=O,I.prev=m,I.curr=T,m=T,A[0]=r.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let k=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(D,$)=>{if(D==="%%")return"%";k++;const j=r.formatters[$];if(typeof j=="function"){const X=A[k];D=j.call(I,X),A.splice(k,1),k--}return D}),r.formatArgs.call(I,A),(I.log||r.log).apply(I,A)}return S.namespace=g,S.useColors=r.useColors(),S.color=r.selectColor(g),S.extend=i,S.destroy=r.destroy,Object.defineProperty(S,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(v!==r.namespaces&&(v=r.namespaces,E=r.enabled(g)),E),set:A=>{w=A}}),typeof r.init=="function"&&r.init(S),S}function i(g,m){const w=r(this.namespace+(typeof m>"u"?":":m)+g);return w.log=this.log,w}function s(g){r.save(g),r.namespaces=g,r.names=[],r.skips=[];const m=(typeof g=="string"?g:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const w of m)w[0]==="-"?r.skips.push(w.slice(1)):r.names.push(w)}function a(g,m){let w=0,v=0,E=-1,S=0;for(;w<g.length;)if(v<m.length&&(m[v]===g[w]||m[v]==="*"))m[v]==="*"?(E=v,S=w,v++):(w++,v++);else if(E!==-1)v=E+1,S++,w=S;else return!1;for(;v<m.length&&m[v]==="*";)v++;return v===m.length}function c(){const g=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),g}function l(g){for(const m of r.skips)if(a(g,m))return!1;for(const m of r.names)if(a(g,m))return!0;return!1}function h(g){return g instanceof Error?g.stack||g.message:g}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 r.enable(r.load()),r}return kl=t,kl}var Og;function hT(){return Og||(Og=1,(function(t,e){var n={};e.formatArgs=i,e.save=s,e.load=a,e.useColors=r,e.storage=c(),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 r(){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 g=0,m=0;h[0].replace(/%[a-zA-Z%]/g,w=>{w!=="%%"&&(g++,w==="%c"&&(m=g))}),h.splice(m,0,d)}e.log=console.debug||console.log||(()=>{});function s(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 Fe<"u"&&"env"in Fe&&(h=n.DEBUG),h}function c(){try{return localStorage}catch{}}t.exports=fT()(e);const{formatters:l}=t.exports;l.j=function(h){try{return JSON.stringify(h)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(wa,wa.exports)),wa.exports}var dT=hT();const pT=My(dT),gT=pT("bee-js:http"),mT=1e5,bT=200,yT=1e3,xT=300,wT={headers:{accept:"application/json, text/plain, */*"}};async function ye(t,e){const n=e.data,r=ke.Objects.deepMerge3(wT,{...e,data:void 0},t);if(r.data=n,t.signal&&(r.signal=t.signal),AT(r),r.params)for(const c of Object.keys(r.params))r.params[c]===void 0&&delete r.params[c];const i=BT(r),s=(r.method||"GET").toUpperCase();r.method=s,t.onRequest?.({method:s,url:ke.Strings.joinUrl([r.baseURL??"",r.url??""]),headers:{...r.headers},params:r.params});let a=0;for(;a<mT;)try{gT(`${s} ${i}`,{headers:r.headers,params:r.params});const c=await fetch(i,r);return c.ok||await ET(s,i,c,r.responseType),g1(c,r.responseType)}catch(c){if(c instanceof Bo)throw c;const l=c;if(l.name==="TimeoutError"&&t.endlesslyRetry)a++,await ke.System.sleepMillis(a<xT?bT:yT);else throw vT(l,s,i)}throw Error("Max number of failed attempts reached")}function AT(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 r=e instanceof Blob&&e.type?e.type:"application/octet-stream";t.headers={"content-type":r,...t.headers}}}async function ET(t,e,n,r){const i=await g1(n,r).catch(()=>({data:void 0})),s=typeof i.data=="string"?i.data:JSON.stringify(i.data),a=s&&s!=="undefined"?`${n.statusText}: ${s}`:n.statusText;throw new Bo(t,e,a,i.data,n.status,n.statusText)}function vT(t,e,n){if(t.name==="AbortError")return new Bo(e,n,"Request aborted",void 0,void 0,"ERR_CANCELED");const r=t.cause,i=r?.message?`${t.message}: ${r.message}`:t.message;return new Bo(e,n,i)}async function g1(t,e="json"){let n;switch(e){case"arraybuffer":n=await t.arrayBuffer();break;case"text":n=await t.text();break;case"blob":n=await t.blob();break;case"stream":n=t.body;break;default:{const r=await t.text();n=r?JSON.parse(r):null}}return{data:n,status:t.status,statusText:t.statusText,headers:Object.fromEntries(t.headers.entries()),raw:t}}function BT(t){let e=ke.Strings.joinUrl([t.baseURL??"",t.url??""]);if(t.params){const n=new URLSearchParams(Object.entries(t.params).filter(([,r])=>r!==void 0).map(([r,i])=>[r,String(i)])).toString();n&&(e+=`?${n}`)}return e}const RT="envelope";async function TT(t,e,n){const r=await ye(t,{method:"post",responseType:"json",url:`${RT}/${n}`,headers:{"swarm-postage-batch-id":e.toHex()}}),i=uT.parse(r.data);return{issuer:new It(i.issuer),index:i.index,timestamp:i.timestamp,signature:new ps(i.signature),batchId:e}}const ST=Te({durationSeconds:ve()}),IT="rchash";async function OT(t,e,n,r){const i=await ye(t,{responseType:"json",url:`${IT}/${e}/${n}/${r}`});return ST.parse(i.data).durationSeconds}const Ci=Te({reference:me().transform(t=>new Ue(t))});class Ln extends Error{constructor(e){super(e)}}class Yn extends Ln{constructor(e,n){super(e),this.value=n}}class Bo extends Ln{constructor(e,n,r,i,s,a){super(r),this.method=e,this.url=n,this.responseBody=i,this.status=s,this.statusText=a,this.response={status:s,data:i,statusText:a}}}class ln{constructor(e){this.seconds=Math.ceil(e),e<0&&(this.seconds=0)}static fromMilliseconds(e){return new ln(e/1e3)}static fromSeconds(e){return new ln(e)}static fromHours(e){return new ln(e*60*60)}static fromDays(e){return new ln(e*24*60*60)}static fromWeeks(e){return new ln(e*7*24*60*60)}static fromYears(e){return new ln(e*365*24*60*60)}static fromEndDate(e,n){return new ln((e.getTime()-(n??new Date).getTime())/1e3)}static parseFromString(e){return ln.fromSeconds(ke.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 ke.Dates.secondsToHumanTime(this.seconds)}isZero(){return this.seconds===0}}ln.ZERO=new ln(0);class Dn{constructor(e){if(this.bytes=Math.ceil(e),e<0)throw Error("Size must be at least 0")}static fromBytes(e){return new Dn(e)}static fromKilobytes(e){return new Dn(e*1e3)}static fromMegabytes(e){return new Dn(e*1e3*1e3)}static fromGigabytes(e){return new Dn(e*1e3*1e3*1e3)}static parseFromString(e){return Dn.fromBytes(ke.Numbers.makeStorage(e,1e3))}toBytes(){return this.bytes}toGigabytes(){return this.bytes/1e3/1e3/1e3}toFormattedString(){return ke.Numbers.convertBytes(this.bytes,1e3)}represent(){return this.toFormattedString()}}class Le{constructor(e){this.state=e}static fromDecimalString(e){return new Le(ke.FixedPointNumber.fromDecimalString(e,Le.DIGITS))}static fromPLUR(e){return new Le(new ke.FixedPointNumber(e,Le.DIGITS))}static fromFloat(e){return new Le(ke.FixedPointNumber.fromFloat(e,Le.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 Le(this.state.add(e instanceof Le?e.state:new ke.FixedPointNumber(e,Le.DIGITS)))}minus(e){return new Le(this.state.subtract(e instanceof Le?e.state:new ke.FixedPointNumber(e,Le.DIGITS)))}divide(e){return new Le(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 ft.fromWei(this.state.exchange("*",new ke.FixedPointNumber(e.toWeiBigInt(),ft.DIGITS),ft.DIGITS).value)}}Le.DIGITS=16;class ft{constructor(e){this.state=e}static fromDecimalString(e){return new ft(ke.FixedPointNumber.fromDecimalString(e,ft.DIGITS))}static fromWei(e){return new ft(new ke.FixedPointNumber(e,ft.DIGITS))}static fromFloat(e){return new ft(ke.FixedPointNumber.fromFloat(e,ft.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 ft(this.state.add(e instanceof ft?e.state:new ke.FixedPointNumber(e,ft.DIGITS)))}minus(e){return new ft(this.state.subtract(e instanceof ft?e.state:new ke.FixedPointNumber(e,ft.DIGITS)))}divide(e){return new ft(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 Le.fromPLUR(this.state.exchange("/",new ke.FixedPointNumber(e.toWeiBigInt(),ft.DIGITS),Le.DIGITS).value)}}ft.DIGITS=18;var Aa={exports:{}},Pg;function Od(){if(Pg)return Aa.exports;Pg=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(k,_,D){return Function.prototype.apply.call(k,_,D)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:n=function(k){return Object.getOwnPropertyNames(k)};function r(O){console&&console.warn&&console.warn(O)}var i=Number.isNaN||function(k){return k!==k};function s(){s.init.call(this)}Aa.exports=s,Aa.exports.once=A,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function c(O){if(typeof O!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof O)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(O){if(typeof O!="number"||O<0||i(O))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+O+".");a=O}}),s.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},s.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||i(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this};function l(O){return O._maxListeners===void 0?s.defaultMaxListeners:O._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(k){for(var _=[],D=1;D<arguments.length;D++)_.push(arguments[D]);var $=k==="error",j=this._events;if(j!==void 0)$=$&&j.error===void 0;else if(!$)return!1;if($){var X;if(_.length>0&&(X=_[0]),X instanceof Error)throw X;var de=new Error("Unhandled error."+(X?" ("+X.message+")":""));throw de.context=X,de}var U=j[k];if(U===void 0)return!1;if(typeof U=="function")e(U,this,_);else for(var Z=U.length,J=v(U,Z),D=0;D<Z;++D)e(J[D],this,_);return!0};function h(O,k,_,D){var $,j,X;if(c(_),j=O._events,j===void 0?(j=O._events=Object.create(null),O._eventsCount=0):(j.newListener!==void 0&&(O.emit("newListener",k,_.listener?_.listener:_),j=O._events),X=j[k]),X===void 0)X=j[k]=_,++O._eventsCount;else if(typeof X=="function"?X=j[k]=D?[_,X]:[X,_]:D?X.unshift(_):X.push(_),$=l(O),$>0&&X.length>$&&!X.warned){X.warned=!0;var de=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");de.name="MaxListenersExceededWarning",de.emitter=O,de.type=k,de.count=X.length,r(de)}return O}s.prototype.addListener=function(k,_){return h(this,k,_,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(k,_){return h(this,k,_,!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 g(O,k,_){var D={fired:!1,wrapFn:void 0,target:O,type:k,listener:_},$=d.bind(D);return $.listener=_,D.wrapFn=$,$}s.prototype.once=function(k,_){return c(_),this.on(k,g(this,k,_)),this},s.prototype.prependOnceListener=function(k,_){return c(_),this.prependListener(k,g(this,k,_)),this},s.prototype.removeListener=function(k,_){var D,$,j,X,de;if(c(_),$=this._events,$===void 0)return this;if(D=$[k],D===void 0)return this;if(D===_||D.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete $[k],$.removeListener&&this.emit("removeListener",k,D.listener||_));else if(typeof D!="function"){for(j=-1,X=D.length-1;X>=0;X--)if(D[X]===_||D[X].listener===_){de=D[X].listener,j=X;break}if(j<0)return this;j===0?D.shift():E(D,j),D.length===1&&($[k]=D[0]),$.removeListener!==void 0&&this.emit("removeListener",k,de||_)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(k){var _,D,$;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[k]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete D[k]),this;if(arguments.length===0){var j=Object.keys(D),X;for($=0;$<j.length;++$)X=j[$],X!=="removeListener"&&this.removeAllListeners(X);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(_=D[k],typeof _=="function")this.removeListener(k,_);else if(_!==void 0)for($=_.length-1;$>=0;$--)this.removeListener(k,_[$]);return this};function m(O,k,_){var D=O._events;if(D===void 0)return[];var $=D[k];return $===void 0?[]:typeof $=="function"?_?[$.listener||$]:[$]:_?S($):v($,$.length)}s.prototype.listeners=function(k){return m(this,k,!0)},s.prototype.rawListeners=function(k){return m(this,k,!1)},s.listenerCount=function(O,k){return typeof O.listenerCount=="function"?O.listenerCount(k):w.call(O,k)},s.prototype.listenerCount=w;function w(O){var k=this._events;if(k!==void 0){var _=k[O];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function v(O,k){for(var _=new Array(k),D=0;D<k;++D)_[D]=O[D];return _}function E(O,k){for(;k+1<O.length;k++)O[k]=O[k+1];O.pop()}function S(O){for(var k=new Array(O.length),_=0;_<k.length;++_)k[_]=O[_].listener||O[_];return k}function A(O,k){return new Promise(function(_,D){function $(X){O.removeListener(k,j),D(X)}function j(){typeof O.removeListener=="function"&&O.removeListener("error",$),_([].slice.call(arguments))}T(O,k,j,{once:!0}),k!=="error"&&I(O,$,{once:!0})})}function I(O,k,_){typeof O.on=="function"&&T(O,"error",k,_)}function T(O,k,_,D){if(typeof O.on=="function")D.once?O.once(k,_):O.on(k,_);else if(typeof O.addEventListener=="function")O.addEventListener(k,function $(j){D.once&&O.removeEventListener(k,$),_(j)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof O)}return Aa.exports}var Ea={exports:{}},kg;function _i(){return kg||(kg=1,typeof Object.create=="function"?Ea.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ea.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Ea.exports}var Nl,Ng;function m1(){return Ng||(Ng=1,Nl=Od().EventEmitter),Nl}var Cl={},Cg;function Nc(){return Cg||(Cg=1,(function(t){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e={},n={};n.byteLength=d,n.toByteArray=m,n.fromByteArray=E;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=a.length;c<l;++c)r[c]=a[c],i[a.charCodeAt(c)]=c;i[45]=62,i[95]=63;function h(I){var T=I.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=I.indexOf("=");O===-1&&(O=T);var k=O===T?0:4-O%4;return[O,k]}function d(I){var T=h(I),O=T[0],k=T[1];return(O+k)*3/4-k}function g(I,T,O){return(T+O)*3/4-O}function m(I){var T,O=h(I),k=O[0],_=O[1],D=new s(g(I,k,_)),$=0,j=_>0?k-4:k,X;for(X=0;X<j;X+=4)T=i[I.charCodeAt(X)]<<18|i[I.charCodeAt(X+1)]<<12|i[I.charCodeAt(X+2)]<<6|i[I.charCodeAt(X+3)],D[$++]=T>>16&255,D[$++]=T>>8&255,D[$++]=T&255;return _===2&&(T=i[I.charCodeAt(X)]<<2|i[I.charCodeAt(X+1)]>>4,D[$++]=T&255),_===1&&(T=i[I.charCodeAt(X)]<<10|i[I.charCodeAt(X+1)]<<4|i[I.charCodeAt(X+2)]>>2,D[$++]=T>>8&255,D[$++]=T&255),D}function w(I){return r[I>>18&63]+r[I>>12&63]+r[I>>6&63]+r[I&63]}function v(I,T,O){for(var k,_=[],D=T;D<O;D+=3)k=(I[D]<<16&16711680)+(I[D+1]<<8&65280)+(I[D+2]&255),_.push(w(k));return _.join("")}function E(I){for(var T,O=I.length,k=O%3,_=[],D=16383,$=0,j=O-k;$<j;$+=D)_.push(v(I,$,$+D>j?j:$+D));return k===1?(T=I[O-1],_.push(r[T>>2]+r[T<<4&63]+"==")):k===2&&(T=(I[O-2]<<8)+I[O-1],_.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),_.join("")}var S={};S.read=function(I,T,O,k,_){var D,$,j=_*8-k-1,X=(1<<j)-1,de=X>>1,U=-7,Z=O?_-1:0,J=O?-1:1,L=I[T+Z];for(Z+=J,D=L&(1<<-U)-1,L>>=-U,U+=j;U>0;D=D*256+I[T+Z],Z+=J,U-=8);for($=D&(1<<-U)-1,D>>=-U,U+=k;U>0;$=$*256+I[T+Z],Z+=J,U-=8);if(D===0)D=1-de;else{if(D===X)return $?NaN:(L?-1:1)*(1/0);$=$+Math.pow(2,k),D=D-de}return(L?-1:1)*$*Math.pow(2,D-k)},S.write=function(I,T,O,k,_,D){var $,j,X,de=D*8-_-1,U=(1<<de)-1,Z=U>>1,J=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=k?0:D-1,q=k?1:-1,re=T<0||T===0&&1/T<0?1:0;for(T=Math.abs(T),isNaN(T)||T===1/0?(j=isNaN(T)?1:0,$=U):($=Math.floor(Math.log(T)/Math.LN2),T*(X=Math.pow(2,-$))<1&&($--,X*=2),$+Z>=1?T+=J/X:T+=J*Math.pow(2,1-Z),T*X>=2&&($++,X/=2),$+Z>=U?(j=0,$=U):$+Z>=1?(j=(T*X-1)*Math.pow(2,_),$=$+Z):(j=T*Math.pow(2,Z-1)*Math.pow(2,_),$=0));_>=8;I[O+L]=j&255,L+=q,j/=256,_-=8);for($=$<<_|j,de+=_;de>0;I[O+L]=$&255,L+=q,$/=256,de-=8);I[O+L-q]|=re*128};(function(I){const T=n,O=S,k=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;I.Buffer=U,I.SlowBuffer=V,I.INSPECT_MAX_BYTES=50;const _=2147483647;I.kMaxLength=_;const{Uint8Array:D,ArrayBuffer:$,SharedArrayBuffer:j}=globalThis;U.TYPED_ARRAY_SUPPORT=X(),!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 X(){try{const B=new D(1),b={foo:function(){return 42}};return Object.setPrototypeOf(b,D.prototype),Object.setPrototypeOf(B,b),B.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 de(B){if(B>_)throw new RangeError('The value "'+B+'" is invalid for option "size"');const b=new D(B);return Object.setPrototypeOf(b,U.prototype),b}function U(B,b,x){if(typeof B=="number"){if(typeof b=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return q(B)}return Z(B,b,x)}U.poolSize=8192;function Z(B,b,x){if(typeof B=="string")return re(B,b);if($.isView(B))return ce(B);if(B==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if($t(B,$)||B&&$t(B.buffer,$)||typeof j<"u"&&($t(B,j)||B&&$t(B.buffer,j)))return he(B,b,x);if(typeof B=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const C=B.valueOf&&B.valueOf();if(C!=null&&C!==B)return U.from(C,b,x);const G=be(B);if(G)return G;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]=="function")return U.from(B[Symbol.toPrimitive]("string"),b,x);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}U.from=function(B,b,x){return Z(B,b,x)},Object.setPrototypeOf(U.prototype,D.prototype),Object.setPrototypeOf(U,D);function J(B){if(typeof B!="number")throw new TypeError('"size" argument must be of type number');if(B<0)throw new RangeError('The value "'+B+'" is invalid for option "size"')}function L(B,b,x){return J(B),B<=0?de(B):b!==void 0?typeof x=="string"?de(B).fill(b,x):de(B).fill(b):de(B)}U.alloc=function(B,b,x){return L(B,b,x)};function q(B){return J(B),de(B<0?0:xe(B)|0)}U.allocUnsafe=function(B){return q(B)},U.allocUnsafeSlow=function(B){return q(B)};function re(B,b){if((typeof b!="string"||b==="")&&(b="utf8"),!U.isEncoding(b))throw new TypeError("Unknown encoding: "+b);const x=K(B,b)|0;let C=de(x);const G=C.write(B,b);return G!==x&&(C=C.slice(0,G)),C}function le(B){const b=B.length<0?0:xe(B.length)|0,x=de(b);for(let C=0;C<b;C+=1)x[C]=B[C]&255;return x}function ce(B){if($t(B,D)){const b=new D(B);return he(b.buffer,b.byteOffset,b.byteLength)}return le(B)}function he(B,b,x){if(b<0||B.byteLength<b)throw new RangeError('"offset" is outside of buffer bounds');if(B.byteLength<b+(x||0))throw new RangeError('"length" is outside of buffer bounds');let C;return b===void 0&&x===void 0?C=new D(B):x===void 0?C=new D(B,b):C=new D(B,b,x),Object.setPrototypeOf(C,U.prototype),C}function be(B){if(U.isBuffer(B)){const b=xe(B.length)|0,x=de(b);return x.length===0||B.copy(x,0,0,b),x}if(B.length!==void 0)return typeof B.length!="number"||or(B.length)?de(0):le(B);if(B.type==="Buffer"&&Array.isArray(B.data))return le(B.data)}function xe(B){if(B>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return B|0}function V(B){return+B!=B&&(B=0),U.alloc(+B)}U.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==U.prototype},U.compare=function(b,x){if($t(b,D)&&(b=U.from(b,b.offset,b.byteLength)),$t(x,D)&&(x=U.from(x,x.offset,x.byteLength)),!U.isBuffer(b)||!U.isBuffer(x))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===x)return 0;let C=b.length,G=x.length;for(let Q=0,ae=Math.min(C,G);Q<ae;++Q)if(b[Q]!==x[Q]){C=b[Q],G=x[Q];break}return C<G?-1:G<C?1:0},U.isEncoding=function(b){switch(String(b).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(b,x){if(!Array.isArray(b))throw new TypeError('"list" argument must be an Array of Buffers');if(b.length===0)return U.alloc(0);let C;if(x===void 0)for(x=0,C=0;C<b.length;++C)x+=b[C].length;const G=U.allocUnsafe(x);let Q=0;for(C=0;C<b.length;++C){let ae=b[C];if($t(ae,D))Q+ae.length>G.length?(U.isBuffer(ae)||(ae=U.from(ae)),ae.copy(G,Q)):D.prototype.set.call(G,ae,Q);else if(U.isBuffer(ae))ae.copy(G,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=ae.length}return G};function K(B,b){if(U.isBuffer(B))return B.length;if($.isView(B)||$t(B,$))return B.byteLength;if(typeof B!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);const x=B.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&x===0)return 0;let G=!1;for(;;)switch(b){case"ascii":case"latin1":case"binary":return x;case"utf8":case"utf-8":return rr(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x*2;case"hex":return x>>>1;case"base64":return sr(B).length;default:if(G)return C?-1:rr(B).length;b=(""+b).toLowerCase(),G=!0}}U.byteLength=K;function Y(B,b,x){let C=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0,b>>>=0,x<=b))return"";for(B||(B="utf8");;)switch(B){case"hex":return at(this,b,x);case"utf8":case"utf-8":return Pe(this,b,x);case"ascii":return Rt(this,b,x);case"latin1":case"binary":return oe(this,b,x);case"base64":return ge(this,b,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ct(this,b,x);default:if(C)throw new TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),C=!0}}U.prototype._isBuffer=!0;function M(B,b,x){const C=B[b];B[b]=B[x],B[x]=C}U.prototype.swap16=function(){const b=this.length;if(b%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let x=0;x<b;x+=2)M(this,x,x+1);return this},U.prototype.swap32=function(){const b=this.length;if(b%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let x=0;x<b;x+=4)M(this,x,x+3),M(this,x+1,x+2);return this},U.prototype.swap64=function(){const b=this.length;if(b%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let x=0;x<b;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 b=this.length;return b===0?"":arguments.length===0?Pe(this,0,b):Y.apply(this,arguments)},U.prototype.toLocaleString=U.prototype.toString,U.prototype.equals=function(b){if(!U.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b?!0:U.compare(this,b)===0},U.prototype.inspect=function(){let b="";const x=I.INSPECT_MAX_BYTES;return b=this.toString("hex",0,x).replace(/(.{2})/g,"$1 ").trim(),this.length>x&&(b+=" ... "),"<Buffer "+b+">"},k&&(U.prototype[k]=U.prototype.inspect),U.prototype.compare=function(b,x,C,G,Q){if($t(b,D)&&(b=U.from(b,b.offset,b.byteLength)),!U.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(x===void 0&&(x=0),C===void 0&&(C=b?b.length:0),G===void 0&&(G=0),Q===void 0&&(Q=this.length),x<0||C>b.length||G<0||Q>this.length)throw new RangeError("out of range index");if(G>=Q&&x>=C)return 0;if(G>=Q)return-1;if(x>=C)return 1;if(x>>>=0,C>>>=0,G>>>=0,Q>>>=0,this===b)return 0;let ae=Q-G,De=C-x;const Qe=Math.min(ae,De),Ke=this.slice(G,Q),lt=b.slice(x,C);for(let Je=0;Je<Qe;++Je)if(Ke[Je]!==lt[Je]){ae=Ke[Je],De=lt[Je];break}return ae<De?-1:De<ae?1:0};function z(B,b,x,C,G){if(B.length===0)return-1;if(typeof x=="string"?(C=x,x=0):x>2147483647?x=2147483647:x<-2147483648&&(x=-2147483648),x=+x,or(x)&&(x=G?0:B.length-1),x<0&&(x=B.length+x),x>=B.length){if(G)return-1;x=B.length-1}else if(x<0)if(G)x=0;else return-1;if(typeof b=="string"&&(b=U.from(b,C)),U.isBuffer(b))return b.length===0?-1:W(B,b,x,C,G);if(typeof b=="number")return b=b&255,typeof D.prototype.indexOf=="function"?G?D.prototype.indexOf.call(B,b,x):D.prototype.lastIndexOf.call(B,b,x):W(B,[b],x,C,G);throw new TypeError("val must be string, number or Buffer")}function W(B,b,x,C,G){let Q=1,ae=B.length,De=b.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if(B.length<2||b.length<2)return-1;Q=2,ae/=2,De/=2,x/=2}function Qe(lt,Je){return Q===1?lt[Je]:lt.readUInt16BE(Je*Q)}let Ke;if(G){let lt=-1;for(Ke=x;Ke<ae;Ke++)if(Qe(B,Ke)===Qe(b,lt===-1?0:Ke-lt)){if(lt===-1&&(lt=Ke),Ke-lt+1===De)return lt*Q}else lt!==-1&&(Ke-=Ke-lt),lt=-1}else for(x+De>ae&&(x=ae-De),Ke=x;Ke>=0;Ke--){let lt=!0;for(let Je=0;Je<De;Je++)if(Qe(B,Ke+Je)!==Qe(b,Je)){lt=!1;break}if(lt)return Ke}return-1}U.prototype.includes=function(b,x,C){return this.indexOf(b,x,C)!==-1},U.prototype.indexOf=function(b,x,C){return z(this,b,x,C,!0)},U.prototype.lastIndexOf=function(b,x,C){return z(this,b,x,C,!1)};function te(B,b,x,C){x=Number(x)||0;const G=B.length-x;C?(C=Number(C),C>G&&(C=G)):C=G;const Q=b.length;C>Q/2&&(C=Q/2);let ae;for(ae=0;ae<C;++ae){const De=parseInt(b.substr(ae*2,2),16);if(or(De))return ae;B[x+ae]=De}return ae}function se(B,b,x,C){return kn(rr(b,B.length-x),B,x,C)}function P(B,b,x,C){return kn(ir(b),B,x,C)}function N(B,b,x,C){return kn(sr(b),B,x,C)}function ee(B,b,x,C){return kn(kr(b,B.length-x),B,x,C)}U.prototype.write=function(b,x,C,G){if(x===void 0)G="utf8",C=this.length,x=0;else if(C===void 0&&typeof x=="string")G=x,C=this.length,x=0;else if(isFinite(x))x=x>>>0,isFinite(C)?(C=C>>>0,G===void 0&&(G="utf8")):(G=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),b.length>0&&(C<0||x<0)||x>this.length)throw new RangeError("Attempt to write outside buffer bounds");G||(G="utf8");let ae=!1;for(;;)switch(G){case"hex":return te(this,b,x,C);case"utf8":case"utf-8":return se(this,b,x,C);case"ascii":case"latin1":case"binary":return P(this,b,x,C);case"base64":return N(this,b,x,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ee(this,b,x,C);default:if(ae)throw new TypeError("Unknown encoding: "+G);G=(""+G).toLowerCase(),ae=!0}},U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ge(B,b,x){return b===0&&x===B.length?T.fromByteArray(B):T.fromByteArray(B.slice(b,x))}function Pe(B,b,x){x=Math.min(B.length,x);const C=[];let G=b;for(;G<x;){const Q=B[G];let ae=null,De=Q>239?4:Q>223?3:Q>191?2:1;if(G+De<=x){let Qe,Ke,lt,Je;switch(De){case 1:Q<128&&(ae=Q);break;case 2:Qe=B[G+1],(Qe&192)===128&&(Je=(Q&31)<<6|Qe&63,Je>127&&(ae=Je));break;case 3:Qe=B[G+1],Ke=B[G+2],(Qe&192)===128&&(Ke&192)===128&&(Je=(Q&15)<<12|(Qe&63)<<6|Ke&63,Je>2047&&(Je<55296||Je>57343)&&(ae=Je));break;case 4:Qe=B[G+1],Ke=B[G+2],lt=B[G+3],(Qe&192)===128&&(Ke&192)===128&&(lt&192)===128&&(Je=(Q&15)<<18|(Qe&63)<<12|(Ke&63)<<6|lt&63,Je>65535&&Je<1114112&&(ae=Je))}}ae===null?(ae=65533,De=1):ae>65535&&(ae-=65536,C.push(ae>>>10&1023|55296),ae=56320|ae&1023),C.push(ae),G+=De}return Ce(C)}const Ee=4096;function Ce(B){const b=B.length;if(b<=Ee)return String.fromCharCode.apply(String,B);let x="",C=0;for(;C<b;)x+=String.fromCharCode.apply(String,B.slice(C,C+=Ee));return x}function Rt(B,b,x){let C="";x=Math.min(B.length,x);for(let G=b;G<x;++G)C+=String.fromCharCode(B[G]&127);return C}function oe(B,b,x){let C="";x=Math.min(B.length,x);for(let G=b;G<x;++G)C+=String.fromCharCode(B[G]);return C}function at(B,b,x){const C=B.length;(!b||b<0)&&(b=0),(!x||x<0||x>C)&&(x=C);let G="";for(let Q=b;Q<x;++Q)G+=si[B[Q]];return G}function ct(B,b,x){const C=B.slice(b,x);let G="";for(let Q=0;Q<C.length-1;Q+=2)G+=String.fromCharCode(C[Q]+C[Q+1]*256);return G}U.prototype.slice=function(b,x){const C=this.length;b=~~b,x=x===void 0?C:~~x,b<0?(b+=C,b<0&&(b=0)):b>C&&(b=C),x<0?(x+=C,x<0&&(x=0)):x>C&&(x=C),x<b&&(x=b);const G=this.subarray(b,x);return Object.setPrototypeOf(G,U.prototype),G};function Ge(B,b,x){if(B%1!==0||B<0)throw new RangeError("offset is not uint");if(B+b>x)throw new RangeError("Trying to access beyond buffer length")}U.prototype.readUintLE=U.prototype.readUIntLE=function(b,x,C){b=b>>>0,x=x>>>0,C||Ge(b,x,this.length);let G=this[b],Q=1,ae=0;for(;++ae<x&&(Q*=256);)G+=this[b+ae]*Q;return G},U.prototype.readUintBE=U.prototype.readUIntBE=function(b,x,C){b=b>>>0,x=x>>>0,C||Ge(b,x,this.length);let G=this[b+--x],Q=1;for(;x>0&&(Q*=256);)G+=this[b+--x]*Q;return G},U.prototype.readUint8=U.prototype.readUInt8=function(b,x){return b=b>>>0,x||Ge(b,1,this.length),this[b]},U.prototype.readUint16LE=U.prototype.readUInt16LE=function(b,x){return b=b>>>0,x||Ge(b,2,this.length),this[b]|this[b+1]<<8},U.prototype.readUint16BE=U.prototype.readUInt16BE=function(b,x){return b=b>>>0,x||Ge(b,2,this.length),this[b]<<8|this[b+1]},U.prototype.readUint32LE=U.prototype.readUInt32LE=function(b,x){return b=b>>>0,x||Ge(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+this[b+3]*16777216},U.prototype.readUint32BE=U.prototype.readUInt32BE=function(b,x){return b=b>>>0,x||Ge(b,4,this.length),this[b]*16777216+(this[b+1]<<16|this[b+2]<<8|this[b+3])},U.prototype.readBigUInt64LE=zn(function(b){b=b>>>0,gn(b,"offset");const x=this[b],C=this[b+7];(x===void 0||C===void 0)&&Pn(b,this.length-8);const G=x+this[++b]*2**8+this[++b]*2**16+this[++b]*2**24,Q=this[++b]+this[++b]*2**8+this[++b]*2**16+C*2**24;return BigInt(G)+(BigInt(Q)<<BigInt(32))}),U.prototype.readBigUInt64BE=zn(function(b){b=b>>>0,gn(b,"offset");const x=this[b],C=this[b+7];(x===void 0||C===void 0)&&Pn(b,this.length-8);const G=x*2**24+this[++b]*2**16+this[++b]*2**8+this[++b],Q=this[++b]*2**24+this[++b]*2**16+this[++b]*2**8+C;return(BigInt(G)<<BigInt(32))+BigInt(Q)}),U.prototype.readIntLE=function(b,x,C){b=b>>>0,x=x>>>0,C||Ge(b,x,this.length);let G=this[b],Q=1,ae=0;for(;++ae<x&&(Q*=256);)G+=this[b+ae]*Q;return Q*=128,G>=Q&&(G-=Math.pow(2,8*x)),G},U.prototype.readIntBE=function(b,x,C){b=b>>>0,x=x>>>0,C||Ge(b,x,this.length);let G=x,Q=1,ae=this[b+--G];for(;G>0&&(Q*=256);)ae+=this[b+--G]*Q;return Q*=128,ae>=Q&&(ae-=Math.pow(2,8*x)),ae},U.prototype.readInt8=function(b,x){return b=b>>>0,x||Ge(b,1,this.length),this[b]&128?(255-this[b]+1)*-1:this[b]},U.prototype.readInt16LE=function(b,x){b=b>>>0,x||Ge(b,2,this.length);const C=this[b]|this[b+1]<<8;return C&32768?C|4294901760:C},U.prototype.readInt16BE=function(b,x){b=b>>>0,x||Ge(b,2,this.length);const C=this[b+1]|this[b]<<8;return C&32768?C|4294901760:C},U.prototype.readInt32LE=function(b,x){return b=b>>>0,x||Ge(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},U.prototype.readInt32BE=function(b,x){return b=b>>>0,x||Ge(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},U.prototype.readBigInt64LE=zn(function(b){b=b>>>0,gn(b,"offset");const x=this[b],C=this[b+7];(x===void 0||C===void 0)&&Pn(b,this.length-8);const G=this[b+4]+this[b+5]*2**8+this[b+6]*2**16+(C<<24);return(BigInt(G)<<BigInt(32))+BigInt(x+this[++b]*2**8+this[++b]*2**16+this[++b]*2**24)}),U.prototype.readBigInt64BE=zn(function(b){b=b>>>0,gn(b,"offset");const x=this[b],C=this[b+7];(x===void 0||C===void 0)&&Pn(b,this.length-8);const G=(x<<24)+this[++b]*2**16+this[++b]*2**8+this[++b];return(BigInt(G)<<BigInt(32))+BigInt(this[++b]*2**24+this[++b]*2**16+this[++b]*2**8+C)}),U.prototype.readFloatLE=function(b,x){return b=b>>>0,x||Ge(b,4,this.length),O.read(this,b,!0,23,4)},U.prototype.readFloatBE=function(b,x){return b=b>>>0,x||Ge(b,4,this.length),O.read(this,b,!1,23,4)},U.prototype.readDoubleLE=function(b,x){return b=b>>>0,x||Ge(b,8,this.length),O.read(this,b,!0,52,8)},U.prototype.readDoubleBE=function(b,x){return b=b>>>0,x||Ge(b,8,this.length),O.read(this,b,!1,52,8)};function Ze(B,b,x,C,G,Q){if(!U.isBuffer(B))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>G||b<Q)throw new RangeError('"value" argument is out of bounds');if(x+C>B.length)throw new RangeError("Index out of range")}U.prototype.writeUintLE=U.prototype.writeUIntLE=function(b,x,C,G){if(b=+b,x=x>>>0,C=C>>>0,!G){const De=Math.pow(2,8*C)-1;Ze(this,b,x,C,De,0)}let Q=1,ae=0;for(this[x]=b&255;++ae<C&&(Q*=256);)this[x+ae]=b/Q&255;return x+C},U.prototype.writeUintBE=U.prototype.writeUIntBE=function(b,x,C,G){if(b=+b,x=x>>>0,C=C>>>0,!G){const De=Math.pow(2,8*C)-1;Ze(this,b,x,C,De,0)}let Q=C-1,ae=1;for(this[x+Q]=b&255;--Q>=0&&(ae*=256);)this[x+Q]=b/ae&255;return x+C},U.prototype.writeUint8=U.prototype.writeUInt8=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,1,255,0),this[x]=b&255,x+1},U.prototype.writeUint16LE=U.prototype.writeUInt16LE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,2,65535,0),this[x]=b&255,this[x+1]=b>>>8,x+2},U.prototype.writeUint16BE=U.prototype.writeUInt16BE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,2,65535,0),this[x]=b>>>8,this[x+1]=b&255,x+2},U.prototype.writeUint32LE=U.prototype.writeUInt32LE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,4,4294967295,0),this[x+3]=b>>>24,this[x+2]=b>>>16,this[x+1]=b>>>8,this[x]=b&255,x+4},U.prototype.writeUint32BE=U.prototype.writeUInt32BE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,4,4294967295,0),this[x]=b>>>24,this[x+1]=b>>>16,this[x+2]=b>>>8,this[x+3]=b&255,x+4};function Tt(B,b,x,C,G){tr(b,C,G,B,x,7);let Q=Number(b&BigInt(4294967295));B[x++]=Q,Q=Q>>8,B[x++]=Q,Q=Q>>8,B[x++]=Q,Q=Q>>8,B[x++]=Q;let ae=Number(b>>BigInt(32)&BigInt(4294967295));return B[x++]=ae,ae=ae>>8,B[x++]=ae,ae=ae>>8,B[x++]=ae,ae=ae>>8,B[x++]=ae,x}function qt(B,b,x,C,G){tr(b,C,G,B,x,7);let Q=Number(b&BigInt(4294967295));B[x+7]=Q,Q=Q>>8,B[x+6]=Q,Q=Q>>8,B[x+5]=Q,Q=Q>>8,B[x+4]=Q;let ae=Number(b>>BigInt(32)&BigInt(4294967295));return B[x+3]=ae,ae=ae>>8,B[x+2]=ae,ae=ae>>8,B[x+1]=ae,ae=ae>>8,B[x]=ae,x+8}U.prototype.writeBigUInt64LE=zn(function(b,x=0){return Tt(this,b,x,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeBigUInt64BE=zn(function(b,x=0){return qt(this,b,x,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeIntLE=function(b,x,C,G){if(b=+b,x=x>>>0,!G){const Qe=Math.pow(2,8*C-1);Ze(this,b,x,C,Qe-1,-Qe)}let Q=0,ae=1,De=0;for(this[x]=b&255;++Q<C&&(ae*=256);)b<0&&De===0&&this[x+Q-1]!==0&&(De=1),this[x+Q]=(b/ae>>0)-De&255;return x+C},U.prototype.writeIntBE=function(b,x,C,G){if(b=+b,x=x>>>0,!G){const Qe=Math.pow(2,8*C-1);Ze(this,b,x,C,Qe-1,-Qe)}let Q=C-1,ae=1,De=0;for(this[x+Q]=b&255;--Q>=0&&(ae*=256);)b<0&&De===0&&this[x+Q+1]!==0&&(De=1),this[x+Q]=(b/ae>>0)-De&255;return x+C},U.prototype.writeInt8=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,1,127,-128),b<0&&(b=255+b+1),this[x]=b&255,x+1},U.prototype.writeInt16LE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,2,32767,-32768),this[x]=b&255,this[x+1]=b>>>8,x+2},U.prototype.writeInt16BE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,2,32767,-32768),this[x]=b>>>8,this[x+1]=b&255,x+2},U.prototype.writeInt32LE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,4,2147483647,-2147483648),this[x]=b&255,this[x+1]=b>>>8,this[x+2]=b>>>16,this[x+3]=b>>>24,x+4},U.prototype.writeInt32BE=function(b,x,C){return b=+b,x=x>>>0,C||Ze(this,b,x,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),this[x]=b>>>24,this[x+1]=b>>>16,this[x+2]=b>>>8,this[x+3]=b&255,x+4},U.prototype.writeBigInt64LE=zn(function(b,x=0){return Tt(this,b,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),U.prototype.writeBigInt64BE=zn(function(b,x=0){return qt(this,b,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function We(B,b,x,C,G,Q){if(x+C>B.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("Index out of range")}function xt(B,b,x,C,G){return b=+b,x=x>>>0,G||We(B,b,x,4),O.write(B,b,x,C,23,4),x+4}U.prototype.writeFloatLE=function(b,x,C){return xt(this,b,x,!0,C)},U.prototype.writeFloatBE=function(b,x,C){return xt(this,b,x,!1,C)};function Mt(B,b,x,C,G){return b=+b,x=x>>>0,G||We(B,b,x,8),O.write(B,b,x,C,52,8),x+8}U.prototype.writeDoubleLE=function(b,x,C){return Mt(this,b,x,!0,C)},U.prototype.writeDoubleBE=function(b,x,C){return Mt(this,b,x,!1,C)},U.prototype.copy=function(b,x,C,G){if(!U.isBuffer(b))throw new TypeError("argument should be a Buffer");if(C||(C=0),!G&&G!==0&&(G=this.length),x>=b.length&&(x=b.length),x||(x=0),G>0&&G<C&&(G=C),G===C||b.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(G<0)throw new RangeError("sourceEnd out of bounds");G>this.length&&(G=this.length),b.length-x<G-C&&(G=b.length-x+C);const Q=G-C;return this===b&&typeof D.prototype.copyWithin=="function"?this.copyWithin(x,C,G):D.prototype.set.call(b,this.subarray(C,G),x),Q},U.prototype.fill=function(b,x,C,G){if(typeof b=="string"){if(typeof x=="string"?(G=x,x=0,C=this.length):typeof C=="string"&&(G=C,C=this.length),G!==void 0&&typeof G!="string")throw new TypeError("encoding must be a string");if(typeof G=="string"&&!U.isEncoding(G))throw new TypeError("Unknown encoding: "+G);if(b.length===1){const ae=b.charCodeAt(0);(G==="utf8"&&ae<128||G==="latin1")&&(b=ae)}}else typeof b=="number"?b=b&255:typeof b=="boolean"&&(b=Number(b));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,b||(b=0);let Q;if(typeof b=="number")for(Q=x;Q<C;++Q)this[Q]=b;else{const ae=U.isBuffer(b)?b:U.from(b,G),De=ae.length;if(De===0)throw new TypeError('The value "'+b+'" is invalid for argument "value"');for(Q=0;Q<C-x;++Q)this[Q+x]=ae[Q%De]}return this};const Dt={};function pn(B,b,x){Dt[B]=class extends x{constructor(){super(),Object.defineProperty(this,"message",{value:b.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(G){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:G,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}pn("ERR_BUFFER_OUT_OF_BOUNDS",function(B){return B?`${B} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),pn("ERR_INVALID_ARG_TYPE",function(B,b){return`The "${B}" argument must be of type number. Received type ${typeof b}`},TypeError),pn("ERR_OUT_OF_RANGE",function(B,b,x){let C=`The value of "${B}" is out of range.`,G=x;return Number.isInteger(x)&&Math.abs(x)>2**32?G=$n(String(x)):typeof x=="bigint"&&(G=String(x),(x>BigInt(2)**BigInt(32)||x<-(BigInt(2)**BigInt(32)))&&(G=$n(G)),G+="n"),C+=` It must be ${b}. Received ${G}`,C},RangeError);function $n(B){let b="",x=B.length;const C=B[0]==="-"?1:0;for(;x>=C+4;x-=3)b=`_${B.slice(x-3,x)}${b}`;return`${B.slice(0,x)}${b}`}function Pr(B,b,x){gn(b,"offset"),(B[b]===void 0||B[b+x]===void 0)&&Pn(b,B.length-(x+1))}function tr(B,b,x,C,G,Q){if(B>x||B<b){const ae=typeof b=="bigint"?"n":"";let De;throw b===0||b===BigInt(0)?De=`>= 0${ae} and < 2${ae} ** ${(Q+1)*8}${ae}`:De=`>= -(2${ae} ** ${(Q+1)*8-1}${ae}) and < 2 ** ${(Q+1)*8-1}${ae}`,new Dt.ERR_OUT_OF_RANGE("value",De,B)}Pr(C,G,Q)}function gn(B,b){if(typeof B!="number")throw new Dt.ERR_INVALID_ARG_TYPE(b,"number",B)}function Pn(B,b,x){throw Math.floor(B)!==B?(gn(B,x),new Dt.ERR_OUT_OF_RANGE("offset","an integer",B)):b<0?new Dt.ERR_BUFFER_OUT_OF_BOUNDS:new Dt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${b}`,B)}const nr=/[^+/0-9A-Za-z-_]/g;function ii(B){if(B=B.split("=")[0],B=B.trim().replace(nr,""),B.length<2)return"";for(;B.length%4!==0;)B=B+"=";return B}function rr(B,b){b=b||1/0;let x;const C=B.length;let G=null;const Q=[];for(let ae=0;ae<C;++ae){if(x=B.charCodeAt(ae),x>55295&&x<57344){if(!G){if(x>56319){(b-=3)>-1&&Q.push(239,191,189);continue}else if(ae+1===C){(b-=3)>-1&&Q.push(239,191,189);continue}G=x;continue}if(x<56320){(b-=3)>-1&&Q.push(239,191,189),G=x;continue}x=(G-55296<<10|x-56320)+65536}else G&&(b-=3)>-1&&Q.push(239,191,189);if(G=null,x<128){if((b-=1)<0)break;Q.push(x)}else if(x<2048){if((b-=2)<0)break;Q.push(x>>6|192,x&63|128)}else if(x<65536){if((b-=3)<0)break;Q.push(x>>12|224,x>>6&63|128,x&63|128)}else if(x<1114112){if((b-=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 ir(B){const b=[];for(let x=0;x<B.length;++x)b.push(B.charCodeAt(x)&255);return b}function kr(B,b){let x,C,G;const Q=[];for(let ae=0;ae<B.length&&!((b-=2)<0);++ae)x=B.charCodeAt(ae),C=x>>8,G=x%256,Q.push(G),Q.push(C);return Q}function sr(B){return T.toByteArray(ii(B))}function kn(B,b,x,C){let G;for(G=0;G<C&&!(G+x>=b.length||G>=B.length);++G)b[G+x]=B[G];return G}function $t(B,b){return B instanceof b||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===b.name}function or(B){return B!==B}const si=(function(){const B="0123456789abcdef",b=new Array(256);for(let x=0;x<16;++x){const C=x*16;for(let G=0;G<16;++G)b[C+G]=B[x]+B[G]}return b})();function zn(B){return typeof BigInt>"u"?tu:B}function tu(){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})(Cl)),Cl}var _l={},Dl={},Fl,_g;function b1(){return _g||(_g=1,Fl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[n]=i;for(var s 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]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(e,n);if(c.value!==i||c.enumerable!==!0)return!1}return!0}),Fl}var Ul,Dg;function Cc(){if(Dg)return Ul;Dg=1;var t=b1();return Ul=function(){return t()&&!!Symbol.toStringTag},Ul}var Ll,Fg;function y1(){return Fg||(Fg=1,Ll=Object),Ll}var Ml,Ug;function PT(){return Ug||(Ug=1,Ml=Error),Ml}var $l,Lg;function kT(){return Lg||(Lg=1,$l=EvalError),$l}var zl,Mg;function NT(){return Mg||(Mg=1,zl=RangeError),zl}var Gl,$g;function CT(){return $g||($g=1,Gl=ReferenceError),Gl}var Vl,zg;function x1(){return zg||(zg=1,Vl=SyntaxError),Vl}var jl,Gg;function zo(){return Gg||(Gg=1,jl=TypeError),jl}var Hl,Vg;function _T(){return Vg||(Vg=1,Hl=URIError),Hl}var ql,jg;function DT(){return jg||(jg=1,ql=Math.abs),ql}var Zl,Hg;function FT(){return Hg||(Hg=1,Zl=Math.floor),Zl}var Kl,qg;function UT(){return qg||(qg=1,Kl=Math.max),Kl}var Jl,Zg;function LT(){return Zg||(Zg=1,Jl=Math.min),Jl}var Wl,Kg;function MT(){return Kg||(Kg=1,Wl=Math.pow),Wl}var Ql,Jg;function $T(){return Jg||(Jg=1,Ql=Math.round),Ql}var Yl,Wg;function zT(){return Wg||(Wg=1,Yl=Number.isNaN||function(e){return e!==e}),Yl}var Xl,Qg;function GT(){if(Qg)return Xl;Qg=1;var t=zT();return Xl=function(n){return t(n)||n===0?n:n<0?-1:1},Xl}var ef,Yg;function VT(){return Yg||(Yg=1,ef=Object.getOwnPropertyDescriptor),ef}var tf,Xg;function ks(){if(Xg)return tf;Xg=1;var t=VT();if(t)try{t([],"length")}catch{t=null}return tf=t,tf}var nf,em;function _c(){if(em)return nf;em=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return nf=t,nf}var rf,tm;function jT(){if(tm)return rf;tm=1;var t=typeof Symbol<"u"&&Symbol,e=b1();return rf=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},rf}var sf,nm;function w1(){return nm||(nm=1,sf=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),sf}var of,rm;function A1(){if(rm)return of;rm=1;var t=y1();return of=t.getPrototypeOf||null,of}var af,im;function HT(){if(im)return af;im=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",i=function(l,h){for(var d=[],g=0;g<l.length;g+=1)d[g]=l[g];for(var m=0;m<h.length;m+=1)d[m+l.length]=h[m];return d},s=function(l,h){for(var d=[],g=h,m=0;g<l.length;g+=1,m+=1)d[m]=l[g];return d},a=function(c,l){for(var h="",d=0;d<c.length;d+=1)h+=c[d],d+1<c.length&&(h+=l);return h};return af=function(l){var h=this;if(typeof h!="function"||e.apply(h)!==r)throw new TypeError(t+h);for(var d=s(arguments,1),g,m=function(){if(this instanceof g){var A=h.apply(this,i(d,arguments));return Object(A)===A?A:this}return h.apply(l,i(d,arguments))},w=n(0,h.length-d.length),v=[],E=0;E<w;E++)v[E]="$"+E;if(g=Function("binder","return function ("+a(v,",")+"){ return binder.apply(this,arguments); }")(m),h.prototype){var S=function(){};S.prototype=h.prototype,g.prototype=new S,S.prototype=null}return g},af}var cf,sm;function Go(){if(sm)return cf;sm=1;var t=HT();return cf=Function.prototype.bind||t,cf}var uf,om;function Pd(){return om||(om=1,uf=Function.prototype.call),uf}var lf,am;function kd(){return am||(am=1,lf=Function.prototype.apply),lf}var ff,cm;function qT(){return cm||(cm=1,ff=typeof Reflect<"u"&&Reflect&&Reflect.apply),ff}var hf,um;function E1(){if(um)return hf;um=1;var t=Go(),e=kd(),n=Pd(),r=qT();return hf=r||t.call(n,e),hf}var df,lm;function Nd(){if(lm)return df;lm=1;var t=Go(),e=zo(),n=Pd(),r=E1();return df=function(s){if(s.length<1||typeof s[0]!="function")throw new e("a function is required");return r(t,n,s)},df}var pf,fm;function ZT(){if(fm)return pf;fm=1;var t=Nd(),e=ks(),n;try{n=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var r=!!n&&e&&e(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return pf=r&&typeof r.get=="function"?t([r.get]):typeof s=="function"?function(c){return s(c==null?c:i(c))}:!1,pf}var gf,hm;function Cd(){if(hm)return gf;hm=1;var t=w1(),e=A1(),n=ZT();return gf=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)}:n?function(i){return n(i)}:null,gf}var mf,dm;function v1(){if(dm)return mf;dm=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=Go();return mf=n.call(t,e),mf}var bf,pm;function B1(){if(pm)return bf;pm=1;var t,e=y1(),n=PT(),r=kT(),i=NT(),s=CT(),a=x1(),c=zo(),l=_T(),h=DT(),d=FT(),g=UT(),m=LT(),w=MT(),v=$T(),E=GT(),S=Function,A=function(te){try{return S('"use strict"; return ('+te+").constructor;")()}catch{}},I=ks(),T=_c(),O=function(){throw new c},k=I?(function(){try{return arguments.callee,O}catch{try{return I(arguments,"callee").get}catch{return O}}})():O,_=jT()(),D=Cd(),$=A1(),j=w1(),X=kd(),de=Pd(),U={},Z=typeof Uint8Array>"u"||!D?t:D(Uint8Array),J={__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%":n,"%eval%":eval,"%EvalError%":r,"%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%":S,"%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%":s,"%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%":k,"%TypedArray%":Z,"%TypeError%":c,"%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%":de,"%Function.prototype.apply%":X,"%Object.defineProperty%":T,"%Object.getPrototypeOf%":$,"%Math.abs%":h,"%Math.floor%":d,"%Math.max%":g,"%Math.min%":m,"%Math.pow%":w,"%Math.round%":v,"%Math.sign%":E,"%Reflect.getPrototypeOf%":j};if(D)try{null.error}catch(te){var L=D(D(te));J["%Error.prototype%"]=L}var q=function te(se){var P;if(se==="%AsyncFunction%")P=A("async function () {}");else if(se==="%GeneratorFunction%")P=A("function* () {}");else if(se==="%AsyncGeneratorFunction%")P=A("async function* () {}");else if(se==="%AsyncGenerator%"){var N=te("%AsyncGeneratorFunction%");N&&(P=N.prototype)}else if(se==="%AsyncIteratorPrototype%"){var ee=te("%AsyncGenerator%");ee&&D&&(P=D(ee.prototype))}return J[se]=P,P},re={__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"]},le=Go(),ce=v1(),he=le.call(de,Array.prototype.concat),be=le.call(X,Array.prototype.splice),xe=le.call(de,String.prototype.replace),V=le.call(de,String.prototype.slice),K=le.call(de,RegExp.prototype.exec),Y=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,M=/\\(\\)?/g,z=function(se){var P=V(se,0,1),N=V(se,-1);if(P==="%"&&N!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(N==="%"&&P!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var ee=[];return xe(se,Y,function(ge,Pe,Ee,Ce){ee[ee.length]=Ee?xe(Ce,M,"$1"):Pe||ge}),ee},W=function(se,P){var N=se,ee;if(ce(re,N)&&(ee=re[N],N="%"+ee[0]+"%"),ce(J,N)){var ge=J[N];if(ge===U&&(ge=q(N)),typeof ge>"u"&&!P)throw new c("intrinsic "+se+" exists, but is not available. Please file an issue!");return{alias:ee,name:N,value:ge}}throw new a("intrinsic "+se+" does not exist!")};return bf=function(se,P){if(typeof se!="string"||se.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof P!="boolean")throw new c('"allowMissing" argument must be a boolean');if(K(/^%?[^%]*%?$/,se)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var N=z(se),ee=N.length>0?N[0]:"",ge=W("%"+ee+"%",P),Pe=ge.name,Ee=ge.value,Ce=!1,Rt=ge.alias;Rt&&(ee=Rt[0],be(N,he([0,1],Rt)));for(var oe=1,at=!0;oe<N.length;oe+=1){var ct=N[oe],Ge=V(ct,0,1),Ze=V(ct,-1);if((Ge==='"'||Ge==="'"||Ge==="`"||Ze==='"'||Ze==="'"||Ze==="`")&&Ge!==Ze)throw new a("property names with quotes must have matching quotes");if((ct==="constructor"||!at)&&(Ce=!0),ee+="."+ct,Pe="%"+ee+"%",ce(J,Pe))Ee=J[Pe];else if(Ee!=null){if(!(ct in Ee)){if(!P)throw new c("base intrinsic for "+se+" exists, but the property is not available.");return}if(I&&oe+1>=N.length){var Tt=I(Ee,ct);at=!!Tt,at&&"get"in Tt&&!("originalValue"in Tt.get)?Ee=Tt.get:Ee=Ee[ct]}else at=ce(Ee,ct),Ee=Ee[ct];at&&!Ce&&(J[Pe]=Ee)}}return Ee},bf}var yf,gm;function Vo(){if(gm)return yf;gm=1;var t=B1(),e=Nd(),n=e([t("%String.prototype.indexOf%")]);return yf=function(i,s){var a=t(i,!!s);return typeof a=="function"&&n(i,".prototype.")>-1?e([a]):a},yf}var xf,mm;function KT(){if(mm)return xf;mm=1;var t=Cc()(),e=Vo(),n=e("Object.prototype.toString"),r=function(c){return t&&c&&typeof c=="object"&&Symbol.toStringTag in c?!1:n(c)==="[object Arguments]"},i=function(c){return r(c)?!0:c!==null&&typeof c=="object"&&"length"in c&&typeof c.length=="number"&&c.length>=0&&n(c)!=="[object Array]"&&"callee"in c&&n(c.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=i,xf=s?r:i,xf}var wf,bm;function JT(){if(bm)return wf;bm=1;var t=Vo(),e=Cc()(),n=v1(),r=ks(),i;if(e){var s=t("RegExp.prototype.exec"),a={},c=function(){throw a},l={toString:c,valueOf:c};typeof Symbol.toPrimitive=="symbol"&&(l[Symbol.toPrimitive]=c),i=function(m){if(!m||typeof m!="object")return!1;var w=r(m,"lastIndex"),v=w&&n(w,"value");if(!v)return!1;try{s(m,l)}catch(E){return E===a}}}else{var h=t("Object.prototype.toString"),d="[object RegExp]";i=function(m){return!m||typeof m!="object"&&typeof m!="function"?!1:h(m)===d}}return wf=i,wf}var Af,ym;function WT(){if(ym)return Af;ym=1;var t=Vo(),e=JT(),n=t("RegExp.prototype.exec"),r=zo();return Af=function(s){if(!e(s))throw new r("`regex` must be a RegExp");return function(c){return n(s,c)!==null}},Af}var Ef,xm;function QT(){if(xm)return Ef;xm=1;const t=(function*(){}).constructor;return Ef=()=>t,Ef}var vf,wm;function YT(){if(wm)return vf;wm=1;var t=Vo(),e=WT(),n=e(/^\s*(?:function)?\*/),r=Cc()(),i=Cd(),s=t("Object.prototype.toString"),a=t("Function.prototype.toString"),c=QT();return vf=function(h){if(typeof h!="function")return!1;if(n(a(h)))return!0;if(!r){var d=s(h);return d==="[object GeneratorFunction]"}if(!i)return!1;var g=c();return g&&i(h)===g.prototype},vf}var Bf,Am;function XT(){if(Am)return Bf;Am=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(I){I!==r&&(e=null)}else e=null;var i=/^\s*class\b/,s=function(T){try{var O=t.call(T);return i.test(O)}catch{return!1}},a=function(T){try{return s(T)?!1:(t.call(T),!0)}catch{return!1}},c=Object.prototype.toString,l="[object Object]",h="[object Function]",d="[object GeneratorFunction]",g="[object HTMLAllCollection]",m="[object HTML document.all class]",w="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,E=!(0 in[,]),S=function(){return!1};if(typeof document=="object"){var A=document.all;c.call(A)===c.call(document.all)&&(S=function(T){if((E||!T)&&(typeof T>"u"||typeof T=="object"))try{var O=c.call(T);return(O===g||O===m||O===w||O===l)&&T("")==null}catch{}return!1})}return Bf=e?function(T){if(S(T))return!0;if(!T||typeof T!="function"&&typeof T!="object")return!1;try{e(T,null,n)}catch(O){if(O!==r)return!1}return!s(T)&&a(T)}:function(T){if(S(T))return!0;if(!T||typeof T!="function"&&typeof T!="object")return!1;if(v)return a(T);if(s(T))return!1;var O=c.call(T);return O!==h&&O!==d&&!/^\[object HTML/.test(O)?!1:a(T)},Bf}var Rf,Em;function eS(){if(Em)return Rf;Em=1;var t=XT(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,h,d){for(var g=0,m=l.length;g<m;g++)n.call(l,g)&&(d==null?h(l[g],g,l):h.call(d,l[g],g,l))},i=function(l,h,d){for(var g=0,m=l.length;g<m;g++)d==null?h(l.charAt(g),g,l):h.call(d,l.charAt(g),g,l)},s=function(l,h,d){for(var g in l)n.call(l,g)&&(d==null?h(l[g],g,l):h.call(d,l[g],g,l))};function a(c){return e.call(c)==="[object Array]"}return Rf=function(l,h,d){if(!t(h))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=d),a(l)?r(l,h,g):typeof l=="string"?i(l,h,g):s(l,h,g)},Rf}var Tf,vm;function tS(){return vm||(vm=1,Tf=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Tf}var Sf,Bm;function nS(){if(Bm)return Sf;Bm=1;var t=tS(),e=typeof globalThis>"u"?Qr:globalThis;return Sf=function(){for(var r=[],i=0;i<t.length;i++)typeof e[t[i]]=="function"&&(r[r.length]=t[i]);return r},Sf}var If={exports:{}},Of,Rm;function rS(){if(Rm)return Of;Rm=1;var t=_c(),e=x1(),n=zo(),r=ks();return Of=function(s,a,c){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`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,g=arguments.length>6?arguments[6]:!1,m=!!r&&r(s,a);if(t)t(s,a,{configurable:d===null&&m?m.configurable:!d,enumerable:l===null&&m?m.enumerable:!l,value:c,writable:h===null&&m?m.writable:!h});else if(g||!l&&!h&&!d)s[a]=c;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Of}var Pf,Tm;function iS(){if(Tm)return Pf;Tm=1;var t=_c(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Pf=e,Pf}var kf,Sm;function sS(){if(Sm)return kf;Sm=1;var t=B1(),e=rS(),n=iS()(),r=ks(),i=zo(),s=t("%Math.floor%");return kf=function(c,l){if(typeof c!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new i("`length` must be a positive 32-bit integer");var h=arguments.length>2&&!!arguments[2],d=!0,g=!0;if("length"in c&&r){var m=r(c,"length");m&&!m.configurable&&(d=!1),m&&!m.writable&&(g=!1)}return(d||g||!h)&&(n?e(c,"length",l,!0,!0):e(c,"length",l)),c},kf}var Nf,Im;function oS(){if(Im)return Nf;Im=1;var t=Go(),e=kd(),n=E1();return Nf=function(){return n(t,e,arguments)},Nf}var Om;function aS(){return Om||(Om=1,(function(t){var e=sS(),n=_c(),r=Nd(),i=oS();t.exports=function(a){var c=r(arguments),l=1+a.length-(arguments.length-1);return e(c,l>0?l:0,!0)},n?n(t.exports,"apply",{value:i}):t.exports.apply=i})(If)),If.exports}var Cf,Pm;function R1(){if(Pm)return Cf;Pm=1;var t=eS(),e=nS(),n=aS(),r=Vo(),i=ks(),s=Cd(),a=r("Object.prototype.toString"),c=Cc()(),l=typeof globalThis>"u"?Qr:globalThis,h=e(),d=r("String.prototype.slice"),g=r("Array.prototype.indexOf",!0)||function(A,I){for(var T=0;T<A.length;T+=1)if(A[T]===I)return T;return-1},m={__proto__:null};c&&i&&s?t(h,function(S){var A=new l[S];if(Symbol.toStringTag in A&&s){var I=s(A),T=i(I,Symbol.toStringTag);if(!T&&I){var O=s(I);T=i(O,Symbol.toStringTag)}if(T&&T.get){var k=n(T.get);m["$"+S]=k}}}):t(h,function(S){var A=new l[S],I=A.slice||A.set;if(I){var T=n(I);m["$"+S]=T}});function w(S){var A=!1;return t(m,function(I,T){if(!A)try{"$"+I(S)===T&&(A=d(T,1))}catch{}}),A}function v(S){var A=!1;return t(m,function(I,T){if(!A)try{I(S),A=d(T,1)}catch{}}),A}function E(S){return g(h,S)>-1}return Cf=function(A){if(!A||typeof A!="object")return!1;if(!c){var I=d(a(A),8,-1);return E(I)?I:I!=="Object"?!1:v(A)}return i?w(A):null},Cf}var _f,km;function cS(){if(km)return _f;km=1;var t=R1();return _f=function(n){return!!t(n)},_f}var Nm;function uS(){return Nm||(Nm=1,(function(t){var e=KT(),n=YT(),r=R1(),i=cS();function s(oe){return oe.call.bind(oe)}var a=typeof BigInt<"u",c=typeof Symbol<"u",l=s(Object.prototype.toString),h=s(Number.prototype.valueOf),d=s(String.prototype.valueOf),g=s(Boolean.prototype.valueOf);if(a)var m=s(BigInt.prototype.valueOf);if(c)var w=s(Symbol.prototype.valueOf);function v(oe,at){if(typeof oe!="object")return!1;try{return at(oe),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=n,t.isTypedArray=i;function E(oe){return typeof Promise<"u"&&oe instanceof Promise||oe!==null&&typeof oe=="object"&&typeof oe.then=="function"&&typeof oe.catch=="function"}t.isPromise=E;function S(oe){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(oe):i(oe)||V(oe)}t.isArrayBufferView=S;function A(oe){return r(oe)==="Uint8Array"}t.isUint8Array=A;function I(oe){return r(oe)==="Uint8ClampedArray"}t.isUint8ClampedArray=I;function T(oe){return r(oe)==="Uint16Array"}t.isUint16Array=T;function O(oe){return r(oe)==="Uint32Array"}t.isUint32Array=O;function k(oe){return r(oe)==="Int8Array"}t.isInt8Array=k;function _(oe){return r(oe)==="Int16Array"}t.isInt16Array=_;function D(oe){return r(oe)==="Int32Array"}t.isInt32Array=D;function $(oe){return r(oe)==="Float32Array"}t.isFloat32Array=$;function j(oe){return r(oe)==="Float64Array"}t.isFloat64Array=j;function X(oe){return r(oe)==="BigInt64Array"}t.isBigInt64Array=X;function de(oe){return r(oe)==="BigUint64Array"}t.isBigUint64Array=de;function U(oe){return l(oe)==="[object Map]"}U.working=typeof Map<"u"&&U(new Map);function Z(oe){return typeof Map>"u"?!1:U.working?U(oe):oe instanceof Map}t.isMap=Z;function J(oe){return l(oe)==="[object Set]"}J.working=typeof Set<"u"&&J(new Set);function L(oe){return typeof Set>"u"?!1:J.working?J(oe):oe instanceof Set}t.isSet=L;function q(oe){return l(oe)==="[object WeakMap]"}q.working=typeof WeakMap<"u"&&q(new WeakMap);function re(oe){return typeof WeakMap>"u"?!1:q.working?q(oe):oe instanceof WeakMap}t.isWeakMap=re;function le(oe){return l(oe)==="[object WeakSet]"}le.working=typeof WeakSet<"u"&&le(new WeakSet);function ce(oe){return le(oe)}t.isWeakSet=ce;function he(oe){return l(oe)==="[object ArrayBuffer]"}he.working=typeof ArrayBuffer<"u"&&he(new ArrayBuffer);function be(oe){return typeof ArrayBuffer>"u"?!1:he.working?he(oe):oe instanceof ArrayBuffer}t.isArrayBuffer=be;function xe(oe){return l(oe)==="[object DataView]"}xe.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&xe(new DataView(new ArrayBuffer(1),0,1));function V(oe){return typeof DataView>"u"?!1:xe.working?xe(oe):oe instanceof DataView}t.isDataView=V;var K=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y(oe){return l(oe)==="[object SharedArrayBuffer]"}function M(oe){return typeof K>"u"?!1:(typeof Y.working>"u"&&(Y.working=Y(new K)),Y.working?Y(oe):oe instanceof K)}t.isSharedArrayBuffer=M;function z(oe){return l(oe)==="[object AsyncFunction]"}t.isAsyncFunction=z;function W(oe){return l(oe)==="[object Map Iterator]"}t.isMapIterator=W;function te(oe){return l(oe)==="[object Set Iterator]"}t.isSetIterator=te;function se(oe){return l(oe)==="[object Generator]"}t.isGeneratorObject=se;function P(oe){return l(oe)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=P;function N(oe){return v(oe,h)}t.isNumberObject=N;function ee(oe){return v(oe,d)}t.isStringObject=ee;function ge(oe){return v(oe,g)}t.isBooleanObject=ge;function Pe(oe){return a&&v(oe,m)}t.isBigIntObject=Pe;function Ee(oe){return c&&v(oe,w)}t.isSymbolObject=Ee;function Ce(oe){return N(oe)||ee(oe)||ge(oe)||Pe(oe)||Ee(oe)}t.isBoxedPrimitive=Ce;function Rt(oe){return typeof Uint8Array<"u"&&(be(oe)||M(oe))}t.isAnyArrayBuffer=Rt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(oe){Object.defineProperty(t,oe,{enumerable:!1,value:function(){throw new Error(oe+" is not supported in userland")}})})})(Dl)),Dl}var Df,Cm;function lS(){return Cm||(Cm=1,Df=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Df}var _m;function T1(){return _m||(_m=1,(function(t){var e={},n=Object.getOwnPropertyDescriptors||function(K){for(var Y=Object.keys(K),M={},z=0;z<Y.length;z++)M[Y[z]]=Object.getOwnPropertyDescriptor(K,Y[z]);return M},r=/%[sdj%]/g;t.format=function(V){if(!_(V)){for(var K=[],Y=0;Y<arguments.length;Y++)K.push(c(arguments[Y]));return K.join(" ")}for(var Y=1,M=arguments,z=M.length,W=String(V).replace(r,function(se){if(se==="%%")return"%";if(Y>=z)return se;switch(se){case"%s":return String(M[Y++]);case"%d":return Number(M[Y++]);case"%j":try{return JSON.stringify(M[Y++])}catch{return"[Circular]"}default:return se}}),te=M[Y];Y<z;te=M[++Y])T(te)||!X(te)?W+=" "+te:W+=" "+c(te);return W},t.deprecate=function(V,K){if(typeof Fe<"u"&&Fe.noDeprecation===!0)return V;if(typeof Fe>"u")return function(){return t.deprecate(V,K).apply(this,arguments)};var Y=!1;function M(){if(!Y){if(Fe.throwDeprecation)throw new Error(K);Fe.traceDeprecation?console.trace(K):console.error(K),Y=!0}return V.apply(this,arguments)}return M};var i={},s=/^$/;if(e.NODE_DEBUG){var a=e.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+a+"$","i")}t.debuglog=function(V){if(V=V.toUpperCase(),!i[V])if(s.test(V)){var K=Fe.pid;i[V]=function(){var Y=t.format.apply(t,arguments);console.error("%s %d: %s",V,K,Y)}}else i[V]=function(){};return i[V]};function c(V,K){var Y={seen:[],stylize:h};return arguments.length>=3&&(Y.depth=arguments[2]),arguments.length>=4&&(Y.colors=arguments[3]),I(K)?Y.showHidden=K:K&&t._extend(Y,K),$(Y.showHidden)&&(Y.showHidden=!1),$(Y.depth)&&(Y.depth=2),$(Y.colors)&&(Y.colors=!1),$(Y.customInspect)&&(Y.customInspect=!0),Y.colors&&(Y.stylize=l),g(Y,V,Y.depth)}t.inspect=c,c.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]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(V,K){var Y=c.styles[K];return Y?"\x1B["+c.colors[Y][0]+"m"+V+"\x1B["+c.colors[Y][1]+"m":V}function h(V,K){return V}function d(V){var K={};return V.forEach(function(Y,M){K[Y]=!0}),K}function g(V,K,Y){if(V.customInspect&&K&&Z(K.inspect)&&K.inspect!==t.inspect&&!(K.constructor&&K.constructor.prototype===K)){var M=K.inspect(Y,V);return _(M)||(M=g(V,M,Y)),M}var z=m(V,K);if(z)return z;var W=Object.keys(K),te=d(W);if(V.showHidden&&(W=Object.getOwnPropertyNames(K)),U(K)&&(W.indexOf("message")>=0||W.indexOf("description")>=0))return w(K);if(W.length===0){if(Z(K)){var se=K.name?": "+K.name:"";return V.stylize("[Function"+se+"]","special")}if(j(K))return V.stylize(RegExp.prototype.toString.call(K),"regexp");if(de(K))return V.stylize(Date.prototype.toString.call(K),"date");if(U(K))return w(K)}var P="",N=!1,ee=["{","}"];if(A(K)&&(N=!0,ee=["[","]"]),Z(K)){var ge=K.name?": "+K.name:"";P=" [Function"+ge+"]"}if(j(K)&&(P=" "+RegExp.prototype.toString.call(K)),de(K)&&(P=" "+Date.prototype.toUTCString.call(K)),U(K)&&(P=" "+w(K)),W.length===0&&(!N||K.length==0))return ee[0]+P+ee[1];if(Y<0)return j(K)?V.stylize(RegExp.prototype.toString.call(K),"regexp"):V.stylize("[Object]","special");V.seen.push(K);var Pe;return N?Pe=v(V,K,Y,te,W):Pe=W.map(function(Ee){return E(V,K,Y,te,Ee,N)}),V.seen.pop(),S(Pe,P,ee)}function m(V,K){if($(K))return V.stylize("undefined","undefined");if(_(K)){var Y="'"+JSON.stringify(K).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return V.stylize(Y,"string")}if(k(K))return V.stylize(""+K,"number");if(I(K))return V.stylize(""+K,"boolean");if(T(K))return V.stylize("null","null")}function w(V){return"["+Error.prototype.toString.call(V)+"]"}function v(V,K,Y,M,z){for(var W=[],te=0,se=K.length;te<se;++te)ce(K,String(te))?W.push(E(V,K,Y,M,String(te),!0)):W.push("");return z.forEach(function(P){P.match(/^\d+$/)||W.push(E(V,K,Y,M,P,!0))}),W}function E(V,K,Y,M,z,W){var te,se,P;if(P=Object.getOwnPropertyDescriptor(K,z)||{value:K[z]},P.get?P.set?se=V.stylize("[Getter/Setter]","special"):se=V.stylize("[Getter]","special"):P.set&&(se=V.stylize("[Setter]","special")),ce(M,z)||(te="["+z+"]"),se||(V.seen.indexOf(P.value)<0?(T(Y)?se=g(V,P.value,null):se=g(V,P.value,Y-1),se.indexOf(`
|
|
76
|
+
`)>-1&&(W?se=se.split(`
|
|
77
|
+
`).map(function(N){return" "+N}).join(`
|
|
78
|
+
`).slice(2):se=`
|
|
79
|
+
`+se.split(`
|
|
80
|
+
`).map(function(N){return" "+N}).join(`
|
|
81
|
+
`))):se=V.stylize("[Circular]","special")),$(te)){if(W&&z.match(/^\d+$/))return se;te=JSON.stringify(""+z),te.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(te=te.slice(1,-1),te=V.stylize(te,"name")):(te=te.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),te=V.stylize(te,"string"))}return te+": "+se}function S(V,K,Y){var M=V.reduce(function(z,W){return W.indexOf(`
|
|
82
|
+
`)>=0,z+W.replace(/\u001b\[\d\d?m/g,"").length+1},0);return M>60?Y[0]+(K===""?"":K+`
|
|
83
|
+
`)+" "+V.join(`,
|
|
84
|
+
`)+" "+Y[1]:Y[0]+K+" "+V.join(", ")+" "+Y[1]}t.types=uS();function A(V){return Array.isArray(V)}t.isArray=A;function I(V){return typeof V=="boolean"}t.isBoolean=I;function T(V){return V===null}t.isNull=T;function O(V){return V==null}t.isNullOrUndefined=O;function k(V){return typeof V=="number"}t.isNumber=k;function _(V){return typeof V=="string"}t.isString=_;function D(V){return typeof V=="symbol"}t.isSymbol=D;function $(V){return V===void 0}t.isUndefined=$;function j(V){return X(V)&&L(V)==="[object RegExp]"}t.isRegExp=j,t.types.isRegExp=j;function X(V){return typeof V=="object"&&V!==null}t.isObject=X;function de(V){return X(V)&&L(V)==="[object Date]"}t.isDate=de,t.types.isDate=de;function U(V){return X(V)&&(L(V)==="[object Error]"||V instanceof Error)}t.isError=U,t.types.isNativeError=U;function Z(V){return typeof V=="function"}t.isFunction=Z;function J(V){return V===null||typeof V=="boolean"||typeof V=="number"||typeof V=="string"||typeof V=="symbol"||typeof V>"u"}t.isPrimitive=J,t.isBuffer=lS();function L(V){return Object.prototype.toString.call(V)}function q(V){return V<10?"0"+V.toString(10):V.toString(10)}var re=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function le(){var V=new Date,K=[q(V.getHours()),q(V.getMinutes()),q(V.getSeconds())].join(":");return[V.getDate(),re[V.getMonth()],K].join(" ")}t.log=function(){console.log("%s - %s",le(),t.format.apply(t,arguments))},t.inherits=_i(),t._extend=function(V,K){if(!K||!X(K))return V;for(var Y=Object.keys(K),M=Y.length;M--;)V[Y[M]]=K[Y[M]];return V};function ce(V,K){return Object.prototype.hasOwnProperty.call(V,K)}var he=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(K){if(typeof K!="function")throw new TypeError('The "original" argument must be of type Function');if(he&&K[he]){var Y=K[he];if(typeof Y!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Y,he,{value:Y,enumerable:!1,writable:!1,configurable:!0}),Y}function Y(){for(var M,z,W=new Promise(function(P,N){M=P,z=N}),te=[],se=0;se<arguments.length;se++)te.push(arguments[se]);te.push(function(P,N){P?z(P):M(N)});try{K.apply(this,te)}catch(P){z(P)}return W}return Object.setPrototypeOf(Y,Object.getPrototypeOf(K)),he&&Object.defineProperty(Y,he,{value:Y,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(Y,n(K))},t.promisify.custom=he;function be(V,K){if(!V){var Y=new Error("Promise was rejected with a falsy value");Y.reason=V,V=Y}return K(V)}function xe(V){if(typeof V!="function")throw new TypeError('The "original" argument must be of type Function');function K(){for(var Y=[],M=0;M<arguments.length;M++)Y.push(arguments[M]);var z=Y.pop();if(typeof z!="function")throw new TypeError("The last argument must be of type Function");var W=this,te=function(){return z.apply(W,arguments)};V.apply(this,Y).then(function(se){Fe.nextTick(te.bind(null,null,se))},function(se){Fe.nextTick(be.bind(null,se,te))})}return Object.setPrototypeOf(K,Object.getPrototypeOf(V)),Object.defineProperties(K,n(V)),K}t.callbackify=xe})(_l)),_l}var Ff,Dm;function fS(){if(Dm)return Ff;Dm=1;function t(v,E){var S=Object.keys(v);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(v);E&&(A=A.filter(function(I){return Object.getOwnPropertyDescriptor(v,I).enumerable})),S.push.apply(S,A)}return S}function e(v){for(var E=1;E<arguments.length;E++){var S=arguments[E]!=null?arguments[E]:{};E%2?t(Object(S),!0).forEach(function(A){n(v,A,S[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(S)):t(Object(S)).forEach(function(A){Object.defineProperty(v,A,Object.getOwnPropertyDescriptor(S,A))})}return v}function n(v,E,S){return E=a(E),E in v?Object.defineProperty(v,E,{value:S,enumerable:!0,configurable:!0,writable:!0}):v[E]=S,v}function r(v,E){if(!(v instanceof E))throw new TypeError("Cannot call a class as a function")}function i(v,E){for(var S=0;S<E.length;S++){var A=E[S];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(v,a(A.key),A)}}function s(v,E,S){return E&&i(v.prototype,E),Object.defineProperty(v,"prototype",{writable:!1}),v}function a(v){var E=c(v,"string");return typeof E=="symbol"?E:String(E)}function c(v,E){if(typeof v!="object"||v===null)return v;var S=v[Symbol.toPrimitive];if(S!==void 0){var A=S.call(v,E);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}var l=Nc(),h=l.Buffer,d=T1(),g=d.inspect,m=g&&g.custom||"inspect";function w(v,E,S){h.prototype.copy.call(v,E,S)}return Ff=(function(){function v(){r(this,v),this.head=null,this.tail=null,this.length=0}return s(v,[{key:"push",value:function(S){var A={data:S,next:null};this.length>0?this.tail.next=A:this.head=A,this.tail=A,++this.length}},{key:"unshift",value:function(S){var A={data:S,next:this.head};this.length===0&&(this.tail=A),this.head=A,++this.length}},{key:"shift",value:function(){if(this.length!==0){var S=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,S}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(S){if(this.length===0)return"";for(var A=this.head,I=""+A.data;A=A.next;)I+=S+A.data;return I}},{key:"concat",value:function(S){if(this.length===0)return h.alloc(0);for(var A=h.allocUnsafe(S>>>0),I=this.head,T=0;I;)w(I.data,A,T),T+=I.data.length,I=I.next;return A}},{key:"consume",value:function(S,A){var I;return S<this.head.data.length?(I=this.head.data.slice(0,S),this.head.data=this.head.data.slice(S)):S===this.head.data.length?I=this.shift():I=A?this._getString(S):this._getBuffer(S),I}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(S){var A=this.head,I=1,T=A.data;for(S-=T.length;A=A.next;){var O=A.data,k=S>O.length?O.length:S;if(k===O.length?T+=O:T+=O.slice(0,S),S-=k,S===0){k===O.length?(++I,A.next?this.head=A.next:this.head=this.tail=null):(this.head=A,A.data=O.slice(k));break}++I}return this.length-=I,T}},{key:"_getBuffer",value:function(S){var A=h.allocUnsafe(S),I=this.head,T=1;for(I.data.copy(A),S-=I.data.length;I=I.next;){var O=I.data,k=S>O.length?O.length:S;if(O.copy(A,A.length-S,0,k),S-=k,S===0){k===O.length?(++T,I.next?this.head=I.next:this.head=this.tail=null):(this.head=I,I.data=O.slice(k));break}++T}return this.length-=T,A}},{key:m,value:function(S,A){return g(this,e(e({},A),{},{depth:0,customInspect:!1}))}}]),v})(),Ff}var Uf,Fm;function S1(){if(Fm)return Uf;Fm=1;function t(a,c){var l=this,h=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return h||d?(c?c(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Fe.nextTick(i,this,a)):Fe.nextTick(i,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(g){!c&&g?l._writableState?l._writableState.errorEmitted?Fe.nextTick(n,l):(l._writableState.errorEmitted=!0,Fe.nextTick(e,l,g)):Fe.nextTick(e,l,g):c?(Fe.nextTick(n,l),c(g)):Fe.nextTick(n,l)}),this)}function e(a,c){i(a,c),n(a)}function n(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function r(){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,c){a.emit("error",c)}function s(a,c){var l=a._readableState,h=a._writableState;l&&l.autoDestroy||h&&h.autoDestroy?a.destroy(c):a.emit("error",c)}return Uf={destroy:t,undestroy:r,errorOrDestroy:s},Uf}var Lf={},Um;function Ns(){if(Um)return Lf;Um=1;function t(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,c.__proto__=l}var e={};function n(c,l,h){h||(h=Error);function d(m,w,v){return typeof l=="string"?l:l(m,w,v)}var g=(function(m){t(w,m);function w(v,E,S){return m.call(this,d(v,E,S))||this}return w})(h);g.prototype.name=h.name,g.prototype.code=c,e[c]=g}function r(c,l){if(Array.isArray(c)){var h=c.length;return c=c.map(function(d){return String(d)}),h>2?"one of ".concat(l," ").concat(c.slice(0,h-1).join(", "),", or ")+c[h-1]:h===2?"one of ".concat(l," ").concat(c[0]," or ").concat(c[1]):"of ".concat(l," ").concat(c[0])}else return"of ".concat(l," ").concat(String(c))}function i(c,l,h){return c.substr(0,l.length)===l}function s(c,l,h){return(h===void 0||h>c.length)&&(h=c.length),c.substring(h-l.length,h)===l}function a(c,l,h){return typeof h!="number"&&(h=0),h+l.length>c.length?!1:c.indexOf(l,h)!==-1}return n("ERR_INVALID_OPT_VALUE",function(c,l){return'The value "'+l+'" is invalid for option "'+c+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(c,l,h){var d;typeof l=="string"&&i(l,"not ")?(d="must not be",l=l.replace(/^not /,"")):d="must be";var g;if(s(c," argument"))g="The ".concat(c," ").concat(d," ").concat(r(l,"type"));else{var m=a(c,".")?"property":"argument";g='The "'.concat(c,'" ').concat(m," ").concat(d," ").concat(r(l,"type"))}return g+=". Received type ".concat(typeof h),g},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(c){return"The "+c+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(c){return"Cannot call "+c+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(c){return"Unknown encoding: "+c},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Lf.codes=e,Lf}var Mf,Lm;function I1(){if(Lm)return Mf;Lm=1;var t=Ns().codes.ERR_INVALID_OPT_VALUE;function e(r,i,s){return r.highWaterMark!=null?r.highWaterMark:i?r[s]:null}function n(r,i,s,a){var c=e(i,a,s);if(c!=null){if(!(isFinite(c)&&Math.floor(c)===c)||c<0){var l=a?s:"highWaterMark";throw new t(l,c)}return Math.floor(c)}return r.objectMode?16:16*1024}return Mf={getHighWaterMark:n},Mf}var $f,Mm;function hS(){if(Mm)return $f;Mm=1,$f=t;function t(n,r){if(e("noDeprecation"))return n;var i=!1;function s(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this,arguments)}return s}function e(n){try{if(!Qr.localStorage)return!1}catch{return!1}var r=Qr.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return $f}var zf,$m;function O1(){if($m)return zf;$m=1,zf=$;function t(M){var z=this;this.next=null,this.entry=null,this.finish=function(){Y(z,M)}}var e;$.WritableState=_;var n={deprecate:hS()},r=m1(),i=Nc().Buffer,s=(typeof Qr<"u"?Qr:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(M){return i.from(M)}function c(M){return i.isBuffer(M)||M instanceof s}var l=S1(),h=I1(),d=h.getHighWaterMark,g=Ns().codes,m=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,v=g.ERR_MULTIPLE_CALLBACK,E=g.ERR_STREAM_CANNOT_PIPE,S=g.ERR_STREAM_DESTROYED,A=g.ERR_STREAM_NULL_VALUES,I=g.ERR_STREAM_WRITE_AFTER_END,T=g.ERR_UNKNOWN_ENCODING,O=l.errorOrDestroy;_i()($,r);function k(){}function _(M,z,W){e=e||xs(),M=M||{},typeof W!="boolean"&&(W=z instanceof e),this.objectMode=!!M.objectMode,W&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=d(this,M,"writableHighWaterMark",W),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var te=M.decodeStrings===!1;this.decodeStrings=!te,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(se){q(z,se)},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,W=[];z;)W.push(z),z=z.next;return W},(function(){try{Object.defineProperty(_.prototype,"buffer",{get:n.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($,Symbol.hasInstance,{value:function(z){return D.call(this,z)?!0:this!==$?!1:z&&z._writableState instanceof _}})):D=function(z){return z instanceof this};function $(M){e=e||xs();var z=this instanceof e;if(!z&&!D.call($,this))return new $(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)),r.call(this)}$.prototype.pipe=function(){O(this,new E)};function j(M,z){var W=new I;O(M,W),Fe.nextTick(z,W)}function X(M,z,W,te){var se;return W===null?se=new A:typeof W!="string"&&!z.objectMode&&(se=new m("chunk",["string","Buffer"],W)),se?(O(M,se),Fe.nextTick(te,se),!1):!0}$.prototype.write=function(M,z,W){var te=this._writableState,se=!1,P=!te.objectMode&&c(M);return P&&!i.isBuffer(M)&&(M=a(M)),typeof z=="function"&&(W=z,z=null),P?z="buffer":z||(z=te.defaultEncoding),typeof W!="function"&&(W=k),te.ending?j(this,W):(P||X(this,te,M,W))&&(te.pendingcb++,se=U(this,te,P,M,z,W)),se},$.prototype.cork=function(){this._writableState.corked++},$.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&ce(this,M))},$.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 T(z);return this._writableState.defaultEncoding=z,this},Object.defineProperty($.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function de(M,z,W){return!M.objectMode&&M.decodeStrings!==!1&&typeof z=="string"&&(z=i.from(z,W)),z}Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function U(M,z,W,te,se,P){if(!W){var N=de(z,te,se);te!==N&&(W=!0,se="buffer",te=N)}var ee=z.objectMode?1:te.length;z.length+=ee;var ge=z.length<z.highWaterMark;if(ge||(z.needDrain=!0),z.writing||z.corked){var Pe=z.lastBufferedRequest;z.lastBufferedRequest={chunk:te,encoding:se,isBuf:W,callback:P,next:null},Pe?Pe.next=z.lastBufferedRequest:z.bufferedRequest=z.lastBufferedRequest,z.bufferedRequestCount+=1}else Z(M,z,!1,ee,te,se,P);return ge}function Z(M,z,W,te,se,P,N){z.writelen=te,z.writecb=N,z.writing=!0,z.sync=!0,z.destroyed?z.onwrite(new S("write")):W?M._writev(se,z.onwrite):M._write(se,P,z.onwrite),z.sync=!1}function J(M,z,W,te,se){--z.pendingcb,W?(Fe.nextTick(se,te),Fe.nextTick(V,M,z),M._writableState.errorEmitted=!0,O(M,te)):(se(te),M._writableState.errorEmitted=!0,O(M,te),V(M,z))}function L(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}function q(M,z){var W=M._writableState,te=W.sync,se=W.writecb;if(typeof se!="function")throw new v;if(L(W),z)J(M,W,te,z,se);else{var P=he(W)||M.destroyed;!P&&!W.corked&&!W.bufferProcessing&&W.bufferedRequest&&ce(M,W),te?Fe.nextTick(re,M,W,P,se):re(M,W,P,se)}}function re(M,z,W,te){W||le(M,z),z.pendingcb--,te(),V(M,z)}function le(M,z){z.length===0&&z.needDrain&&(z.needDrain=!1,M.emit("drain"))}function ce(M,z){z.bufferProcessing=!0;var W=z.bufferedRequest;if(M._writev&&W&&W.next){var te=z.bufferedRequestCount,se=new Array(te),P=z.corkedRequestsFree;P.entry=W;for(var N=0,ee=!0;W;)se[N]=W,W.isBuf||(ee=!1),W=W.next,N+=1;se.allBuffers=ee,Z(M,z,!0,z.length,se,"",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(;W;){var ge=W.chunk,Pe=W.encoding,Ee=W.callback,Ce=z.objectMode?1:ge.length;if(Z(M,z,!1,Ce,ge,Pe,Ee),W=W.next,z.bufferedRequestCount--,z.writing)break}W===null&&(z.lastBufferedRequest=null)}z.bufferedRequest=W,z.bufferProcessing=!1}$.prototype._write=function(M,z,W){W(new w("_write()"))},$.prototype._writev=null,$.prototype.end=function(M,z,W){var te=this._writableState;return typeof M=="function"?(W=M,M=null,z=null):typeof z=="function"&&(W=z,z=null),M!=null&&this.write(M,z),te.corked&&(te.corked=1,this.uncork()),te.ending||K(this,te,W),this},Object.defineProperty($.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function he(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function be(M,z){M._final(function(W){z.pendingcb--,W&&O(M,W),z.prefinished=!0,M.emit("prefinish"),V(M,z)})}function xe(M,z){!z.prefinished&&!z.finalCalled&&(typeof M._final=="function"&&!z.destroyed?(z.pendingcb++,z.finalCalled=!0,Fe.nextTick(be,M,z)):(z.prefinished=!0,M.emit("prefinish")))}function V(M,z){var W=he(z);if(W&&(xe(M,z),z.pendingcb===0&&(z.finished=!0,M.emit("finish"),z.autoDestroy))){var te=M._readableState;(!te||te.autoDestroy&&te.endEmitted)&&M.destroy()}return W}function K(M,z,W){z.ending=!0,V(M,z),W&&(z.finished?Fe.nextTick(W):M.once("finish",W)),z.ended=!0,M.writable=!1}function Y(M,z,W){var te=M.entry;for(M.entry=null;te;){var se=te.callback;z.pendingcb--,se(W),te=te.next}z.corkedRequestsFree.next=M}return Object.defineProperty($.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(z){this._writableState&&(this._writableState.destroyed=z)}}),$.prototype.destroy=l.destroy,$.prototype._undestroy=l.undestroy,$.prototype._destroy=function(M,z){z(M)},zf}var Gf,zm;function xs(){if(zm)return Gf;zm=1;var t=Object.keys||function(h){var d=[];for(var g in h)d.push(g);return d};Gf=a;var e=P1(),n=O1();_i()(a,e);for(var r=t(n.prototype),i=0;i<r.length;i++){var s=r[i];a.prototype[s]||(a.prototype[s]=n.prototype[s])}function a(h){if(!(this instanceof a))return new a(h);e.call(this,h),n.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",c)))}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 c(){this._writableState.ended||Fe.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)}}),Gf}var Vf={},va={exports:{}};var Gm;function dS(){return Gm||(Gm=1,(function(t,e){var n=Nc(),r=n.Buffer;function i(a,c){for(var l in a)c[l]=a[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=s);function s(a,c,l){return r(a,c,l)}s.prototype=Object.create(r.prototype),i(r,s),s.from=function(a,c,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return r(a,c,l)},s.alloc=function(a,c,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=r(a);return c!==void 0?typeof l=="string"?h.fill(c,l):h.fill(c):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(a)}})(va,va.exports)),va.exports}var Vm;function jm(){if(Vm)return Vf;Vm=1;var t=dS().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 n(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 r(A){var I=n(A);if(typeof I!="string"&&(t.isEncoding===e||!e(A)))throw new Error("Unknown encoding: "+A);return I||A}Vf.StringDecoder=i;function i(A){this.encoding=r(A);var I;switch(this.encoding){case"utf16le":this.text=g,this.end=m,I=4;break;case"utf8":this.fillLast=l,I=4;break;case"base64":this.text=w,this.end=v,I=3;break;default:this.write=E,this.end=S;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(I)}i.prototype.write=function(A){if(A.length===0)return"";var I,T;if(this.lastNeed){if(I=this.fillLast(A),I===void 0)return"";T=this.lastNeed,this.lastNeed=0}else T=0;return T<A.length?I?I+this.text(A,T):this.text(A,T):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 s(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,T){var O=I.length-1;if(O<T)return 0;var k=s(I[O]);return k>=0?(k>0&&(A.lastNeed=k-1),k):--O<T||k===-2?0:(k=s(I[O]),k>=0?(k>0&&(A.lastNeed=k-2),k):--O<T||k===-2?0:(k=s(I[O]),k>=0?(k>0&&(k===2?k=0:A.lastNeed=k-3),k):0))}function c(A,I,T){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,T=c(this,A);if(T!==void 0)return T;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 T=a(this,A,I);if(!this.lastNeed)return A.toString("utf8",I);this.lastTotal=T;var O=A.length-(T-this.lastNeed);return A.copy(this.lastChar,0,O),A.toString("utf8",I,O)}function d(A){var I=A&&A.length?this.write(A):"";return this.lastNeed?I+"�":I}function g(A,I){if((A.length-I)%2===0){var T=A.toString("utf16le",I);if(T){var O=T.charCodeAt(T.length-1);if(O>=55296&&O<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1],T.slice(0,-1)}return T}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=A[A.length-1],A.toString("utf16le",I,A.length-1)}function m(A){var I=A&&A.length?this.write(A):"";if(this.lastNeed){var T=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,T)}return I}function w(A,I){var T=(A.length-I)%3;return T===0?A.toString("base64",I):(this.lastNeed=3-T,this.lastTotal=3,T===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-T))}function v(A){var I=A&&A.length?this.write(A):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function E(A){return A.toString(this.encoding)}function S(A){return A&&A.length?this.write(A):""}return Vf}var jf,Hm;function _d(){if(Hm)return jf;Hm=1;var t=Ns().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var a=!1;return function(){if(!a){a=!0;for(var c=arguments.length,l=new Array(c),h=0;h<c;h++)l[h]=arguments[h];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function i(s,a,c){if(typeof a=="function")return i(s,null,a);a||(a={}),c=e(c||n);var l=a.readable||a.readable!==!1&&s.readable,h=a.writable||a.writable!==!1&&s.writable,d=function(){s.writable||m()},g=s._writableState&&s._writableState.finished,m=function(){h=!1,g=!0,l||c.call(s)},w=s._readableState&&s._readableState.endEmitted,v=function(){l=!1,w=!0,h||c.call(s)},E=function(T){c.call(s,T)},S=function(){var T;if(l&&!w)return(!s._readableState||!s._readableState.ended)&&(T=new t),c.call(s,T);if(h&&!g)return(!s._writableState||!s._writableState.ended)&&(T=new t),c.call(s,T)},A=function(){s.req.on("finish",m)};return r(s)?(s.on("complete",m),s.on("abort",S),s.req?A():s.on("request",A)):h&&!s._writableState&&(s.on("end",d),s.on("close",d)),s.on("end",v),s.on("finish",m),a.error!==!1&&s.on("error",E),s.on("close",S),function(){s.removeListener("complete",m),s.removeListener("abort",S),s.removeListener("request",A),s.req&&s.req.removeListener("finish",m),s.removeListener("end",d),s.removeListener("close",d),s.removeListener("finish",m),s.removeListener("end",v),s.removeListener("error",E),s.removeListener("close",S)}}return jf=i,jf}var Hf,qm;function pS(){if(qm)return Hf;qm=1;var t;function e(T,O,k){return O=n(O),O in T?Object.defineProperty(T,O,{value:k,enumerable:!0,configurable:!0,writable:!0}):T[O]=k,T}function n(T){var O=r(T,"string");return typeof O=="symbol"?O:String(O)}function r(T,O){if(typeof T!="object"||T===null)return T;var k=T[Symbol.toPrimitive];if(k!==void 0){var _=k.call(T,O);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(T)}var i=_d(),s=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),d=Symbol("handlePromise"),g=Symbol("stream");function m(T,O){return{value:T,done:O}}function w(T){var O=T[s];if(O!==null){var k=T[g].read();k!==null&&(T[h]=null,T[s]=null,T[a]=null,O(m(k,!1)))}}function v(T){Fe.nextTick(w,T)}function E(T,O){return function(k,_){T.then(function(){if(O[l]){k(m(void 0,!0));return}O[d](k,_)},_)}}var S=Object.getPrototypeOf(function(){}),A=Object.setPrototypeOf((t={get stream(){return this[g]},next:function(){var O=this,k=this[c];if(k!==null)return Promise.reject(k);if(this[l])return Promise.resolve(m(void 0,!0));if(this[g].destroyed)return new Promise(function(j,X){Fe.nextTick(function(){O[c]?X(O[c]):j(m(void 0,!0))})});var _=this[h],D;if(_)D=new Promise(E(_,this));else{var $=this[g].read();if($!==null)return Promise.resolve(m($,!1));D=new Promise(this[d])}return this[h]=D,D}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var O=this;return new Promise(function(k,_){O[g].destroy(null,function(D){if(D){_(D);return}k(m(void 0,!0))})})}),t),S),I=function(O){var k,_=Object.create(A,(k={},e(k,g,{value:O,writable:!0}),e(k,s,{value:null,writable:!0}),e(k,a,{value:null,writable:!0}),e(k,c,{value:null,writable:!0}),e(k,l,{value:O._readableState.endEmitted,writable:!0}),e(k,d,{value:function($,j){var X=_[g].read();X?(_[h]=null,_[s]=null,_[a]=null,$(m(X,!1))):(_[s]=$,_[a]=j)},writable:!0}),k));return _[h]=null,i(O,function(D){if(D&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"){var $=_[a];$!==null&&(_[h]=null,_[s]=null,_[a]=null,$(D)),_[c]=D;return}var j=_[s];j!==null&&(_[h]=null,_[s]=null,_[a]=null,j(m(void 0,!0))),_[l]=!0}),O.on("readable",v.bind(null,_)),_};return Hf=I,Hf}var qf,Zm;function gS(){return Zm||(Zm=1,qf=function(){throw new Error("Readable.from is not available in the browser")}),qf}var Zf,Km;function P1(){if(Km)return Zf;Km=1,Zf=j;var t;j.ReadableState=$,Od().EventEmitter;var e=function(N,ee){return N.listeners(ee).length},n=m1(),r=Nc().Buffer,i=(typeof Qr<"u"?Qr:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(P){return r.from(P)}function a(P){return r.isBuffer(P)||P instanceof i}var c=T1(),l;c&&c.debuglog?l=c.debuglog("stream"):l=function(){};var h=fS(),d=S1(),g=I1(),m=g.getHighWaterMark,w=Ns().codes,v=w.ERR_INVALID_ARG_TYPE,E=w.ERR_STREAM_PUSH_AFTER_EOF,S=w.ERR_METHOD_NOT_IMPLEMENTED,A=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,I,T,O;_i()(j,n);var k=d.errorOrDestroy,_=["error","close","destroy","pause","resume"];function D(P,N,ee){if(typeof P.prependListener=="function")return P.prependListener(N,ee);!P._events||!P._events[N]?P.on(N,ee):Array.isArray(P._events[N])?P._events[N].unshift(ee):P._events[N]=[ee,P._events[N]]}function $(P,N,ee){t=t||xs(),P=P||{},typeof ee!="boolean"&&(ee=N instanceof t),this.objectMode=!!P.objectMode,ee&&(this.objectMode=this.objectMode||!!P.readableObjectMode),this.highWaterMark=m(this,P,"readableHighWaterMark",ee),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=jm().StringDecoder),this.decoder=new I(P.encoding),this.encoding=P.encoding)}function j(P){if(t=t||xs(),!(this instanceof j))return new j(P);var N=this instanceof t;this._readableState=new $(P,this,N),this.readable=!0,P&&(typeof P.read=="function"&&(this._read=P.read),typeof P.destroy=="function"&&(this._destroy=P.destroy)),n.call(this)}Object.defineProperty(j.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(N){this._readableState&&(this._readableState.destroyed=N)}}),j.prototype.destroy=d.destroy,j.prototype._undestroy=d.undestroy,j.prototype._destroy=function(P,N){N(P)},j.prototype.push=function(P,N){var ee=this._readableState,ge;return ee.objectMode?ge=!0:typeof P=="string"&&(N=N||ee.defaultEncoding,N!==ee.encoding&&(P=r.from(P,N),N=""),ge=!0),X(this,P,N,!1,ge)},j.prototype.unshift=function(P){return X(this,P,null,!0,!1)};function X(P,N,ee,ge,Pe){l("readableAddChunk",N);var Ee=P._readableState;if(N===null)Ee.reading=!1,q(P,Ee);else{var Ce;if(Pe||(Ce=U(Ee,N)),Ce)k(P,Ce);else if(Ee.objectMode||N&&N.length>0)if(typeof N!="string"&&!Ee.objectMode&&Object.getPrototypeOf(N)!==r.prototype&&(N=s(N)),ge)Ee.endEmitted?k(P,new A):de(P,Ee,N,!0);else if(Ee.ended)k(P,new E);else{if(Ee.destroyed)return!1;Ee.reading=!1,Ee.decoder&&!ee?(N=Ee.decoder.write(N),Ee.objectMode||N.length!==0?de(P,Ee,N,!1):ce(P,Ee)):de(P,Ee,N,!1)}else ge||(Ee.reading=!1,ce(P,Ee))}return!Ee.ended&&(Ee.length<Ee.highWaterMark||Ee.length===0)}function de(P,N,ee,ge){N.flowing&&N.length===0&&!N.sync?(N.awaitDrain=0,P.emit("data",ee)):(N.length+=N.objectMode?1:ee.length,ge?N.buffer.unshift(ee):N.buffer.push(ee),N.needReadable&&re(P)),ce(P,N)}function U(P,N){var ee;return!a(N)&&typeof N!="string"&&N!==void 0&&!P.objectMode&&(ee=new v("chunk",["string","Buffer","Uint8Array"],N)),ee}j.prototype.isPaused=function(){return this._readableState.flowing===!1},j.prototype.setEncoding=function(P){I||(I=jm().StringDecoder);var N=new I(P);this._readableState.decoder=N,this._readableState.encoding=this._readableState.decoder.encoding;for(var ee=this._readableState.buffer.head,ge="";ee!==null;)ge+=N.write(ee.data),ee=ee.next;return this._readableState.buffer.clear(),ge!==""&&this._readableState.buffer.push(ge),this._readableState.length=ge.length,this};var Z=1073741824;function J(P){return P>=Z?P=Z:(P--,P|=P>>>1,P|=P>>>2,P|=P>>>4,P|=P>>>8,P|=P>>>16,P++),P}function L(P,N){return P<=0||N.length===0&&N.ended?0:N.objectMode?1:P!==P?N.flowing&&N.length?N.buffer.head.data.length:N.length:(P>N.highWaterMark&&(N.highWaterMark=J(P)),P<=N.length?P:N.ended?N.length:(N.needReadable=!0,0))}j.prototype.read=function(P){l("read",P),P=parseInt(P,10);var N=this._readableState,ee=P;if(P!==0&&(N.emittedReadable=!1),P===0&&N.needReadable&&((N.highWaterMark!==0?N.length>=N.highWaterMark:N.length>0)||N.ended))return l("read: emitReadable",N.length,N.ended),N.length===0&&N.ended?W(this):re(this),null;if(P=L(P,N),P===0&&N.ended)return N.length===0&&W(this),null;var ge=N.needReadable;l("need readable",ge),(N.length===0||N.length-P<N.highWaterMark)&&(ge=!0,l("length less than watermark",ge)),N.ended||N.reading?(ge=!1,l("reading or ended",ge)):ge&&(l("do read"),N.reading=!0,N.sync=!0,N.length===0&&(N.needReadable=!0),this._read(N.highWaterMark),N.sync=!1,N.reading||(P=L(ee,N)));var Pe;return P>0?Pe=z(P,N):Pe=null,Pe===null?(N.needReadable=N.length<=N.highWaterMark,P=0):(N.length-=P,N.awaitDrain=0),N.length===0&&(N.ended||(N.needReadable=!0),ee!==P&&N.ended&&W(this)),Pe!==null&&this.emit("data",Pe),Pe};function q(P,N){if(l("onEofChunk"),!N.ended){if(N.decoder){var ee=N.decoder.end();ee&&ee.length&&(N.buffer.push(ee),N.length+=N.objectMode?1:ee.length)}N.ended=!0,N.sync?re(P):(N.needReadable=!1,N.emittedReadable||(N.emittedReadable=!0,le(P)))}}function re(P){var N=P._readableState;l("emitReadable",N.needReadable,N.emittedReadable),N.needReadable=!1,N.emittedReadable||(l("emitReadable",N.flowing),N.emittedReadable=!0,Fe.nextTick(le,P))}function le(P){var N=P._readableState;l("emitReadable_",N.destroyed,N.length,N.ended),!N.destroyed&&(N.length||N.ended)&&(P.emit("readable"),N.emittedReadable=!1),N.needReadable=!N.flowing&&!N.ended&&N.length<=N.highWaterMark,M(P)}function ce(P,N){N.readingMore||(N.readingMore=!0,Fe.nextTick(he,P,N))}function he(P,N){for(;!N.reading&&!N.ended&&(N.length<N.highWaterMark||N.flowing&&N.length===0);){var ee=N.length;if(l("maybeReadMore read 0"),P.read(0),ee===N.length)break}N.readingMore=!1}j.prototype._read=function(P){k(this,new S("_read()"))},j.prototype.pipe=function(P,N){var ee=this,ge=this._readableState;switch(ge.pipesCount){case 0:ge.pipes=P;break;case 1:ge.pipes=[ge.pipes,P];break;default:ge.pipes.push(P);break}ge.pipesCount+=1,l("pipe count=%d opts=%j",ge.pipesCount,N);var Pe=(!N||N.end!==!1)&&P!==Fe.stdout&&P!==Fe.stderr,Ee=Pe?Rt:We;ge.endEmitted?Fe.nextTick(Ee):ee.once("end",Ee),P.on("unpipe",Ce);function Ce(xt,Mt){l("onunpipe"),xt===ee&&Mt&&Mt.hasUnpiped===!1&&(Mt.hasUnpiped=!0,ct())}function Rt(){l("onend"),P.end()}var oe=be(ee);P.on("drain",oe);var at=!1;function ct(){l("cleanup"),P.removeListener("close",Tt),P.removeListener("finish",qt),P.removeListener("drain",oe),P.removeListener("error",Ze),P.removeListener("unpipe",Ce),ee.removeListener("end",Rt),ee.removeListener("end",We),ee.removeListener("data",Ge),at=!0,ge.awaitDrain&&(!P._writableState||P._writableState.needDrain)&&oe()}ee.on("data",Ge);function Ge(xt){l("ondata");var Mt=P.write(xt);l("dest.write",Mt),Mt===!1&&((ge.pipesCount===1&&ge.pipes===P||ge.pipesCount>1&&se(ge.pipes,P)!==-1)&&!at&&(l("false write response, pause",ge.awaitDrain),ge.awaitDrain++),ee.pause())}function Ze(xt){l("onerror",xt),We(),P.removeListener("error",Ze),e(P,"error")===0&&k(P,xt)}D(P,"error",Ze);function Tt(){P.removeListener("finish",qt),We()}P.once("close",Tt);function qt(){l("onfinish"),P.removeListener("close",Tt),We()}P.once("finish",qt);function We(){l("unpipe"),ee.unpipe(P)}return P.emit("pipe",ee),ge.flowing||(l("pipe resume"),ee.resume()),P};function be(P){return function(){var ee=P._readableState;l("pipeOnDrain",ee.awaitDrain),ee.awaitDrain&&ee.awaitDrain--,ee.awaitDrain===0&&e(P,"data")&&(ee.flowing=!0,M(P))}}j.prototype.unpipe=function(P){var N=this._readableState,ee={hasUnpiped:!1};if(N.pipesCount===0)return this;if(N.pipesCount===1)return P&&P!==N.pipes?this:(P||(P=N.pipes),N.pipes=null,N.pipesCount=0,N.flowing=!1,P&&P.emit("unpipe",this,ee),this);if(!P){var ge=N.pipes,Pe=N.pipesCount;N.pipes=null,N.pipesCount=0,N.flowing=!1;for(var Ee=0;Ee<Pe;Ee++)ge[Ee].emit("unpipe",this,{hasUnpiped:!1});return this}var Ce=se(N.pipes,P);return Ce===-1?this:(N.pipes.splice(Ce,1),N.pipesCount-=1,N.pipesCount===1&&(N.pipes=N.pipes[0]),P.emit("unpipe",this,ee),this)},j.prototype.on=function(P,N){var ee=n.prototype.on.call(this,P,N),ge=this._readableState;return P==="data"?(ge.readableListening=this.listenerCount("readable")>0,ge.flowing!==!1&&this.resume()):P==="readable"&&!ge.endEmitted&&!ge.readableListening&&(ge.readableListening=ge.needReadable=!0,ge.flowing=!1,ge.emittedReadable=!1,l("on readable",ge.length,ge.reading),ge.length?re(this):ge.reading||Fe.nextTick(V,this)),ee},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(P,N){var ee=n.prototype.removeListener.call(this,P,N);return P==="readable"&&Fe.nextTick(xe,this),ee},j.prototype.removeAllListeners=function(P){var N=n.prototype.removeAllListeners.apply(this,arguments);return(P==="readable"||P===void 0)&&Fe.nextTick(xe,this),N};function xe(P){var N=P._readableState;N.readableListening=P.listenerCount("readable")>0,N.resumeScheduled&&!N.paused?N.flowing=!0:P.listenerCount("data")>0&&P.resume()}function V(P){l("readable nexttick read 0"),P.read(0)}j.prototype.resume=function(){var P=this._readableState;return P.flowing||(l("resume"),P.flowing=!P.readableListening,K(this,P)),P.paused=!1,this};function K(P,N){N.resumeScheduled||(N.resumeScheduled=!0,Fe.nextTick(Y,P,N))}function Y(P,N){l("resume",N.reading),N.reading||P.read(0),N.resumeScheduled=!1,P.emit("resume"),M(P),N.flowing&&!N.reading&&P.read(0)}j.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 N=P._readableState;for(l("flow",N.flowing);N.flowing&&P.read()!==null;);}j.prototype.wrap=function(P){var N=this,ee=this._readableState,ge=!1;P.on("end",function(){if(l("wrapped end"),ee.decoder&&!ee.ended){var Ce=ee.decoder.end();Ce&&Ce.length&&N.push(Ce)}N.push(null)}),P.on("data",function(Ce){if(l("wrapped data"),ee.decoder&&(Ce=ee.decoder.write(Ce)),!(ee.objectMode&&Ce==null)&&!(!ee.objectMode&&(!Ce||!Ce.length))){var Rt=N.push(Ce);Rt||(ge=!0,P.pause())}});for(var Pe in P)this[Pe]===void 0&&typeof P[Pe]=="function"&&(this[Pe]=(function(Rt){return function(){return P[Rt].apply(P,arguments)}})(Pe));for(var Ee=0;Ee<_.length;Ee++)P.on(_[Ee],this.emit.bind(this,_[Ee]));return this._read=function(Ce){l("wrapped _read",Ce),ge&&(ge=!1,P.resume())},this},typeof Symbol=="function"&&(j.prototype[Symbol.asyncIterator]=function(){return T===void 0&&(T=pS()),T(this)}),Object.defineProperty(j.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(j.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(j.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(N){this._readableState&&(this._readableState.flowing=N)}}),j._fromList=z,Object.defineProperty(j.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function z(P,N){if(N.length===0)return null;var ee;return N.objectMode?ee=N.buffer.shift():!P||P>=N.length?(N.decoder?ee=N.buffer.join(""):N.buffer.length===1?ee=N.buffer.first():ee=N.buffer.concat(N.length),N.buffer.clear()):ee=N.buffer.consume(P,N.decoder),ee}function W(P){var N=P._readableState;l("endReadable",N.endEmitted),N.endEmitted||(N.ended=!0,Fe.nextTick(te,N,P))}function te(P,N){if(l("endReadableNT",P.endEmitted,P.length),!P.endEmitted&&P.length===0&&(P.endEmitted=!0,N.readable=!1,N.emit("end"),P.autoDestroy)){var ee=N._writableState;(!ee||ee.autoDestroy&&ee.finished)&&N.destroy()}}typeof Symbol=="function"&&(j.from=function(P,N){return O===void 0&&(O=gS()),O(j,P,N)});function se(P,N){for(var ee=0,ge=P.length;ee<ge;ee++)if(P[ee]===N)return ee;return-1}return Zf}var Kf,Jm;function k1(){if(Jm)return Kf;Jm=1,Kf=c;var t=Ns().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,s=xs();_i()(c,s);function a(d,g){var m=this._transformState;m.transforming=!1;var w=m.writecb;if(w===null)return this.emit("error",new n);m.writechunk=null,m.writecb=null,g!=null&&this.push(g),w(d);var v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}function c(d){if(!(this instanceof c))return new c(d);s.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(g,m){h(d,g,m)}):h(this,null,null)}c.prototype.push=function(d,g){return this._transformState.needTransform=!1,s.prototype.push.call(this,d,g)},c.prototype._transform=function(d,g,m){m(new e("_transform()"))},c.prototype._write=function(d,g,m){var w=this._transformState;if(w.writecb=m,w.writechunk=d,w.writeencoding=g,!w.transforming){var v=this._readableState;(w.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}},c.prototype._read=function(d){var g=this._transformState;g.writechunk!==null&&!g.transforming?(g.transforming=!0,this._transform(g.writechunk,g.writeencoding,g.afterTransform)):g.needTransform=!0},c.prototype._destroy=function(d,g){s.prototype._destroy.call(this,d,function(m){g(m)})};function h(d,g,m){if(g)return d.emit("error",g);if(m!=null&&d.push(m),d._writableState.length)throw new i;if(d._transformState.transforming)throw new r;return d.push(null)}return Kf}var Jf,Wm;function mS(){if(Wm)return Jf;Wm=1,Jf=e;var t=k1();_i()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,i){i(null,n)},Jf}var Wf,Qm;function bS(){if(Qm)return Wf;Qm=1;var t;function e(m){var w=!1;return function(){w||(w=!0,m.apply(void 0,arguments))}}var n=Ns().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function s(m){if(m)throw m}function a(m){return m.setHeader&&typeof m.abort=="function"}function c(m,w,v,E){E=e(E);var S=!1;m.on("close",function(){S=!0}),t===void 0&&(t=_d()),t(m,{readable:w,writable:v},function(I){if(I)return E(I);S=!0,E()});var A=!1;return function(I){if(!S&&!A){if(A=!0,a(m))return m.abort();if(typeof m.destroy=="function")return m.destroy();E(I||new i("pipe"))}}}function l(m){m()}function h(m,w){return m.pipe(w)}function d(m){return!m.length||typeof m[m.length-1]!="function"?s:m.pop()}function g(){for(var m=arguments.length,w=new Array(m),v=0;v<m;v++)w[v]=arguments[v];var E=d(w);if(Array.isArray(w[0])&&(w=w[0]),w.length<2)throw new r("streams");var S,A=w.map(function(I,T){var O=T<w.length-1,k=T>0;return c(I,O,k,function(_){S||(S=_),_&&A.forEach(l),!O&&(A.forEach(l),E(S))})});return w.reduce(h)}return Wf=g,Wf}var Qf,Ym;function yS(){if(Ym)return Qf;Ym=1,Qf=n;var t=Od().EventEmitter,e=_i();e(n,t),n.Readable=P1(),n.Writable=O1(),n.Duplex=xs(),n.Transform=k1(),n.PassThrough=mS(),n.finished=_d(),n.pipeline=bS(),n.Stream=n;function n(){t.call(this)}return n.prototype.pipe=function(r,i){var s=this;function a(w){r.writable&&r.write(w)===!1&&s.pause&&s.pause()}s.on("data",a);function c(){s.readable&&s.resume&&s.resume()}r.on("drain",c),!r._isStdio&&(!i||i.end!==!1)&&(s.on("end",h),s.on("close",d));var l=!1;function h(){l||(l=!0,r.end())}function d(){l||(l=!0,typeof r.destroy=="function"&&r.destroy())}function g(w){if(m(),t.listenerCount(this,"error")===0)throw w}s.on("error",g),r.on("error",g);function m(){s.removeListener("data",a),r.removeListener("drain",c),s.removeListener("end",h),s.removeListener("close",d),s.removeListener("error",g),r.removeListener("error",g),s.removeListener("end",m),s.removeListener("close",m),r.removeListener("close",m)}return s.on("end",m),s.on("close",m),r.on("close",m),r.emit("pipe",s),r},Qf}var Xm=yS();function N1(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 C1(t){return t.arrayBuffer?t.arrayBuffer():new Promise(e=>{const n=new FileReader;n.onload=()=>e(n.result),n.readAsArrayBuffer(t)})}var ts;(function(t){t.FULL="full",t.LIGHT="light",t.ULTRA_LIGHT="ultra-light",t.DEV="dev"})(ts||(ts={}));function _1(t){switch(t){case"full":return ts.FULL;case"light":return ts.LIGHT;case"ultra-light":return ts.ULTRA_LIGHT;case"dev":return ts.DEV;default:throw new Error(`Unknown Bee mode: ${t}`)}}const xS=32,wS=128,Ba=xS*wS,eb=17,tb=255,AS=1,ES=1e3;var En;(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"})(En||(En={}));var nb;(function(t){t[t.NONE=0]="NONE",t[t.DATA=1]="DATA",t[t.PROX=2]="PROX",t[t.RACE=3]="RACE"})(nb||(nb={}));const VF={ENCRYPTION_OFF:{[En.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%"}],[En.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%"}],[En.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%"}],[En.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%"}],[En.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:{[En.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%"}],[En.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%"}],[En.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%"}],[En.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%"}],[En.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%"}]}};me().regex(/^(?:0x)?[0-9a-fA-F]*$/i,"expected hex string").refine(t=>t.replace(/^0x/i,"").length%2===0,"expected even-length hex string");const vi=Ti().refine(t=>sT().safeParse(t).success,"expected a function"),vS=Ti().transform(t=>(u1().safeParse(t).success&&(t=String(t)),me().regex(/^-?\d+$/,"expected integer string").parse(t))),rb=Ti().transform(t=>(u1().safeParse(t).success&&(t=String(t)),me().regex(/^\d+$/,"expected non-negative integer string").parse(t))),BS=Te({baseURL:me().optional(),timeout:ve().int().min(0).optional(),headers:l1(me(),me()).optional(),onRequest:vi.optional(),httpAgent:ys().optional(),httpsAgent:ys().optional(),endlesslyRetry:Xe().optional(),signal:Ti().optional()}),Yr=Te({redundancyStrategy:ve().int().optional(),fallback:Xe().optional(),timeoutMs:ve().int().min(0).optional(),actPublisher:vo(Ti().transform(t=>new Un(t))),actHistoryAddress:vo(Ti().transform(t=>new Ue(t))),actTimestamp:p1().optional()}),jo=Te({act:Xe().optional(),actHistoryAddress:vo(Ti().transform(t=>new Ue(t))),deferred:Xe().optional(),encrypt:Xe().optional(),pin:Xe().optional(),tag:ve().int().min(0).optional()}),RS=jo.extend({redundancyLevel:ve().int().min(0).optional()}),TS=jo.extend({size:ve().int().min(0).optional(),contentType:me().optional(),redundancyLevel:ve().int().min(0).optional()}),Yf=jo.extend({errorDocument:me().optional(),indexDocument:me().optional(),redundancyLevel:ve().int().min(0).optional()}),SS=Te({uid:ve().int()}),IS=p1().min(0),OS=Te({onMessage:vi,onError:vi,onClose:vi}),PS=Te({onMessage:vi,onError:vi,onClose:vi}),D1=Te({gasPrice:vS.optional(),immutableFlag:Xe().optional(),label:me().optional(),waitForUsable:Xe().optional(),waitForUsableTimeout:ve().int().min(0).optional()}),F1=Te({gasLimit:rb.optional(),gasPrice:rb.optional()}),kS=Te({limit:ve().int().min(AS).max(ES).optional(),offset:ve().int().min(0).optional()});function Dd(t){return typeof Xm.Readable<"u"&&t instanceof Xm.Readable}function qe(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 NS(t){return SS.safeParse(t).success}function U1(t){if(typeof t!="string"&&!(t instanceof Uint8Array)&&!(t instanceof Blob)&&!Dd(t))throw new TypeError("Data must be either string, Uint8Array, Blob or Readable!")}function CS(t){if(typeof t!="string"&&!(t instanceof Uint8Array)&&!N1(t)&&!Dd(t))throw new TypeError("Data must be either string, Readable, Uint8Array or File!")}function Kr(t){if(t==null)throw new TypeError(`Expected number | Tag | string from tagUid, got: ${t}`);if(NS(t))return t.uid;if(typeof t=="number"||typeof t=="string")return IS.parse(t);throw new TypeError(`Expected number | Tag | string from tagUid, got: ${t}`)}function _S(t){return!Number.isInteger(t)||t<1?1:t>3155695200?3155695200:t}function DS(t){return!Number.isInteger(t)||t<24e3?24e3:t}function Hi(t,e){return Le.fromPLUR(2n**BigInt(t)*BigInt(e))}function FS(t,e,n){const r=BigInt(qe(t));return ln.fromSeconds(Number(r*BigInt(n)/BigInt(e)))}function Hn(t,e,n){return BigInt(t.toSeconds())/BigInt(n)*BigInt(e)+1n}function qi(t,e,n){return s5(t.toBytes(),e,n)}function US(t){return a5(t)}function L1(t,e,n){const r=_S(t.batchTTL),i=ln.fromSeconds(r),s=Ga(t.depth,e,n),a=t.utilizationRatio??r5(t.utilization,t.depth,t.bucketDepth);return{batchID:new ot(t.batchID),utilization:t.utilization,usable:t.usable,label:t.label,depth:t.depth,amount:qe(t.amount),bucketDepth:t.bucketDepth,blockNumber:t.blockNumber,immutableFlag:t.immutableFlag,usage:a,usageText:`${Math.round(a*100)}%`,size:Dn.fromBytes(s),remainingSize:Dn.fromBytes(Math.ceil(s*(1-a))),theoreticalSize:Dn.fromBytes(Cx(t.depth)),duration:i,calculateSize(c,l){const h=Ga(t.depth,c,l);return Dn.fromBytes(h)},calculateRemainingSize(c,l){const h=Ga(t.depth,c,l);return Dn.fromBytes(Math.ceil(h*(1-this.usage)))}}}function M1(t){const e=LS(t["content-disposition"]),n=MS(t["swarm-tag-uid"]),r=t["content-type"]||void 0;return{name:e,tagUid:n,contentType:r}}function LS(t){if(!t)throw new Ln("missing content-disposition header");const e=t.match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/i);if(e&&e.length>0)return e[1];throw new Ln("invalid content-disposition header")}function MS(t){if(t)return parseInt(t,10)}function Ht(t,e){const n={};if($S(t)?n["swarm-postage-stamp"]=US(t).toHex():t&&(t=new ot(t),n["swarm-postage-batch-id"]=t.toHex()),!e)return n;const r=e;r.size&&(n["content-length"]=String(r.size)),r.contentType&&(n["content-type"]=String(r.contentType)),r.redundancyLevel&&(n["swarm-redundancy-level"]=String(r.redundancyLevel));const i=Xe().safeParse(r.act);i.success&&(n["swarm-act"]=String(i.data));const s=Xe().safeParse(r.pin);s.success&&(n["swarm-pin"]=String(s.data));const a=Xe().safeParse(r.encrypt);a.success&&(n["swarm-encrypt"]=String(a.data)),r.tag&&(n["swarm-tag"]=String(r.tag));const c=Xe().safeParse(r.deferred);c.success&&(n["swarm-deferred-upload"]=String(c.data)),r.redundancyStrategy&&(n["swarm-redundancy-strategy"]=String(r.redundancyStrategy));const l=Xe().safeParse(r.fallback);return l.success&&(n["swarm-redundancy-fallback-mode"]=String(l.data)),r.timeoutMs&&(n["swarm-chunk-retrieval-timeout"]=String(r.timeoutMs)),r.indexDocument&&(n["swarm-index-document"]=String(r.indexDocument)),r.errorDocument&&(n["swarm-error-document"]=String(r.errorDocument)),r.actPublisher&&(n["swarm-act-publisher"]=new Un(r.actPublisher).toCompressedHex()),r.actHistoryAddress&&(n["swarm-act-history-address"]=new Ue(r.actHistoryAddress).toHex()),r.actTimestamp&&(n["swarm-act-timestamp"]=String(r.actTimestamp)),(r.actPublisher||r.actHistoryAddress||r.actTimestamp)&&(n["swarm-act"]="true"),r.gasPrice&&(n["gas-price"]=String(r.gasPrice)),r.gasLimit&&(n["gas-limit"]=String(r.gasLimit)),n}function $S(t){if(!Te({}).safeParse(t).success)return!1;const n=t;return n.issuer!==void 0&&n.index!==void 0&&n.signature!==void 0&&n.timestamp!==void 0&&n.batchId!==void 0}const $1="chunks";async function zS(t,e,n,r){const i=await ye(t,{method:"post",url:`${$1}`,data:e,headers:{"content-type":"application/octet-stream",...Ht(n,r)},responseType:"json"});return{reference:Ci.parse(i.data).reference,tagUid:i.headers["swarm-tag"]?Kr(i.headers["swarm-tag"]):void 0,historyAddress:i.headers["swarm-act-history-address"]?ke.Optional.of(new Ue(i.headers["swarm-act-history-address"])):ke.Optional.empty()}}async function Ho(t,e,n){e=new Ue(e);const r=await ye(t,{responseType:"arraybuffer",url:`${$1}/${e}`,headers:Ht(null,n)});return new Uint8Array(r.data)}const GS="soc";async function VS(t,e,n,r,i,s,a){const c=await ye(t,{method:"post",url:`${GS}/${e}/${n}`,data:i,headers:{"content-type":"application/octet-stream",...Ht(s,a)},responseType:"json",params:{sig:r.toHex()}});return{reference:Ci.parse(c.data).reference,tagUid:c.headers["swarm-tag"]?Kr(c.headers["swarm-tag"]):void 0,historyAddress:c.headers["swarm-act-history-address"]?ke.Optional.of(new Ue(c.headers["swarm-act-history-address"])):ke.Optional.empty()}}function Dc(t,e){try{return jv(t,e)}catch(n){throw new Ln(n.message)}}function jS(t,e,n,r,i){r=new Vt(r),i=new Er(i);const s={data:Se.concat(e.toUint8Array(),n.toUint8Array()),span:e,payload:n,address:t};return kx(s,r,i.toBigInt())}async function Fd(t,e,n,r){const i=Se.concat(e.span.toUint8Array(),e.payload.toUint8Array());return VS(t,e.owner,e.identifier,e.signature,i,n,r)}async function Ud(t,e,n,r,i,s){e=new Er(e),r=new Vt(r);const c=Mo(i).toSingleOwnerChunk(r,e);return Fd(t,c,n,s)}async function HS(t,e,n,r,i,s){e=new Er(e),r=new Vt(r);const a=i.toSingleOwnerChunk(r,e);return Fd(t,a,n,s)}async function qS(t,e,n){n=new Vt(n),e=new It(e);const r=gs(n,e),i=await Ho(t,r.toHex());return Dc(i,r)}const z1=Te({peer:me(),balance:me().transform(t=>Le.fromPLUR(qe(t,{name:"balance"})))}),G1=Te({balances:Lt(z1)}),V1=z1,j1="balances";async function ZS(t){const e=await ye(t,{url:j1,responseType:"json"});return G1.parse(e.data)}async function KS(t,e){const n=await ye(t,{url:`${j1}/${e}`,responseType:"json"});return V1.parse(n.data)}const H1="consumed";async function JS(t){const e=await ye(t,{url:H1,responseType:"json"});return G1.parse(e.data)}async function WS(t,e){const n=await ye(t,{url:`${H1}/${e}`,responseType:"json"});return V1.parse(n.data)}class QS{constructor(e){this.context=e}async getAll(e){return ZS(this.context.getRequestOptionsForCall(e))}async getPeer(e,n){const r=new Qn(e);return KS(this.context.getRequestOptionsForCall(n),r)}async getAllPastDueConsumption(e){return JS(this.context.getRequestOptionsForCall(e))}async getAllPastDueConsumptionForPeer(e,n){const r=new Qn(e);return WS(this.context.getRequestOptionsForCall(n),r)}}const Ro=Te({beneficiary:me().transform(t=>new It(t)),chequebook:me().transform(t=>new It(t)),payout:me().transform(t=>Le.fromPLUR(qe(t,{name:"payout"})))}),YS=Te({recipient:me(),lastPayout:me().transform(t=>Le.fromPLUR(qe(t,{name:"lastPayout"}))),bounced:Xe()}),XS=Te({chequebookAddress:me().transform(t=>new It(t))}),eI=Te({availableBalance:me().transform(t=>Le.fromPLUR(qe(t,{name:"availableBalance"}))),totalBalance:me().transform(t=>Le.fromPLUR(qe(t,{name:"totalBalance"})))}),tI=Te({peer:me(),uncashedAmount:me().transform(t=>Le.fromPLUR(qe(t,{name:"uncashedAmount"}))),transactionHash:me().nullish().transform(t=>t??null),lastCashedCheque:Ro.nullish().transform(t=>t??null),result:YS.nullish().transform(t=>t??null)}),nI=Te({peer:me(),lastreceived:Ro.nullish().transform(t=>t??null),lastsent:Ro.nullish().transform(t=>t??null)}),rI=Te({lastcheques:Lt(Te({peer:me(),lastreceived:Ro.nullish().transform(t=>t??null),lastsent:Ro.nullish().transform(t=>t??null)}))}),Ld=Te({transactionHash:me().transform(t=>new Zr(t))}),ti="chequebook";async function iI(t){const e=await ye(t,{url:`${ti}/address`,responseType:"json"});return XS.parse(e.data)}async function sI(t){const e=await ye(t,{url:`${ti}/balance`,responseType:"json"});return eI.parse(e.data)}async function oI(t,e,n){const r={};n&&(r["gas-price"]=n);const i=await ye(t,{method:"post",url:`${ti}/deposit`,responseType:"json",params:{amount:e},headers:r});return Ld.parse(i.data).transactionHash}async function aI(t,e,n){const r={};n&&(r["gas-price"]=n);const i=await ye(t,{method:"post",url:`${ti}/withdraw`,responseType:"json",params:{amount:e},headers:r});return Ld.parse(i.data).transactionHash}async function cI(t){const e=await ye(t,{url:`${ti}/cheque`,responseType:"json"});return rI.parse(e.data)}async function uI(t,e){const n=await ye(t,{url:`${ti}/cheque/${e}`,responseType:"json"});return nI.parse(n.data)}async function lI(t,e){const n=await ye(t,{url:`${ti}/cashout/${e}`,responseType:"json"});return tI.parse(n.data)}async function fI(t,e,n){const r=await ye(t,{method:"post",url:`${ti}/cashout/${e}`,responseType:"json",headers:Ht(null,n)});return Ld.parse(r.data).transactionHash}class hI{constructor(e){this.context=e}async getAllLatest(e){return cI(this.context.getRequestOptionsForCall(e))}async getAllLatestForPeer(e,n){const r=new Qn(e);return uI(this.context.getRequestOptionsForCall(n),r)}async getLastCashoutAction(e,n){const r=new Qn(e);return lI(this.context.getRequestOptionsForCall(n),r)}async cashoutLast(e,n,r){const i=new Qn(e);return n&&(n=F1.parse(n)),fI(this.context.getRequestOptionsForCall(r),i,n)}}class dI{constructor(e){this.context=e}async getAddress(e){return iI(this.context.getRequestOptionsForCall(e))}async getBalance(e){return sI(this.context.getRequestOptionsForCall(e))}async deposit(e,n,r){const i=e instanceof Le?e.toPLURString():qe(e,{min:1n,name:"amount"}),s=n?qe(e,{min:0n,name:"gasPrice"}):void 0;return oI(this.context.getRequestOptionsForCall(r),i,s)}async withdraw(e,n,r){const i=e instanceof Le?e.toPLURString():qe(e,{min:1n,name:"amount"}),s=n?qe(e,{min:0n,name:"gasPrice"}):void 0;return aI(this.context.getRequestOptionsForCall(r),i,s)}}class pI{constructor(e){this.context=e}async upload(e,n,r,i){const s="identifier"in n&&"signature"in n&&"owner"in n;if(n=n instanceof Uint8Array?n:n.data,r&&(r=jo.parse(r)),n.length<Tn.LENGTH)throw new Yn(`Chunk has to have size of at least ${Tn.LENGTH}.`,n);if(!s&&n.length>Ba+Tn.LENGTH)throw new Yn(`Content Addressed Chunk must not exceed ${Ba+Tn.LENGTH} bytes.`,n);if(s&&n.length>Ba+Tn.LENGTH+ps.LENGTH+Vt.LENGTH)throw new Yn(`Single Owner Chunk must not exceed ${Ba+Tn.LENGTH+ps.LENGTH+Vt.LENGTH} bytes.`,n);return zS(this.context.getRequestOptionsForCall(i),n,e,r)}async download(e,n,r){const i=new Ue(e);return n&&(n=Yr.parse(n)),Ho(this.context.getRequestOptionsForCall(r),i,n)}}async function q1(t,e,n,r,i){for(const a of t.forks.values()){const c=await q1(a.node,e,n,r,i);if(r?.act){let l;c.historyAddress.ifPresent(h=>l=h),l&&(a.node.metadata||(a.node.metadata={}),a.node.metadata["swarm-act-history-address"]=l.toHex())}}const s=await e.data.upload(n,await t.marshal(),r,i);return t.selfAddress=s.reference.toUint8Array(),s}async function Z1(t,e,n,r){for(const i of t.forks.values()){if(!i.node.selfAddress)throw Error("MantarayNode#loadRecursively fork.node.selfAddress is not set");let s=n;i.node.metadata&&i.node.metadata["swarm-act-history-address"]&&(s={...n,actHistoryAddress:i.node.metadata["swarm-act-history-address"]});const a=(await e.data.download(i.node.selfAddress,s,r)).toUint8Array(),c=Ao.unmarshalFromData(a,i.node.selfAddress);i.node.targetAddress=c.targetAddress,i.node.forks=c.forks,i.node.path=i.prefix,i.node.parent=t,await Z1(i.node,e,n,r)}}class Md{constructor(e=new Ao){this.core=e}get obfuscationKey(){return this.core.obfuscationKey}get selfAddress(){return this.core.selfAddress}get targetAddress(){return this.core.targetAddress}get metadata(){return this.core.metadata}get path(){return this.core.path}get forks(){return this.core.forks}get parent(){return this.core.parent}get type(){return this.core.type}get fullPath(){return this.core.fullPath}get fullPathString(){return this.core.fullPathString}getRootMetadata(){const e=this.core.find("/");return e&&e.metadata?ke.Optional.of(e.metadata):ke.Optional.empty()}getDocsMetadata(){const e=this.core.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,n){const r=this.core.find("/");if(!r||!r.metadata)return ke.Optional.empty();const i=r.metadata["swarm-feed-owner"],s=r.metadata["swarm-feed-topic"];return!i||!s?ke.Optional.empty():ke.Optional.of(await e.feed.fetchLatestUpdate(s,i,n))}async marshal(){return this.core.marshal()}static async unmarshal(e,n,r,i){n=new Ue(n);const s=(await e.data.download(n,r,i)).toUint8Array();return this.unmarshalFromData(s,n.toUint8Array())}static unmarshalFromData(e,n){return new Md(Ao.unmarshalFromData(e,n))}addFork(e,n,r){this.core.addFork(e,n instanceof Se?n.toUint8Array():n,r)}removeFork(e){this.core.removeFork(e)}async calculateSelfAddress(){return this.core.calculateSelfAddress()}async saveRecursively(e,n,r,i){return q1(this.core,e,n,r,i)}async loadRecursively(e,n,r){return Z1(this.core,e,n,r)}find(e){return this.core.find(e)}findClosest(e,n){return this.core.findClosest(e,n)}collect(e=[]){return this.core.collect(e)}collectAndMap(){return this.core.collectAndMap()}determineType(){return this.core.determineType()}}function gI(t){function r(s){if(s<=1)return s;const a=Math.ceil(s/128);return s+r(a)}const i=Math.ceil(t/4096);return r(i)}function mI(t){return Array.isArray(t)?t.every(e=>typeof e=="object"&&e.path&&e.size!==void 0):!1}function K1(t){if(!mI(t))throw new Yn("invalid collection",t)}function J1(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 bI(t){return Array.from(t).map(e=>({path:J1(e),size:e.size,file:e}))}const yI={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 xI(t){throw new Error("Hashing directories is not supported in browsers!")}async function wI(t,e,n,r,i,s){throw new Error("Streaming directories is not supported in browsers!")}async function AI(t,e,n,r,i,s){const a=s?.signal;if(a?.aborted)throw new Error("Request aborted");const c=new ke.AsyncQueue(64,64);let l=0,h=0;for(const w of e)l+=gI(w.size);n=new ot(n);async function d(w){if(!a?.aborted)try{await t.chunk.upload(n,w.build(),i,s),r?.({total:l,processed:++h})}catch(v){if(a?.aborted)return;throw v}}async function g(w){for(const{chunk:v}of w)await c.enqueue(async()=>d(v));return[]}const m=new Md;for(const w of e){if(a?.aborted)throw new Error("Request aborted");const v=await new Promise((A,I)=>{const T=new Lh(g);let O=0;const k=new FileReader;k.onerror=()=>{I(k.error)};const _=async()=>{if(a?.aborted){I(new Error("Request aborted"));return}if(O>=w.size){const $=await T.finalize();await c.enqueue(async()=>d($)),A($);return}const D=w.slice(O,O+4096);k.readAsArrayBuffer(D)};k.onload=async D=>{if(!D.target){I("No event target");return}const $=D.target.result;$&&(await T.append(new Uint8Array($)),O+=4096),_()},_()});await c.drain();const{filename:E,extension:S}=ke.Strings.parseFilename(w.name);m.addFork(J1(w),v.hash(),{"Content-Type":EI(yI[S.toLowerCase()]||"application/octet-stream"),Filename:E}),w.name==="index.html"&&m.addFork("/",fk,{"website-index-document":"index.html"})}if(a?.aborted)throw new Error("Request aborted");return m.saveRecursively(t,n,i,s)}function EI(t){return["text/html","text/css"].includes(t)?`${t}; charset=utf-8`:t}async function vI(t){throw new Error("Creating Collection from File System is not supported in browsers!")}class BI{constructor(){this.pieces=[],this.currentFileSize=0}get output(){return this.pieces.reduce((e,n)=>{const r=new Uint8Array(e.length+n.length);return r.set(e),r.set(n,e.length),r})}beginFile(e,n){const{name:r,prefix:i,longLink:s}=RI(e);if(s){const l=new TextEncoder().encode(e+"\0");this.pieces.push(TI(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=SI(r,i,n);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(II())}}function RI(t){if(t.length<=100)return{name:t,prefix:"",longLink:!1};for(let r=t.length-1;r>=0;r--)if(t[r]==="/"){const i=t.substring(r+1),s=t.substring(0,r);if(i.length<=100&&s.length<=155)return{name:i,prefix:s,longLink:!1}}const e=t.lastIndexOf("/");return{name:(e>=0?t.substring(e+1):t).slice(0,100),prefix:"",longLink:!0}}function TI(t){const e=new TextEncoder;function n(s,a,c){const l=e.encode(s);r.set(l.slice(0,c),a)}const r=new Uint8Array(512);r.fill(0),n("././@LongLink",0,100),n("0000644\0",100,8),n("0000000\0",108,8),n("0000000\0",116,8),n(t.toString(8).padStart(11,"0")+"\0",124,12),n("00000000000\0",136,12),n(" ",148,8),n("L",156,1),n("ustar\0\0",257,8);let i=0;for(let s=0;s<512;s++)i+=r[s];return n(i.toString(8).padStart(6,"0")+"\0 ",148,8),r}function SI(t,e,n){const r=new TextEncoder;function i(l,h,d){const g=r.encode(l);s.set(g.slice(0,d),h)}const s=new Uint8Array(512);s.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(n.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 c=0;for(let l=0;l<512;l++)c+=s[l];return i(c.toString(8).padStart(6,"0")+"\0 ",148,8),s}function II(){return new Uint8Array(1024)}async function OI(t,e){for(const n of t)if(n.file)e.beginFile(n.path,n.file.size),await e.appendFile(new Uint8Array(await C1(n.file))),await e.endFile();else throw new Error("Invalid collection item")}const PI="bzz";async function kI(t,e,n,r){const i=new BI;return await OI(e,i),await i.end(),await ye(t,{method:"post",url:PI,data:i.output,responseType:"json",headers:{"content-type":"application/x-tar","swarm-collection":"true",...Ht(n,r)}})}const $d="bzz";async function ib(t,e,n,r,i){Dd(e)&&!i?.contentType&&(i||(i={}),i.contentType="application/octet-stream");const s=await ye(t,{method:"post",url:$d,data:e,headers:Ht(n,i),params:{name:r},responseType:"json"});return{reference:Ci.parse(s.data).reference,tagUid:s.headers["swarm-tag"]?Kr(s.headers["swarm-tag"]):void 0,historyAddress:s.headers["swarm-act-history-address"]?ke.Optional.of(new Ue(s.headers["swarm-act-history-address"])):ke.Optional.empty()}}async function NI(t,e,n="",r){const i=await ye(t,{method:"GET",responseType:"arraybuffer",url:`${$d}/${e}/${n}`,headers:Ht(null,r)});return{...M1(i.headers),data:new Se(i.data)}}async function CI(t,e,n="",r){e=new Ue(e);const i=await ye(t,{method:"GET",responseType:"stream",url:`${$d}/${e}/${n}`,headers:Ht(null,r)});return{...M1(i.headers),data:i.data}}async function Xf(t,e,n,r){K1(e);const i=await kI(t,e,n,r);return{reference:Ci.parse(i.data).reference,tagUid:i.headers["swarm-tag"]?Kr(i.headers["swarm-tag"]):void 0,historyAddress:i.headers["swarm-act-history-address"]?ke.Optional.of(new Ue(i.headers["swarm-act-history-address"])):ke.Optional.empty()}}class _I{constructor(e){this.context=e}async upload(e,n,r,i){const s=new ot(e);return K1(n),r&&(r=Yf.parse(r)),Xf(this.context.getRequestOptionsForCall(i),n,s,r)}async uploadFromFileList(e,n,r,i){const s=new ot(e);r&&(r=Yf.parse(r));const a=bI(n);return Xf(this.context.getRequestOptionsForCall(i),a,s,r)}async uploadFromDirectory(e,n,r,i){const s=new ot(e);r&&(r=Yf.parse(r));const a=await vI();return Xf(this.context.getRequestOptionsForCall(i),a,s,r)}async stream(e,n,r,i,s){const a=new ot(e);return AI(this.context.bee,n,a,r,i,this.context.getRequestOptionsForCall(s))}async streamFromDirectory(e,n,r,i,s){const a=new ot(e);return wI(this.context.bee,n,a,r,i,this.context.getRequestOptionsForCall(s))}async hashDirectory(e){return xI()}}const W1=Te({address:me(),fullNode:Xe()}),DI=Te({population:ve(),connected:ve(),connectedPeers:Lt(Te({address:me()})).nullish().transform(t=>t??[]),disconnectedPeers:Lt(Te({address:me()})).nullish().transform(t=>t??[])}),FI=l1(me(),DI),UI=Te({overlay:me().transform(t=>new Qn(t)),underlay:Lt(me()),ethereum:me().transform(t=>new It(t)),publicKey:me().transform(t=>new Un(t)),pssPublicKey:me().transform(t=>new Un(t))}),LI=Te({peers:Lt(W1)}),MI=Te({peers:Lt(W1)}),$I=Te({baseAddr:me(),population:ve(),connected:ve(),timestamp:me(),nnLowWatermark:ve(),depth:ve(),reachability:me(),networkAvailability:me(),bins:FI}),zI=Te({overlay:me(),proximity:ve(),beeMode:me().transform(_1),reserveSize:ve(),reserveSizeWithinRadius:ve(),pullsyncRate:ve(),storageRadius:ve(),connectedPeers:ve(),neighborhoodSize:ve(),batchCommitment:ve(),isReachable:Xe(),lastSyncedBlock:ve(),committedDepth:ve(),isWarmingUp:Xe()}),GI=Te({apiVersion:me(),version:me(),status:GR("ok")}),VI=Te({apiVersion:me(),version:me(),status:f1(["ready","notReady"])}),jI=Te({beeMode:me().transform(_1),chequebookEnabled:Xe(),swapEnabled:Xe()}),HI=Te({gateway:Xe()}),qI="addresses",ZI="blocklist",Q1="peers",KI="topology",JI="pingpong",WI="/gateway";async function QI(t){await ye(t,{url:"",responseType:"text"})}async function YI(t){const e=await ye(t,{url:WI});return HI.parse(e.data).gateway}async function XI(t){const e=await ye(t,{url:qI,responseType:"json"});return UI.parse(e.data)}async function eO(t){const e=await ye(t,{url:ZI,responseType:"json"});return MI.parse(e.data).peers}async function tO(t){const e=await ye(t,{url:Q1,responseType:"json"});return LI.parse(e.data).peers}async function nO(t,e){return(await ye(t,{url:`${Q1}/${e}`,responseType:"json",method:"DELETE"})).data}async function rO(t){const e=await ye(t,{url:KI,responseType:"json"});return $I.parse(e.data)}async function iO(t,e){return(await ye(t,{url:`${JI}/${e}`,responseType:"json",method:"POST"})).data}class sO{constructor(e){this.context=e}async checkConnection(e){return QI(this.context.getRequestOptionsForCall(e))}async isConnected(e){try{await this.checkConnection(e)}catch{return!1}return!0}async isGateway(e){try{return await YI(this.context.getRequestOptionsForCall(e))}catch{return!1}}async getNodeAddresses(e){return XI(this.context.getRequestOptionsForCall(e))}async getBlocklist(e){return eO(this.context.getRequestOptionsForCall(e))}async getPeers(e){return tO(this.context.getRequestOptionsForCall(e))}async removePeer(e,n){const r=new Qn(e);return nO(this.context.getRequestOptionsForCall(n),r)}async getTopology(e){return rO(this.context.getRequestOptionsForCall(e))}async ping(e,n){const r=new Qn(e);return iO(this.context.getRequestOptionsForCall(n),r)}}const Fc="bytes";async function Y1(t,e,n,r){const i=await ye(t,{url:Fc,method:"post",responseType:"json",data:e,headers:{"content-type":"application/octet-stream",...Ht(n,r)}});return{reference:Ci.parse(i.data).reference,tagUid:i.headers["swarm-tag"]?Kr(i.headers["swarm-tag"]):void 0,historyAddress:i.headers["swarm-act-history-address"]?ke.Optional.of(new Ue(i.headers["swarm-act-history-address"])):ke.Optional.empty()}}async function oO(t,e){const n=await ye(t,{url:`${Fc}/${e}`,method:"head",responseType:"json"});return{contentLength:parseInt(n.headers["content-length"])}}async function X1(t,e,n){n&&(n=Yr.parse(n));const r=await ye(t,{responseType:"arraybuffer",url:`${Fc}/${e}`,headers:Ht(null,n)});return new Se(r.data)}async function aO(t,e,n){return n&&(n=Yr.parse(n)),(await ye(t,{responseType:"stream",url:`${Fc}/${e}`,headers:Ht(null,n)})).data}const cO=Te({isRetrievable:Xe()}),ew="stewardship";async function uO(t,e,n){await ye(t,{method:"put",url:`${ew}/${n}`,headers:{"swarm-postage-batch-id":e.toHex()}})}async function lO(t,e){const n=await ye(t,{method:"get",responseType:"json",url:`${ew}/${e}`});return cO.parse(n.data).isRetrievable}class lc{constructor(e){this.raw=e}toString(){const e=me().safeParse(this.raw);return e.success&&e.data.includes(".eth")?e.data:new Ue(this.raw).toHex()}}class fO{constructor(e){this.context=e}async upload(e,n,r,i){const s=new ot(e);return U1(n),r&&(r=RS.parse(r)),Y1(this.context.getRequestOptionsForCall(i),n,s,r)}async download(e,n,r){return n&&(n=Yr.parse(n)),X1(this.context.getRequestOptionsForCall(r),new lc(e),n)}async downloadReadable(e,n,r){return n&&(n=Yr.parse(n)),aO(this.context.getRequestOptionsForCall(r),new lc(e),n)}async probe(e,n){const r=new Ue(e);return oO(this.context.getRequestOptionsForCall(n),r)}async isRetrievable(e,n){const r=new Ue(e);return lO(this.context.getRequestOptionsForCall(n),r)}}const zd="feeds";async function hO(t,e,n,r,i){const s=await ye(t,{method:"post",responseType:"json",url:`${zd}/${e}/${n}`,headers:Ht(r,i)});return Ci.parse(s.data).reference}function tw(t){const e=t["swarm-feed-index"],n=t["swarm-feed-index-next"];if(!e)throw new Ln("Response did not contain expected swarm-feed-index!");if(!n)throw new Ln("Response did not contain expected swarm-feed-index-next!");return{feedIndex:new Ar(e),feedIndexNext:new Ar(n)}}async function fc(t,e,n,r){const i=await ye(t,{responseType:"arraybuffer",url:`${zd}/${e}/${n}`,params:{...r}});return{payload:new Se(i.data),...tw(i.headers)}}async function dO(t,e,n){const r=await ye(t,{responseType:"arraybuffer",url:`${zd}/${e}/${n}`,params:{"Swarm-Only-Root-Chunk":!0}});return tw(r.headers)}function Gd(t,e){return e=typeof e=="number"?Ar.fromBigInt(BigInt(e)):e,new Vt(jt(Se.concat(t.toUint8Array(),e.toUint8Array())))}const pO=0,nw=8,gO=nw;async function rw(t,e,n){try{const r=await fc(t,e,n);if(!r.feedIndexNext)throw Error("Feed index next is not defined. This should happen when fetching an exact index.");return r.feedIndexNext}catch(r){if(r instanceof Bo)return Ar.fromBigInt(0n);throw r}}async function mO(t,e,n,r,i,s){r=new Ue(r);const a=s?.index??await rw(t,e.publicKey().address(),n),c=Gd(n,a),l=s?.at??Date.now()/1e3,h=wo(BigInt(Math.floor(l)),"BE"),d=Se.concat(h,r.toUint8Array());return Ud(t,e,i,c,d,s)}async function bO(t,e,n,r,i,s){const a=s?.index??await rw(t,e.publicKey().address(),n),c=Gd(n,a);if(r.length>4096){const h=await Y1(t,r,i,s),d=Nx(await Ho(t,h.reference));return HS(t,e,i,c,d,s)}const l=me().safeParse(r);return Ud(t,e,i,c,l.success?Se.fromUtf8(l.data).toUint8Array():r,s)}function Vd(t,e,n){const r=Gd(e,n);return new Ue(jt(Se.concat(r.toUint8Array(),t.toUint8Array())))}async function yO(t,e,n,r,i=!1){r=typeof r=="number"?Ar.fromBigInt(BigInt(r)):r;const s=Vd(e,n,r),a=await Ho(t,s.toHex()),c=Dc(a,s);let l=ke.Optional.empty();if(i){const h=Se.fromSlice(c.payload.toUint8Array(),pO,nw);l=ke.Optional.of(Number(wd(h.toUint8Array(),"BE")))}return{timestamp:l,payload:new Se(c.payload.offset(i?gO:0))}}async function xO(t,e,n,r){r=typeof r=="number"?Ar.fromBigInt(BigInt(r)):r;const i=Vd(e,n,r),s=await Ho(t,i),a=Dc(s,i);return Mo(a.payload,a.span)}function iw(t,e,n){const r=async a=>{if(a?.index===void 0)return fc(t,n,e);const c=await yO(t,n,e,a.index,a.hasTimestamp??!0),l=typeof a.index=="number"?Ar.fromBigInt(BigInt(a.index)):a.index;return{payload:c.payload,feedIndex:l,feedIndexNext:l.next()}};return{download:r,downloadPayload:async a=>{if(a?.index===void 0)return fc(t,n,e);const c=await xO(t,n,e,a.index),l=c.span.toBigInt()<=4096n?c.payload:await X1(t,new lc(c.address)),h=typeof a.index=="number"?Ar.fromBigInt(BigInt(a.index)):a.index;return{payload:l,feedIndex:h,feedIndexNext:h.next()}},downloadReference:async a=>{let c=a?.index;c===void 0&&(c=(await dO(t,n,e)).feedIndex);const l=await r({...a,index:c});return{reference:new Ue(l.payload.toUint8Array()),feedIndex:l.feedIndex,feedIndexNext:l.feedIndexNext??l.feedIndex.next()}},owner:n,topic:e}}function wO(t,e,n){const r=async(s,a,c)=>mO(t,n,e,a,s,c),i=async(s,a,c)=>bO(t,n,e,a,s,c);return{...iw(t,e,n.publicKey().address()),upload:r,uploadReference:r,uploadPayload:i}}async function AO(t,e,n,r){try{return await t.chunk.download(e,n,r),!0}catch(i){const s=ke.Objects.getDeep(i,"status");if(s===404||s===500)return!1;throw i}}function EO(t,e,n){const r=n.toBigInt(),i=[];for(let s=0n;s<=r;s++)i.push(Vd(t,e,Ar.fromBigInt(s)));return i}async function vO(t,e,n,r,i,s){const a=EO(e,n,r).map(async c=>AO(t,c,i,s));return(await Promise.all(a)).every(c=>c)}class BO{constructor(e){this.context=e}makeReader(e,n,r){return iw(this.context.getRequestOptionsForCall(r),new Wi(e),new It(n))}makeWriter(e,n,r){const i=n?new Er(n):this.context.signer;if(!i)throw Error("No signer provided");return wO(this.context.getRequestOptionsForCall(r),new Wi(e),i)}async createManifest(e,n,r,i,s){const a=new ot(e),c=new Wi(n),l=new It(r);return i&&(i=jo.parse(i)),hO(this.context.getRequestOptionsForCall(s),l,c,a,i)}async fetchLatestUpdate(e,n,r){return fc(this.context.getRequestOptionsForCall(r),new It(n),new Wi(e))}async isRetrievable(e,n,r,i,s){const a=new It(e),c=new Wi(n);if(i&&(i=Yr.parse(i)),!r)try{return await this.makeReader(c,a,s).download(),!0}catch(l){const h=ke.Objects.getDeep(l,"status");if(h===404||h===500)return!1;throw l}return vO(this.context.bee,a,c,r,i,this.context.getRequestOptionsForCall(s))}}let RO=class{constructor(e){this.context=e}async upload(e,n,r,i,s){const a=new ot(e);if(CS(n),i&&(i=TS.parse(i)),r&&typeof r!="string")throw new TypeError("name has to be string or undefined!");if(N1(n)){const c=await C1(n),l=r??n.name,h=n.type,d={...i,contentType:h};return ib(this.context.getRequestOptionsForCall(s),c,a,l,d)}else return ib(this.context.getRequestOptionsForCall(s),n,a,r,i)}async download(e,n="",r,i){return r&&(r=Yr.parse(r)),NI(this.context.getRequestOptionsForCall(i),new lc(e),n,r)}async downloadReadable(e,n="",r,i){const s=new Ue(e);return r&&(r=Yr.parse(r)),CI(this.context.getRequestOptionsForCall(i),s,n,r)}};const TO=Lt(me().transform(t=>new Un(t))),sw=Te({ref:me().transform(t=>new Ue(t)),historyref:me().transform(t=>new Ue(t))}),jd="grantee";async function SO(t,e,n){const r=await ye(t,{method:"post",url:jd,data:{grantees:n.map(s=>s.toCompressedHex())},headers:Ht(e),responseType:"json"}),i=sw.parse(r.data);return{status:r.status,statusText:r.statusText,ref:i.ref,historyref:i.historyref}}async function IO(t,e){const n=await ye(t,{method:"get",url:`${jd}/${e}`,responseType:"json"});return{status:n.status,statusText:n.statusText,grantees:TO.parse(n.data)}}async function OO(t,e,n,r,i){const s=await ye(t,{method:"patch",url:`${jd}/${n}`,data:{add:i.add.map(c=>c.toCompressedHex()),revoke:i.revoke.map(c=>c.toCompressedHex())},headers:{...Ht(e),"swarm-act-history-address":r.toHex()},responseType:"json"}),a=sw.parse(s.data);return{status:s.status,statusText:s.statusText,ref:a.ref,historyref:a.historyref}}class PO{constructor(e){this.context=e}async create(e,n,r){const i=new ot(e),s=n.map(a=>new Un(a));return SO(this.context.getRequestOptionsForCall(r),i,s)}async get(e,n){const r=new Ue(e);return IO(this.context.getRequestOptionsForCall(n),r)}async patch(e,n,r,i,s){const a=new ot(e),c=new Ue(n),l=new Ue(r),h={add:i.add?.map(d=>new Un(d))??[],revoke:i.revoke?.map(d=>new Un(d))??[]};return OO(this.context.getRequestOptionsForCall(s),a,c,l,h)}}var Qi=null;typeof WebSocket<"u"?Qi=WebSocket:typeof MozWebSocket<"u"?Qi=MozWebSocket:typeof bo<"u"?Qi=bo.WebSocket||bo.MozWebSocket:typeof window<"u"?Qi=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Qi=self.WebSocket||self.MozWebSocket);const sb=Qi,kO="pss";async function NO(t,e,n,r,i,s){await ye(t,{method:"post",url:`${kO}/send/${n}/${r}`,data:i,responseType:"json",params:{recipient:s},headers:Ht(e)})}async function ob(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 CO="pss",_O="gsoc";class DO{constructor(e){this.context=e,this.cancelled=new WeakSet}async pssSend(e,n,r,i,s,a){const c=new ot(e);U1(i);const l=s?new Un(s):void 0;await NO(this.context.getRequestOptionsForCall(a),c,n,r,i,l)}pssSubscribe(e,n){n=OS.parse(n);const r=this.openWebSocket(`${CO}/subscribe/${e.toHex()}`),i=this.makeCancel(r),s={topic:e,cancel:i};return r.onmessage=async a=>{const c=await ob(a.data);c.length&&n.onMessage(new Se(c),s)},r.onerror=a=>{this.isCancelled(r)||n.onError(new Ln(a.message),s)},r.onclose=()=>{n.onClose(s)},s}async pssReceive(e,n=0){if(typeof n!="number")throw new TypeError("timeoutMsc parameter has to be a number!");return new Promise((r,i)=>{let s;const a=this.pssSubscribe(e,{onError:c=>{clearTimeout(s),a.cancel(),i(c.message)},onMessage:c=>{clearTimeout(s),a.cancel(),r(c)},onClose:()=>{clearTimeout(s),a.cancel()}});n>0&&(s=setTimeout(()=>{a.cancel(),i(new Ln("pssReceive timeout"))},n))})}gsocMine(e,n,r=12){const i=new Qn(e),s=new Vt(n),a=0xb33n;for(let c=0n;c<0xffffn;c++){const l=new Er(hn(a+c)),h=gs(s,l.publicKey().address());if(256-ke.Binary.proximity(h.toUint8Array(),i.toUint8Array())<=256-r)return l}throw Error("Could not mine a valid signer")}async gsocSend(e,n,r,i,s,a){const c=new ot(e),l=new Er(n),h=new Vt(r),g=Mo(i).toSingleOwnerChunk(h,l);return Fd(this.context.getRequestOptionsForCall(a),g,c,s)}gsocSubscribe(e,n,r){const i=new It(e),s=new Vt(n);r=PS.parse(r);const a=gs(s,i),c=this.openWebSocket(`${_O}/subscribe/${a.toHex()}`),l=this.makeCancel(c),h={address:i,cancel:l};return c.onmessage=async d=>{const g=await ob(d.data);g.length&&r.onMessage(new Se(g),h)},c.onerror=d=>{this.isCancelled(c)||r.onError(new Ln(d.message),h)},c.onclose=()=>{r.onClose(h)},h}openWebSocket(e){const n=this.context.url.replace(/^http/i,"ws");return ke.System.whereAmI()==="browser"?new sb(`${n}/${e}`):new sb(`${n}/${e}`,{headers:this.context.getRequestOptionsForCall().headers})}makeCancel(e){return()=>{this.cancelled.has(e)||(this.cancelled.add(e),e.terminate?e.terminate():e.close())}}isCancelled(e){return this.cancelled.has(e)}}const FO=Te({references:Lt(me()).nullable()}),Uc="pins";async function UO(t,e){await ye(t,{method:"post",responseType:"json",url:`${Uc}/${e}`})}async function LO(t,e){await ye(t,{method:"delete",responseType:"json",url:`${Uc}/${e}`})}async function MO(t){const e=await ye(t,{method:"get",responseType:"json",url:Uc}),{references:n}=FO.parse(e.data);return(n??[]).map(r=>new Ue(r))}async function $O(t,e){const n=await ye(t,{method:"get",responseType:"json",url:`${Uc}/${e}`});return Ci.parse(n.data)}class zO{constructor(e){this.context=e}async add(e,n){const r=new Ue(e);await UO(this.context.getRequestOptionsForCall(n),r)}async remove(e,n){const r=new Ue(e);await LO(this.context.getRequestOptionsForCall(n),r)}async getAll(e){return MO(this.context.getRequestOptionsForCall(e))}async get(e,n){const r=new Ue(e);return $O(this.context.getRequestOptionsForCall(n),r)}async reuploadData(e,n,r){const i=new ot(e),s=new Ue(n);await uO(this.context.getRequestOptionsForCall(r),i,s)}}const ow=Te({peer:me(),sent:me().transform(t=>Le.fromPLUR(qe(t,{name:"sent"}))),received:me().transform(t=>Le.fromPLUR(qe(t,{name:"received"})))}),GO=ow,VO=Te({totalSent:me().transform(t=>Le.fromPLUR(qe(t,{name:"totalSent"}))),totalReceived:me().transform(t=>Le.fromPLUR(qe(t,{name:"totalReceived"}))),settlements:Lt(ow)}),aw="settlements";async function jO(t,e){const n=await ye(t,{url:`${aw}/${e}`,responseType:"json"});return GO.parse(n.data)}async function HO(t){const e=await ye(t,{url:aw,responseType:"json"});return VO.parse(e.data)}class qO{constructor(e){this.context=e}async get(e,n){const r=new Qn(e);return jO(this.context.getRequestOptionsForCall(n),r)}async getAll(e){return HO(this.context.getRequestOptionsForCall(e))}}class ZO{constructor(e){this.context=e}makeReader(e,n){const r=new It(e);return{owner:r,download:qS.bind(null,this.context.getRequestOptionsForCall(n),r)}}makeWriter(e,n){const r=e?new Er(e):this.context.signer;if(!r)throw Error("No signer provided");return{...this.makeReader(r.publicKey().address(),n),upload:Ud.bind(null,this.context.getRequestOptionsForCall(n),r)}}}const KO=Te({stakedAmount:me().transform(t=>Le.fromPLUR(qe(t,{name:"stakedAmount"})))}),JO=Te({withdrawableAmount:me().transform(t=>Le.fromPLUR(qe(t,{name:"withdrawableAmount"})))}),Hd=Te({txHash:me().transform(t=>new Zr(t))}),WO=Te({minimumGasFunds:me().transform(t=>ft.fromWei(qe(t,{name:"minimumGasFunds"}))),hasSufficientFunds:Xe(),isFrozen:Xe(),isFullySynced:Xe(),phase:me(),round:ve(),lastWonRound:ve(),lastPlayedRound:ve(),lastFrozenRound:ve(),lastSelectedRound:ve(),lastSampleDurationSeconds:ve(),block:ve(),reward:me().transform(t=>Le.fromPLUR(qe(t,{name:"reward"}))),fees:me().transform(t=>ft.fromWei(qe(t,{name:"fees"}))),isHealthy:Xe()}),qo="stake";async function QO(t){const e=await ye(t,{method:"get",responseType:"json",url:qo});return KO.parse(e.data).stakedAmount}async function YO(t){const e=await ye(t,{method:"get",responseType:"json",url:`${qo}/withdrawable`});return JO.parse(e.data).withdrawableAmount}async function XO(t,e,n){const r=await ye(t,{method:"post",responseType:"json",url:`${qo}/${e}`,headers:Ht(null,n)});return Hd.parse(r.data).txHash}async function eP(t){const e=await ye(t,{method:"delete",responseType:"json",url:`${qo}/withdrawable`});return Hd.parse(e.data).txHash}async function tP(t){const e=await ye(t,{method:"delete",responseType:"json",url:qo});return Hd.parse(e.data).txHash}const nP="redistributionstate";async function rP(t){const e=await ye(t,{method:"get",responseType:"json",url:nP});return WO.parse(e.data)}class iP{constructor(e){this.context=e}async get(e){return QO(this.context.getRequestOptionsForCall(e))}async getWithdrawable(e){return YO(this.context.getRequestOptionsForCall(e))}async deposit(e,n,r){const i=e instanceof Le?e.toPLURString():qe(e,{min:1n,name:"amount"});return n&&(n=F1.parse(n)),XO(this.context.getRequestOptionsForCall(r),i,n)}async withdrawSurplus(e){return eP(this.context.getRequestOptionsForCall(e))}async migrate(e){return tP(this.context.getRequestOptionsForCall(e))}async getRedistributionState(e){return rP(this.context.getRequestOptionsForCall(e))}}const cw=Te({batchID:me(),utilization:ve(),utilizationRatio:ve().optional(),usable:Xe(),label:me(),depth:ve(),amount:me(),bucketDepth:ve(),blockNumber:ve(),immutableFlag:Xe(),batchTTL:ve()}),uw=Te({batchID:me().transform(t=>new ot(t)),batchTTL:ve(),bucketDepth:ve(),depth:ve(),immutable:Xe(),owner:me().transform(t=>new It(t)),start:ve(),value:me().transform(t=>qe(t,{name:"value"}))}),sP=Te({batches:Lt(uw)}),oP=Te({stamps:Lt(cw)}),aP=cw,cP=Te({depth:ve(),bucketDepth:ve(),bucketUpperBound:ve(),buckets:Lt(Te({bucketID:ve(),collisions:ve()}))}),qd=Te({batchID:me().transform(t=>new ot(t))}),Di="stamps";async function uP(t,e,n,r,i,s){const a={};i&&(a["gas-price"]=i),s!==void 0&&(a.immutable=String(s));const c=await ye(t,{method:"post",url:`${Di}/${e}/${n}`,responseType:"json",params:{label:r},headers:a});return qd.parse(c.data).batchID}async function lP(t,e,n){await ye(t,{method:"patch",url:`${Di}/${e}`,responseType:"json",data:{label:n}})}async function fP(t,e,n){const r=await ye(t,{method:"patch",url:`${Di}/topup/${e}/${n}`,responseType:"json"});return qd.parse(r.data).batchID}async function hP(t,e,n){const r=await ye(t,{method:"patch",url:`${Di}/dilute/${e}/${n}`,responseType:"json"});return qd.parse(r.data).batchID}async function dP(t,e,n,r){const i=await ye(t,{method:"get",url:`${Di}/${e}`,responseType:"json"});return L1(aP.parse(i.data),n,r)}async function pP(t,e){const n=await ye(t,{method:"get",url:`${Di}/${e}/buckets`,responseType:"json"});return cP.parse(n.data)}async function gP(t){const e=await ye(t,{method:"get",url:Di,responseType:"json"});return oP.parse(e.data).stamps.map(n=>L1(n))}const lw="batches";async function mP(t,e){const n=await ye(t,{method:"get",url:`${lw}/${e}`,responseType:"json"});return uw.parse(n.data)}async function bP(t){const e=await ye(t,{method:"get",url:lw,responseType:"json"});return sP.parse(e.data).batches}class yP{constructor(e){this.context=e}async create(e,n,r,i){const s=qe(e,{min:0n,name:"amount"});if(r&&(r=D1.parse(r)),n<eb||n>tb)throw new Yn(`Depth has to be between ${eb}..${tb}`,n);const a=await this.context.bee.status.getChainState(),c=BigInt(a.currentPrice)*17280n+1n;if(BigInt(s)<c)throw new Yn(`Amount has to be at least ${c} (1 day at current price ${a.currentPrice})`,s);const l=await uP(this.context.getRequestOptionsForCall(i),s,n,r?.label,r?.gasPrice?.toString(),r?.immutableFlag);return r?.waitForUsable!==!1&&await this.waitForUsable(l,r?.waitForUsableTimeout),l}async updateLabel(e,n,r){const i=new ot(e);await lP(this.context.getRequestOptionsForCall(r),i,n)}async calculateTopUpForBZZ(e,n,r){const i=await this.context.bee.status.getChainState(r),s=this.context.network==="gnosis"?5:15,a=n.toPLURBigInt()/2n**BigInt(e),c=FS(a,i.currentPrice,s);return{amount:a,duration:c}}async topUp(e,n,r){const i=new ot(e),s=qe(n,{min:1n,name:"amount"});return fP(this.context.getRequestOptionsForCall(r),i,s)}async dilute(e,n,r){const i=new ot(e),s=ve().int().min(18).max(255).parse(n);return hP(this.context.getRequestOptionsForCall(r),i,s)}async get(e,n,r,i){const s=new ot(e);return dP(this.context.getRequestOptionsForCall(n),s,r,i)}async getGlobal(e,n){const r=new ot(e);return mP(this.context.getRequestOptionsForCall(n),r)}async getBuckets(e,n){const r=new ot(e);return pP(this.context.getRequestOptionsForCall(n),r)}async getAll(e){return gP(this.context.getRequestOptionsForCall(e))}async getAllGlobal(e){return bP(this.context.getRequestOptionsForCall(e))}async waitForUsable(e,n=24e4){for(let i=0;i<n;i+=3e3){try{if((await this.get(e)).usable)return}catch{}await ke.System.sleepMillis(3e3)}throw new Ln("Timeout on waiting for postage stamp to become usable")}}var eh,ab;function fw(){if(ab)return eh;ab=1;var t={};return eh=typeof Fe=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{},eh}var th,cb;function hw(){if(cb)return th;cb=1;const t="2.0.0",e=256,n=Number.MAX_SAFE_INTEGER||9007199254740991,r=16,i=e-6;return th={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:n,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},th}var Ra={exports:{}},ub;function xP(){return ub||(ub=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=hw(),s=fw();e=t.exports={};const a=e.re=[],c=e.safeRe=[],l=e.src=[],h=e.safeSrc=[],d=e.t={};let g=0;const m="[a-zA-Z0-9-]",w=[["\\s",1],["\\d",i],[m,r]],v=S=>{for(const[A,I]of w)S=S.split(`${A}*`).join(`${A}{0,${I}}`).split(`${A}+`).join(`${A}{1,${I}}`);return S},E=(S,A,I)=>{const T=v(A),O=g++;s(S,O,A),d[S]=O,l[O]=A,h[O]=T,a[O]=new RegExp(A,I?"g":void 0),c[O]=new RegExp(T,I?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*"),E("NUMERICIDENTIFIERLOOSE","\\d+"),E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${m}*`),E("MAINVERSION",`(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})`),E("MAINVERSIONLOOSE",`(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASEIDENTIFIER",`(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIER]})`),E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASE",`(?:-(${l[d.PRERELEASEIDENTIFIER]}(?:\\.${l[d.PRERELEASEIDENTIFIER]})*))`),E("PRERELEASELOOSE",`(?:-?(${l[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[d.PRERELEASEIDENTIFIERLOOSE]})*))`),E("BUILDIDENTIFIER",`${m}+`),E("BUILD",`(?:\\+(${l[d.BUILDIDENTIFIER]}(?:\\.${l[d.BUILDIDENTIFIER]})*))`),E("FULLPLAIN",`v?${l[d.MAINVERSION]}${l[d.PRERELEASE]}?${l[d.BUILD]}?`),E("FULL",`^${l[d.FULLPLAIN]}$`),E("LOOSEPLAIN",`[v=\\s]*${l[d.MAINVERSIONLOOSE]}${l[d.PRERELEASELOOSE]}?${l[d.BUILD]}?`),E("LOOSE",`^${l[d.LOOSEPLAIN]}$`),E("GTLT","((?:<|>)?=?)"),E("XRANGEIDENTIFIERLOOSE",`${l[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),E("XRANGEIDENTIFIER",`${l[d.NUMERICIDENTIFIER]}|x|X|\\*`),E("XRANGEPLAIN",`[v=\\s]*(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:${l[d.PRERELEASE]})?${l[d.BUILD]}?)?)?`),E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:${l[d.PRERELEASELOOSE]})?${l[d.BUILD]}?)?)?`),E("XRANGE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAIN]}$`),E("XRANGELOOSE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAINLOOSE]}$`),E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),E("COERCE",`${l[d.COERCEPLAIN]}(?:$|[^\\d])`),E("COERCEFULL",l[d.COERCEPLAIN]+`(?:${l[d.PRERELEASE]})?(?:${l[d.BUILD]})?(?:$|[^\\d])`),E("COERCERTL",l[d.COERCE],!0),E("COERCERTLFULL",l[d.COERCEFULL],!0),E("LONETILDE","(?:~>?)"),E("TILDETRIM",`(\\s*)${l[d.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",E("TILDE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAIN]}$`),E("TILDELOOSE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAINLOOSE]}$`),E("LONECARET","(?:\\^)"),E("CARETTRIM",`(\\s*)${l[d.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",E("CARET",`^${l[d.LONECARET]}${l[d.XRANGEPLAIN]}$`),E("CARETLOOSE",`^${l[d.LONECARET]}${l[d.XRANGEPLAINLOOSE]}$`),E("COMPARATORLOOSE",`^${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]})$|^$`),E("COMPARATOR",`^${l[d.GTLT]}\\s*(${l[d.FULLPLAIN]})$|^$`),E("COMPARATORTRIM",`(\\s*)${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]}|${l[d.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",E("HYPHENRANGE",`^\\s*(${l[d.XRANGEPLAIN]})\\s+-\\s+(${l[d.XRANGEPLAIN]})\\s*$`),E("HYPHENRANGELOOSE",`^\\s*(${l[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[d.XRANGEPLAINLOOSE]})\\s*$`),E("STAR","(<|>)?=?\\s*\\*"),E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Ra,Ra.exports)),Ra.exports}var nh,lb;function wP(){if(lb)return nh;lb=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return nh=r=>r?typeof r!="object"?t:r:e,nh}var rh,fb;function AP(){if(fb)return rh;fb=1;const t=/^[0-9]+$/,e=(r,i)=>{if(typeof r=="number"&&typeof i=="number")return r===i?0:r<i?-1:1;const s=t.test(r),a=t.test(i);return s&&a&&(r=+r,i=+i),r===i?0:s&&!a?-1:a&&!s?1:r<i?-1:1};return rh={compareIdentifiers:e,rcompareIdentifiers:(r,i)=>e(i,r)},rh}var ih,hb;function EP(){if(hb)return ih;hb=1;const t=fw(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:n}=hw(),{safeRe:r,t:i}=xP(),s=wP(),{compareIdentifiers:a}=AP(),c=(h,d)=>{const g=d.split(".");if(g.length>h.length)return!1;for(let m=0;m<g.length;m++)if(a(h[m],g[m])!==0)return!1;return!0};class l{constructor(d,g){if(g=s(g),d instanceof l){if(d.loose===!!g.loose&&d.includePrerelease===!!g.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,g),this.options=g,this.loose=!!g.loose,this.includePrerelease=!!g.includePrerelease;const m=d.trim().match(g.loose?r[i.LOOSE]:r[i.FULL]);if(!m)throw new TypeError(`Invalid Version: ${d}`);if(this.raw=d,this.major=+m[1],this.minor=+m[2],this.patch=+m[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");m[4]?this.prerelease=m[4].split(".").map(w=>{if(/^[0-9]+$/.test(w)){const v=+w;if(v>=0&&v<n)return v}return w}):this.prerelease=[],this.build=m[5]?m[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 g=0;do{const m=this.prerelease[g],w=d.prerelease[g];if(t("prerelease compare",g,m,w),m===void 0&&w===void 0)return 0;if(w===void 0)return 1;if(m===void 0)return-1;if(m===w)continue;return a(m,w)}while(++g)}compareBuild(d){d instanceof l||(d=new l(d,this.options));let g=0;do{const m=this.build[g],w=d.build[g];if(t("build compare",g,m,w),m===void 0&&w===void 0)return 0;if(w===void 0)return 1;if(m===void 0)return-1;if(m===w)continue;return a(m,w)}while(++g)}inc(d,g,m){if(d.startsWith("pre")){if(!g&&m===!1)throw new Error("invalid increment argument: identifier is empty");if(g){const w=`-${g}`.match(this.options.loose?r[i.PRERELEASELOOSE]:r[i.PRERELEASE]);if(!w||w[1]!==g)throw new Error(`invalid identifier: ${g}`)}}switch(d){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",g,m);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",g,m);break;case"prepatch":this.prerelease.length=0,this.inc("patch",g,m),this.inc("pre",g,m);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",g,m),this.inc("pre",g,m);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(m)?1:0;if(this.prerelease.length===0)this.prerelease=[w];else{let v=this.prerelease.length;for(;--v>=0;)typeof this.prerelease[v]=="number"&&(this.prerelease[v]++,v=-2);if(v===-1){if(g===this.prerelease.join(".")&&m===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(w)}}if(g){let v=[g,w];if(m===!1&&(v=[g]),c(this.prerelease,g)){const E=this.prerelease[g.split(".").length];isNaN(E)&&(this.prerelease=v)}else this.prerelease=v}break}default:throw new Error(`invalid increment argument: ${d}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ih=l,ih}var sh,db;function vP(){if(db)return sh;db=1;const t=EP();return sh=(n,r)=>new t(n,r).major,sh}var BP=vP();const pb=My(BP),jh="2.8.1-7cf53193";jh.split("-")[0];const gb="8.1.0",RP=Te({commitment:ve(),radius:ve(),storageRadius:ve(),reserveCapacityDoubling:ve()}),TP=Te({block:ve(),chainTip:ve(),totalAmount:me().transform(t=>qe(t,{name:"totalAmount"})),currentPrice:me().transform(Number).transform(t=>DS(t)),minimumValidityBlocks:ve().optional()}),SP=Te({bzzBalance:me().transform(t=>Le.fromPLUR(qe(t,{name:"bzzBalance"}))),nativeTokenBalance:me().transform(t=>ft.fromWei(qe(t,{name:"nativeTokenBalance"}))),chainID:ve(),chequebookContractAddress:me(),walletAddress:me()}),dw=Te({transactionHash:me().transform(t=>new Zr(t))}),IP="node",OP="status",PP="health",kP="readiness",NP="reservestate",CP="chainstate";async function _P(t){const e=await ye(t,{method:"get",url:OP,responseType:"json"});return zI.parse(e.data)}async function DP(t){const e=await ye(t,{method:"get",url:PP,responseType:"json"});return GI.parse(e.data)}async function FP(t){const e=await ye(t,{method:"get",url:kP});return VI.parse(e.data)}async function UP(t){const e=await ye(t,{method:"get",url:IP,responseType:"json"});return jI.parse(e.data)}async function LP(t){const e=await ye(t,{method:"get",url:NP,responseType:"json"});return RP.parse(e.data)}async function MP(t){const e=await ye(t,{method:"get",url:CP,responseType:"json"});return TP.parse(e.data)}class $P{constructor(e){this.context=e}async get(e){return _P(this.context.getRequestOptionsForCall(e))}async getHealth(e){return DP(this.context.getRequestOptionsForCall(e))}async getReadiness(e){return FP(this.context.getRequestOptionsForCall(e))}async getNodeInfo(e){return UP(this.context.getRequestOptionsForCall(e))}async isSupportedExactVersion(e){const{version:n}=await this.getHealth(e);return n===jh}async isSupportedApiVersion(e){const{apiVersion:n}=await this.getHealth(e);return pb(n)===pb(gb)}async getVersions(e){const{version:n,apiVersion:r}=await this.getHealth(e);return{supportedBeeVersion:jh,supportedBeeApiVersion:gb,beeVersion:n,beeApiVersion:r}}async getReserveState(e){return LP(this.context.getRequestOptionsForCall(e))}async getChainState(e){return MP(this.context.getRequestOptionsForCall(e))}}class zP{constructor(e){this.context=e}get blockTime(){return this.context.network==="gnosis"?5:15}async buy(e,n,r,i,s,a){const c=await this.context.bee.status.getChainState(i),l=Hn(n,c.currentPrice,this.blockTime),h=qi(e,s,a);return r&&(r=D1.parse(r)),this.context.bee.stamp.create(l,h,r,i)}async getCost(e,n,r,i,s){const a=await this.context.bee.status.getChainState(r),c=Hn(n,a.currentPrice,this.blockTime),l=qi(e,i,s);return Hi(l,c)}async extend(e,n,r,i,s,a){const c=await this.context.bee.stamp.get(e,i),l=qi(n,s,a),h=await this.context.bee.status.getChainState(i),d=l-c.depth,g=d<=0?1n:2n**BigInt(d),m=Hn(r,h.currentPrice,this.blockTime),w=Hn(c.duration,h.currentPrice,this.blockTime),E=(r.isZero()?w*g:(w+m)*g)-w;let S;if(E>0n&&(S=await this.context.bee.stamp.topUp(c.batchID,E,i)),d>0)return this.context.bee.stamp.dilute(c.batchID,l,i);if(!S)throw new Error("Nothing to extend, both size and duration are already sufficient");return S}async extendSize(e,n,r,i,s){const a=await this.context.bee.status.getChainState(r),c=await this.context.bee.stamp.get(e,r),l=qi(n,i,s),h=l-c.depth;if(h<=0)throw new Yn("New depth has to be greater than the original depth",l);const d=Hn(c.duration,a.currentPrice,this.blockTime);return await this.context.bee.stamp.topUp(c.batchID,d*(2n**BigInt(h)-1n)+1n,r),this.context.bee.stamp.dilute(c.batchID,l,r)}async extendDuration(e,n,r){const i=await this.context.bee.stamp.get(e,r),s=await this.context.bee.status.getChainState(r),a=Hn(n,s.currentPrice,this.blockTime);return this.context.bee.stamp.topUp(i.batchID,a,r)}async getExtensionCost(e,n,r,i,s,a){const c=await this.context.bee.stamp.get(e,i),l=await this.context.bee.status.getChainState(i),h=r.isZero()?0n:Hn(r,l.currentPrice,this.blockTime),d=qi(n,s,a),g=Hn(c.duration,l.currentPrice,this.blockTime),m=Hi(c.depth,g);return Hi(Math.max(c.depth,d),g+h).minus(m)}async getSizeExtensionCost(e,n,r,i,s){const a=await this.context.bee.stamp.get(e,r),c=await this.context.bee.status.getChainState(r),l=qi(n,i,s);if(l-a.depth<=0)throw new Yn("New depth has to be greater than the original depth",l);const d=Hn(a.duration,c.currentPrice,this.blockTime),g=Hi(a.depth,d);return Hi(l,d).minus(g)}async getDurationExtensionCost(e,n,r){const i=await this.context.bee.stamp.get(e,r),s=await this.context.bee.status.getChainState(r),a=Hn(n,s.currentPrice,this.blockTime);return Hi(i.depth,a)}async rename(e,n,r){return this.context.bee.stamp.updateLabel(e,n,r)}}const Zd=Te({address:me().nullish().transform(t=>t??""),seen:ve(),sent:ve(),split:ve(),startedAt:me(),stored:ve(),synced:ve(),uid:ve()}),GP=Te({tags:Lt(Zd)}),Zo="tags";async function VP(t){const e=await ye(t,{method:"post",url:Zo,responseType:"json"});return Zd.parse(e.data)}async function jP(t,e){const n=await ye(t,{url:Zo,params:{offset:e?.offset,limit:e?.limit},responseType:"json"});return GP.parse(n.data).tags}async function HP(t,e){const n=await ye(t,{url:`${Zo}/${e}`,responseType:"json"});return Zd.parse(n.data)}async function qP(t,e){await ye(t,{method:"delete",url:`${Zo}/${e}`})}async function ZP(t,e,n){await ye(t,{method:"patch",url:`${Zo}/${e}`,data:{reference:n}})}class KP{constructor(e){this.context=e}async create(e){return VP(this.context.getRequestOptionsForCall(e))}async getAll(e,n){return e&&(e=kS.parse(e)),jP(this.context.getRequestOptionsForCall(n),e)}async get(e,n){const r=Kr(e);return HP(this.context.getRequestOptionsForCall(n),r)}async delete(e,n){const r=Kr(e);await qP(this.context.getRequestOptionsForCall(n),r)}async update(e,n,r){const i=new Ue(n),s=Kr(e);await ZP(this.context.getRequestOptionsForCall(r),s,i)}}const pw=Te({transactionHash:me().transform(t=>new Zr(t)),to:me(),nonce:ve(),gasPrice:me().transform(t=>qe(t,{name:"gasPrice"})),gasLimit:ve(),data:me(),created:me(),description:me(),value:me().transform(t=>qe(t,{name:"value"}))}),JP=Te({pendingTransactions:Lt(pw)}),WP=pw,gw=Te({transactionHash:me().transform(t=>new Zr(t))}),Lc="transactions";async function QP(t){const e=await ye(t,{url:Lc,responseType:"json"});return JP.parse(e.data).pendingTransactions}async function YP(t,e){const n=await ye(t,{url:`${Lc}/${e}`,responseType:"json"});return WP.parse(n.data)}async function XP(t,e){const n=await ye(t,{method:"post",url:`${Lc}/${e}`,responseType:"json"});return gw.parse(n.data).transactionHash}async function ek(t,e,n){const r={};n&&(r["gas-price"]=n);const i=await ye(t,{method:"delete",headers:r,url:`${Lc}/${e}`,responseType:"json"});return gw.parse(i.data).transactionHash}let tk=class{constructor(e){this.context=e}async getAll(e){return QP(this.context.getRequestOptionsForCall(e))}async get(e,n){const r=new Zr(e);return YP(this.context.getRequestOptionsForCall(n),r)}async rebroadcast(e,n){const r=new Zr(e);return XP(this.context.getRequestOptionsForCall(n),r)}async cancel(e,n,r){const i=new Zr(e),s=n?qe(n,{min:0n,name:"gasPrice"}):void 0;return ek(this.context.getRequestOptionsForCall(r),i,s)}};const Kd="wallet";async function nk(t){const e=await ye(t,{method:"get",url:Kd,responseType:"json"});return SP.parse(e.data)}async function rk(t,e,n){const r=await ye(t,{method:"post",url:`${Kd}/withdraw/bzz`,responseType:"json",params:{amount:e.toPLURString(),address:n.toHex()}});return dw.parse(r.data).transactionHash}async function ik(t,e,n){const r=await ye(t,{method:"post",url:`${Kd}/withdraw/nativetoken`,responseType:"json",params:{amount:e.toWeiString(),address:n.toHex()}});return dw.parse(r.data).transactionHash}let sk=class{constructor(e){this.context=e}async getBalance(e){return nk(this.context.getRequestOptionsForCall(e))}async withdrawBZZ(e,n,r){const i=e instanceof Le?e:Le.fromPLUR(e),s=new It(n);return rk(this.context.getRequestOptionsForCall(r),i,s)}async withdrawDAI(e,n,r){const i=e instanceof ft?e:ft.fromWei(e),s=new It(n);return ik(this.context.getRequestOptionsForCall(r),i,s)}};const ok=["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 ak(t){try{if(typeof t!="string")return!1;const e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function ck(t){if(typeof t!="string"||ok.includes(t))return!1;const e=parseInt(t,10);return e>0&&e<65536&&!isNaN(e)}function uk(t){if(!ak(t))throw new Yn("URL is not valid!",t);const e=new URL(t).port;if(e&&!ck(e))throw new Yn("Port in URL is considered bad port and cannot be used!",e)}function lk(t){return t.endsWith("/")?t.slice(0,-1):t}class ZF{constructor(e,n){uk(e),this.url=lk(e),n?.signer&&(this.signer=new Er(n.signer)),this.network=n?.network??"gnosis",this.requestOptions={baseURL:this.url,timeout:n?.timeout??0,headers:n?.headers,onRequest:n?.onRequest,httpAgent:n?.httpAgent,httpsAgent:n?.httpsAgent};const r={getRequestOptionsForCall:i=>this.getRequestOptionsForCall(i),url:this.url,signer:this.signer,network:this.network,bee:this};this.balance=new QS(r),this.settlement=new qO(r),this.transaction=new tk(r),this.stake=new iP(r),this.connectivity=new sO(r),this.status=new $P(r),this.wallet=new sk(r),this.stamp=new yP(r),this.storage=new zP(r),this.chequebook=new dI(r),this.cheque=new hI(r),this.tag=new KP(r),this.pin=new zO(r),this.grantee=new PO(r),this.messaging=new DO(r),this.feed=new BO(r),this.soc=new ZO(r),this.data=new fO(r),this.chunk=new pI(r),this.file=new RO(r),this.collection=new _I(r)}makeContentAddressedChunk(e,n){return Mo(e,n)}unmarshalContentAddressedChunk(e){return Nx(e)}makeSingleOwnerChunk(e,n,r,i,s){return jS(e,n,r,i,s)}calculateSingleOwnerChunkAddress(e,n){return gs(e,n)}unmarshalSingleOwnerChunk(e,n){return Dc(e,n)}async createEnvelope(e,n,r){return e=new ot(e),n=new Ue(n),TT(this.getRequestOptionsForCall(r),e,n)}async rchash(e,n,r,i){return OT(this.getRequestOptionsForCall(i),e,n,r)}getRequestOptionsForCall(e){return e&&(e=BS.parse(e)),e?ke.Objects.deepMerge2(this.requestOptions,e):this.requestOptions}}new ot("0000000000000000000000000000000000000000000000000000000000000000");const KF=new Wi("0000000000000000000000000000000000000000000000000000000000000000"),fk=new Uint8Array(32),mw="6.17.0";function hk(t,e,n){const r=e.split("|").map(s=>s.trim());for(let s=0;s<r.length;s++)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.${n}`,i.value=t,i}async function Gt(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,i,s)=>(r[e[s]]=i,r),{})}function Oe(t,e,n){for(let r in e){let i=e[r];const s=n?n[r]:null;s&&hk(i,s,r),Object.defineProperty(t,r,{enumerable:!0,value:i,writable:!1})}}function ns(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(n=>ns(n,e)).join(", ")+" ]";if(t instanceof Uint8Array){const n="0123456789abcdef";let r="0x";for(let i=0;i<t.length;i++)r+=n[t[i]>>4],r+=n[t[i]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return ns(t.toJSON(),e);switch(typeof t){case"boolean":case"number":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const n=Object.keys(t);return n.sort(),"{ "+n.map(r=>`${ns(r,e)}: ${ns(t[r],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Nt(t,e){return t&&t.code===e}function Jd(t){return Nt(t,"CALL_EXCEPTION")}function pt(t,e,n){let r=t;{const s=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${ns(n)}`);for(const a in n){if(a==="shortMessage")continue;const c=n[a];s.push(a+"="+ns(c))}}s.push(`code=${e}`),s.push(`version=${mw}`),s.length&&(t+=" ("+s.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 Oe(i,{code:e}),n&&Object.assign(i,n),i.shortMessage==null&&Oe(i,{shortMessage:r}),i}function fe(t,e,n,r){if(!t)throw pt(e,n,r)}function F(t,e,n,r){fe(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function bw(t,e,n){n==null&&(n=""),n&&(n=": "+n),fe(t>=e,"missing argument"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),fe(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const dk=["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 yw(t){fe(dk.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function Fi(t,e,n){if(n==null&&(n=""),t!==e){let r=n,i="new";n&&(r+=".",i+=" "+n),fe(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function xw(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.length%2===0&&t.match(/^0x[0-9a-f]*$/i)){const r=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s<r.length;s++)r[s]=parseInt(t.substring(i,i+2),16),i+=2;return r}F(!1,"invalid BytesLike value",e||"value",t)}function we(t,e){return xw(t,e,!1)}function Ut(t,e){return xw(t,e,!0)}function nt(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 Mc(t){return nt(t,!0)||t instanceof Uint8Array}const mb="0123456789abcdef";function pe(t){const e=we(t);let n="0x";for(let r=0;r<e.length;r++){const i=e[r];n+=mb[(i&240)>>4]+mb[i&15]}return n}function He(t){return"0x"+t.map(e=>pe(e).substring(2)).join("")}function cs(t){return nt(t,!0)?(t.length-2)/2:we(t).length}function ut(t,e,n){const r=we(t);return n!=null&&n>r.length&&fe(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),pe(r.slice(e??0,n??r.length))}function ww(t,e,n){const r=we(t);fe(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),n?i.set(r,e-r.length):i.set(r,0),pe(i)}function Rr(t,e){return ww(t,e,!0)}function pk(t,e){return ww(t,e,!1)}const Ko=BigInt(0),Fn=BigInt(1),rs=9007199254740991;function gk(t,e){const n=$c(t,"value"),r=BigInt(Ne(e,"width"));if(fe(n>>r===Ko,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-Fn){const i=(Fn<<r)-Fn;return-((~n&i)+Fn)}return n}function Aw(t,e){let n=Ae(t,"value");const r=BigInt(Ne(e,"width")),i=Fn<<r-Fn;if(n<Ko){n=-n,fe(n<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const s=(Fn<<r)-Fn;return(~n&s)+Fn}else fe(n<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function uo(t,e){const n=$c(t,"value"),r=BigInt(Ne(e,"bits"));return n&(Fn<<r)-Fn}function Ae(t,e){switch(typeof t){case"bigint":return t;case"number":return F(Number.isInteger(t),"underflow",e||"value",t),F(t>=-rs&&t<=rs,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){F(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}F(!1,"invalid BigNumberish value",e||"value",t)}function $c(t,e){const n=Ae(t,e);return fe(n>=Ko,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const bb="0123456789abcdef";function zc(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=bb[n>>4],e+=bb[n&15];return BigInt(e)}return Ae(t)}function Ne(t,e){switch(typeof t){case"bigint":return F(t>=-rs&&t<=rs,"overflow",e||"value",t),Number(t);case"number":return F(Number.isInteger(t),"underflow",e||"value",t),F(t>=-rs&&t<=rs,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Ne(BigInt(t),e)}catch(n){F(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}F(!1,"invalid numeric value",e||"value",t)}function mk(t){return Ne(zc(t))}function Tr(t,e){const n=$c(t,"value");let r=n.toString(16);if(e==null)r.length%2&&(r="0"+r);else{const i=Ne(e,"width");if(i===0&&n===Ko)return"0x";for(fe(i*2>=r.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<i*2;)r="0"+r}return"0x"+r}function bt(t,e){const n=$c(t,"value");if(n===Ko)return new Uint8Array(0);let r=n.toString(16);r.length%2&&(r="0"+r);const i=new Uint8Array(r.length/2);for(let s=0;s<i.length;s++){const a=s*2;i[s]=parseInt(r.substring(a,a+2),16)}return i}function _n(t){let e=pe(Mc(t)?t:bt(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const hc="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let Ta=null;function bk(t){if(Ta==null){Ta={};for(let n=0;n<hc.length;n++)Ta[hc[n]]=BigInt(n)}const e=Ta[t];return F(e!=null,"invalid base58 value","letter",t),e}const yk=BigInt(0),Hh=BigInt(58);function Ew(t){const e=we(t);let n=zc(e),r="";for(;n;)r=hc[Number(n%Hh)]+r,n/=Hh;for(let i=0;i<e.length&&!e[i];i++)r=hc[0]+r;return r}function xk(t){let e=yk;for(let n=0;n<t.length;n++)e*=Hh,e+=bk(t[n]);return e}function wk(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return we(e)}function Ak(t){const e=we(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}class vw{filter;emitter;#e;constructor(e,n,r){this.#e=n,Oe(this,{emitter:e,filter:r})}async removeListener(){this.#e!=null&&await this.emitter.off(this.filter,this.#e)}}function Ek(t,e,n,r,i){F(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function Bw(t,e,n,r,i){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let s=0;for(let a=e+1;a<n.length&&n[a]>>6===2;a++)s++;return s}return t==="OVERRUN"?n.length-e-1:0}function vk(t,e,n,r,i){return t==="OVERLONG"?(F(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),r.push(i),0):(r.push(65533),Bw(t,e,n))}const Bk=Object.freeze({error:Ek,ignore:Bw,replace:vk});function Rk(t,e){e==null&&(e=Bk.error);const n=we(t,"bytes"),r=[];let i=0;for(;i<n.length;){const s=n[i++];if(s>>7===0){r.push(s);continue}let a=null,c=null;if((s&224)===192)a=1,c=127;else if((s&240)===224)a=2,c=2047;else if((s&248)===240)a=3,c=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,n,r):i+=e("BAD_PREFIX",i-1,n,r);continue}if(i-1+a>=n.length){i+=e("OVERRUN",i-1,n,r);continue}let l=s&(1<<8-a-1)-1;for(let h=0;h<a;h++){let d=n[i];if((d&192)!=128){i+=e("MISSING_CONTINUE",i,n,r),l=null;break}l=l<<6|d&63,i++}if(l!==null){if(l>1114111){i+=e("OUT_OF_RANGE",i-1-a,n,r,l);continue}if(l>=55296&&l<=57343){i+=e("UTF16_SURROGATE",i-1-a,n,r,l);continue}if(l<=c){i+=e("OVERLONG",i-1-a,n,r,l);continue}r.push(l)}}return r}function Xt(t,e){F(typeof t=="string","invalid string value","str",t),e!=null&&(yw(e),t=t.normalize(e));let n=[];for(let r=0;r<t.length;r++){const i=t.charCodeAt(r);if(i<128)n.push(i);else if(i<2048)n.push(i>>6|192),n.push(i&63|128);else if((i&64512)==55296){r++;const s=t.charCodeAt(r);F(r<t.length&&(s&64512)===56320,"invalid surrogate pair","str",t);const a=65536+((i&1023)<<10)+(s&1023);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(a&63|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(i&63|128)}return new Uint8Array(n)}function Tk(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function dc(t,e){return Tk(Rk(t,e))}function Rw(t){async function e(n,r){fe(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const i=n.url.split(":")[0].toLowerCase();fe(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),fe(i==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s=null;const a=new AbortController,c=setTimeout(()=>{s=pt("request timeout","TIMEOUT"),a.abort()},n.timeout);r&&r.addListener(()=>{s=pt("request cancelled","CANCELLED"),a.abort()});const l=Object.assign({},t,{method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:a.signal});let h;try{h=await fetch(n.url,l)}catch(w){throw clearTimeout(c),s||w}clearTimeout(c);const d={};h.headers.forEach((w,v)=>{d[v.toLowerCase()]=w});const g=await h.arrayBuffer(),m=g==null?null:new Uint8Array(g);return{statusCode:h.status,statusMessage:h.statusText,headers:d,body:m}}return e}const Sk=12,Ik=250;let yb=Rw();const Ok=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Pk=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let oh=!1;async function Tw(t,e){try{const n=t.match(Ok);if(!n)throw new Error("invalid data");return new Jr(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?wk(n[3]):Nk(n[3]))}catch{return new Jr(599,"BAD REQUEST (invalid data: URI)",{},null,new er(t))}}function Sw(t){async function e(n,r){try{const i=n.match(Pk);if(!i)throw new Error("invalid link");return new er(`${t}${i[2]}`)}catch{return new Jr(599,"BAD REQUEST (invalid IPFS URI)",{},null,new er(n))}}return e}const Sa={data:Tw,ipfs:Sw("https://gateway.ipfs.io/ipfs/")},Iw=new WeakMap;class kk{#e;#t;constructor(e){this.#e=[],this.#t=!1,Iw.set(e,()=>{if(!this.#t){this.#t=!0;for(const n of this.#e)setTimeout(()=>{n()},0);this.#e=[]}})}addListener(e){fe(!this.#t,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#e.push(e)}get cancelled(){return this.#t}checkSignal(){fe(!this.cancelled,"cancelled","CANCELLED",{})}}function Ia(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}class er{#e;#t;#n;#r;#i;#o;#s;#a;#d;#u;#g;#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=Xt(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=Xt(JSON.stringify(e)),this.#a="application/json";else throw new Error("invalid body")}hasBody(){return this.#s!=null}get method(){return this.#r?this.#r:this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),this.#r=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#n);return this.#d&&(e.authorization=`Basic ${Ak(Xt(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,n){this.#n[String(e).toLowerCase()]=String(n)}clearHeaders(){this.#n={}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const i=n[r++];return{value:[i,e[i]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#d||null}setCredentials(e,n){F(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#d=`${e}:${n}`}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.#g||null}set processFunc(e){this.#g=e}get retryFunc(){return this.#p||null}set retryFunc(e){this.#p=e}get getUrlFunc(){return this.#f||yb}set getUrlFunc(e){this.#f=e}constructor(e){this.#o=String(e),this.#e=!1,this.#t=!0,this.#n={},this.#r="",this.#i=3e5,this.#l={slotInterval:Ik,maxAttempts:Sk},this.#f=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#s?pe(this.#s):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(this.#l.slotInterval=e.slotInterval),e.maxAttempts!=null&&(this.#l.maxAttempts=e.maxAttempts)}async#c(e,n,r,i,s){if(e>=this.#l.maxAttempts)return s.makeServerError("exceeded maximum retry limit");fe(xb()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),r>0&&await Ck(r);let a=this.clone();const c=(a.url.split(":")[0]||"").toLowerCase();if(c in Sa){const d=await Sa[c](a.url,Ia(i.#h));if(d instanceof Jr){let g=d;if(this.processFunc){Ia(i.#h);try{g=await this.processFunc(a,g)}catch(m){(m.throttle==null||typeof m.stall!="number")&&g.makeServerError("error in post-processing function",m).assertOk()}}return g}a=d}this.preflightFunc&&(a=await this.preflightFunc(a));const l=await this.getUrlFunc(a,Ia(i.#h));let h=new Jr(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,n,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 g=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof d=="string"&&d.match(/^[1-9][0-9]*$/)&&(g=parseInt(d)),a.clone().#c(e+1,n,g,i,h)}if(this.processFunc){Ia(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 g=this.#l.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return d.stall>=0&&(g=d.stall),a.clone().#c(e+1,n,g,i,h)}}return h}send(){return fe(this.#h==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#h=new kk(this),this.#c(0,xb()+this.timeout,0,this,new Jr(0,"",{},null,this))}cancel(){fe(this.#h!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=Iw.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();fe((n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new er(e);return i.method=this.method,i.allowGzip=this.allowGzip,i.timeout=this.timeout,i.#n=Object.assign({},this.#n),this.#s&&(i.#s=new Uint8Array(this.#s)),i.#a=this.#a,i}clone(){const e=new er(this.url);return e.#r=this.#r,this.#s&&(e.#s=this.#s),e.#a=this.#a,e.#n=Object.assign({},this.#n),e.#d=this.#d,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#u=this.#u,e.#g=this.#g,e.#p=this.#p,e.#l=Object.assign({},this.#l),e.#f=this.#f,e}static lockConfig(){oh=!0}static getGateway(e){return Sa[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(oh)throw new Error("gateways locked");Sa[e]=n}static registerGetUrl(e){if(oh)throw new Error("gateways locked");yb=e}static createGetUrlFunc(e){return Rw(e)}static createDataGateway(){return Tw}static createIpfsGatewayFunc(e){return Sw(e)}}class Jr{#e;#t;#n;#r;#i;#o;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#r?pe(this.#r):"null"}>`}get statusCode(){return this.#e}get statusMessage(){return this.#t}get headers(){return Object.assign({},this.#n)}get body(){return this.#r==null?null:new Uint8Array(this.#r)}get bodyText(){try{return this.#r==null?"":dc(this.#r)}catch{fe(!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{fe(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const i=n[r++];return{value:[i,e[i]],done:!1}}return{value:void 0,done:!0}}}}constructor(e,n,r,i,s){this.#e=e,this.#t=n,this.#n=Object.keys(r).reduce((a,c)=>(a[c.toLowerCase()]=String(r[c]),a),{}),this.#r=i==null?null:new Uint8Array(i),this.#i=s||null,this.#o={message:""}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const i=new Jr(599,r,this.headers,this.body,this.#i||void 0);return i.#o={message:e,error:n},i}throwThrottleError(e,n){n==null?n=-1:F(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw Oe(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return this.#r!=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:n}=this.#o;e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let i=null;try{this.#r&&(i=dc(this.#r))}catch{}fe(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function xb(){return new Date().getTime()}function Nk(t){return Xt(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function Ck(t){return new Promise(e=>setTimeout(e,t))}function _k(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function wb(t,e,n){let r=0;for(let i=0;i<n;i++)r=r*256+t[e+i];return r}function Ab(t,e,n,r){const i=[];for(;n<e+1+r;){const s=Ow(t,n);i.push(s.result),n+=s.consumed,fe(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:i}}function Ow(t,e){fe(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{fe(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const i=wb(t,e+1,r);return n(e+1+r+i),Ab(t,e,e+1+r,r+i)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),Ab(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const i=wb(t,e+1,r);n(e+1+r+i);const s=pe(t.slice(e+1+r,e+1+r+i));return{consumed:1+r+i,result:s}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const i=pe(t.slice(e+1,e+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:_k(t[e])}}function Jo(t){const e=we(t,"data"),n=Ow(e,0);return F(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function Eb(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function Pw(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(s){r=r.concat(Pw(s))}),r.length<=55)return r.unshift(192+r.length),r;const i=Eb(r.length);return i.unshift(247+i.length),i.concat(r)}const e=Array.prototype.slice.call(we(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=Eb(e.length);return n.unshift(183+n.length),n.concat(e)}const vb="0123456789abcdef";function Xn(t){let e="0x";for(const n of Pw(t))e+=vb[n>>4],e+=vb[n&15];return e}function Dk(t){const e=we(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=pe(e);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const Wt=32,qh=new Uint8Array(Wt),Fk=["then"],Oa={},kw=new WeakMap;function pi(t){return kw.get(t)}function Bb(t,e){kw.set(t,e)}function no(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function Zh(t,e,n){return t.indexOf(null)>=0?e.map((r,i)=>r instanceof br?Zh(pi(r),r,n):r):t.reduce((r,i,s)=>{let a=e.getValue(i);return i in r||(n&&a instanceof br&&(a=Zh(pi(a),a,n)),r[i]=a),r},{})}class br extends Array{#e;constructor(...e){const n=e[0];let r=e[1],i=(e[2]||[]).slice(),s=!0;n!==Oa&&(r=e,i=[],s=!1),super(r.length),r.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(Bb(this,Object.freeze(r.map((l,h)=>{const d=i[h];return d!=null&&a.get(d)===1?d:null}))),this.#e=[],this.#e==null&&this.#e,!s)return;Object.freeze(this);const c=new Proxy(this,{get:(l,h,d)=>{if(typeof h=="string"){if(h.match(/^[0-9]+$/)){const m=Ne(h,"%index");if(m<0||m>=this.length)throw new RangeError("out of result range");const w=l[m];return w instanceof Error&&no(`index ${m}`,w),w}if(Fk.indexOf(h)>=0)return Reflect.get(l,h,d);const g=l[h];if(g instanceof Function)return function(...m){return g.apply(this===d?l:this,m)};if(!(h in l))return l.getValue.apply(this===d?l:this,[h])}return Reflect.get(l,h,d)}});return Bb(c,pi(this)),c}toArray(e){const n=[];return this.forEach((r,i)=>{r instanceof Error&&no(`index ${i}`,r),e&&r instanceof br&&(r=r.toArray(e)),n.push(r)}),n}toObject(e){const n=pi(this);return n.reduce((r,i,s)=>(fe(i!=null,`value at index ${s} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Zh(n,this,e)),{})}slice(e,n){e==null&&(e=0),e<0&&(e+=this.length,e<0&&(e=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const r=pi(this),i=[],s=[];for(let a=e;a<n;a++)i.push(this[a]),s.push(r[a]);return new br(Oa,i,s)}filter(e,n){const r=pi(this),i=[],s=[];for(let a=0;a<this.length;a++){const c=this[a];c instanceof Error&&no(`index ${a}`,c),e.call(n,c,a,this)&&(i.push(c),s.push(r[a]))}return new br(Oa,i,s)}map(e,n){const r=[];for(let i=0;i<this.length;i++){const s=this[i];s instanceof Error&&no(`index ${i}`,s),r.push(e.call(n,s,i,this))}return r}getValue(e){const n=pi(this).indexOf(e);if(n===-1)return;const r=this[n];return r instanceof Error&&no(`property ${JSON.stringify(e)}`,r.error),r}static fromItems(e,n){return new br(Oa,e,n)}}function Rb(t){let e=bt(t);return fe(e.length<=Wt,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Wt,offset:e.length}),e.length!==Wt&&(e=Ut(He([qh.slice(e.length%Wt),e]))),e}class Or{name;type;localName;dynamic;constructor(e,n,r,i){Oe(this,{name:e,type:n,localName:r,dynamic:i},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){F(!1,e,this.localName,n)}}class Kh{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return He(this.#e)}get length(){return this.#t}#n(e){return this.#e.push(e),this.#t+=e.length,e.length}appendWriter(e){return this.#n(Ut(e.data))}writeBytes(e){let n=Ut(e);const r=n.length%Wt;return r&&(n=Ut(He([n,qh.slice(r)]))),this.#n(n)}writeValue(e){return this.#n(Rb(e))}writeUpdatableValue(){const e=this.#e.length;return this.#e.push(qh),this.#t+=Wt,n=>{this.#e[e]=Rb(n)}}}class Wd{allowLoose;#e;#t;#n;#r;#i;constructor(e,n,r){Oe(this,{allowLoose:!!n}),this.#e=Ut(e),this.#n=0,this.#r=null,this.#i=r??1024,this.#t=0}get data(){return pe(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#t}get bytes(){return new Uint8Array(this.#e)}#o(e){if(this.#r)return this.#r.#o(e);this.#n+=e,fe(this.#i<1||this.#n<=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:Ut(this.#e),offset:this.#t,length:e,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#s(e,n,r){let i=Math.ceil(n/Wt)*Wt;return this.#t+i>this.#e.length&&(this.allowLoose&&r&&this.#t+n<=this.#e.length?i=n:fe(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Ut(this.#e),length:this.#e.length,offset:this.#t+i})),this.#e.slice(this.#t,this.#t+i)}subReader(e){const n=new Wd(this.#e.slice(this.#t+e),this.allowLoose,this.#i);return n.#r=this,n}readBytes(e,n){let r=this.#s(0,e,!!n);return this.#o(e),this.#t+=r.length,r.slice(0,e)}readValue(){return zc(this.readBytes(Wt))}readIndex(){return mk(this.readBytes(Wt))}}function fn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Qd(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 Nw(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");fn(t.outputLen),fn(t.blockLen)}function ws(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 Cw(t,e){Qd(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const ah=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const _w=t=>t instanceof Uint8Array,Va=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ja=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),qn=(t,e)=>t<<32-e|t>>>e,Uk=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Uk)throw new Error("Non little-endian hardware is not supported");const Lk=async()=>{};async function Tb(t,e,n){let r=Date.now();for(let i=0;i<t;i++){n(i);const s=Date.now()-r;s>=0&&s<e||(await Lk(),r+=s)}}function Mk(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function As(t){if(typeof t=="string"&&(t=Mk(t)),!_w(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function $k(...t){const e=new Uint8Array(t.reduce((r,i)=>r+i.length,0));let n=0;return t.forEach(r=>{if(!_w(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class Yd{clone(){return this._cloneInto()}}const zk={}.toString;function Dw(t,e){if(e!==void 0&&zk.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function Gc(t){const e=r=>t().update(As(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Gk(t=32){if(ah&&typeof ah.getRandomValues=="function")return ah.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class Fw extends Yd{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Nw(e);const r=As(n);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,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let a=0;a<s.length;a++)s[a]^=54;this.iHash.update(s),this.oHash=e.create();for(let a=0;a<s.length;a++)s[a]^=106;this.oHash.update(s),s.fill(0)}update(e){return ws(this),this.iHash.update(e),this}digestInto(e){ws(this),Qd(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:n,iHash:r,finished:i,destroyed:s,blockLen:a,outputLen:c}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=a,e.outputLen=c,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Vc=(t,e,n)=>new Fw(t,e).update(n).digest();Vc.create=(t,e)=>new Fw(t,e);function Vk(t,e,n,r){Nw(t);const i=Dw({dkLen:32,asyncTick:10},r),{c:s,dkLen:a,asyncTick:c}=i;if(fn(s),fn(a),fn(c),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=As(e),h=As(n),d=new Uint8Array(a),g=Vc.create(t,l),m=g._cloneInto().update(h);return{c:s,dkLen:a,asyncTick:c,DK:d,PRF:g,PRFSalt:m}}function jk(t,e,n,r,i){return t.destroy(),e.destroy(),r&&r.destroy(),i.fill(0),n}function Xd(t,e,n,r){const{c:i,dkLen:s,DK:a,PRF:c,PRFSalt:l}=Vk(t,e,n,r);let h;const d=new Uint8Array(4),g=ja(d),m=new Uint8Array(c.outputLen);for(let w=1,v=0;v<s;w++,v+=c.outputLen){const E=a.subarray(v,v+c.outputLen);g.setInt32(0,w,!1),(h=l._cloneInto(h)).update(d).digestInto(m),E.set(m.subarray(0,E.length));for(let S=1;S<i;S++){c._cloneInto(h).update(m).digestInto(m);for(let A=0;A<E.length;A++)E[A]^=m[A]}}return jk(c,l,a,h,m)}function Hk(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),a=Number(n>>i&s),c=Number(n&s),l=r?4:0,h=r?0:4;t.setUint32(e+l,a,r),t.setUint32(e+h,c,r)}class e0 extends Yd{constructor(e,n,r,i){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ja(this.buffer)}update(e){ws(this);const{view:n,buffer:r,blockLen:i}=this;e=As(e);const s=e.length;for(let a=0;a<s;){const c=Math.min(i-this.pos,s-a);if(c===i){const l=ja(e);for(;i<=s-a;a+=i)this.process(l,a);continue}r.set(e.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ws(this),Cw(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:a}=this;n[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(r,0),a=0);for(let g=a;g<i;g++)n[g]=0;Hk(r,i-8,BigInt(this.length*8),s),this.process(r,0);const c=ja(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 g=0;g<h;g++)c.setUint32(4*g,d[g],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:a,pos:c}=this;return e.length=i,e.pos=c,e.finished=s,e.destroyed=a,i%n&&e.buffer.set(r),e}}const qk=(t,e,n)=>t&e^~t&n,Zk=(t,e,n)=>t&e^t&n^e&n,Kk=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]),Lr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mr=new Uint32Array(64);class Jk extends e0{constructor(){super(64,32,8,!1),this.A=Lr[0]|0,this.B=Lr[1]|0,this.C=Lr[2]|0,this.D=Lr[3]|0,this.E=Lr[4]|0,this.F=Lr[5]|0,this.G=Lr[6]|0,this.H=Lr[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:a,G:c,H:l}=this;return[e,n,r,i,s,a,c,l]}set(e,n,r,i,s,a,c,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=c|0,this.H=l|0}process(e,n){for(let g=0;g<16;g++,n+=4)Mr[g]=e.getUint32(n,!1);for(let g=16;g<64;g++){const m=Mr[g-15],w=Mr[g-2],v=qn(m,7)^qn(m,18)^m>>>3,E=qn(w,17)^qn(w,19)^w>>>10;Mr[g]=E+Mr[g-7]+v+Mr[g-16]|0}let{A:r,B:i,C:s,D:a,E:c,F:l,G:h,H:d}=this;for(let g=0;g<64;g++){const m=qn(c,6)^qn(c,11)^qn(c,25),w=d+m+qk(c,l,h)+Kk[g]+Mr[g]|0,E=(qn(r,2)^qn(r,13)^qn(r,22))+Zk(r,i,s)|0;d=h,h=l,l=c,c=a+w|0,a=s,s=i,i=r,r=w+E|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(r,i,s,a,c,l,h,d)}roundClean(){Mr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Cs=Gc(()=>new Jk),Pa=BigInt(2**32-1),Jh=BigInt(32);function Uw(t,e=!1){return e?{h:Number(t&Pa),l:Number(t>>Jh&Pa)}:{h:Number(t>>Jh&Pa)|0,l:Number(t&Pa)|0}}function Lw(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:a}=Uw(t[i],e);[n[i],r[i]]=[s,a]}return[n,r]}const Wk=(t,e)=>BigInt(t>>>0)<<Jh|BigInt(e>>>0),Qk=(t,e,n)=>t>>>n,Yk=(t,e,n)=>t<<32-n|e>>>n,Xk=(t,e,n)=>t>>>n|e<<32-n,eN=(t,e,n)=>t<<32-n|e>>>n,tN=(t,e,n)=>t<<64-n|e>>>n-32,nN=(t,e,n)=>t>>>n-32|e<<64-n,rN=(t,e)=>e,iN=(t,e)=>t,Mw=(t,e,n)=>t<<n|e>>>32-n,$w=(t,e,n)=>e<<n|t>>>32-n,zw=(t,e,n)=>e<<n-32|t>>>64-n,Gw=(t,e,n)=>t<<n-32|e>>>64-n;function sN(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:i|0}}const oN=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),aN=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,cN=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),uN=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,lN=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),fN=(t,e,n,r,i,s)=>e+n+r+i+s+(t/2**32|0)|0,_e={fromBig:Uw,split:Lw,toBig:Wk,shrSH:Qk,shrSL:Yk,rotrSH:Xk,rotrSL:eN,rotrBH:tN,rotrBL:nN,rotr32H:rN,rotr32L:iN,rotlSH:Mw,rotlSL:$w,rotlBH:zw,rotlBL:Gw,add:sN,add3L:oN,add3H:aN,add4L:cN,add4H:uN,add5H:fN,add5L:lN},[hN,dN]=_e.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))),$r=new Uint32Array(80),zr=new Uint32Array(80);class pN extends e0{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:n,Bh:r,Bl:i,Ch:s,Cl:a,Dh:c,Dl:l,Eh:h,El:d,Fh:g,Fl:m,Gh:w,Gl:v,Hh:E,Hl:S}=this;return[e,n,r,i,s,a,c,l,h,d,g,m,w,v,E,S]}set(e,n,r,i,s,a,c,l,h,d,g,m,w,v,E,S){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=a|0,this.Dh=c|0,this.Dl=l|0,this.Eh=h|0,this.El=d|0,this.Fh=g|0,this.Fl=m|0,this.Gh=w|0,this.Gl=v|0,this.Hh=E|0,this.Hl=S|0}process(e,n){for(let T=0;T<16;T++,n+=4)$r[T]=e.getUint32(n),zr[T]=e.getUint32(n+=4);for(let T=16;T<80;T++){const O=$r[T-15]|0,k=zr[T-15]|0,_=_e.rotrSH(O,k,1)^_e.rotrSH(O,k,8)^_e.shrSH(O,k,7),D=_e.rotrSL(O,k,1)^_e.rotrSL(O,k,8)^_e.shrSL(O,k,7),$=$r[T-2]|0,j=zr[T-2]|0,X=_e.rotrSH($,j,19)^_e.rotrBH($,j,61)^_e.shrSH($,j,6),de=_e.rotrSL($,j,19)^_e.rotrBL($,j,61)^_e.shrSL($,j,6),U=_e.add4L(D,de,zr[T-7],zr[T-16]),Z=_e.add4H(U,_,X,$r[T-7],$r[T-16]);$r[T]=Z|0,zr[T]=U|0}let{Ah:r,Al:i,Bh:s,Bl:a,Ch:c,Cl:l,Dh:h,Dl:d,Eh:g,El:m,Fh:w,Fl:v,Gh:E,Gl:S,Hh:A,Hl:I}=this;for(let T=0;T<80;T++){const O=_e.rotrSH(g,m,14)^_e.rotrSH(g,m,18)^_e.rotrBH(g,m,41),k=_e.rotrSL(g,m,14)^_e.rotrSL(g,m,18)^_e.rotrBL(g,m,41),_=g&w^~g&E,D=m&v^~m&S,$=_e.add5L(I,k,D,dN[T],zr[T]),j=_e.add5H($,A,O,_,hN[T],$r[T]),X=$|0,de=_e.rotrSH(r,i,28)^_e.rotrBH(r,i,34)^_e.rotrBH(r,i,39),U=_e.rotrSL(r,i,28)^_e.rotrBL(r,i,34)^_e.rotrBL(r,i,39),Z=r&s^r&c^s&c,J=i&a^i&l^a&l;A=E|0,I=S|0,E=w|0,S=v|0,w=g|0,v=m|0,{h:g,l:m}=_e.add(h|0,d|0,j|0,X|0),h=c|0,d=l|0,c=s|0,l=a|0,s=r|0,a=i|0;const L=_e.add3L(X,U,J);r=_e.add3H(L,j,de,Z),i=L|0}({h:r,l:i}=_e.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:a}=_e.add(this.Bh|0,this.Bl|0,s|0,a|0),{h:c,l}=_e.add(this.Ch|0,this.Cl|0,c|0,l|0),{h,l:d}=_e.add(this.Dh|0,this.Dl|0,h|0,d|0),{h:g,l:m}=_e.add(this.Eh|0,this.El|0,g|0,m|0),{h:w,l:v}=_e.add(this.Fh|0,this.Fl|0,w|0,v|0),{h:E,l:S}=_e.add(this.Gh|0,this.Gl|0,E|0,S|0),{h:A,l:I}=_e.add(this.Hh|0,this.Hl|0,A|0,I|0),this.set(r,i,s,a,c,l,h,d,g,m,w,v,E,S,A,I)}roundClean(){$r.fill(0),zr.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 t0=Gc(()=>new pN);function gN(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof bo<"u")return bo;throw new Error("unable to locate global object")}const Sb=gN(),Ib=Sb.crypto||Sb.msCrypto;function mN(t){switch(t){case"sha256":return Cs.create();case"sha512":return t0.create()}F(!1,"invalid hashing algorithm name","algorithm",t)}function bN(t,e){const n={sha256:Cs,sha512:t0}[t];return F(n!=null,"invalid hmac algorithm","algorithm",t),Vc.create(n,e)}function yN(t,e,n,r,i){const s={sha256:Cs,sha512:t0}[i];return F(s!=null,"invalid pbkdf2 algorithm","algorithm",i),Xd(s,t,e,{c:n,dkLen:r})}function xN(t){fe(Ib!=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 Ib.getRandomValues(e),e}let Vw=!1;const jw=function(t,e,n){return bN(t,e).update(n).digest()};let Hw=jw;function _s(t,e,n){const r=we(e,"key"),i=we(n,"data");return pe(Hw(t,r,i))}_s._=jw;_s.lock=function(){Vw=!0};_s.register=function(t){if(Vw)throw new Error("computeHmac is locked");Hw=t};Object.freeze(_s);const[qw,Zw,Kw]=[[],[],[]],wN=BigInt(0),ro=BigInt(1),AN=BigInt(2),EN=BigInt(7),vN=BigInt(256),BN=BigInt(113);for(let t=0,e=ro,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],qw.push(2*(5*r+n)),Zw.push((t+1)*(t+2)/2%64);let i=wN;for(let s=0;s<7;s++)e=(e<<ro^(e>>EN)*BN)%vN,e&AN&&(i^=ro<<(ro<<BigInt(s))-ro);Kw.push(i)}const[RN,TN]=Lw(Kw,!0),Ob=(t,e,n)=>n>32?zw(t,e,n):Mw(t,e,n),Pb=(t,e,n)=>n>32?Gw(t,e,n):$w(t,e,n);function SN(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let a=0;a<10;a++)n[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){const c=(a+8)%10,l=(a+2)%10,h=n[l],d=n[l+1],g=Ob(h,d,1)^n[c],m=Pb(h,d,1)^n[c+1];for(let w=0;w<50;w+=10)t[a+w]^=g,t[a+w+1]^=m}let i=t[2],s=t[3];for(let a=0;a<24;a++){const c=Zw[a],l=Ob(i,s,c),h=Pb(i,s,c),d=qw[a];i=t[d],s=t[d+1],t[d]=l,t[d+1]=h}for(let a=0;a<50;a+=10){for(let c=0;c<10;c++)n[c]=t[a+c];for(let c=0;c<10;c++)t[a+c]^=~n[(c+2)%10]&n[(c+4)%10]}t[0]^=RN[r],t[1]^=TN[r]}n.fill(0)}class n0 extends Yd{constructor(e,n,r,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,fn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Va(this.state)}keccak(){SN(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){ws(this);const{blockLen:n,state:r}=this;e=As(e);const i=e.length;for(let s=0;s<i;){const a=Math.min(n-this.pos,i-s);for(let c=0;c<a;c++)r[this.pos++]^=e[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:i}=this;e[r]^=n,(n&128)!==0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){ws(this,!1),Qd(e),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=e.length;i<s;){this.posOut>=r&&this.keccak();const a=Math.min(r-this.posOut,s-i);e.set(n.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 fn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Cw(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:n,suffix:r,outputLen:i,rounds:s,enableXOF:a}=this;return e||(e=new n0(n,r,i,a,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}const IN=(t,e,n)=>Gc(()=>new n0(e,t,n)),ON=IN(1,136,256/8);let Jw=!1;const Ww=function(t){return ON(t)};let Qw=Ww;function ht(t){const e=we(t,"data");return pe(Qw(e))}ht._=Ww;ht.lock=function(){Jw=!0};ht.register=function(t){if(Jw)throw new TypeError("keccak256 is locked");Qw=t};Object.freeze(ht);const PN=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Yw=Uint8Array.from({length:16},(t,e)=>e),kN=Yw.map(t=>(9*t+5)%16);let r0=[Yw],i0=[kN];for(let t=0;t<4;t++)for(let e of[r0,i0])e.push(e[t].map(n=>PN[n]));const Xw=[[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)),NN=r0.map((t,e)=>t.map(n=>Xw[e][n])),CN=i0.map((t,e)=>t.map(n=>Xw[e][n])),_N=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),DN=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),ka=(t,e)=>t<<e|t>>>32-e;function kb(t,e,n,r){return t===0?e^n^r:t===1?e&n|~e&r:t===2?(e|~n)^r:t===3?e&r|n&~r:e^(n|~r)}const Na=new Uint32Array(16);class FN extends e0{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:n,h2:r,h3:i,h4:s}=this;return[e,n,r,i,s]}set(e,n,r,i,s){this.h0=e|0,this.h1=n|0,this.h2=r|0,this.h3=i|0,this.h4=s|0}process(e,n){for(let w=0;w<16;w++,n+=4)Na[w]=e.getUint32(n,!0);let r=this.h0|0,i=r,s=this.h1|0,a=s,c=this.h2|0,l=c,h=this.h3|0,d=h,g=this.h4|0,m=g;for(let w=0;w<5;w++){const v=4-w,E=_N[w],S=DN[w],A=r0[w],I=i0[w],T=NN[w],O=CN[w];for(let k=0;k<16;k++){const _=ka(r+kb(w,s,c,h)+Na[A[k]]+E,T[k])+g|0;r=g,g=h,h=ka(c,10)|0,c=s,s=_}for(let k=0;k<16;k++){const _=ka(i+kb(v,a,l,d)+Na[I[k]]+S,O[k])+m|0;i=m,m=d,d=ka(l,10)|0,l=a,a=_}}this.set(this.h1+c+d|0,this.h2+h+m|0,this.h3+g+i|0,this.h4+r+a|0,this.h0+s+l|0)}roundClean(){Na.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const UN=Gc(()=>new FN);let e2=!1;const t2=function(t){return UN(t)};let n2=t2;function Ds(t){const e=we(t,"data");return pe(n2(e))}Ds._=t2;Ds.lock=function(){e2=!0};Ds.register=function(t){if(e2)throw new TypeError("ripemd160 is locked");n2=t};Object.freeze(Ds);let r2=!1;const i2=function(t,e,n,r,i){return yN(t,e,n,r,i)};let s2=i2;function ni(t,e,n,r,i){const s=we(t,"password"),a=we(e,"salt");return pe(s2(s,a,n,r,i))}ni._=i2;ni.lock=function(){r2=!0};ni.register=function(t){if(r2)throw new Error("pbkdf2 is locked");s2=t};Object.freeze(ni);let o2=!1;const a2=function(t){return new Uint8Array(xN(t))};let c2=a2;function xr(t){return c2(t)}xr._=a2;xr.lock=function(){o2=!0};xr.register=function(t){if(o2)throw new Error("randomBytes is locked");c2=t};Object.freeze(xr);const Ve=(t,e)=>t<<e|t>>>32-e;function Nb(t,e,n,r,i,s){let a=t[e++]^n[r++],c=t[e++]^n[r++],l=t[e++]^n[r++],h=t[e++]^n[r++],d=t[e++]^n[r++],g=t[e++]^n[r++],m=t[e++]^n[r++],w=t[e++]^n[r++],v=t[e++]^n[r++],E=t[e++]^n[r++],S=t[e++]^n[r++],A=t[e++]^n[r++],I=t[e++]^n[r++],T=t[e++]^n[r++],O=t[e++]^n[r++],k=t[e++]^n[r++],_=a,D=c,$=l,j=h,X=d,de=g,U=m,Z=w,J=v,L=E,q=S,re=A,le=I,ce=T,he=O,be=k;for(let xe=0;xe<8;xe+=2)X^=Ve(_+le|0,7),J^=Ve(X+_|0,9),le^=Ve(J+X|0,13),_^=Ve(le+J|0,18),L^=Ve(de+D|0,7),ce^=Ve(L+de|0,9),D^=Ve(ce+L|0,13),de^=Ve(D+ce|0,18),he^=Ve(q+U|0,7),$^=Ve(he+q|0,9),U^=Ve($+he|0,13),q^=Ve(U+$|0,18),j^=Ve(be+re|0,7),Z^=Ve(j+be|0,9),re^=Ve(Z+j|0,13),be^=Ve(re+Z|0,18),D^=Ve(_+j|0,7),$^=Ve(D+_|0,9),j^=Ve($+D|0,13),_^=Ve(j+$|0,18),U^=Ve(de+X|0,7),Z^=Ve(U+de|0,9),X^=Ve(Z+U|0,13),de^=Ve(X+Z|0,18),re^=Ve(q+L|0,7),J^=Ve(re+q|0,9),L^=Ve(J+re|0,13),q^=Ve(L+J|0,18),le^=Ve(be+he|0,7),ce^=Ve(le+be|0,9),he^=Ve(ce+le|0,13),be^=Ve(he+ce|0,18);i[s++]=a+_|0,i[s++]=c+D|0,i[s++]=l+$|0,i[s++]=h+j|0,i[s++]=d+X|0,i[s++]=g+de|0,i[s++]=m+U|0,i[s++]=w+Z|0,i[s++]=v+J|0,i[s++]=E+L|0,i[s++]=S+q|0,i[s++]=A+re|0,i[s++]=I+le|0,i[s++]=T+ce|0,i[s++]=O+he|0,i[s++]=k+be|0}function us(t,e,n,r,i){let s=r+0,a=r+16*i;for(let c=0;c<16;c++)n[a+c]=t[e+(2*i-1)*16+c];for(let c=0;c<i;c++,s+=16,e+=16)Nb(n,a,t,e,n,s),c>0&&(a+=16),Nb(n,s,t,e+=16,n,a)}function u2(t,e,n){const r=Dw({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:l,maxmem:h,onProgress:d}=r;if(fn(i),fn(s),fn(a),fn(c),fn(l),fn(h),d!==void 0&&typeof d!="function")throw new Error("progressCb should be function");const g=128*s,m=g/4;if(i<=1||(i&i-1)!==0||i>=2**(g/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/g)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const w=g*(i+a);if(w>h)throw new Error(`Scrypt: parameters too large, ${w} (128 * r * (N + p)) > ${h} (maxmem)`);const v=Xd(Cs,t,e,{c:1,dkLen:g*a}),E=Va(v),S=Va(new Uint8Array(g*i)),A=Va(new Uint8Array(g));let I=()=>{};if(d){const T=2*i*a,O=Math.max(Math.floor(T/1e4),1);let k=0;I=()=>{k++,d&&(!(k%O)||k===T)&&d(k/T)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:m,V:S,B32:E,B:v,tmp:A,blockMixCb:I,asyncTick:l}}function l2(t,e,n,r,i){const s=Xd(Cs,t,n,{c:1,dkLen:e});return n.fill(0),r.fill(0),i.fill(0),s}function LN(t,e,n){const{N:r,r:i,p:s,dkLen:a,blockSize32:c,V:l,B32:h,B:d,tmp:g,blockMixCb:m}=u2(t,e,n);for(let w=0;w<s;w++){const v=c*w;for(let E=0;E<c;E++)l[E]=h[v+E];for(let E=0,S=0;E<r-1;E++)us(l,S,l,S+=c,i),m();us(l,(r-1)*c,h,v,i),m();for(let E=0;E<r;E++){const S=h[v+c-16]%r;for(let A=0;A<c;A++)g[A]=h[v+A]^l[S*c+A];us(g,0,h,v,i),m()}}return l2(t,a,d,l,g)}async function MN(t,e,n){const{N:r,r:i,p:s,dkLen:a,blockSize32:c,V:l,B32:h,B:d,tmp:g,blockMixCb:m,asyncTick:w}=u2(t,e,n);for(let v=0;v<s;v++){const E=c*v;for(let A=0;A<c;A++)l[A]=h[E+A];let S=0;await Tb(r-1,w,()=>{us(l,S,l,S+=c,i),m()}),us(l,(r-1)*c,h,E,i),m(),await Tb(r,w,()=>{const A=h[E+c-16]%r;for(let I=0;I<c;I++)g[I]=h[E+I]^l[A*c+I];us(g,0,h,E,i),m()})}return l2(t,a,d,l,g)}let f2=!1,h2=!1;const d2=async function(t,e,n,r,i,s,a){return await MN(t,e,{N:n,r,p:i,dkLen:s,onProgress:a})},p2=function(t,e,n,r,i,s){return LN(t,e,{N:n,r,p:i,dkLen:s})};let g2=d2,m2=p2;async function Fs(t,e,n,r,i,s,a){const c=we(t,"passwd"),l=we(e,"salt");return pe(await g2(c,l,n,r,i,s,a))}Fs._=d2;Fs.lock=function(){h2=!0};Fs.register=function(t){if(h2)throw new Error("scrypt is locked");g2=t};Object.freeze(Fs);function Us(t,e,n,r,i,s){const a=we(t,"passwd"),c=we(e,"salt");return pe(m2(a,c,n,r,i,s))}Us._=p2;Us.lock=function(){f2=!0};Us.register=function(t){if(f2)throw new Error("scryptSync is locked");m2=t};Object.freeze(Us);const b2=function(t){return mN("sha256").update(t).digest()};let y2=b2,x2=!1;function Sn(t){const e=we(t,"data");return pe(y2(e))}Sn._=b2;Sn.lock=function(){x2=!0};Sn.register=function(t){if(x2)throw new Error("sha256 is locked");y2=t};Object.freeze(Sn);Object.freeze(Sn);BigInt(0);const $N=BigInt(1),zN=BigInt(2),jc=t=>t instanceof Uint8Array,GN=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Es(t){if(!jc(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=GN[t[n]];return e}function s0(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function To(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 n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const i=r*2,s=t.slice(i,i+2),a=Number.parseInt(s,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");n[r]=a}return n}function Bi(t){return s0(Es(t))}function o0(t){if(!jc(t))throw new Error("Uint8Array expected");return s0(Es(Uint8Array.from(t).reverse()))}function vs(t,e){return To(t.toString(16).padStart(e*2,"0"))}function a0(t,e){return vs(t,e).reverse()}function Cn(t,e,n){let r;if(typeof e=="string")try{r=To(e)}catch(s){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${s}`)}else if(jc(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(`${t} expected ${n} bytes, got ${i}`);return r}function So(...t){const e=new Uint8Array(t.reduce((r,i)=>r+i.length,0));let n=0;return t.forEach(r=>{if(!jc(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}const c0=t=>(zN<<BigInt(t-1))-$N,ch=t=>new Uint8Array(t),Cb=t=>Uint8Array.from(t);function w2(t,e,n){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 n!="function")throw new Error("hmacFn must be a function");let r=ch(t),i=ch(t),s=0;const a=()=>{r.fill(1),i.fill(0),s=0},c=(...g)=>n(i,r,...g),l=(g=ch())=>{i=c(Cb([0]),g),r=c(),g.length!==0&&(i=c(Cb([1]),g),r=c())},h=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const m=[];for(;g<e;){r=c();const w=r.slice();m.push(w),g+=r.length}return So(...m)};return(g,m)=>{a(),l(g);let w;for(;!(w=m(h()));)l();return a(),w}}const VN={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 Wo(t,e,n={}){const r=(i,s,a)=>{const c=VN[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);const l=t[i];if(!(a&&l===void 0)&&!c(l,t))throw new Error(`Invalid param ${String(i)}=${l} (${typeof l}), expected ${s}`)};for(const[i,s]of Object.entries(e))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return t}const jN=Object.freeze(Object.defineProperty({__proto__:null,bitMask:c0,bytesToHex:Es,bytesToNumberBE:Bi,bytesToNumberLE:o0,concatBytes:So,createHmacDrbg:w2,ensureBytes:Cn,hexToBytes:To,hexToNumber:s0,numberToBytesBE:vs,numberToBytesLE:a0,validateObject:Wo},Symbol.toStringTag,{value:"Module"}));const Ct=BigInt(0),Bt=BigInt(1),gi=BigInt(2),HN=BigInt(3),Wh=BigInt(4),_b=BigInt(5),Db=BigInt(8);BigInt(9);BigInt(16);function tn(t,e){const n=t%e;return n>=Ct?n:e+n}function qN(t,e,n){if(n<=Ct||e<Ct)throw new Error("Expected power/modulo > 0");if(n===Bt)return Ct;let r=Bt;for(;e>Ct;)e&Bt&&(r=r*t%n),t=t*t%n,e>>=Bt;return r}function bn(t,e,n){let r=t;for(;e-- >Ct;)r*=r,r%=n;return r}function Qh(t,e){if(t===Ct||e<=Ct)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=tn(t,e),r=e,i=Ct,s=Bt;for(;n!==Ct;){const c=r/n,l=r%n,h=i-s*c;r=n,n=l,i=s,s=h}if(r!==Bt)throw new Error("invert: does not exist");return tn(i,e)}function ZN(t){const e=(t-Bt)/gi;let n,r,i;for(n=t-Bt,r=0;n%gi===Ct;n/=gi,r++);for(i=gi;i<t&&qN(i,e,t)!==t-Bt;i++);if(r===1){const a=(t+Bt)/Wh;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 s=(n+Bt)/gi;return function(c,l){if(c.pow(l,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let h=r,d=c.pow(c.mul(c.ONE,i),n),g=c.pow(l,s),m=c.pow(l,n);for(;!c.eql(m,c.ONE);){if(c.eql(m,c.ZERO))return c.ZERO;let w=1;for(let E=c.sqr(m);w<h&&!c.eql(E,c.ONE);w++)E=c.sqr(E);const v=c.pow(d,Bt<<BigInt(h-w-1));d=c.sqr(v),g=c.mul(g,v),m=c.mul(m,d),h=w}return g}}function KN(t){if(t%Wh===HN){const e=(t+Bt)/Wh;return function(r,i){const s=r.pow(i,e);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(t%Db===_b){const e=(t-_b)/Db;return function(r,i){const s=r.mul(i,gi),a=r.pow(s,e),c=r.mul(i,a),l=r.mul(r.mul(c,gi),a),h=r.mul(c,r.sub(l,r.ONE));if(!r.eql(r.sqr(h),i))throw new Error("Cannot find square root");return h}}return ZN(t)}const JN=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function WN(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=JN.reduce((r,i)=>(r[i]="function",r),e);return Wo(t,n)}function QN(t,e,n){if(n<Ct)throw new Error("Expected power > 0");if(n===Ct)return t.ONE;if(n===Bt)return e;let r=t.ONE,i=e;for(;n>Ct;)n&Bt&&(r=t.mul(r,i)),i=t.sqr(i),n>>=Bt;return r}function YN(t,e){const n=new Array(e.length),r=e.reduce((s,a,c)=>t.is0(a)?s:(n[c]=s,t.mul(s,a)),t.ONE),i=t.inv(r);return e.reduceRight((s,a,c)=>t.is0(a)?s:(n[c]=t.mul(s,n[c]),t.mul(s,a)),i),n}function A2(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function XN(t,e,n=!1,r={}){if(t<=Ct)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=A2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=KN(t),c=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:c0(i),ZERO:Ct,ONE:Bt,create:l=>tn(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return Ct<=l&&l<t},is0:l=>l===Ct,isOdd:l=>(l&Bt)===Bt,neg:l=>tn(-l,t),eql:(l,h)=>l===h,sqr:l=>tn(l*l,t),add:(l,h)=>tn(l+h,t),sub:(l,h)=>tn(l-h,t),mul:(l,h)=>tn(l*h,t),pow:(l,h)=>QN(c,l,h),div:(l,h)=>tn(l*Qh(h,t),t),sqrN:l=>l*l,addN:(l,h)=>l+h,subN:(l,h)=>l-h,mulN:(l,h)=>l*h,inv:l=>Qh(l,t),sqrt:r.sqrt||(l=>a(c,l)),invertBatch:l=>YN(c,l),cmov:(l,h,d)=>d?h:l,toBytes:l=>n?a0(l,s):vs(l,s),fromBytes:l=>{if(l.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${l.length}`);return n?o0(l):Bi(l)}});return Object.freeze(c)}function E2(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 v2(t){const e=E2(t);return e+Math.ceil(e/2)}function eC(t,e,n=!1){const r=t.length,i=E2(e),s=v2(e);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const a=n?Bi(t):o0(t),c=tn(a,e-Bt)+Bt;return n?a0(c,i):vs(c,i)}const tC=BigInt(0),uh=BigInt(1);function nC(t,e){const n=(i,s)=>{const a=s.negate();return i?a:s},r=i=>{const s=Math.ceil(e/i)+1,a=2**(i-1);return{windows:s,windowSize:a}};return{constTimeNegate:n,unsafeLadder(i,s){let a=t.ZERO,c=i;for(;s>tC;)s&uh&&(a=a.add(c)),c=c.double(),s>>=uh;return a},precomputeWindow(i,s){const{windows:a,windowSize:c}=r(s),l=[];let h=i,d=h;for(let g=0;g<a;g++){d=h,l.push(d);for(let m=1;m<c;m++)d=d.add(h),l.push(d);h=d.double()}return l},wNAF(i,s,a){const{windows:c,windowSize:l}=r(i);let h=t.ZERO,d=t.BASE;const g=BigInt(2**i-1),m=2**i,w=BigInt(i);for(let v=0;v<c;v++){const E=v*l;let S=Number(a&g);a>>=w,S>l&&(S-=m,a+=uh);const A=E,I=E+Math.abs(S)-1,T=v%2!==0,O=S<0;S===0?d=d.add(n(T,s[A])):h=h.add(n(O,s[I]))}return{p:h,f:d}},wNAFCached(i,s,a,c){const l=i._WINDOW_SIZE||1;let h=s.get(i);return h||(h=this.precomputeWindow(i,l),l!==1&&s.set(i,c(h))),this.wNAF(l,h,a)}}}function B2(t){return WN(t.Fp),Wo(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...A2(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function rC(t){const e=B2(t);Wo(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=e;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:iC,hexToBytes:sC}=jN,wi={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=wi;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:iC(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=wi,n=typeof t=="string"?sC(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=wi._parseInt(n.subarray(2)),{d:a,l:c}=wi._parseInt(s);if(c.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,n=h=>{const d=h.toString(16);return d.length&1?`0${d}`:d},r=e(n(t.s)),i=e(n(t.r)),s=r.length/2,a=i.length/2,c=n(s),l=n(a);return`30${n(a+s+4)}02${l}${i}02${c}${r}`}},dr=BigInt(0),vn=BigInt(1);BigInt(2);const Fb=BigInt(3);BigInt(4);function oC(t){const e=rC(t),{Fp:n}=e,r=e.toBytes||((v,E,S)=>{const A=E.toAffine();return So(Uint8Array.from([4]),n.toBytes(A.x),n.toBytes(A.y))}),i=e.fromBytes||(v=>{const E=v.subarray(1),S=n.fromBytes(E.subarray(0,n.BYTES)),A=n.fromBytes(E.subarray(n.BYTES,2*n.BYTES));return{x:S,y:A}});function s(v){const{a:E,b:S}=e,A=n.sqr(v),I=n.mul(A,v);return n.add(n.add(I,n.mul(v,E)),S)}if(!n.eql(n.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function a(v){return typeof v=="bigint"&&dr<v&&v<e.n}function c(v){if(!a(v))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(v){const{allowedPrivateKeyLengths:E,nByteLength:S,wrapPrivateKey:A,n:I}=e;if(E&&typeof v!="bigint"){if(v instanceof Uint8Array&&(v=Es(v)),typeof v!="string"||!E.includes(v.length))throw new Error("Invalid key");v=v.padStart(S*2,"0")}let T;try{T=typeof v=="bigint"?v:Bi(Cn("private key",v,S))}catch{throw new Error(`private key must be ${S} bytes, hex or bigint, not ${typeof v}`)}return A&&(T=tn(T,I)),c(T),T}const h=new Map;function d(v){if(!(v instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(E,S,A){if(this.px=E,this.py=S,this.pz=A,E==null||!n.isValid(E))throw new Error("x required");if(S==null||!n.isValid(S))throw new Error("y required");if(A==null||!n.isValid(A))throw new Error("z required")}static fromAffine(E){const{x:S,y:A}=E||{};if(!E||!n.isValid(S)||!n.isValid(A))throw new Error("invalid affine point");if(E instanceof g)throw new Error("projective point not allowed");const I=T=>n.eql(T,n.ZERO);return I(S)&&I(A)?g.ZERO:new g(S,A,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){const S=n.invertBatch(E.map(A=>A.pz));return E.map((A,I)=>A.toAffine(S[I])).map(g.fromAffine)}static fromHex(E){const S=g.fromAffine(i(Cn("pointHex",E)));return S.assertValidity(),S}static fromPrivateKey(E){return g.BASE.multiply(l(E))}_setWindowSize(E){this._WINDOW_SIZE=E,h.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:E,y:S}=this.toAffine();if(!n.isValid(E)||!n.isValid(S))throw new Error("bad point: x or y not FE");const A=n.sqr(S),I=s(E);if(!n.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:E}=this.toAffine();if(n.isOdd)return!n.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){d(E);const{px:S,py:A,pz:I}=this,{px:T,py:O,pz:k}=E,_=n.eql(n.mul(S,k),n.mul(T,I)),D=n.eql(n.mul(A,k),n.mul(O,I));return _&&D}negate(){return new g(this.px,n.neg(this.py),this.pz)}double(){const{a:E,b:S}=e,A=n.mul(S,Fb),{px:I,py:T,pz:O}=this;let k=n.ZERO,_=n.ZERO,D=n.ZERO,$=n.mul(I,I),j=n.mul(T,T),X=n.mul(O,O),de=n.mul(I,T);return de=n.add(de,de),D=n.mul(I,O),D=n.add(D,D),k=n.mul(E,D),_=n.mul(A,X),_=n.add(k,_),k=n.sub(j,_),_=n.add(j,_),_=n.mul(k,_),k=n.mul(de,k),D=n.mul(A,D),X=n.mul(E,X),de=n.sub($,X),de=n.mul(E,de),de=n.add(de,D),D=n.add($,$),$=n.add(D,$),$=n.add($,X),$=n.mul($,de),_=n.add(_,$),X=n.mul(T,O),X=n.add(X,X),$=n.mul(X,de),k=n.sub(k,$),D=n.mul(X,j),D=n.add(D,D),D=n.add(D,D),new g(k,_,D)}add(E){d(E);const{px:S,py:A,pz:I}=this,{px:T,py:O,pz:k}=E;let _=n.ZERO,D=n.ZERO,$=n.ZERO;const j=e.a,X=n.mul(e.b,Fb);let de=n.mul(S,T),U=n.mul(A,O),Z=n.mul(I,k),J=n.add(S,A),L=n.add(T,O);J=n.mul(J,L),L=n.add(de,U),J=n.sub(J,L),L=n.add(S,I);let q=n.add(T,k);return L=n.mul(L,q),q=n.add(de,Z),L=n.sub(L,q),q=n.add(A,I),_=n.add(O,k),q=n.mul(q,_),_=n.add(U,Z),q=n.sub(q,_),$=n.mul(j,L),_=n.mul(X,Z),$=n.add(_,$),_=n.sub(U,$),$=n.add(U,$),D=n.mul(_,$),U=n.add(de,de),U=n.add(U,de),Z=n.mul(j,Z),L=n.mul(X,L),U=n.add(U,Z),Z=n.sub(de,Z),Z=n.mul(j,Z),L=n.add(L,Z),de=n.mul(U,L),D=n.add(D,de),de=n.mul(q,L),_=n.mul(J,_),_=n.sub(_,de),de=n.mul(J,U),$=n.mul(q,$),$=n.add($,de),new g(_,D,$)}subtract(E){return this.add(E.negate())}is0(){return this.equals(g.ZERO)}wNAF(E){return w.wNAFCached(this,h,E,S=>{const A=n.invertBatch(S.map(I=>I.pz));return S.map((I,T)=>I.toAffine(A[T])).map(g.fromAffine)})}multiplyUnsafe(E){const S=g.ZERO;if(E===dr)return S;if(c(E),E===vn)return this;const{endo:A}=e;if(!A)return w.unsafeLadder(this,E);let{k1neg:I,k1:T,k2neg:O,k2:k}=A.splitScalar(E),_=S,D=S,$=this;for(;T>dr||k>dr;)T&vn&&(_=_.add($)),k&vn&&(D=D.add($)),$=$.double(),T>>=vn,k>>=vn;return I&&(_=_.negate()),O&&(D=D.negate()),D=new g(n.mul(D.px,A.beta),D.py,D.pz),_.add(D)}multiply(E){c(E);let S=E,A,I;const{endo:T}=e;if(T){const{k1neg:O,k1:k,k2neg:_,k2:D}=T.splitScalar(S);let{p:$,f:j}=this.wNAF(k),{p:X,f:de}=this.wNAF(D);$=w.constTimeNegate(O,$),X=w.constTimeNegate(_,X),X=new g(n.mul(X.px,T.beta),X.py,X.pz),A=$.add(X),I=j.add(de)}else{const{p:O,f:k}=this.wNAF(S);A=O,I=k}return g.normalizeZ([A,I])[0]}multiplyAndAddUnsafe(E,S,A){const I=g.BASE,T=(k,_)=>_===dr||_===vn||!k.equals(I)?k.multiplyUnsafe(_):k.multiply(_),O=T(this,S).add(T(E,A));return O.is0()?void 0:O}toAffine(E){const{px:S,py:A,pz:I}=this,T=this.is0();E==null&&(E=T?n.ONE:n.inv(I));const O=n.mul(S,E),k=n.mul(A,E),_=n.mul(I,E);if(T)return{x:n.ZERO,y:n.ZERO};if(!n.eql(_,n.ONE))throw new Error("invZ was invalid");return{x:O,y:k}}isTorsionFree(){const{h:E,isTorsionFree:S}=e;if(E===vn)return!0;if(S)return S(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:E,clearCofactor:S}=e;return E===vn?this:S?S(g,this):this.multiplyUnsafe(e.h)}toRawBytes(E=!0){return this.assertValidity(),r(g,this,E)}toHex(E=!0){return Es(this.toRawBytes(E))}}g.BASE=new g(e.Gx,e.Gy,n.ONE),g.ZERO=new g(n.ZERO,n.ONE,n.ZERO);const m=e.nBitLength,w=nC(g,e.endo?Math.ceil(m/2):m);return{CURVE:e,ProjectivePoint:g,normPrivateKeyToScalar:l,weierstrassEquation:s,isWithinCurveOrder:a}}function aC(t){const e=B2(t);return Wo(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function cC(t){const e=aC(t),{Fp:n,n:r}=e,i=n.BYTES+1,s=2*n.BYTES+1;function a(L){return dr<L&&L<n.ORDER}function c(L){return tn(L,r)}function l(L){return Qh(L,r)}const{ProjectivePoint:h,normPrivateKeyToScalar:d,weierstrassEquation:g,isWithinCurveOrder:m}=oC({...e,toBytes(L,q,re){const le=q.toAffine(),ce=n.toBytes(le.x),he=So;return re?he(Uint8Array.from([q.hasEvenY()?2:3]),ce):he(Uint8Array.from([4]),ce,n.toBytes(le.y))},fromBytes(L){const q=L.length,re=L[0],le=L.subarray(1);if(q===i&&(re===2||re===3)){const ce=Bi(le);if(!a(ce))throw new Error("Point is not on curve");const he=g(ce);let be=n.sqrt(he);const xe=(be&vn)===vn;return(re&1)===1!==xe&&(be=n.neg(be)),{x:ce,y:be}}else if(q===s&&re===4){const ce=n.fromBytes(le.subarray(0,n.BYTES)),he=n.fromBytes(le.subarray(n.BYTES,2*n.BYTES));return{x:ce,y:he}}else throw new Error(`Point of length ${q} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),w=L=>Es(vs(L,e.nByteLength));function v(L){const q=r>>vn;return L>q}function E(L){return v(L)?c(-L):L}const S=(L,q,re)=>Bi(L.slice(q,re));class A{constructor(q,re,le){this.r=q,this.s=re,this.recovery=le,this.assertValidity()}static fromCompact(q){const re=e.nByteLength;return q=Cn("compactSignature",q,re*2),new A(S(q,0,re),S(q,re,2*re))}static fromDER(q){const{r:re,s:le}=wi.toSig(Cn("DER",q));return new A(re,le)}assertValidity(){if(!m(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!m(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(q){return new A(this.r,this.s,q)}recoverPublicKey(q){const{r:re,s:le,recovery:ce}=this,he=D(Cn("msgHash",q));if(ce==null||![0,1,2,3].includes(ce))throw new Error("recovery id invalid");const be=ce===2||ce===3?re+e.n:re;if(be>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const xe=(ce&1)===0?"02":"03",V=h.fromHex(xe+w(be)),K=l(be),Y=c(-he*K),M=c(le*K),z=h.BASE.multiplyAndAddUnsafe(V,Y,M);if(!z)throw new Error("point at infinify");return z.assertValidity(),z}hasHighS(){return v(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return To(this.toDERHex())}toDERHex(){return wi.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return To(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}const I={isValidPrivateKey(L){try{return d(L),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const L=v2(e.n);return eC(e.randomBytes(L),e.n)},precompute(L=8,q=h.BASE){return q._setWindowSize(L),q.multiply(BigInt(3)),q}};function T(L,q=!0){return h.fromPrivateKey(L).toRawBytes(q)}function O(L){const q=L instanceof Uint8Array,re=typeof L=="string",le=(q||re)&&L.length;return q?le===i||le===s:re?le===2*i||le===2*s:L instanceof h}function k(L,q,re=!0){if(O(L))throw new Error("first arg must be private key");if(!O(q))throw new Error("second arg must be public key");return h.fromHex(q).multiply(d(L)).toRawBytes(re)}const _=e.bits2int||function(L){const q=Bi(L),re=L.length*8-e.nBitLength;return re>0?q>>BigInt(re):q},D=e.bits2int_modN||function(L){return c(_(L))},$=c0(e.nBitLength);function j(L){if(typeof L!="bigint")throw new Error("bigint expected");if(!(dr<=L&&L<$))throw new Error(`bigint expected < 2^${e.nBitLength}`);return vs(L,e.nByteLength)}function X(L,q,re=de){if(["recovered","canonical"].some(te=>te in re))throw new Error("sign() legacy options not supported");const{hash:le,randomBytes:ce}=e;let{lowS:he,prehash:be,extraEntropy:xe}=re;he==null&&(he=!0),L=Cn("msgHash",L),be&&(L=Cn("prehashed msgHash",le(L)));const V=D(L),K=d(q),Y=[j(K),j(V)];if(xe!=null){const te=xe===!0?ce(n.BYTES):xe;Y.push(Cn("extraEntropy",te))}const M=So(...Y),z=V;function W(te){const se=_(te);if(!m(se))return;const P=l(se),N=h.BASE.multiply(se).toAffine(),ee=c(N.x);if(ee===dr)return;const ge=c(P*c(z+ee*K));if(ge===dr)return;let Pe=(N.x===ee?0:2)|Number(N.y&vn),Ee=ge;return he&&v(ge)&&(Ee=E(ge),Pe^=1),new A(ee,Ee,Pe)}return{seed:M,k2sig:W}}const de={lowS:e.lowS,prehash:!1},U={lowS:e.lowS,prehash:!1};function Z(L,q,re=de){const{seed:le,k2sig:ce}=X(L,q,re),he=e;return w2(he.hash.outputLen,he.nByteLength,he.hmac)(le,ce)}h.BASE._setWindowSize(8);function J(L,q,re,le=U){const ce=L;if(q=Cn("msgHash",q),re=Cn("publicKey",re),"strict"in le)throw new Error("options.strict was renamed to lowS");const{lowS:he,prehash:be}=le;let xe,V;try{if(typeof ce=="string"||ce instanceof Uint8Array)try{xe=A.fromDER(ce)}catch(N){if(!(N instanceof wi.Err))throw N;xe=A.fromCompact(ce)}else if(typeof ce=="object"&&typeof ce.r=="bigint"&&typeof ce.s=="bigint"){const{r:N,s:ee}=ce;xe=new A(N,ee)}else throw new Error("PARSE");V=h.fromHex(re)}catch(N){if(N.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(he&&xe.hasHighS())return!1;be&&(q=e.hash(q));const{r:K,s:Y}=xe,M=D(q),z=l(Y),W=c(M*z),te=c(K*z),se=h.BASE.multiplyAndAddUnsafe(V,W,te)?.toAffine();return se?c(se.x)===K:!1}return{CURVE:e,getPublicKey:T,getSharedSecret:k,sign:Z,verify:J,ProjectivePoint:h,Signature:A,utils:I}}function uC(t){return{hash:t,hmac:(e,...n)=>Vc(t,e,$k(...n)),randomBytes:Gk}}function lC(t,e){const n=r=>cC({...t,...uC(r)});return Object.freeze({...n(e),create:n})}const R2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ub=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),fC=BigInt(1),Yh=BigInt(2),Lb=(t,e)=>(t+e/Yh)/e;function hC(t){const e=R2,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),c=BigInt(44),l=BigInt(88),h=t*t*t%e,d=h*h*t%e,g=bn(d,n,e)*d%e,m=bn(g,n,e)*d%e,w=bn(m,Yh,e)*h%e,v=bn(w,i,e)*w%e,E=bn(v,s,e)*v%e,S=bn(E,c,e)*E%e,A=bn(S,l,e)*S%e,I=bn(A,c,e)*E%e,T=bn(I,n,e)*d%e,O=bn(T,a,e)*v%e,k=bn(O,r,e)*h%e,_=bn(k,Yh,e);if(!Xh.eql(Xh.sqr(_),t))throw new Error("Cannot find square root");return _}const Xh=XN(R2,void 0,void 0,{sqrt:hC}),Gr=lC({a:BigInt(0),b:BigInt(7),Fp:Xh,n:Ub,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Ub,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-fC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,a=BigInt("0x100000000000000000000000000000000"),c=Lb(s*t,e),l=Lb(-r*t,e);let h=tn(t-c*n-l*i,e),d=tn(-c*r-l*s,e);const g=h>a,m=d>a;if(g&&(h=e-h),m&&(d=e-d),h>a||d>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:h,k2neg:m,k2:d}}}},Cs);BigInt(0);Gr.ProjectivePoint;const pc="0x0000000000000000000000000000000000000000",Mb="0x0000000000000000000000000000000000000000000000000000000000000000",dC=`Ethereum Signed Message:
|
|
85
|
+
`,$b=BigInt(0),zb=BigInt(1),ed=BigInt(2),Gb=BigInt(27),Vb=BigInt(28),Ca=BigInt(35),T2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),pC=T2/ed,gC=Symbol.for("nodejs.util.inspect.custom"),li={};function lh(t){return Rr(bt(t),32)}class gt{#e;#t;#n;#r;get r(){return this.#e}set r(e){F(cs(e)===32,"invalid r","value",e),this.#e=pe(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(cs(e)===32,"invalid s","value",e),this.#t=pe(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=pC}get v(){return this.#n}set v(e){const n=Ne(e,"value");F(n===27||n===28,"invalid v","v",e),this.#n=n}get networkV(){return this.#r}get legacyChainId(){const e=this.networkV;return e==null?null:gt.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=we(this.s);return this.yParity&&(e[0]|=128),pe(e)}get compactSerialized(){return He([this.r,this.yParityAndS])}get serialized(){return He([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,n,r,i){Fi(e,li,"Signature"),this.#e=n,this.#t=r,this.#n=i,this.#r=null}getCanonical(){if(this.isValid())return this;const e=T2-BigInt(this._s),n=55-this.v,r=new gt(li,this.r,lh(e),n);return this.networkV&&(r.#r=this.networkV),r}clone(){const e=new gt(li,this.r,this._s,this.v);return this.networkV&&(e.#r=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}}[gC](){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 n=Ae(e,"v");return n==Gb||n==Vb?$b:(F(n>=Ca,"invalid EIP-155 v","v",e),(n-Ca)/ed)}static getChainIdV(e,n){return Ae(e)*ed+BigInt(35+n-27)}static getNormalizedV(e){const n=Ae(e);return n===$b||n===Gb?27:n===zb||n===Vb?28:(F(n>=Ca,"invalid v","v",e),n&zb?27:28)}static from(e){function n(h,d){F(h,d,"signature",e)}if(e==null)return new gt(li,Mb,Mb,27);if(typeof e=="string"){const h=we(e,"signature");if(h.length===64){const d=pe(h.slice(0,32)),g=h.slice(32,64),m=g[0]&128?28:27;return g[0]&=127,new gt(li,d,pe(g),m)}if(h.length===65){const d=pe(h.slice(0,32)),g=pe(h.slice(32,64)),m=gt.getNormalizedV(h[64]);return new gt(li,d,g,m)}n(!1,"invalid raw signature length")}if(e instanceof gt)return e.clone();const r=e.r;n(r!=null,"missing r");const i=lh(r),s=(function(h,d){if(h!=null)return lh(h);if(d!=null){n(nt(d,32),"invalid yParityAndS");const g=we(d);return g[0]&=127,pe(g)}n(!1,"missing s")})(e.s,e.yParityAndS),{networkV:a,v:c}=(function(h,d,g){if(h!=null){const m=Ae(h);return{networkV:m>=Ca?m:void 0,v:gt.getNormalizedV(m)}}if(d!=null)return n(nt(d,32),"invalid yParityAndS"),{v:we(d)[0]&128?28:27};if(g!=null){switch(Ne(g,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")})(e.v,e.yParityAndS,e.yParity),l=new gt(li,i,s,c);return a&&(l.#r=a),n(e.yParity==null||Ne(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}}class rn{#e;constructor(e){F(cs(e)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=pe(e)}get privateKey(){return this.#e}get publicKey(){return rn.computePublicKey(this.#e)}get compressedPublicKey(){return rn.computePublicKey(this.#e,!0)}sign(e){F(cs(e)===32,"invalid digest length","digest",e);const n=Gr.sign(Ut(e),Ut(this.#e),{lowS:!0});return gt.from({r:Tr(n.r,32),s:Tr(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=rn.computePublicKey(e);return pe(Gr.getSharedSecret(Ut(this.#e),we(n),!1))}static computePublicKey(e,n){let r=we(e,"key");if(r.length===32){const s=Gr.getPublicKey(r,!!n);return pe(s)}if(r.length===64){const s=new Uint8Array(65);s[0]=4,s.set(r,1),r=s}const i=Gr.ProjectivePoint.fromHex(r);return pe(i.toRawBytes(n))}static recoverPublicKey(e,n){F(cs(e)===32,"invalid digest length","digest",e);const r=gt.from(n);let i=Gr.Signature.fromCompact(Ut(He([r.r,r.s])));i=i.addRecoveryBit(r.yParity);const s=i.recoverPublicKey(Ut(e));return F(s!=null,"invalid signature for digest","signature",n),"0x"+s.toHex(!1)}static addPoints(e,n,r){const i=Gr.ProjectivePoint.fromHex(rn.computePublicKey(e).substring(2)),s=Gr.ProjectivePoint.fromHex(rn.computePublicKey(n).substring(2));return"0x"+i.add(s).toHex(!!r)}}const mC=BigInt(0),bC=BigInt(36);function jb(t){t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let i=0;i<40;i++)n[i]=e[i].charCodeAt(0);const r=we(ht(n));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const u0={};for(let t=0;t<10;t++)u0[String(t)]=String(t);for(let t=0;t<26;t++)u0[String.fromCharCode(65+t)]=String(10+t);const Hb=15;function yC(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>u0[r]).join("");for(;e.length>=Hb;){let r=e.substring(0,Hb);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const xC=(function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t})();function wC(t){t=t.toLowerCase();let e=mC;for(let n=0;n<t.length;n++)e=e*bC+xC[t[n]];return e}function $e(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=jb(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)===yC(t),"bad icap checksum","address",t);let e=wC(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return jb("0x"+e)}F(!1,"invalid address","address",t)}function AC(t){const e=$e(t.from);let r=Ae(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,$e(ut(ht(Xn([e,r])),12))}function S2(t){return t&&typeof t.getAddress=="function"}async function fh(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(fe(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),F(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),$e(n)}function _t(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?$e(t):(fe(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),fh(t,e.resolveName(t)));if(S2(t))return fh(t,t.getAddress());if(t&&typeof t.then=="function")return fh(t,t);F(!1,"unsupported addressable value","target",t)}const lr={};function Be(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new wt(lr,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function je(t,e){return new wt(lr,`bytes${e||""}`,t,{size:e})}const qb=Symbol.for("_ethers_typed");class wt{type;value;#e;_typedSymbol;constructor(e,n,r,i){i==null&&(i=null),Fi(lr,e,"Typed"),Oe(this,{_typedSymbol:qb,type:n,value:r}),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,n){return new wt(lr,e,n)}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 je(e,1)}static bytes2(e){return je(e,2)}static bytes3(e){return je(e,3)}static bytes4(e){return je(e,4)}static bytes5(e){return je(e,5)}static bytes6(e){return je(e,6)}static bytes7(e){return je(e,7)}static bytes8(e){return je(e,8)}static bytes9(e){return je(e,9)}static bytes10(e){return je(e,10)}static bytes11(e){return je(e,11)}static bytes12(e){return je(e,12)}static bytes13(e){return je(e,13)}static bytes14(e){return je(e,14)}static bytes15(e){return je(e,15)}static bytes16(e){return je(e,16)}static bytes17(e){return je(e,17)}static bytes18(e){return je(e,18)}static bytes19(e){return je(e,19)}static bytes20(e){return je(e,20)}static bytes21(e){return je(e,21)}static bytes22(e){return je(e,22)}static bytes23(e){return je(e,23)}static bytes24(e){return je(e,24)}static bytes25(e){return je(e,25)}static bytes26(e){return je(e,26)}static bytes27(e){return je(e,27)}static bytes28(e){return je(e,28)}static bytes29(e){return je(e,29)}static bytes30(e){return je(e,30)}static bytes31(e){return je(e,31)}static bytes32(e){return je(e,32)}static address(e){return new wt(lr,"address",e)}static bool(e){return new wt(lr,"bool",!!e)}static bytes(e){return new wt(lr,"bytes",e)}static string(e){return new wt(lr,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new wt(lr,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===qb}static dereference(e,n){if(wt.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}}class EC extends Or{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=wt.dereference(n,"string");try{r=$e(r)}catch(i){return this._throwError(i.message,n)}return e.writeValue(r)}decode(e){return $e(Tr(e.readValue(),20))}}class vC extends Or{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,n){return this.coder.encode(e,n)}decode(e){return this.coder.decode(e)}}function I2(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let l={};r=e.map(h=>{const d=h.localName;return fe(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:h},value:n}),fe(!l[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:h},value:n}),l[d]=!0,n[d]})}else F(!1,"invalid tuple value","tuple",n);F(e.length===r.length,"types/value length mismatch","tuple",n);let i=new Kh,s=new Kh,a=[];e.forEach((l,h)=>{let d=r[h];if(l.dynamic){let g=s.length;l.encode(s,d);let m=i.writeUpdatableValue();a.push(w=>{m(w+g)})}else l.encode(i,d)}),a.forEach(l=>{l(i.length)});let c=t.appendWriter(i);return c+=t.appendWriter(s),c}function O2(t,e){let n=[],r=[],i=t.subReader(0);return e.forEach(s=>{let a=null;if(s.dynamic){let c=t.readIndex(),l=i.subReader(c);try{a=s.decode(l)}catch(h){if(Nt(h,"BUFFER_OVERRUN"))throw h;a=h,a.baseType=s.name,a.name=s.localName,a.type=s.type}}else try{a=s.decode(t)}catch(c){if(Nt(c,"BUFFER_OVERRUN"))throw c;a=c,a.baseType=s.name,a.name=s.localName,a.type=s.type}if(a==null)throw new Error("investigate");n.push(a),r.push(s.localName||null)}),br.fromItems(n,r)}class BC extends Or{coder;length;constructor(e,n,r){const i=e.type+"["+(n>=0?n:"")+"]",s=n===-1||e.dynamic;super("array",i,r,s),Oe(this,{coder:e,length:n})}defaultValue(){const e=this.coder.defaultValue(),n=[];for(let r=0;r<this.length;r++)n.push(e);return n}encode(e,n){const r=wt.dereference(n,"array");Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),bw(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let a=0;a<r.length;a++)s.push(this.coder);return I2(e,s,r)}decode(e){let n=this.length;n===-1&&(n=e.readIndex(),fe(n*Wt<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:n*Wt,length:e.dataLength}));let r=[];for(let i=0;i<n;i++)r.push(new vC(this.coder));return O2(e,r)}}class RC extends Or{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=wt.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class P2 extends Or{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Ut(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class TC extends P2{constructor(e){super("bytes",e)}decode(e){return pe(super.decode(e))}}class SC extends Or{size;constructor(e,n){let r="bytes"+String(e);super(r,r,n,!1),Oe(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,n){let r=Ut(wt.dereference(n,this.type));return r.length!==this.size&&this._throwError("incorrect data length",n),e.writeBytes(r)}decode(e){return pe(e.readBytes(this.size))}}const IC=new Uint8Array([]);class OC extends Or{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(IC)}decode(e){return e.readBytes(0),null}}const PC=BigInt(0),kC=BigInt(1),NC=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class CC extends Or{size;signed;constructor(e,n,r){const i=(n?"int":"uint")+e*8;super(i,i,r,!1),Oe(this,{size:e,signed:n},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,n){let r=Ae(wt.dereference(n,this.type)),i=uo(NC,Wt*8);if(this.signed){let s=uo(i,this.size*8-1);(r>s||r<-(s+kC))&&this._throwError("value out-of-bounds",n),r=Aw(r,8*Wt)}else(r<PC||r>uo(i,this.size*8))&&this._throwError("value out-of-bounds",n);return e.writeValue(r)}decode(e){let n=uo(e.readValue(),this.size*8);return this.signed&&(n=gk(n,this.size*8)),n}}class _C extends P2{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,Xt(wt.dereference(n,"string")))}decode(e){return dc(super.decode(e))}}class _a extends Or{coders;constructor(e,n){let r=!1;const i=[];e.forEach(a=>{a.dynamic&&(r=!0),i.push(a.type)});const s="tuple("+i.join(",")+")";super("tuple",s,n,r),Oe(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const n=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||n[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,n){const r=wt.dereference(n,"tuple");return I2(e,this.coders,r)}decode(e){return O2(e,this.coders)}}function hh(t,e){return{address:$e(t),storageKeys:e.map((n,r)=>(F(nt(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function Ui(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?(F(n.length===2,"invalid slot set",`value[${r}]`,n),hh(n[0],n[1])):(F(n!=null&&typeof n=="object","invalid address-slot set","value",t),hh(n.address,n.storageKeys)));F(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((i,s)=>(i[s]=!0,i),{});return hh(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function k2(t){return{address:$e(t.address),nonce:Ae(t.nonce!=null?t.nonce:0),chainId:Ae(t.chainId!=null?t.chainId:0),signature:gt.from(t.signature)}}function Qo(t){let e;return typeof t=="string"?e=rn.computePublicKey(t,!1):e=t.publicKey,$e(ht("0x"+e.substring(4)).substring(26))}function DC(t,e){return Qo(rn.recoverPublicKey(t,e))}const Pt=BigInt(0),FC=BigInt(2),UC=BigInt(27),LC=BigInt(28),MC=BigInt(35),$C=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),zC=Symbol.for("nodejs.util.inspect.custom"),dh=4096*32,Ha=128;function GC(t){return{blobToKzgCommitment:r=>{if("computeBlobProof"in t){if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return we(t.blobToKzgCommitment(pe(r)))}else if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return we(t.blobToKzgCommitment(r));if("blobToKZGCommitment"in t&&typeof t.blobToKZGCommitment=="function")return we(t.blobToKZGCommitment(pe(r)));F(!1,"unsupported KZG library","kzg",t)},computeBlobKzgProof:(r,i)=>{if("computeBlobProof"in t&&typeof t.computeBlobProof=="function")return we(t.computeBlobProof(pe(r),pe(i)));if("computeBlobKzgProof"in t&&typeof t.computeBlobKzgProof=="function")return t.computeBlobKzgProof(r,i);if("computeBlobKZGProof"in t&&typeof t.computeBlobKZGProof=="function")return we(t.computeBlobKZGProof(pe(r),pe(i)));F(!1,"unsupported KZG library","kzg",t)}}}function Zb(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=Sn(e).substring(4),"0x"+n}function Ls(t){return t==="0x"?null:$e(t)}function Hc(t,e){try{return Ui(t)}catch(n){F(!1,n.message,e,t)}}function VC(t,e){try{if(!Array.isArray(t))throw new Error("authorizationList: invalid array");const n=[];for(let r=0;r<t.length;r++){const i=t[r];if(!Array.isArray(i))throw new Error(`authorization[${r}]: invalid array`);if(i.length!==6)throw new Error(`authorization[${r}]: wrong length`);if(!i[1])throw new Error(`authorization[${r}]: null address`);n.push({address:Ls(i[1]),nonce:Ye(i[2],"nonce"),chainId:Ye(i[0],"chainId"),signature:gt.from({yParity:Li(i[3],"yParity"),r:Rr(i[4],32),s:Rr(i[5],32)})})}return n}catch(n){F(!1,n.message,e,t)}}function Li(t,e){return t==="0x"?0:Ne(t,e)}function Ye(t,e){if(t==="0x")return Pt;const n=Ae(t,e);return F(n<=$C,"value exceeds uint size",e,n),n}function ze(t,e){const n=Ae(t,"value"),r=bt(n);return F(r.length<=32,"value too large",`tx.${e}`,n),r}function qc(t){return Ui(t).map(e=>[e.address,e.storageKeys])}function jC(t){return t.map(e=>[ze(e.chainId,"chainId"),e.address,ze(e.nonce,"nonce"),ze(e.signature.yParity,"yParity"),bt(e.signature.r),bt(e.signature._s)])}function HC(t,e){F(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)F(nt(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function qC(t){const e=Jo(t);F(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:Li(e[0],"nonce"),gasPrice:Ye(e[1],"gasPrice"),gasLimit:Ye(e[2],"gasLimit"),to:Ls(e[3]),value:Ye(e[4],"value"),data:pe(e[5]),chainId:Pt};if(e.length===6)return n;const r=Ye(e[6],"v"),i=Ye(e[7],"r"),s=Ye(e[8],"s");if(i===Pt&&s===Pt)n.chainId=r;else{let a=(r-MC)/FC;a<Pt&&(a=Pt),n.chainId=a,F(a!==Pt||r===UC||r===LC,"non-canonical legacy v","v",e[6]),n.signature=gt.from({r:Rr(e[7],32),s:Rr(e[8],32),v:r})}return n}function ZC(t,e){const n=[ze(t.nonce,"nonce"),ze(t.gasPrice||0,"gasPrice"),ze(t.gasLimit,"gasLimit"),t.to||"0x",ze(t.value,"value"),t.data];let r=Pt;if(t.chainId!=Pt)r=Ae(t.chainId,"tx.chainId"),F(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const s=t.signature.legacyChainId;s!=null&&(r=s)}if(!e)return r!==Pt&&(n.push(bt(r)),n.push("0x"),n.push("0x")),Xn(n);let i=BigInt(27+e.yParity);return r!==Pt?i=gt.getChainIdV(r,e.v):BigInt(e.v)!==i&&F(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(bt(i)),n.push(bt(e.r)),n.push(bt(e._s)),Xn(n)}function Zc(t,e){let n;try{if(n=Li(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{F(!1,"invalid yParity","yParity",e[0])}const r=Rr(e[1],32),i=Rr(e[2],32),s=gt.from({r,s:i,yParity:n});t.signature=s}function KC(t){const e=Jo(we(t).slice(1));F(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",pe(t));const n={type:2,chainId:Ye(e[0],"chainId"),nonce:Li(e[1],"nonce"),maxPriorityFeePerGas:Ye(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Ye(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Ye(e[4],"gasLimit"),to:Ls(e[5]),value:Ye(e[6],"value"),data:pe(e[7]),accessList:Hc(e[8],"accessList")};return e.length===9||Zc(n,e.slice(9)),n}function JC(t,e){const n=[ze(t.chainId,"chainId"),ze(t.nonce,"nonce"),ze(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ze(t.maxFeePerGas||0,"maxFeePerGas"),ze(t.gasLimit,"gasLimit"),t.to||"0x",ze(t.value,"value"),t.data,qc(t.accessList||[])];return e&&(n.push(ze(e.yParity,"yParity")),n.push(bt(e.r)),n.push(bt(e.s))),He(["0x02",Xn(n)])}function WC(t){const e=Jo(we(t).slice(1));F(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",pe(t));const n={type:1,chainId:Ye(e[0],"chainId"),nonce:Li(e[1],"nonce"),gasPrice:Ye(e[2],"gasPrice"),gasLimit:Ye(e[3],"gasLimit"),to:Ls(e[4]),value:Ye(e[5],"value"),data:pe(e[6]),accessList:Hc(e[7],"accessList")};return e.length===8||Zc(n,e.slice(8)),n}function QC(t,e){const n=[ze(t.chainId,"chainId"),ze(t.nonce,"nonce"),ze(t.gasPrice||0,"gasPrice"),ze(t.gasLimit,"gasLimit"),t.to||"0x",ze(t.value,"value"),t.data,qc(t.accessList||[])];return e&&(n.push(ze(e.yParity,"recoveryParam")),n.push(bt(e.r)),n.push(bt(e.s))),He(["0x01",Xn(n)])}function YC(t){let e=Jo(we(t).slice(1)),n="3",r=null,i=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const a=e[1],c=e[2],l=e[3];F(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),F(Array.isArray(c),"invalid network format: commitments not an array","fields[2]",c),F(Array.isArray(l),"invalid network format: proofs not an array","fields[3]",l),F(a.length===c.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:c[h],proof:l[h]});e=e[0]}else if(e.length===5&&Array.isArray(e[0])){n="3 (EIP-7594 network format)",r=Ne(e[1]);const a=e[2],c=e[3],l=e[4];F(r===1,`unsupported EIP-7594 network format version: ${r}`,"fields[1]",r),F(Array.isArray(a),"invalid EIP-7594 network format: blobs not an array","fields[2]",a),F(Array.isArray(c),"invalid EIP-7594 network format: commitments not an array","fields[3]",c),F(Array.isArray(l),"invalid EIP-7594 network format: proofs not an array","fields[4]",l),F(a.length===c.length,"invalid network format: blobs/commitments length mismatch","fields",e),F(a.length*Ha===l.length,"invalid network format: blobs/proofs length mismatch","fields",e),i=[];for(let h=0;h<a.length;h++){const d=[];for(let g=0;g<Ha;g++)d.push(l[h*Ha+g]);i.push({data:a[h],commitment:c[h],proof:He(d)})}e=e[0]}F(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",pe(t));const s={type:3,chainId:Ye(e[0],"chainId"),nonce:Li(e[1],"nonce"),maxPriorityFeePerGas:Ye(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Ye(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Ye(e[4],"gasLimit"),to:Ls(e[5]),value:Ye(e[6],"value"),data:pe(e[7]),accessList:Hc(e[8],"accessList"),maxFeePerBlobGas:Ye(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10],blobWrapperVersion:r};i&&(s.blobs=i),F(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),F(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let a=0;a<s.blobVersionedHashes.length;a++)F(nt(s.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",t);return e.length===11||Zc(s,e.slice(11)),s}function XC(t,e,n){const r=[ze(t.chainId,"chainId"),ze(t.nonce,"nonce"),ze(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ze(t.maxFeePerGas||0,"maxFeePerGas"),ze(t.gasLimit,"gasLimit"),t.to||pc,ze(t.value,"value"),t.data,qc(t.accessList||[]),ze(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),HC(t.blobVersionedHashes||[],"blobVersionedHashes")];if(e&&(r.push(ze(e.yParity,"yParity")),r.push(bt(e.r)),r.push(bt(e.s)),n)){if(t.blobWrapperVersion!=null){const i=bt(t.blobWrapperVersion),s=[];for(const{proof:a}of n){const c=we(a),l=c.length/Ha;for(let h=0;h<c.length;h+=l)s.push(c.subarray(h,h+l))}return He(["0x03",Xn([r,i,n.map(a=>a.data),n.map(a=>a.commitment),s])])}return He(["0x03",Xn([r,n.map(i=>i.data),n.map(i=>i.commitment),n.map(i=>i.proof)])])}return He(["0x03",Xn(r)])}function e_(t){const e=Jo(we(t).slice(1));F(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",pe(t));const n={type:4,chainId:Ye(e[0],"chainId"),nonce:Li(e[1],"nonce"),maxPriorityFeePerGas:Ye(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Ye(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Ye(e[4],"gasLimit"),to:Ls(e[5]),value:Ye(e[6],"value"),data:pe(e[7]),accessList:Hc(e[8],"accessList"),authorizationList:VC(e[9],"authorizationList")};return e.length===10||Zc(n,e.slice(10)),n}function t_(t,e){const n=[ze(t.chainId,"chainId"),ze(t.nonce,"nonce"),ze(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ze(t.maxFeePerGas||0,"maxFeePerGas"),ze(t.gasLimit,"gasLimit"),t.to||"0x",ze(t.value,"value"),t.data,qc(t.accessList||[]),jC(t.authorizationList||[])];return e&&(n.push(ze(e.yParity,"yParity")),n.push(bt(e.r)),n.push(bt(e.s))),He(["0x04",Xn(n)])}class Bn{#e;#t;#n;#r;#i;#o;#s;#a;#d;#u;#g;#p;#h;#l;#f;#c;#b;#y;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?pc:e}set to(e){this.#t=e==null?null:$e(e)}get nonce(){return this.#r}set nonce(e){this.#r=Ne(e,"value")}get gasLimit(){return this.#i}set gasLimit(e){this.#i=Ae(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:Ae(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:Ae(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:Ae(e,"maxFeePerGas")}get data(){return this.#n}set data(e){this.#n=pe(e)}get value(){return this.#d}set value(e){this.#d=Ae(e,"value")}get chainId(){return this.#u}set chainId(e){this.#u=Ae(e)}get signature(){return this.#g||null}set signature(e){this.#g=e==null?null:gt.from(e)}isValid(){const e=this.signature;if(e&&!e.isValid())return!1;const n=this.authorizationList;if(n){for(const r of n)if(!r.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.#b||null;return e==null&&this.type===4?[]:e}set authorizationList(e){this.#b=e==null?null:e.map(n=>k2(n))}get maxFeePerBlobGas(){const e=this.#h;return e==null&&this.type===3?Pt:e}set maxFeePerBlobGas(e){this.#h=e==null?null:Ae(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 n=0;n<e.length;n++)F(nt(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}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 n=[],r=[];for(let i=0;i<e.length;i++){const s=e[i];if(Mc(s)){fe(this.#f,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let a=we(s);if(F(a.length<=dh,"blob is too large",`blobs[${i}]`,s),a.length!==dh){const h=new Uint8Array(dh);h.set(a),a=h}const c=this.#f.blobToKzgCommitment(a),l=pe(this.#f.computeBlobKzgProof(a,c));n.push({data:pe(a),commitment:pe(c),proof:l}),r.push(Zb(1,c))}else{const a=pe(s.data),c=pe(s.commitment),l=pe(s.proof);n.push({data:a,commitment:c,proof:l}),r.push(Zb(1,c))}}this.#c=n,this.#l=r}get kzg(){return this.#f}set kzg(e){e==null?this.#f=null:this.#f=GC(e)}get blobWrapperVersion(){return this.#y}set blobWrapperVersion(e){this.#y=e}constructor(){this.#e=null,this.#t=null,this.#r=0,this.#i=Pt,this.#o=null,this.#s=null,this.#a=null,this.#n="0x",this.#d=Pt,this.#u=Pt,this.#g=null,this.#p=null,this.#h=null,this.#l=null,this.#f=null,this.#c=null,this.#b=null,this.#y=null}get hash(){return this.signature==null?null:ht(this.#m(!0,!1))}get unsignedHash(){return ht(this.unsignedSerialized)}get from(){return this.signature==null?null:DC(this.unsignedHash,this.signature.getCanonical())}get fromPublicKey(){return this.signature==null?null:rn.recoverPublicKey(this.unsignedHash,this.signature.getCanonical())}isSigned(){return this.signature!=null}#m(e,n){fe(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return ZC(this,r);case 1:return QC(this,r);case 2:return JC(this,r);case 3:return XC(this,r,n?this.blobs:null);case 4:return t_(this,r)}fe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#m(!0,!0)}get unsignedSerialized(){return this.#m(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,i=this.#h!=null||this.#l;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&fe(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),fe(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),fe(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):this.authorizationList&&this.authorizationList.length?s.push(4):n?s.push(2):e?(s.push(1),r||s.push(0)):r?(s.push(1),s.push(2)):(i&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Bn.from(this)}toJSON(){const e=n=>n==null?null:n.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}}[zC](){return this.toString()}toString(){const e=[],n=i=>{let s=this[i];typeof s=="string"&&(s=JSON.stringify(s)),e.push(`${i}: ${s}`)};this.type&&n("type"),n("to"),n("data"),n("nonce"),n("gasLimit"),n("value"),this.chainId!=null&&n("chainId"),this.signature&&(n("from"),e.push(`signature: ${this.signature.toString()}`));const r=this.authorizationList;if(r){const i=[];for(const s of r){const a=[];a.push(`address: ${JSON.stringify(s.address)}`),s.nonce!=null&&a.push(`nonce: ${s.nonce}`),s.chainId!=null&&a.push(`chainId: ${s.chainId}`),s.signature&&a.push(`signature: ${s.signature.toString()}`),i.push(`Authorization { ${a.join(", ")} }`)}e.push(`authorizations: [ ${i.join(", ")} ]`)}return`Transaction { ${e.join(", ")} }`}static from(e){if(e==null)return new Bn;if(typeof e=="string"){const r=we(e);if(r[0]>=127)return Bn.from(qC(r));switch(r[0]){case 1:return Bn.from(WC(r));case 2:return Bn.from(KC(r));case 3:return Bn.from(YC(r));case 4:return Bn.from(e_(r))}fe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new Bn;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=gt.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.authorizationList!=null&&(n.authorizationList=e.authorizationList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobWrapperVersion!=null&&(n.blobWrapperVersion=e.blobWrapperVersion),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&(F(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),F(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(F(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),F(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}}function n_(t){return F(typeof t.address=="string","invalid address for hashAuthorization","auth.address",t),ht(He(["0x05",Xn([t.chainId!=null?bt(t.chainId):"0x",$e(t.address),t.nonce!=null?bt(t.nonce):"0x"])]))}function Sr(t){return ht(Xt(t))}var r_="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 Kb=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Jb=4;function i_(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,s=[0,1];for(let k=1;k<r;k++)s.push(i+=n());let a=n(),c=e;e+=a;let l=0,h=0;function d(){return l==0&&(h=h<<8|t[e++],l=8),h>>--l&1}const g=31,m=2**g,w=m>>>1,v=w>>1,E=m-1;let S=0;for(let k=0;k<g;k++)S=S<<1|d();let A=[],I=0,T=m;for(;;){let k=Math.floor(((S-I+1)*i-1)/T),_=0,D=r;for(;D-_>1;){let X=_+D>>>1;k<s[X]?D=X:_=X}if(_==0)break;A.push(_);let $=I+Math.floor(T*s[_]/i),j=I+Math.floor(T*s[_+1]/i)-1;for(;(($^j)&w)==0;)S=S<<1&E|d(),$=$<<1&E,j=j<<1&E|1;for(;$&~j&v;)S=S&w|S<<1&E>>>1|d(),$=$<<1^w,j=(j^w)<<1|w|1;I=$,T=1+j-$}let O=r-4;return A.map(k=>{switch(k-O){case 3:return O+65792+(t[c++]<<16|t[c++]<<8|t[c++]);case 2:return O+256+(t[c++]<<8|t[c++]);case 1:return O+t[c++];default:return k-1}})}function s_(t){let e=0;return()=>t[e++]}function N2(t){return s_(i_(o_(t)))}function o_(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let n=t.length,r=new Uint8Array(6*n>>3);for(let i=0,s=0,a=0,c=0;i<n;i++)c=c<<6|e[t.charCodeAt(i)],a+=6,a>=8&&(r[s++]=c>>(a-=8));return r}function a_(t){return t&1?~t>>1:t>>1}function c_(t,e){let n=Array(t);for(let r=0,i=0;r<t;r++)n[r]=i+=a_(e());return n}function Io(t,e=0){let n=[];for(;;){let r=t(),i=t();if(!i)break;e+=r;for(let s=0;s<i;s++)n.push(e+s);e+=i+1}return n}function C2(t){return Oo(()=>{let e=Io(t);if(e.length)return e})}function _2(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(u_(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(l_(n,t))}return e.flat()}function Oo(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function D2(t,e,n){let r=Array(t).fill().map(()=>[]);for(let i=0;i<e;i++)c_(t,n).forEach((s,a)=>r[a].push(s));return r}function u_(t,e){let n=1+e(),r=e(),i=Oo(e);return D2(i.length,1+t,e).flatMap((a,c)=>{let[l,...h]=a;return Array(i[c]).fill().map((d,g)=>{let m=g*r;return[l+g*n,h.map(w=>w+m)]})})}function l_(t,e){let n=1+e();return D2(n,1+t,e).map(i=>[i[0],i.slice(1)])}function f_(t){let e=[],n=Io(t);return i(r([]),[]),e;function r(s){let a=t(),c=Oo(()=>{let l=Io(t).map(h=>n[h]);if(l.length)return r(l)});return{S:a,B:c,Q:s}}function i({S:s,B:a},c,l){if(!(s&4&&l===c[c.length-1])){s&2&&(l=c[c.length-1]),s&1&&e.push(c);for(let h of a)for(let d of h.Q)i(h,[...c,d],l)}}}function h_(t){return t.toString(16).toUpperCase().padStart(2,"0")}function F2(t){return`{${h_(t)}}`}function d_(t){let e=[];for(let n=0,r=t.length;n<r;){let i=t.codePointAt(n);n+=i<65536?1:2,e.push(i)}return e}function Bs(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let i=0;i<n;)r.push(String.fromCodePoint(...t.slice(i,i+=4096)));return r.join("")}function p_(t,e){let n=t.length,r=n-e.length;for(let i=0;r==0&&i<n;i++)r=t[i]-e[i];return r}var g_="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 Po=44032,gc=4352,mc=4449,bc=4519,U2=19,L2=21,Rs=28,yc=L2*Rs,m_=U2*yc,b_=Po+m_,y_=gc+U2,x_=mc+L2,w_=bc+Rs;function lo(t){return t>>24&255}function M2(t){return t&16777215}let td,Wb,nd,qa;function A_(){let t=N2(g_);td=new Map(C2(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),Wb=new Set(Io(t)),nd=new Map,qa=new Map;for(let[e,n]of _2(t)){if(!Wb.has(e)&&n.length==2){let[r,i]=n,s=qa.get(r);s||(s=new Map,qa.set(r,s)),s.set(i,e)}nd.set(e,n.reverse())}}function $2(t){return t>=Po&&t<b_}function E_(t,e){if(t>=gc&&t<y_&&e>=mc&&e<x_)return Po+(t-gc)*yc+(e-mc)*Rs;if($2(t)&&e>bc&&e<w_&&(t-Po)%Rs==0)return t+(e-bc);{let n=qa.get(t);return n&&(n=n.get(e),n)?n:-1}}function z2(t){td||A_();let e=[],n=[],r=!1;function i(s){let a=td.get(s);a&&(r=!0,s|=a),e.push(s)}for(let s of t)for(;;){if(s<128)e.push(s);else if($2(s)){let a=s-Po,c=a/yc|0,l=a%yc/Rs|0,h=a%Rs;i(gc+c),i(mc+l),h>0&&i(bc+h)}else{let a=nd.get(s);a?n.push(...a):i(s)}if(!n.length)break;s=n.pop()}if(r&&e.length>1){let s=lo(e[0]);for(let a=1;a<e.length;a++){let c=lo(e[a]);if(c==0||s<=c){s=c;continue}let l=a-1;for(;;){let h=e[l+1];if(e[l+1]=e[l],e[l]=h,!l||(s=lo(e[--l]),s<=c))break}s=lo(e[a])}}return e}function v_(t){let e=[],n=[],r=-1,i=0;for(let s of t){let a=lo(s),c=M2(s);if(r==-1)a==0?r=c:e.push(c);else if(i>0&&i>=a)a==0?(e.push(r,...n),n.length=0,r=c):n.push(c),i=a;else{let l=E_(r,c);l>=0?r=l:i==0&&a==0?(e.push(r),r=c):(n.push(c),i=a)}}return r>=0&&e.push(r,...n),e}function G2(t){return z2(t).map(M2)}function B_(t){return v_(z2(t))}const Qb=45,V2=".",j2=65039,H2=1,xc=t=>Array.from(t);function ko(t,e){return t.P.has(e)||t.Q.has(e)}class R_ extends Array{get is_emoji(){return!0}}let rd,q2,Ai,id,Z2,ls,ph,Yi,hi,Yb,sd;function l0(){if(rd)return;let t=N2(r_);const e=()=>Io(t),n=()=>new Set(e()),r=(d,g)=>g.forEach(m=>d.add(m));rd=new Map(_2(t)),q2=n(),Ai=e(),id=new Set(e().map(d=>Ai[d])),Ai=new Set(Ai),Z2=n(),n();let i=C2(t),s=t();const a=()=>{let d=new Set;return e().forEach(g=>r(d,i[g])),r(d,e()),d};ls=Oo(d=>{let g=Oo(t).map(m=>m+96);if(g.length){let m=d>=s;g[0]-=32,g=Bs(g),m&&(g=`Restricted[${g}]`);let w=a(),v=a(),E=!t();return{N:g,P:w,Q:v,M:E,R:m}}}),ph=n(),Yi=new Map;let c=e().concat(xc(ph)).sort((d,g)=>d-g);c.forEach((d,g)=>{let m=t(),w=c[g]=m?c[g-m]:{V:[],M:new Map};w.V.push(d),ph.has(d)||Yi.set(d,w)});for(let{V:d,M:g}of new Set(Yi.values())){let m=[];for(let v of d){let E=ls.filter(A=>ko(A,v)),S=m.find(({G:A})=>E.some(I=>A.has(I)));S||(S={G:new Set,V:[]},m.push(S)),S.V.push(v),r(S.G,E)}let w=m.flatMap(v=>xc(v.G));for(let{G:v,V:E}of m){let S=new Set(w.filter(A=>!v.has(A)));for(let A of E)g.set(A,S)}}hi=new Set;let l=new Set;const h=d=>hi.has(d)?l.add(d):hi.add(d);for(let d of ls){for(let g of d.P)h(g);for(let g of d.Q)h(g)}for(let d of hi)!Yi.has(d)&&!l.has(d)&&Yi.set(d,H2);r(hi,G2(hi)),Yb=f_(t).map(d=>R_.from(d)).sort(p_),sd=new Map;for(let d of Yb){let g=[sd];for(let m of d){let w=g.map(v=>{let E=v.get(m);return E||(E=new Map,v.set(m,E)),E});m===j2?g.push(...w):g=w}for(let m of g)m.V=d}}function f0(t){return(K2(t)?"":`${h0(Kc([t]))} `)+F2(t)}function h0(t){return`"${t}"`}function T_(t){if(t.length>=4&&t[2]==Qb&&t[3]==Qb)throw new Error(`invalid label extension: "${Bs(t.slice(0,4))}"`)}function S_(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function I_(t){let e=t[0],n=Kb.get(e);if(n)throw yo(`leading ${n}`);let r=t.length,i=-1;for(let s=1;s<r;s++){e=t[s];let a=Kb.get(e);if(a){if(i==s)throw yo(`${n} + ${a}`);i=s+1,n=a}}if(i==r)throw yo(`trailing ${n}`)}function Kc(t,e=1/0,n=F2){let r=[];O_(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,s=t.length;for(let a=0;a<s;a++){let c=t[a];K2(c)&&(r.push(Bs(t.slice(i,a))),r.push(n(c)),i=a+1)}return r.push(Bs(t.slice(i,s))),r.join("")}function O_(t,e){return l0(),Ai.has(t)}function K2(t){return l0(),Z2.has(t)}function P_(t){return __(k_(t,B_,U_))}function k_(t,e,n){if(!t)return[];l0();let r=0;return t.split(V2).map(i=>{let s=d_(i),a={input:s,offset:r};r+=s.length+1;try{let c=a.tokens=F_(s,e,n),l=c.length,h;if(!l)throw new Error("empty label");let d=a.output=c.flat();if(S_(d),!(a.emoji=l>1||c[0].is_emoji)&&d.every(m=>m<128))T_(d),h="ASCII";else{let m=c.flatMap(w=>w.is_emoji?[]:w);if(!m.length)h="Emoji";else{if(Ai.has(d[0]))throw yo("leading combining mark");for(let E=1;E<l;E++){let S=c[E];if(!S.is_emoji&&Ai.has(S[0]))throw yo(`emoji + combining mark: "${Bs(c[E-1])} + ${Kc([S[0]])}"`)}I_(d);let w=xc(new Set(m)),[v]=C_(w);D_(v,m),N_(v,w),h=v.N}}a.type=h}catch(c){a.error=c}return a})}function N_(t,e){let n,r=[];for(let i of e){let s=Yi.get(i);if(s===H2)return;if(s){let a=s.M.get(i);if(n=n?n.filter(c=>a.has(c)):xc(a),!n.length)return}else r.push(i)}if(n){for(let i of n)if(r.every(s=>ko(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function C_(t){let e=ls;for(let n of t){let r=e.filter(i=>ko(i,n));if(!r.length)throw ls.some(i=>ko(i,n))?W2(e[0],n):J2(n);if(e=r,r.length==1)break}return e}function __(t){return t.map(({input:e,error:n,output:r})=>{if(n){let i=n.message;throw new Error(t.length==1?i:`Invalid label ${h0(Kc(e,63))}: ${i}`)}return Bs(r)}).join(V2)}function J2(t){return new Error(`disallowed character: ${f0(t)}`)}function W2(t,e){let n=f0(e),r=ls.find(i=>i.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function yo(t){return new Error(`illegal placement: ${t}`)}function D_(t,e){for(let n of e)if(!ko(t,n))throw W2(t,n);if(t.M){let n=G2(e);for(let r=1,i=n.length;r<i;r++)if(id.has(n[r])){let s=r+1;for(let a;s<i&&id.has(a=n[s]);s++)for(let c=r;c<s;c++)if(n[c]==a)throw new Error(`duplicate non-spacing marks: ${f0(a)}`);if(s-r>Jb)throw new Error(`excessive non-spacing marks: ${h0(Kc(n.slice(r-1,s)))} (${s-r}/${Jb})`);r=s}}}function F_(t,e,n){let r=[],i=[];for(t=t.slice().reverse();t.length;){let s=L_(t);if(s)i.length&&(r.push(e(i)),i=[]),r.push(n(s));else{let a=t.pop();if(hi.has(a))i.push(a);else{let c=rd.get(a);if(c)i.push(...c);else if(!q2.has(a))throw J2(a)}}}return i.length&&r.push(e(i)),r}function U_(t){return t.filter(e=>e!=j2)}function L_(t,e){let n=sd,r,i=t.length;for(;i&&(n=n.get(t[--i]),!!n);){let{V:s}=n;s&&(r=s,t.length=i)}return r}const Q2=new Uint8Array(32);Q2.fill(0);function Xb(t){return F(t.length!==0,"invalid ENS name; empty component","comp",t),t}function d0(t){const e=Xt(Y2(t)),n=[];if(t.length===0)return n;let r=0;for(let i=0;i<e.length;i++)e[i]===46&&(n.push(Xb(e.slice(r,i))),r=i+1);return F(r<e.length,"invalid ENS name; empty component","name",t),n.push(Xb(e.slice(r))),n}function Y2(t){try{if(t.length===0)throw new Error("empty label");return P_(t)}catch(e){F(!1,`invalid ENS name (${e.message})`,"name",t)}}function ey(t){try{return d0(t).length!==0}catch{}return!1}function ty(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=Q2;const n=d0(t);for(;n.length;)e=ht(He([e,ht(n.pop())]));return pe(e)}function ny(t,e){const n=e;return F(n<=255,"DNS encoded label cannot exceed 255","length",n),pe(He(d0(t).map(r=>{F(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const i=new Uint8Array(r.length+1);return i.set(r,1),i[0]=i.length-1,i})))+"00"}function M_(t){return typeof t=="string"&&(t=Xt(t)),ht(He([Xt(dC),Xt(String(t.length)),t]))}const X2=new Uint8Array(32);X2.fill(0);const $_=BigInt(-1),e3=BigInt(0),t3=BigInt(1),z_=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function G_(t){const e=we(t),n=e.length%32;return n?He([e,X2.slice(n)]):pe(e)}const V_=Tr(t3,32),j_=Tr(e3,32),ry={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},gh=["name","version","chainId","verifyingContract","salt"];function iy(t){return function(e){return F(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const H_={name:iy("name"),version:iy("version"),chainId:function(t){const e=Ae(t,"domain.chainId");return F(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):_n(e)},verifyingContract:function(t){try{return $e(t).toLowerCase()}catch{}F(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=we(t,"domain.salt");return F(e.length===32,'invalid domain value "salt"',"domain.salt",t),pe(e)}};function mh(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);F(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const i=uo(z_,n?r-1:r),s=n?(i+t3)*$_:e3;return function(a){const c=Ae(a,"value");return F(c>=s&&c<=i,`value out-of-bounds for ${t}`,"value",c),Tr(n?Aw(c,256):c,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return F(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const i=we(r);return F(i.length===n,`invalid length for ${t}`,"value",r),G_(r)}}}switch(t){case"address":return function(e){return Rr($e(e),32)};case"bool":return function(e){return e?V_:j_};case"bytes":return function(e){return ht(e)};case"string":return function(e){return Sr(e)}}return null}function sy(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function Da(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 Jt{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#n;constructor(e){this.#t=new Map,this.#n=new Map;const n=new Map,r=new Map,i=new Map,s={};Object.keys(e).forEach(l=>{s[l]=e[l].map(({name:h,type:d})=>{let{base:g,index:m}=Da(d);return g==="int"&&!e.int&&(g="int256"),g==="uint"&&!e.uint&&(g="uint256"),{name:h,type:g+(m||"")}}),n.set(l,new Set),r.set(l,[]),i.set(l,new Set)}),this.#e=JSON.stringify(s);for(const l in s){const h=new Set;for(const d of s[l]){F(!h.has(d.name),`duplicate variable name ${JSON.stringify(d.name)} in ${JSON.stringify(l)}`,"types",e),h.add(d.name);const g=Da(d.type).base;F(g!==l,`circular type reference to ${JSON.stringify(g)}`,"types",e),!mh(g)&&(F(r.has(g),`unknown type ${JSON.stringify(g)}`,"types",e),r.get(g).push(l),n.get(l).add(g))}}const a=Array.from(r.keys()).filter(l=>r.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),Oe(this,{primaryType:a[0]});function c(l,h){F(!h.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),h.add(l);for(const d of n.get(l))if(r.has(d)){c(d,h);for(const g of h)i.get(g).add(d)}h.delete(l)}c(this.primaryType,new Set);for(const[l,h]of i){const d=Array.from(h);d.sort(),this.#t.set(l,sy(l,s[l])+d.map(g=>sy(g,s[g])).join(""))}}getEncoder(e){let n=this.#n.get(e);return n||(n=this.#r(e),this.#n.set(e,n)),n}#r(e){{const i=mh(e);if(i)return i}const n=Da(e).array;if(n){const i=n.prefix,s=this.getEncoder(i);return a=>{F(n.count===-1||n.count===a.length,`array length mismatch; expected length ${n.count}`,"value",a);let c=a.map(s);return this.#t.has(i)&&(c=c.map(ht)),ht(He(c))}}const r=this.types[e];if(r){const i=Sr(this.#t.get(e));return s=>{const a=r.map(({name:c,type:l})=>{const h=this.getEncoder(l)(s[c]);return this.#t.has(l)?ht(h):h});return a.unshift(i),He(a)}}F(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const n=this.#t.get(e);return F(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return ht(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(mh(e))return r(e,n);const i=Da(e).array;if(i)return F(i.count===-1||i.count===n.length,`array length mismatch; expected length ${i.count}`,"value",n),n.map(a=>this._visit(i.prefix,a,r));const s=this.types[e];if(s)return s.reduce((a,{name:c,type:l})=>(a[c]=this._visit(l,n[c],r),a),{});F(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new Jt(e)}static getPrimaryType(e){return Jt.from(e).primaryType}static hashStruct(e,n,r){return Jt.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const i=ry[r];F(i,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:i})}return n.sort((r,i)=>gh.indexOf(r.name)-gh.indexOf(i.name)),Jt.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return He(["0x1901",Jt.hashDomain(e),Jt.from(n).hash(r)])}static hash(e,n,r){return ht(Jt.encode(e,n,r))}static async resolveNames(e,n,r,i){e=Object.assign({},e);for(const c in e)e[c]==null&&delete e[c];const s={};e.verifyingContract&&!nt(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const a=Jt.from(n);a.visit(r,(c,l)=>(c==="address"&&!nt(l,20)&&(s[l]="0x"),l));for(const c in s)s[c]=await i(c);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=a.visit(r,(c,l)=>c==="address"&&s[l]?s[l]:l),{domain:e,value:r}}static getPayload(e,n,r){Jt.hashDomain(e);const i={},s=[];gh.forEach(l=>{const h=e[l];h!=null&&(i[l]=H_[l](h),s.push({name:l,type:ry[l]}))});const a=Jt.from(n);n=a.types;const c=Object.assign({},n);return F(c.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),c.EIP712Domain=s,a.encode(r),{types:c,domain:i,primaryType:a.primaryType,message:a.visit(r,(l,h)=>{if(l.match(/^bytes(\d*)/))return pe(we(h));if(l.match(/^u?int/))return Ae(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 Qt(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const q_="external public payable override",Z_=Qt(q_.split(" ")),n3="constant external internal payable private public pure view override",K_=Qt(n3.split(" ")),r3="constructor error event fallback function receive struct",i3=Qt(r3.split(" ")),s3="calldata memory storage payable indexed",J_=Qt(s3.split(" ")),W_="tuple returns",Q_=[r3,s3,W_,n3].join(" "),Y_=Qt(Q_.split(" ")),X_={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},eD=new RegExp("^(\\s*)"),tD=new RegExp("^([0-9]+)"),nD=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),o3=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),a3=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class In{#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 In(this.#t)}reset(){this.#e=0}#n(e=0,n=0){return new In(this.#t.slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=this.#n(this.#e+1,e.match+1);return this.#e=e.match+1,n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;this.#e<e.match-1;){const r=this.peek().linkNext;n.push(this.#n(this.#e+1,r)),this.#e=r}return this.#e=e.match+1,n}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return this.#e++,e}toString(){const e=[];for(let n=this.#e;n<this.#t.length;n++){const r=this.#t[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}}function ri(t){const e=[],n=a=>{const c=s<t.length?JSON.stringify(t[s]):"$EOI";throw new Error(`invalid token ${c} at ${s}: ${a}`)};let r=[],i=[],s=0;for(;s<t.length;){let a=t.substring(s),c=a.match(eD);c&&(s+=c[1].length,a=t.substring(s));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};e.push(l);let h=X_[a[0]]||"";if(h){if(l.type=h,l.text=a[0],s++,h==="OPEN_PAREN")r.push(e.length-1),i.push(e.length-1);else if(h=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),l.match=r.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 g=e.pop().text;d=g+d,e[e.length-1].value=Ne(g)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=d}continue}if(c=a.match(nD),c){if(l.text=c[1],s+=l.text.length,Y_.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(a3)){l.type="TYPE";continue}l.type="ID";continue}if(c=a.match(tD),c){l.text=c[1],l.type="NUMBER",s+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${s}`)}return new In(e.map(a=>Object.freeze(a)))}function oy(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function Jc(t,e){if(e.peekKeyword(i3)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Ir(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function c3(t){let e=Ir(t,K_);return oy(e,Qt("constant payable nonpayable".split(" "))),oy(e,Qt("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 wr(t,e){return t.popParams().map(n=>st.from(n,e))}function u3(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Ae(t.pop().text);throw new Error("invalid gas")}return null}function Si(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const rD=new RegExp(/^(.*)\[([0-9]*)\]$/);function ay(t){const e=t.match(a3);if(F(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);F(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);F(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const mt={},on=Symbol.for("_ethers_internal"),cy="_ParamTypeInternal",uy="_ErrorInternal",ly="_EventInternal",fy="_ConstructorInternal",hy="_FallbackInternal",dy="_FunctionInternal",py="_StructInternal";class st{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,n,r,i,s,a,c,l){if(Fi(e,mt,"ParamType"),Object.defineProperty(this,on,{value:cy}),a&&(a=Object.freeze(a.slice())),i==="array"){if(c==null||l==null)throw new Error("")}else if(c!=null||l!=null)throw new Error("");if(i==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Oe(this,{name:n,type:r,baseType:i,indexed:s,components:a,arrayLength:c,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=r,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){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 r=this;return e.map(i=>r.arrayChildren.walk(i,n))}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 r=this;return e.map((i,s)=>r.components[s].walk(i,n))}return n(this.type,e)}#e(e,n,r,i){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,c=n.slice();c.forEach((l,h)=>{a.#e(e,l,r,d=>{c[h]=d})}),i(c);return}if(this.isTuple()){const a=this.components;let c;if(Array.isArray(n))c=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");c=a.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in n))throw new Error(`missing value for component ${l.name}`);return n[l.name]})}if(c.length!==this.components.length)throw new Error("array is wrong length");c.forEach((l,h)=>{a[h].#e(e,l,r,d=>{c[h]=d})}),i(c);return}const s=r(this.type,n);s.then?e.push((async function(){i(await s)})()):i(s)}async walkAsync(e,n){const r=[],i=[e];return this.#e(r,e,n,s=>{i[0]=s}),r.length&&await Promise.all(r),i[0]}static from(e,n){if(st.isParamType(e))return e;if(typeof e=="string")try{return st.from(ri(e),n)}catch{F(!1,"invalid param type","obj",e)}else if(e instanceof In){let c="",l="",h=null;Ir(e,Qt(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",h=e.popParams().map(E=>st.from(E)),c=`tuple(${h.map(E=>E.format()).join(",")})`):(c=ay(e.popType("TYPE")),l=c);let d=null,g=null;for(;e.length&&e.peekType("BRACKET");){const E=e.pop();d=new st(mt,"",c,l,null,h,g,d),g=E.value,c+=E.text,l="array",h=null}let m=null;if(Ir(e,J_).has("indexed")){if(!n)throw new Error("");m=!0}const v=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new st(mt,v,c,l,m,h,g,d)}const r=e.name;F(!r||typeof r=="string"&&r.match(o3),"invalid name","obj.name",r);let i=e.indexed;i!=null&&(F(n,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,a=s.match(rD);if(a){const c=parseInt(a[2]||"-1"),l=st.from({type:a[1],components:e.components});return new st(mt,r||"",s,"array",i,null,c,l)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const c=e.components!=null?e.components.map(h=>st.from(h)):null;return new st(mt,r||"",s,"tuple",i,c,null,null)}return s=ay(e.type),new st(mt,r||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[on]===cy}}class Ii{type;inputs;constructor(e,n,r){Fi(e,mt,"Fragment"),r=Object.freeze(r.slice()),Oe(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Ii.from(JSON.parse(e))}catch{}return Ii.from(ri(e))}if(e instanceof In)switch(e.peekKeyword(i3)){case"constructor":return yr.from(e);case"error":return nn.from(e);case"event":return Jn.from(e);case"fallback":case"receive":return hr.from(e);case"function":return Wn.from(e);case"struct":return Ri.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return yr.from(e);case"error":return nn.from(e);case"event":return Jn.from(e);case"fallback":case"receive":return hr.from(e);case"function":return Wn.from(e);case"struct":return Ri.from(e)}fe(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}F(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return yr.isFragment(e)}static isError(e){return nn.isFragment(e)}static isEvent(e){return Jn.isFragment(e)}static isFunction(e){return Wn.isFragment(e)}static isStruct(e){return Ri.isFragment(e)}}class Wc extends Ii{name;constructor(e,n,r,i){super(e,n,i),F(typeof r=="string"&&r.match(o3),"invalid identifier","name",r),i=Object.freeze(i.slice()),Oe(this,{name:r})}}function No(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class nn extends Wc{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,on,{value:uy})}get selector(){return Sr(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(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+No(e,this.inputs)),n.join(" ")}static from(e){if(nn.isFragment(e))return e;if(typeof e=="string")return nn.from(ri(e));if(e instanceof In){const n=Jc("error",e),r=wr(e);return Si(e),new nn(mt,n,r)}return new nn(mt,e.name,e.inputs?e.inputs.map(st.from):[])}static isFragment(e){return e&&e[on]===uy}}class Jn extends Wc{anonymous;constructor(e,n,r,i){super(e,"event",n,r),Object.defineProperty(this,on,{value:ly}),Oe(this,{anonymous:i})}get topicHash(){return Sr(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(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("event"),n.push(this.name+No(e,this.inputs)),e!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(e,n){return n=(n||[]).map(i=>st.from(i)),new Jn(mt,e,n,!1).topicHash}static from(e){if(Jn.isFragment(e))return e;if(typeof e=="string")try{return Jn.from(ri(e))}catch{F(!1,"invalid event fragment","obj",e)}else if(e instanceof In){const n=Jc("event",e),r=wr(e,!0),i=!!Ir(e,Qt(["anonymous"])).has("anonymous");return Si(e),new Jn(mt,n,r,i)}return new Jn(mt,e.name,e.inputs?e.inputs.map(n=>st.from(n,!0)):[],!!e.anonymous)}static isFragment(e){return e&&e[on]===ly}}class yr extends Ii{payable;gas;constructor(e,n,r,i,s){super(e,n,r),Object.defineProperty(this,on,{value:fy}),Oe(this,{payable:i,gas:s})}format(e){if(fe(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(r=>JSON.parse(r.format(e)))});const n=[`constructor${No(e,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(e){if(yr.isFragment(e))return e;if(typeof e=="string")try{return yr.from(ri(e))}catch{F(!1,"invalid constuctor fragment","obj",e)}else if(e instanceof In){Ir(e,Qt(["constructor"]));const n=wr(e),r=!!Ir(e,Z_).has("payable"),i=u3(e);return Si(e),new yr(mt,"constructor",n,r,i)}return new yr(mt,"constructor",e.inputs?e.inputs.map(st.from):[],!!e.payable,e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[on]===fy}}class hr extends Ii{payable;constructor(e,n,r){super(e,"fallback",n),Object.defineProperty(this,on,{value:hy}),Oe(this,{payable:r})}format(e){const n=this.inputs.length===0?"receive":"fallback";if(e==="json"){const r=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:r})}return`${n}()${this.payable?" payable":""}`}static from(e){if(hr.isFragment(e))return e;if(typeof e=="string")try{return hr.from(ri(e))}catch{F(!1,"invalid fallback fragment","obj",e)}else if(e instanceof In){const n=e.toString(),r=e.peekKeyword(Qt(["fallback","receive"]));if(F(r,"type must be fallback or receive","obj",n),e.popKeyword(Qt(["fallback","receive"]))==="receive"){const c=wr(e);return F(c.length===0,"receive cannot have arguments","obj.inputs",c),Ir(e,Qt(["payable"])),Si(e),new hr(mt,[],!0)}let s=wr(e);s.length?F(s.length===1&&s[0].type==="bytes","invalid fallback inputs","obj.inputs",s.map(c=>c.format("minimal")).join(", ")):s=[st.from("bytes")];const a=c3(e);if(F(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Ir(e,Qt(["returns"])).has("returns")){const c=wr(e);F(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(l=>l.format("minimal")).join(", "))}return Si(e),new hr(mt,s,a==="payable")}if(e.type==="receive")return new hr(mt,[],!0);if(e.type==="fallback"){const n=[st.from("bytes")],r=e.stateMutability==="payable";return new hr(mt,n,r)}F(!1,"invalid fallback description","obj",e)}static isFragment(e){return e&&e[on]===hy}}class Wn extends Wc{constant;outputs;stateMutability;payable;gas;constructor(e,n,r,i,s,a){super(e,"function",n,i),Object.defineProperty(this,on,{value:dy}),s=Object.freeze(s.slice()),Oe(this,{constant:r==="view"||r==="pure",gas:a,outputs:s,payable:r==="payable",stateMutability:r})}get selector(){return Sr(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(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("function"),n.push(this.name+No(e,this.inputs)),e!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(No(e,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(e,n){return n=(n||[]).map(i=>st.from(i)),new Wn(mt,e,"view",n,[],null).selector}static from(e){if(Wn.isFragment(e))return e;if(typeof e=="string")try{return Wn.from(ri(e))}catch{F(!1,"invalid function fragment","obj",e)}else if(e instanceof In){const r=Jc("function",e),i=wr(e),s=c3(e);let a=[];Ir(e,Qt(["returns"])).has("returns")&&(a=wr(e));const c=u3(e);return Si(e),new Wn(mt,r,s,i,a,c)}let n=e.stateMutability;return n==null&&(n="payable",typeof e.constant=="boolean"?(n="view",e.constant||(n="payable",typeof e.payable=="boolean"&&!e.payable&&(n="nonpayable"))):typeof e.payable=="boolean"&&!e.payable&&(n="nonpayable")),new Wn(mt,e.name,n,e.inputs?e.inputs.map(st.from):[],e.outputs?e.outputs.map(st.from):[],e.gas!=null?e.gas:null)}static isFragment(e){return e&&e[on]===dy}}class Ri extends Wc{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,on,{value:py})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Ri.from(ri(e))}catch{F(!1,"invalid struct fragment","obj",e)}else if(e instanceof In){const n=Jc("struct",e),r=wr(e);return Si(e),new Ri(mt,n,r)}return new Ri(mt,e.name,e.inputs?e.inputs.map(st.from):[])}static isFragment(e){return e&&e[on]===py}}const Mn=new Map;Mn.set(0,"GENERIC_PANIC");Mn.set(1,"ASSERT_FALSE");Mn.set(17,"OVERFLOW");Mn.set(18,"DIVIDE_BY_ZERO");Mn.set(33,"ENUM_RANGE_ERROR");Mn.set(34,"BAD_STORAGE_DATA");Mn.set(49,"STACK_UNDERFLOW");Mn.set(50,"ARRAY_RANGE_ERROR");Mn.set(65,"OUT_OF_MEMORY");Mn.set(81,"UNINITIALIZED_FUNCTION_CALL");const iD=new RegExp(/^bytes([0-9]*)$/),sD=new RegExp(/^(u?int)([0-9]*)$/);let bh=null,gy=1024;function oD(t,e,n,r){let i="missing revert data",s=null;const a=null;let c=null;if(n){i="execution reverted";const h=we(n);if(n=pe(n),h.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(h.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(pe(h.slice(0,4))==="0x08c379a0")try{s=r.decode(["string"],h.slice(4))[0],c={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(pe(h.slice(0,4))==="0x4e487b71")try{const d=Number(r.decode(["uint256"],h.slice(4))[0]);c={signature:"Panic(uint256)",name:"Panic",args:[d]},s=`Panic due to ${Mn.get(d)||"UNKNOWN"}(${d})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const l={to:e.to?$e(e.to):null,data:e.data||"0x"};return e.from&&(l.from=$e(e.from)),pt(i,"CALL_EXCEPTION",{action:t,data:n,reason:s,transaction:l,invocation:a,revert:c})}class Ts{#e(e){if(e.isArray())return new BC(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new _a(e.components.map(r=>this.#e(r)),e.name);switch(e.baseType){case"address":return new EC(e.name);case"bool":return new RC(e.name);case"string":return new _C(e.name);case"bytes":return new TC(e.name);case"":return new OC(e.name)}let n=e.type.match(sD);if(n){let r=parseInt(n[2]||"256");return F(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new CC(r/8,n[1]==="int",e.name)}if(n=e.type.match(iD),n){let r=parseInt(n[1]);return F(r!==0&&r<=32,"invalid bytes length","param",e),new SC(r,e.name)}F(!1,"invalid type","type",e.type)}getDefaultValue(e){const n=e.map(i=>this.#e(st.from(i)));return new _a(n,"_").defaultValue()}encode(e,n){bw(n.length,e.length,"types/values length mismatch");const r=e.map(a=>this.#e(st.from(a))),i=new _a(r,"_"),s=new Kh;return i.encode(s,n),s.data}decode(e,n,r){const i=e.map(a=>this.#e(st.from(a)));return new _a(i,"_").decode(new Wd(n,r,gy))}static _setDefaultMaxInflation(e){F(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),gy=e}static defaultAbiCoder(){return bh==null&&(bh=new Ts),bh}static getBuiltinCallException(e,n,r){return oD(e,n,r,Ts.defaultAbiCoder())}}class aD{fragment;name;signature;topic;args;constructor(e,n,r){const i=e.name,s=e.format();Oe(this,{fragment:e,name:i,signature:s,topic:n,args:r})}}class cD{fragment;name;args;signature;selector;value;constructor(e,n,r,i){const s=e.name,a=e.format();Oe(this,{fragment:e,name:s,args:r,signature:a,selector:n,value:i})}}class uD{fragment;name;args;signature;selector;constructor(e,n,r){const i=e.name,s=e.format();Oe(this,{fragment:e,name:i,args:r,signature:s,selector:n})}}class my{hash;_isIndexed;static isIndexed(e){return!!(e&&e._isIndexed)}constructor(e){Oe(this,{hash:e,_isIndexed:!0})}}const by={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"},yy={"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&&by[t.toString()]&&(e=by[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};class mi{fragments;deploy;fallback;receive;#e;#t;#n;#r;constructor(e){let n=[];typeof e=="string"?n=JSON.parse(e):n=e,this.#n=new Map,this.#e=new Map,this.#t=new Map;const r=[];for(const a of n)try{r.push(Ii.from(a))}catch(c){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,c.message)}Oe(this,{fragments:Object.freeze(r)});let i=null,s=!1;this.#r=this.getAbiCoder(),this.fragments.forEach((a,c)=>{let l;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Oe(this,{deploy:a});return;case"fallback":a.inputs.length===0?s=!0:(F(!i||a.payable!==i.payable,"conflicting fallback fragments",`fragments[${c}]`,a),i=a,s=i.payable);return;case"function":l=this.#n;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||Oe(this,{deploy:yr.from("constructor()")}),Oe(this,{fallback:i,receive:s})}format(e){const n=e?"minimal":"full";return this.fragments.map(i=>i.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return Ts.defaultAbiCoder()}#i(e,n,r){if(nt(e)){const s=e.toLowerCase();for(const a of this.#n.values())if(s===a.selector)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,c]of this.#n)a.split("(")[0]===e&&s.push(c);if(n){const a=n.length>0?n[n.length-1]:null;let c=n.length,l=!0;wt.isTyped(a)&&a.type==="overrides"&&(l=!1,c--);for(let h=s.length-1;h>=0;h--){const d=s[h].inputs.length;d!==c&&(!l||d!==c-1)&&s.splice(h,1)}for(let h=s.length-1;h>=0;h--){const d=s[h].inputs;for(let g=0;g<n.length;g++)if(wt.isTyped(n[g])){if(g>=d.length){if(n[g].type==="overrides")continue;s.splice(h,1);break}if(n[g].type!==d[g].baseType){s.splice(h,1);break}}}}if(s.length===1&&n&&n.length!==s[0].inputs.length){const a=n[n.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&r){const a=s.map(c=>JSON.stringify(c.format())).join(", ");F(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return s[0]}const i=this.#n.get(Wn.from(e).format());return i||null}getFunctionName(e){const n=this.#i(e,null,!1);return F(n,"no matching function","key",e),n.name}hasFunction(e){return!!this.#i(e,null,!1)}getFunction(e,n){return this.#i(e,n||null,!0)}forEachFunction(e){const n=Array.from(this.#n.keys());n.sort((r,i)=>r.localeCompare(i));for(let r=0;r<n.length;r++){const i=n[r];e(this.#n.get(i),r)}}#o(e,n,r){if(nt(e)){const s=e.toLowerCase();for(const a of this.#t.values())if(s===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,c]of this.#t)a.split("(")[0]===e&&s.push(c);if(n){for(let a=s.length-1;a>=0;a--)s[a].inputs.length<n.length&&s.splice(a,1);for(let a=s.length-1;a>=0;a--){const c=s[a].inputs;for(let l=0;l<n.length;l++)if(wt.isTyped(n[l])&&n[l].type!==c[l].baseType){s.splice(a,1);break}}}if(s.length===0)return null;if(s.length>1&&r){const a=s.map(c=>JSON.stringify(c.format())).join(", ");F(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return s[0]}const i=this.#t.get(Jn.from(e).format());return i||null}getEventName(e){const n=this.#o(e,null,!1);return F(n,"no matching event","key",e),n.name}hasEvent(e){return!!this.#o(e,null,!1)}getEvent(e,n){return this.#o(e,n||null,!0)}forEachEvent(e){const n=Array.from(this.#t.keys());n.sort((r,i)=>r.localeCompare(i));for(let r=0;r<n.length;r++){const i=n[r];e(this.#t.get(i),r)}}getError(e,n){if(nt(e)){const i=e.toLowerCase();if(yy[i])return nn.from(yy[i].signature);for(const s of this.#e.values())if(i===s.selector)return s;return null}if(e.indexOf("(")===-1){const i=[];for(const[s,a]of this.#e)s.split("(")[0]===e&&i.push(a);if(i.length===0)return e==="Error"?nn.from("error Error(string)"):e==="Panic"?nn.from("error Panic(uint256)"):null;if(i.length>1){const s=i.map(a=>JSON.stringify(a.format())).join(", ");F(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=nn.from(e).format(),e==="Error(string)")return nn.from("error Error(string)");if(e==="Panic(uint256)")return nn.from("error Panic(uint256)");const r=this.#e.get(e);return r||null}forEachError(e){const n=Array.from(this.#e.keys());n.sort((r,i)=>r.localeCompare(i));for(let r=0;r<n.length;r++){const i=n[r];e(this.#e.get(i),r)}}_decodeParams(e,n){return this.#r.decode(e,n)}_encodeParams(e,n){return this.#r.encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);F(r,"unknown error","fragment",e),e=r}return F(ut(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,ut(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);F(r,"unknown error","fragment",e),e=r}return He([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);F(r,"unknown function","fragment",e),e=r}return F(ut(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,ut(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);F(r,"unknown function","fragment",e),e=r}return He([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const s=this.getFunction(e);F(s,"unknown function","fragment",e),e=s}let r="invalid length for result data";const i=Ut(n);if(i.length%32===0)try{return this.#r.decode(e.outputs,i)}catch{r="could not decode result data"}fe(!1,r,"BAD_DATA",{value:pe(i),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=we(e,"data"),i=Ts.getBuiltinCallException("call",n,r);if(i.message.startsWith("execution reverted (unknown custom error)")){const c=pe(r.slice(0,4)),l=this.getError(c);if(l)try{const h=this.#r.decode(l.inputs,r.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(n);return a&&(i.invocation={method:a.name,signature:a.signature,args:a.args}),i}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);F(r,"unknown function","fragment",e),e=r}return pe(this.#r.encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const s=this.getEvent(e);F(s,"unknown event","eventFragment",e),e=s}fe(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const i=(s,a)=>s.type==="string"?Sr(a):s.type==="bytes"?ht(pe(a)):(s.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":s.type.match(/^u?int/)?a=Tr(a):s.type.match(/^bytes/)?a=pk(a,32):s.type==="address"&&this.#r.encode(["address"],[a]),Rr(pe(a),32));for(n.forEach((s,a)=>{const c=e.inputs[a];if(!c.indexed){F(s==null,"cannot filter non-indexed parameters; must be null","contract."+c.name,s);return}s==null?r.push(null):c.baseType==="array"||c.baseType==="tuple"?F(!1,"filtering with tuples or arrays not supported","contract."+c.name,s):Array.isArray(s)?r.push(s.map(l=>i(c,l))):r.push(i(c,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const a=this.getEvent(e);F(a,"unknown event","eventFragment",e),e=a}const r=[],i=[],s=[];return e.anonymous||r.push(e.topicHash),F(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((a,c)=>{const l=n[c];if(a.indexed)if(a.type==="string")r.push(Sr(l));else if(a.type==="bytes")r.push(ht(l));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");r.push(this.#r.encode([a.type],[l]))}else i.push(a),s.push(l)}),{data:this.#r.encode(i,s),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const w=this.getEvent(e);F(w,"unknown event","eventFragment",e),e=w}if(r!=null&&!e.anonymous){const w=e.topicHash;F(nt(r[0],32)&&r[0].toLowerCase()===w,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const i=[],s=[],a=[];e.inputs.forEach((w,v)=>{w.indexed?w.type==="string"||w.type==="bytes"||w.baseType==="tuple"||w.baseType==="array"?(i.push(st.from({type:"bytes32",name:w.name})),a.push(!0)):(i.push(w),a.push(!1)):(s.push(w),a.push(!1))});const c=r!=null?this.#r.decode(i,He(r)):null,l=this.#r.decode(s,n,!0),h=[],d=[];let g=0,m=0;return e.inputs.forEach((w,v)=>{let E=null;if(w.indexed)if(c==null)E=new my(null);else if(a[v])E=new my(c[m++]);else try{E=c[m++]}catch(S){E=S}else try{E=l[g++]}catch(S){E=S}h.push(E),d.push(w.name||null)}),br.fromItems(h,d)}parseTransaction(e){const n=we(e.data,"tx.data"),r=Ae(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(pe(n.slice(0,4)));if(!i)return null;const s=this.#r.decode(i.inputs,n.slice(4));return new cD(i,i.selector,s,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new aD(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=pe(e),r=this.getError(ut(n,0,4));if(!r)return null;const i=this.#r.decode(r.inputs,ut(n,4));return new uD(r,r.selector,i)}static from(e){return e instanceof mi?e:typeof e=="string"?new mi(JSON.parse(e)):typeof e.formatJson=="function"?new mi(e.formatJson()):typeof e.format=="function"?new mi(e.format("json")):new mi(e)}}const l3=BigInt(0);function fs(t){return t??null}function vt(t){return t==null?null:t.toString()}class xy{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,n,r){Oe(this,{gasPrice:fs(e),maxFeePerGas:fs(n),maxPriorityFeePerGas:fs(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:vt(e),maxFeePerGas:vt(n),maxPriorityFeePerGas:vt(r)}}}function Co(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=pe(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=Ae(t[i],`request.${i}`));const r="type,nonce".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=Ne(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=>Mc(i)?pe(i):Object.assign({},i))),e}class lD{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;transactionsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#e;constructor(e,n){this.#e=e.transactions.map(r=>typeof r!="string"?new Xo(r,n):r),Oe(this,{provider:n,hash:fs(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:fs(e.prevRandao),extraData:e.extraData,baseFeePerGas:fs(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?[]:(fe(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:i,gasUsed:s,hash:a,miner:c,prevRandao:l,nonce:h,number:d,parentHash:g,parentBeaconBlockRoot:m,stateRoot:w,receiptsRoot:v,transactionsRoot:E,timestamp:S,transactions:A}=this;return{_type:"Block",baseFeePerGas:vt(e),difficulty:vt(n),extraData:r,gasLimit:vt(i),gasUsed:vt(s),blobGasUsed:vt(this.blobGasUsed),excessBlobGas:vt(this.excessBlobGas),hash:a,miner:c,prevRandao:l,nonce:h,number:d,parentHash:g,timestamp:S,parentBeaconBlockRoot:m,stateRoot:w,receiptsRoot:v,transactionsRoot:E,transactions:A}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[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 n;if(typeof e=="number")n=this.#e[e];else{const r=e.toLowerCase();for(const i of this.#e)if(typeof i=="string"){if(i!==r)continue;n=i;break}else{if(i.hash!==r)continue;n=i;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;F(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return fD(this)}}class Yo{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(e,n){this.provider=n;const r=Object.freeze(e.topics.slice());Oe(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:i,index:s,removed:a,topics:c,transactionHash:l,transactionIndex:h}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:i,index:s,removed:a,topics:c,transactionHash:l,transactionIndex:h}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return fe(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return fe(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return fe(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return hD(this)}}class f3{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#e;constructor(e,n){this.#e=Object.freeze(e.logs.map(i=>new Yo(i,n)));let r=l3;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Oe(this,{provider:n,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:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#e}toJSON(){const{to:e,from:n,contractAddress:r,hash:i,index:s,blockHash:a,blockNumber:c,logsBloom:l,logs:h,status:d,root:g}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:c,contractAddress:r,cumulativeGasUsed:vt(this.cumulativeGasUsed),from:n,gasPrice:vt(this.gasPrice),blobGasUsed:vt(this.blobGasUsed),blobGasPrice:vt(this.blobGasPrice),gasUsed:vt(this.gasUsed),hash:i,index:s,logs:h,logsBloom:l,root:g,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 d3(this)}reorderedEvent(e){return fe(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),h3(this,e)}}class Xo{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;authorizationList;#e;constructor(e,n){this.provider=n,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:n,index:r,hash:i,type:s,to:a,from:c,nonce:l,data:h,signature:d,accessList:g,blobVersionedHashes:m}=this;return{_type:"TransactionResponse",accessList:g,blockNumber:e,blockHash:n,blobVersionedHashes:m,chainId:vt(this.chainId),data:h,from:c,gasLimit:vt(this.gasLimit),gasPrice:vt(this.gasPrice),hash:i,maxFeePerGas:vt(this.maxFeePerGas),maxPriorityFeePerGas:vt(this.maxPriorityFeePerGas),maxFeePerBlobGas:vt(this.maxFeePerBlobGas),nonce:l,signature:d,to:a,index:r,type:s,value:vt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await Gt({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,i=n??0;let s=this.#e,a=-1,c=s===-1;const l=async()=>{if(c)return null;const{blockNumber:m,nonce:w}=await Gt({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(w<this.nonce){s=m;return}if(c)return null;const v=await this.getTransaction();if(!(v&&v.blockNumber!=null))for(a===-1&&(a=s-3,a<this.#e&&(a=this.#e));a<=m;){if(c)return null;const E=await this.provider.getBlock(a,!0);if(E==null)return;for(const S of E)if(S===this.hash)return;for(let S=0;S<E.length;S++){const A=await E.getTransaction(S);if(A.from===this.from&&A.nonce===this.nonce){if(c)return null;const I=await this.provider.getTransactionReceipt(A.hash);if(I==null||m-I.blockNumber+1<r)return;let T="replaced";A.data===this.data&&A.to===this.to&&A.value===this.value?T="repriced":A.data==="0x"&&A.from===A.to&&A.value===l3&&(T="cancelled"),fe(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:T==="replaced"||T==="cancelled",reason:T,replacement:A.replaceableTransaction(s),hash:A.hash,receipt:I})}}a++}},h=m=>{if(m==null||m.status!==0)return m;fe(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:m.to,from:m.from,data:""},receipt:m})},d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return h(d);if(d){if(r===1||await d.confirmations()>=r)return h(d)}else if(await l(),r===0)return null;return await new Promise((m,w)=>{const v=[],E=()=>{v.forEach(A=>A())};if(v.push(()=>{c=!0}),i>0){const A=setTimeout(()=>{E(),w(pt("wait for transaction timeout","TIMEOUT"))},i);v.push(()=>{clearTimeout(A)})}const S=async A=>{if(await A.confirmations()>=r){E();try{m(h(A))}catch(I){w(I)}}};if(v.push(()=>{this.provider.off(this.hash,S)}),this.provider.on(this.hash,S),s>=0){const A=async()=>{try{await l()}catch(I){if(Nt(I,"TRANSACTION_REPLACED")){E(),w(I);return}}c||this.provider.once("block",A)};v.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 fe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),d3(this)}reorderedEvent(e){return fe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),fe(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),h3(this,e)}replaceableTransaction(e){F(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new Xo(this,this.provider);return n.#e=e,n}}function fD(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function h3(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function d3(t){return{orphan:"drop-transaction",tx:t}}function hD(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 p0 extends Yo{interface;fragment;args;constructor(e,n,r){super(e,e.provider);const i=n.decodeEventLog(r,e.data,e.topics);Oe(this,{args:i,fragment:r,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class p3 extends Yo{error;constructor(e,n){super(e,e.provider),Oe(this,{error:n})}}class dD extends f3{#e;constructor(e,n,r){super(r,n),this.#e=e}get logs(){return super.logs.map(e=>{const n=e.topics.length?this.#e.getEvent(e.topics[0]):null;if(n)try{return new p0(e,this.#e,n)}catch(r){return new p3(e,r)}return e})}}class g0 extends Xo{#e;constructor(e,n,r){super(r,n),this.#e=e}async wait(e,n){const r=await super.wait(e,n);return r==null?null:new dD(this.#e,this.provider,r)}}class g3 extends vw{log;constructor(e,n,r,i){super(e,n,r),Oe(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 pD extends g3{constructor(e,n,r,i,s){super(e,n,r,new p0(s,e.interface,i));const a=e.interface.decodeEventLog(i,this.log.data,this.log.topics);Oe(this,{args:a,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const wy=BigInt(0);function m3(t){return t&&typeof t.call=="function"}function b3(t){return t&&typeof t.estimateGas=="function"}function Qc(t){return t&&typeof t.resolveName=="function"}function y3(t){return t&&typeof t.sendTransaction=="function"}function x3(t){if(t!=null){if(Qc(t))return t;if(t.provider)return t.provider}}class gD{#e;fragment;constructor(e,n,r){if(Oe(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const i=Oi(e.runner,"resolveName"),s=Qc(i)?i:null;this.#e=(async function(){const a=await Promise.all(n.inputs.map((c,l)=>r[l]==null?null:c.walkAsync(r[l],(d,g)=>d==="address"?Array.isArray(g)?Promise.all(g.map(m=>_t(m,s))):_t(g,s):g)));return e.interface.encodeFilterTopics(n,a)})()}getTopicFilter(){return this.#e}}function Oi(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Ei(t){return t==null?null:t.provider||null}async function w3(t,e){const n=wt.dereference(t,"overrides");F(typeof n=="object","invalid overrides parameter","overrides",t);const r=Co(n);return F(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),F(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function mD(t,e,n){const r=Oi(t,"resolveName"),i=Qc(r)?r:null;return await Promise.all(e.map((s,a)=>s.walkAsync(n[a],(c,l)=>(l=wt.dereference(l,c),c==="address"?_t(l,i):l))))}function bD(t){const e=async function(a){const c=await w3(a,["data"]);c.to=await t.getAddress(),c.from&&(c.from=await _t(c.from,x3(t.runner)));const l=t.interface,h=Ae(c.value||wy,"overrides.value")===wy,d=(c.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",c.data);const g=l.receive||l.fallback&&l.fallback.payable;return F(g||h,"cannot send value to non-payable fallback","overrides.value",c.value),F(l.fallback||d,"cannot send data to receive-only contract","overrides.data",c.data),c},n=async function(a){const c=Oi(t.runner,"call");fe(m3(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(a);try{return await c.call(l)}catch(h){throw Jd(h)&&h.data?t.interface.makeError(h.data,l):h}},r=async function(a){const c=t.runner;fe(y3(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await c.sendTransaction(await e(a)),h=Ei(t.runner);return new g0(t.interface,h,l)},i=async function(a){const c=Oi(t.runner,"estimateGas");return fe(b3(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await e(a))},s=async a=>await r(a);return Oe(s,{_contract:t,estimateGas:i,populateTransaction:e,send:r,staticCall:n}),s}function yD(t,e){const n=function(...h){const d=t.interface.getFunction(e,h);return fe(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:h}}),d},r=async function(...h){const d=n(...h);let g={};if(d.inputs.length+1===h.length&&(g=await w3(h.pop()),g.from&&(g.from=await _t(g.from,x3(t.runner)))),d.inputs.length!==h.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const m=await mD(t.runner,d.inputs,h);return Object.assign({},g,await Gt({to:t.getAddress(),data:t.interface.encodeFunctionData(d,m)}))},i=async function(...h){const d=await c(...h);return d.length===1?d[0]:d},s=async function(...h){const d=t.runner;fe(y3(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const g=await d.sendTransaction(await r(...h)),m=Ei(t.runner);return new g0(t.interface,m,g)},a=async function(...h){const d=Oi(t.runner,"estimateGas");return fe(b3(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...h))},c=async function(...h){const d=Oi(t.runner,"call");fe(m3(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const g=await r(...h);let m="0x";try{m=await d.call(g)}catch(v){throw Jd(v)&&v.data?t.interface.makeError(v.data,g):v}const w=n(...h);return t.interface.decodeFunctionResult(w,m)},l=async(...h)=>n(...h).constant?await i(...h):await s(...h);return Oe(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:a,populateTransaction:r,send:s,staticCall:i,staticCallResult:c}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const h=t.interface.getFunction(e);return fe(h,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),h}}),l}function xD(t,e){const n=function(...i){const s=t.interface.getEvent(e,i);return fe(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},r=function(...i){return new gD(t,n(...i),i)};return Oe(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return fe(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),r}const wc=Symbol.for("_ethersInternal_contract"),A3=new WeakMap;function wD(t,e){A3.set(t[wc],e)}function un(t){return A3.get(t[wc])}function AD(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function m0(t,e){let n,r=null;if(Array.isArray(e)){const s=function(a){if(nt(a,32))return a;const c=t.interface.getEvent(a);return F(c,"unknown fragment","name",a),c.topicHash};n=e.map(a=>a==null?null:Array.isArray(a)?a.map(s):s(a))}else e==="*"?n=[null]:typeof e=="string"?nt(e,32)?n=[e]:(r=t.interface.getEvent(e),F(r,"unknown fragment","event",e),n=[r.topicHash]):AD(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):F(!1,"unknown event name","event",e);n=n.map(s=>{if(s==null)return null;if(Array.isArray(s)){const a=Array.from(new Set(s.map(c=>c.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return s.toLowerCase()});const i=n.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:r,tag:i,topics:n}}async function fo(t,e){const{subs:n}=un(t);return n.get((await m0(t,e)).tag)||null}async function Ay(t,e,n){const r=Ei(t.runner);fe(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:a}=await m0(t,n),{addr:c,subs:l}=un(t);let h=l.get(s);if(!h){const g={address:c||t,topics:a},m=S=>{let A=i;if(A==null)try{A=t.interface.getEvent(S.topics[0])}catch{}if(A){const I=A,T=i?t.interface.decodeEventLog(i,S.data,S.topics):[];ad(t,n,T,O=>new pD(t,O,n,I,S))}else ad(t,n,[],I=>new g3(t,I,n,S))};let w=[];h={tag:s,listeners:[],start:()=>{w.length||w.push(r.on(g,m))},stop:async()=>{if(w.length==0)return;let S=w;w=[],await Promise.all(S),r.off(g,m)}},l.set(s,h)}return h}let od=Promise.resolve();async function ED(t,e,n,r){await od;const i=await fo(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:a,once:c})=>{const l=Array.from(n);r&&l.push(r(c?null:a));try{a.call(t,...l)}catch{}return!c}),i.listeners.length===0&&(i.stop(),un(t).subs.delete(i.tag)),s>0}async function ad(t,e,n,r){try{await od}catch{}const i=ED(t,e,n,r);return od=i,await i}const Fa=["then"];class xo{target;interface;runner;filters;[wc];fallback;constructor(e,n,r,i){F(typeof e=="string"||S2(e),"invalid value for Contract target","target",e),r==null&&(r=null);const s=mi.from(n);Oe(this,{target:e,runner:r,interface:s}),Object.defineProperty(this,wc,{value:{}});let a,c=null,l=null;if(i){const g=Ei(r);l=new g0(this.interface,g,i)}let h=new Map;if(typeof e=="string")if(nt(e))c=e,a=Promise.resolve(e);else{const g=Oi(r,"resolveName");if(!Qc(g))throw pt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=g.resolveName(e).then(m=>{if(m==null)throw pt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return un(this).addr=m,m})}else a=e.getAddress().then(g=>{if(g==null)throw new Error("TODO");return un(this).addr=g,g});wD(this,{addrPromise:a,addr:c,deployTx:l,subs:h});const d=new Proxy({},{get:(g,m,w)=>{if(typeof m=="symbol"||Fa.indexOf(m)>=0)return Reflect.get(g,m,w);try{return this.getEvent(m)}catch(v){if(!Nt(v,"INVALID_ARGUMENT")||v.argument!=="key")throw v}},has:(g,m)=>Fa.indexOf(m)>=0?Reflect.has(g,m):Reflect.has(g,m)||this.interface.hasEvent(String(m))});return Oe(this,{filters:d}),Oe(this,{fallback:s.receive||s.fallback?bD(this):null}),new Proxy(this,{get:(g,m,w)=>{if(typeof m=="symbol"||m in g||Fa.indexOf(m)>=0)return Reflect.get(g,m,w);try{return g.getFunction(m)}catch(v){if(!Nt(v,"INVALID_ARGUMENT")||v.argument!=="key")throw v}},has:(g,m)=>typeof m=="symbol"||m in g||Fa.indexOf(m)>=0?Reflect.has(g,m):g.interface.hasFunction(m)})}connect(e){return new xo(this.target,this.interface,e)}attach(e){return new xo(e,this.interface,this.runner)}async getAddress(){return await un(this).addrPromise}async getDeployedCode(){const e=Ei(this.runner);fe(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Ei(this.runner);return fe(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);r.once("block",a)}catch(c){s(c)}};a()})}deploymentTransaction(){return un(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),yD(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),xD(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:i,addrPromise:s}=un(this),a=i||await s,{fragment:c,topics:l}=await m0(this,e),h={address:a,topics:l,fromBlock:n,toBlock:r},d=Ei(this.runner);return fe(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(h)).map(g=>{let m=c;if(m==null)try{m=this.interface.getEvent(g.topics[0])}catch{}if(m)try{return new p0(g,this.interface,m)}catch(w){return new p3(g,w)}return new Yo(g,d)})}async on(e,n){const r=await Ay(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await Ay(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await ad(this,e,n,null)}async listenerCount(e){if(e){const i=await fo(this,e);return i?i.listeners.length:0}const{subs:n}=un(this);let r=0;for(const{listeners:i}of n.values())r+=i.length;return r}async listeners(e){if(e){const i=await fo(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:n}=un(this);let r=[];for(const{listeners:i}of n.values())r=r.concat(i.map(({listener:s})=>s));return r}async off(e,n){const r=await fo(this,e);if(!r)return this;if(n){const i=r.listeners.map(({listener:s})=>s).indexOf(n);i>=0&&r.listeners.splice(i,1)}return(n==null||r.listeners.length===0)&&(r.stop(),un(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await fo(this,e);if(!n)return this;n.stop(),un(this).subs.delete(n.tag)}else{const{subs:n}=un(this);for(const{tag:r,stop:i}of n.values())i(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends xo{constructor(i,s=null){super(i,e,s)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}}function vD(){return xo}class Za extends vD(){}const ho=BigInt(60);function yh(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 BD{name;constructor(e){Oe(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const E3=new RegExp("^(ipfs)://(.*)$","i"),Ey=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),E3,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function vy(t){return t===ho||t>=2147483648&&t<=4294967295}class pr{provider;address;name;#e;#t;constructor(e,n,r,i){Oe(this,{provider:e,address:n,name:r}),this.#e=i!=null?Promise.resolve(i):null,this.#t=new Za(n,["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(Nt(e,"CALL_EXCEPTION"))return!1;throw this.#e=null,e}})()),await this.#e}async#n(e,n){n=(n||[]).slice();const r=this.#t.interface;n.unshift(ty(this.name));let i=null;await this.supportsWildcard()&&(i=r.getFunction(e),fe(i,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[ny(this.name,255),r.encodeFunctionData(i,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const s=await this.#t[e](...n);return i?r.decodeFunctionResult(i,s)[0]:s}catch(s){if(!Nt(s,"CALL_EXCEPTION"))throw s}return null}async getAddress(e){const n=e==null?ho:Ae(e);if(n===ho)try{const s=await this.#n("addr(bytes32)");return s==null||s===pc?null:s}catch(s){if(Nt(s,"CALL_EXCEPTION"))return null;throw s}if(vy(n)){const s=await this.#n("addr(bytes32,uint)",[n]);return nt(s,20)?$e(s):null}if(n>=0&&n<2147483648){let s=n+BigInt(2147483648);const a=await this.#n("addr(bytes32,uint)",[s]);if(nt(a,20))return $e(a)}let r=null;for(const s of this.provider.plugins)if(s instanceof BD&&n<=2147483648&&s.supportsCoinType(Number(n))){r=s;break}if(r==null)return null;const i=await this.#n("addr(bytes32,uint)",[n]);if(i==null||i==="0x")return null;if(n<2147483648){const s=await r.decodeAddress(Number(n),i);if(s!=null)return s}fe(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${n})`,info:{coinType:n,data:i}})}async getText(e){const n=await this.#n("text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await this.#n("contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const i=n[1]==="e3010170"?"ipfs":"ipns",s=parseInt(n[4],16);if(n[5].length===s*2)return`${i}://${Ew("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;fe(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getName(){return await this.#n("name(bytes32)")}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<Ey.length;r++){const i=n.match(Ey[r]);if(i==null)continue;const s=i[1].toLowerCase();switch(s){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const a=yh(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:a}),{linkage:e,url:a}}case"erc721":case"erc1155":{const a=s==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:s,value:n});const c=await this.getAddress();if(c==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(i[2]||"").split("/");if(l.length!==2)return e.push({type:`!${s}caip`,value:i[2]||""}),{url:null,linkage:e};const h=l[1],d=new Za(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(s==="erc721"){const E=await d.ownerOf(h);if(c!==E)return e.push({type:"!owner",value:E}),{url:null,linkage:e};e.push({type:"owner",value:E})}else if(s==="erc1155"){const E=await d.balanceOf(c,h);if(!E)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:E.toString()})}let g=await d[a](h);if(g==null||g==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:g}),s==="erc1155"&&(g=g.replace("{id}",Tr(h,32).substring(2)),e.push({type:"metadata-url-expanded",value:g})),g.match(/^ipfs:/i)&&(g=yh(g)),e.push({type:"metadata-url",value:g});let m={};const w=await new er(g).send();w.assertOk();try{m=w.bodyJson}catch{try{e.push({type:"!metadata",value:w.bodyText})}catch{const A=w.body;return A&&e.push({type:"!metadata",value:pe(A)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!m)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(m)});let v=m.image;if(typeof v!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!v.match(/^(https:\/\/|data:)/i)){if(v.match(E3)==null)return e.push({type:"!imageUrl-ipfs",value:v}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:v}),v=yh(v)}return e.push({type:"url",value:v}),{linkage:e,url:v}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return fe(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async getUniversalResolverAddress(e){const r=(await e.getNetwork()).getPlugin("org.ethers.plugins.network.Ens");return r&&r.universalResolver?r.universalResolver:null}static async#r(e,n){const r=await pr.getEnsAddress(e);try{const s=await new Za(r,["function resolver(bytes32) view returns (address)"],e).resolver(ty(n),{enableCcipRead:!0});return s===pc?null:s}catch(i){throw i}return null}static async lookupAddress(e,n,r){const i=r==null?ho:Ae(r);vy(i)&&(n=$e(n));const s=await By(e);if(s)try{const c=(await s.reverse(n,i,{enableCcipRead:!0})).primary;return ey(c)?c:null}catch(a){if(Nt(a,"CALL_EXCEPTION")&&a.reason==="ResolverNotFound(bytes)")return null;throw a}fe(i===ho,"lookupAddress coinType requires ENS Universal Resolver","UNSUPPORTED_OPERATION",{operation:"lookupAddress"});try{const a=await pr.fromName(e,`${n.toLowerCase().substring(2)}.addr.reverse`);if(!a)return null;const c=await a.getName();return c==null||!ey(c)||await e.resolveName(c)!==n?null:c}catch(a){if(Nt(a,"BAD_DATA")&&a.value==="0x"||Nt(a,"CALL_EXCEPTION"))return null;throw a}}static async fromName(e,n){const r=await By(e);if(r){let s;try{s=ny(Y2(n),255)}catch{return null}const a=await r.requireResolver(s);return new pr(e,a.resolver,n,a.extended)}let i=n;for(;;){if(i===""||i==="."||n!=="eth"&&i==="eth")return null;const s=await pr.#r(e,i);if(s!=null){const a=new pr(e,s,n);return i!==n&&!await a.supportsWildcard()?null:a}i=i.split(".").slice(1).join(".")}}}async function By(t){const e=await pr.getUniversalResolverAddress(t);return e?new Za(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 Ry=BigInt(0);function Me(t,e){return(function(n){return n==null?e:t(n)})}function _o(t,e){return(n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))})}function ea(t,e){return(n=>{const r={};for(const i in t){let s=i;if(e&&i in e&&!(s in n)){for(const a of e[i])if(a in n){s=a;break}}try{const a=t[i](n[s]);a!==void 0&&(r[i]=a)}catch(a){const c=a instanceof Error?a.message:"not-an-error";fe(!1,`invalid value for value.${i} (${c})`,"BAD_DATA",{value:n})}}return r})}function RD(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 Ss(t){return F(nt(t,!0),"invalid data","value",t),t}function kt(t){return F(nt(t,32),"invalid hash","value",t),t}const TD=ea({address:$e,blockHash:kt,blockNumber:Ne,data:Ss,index:Ne,removed:Me(RD,!1),topics:_o(kt),transactionHash:kt,transactionIndex:Ne},{index:["logIndex"]});function SD(t){return TD(t)}const ID=ea({hash:Me(kt),parentHash:kt,parentBeaconBlockRoot:Me(kt,null),number:Ne,timestamp:Ne,nonce:Me(Ss),difficulty:Ae,gasLimit:Ae,gasUsed:Ae,stateRoot:Me(kt,null),receiptsRoot:Me(kt,null),transactionsRoot:Me(kt,null),blobGasUsed:Me(Ae,null),excessBlobGas:Me(Ae,null),miner:Me($e),prevRandao:Me(kt,null),extraData:Ss,baseFeePerGas:Me(Ae)},{prevRandao:["mixHash"]});function OD(t){const e=ID(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:v3(n)),e}const PD=ea({transactionIndex:Ne,blockNumber:Ne,transactionHash:kt,address:$e,topics:_o(kt),data:Ss,index:Ne,blockHash:kt},{index:["logIndex"]});function kD(t){return PD(t)}const ND=ea({to:Me($e,null),from:Me($e,null),contractAddress:Me($e,null),index:Ne,root:Me(pe),gasUsed:Ae,blobGasUsed:Me(Ae,null),logsBloom:Me(Ss),blockHash:kt,hash:kt,logs:_o(kD),blockNumber:Ne,cumulativeGasUsed:Ae,effectiveGasPrice:Me(Ae),blobGasPrice:Me(Ae,null),status:Me(Ne),type:Me(Ne,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function CD(t){return ND(t)}function v3(t){t.to&&Ae(t.to)===Ry&&(t.to="0x0000000000000000000000000000000000000000");const e=ea({hash:kt,index:Me(Ne,void 0),type:n=>n==="0x"||n==null?0:Ne(n),accessList:Me(Ui,null),blobVersionedHashes:Me(_o(kt,!0),null),authorizationList:Me(_o(n=>{let r;if(n.signature)r=n.signature;else{let i=n.yParity;i==="0x1b"?i=0:i==="0x1c"&&(i=1),r=Object.assign({},n,{yParity:i})}return{address:$e(n.address),chainId:Ae(n.chainId),nonce:Ae(n.nonce),signature:gt.from(r)}},!1),null),blockHash:Me(kt,null),blockNumber:Me(Ne,null),transactionIndex:Me(Ne,null),from:$e,gasPrice:Me(Ae),maxPriorityFeePerGas:Me(Ae),maxFeePerGas:Me(Ae),maxFeePerBlobGas:Me(Ae,null),gasLimit:Ae,to:Me($e,null),value:Ae,nonce:Ne,data:Ss,creates:Me($e,null),chainId:Me(Ae,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=AC(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=gt.from(t.signature):e.signature=gt.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&Ae(e.blockHash)===Ry&&(e.blockHash=null),e}const _D="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",DD=Symbol.for("nodejs.util.inspect.custom");class ta{name;constructor(e){Oe(this,{name:e})}[DD](){return this.toString()}toString(){return`${this.name} { }`}clone(){return new ta(this.name)}}class Yc extends ta{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(e,n){e==null&&(e=0),super(`org.ethers.network.plugins.GasCost#${e||0}`);const r={effectiveBlock:e};function i(s,a){let c=(n||{})[s];c==null&&(c=a),F(typeof c=="number",`invalud value for ${s}`,"costs",n),r[s]=c}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Oe(this,r)}toString(){return`${this.name} { txBase: ${this.txBase}, txCreate: ${this.txCreate}, txDataZero: ${this.txDataZero}, txAccessListStorageKey: ${this.txAccessListStorageKey}, txAccessListAddress: ${this.txAccessListAddress} }`}clone(){return new Yc(this.effectiveBlock,this)}}class Xc extends ta{address;targetNetwork;universalResolver;constructor(e,n,r){super("org.ethers.plugins.network.Ens"),Oe(this,{address:e||_D,targetNetwork:n??1,universalResolver:r})}toString(){return`${this.name} { address: ${this.address}, targetNetwork: ${this.targetNetwork}, universalResolver: ${this.universalResolver} }`}clone(){return new Xc(this.address,this.targetNetwork,this.universalResolver)}}class FD extends ta{#e;#t;get url(){return this.#e}get processFunc(){return this.#t}constructor(e,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#e=e,this.#t=n}toString(){return`${this.name} { url: ${this.url} }`}clone(){return this}}const UD=Symbol.for("nodejs.util.inspect.custom"),xh=new Map;class dn{#e;#t;#n;constructor(e,n){this.#e=e,this.#t=Ae(n),this.#n=new Map}[UD](){return this.toString()}toString(){const e=[];for(const n of this.#n.values())e.push(n.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=Ae(e,"chainId")}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ae(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ae(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ae(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(this.#n.values())}attachPlugin(e){if(this.#n.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#n.set(e.name,e.clone()),this}getPlugin(e){return this.#n.get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new dn(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new Yc;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let i=2;i<e.data.length;i+=2)e.data.substring(i,i+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const i=Ui(e.accessList);for(const s in i)r+=n.txAccessListAddress+n.txAccessListStorageKey*i[s].storageKeys.length}return r}static from(e){if(LD(),e==null)return dn.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=xh.get(e);if(n)return n();if(typeof e=="bigint")return new dn("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 n=new dn(e.name,e.chainId),r=e;return(r.ensAddress||r.ensNetwork!=null||r.ensUniversalResolver)&&n.attachPlugin(new Xc(r.ensAddress,r.ensNetwork,r.ensUniversalResolver)),n}F(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=xh.get(e);r&&F(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),xh.set(e,n)}}function Ty(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let i=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||i++,r[1]=i.toString()}return BigInt(r[0]+r[1])}function Sy(t){return new FD(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let i;try{const[s,a]=await Promise.all([r.send(),e()]);i=s;const c=i.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:Ty(c.maxFee,9),maxPriorityFeePerGas:Ty(c.maxPriorityFee,9)}}catch(s){fe(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:i,error:s})}})}let Iy=!1;function LD(){if(Iy)return;Iy=!0;function t(n,r,i){const s=function(){const a=new dn(n,r);return i.ensNetwork!=null&&a.attachPlugin(new Xc(null,i.ensNetwork,i.ensUniversalResolver)),a.attachPlugin(new Yc),(i.plugins||[]).forEach(c=>{a.attachPlugin(c)}),a};dn.register(n,s),dn.register(r,s),i.altNames&&i.altNames.forEach(a=>{dn.register(a,s)})}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:[Sy("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[Sy("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 cd(t){return JSON.parse(JSON.stringify(t))}class MD{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=null,this.#n=4e3,this.#r=-2}get pollingInterval(){return this.#n}set pollingInterval(e){this.#n=e}async#i(){try{const e=await this.#e.getBlockNumber();if(this.#r===-2){this.#r=e;return}if(e!==this.#r){for(let n=this.#r+1;n<=e;n++){if(this.#t==null)return;await this.#e.emit("block",n)}this.#r=e}}catch{}this.#t!=null&&(this.#t=this.#e._setTimeout(this.#i.bind(this),this.#n))}start(){this.#t||(this.#t=this.#e._setTimeout(this.#i.bind(this),this.#n),this.#i())}stop(){this.#t&&(this.#e._clearTimeout(this.#t),this.#t=null)}pause(e){this.stop(),e&&(this.#r=-2)}resume(){this.start()}}class b0{#e;#t;#n;constructor(e){this.#e=e,this.#n=!1,this.#t=n=>{this._poll(n,this.#e)}}async _poll(e,n){throw new Error("sub-classes must override this")}start(){this.#n||(this.#n=!0,this.#t(-2),this.#e.on("block",this.#t))}stop(){this.#n&&(this.#n=!1,this.#e.off("block",this.#t))}pause(e){this.stop()}resume(){this.start()}}class $D extends b0{#e;#t;constructor(e,n){super(e),this.#e=n,this.#t=-2}pause(e){e&&(this.#t=-2),super.pause(e)}async _poll(e,n){const r=await n.getBlock(this.#e);r!=null&&(this.#t===-2?this.#t=r.number:r.number>this.#t&&(n.emit(this.#e,r.number),this.#t=r.number))}}class zD extends b0{#e;constructor(e,n){super(e),this.#e=cd(n)}async _poll(e,n){throw new Error("@TODO")}}class GD extends b0{#e;constructor(e,n){super(e),this.#e=n}async _poll(e,n){const r=await n.getTransactionReceipt(this.#e);r&&n.emit(this.#e,r)}}class y0{#e;#t;#n;#r;#i;constructor(e,n){this.#e=e,this.#t=cd(n),this.#n=this.#o.bind(this),this.#r=!1,this.#i=-2}async#o(e){if(this.#i===-2)return;const n=cd(this.#t);n.fromBlock=this.#i+1,n.toBlock=e;const r=await this.#e.getLogs(n);if(r.length===0){this.#i<e-60&&(this.#i=e-60);return}for(const i of r)this.#e.emit(this.#t,i),this.#i=i.blockNumber}start(){this.#r||(this.#r=!0,this.#i===-2&&this.#e.getBlockNumber().then(e=>{this.#i=e}),this.#e.on("block",this.#n))}stop(){this.#r&&(this.#r=!1,this.#e.off("block",this.#n))}pause(e){this.stop(),e&&(this.#i=-2)}resume(){this.start()}}const VD=BigInt(2),jD=10;function wh(t){return new Promise(e=>{setTimeout(e,t)})}function Ua(t){return t&&typeof t.then=="function"}function Ka(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const i=Object.keys(r);return i.sort(),i.reduce((s,a)=>(s[a]=r[a],s),{})}return r})}class B3{name;constructor(e){Oe(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function HD(t){return JSON.parse(JSON.stringify(t))}function ud(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function Ah(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(nt(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:Ka("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:Ka("orphan",n),filter:HD(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(i=>i==null?null:Array.isArray(i)?ud(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(n.address){const i=[],s=[],a=c=>{nt(c)?i.push(c):s.push((async()=>{i.push(await _t(c,e))})())};Array.isArray(n.address)?n.address.forEach(a):a(n.address),s.length&&await Promise.all(s),r.address=ud(i.map(c=>c.toLowerCase()))}return{filter:r,tag:Ka("event",r),type:"event"}}F(!1,"unknown ProviderEvent","event",t)}function La(){return new Date().getTime()}const qD={cacheTimeout:250,pollingInterval:4e3};class ZD{#e;#t;#n;#r;#i;#o;#s;#a;#d;#u;#g;#p;#h;#l;constructor(e,n){if(this.#l=Object.assign({},qD,n||{}),e==="any")this.#o=!0,this.#i=null;else if(e){const r=dn.from(e);this.#o=!1,this.#i=Promise.resolve(r),setTimeout(()=>{this.emit("network",r,null)},0)}else this.#o=!1,this.#i=null;this.#a=-1,this.#s=new Map,this.#e=new Map,this.#t=new Map,this.#n=null,this.#r=!1,this.#d=1,this.#u=new Map,this.#g=!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=Ne(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.#g}set disableCcipRead(e){this.#g=!!e}#f(){let e=this.#p;if(e===0)return 0;const n=this.#h,r=La();n.push(r);const i=r-1e3;for(;n.length&&n[0]<i;)n.shift();return n.length<e?0:n[0]+1e3-r}async#c(e){const n=this.#l.cacheTimeout;if(n<0){const s=this.#f();return s&&await wh(s),await this._perform(e)}const r=Ka(e.method,e);let i=this.#s.get(r);if(!i){const s=this.#f();s&&await wh(s),i=this._perform(e),this.#s.set(r,i),setTimeout(()=>{this.#s.get(r)===i&&this.#s.delete(r)},n)}return await i}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=n.toLowerCase(),a=[];for(let c=0;c<r.length;c++){const l=r[c],h=l.replace("{sender}",i).replace("{data}",s),d=new er(h);l.indexOf("{data}")===-1&&(d.body={data:s,sender:i}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:d,index:c,urls:r});let g="unknown error",m;try{m=await d.send()}catch(w){a.push(w.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:{error:w}});continue}try{const w=m.bodyJson;if(w.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:d,result:w}),w.data;w.message&&(g=w.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:w})}catch{}fe(m.statusCode<400||m.statusCode>=500,`response not found during CCIP fetch: ${g}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:g}}),a.push(g)}fe(!1,`error encountered during CCIP fetch: ${a.map(c=>JSON.stringify(c)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:a}})}_wrapBlock(e,n){return new lD(OD(e),this)}_wrapLog(e,n){return new Yo(SD(e),this)}_wrapTransactionReceipt(e,n){return new f3(CD(e),this)}_wrapTransactionResponse(e,n){return new Xo(v3(e),this)}_detectNetwork(){fe(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){fe(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Ne(await this.#c({method:"getBlockNumber"}),"%response");return this.#a>=0&&(this.#a=e),e}_getAddress(e){return _t(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(nt(e))return nt(e,32)?e:_n(e);if(typeof e=="bigint"&&(e=Ne(e,"blockTag")),typeof e=="number")return e>=0?_n(e):this.#a>=0?_n(this.#a+e):this.getBlockNumber().then(n=>_n(n+e));F(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?ud(l.map(h=>h.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,i=(l,h,d)=>{let g;switch(l.length){case 0:break;case 1:g=l[0];break;default:l.sort(),g=l}if(r&&(h!=null||d!=null))throw new Error("invalid filter");const m={};return g&&(m.address=g),n.length&&(m.topics=n),h&&(m.fromBlock=h),d&&(m.toBlock=d),r&&(m.blockHash=r),m};let s=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)s.push(this._getAddress(l));else s.push(this._getAddress(e.address));let a;"fromBlock"in e&&(a=this._getBlockTag(e.fromBlock));let c;return"toBlock"in e&&(c=this._getBlockTag(e.toBlock)),s.filter(l=>typeof l!="string").length||a!=null&&typeof a!="string"||c!=null&&typeof c!="string"?Promise.all([Promise.all(s),a,c]).then(l=>i(l[0],l[1],l[2])):i(s,a,c)}_getTransactionRequest(e){const n=Co(e),r=[];if(["to","from"].forEach(i=>{if(n[i]==null)return;const s=_t(n[i],this);Ua(s)?r.push((async function(){n[i]=await s})()):n[i]=s}),n.blockTag!=null){const i=this._getBlockTag(n.blockTag);Ua(i)?r.push((async function(){n.blockTag=await i})()):n.blockTag=i}return r.length?(async function(){return await Promise.all(r),n})():n}async getNetwork(){if(this.#i==null){const i=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw this.#i===i&&(this.#i=null),s}})();return this.#i=i,(await i).clone()}const e=this.#i,[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(this.#o?(this.emit("network",r,n),this.#i===e&&(this.#i=Promise.resolve(r))):fe(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:i,gasPrice:s,priorityFee:a}=await Gt({_block:this.#A("latest",!1),gasPrice:(async()=>{try{const d=await this.#c({method:"getGasPrice"});return Ae(d,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const d=await this.#c({method:"getPriorityFee"});return Ae(d,"%response")}catch{}return null})()});let c=null,l=null;const h=this._wrapBlock(i,e);return h&&h.baseFeePerGas&&(l=a??BigInt("1000000000"),c=h.baseFeePerGas*VD+l),new xy(s,c,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const i=new er(r.url),s=await r.processFunc(n,this,i);return new xy(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return Ua(n)&&(n=await n),Ae(await this.#c({method:"estimateGas",transaction:n}),"%response")}async#b(e,n,r){fe(r<jD,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const i=Co(e);try{const s=this.#f();return s&&await wh(s),pe(await this._perform({method:"call",transaction:i,blockTag:n}))}catch(s){if(!this.disableCcipRead&&Jd(s)&&s.data&&r>=0&&n==="latest"&&i.to!=null&&ut(s.data,0,4)==="0x556f1830"){const a=s.data,c=await _t(i.to,this);let l;try{l=YD(ut(s.data,4))}catch(g){fe(!1,g.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:a}})}fe(l.sender.toLowerCase()===c.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);fe(h!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:l.errorArgs}});const d={to:c,data:He([l.selector,QD([h,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:d});try{const g=await this.#b(d,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},d),result:g}),g}catch(g){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},d),error:g}),g}}throw s}}async#y(e){const{value:n}=await Gt({network:this.getNetwork(),value:e});return n}async call(e){const{tx:n,blockTag:r}=await Gt({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await this.#y(this.#b(n,r,e.enableCcipRead?0:-1))}async#m(e,n,r){let i=this._getAddress(n),s=this._getBlockTag(r);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await this.#y(this.#c(Object.assign(e,{address:i,blockTag:s})))}async getBalance(e,n){return Ae(await this.#m({method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return Ne(await this.#m({method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return pe(await this.#m({method:"getCode"},e,n))}async getStorage(e,n,r){const i=Ae(n,"position");return pe(await this.#m({method:"getStorage",position:i},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:i}=await Gt({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=Bn.from(e);if(s.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(n)}async#A(e,n){if(nt(e,32))return await this.#c({method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await this.#c({method:"getBlock",blockTag:r,includeTransactions:n})}async getBlock(e,n){const{network:r,params:i}=await Gt({network:this.getNetwork(),params:this.#A(e,!!n)});return i==null?null:this._wrapBlock(i,r)}async getTransaction(e){const{network:n,params:r}=await Gt({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await Gt({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.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");r.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await Gt({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:e})});return n==null?null:pe(n)}async getLogs(e){let n=this._getFilter(e);Ua(n)&&(n=await n);const{network:r,params:i}=await Gt({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:n})});return i.map(s=>this._wrapLog(s,r))}_getProvider(e){fe(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await pr.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e,n){const r=await this.getResolver(e);return r?await r.getAddress(n):null}async lookupAddress(e,n){return await pr.lookupAddress(this,e,n)}async waitForTransaction(e,n,r){const i=n??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,a)=>{let c=null;const l=(async h=>{try{const d=await this.getTransactionReceipt(e);if(d!=null&&h-d.blockNumber+1>=i){s(d),c&&(clearTimeout(c),c=null);return}}catch(d){console.log("EEE",d)}this.once("block",l)});r!=null&&(c=setTimeout(()=>{c!=null&&(c=null,this.off("block",l),a(pt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){fe(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=this.#u.get(e);n&&(n.timer&&clearTimeout(n.timer),this.#u.delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=this.#d++,i=()=>{this.#u.delete(r),e()};if(this.paused)this.#u.set(r,{timer:null,func:i,time:n});else{const s=setTimeout(i,n);this.#u.set(r,{timer:s,func:i,time:La()})}return r}_forEachSubscriber(e){for(const n of this.#e.values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new B3(e.type);case"block":{const n=new MD(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new $D(this,e.type);case"event":return new y0(this,e.filter);case"transaction":return new GD(this,e.hash);case"orphan":return new zD(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of this.#e.values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),this.#n!=null&&n.pause(this.#n);break}}async#x(e,n){let r=await Ah(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await Ah({orphan:"drop-log",log:n[0]},this)),this.#e.get(r.tag)||null}async#w(e){const n=await Ah(e,this),r=n.tag;let i=this.#e.get(r);return i||(i={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#e.set(r,i)),i}async on(e,n){const r=await this.#w(e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,this.#n!=null&&r.subscriber.pause(this.#n)),this}async once(e,n){const r=await this.#w(e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,this.#n!=null&&r.subscriber.pause(this.#n)),this}async emit(e,...n){const r=await this.#x(e,n);if(!r||r.listeners.length===0)return!1;const i=r.listeners.length;return r.listeners=r.listeners.filter(({listener:s,once:a})=>{const c=new vw(this,a?null:s,e);try{s.call(this,...n,c)}catch{}return!a}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),this.#e.delete(r.tag)),i>0}async listenerCount(e){if(e){const r=await this.#x(e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of this.#e.values())n+=r.length;return n}async listeners(e){if(e){const r=await this.#x(e);return r?r.listeners.map(({listener:i})=>i):[]}let n=[];for(const{listeners:r}of this.#e.values())n=n.concat(r.map(({listener:i})=>i));return n}async off(e,n){const r=await this.#x(e);if(!r)return this;if(n){const i=r.listeners.map(({listener:s})=>s).indexOf(n);i>=0&&r.listeners.splice(i,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),this.#e.delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:i}=await this.#w(e);r&&i.stop(),this.#e.delete(n)}else for(const[n,{started:r,subscriber:i}]of this.#e)r&&i.stop(),this.#e.delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return this.#r}destroy(){this.removeAllListeners();for(const e of this.#u.keys())this._clearTimeout(e);this.#r=!0}get paused(){return this.#n!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(this.#a=-1,this.#n!=null){if(this.#n==!!e)return;fe(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),this.#n=!!e;for(const n of this.#u.values())n.timer&&clearTimeout(n.timer),n.time=La()-n.time}resume(){if(this.#n!=null){this._forEachSubscriber(e=>e.resume()),this.#n=null;for(const e of this.#u.values()){let n=e.time;n<0&&(n=0),e.time=La(),setTimeout(e.func,n)}}}}function KD(t,e){try{const n=ld(t,e);if(n)return dc(n)}catch{}return null}function ld(t,e){if(t==="0x")return null;try{const n=Ne(ut(t,e,e+32)),r=Ne(ut(t,n,n+32));return ut(t,n+32,n+32+r)}catch{}return null}function Oy(t){const e=bt(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function JD(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const WD=new Uint8Array([]);function QD(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(WD),n+=32;for(let r=0;r<t.length;r++){const i=we(t[r]);e[r]=Oy(n),e.push(Oy(i.length)),e.push(JD(i)),n+=32+Math.ceil(i.length/32)*32}return He(e)}const Py="0x0000000000000000000000000000000000000000000000000000000000000000";function YD(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};fe(cs(t)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=ut(t,0,32);fe(ut(n,0,12)===ut(Py,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=ut(n,12);try{const r=[],i=Ne(ut(t,32,64)),s=Ne(ut(t,i,i+32)),a=ut(t,i+32);for(let c=0;c<s;c++){const l=KD(a,c*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{fe(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=ld(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{fe(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}fe(ut(t,100,128)===ut(Py,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=ut(t,96,100);try{const r=ld(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{fe(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function fi(t,e){if(t.provider)return t.provider;fe(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function ky(t,e){let n=Co(e);if(n.to!=null&&(n.to=_t(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),_t(r,t)]).then(([i,s])=>(F(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else n.from=t.getAddress();return await Gt(n)}class x0{provider;constructor(e){Oe(this,{provider:e||null})}async getNonce(e){return fi(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await ky(this,e)}async populateTransaction(e){const n=fi(this,"populateTransaction"),r=await ky(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const i=await this.provider.getNetwork();if(r.chainId!=null){const a=Ae(r.chainId);F(a===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=i.chainId;const s=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||s)?F(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&s&&F(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const a=await n.getFeeData();fe(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=a.gasPrice)}else{const a=await n.getFeeData();if(r.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,r.gasPrice!=null){const c=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=c,r.maxPriorityFeePerGas=c}else r.maxFeePerGas==null&&(r.maxFeePerGas=a.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(fe(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=a.gasPrice),r.type=0):fe(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3||r.type===4)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=a.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await Gt(r)}async populateAuthorization(e){const n=Object.assign({},e);return n.chainId==null&&(n.chainId=(await fi(this,"getNetwork").getNetwork()).chainId),n.nonce==null&&(n.nonce=await this.getNonce()),n}async estimateGas(e){return fi(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return fi(this,"call").call(await this.populateCall(e))}async resolveName(e){return await fi(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=fi(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const i=Bn.from(r);return await n.broadcastTransaction(await this.signTransaction(i))}authorize(e){fe(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class w0 extends x0{address;constructor(e,n){super(n),Oe(this,{address:e})}async getAddress(){return this.address}connect(e){return new w0(this.address,e)}#e(e,n){fe(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:n})}async signTransaction(e){this.#e("transactions","signTransaction")}async signMessage(e){this.#e("messages","signMessage")}async signTypedData(e,n,r){this.#e("typed-data","signTypedData")}}function XD(t){return JSON.parse(JSON.stringify(t))}class R3{#e;#t;#n;#r;#i;#o;constructor(e){this.#e=e,this.#t=null,this.#n=this.#s.bind(this),this.#r=!1,this.#i=null,this.#o=!1}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){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 n=null;try{n=await this.#t}catch(s){if(!Nt(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(n==null){this.#t=null,this.#e._recoverSubscriber(this,this._recover(this.#e));return}const r=await this.#e.getNetwork();if(this.#i||(this.#i=r),this.#i.chainId!==r.chainId)throw new Error("chaid changed");if(this.#o)return;const i=await this.#e.send("eth_getFilterChanges",[n]);await this._emitResults(this.#e,i)}catch(n){console.log("@TODO",n)}this.#e.once("block",this.#n)}#a(){const e=this.#t;e&&(this.#t=null,e.then(n=>{this.#e.destroyed||this.#e.send("eth_uninstallFilter",[n])}))}start(){this.#r||(this.#r=!0,this.#s(-2))}stop(){this.#r&&(this.#r=!1,this.#o=!0,this.#a(),this.#e.off("block",this.#n))}pause(e){e&&this.#a(),this.#e.off("block",this.#n)}resume(){this.start()}}class eF extends R3{#e;constructor(e,n){super(e),this.#e=XD(n)}_recover(e){return new y0(e,this.#e)}async _subscribe(e){return await e.send("eth_newFilter",[this.#e])}async _emitResults(e,n){for(const r of n)e.emit(this.#e,e._wrapLog(r,e._network))}}class tF extends R3{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const nF="bigint,boolean,function,number,string,symbol".split(/,/g);function Ja(t){if(t==null||nF.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(Ja);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function rF(t){return new Promise(e=>{setTimeout(e,t)})}function Zi(t){return t&&t.toLowerCase()}function Ny(t){return t&&typeof t.pollingInterval=="number"}const T3={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Eh extends x0{address;constructor(e,n){super(e),n=$e(n),Oe(this,{address:n})}connect(e){fe(!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 n=Ja(e),r=[];if(n.from){const s=n.from;r.push((async()=>{const a=await _t(s,this.provider);F(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&r.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const s=n.to;r.push((async()=>{n.to=await _t(s,this.provider)})())}r.length&&await Promise.all(r);const i=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(e){const n=await this.provider.getBlockNumber(),r=await this.sendUncheckedTransaction(e);return await new Promise((i,s)=>{const a=[1e3,100];let c=0;const l=async()=>{try{const h=await this.provider.getTransaction(r);if(h!=null){i(h.replaceableTransaction(n));return}}catch(h){if(Nt(h,"CANCELLED")||Nt(h,"BAD_DATA")||Nt(h,"NETWORK_ERROR")||Nt(h,"UNSUPPORTED_OPERATION")){h.info==null&&(h.info={}),h.info.sendTransactionHash=r,s(h);return}if(Nt(h,"INVALID_ARGUMENT")&&(c++,h.info==null&&(h.info={}),h.info.sendTransactionHash=r,c>10)){s(h);return}this.provider.emit("error",pt("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 n=Ja(e);if(n.from){const i=await _t(n.from,this.provider);F(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),n.from=i}else n.from=this.address;const r=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[r])}async signMessage(e){const n=typeof e=="string"?Xt(e):e;return await this.provider.send("personal_sign",[pe(n),this.address.toLowerCase()])}async signTypedData(e,n,r){const i=Ja(r),s=await Jt.resolveNames(e,n,i,async a=>{const c=await _t(a);return F(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Jt.getPayload(s.domain,n,s.value))])}async unlock(e){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),e,null])}async _legacySignMessage(e){const n=typeof e=="string"?Xt(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),pe(n)])}}class iF extends ZD{#e;#t;#n;#r;#i;#o;#s;#a(){if(this.#r)return;const e=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#r=setTimeout(()=>{this.#r=null;const n=this.#n;for(this.#n=[];n.length;){const r=[n.shift()];for(;n.length&&r.length!==this.#e.batchMaxCount;)if(r.push(n.shift()),JSON.stringify(r.map(s=>s.payload)).length>this.#e.batchMaxSize){n.unshift(r.pop());break}(async()=>{const i=r.length===1?r[0].payload:r.map(s=>s.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const s=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:s});for(const{resolve:a,reject:c,payload:l}of r){if(this.destroyed){c(pt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const h=s.filter(d=>d.id===l.id)[0];if(h==null){const d=pt("missing response for request","BAD_DATA",{value:s,info:{payload:l}});this.emit("error",d),c(d);continue}if("error"in h){c(this.getRpcError(l,h));continue}a(h.result)}}catch(s){this.emit("debug",{action:"receiveRpcError",error:s});for(const{reject:a}of r)a(s)}})()}},e)}constructor(e,n){super(e,n),this.#t=1,this.#e=Object.assign({},T3,n||{}),this.#n=[],this.#r=null,this.#o=null,this.#s=null;{let i=null;const s=new Promise(a=>{i=a});this.#i={promise:s,resolve:i}}const r=this._getOption("staticNetwork");typeof r=="boolean"?(F(!r||e!=="any","staticNetwork cannot be used on special network 'any'","options",n),r&&e!=null&&(this.#o=dn.from(e))):r&&(F(e==null||r.matches(e),"staticNetwork MUST match network object","options",n),this.#o=r)}_getOption(e){return this.#e[e]}get _network(){return fe(this.#o,"network is not available yet","NETWORK_ERROR"),this.#o}async _perform(e){if(e.method==="call"||e.method==="estimateGas"){let r=e.transaction;if(r&&r.type!=null&&Ae(r.type)&&r.maxFeePerGas==null&&r.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(e=Object.assign({},e,{transaction:Object.assign({},r,{type:void 0})}))}}const n=this.getRpcRequest(e);return n!=null?await this.send(n.method,n.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 n=dn.from(Ae(await this.send("eth_chainId",[])));return this.#s=null,n}catch(n){throw this.#s=null,n}})(),await this.#s):(this.#s=(async()=>{const n={id:this.#t++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let r;try{r=(await this._send(n))[0],this.#s=null}catch(i){throw this.#s=null,this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:r}),"result"in r)return dn.from(Ae(r.result));throw this.getRpcError(n,r)})(),await this.#s)}_start(){this.#i==null||this.#i.resolve==null||(this.#i.resolve(),this.#i=null,(async()=>{for(;this.#o==null&&!this.destroyed;)try{this.#o=await this._detectNetwork()}catch(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",pt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await rF(1e3)}this.#a()})())}async _waitUntilReady(){if(this.#i!=null)return await this.#i.promise}_getSubscriber(e){return e.type==="pending"?new tF(this):e.type==="event"?this._getOption("polling")?new y0(this,e.filter):new eF(this,e.filter):e.type==="orphan"&&e.filter.orphan==="drop-log"?new B3("orphan"):super._getSubscriber(e)}get ready(){return this.#i==null}getRpcTransaction(e){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(r=>{if(e[r]==null)return;let i=r;r==="gasLimit"&&(i="gas"),n[i]=_n(Ae(e[r],`tx.${r}`))}),["from","to","data"].forEach(r=>{e[r]!=null&&(n[r]=pe(e[r]))}),e.accessList&&(n.accessList=Ui(e.accessList)),e.blobVersionedHashes&&(n.blobVersionedHashes=e.blobVersionedHashes.map(r=>r.toLowerCase())),e.authorizationList&&(n.authorizationList=e.authorizationList.map(r=>{const i=k2(r);return{address:i.address,nonce:_n(i.nonce),chainId:_n(i.chainId),yParity:_n(i.signature.yParity),r:_n(i.signature.r),s:_n(i.signature.s)}})),n}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:[Zi(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Zi(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[Zi(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Zi(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(Zi):e.filter.address=Zi(e.filter.address)),{method:"eth_getLogs",args:[e.filter]}}return null}getRpcError(e,n){const{method:r}=e,{error:i}=n;if(r==="eth_estimateGas"&&i.message){const c=i.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return pt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:i}});if(c.match(/nonce/i)&&c.match(/too low/i))return pt("nonce has already been used","NONCE_EXPIRED",{transaction:e.params[0],info:{payload:e,error:i}})}if(r==="eth_call"||r==="eth_estimateGas"){const c=fd(i),l=Ts.getBuiltinCallException(r==="eth_call"?"call":"estimateGas",e.params[0],c?c.data:null);return l.info={error:i,payload:e},l}const s=JSON.stringify(oF(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return pt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[r]||"unknown",reason:"rejected",info:{payload:e,error:i}});if(r==="eth_sendRawTransaction"||r==="eth_sendTransaction"){const c=e.params[0];if(s.match(/insufficient funds|base fee exceeds gas limit/i))return pt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:i}});if(s.match(/nonce/i)&&s.match(/too low/i))return pt("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:i}});if(s.match(/replacement transaction/i)&&s.match(/underpriced/i))return pt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:i}});if(s.match(/only replay-protected/i))return pt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:r,info:{transaction:c,info:{error:i}}})}let a=!!s.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?pt("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:i,payload:e}}):pt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:e})}send(e,n){if(this.destroyed)return Promise.reject(pt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e}));const r=this.#t++,i=new Promise((s,a)=>{this.#n.push({resolve:s,reject:a,payload:{method:e,params:n,id:r,jsonrpc:"2.0"}})});return this.#a(),i}async getSigner(e){e==null&&(e=0);const n=this.send("eth_accounts",[]);if(typeof e=="number"){const i=await n;if(e>=i.length)throw new Error("no such account");return new Eh(this,i[e])}const{accounts:r}=await Gt({network:this.getNetwork(),accounts:n});e=$e(e);for(const i of r)if($e(i)===e)return new Eh(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new Eh(this,n))}destroy(){this.#r&&(clearTimeout(this.#r),this.#r=null);for(const{payload:e,reject:n}of this.#n)n(pt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#n=[],super.destroy()}}class sF extends iF{#e;constructor(e,n){super(e,n);let r=this._getOption("pollingInterval");r==null&&(r=T3.pollingInterval),this.#e=r}_getSubscriber(e){const n=super._getSubscriber(e);return Ny(n)&&(n.pollingInterval=this.#e),n}get pollingInterval(){return this.#e}set pollingInterval(e){if(!Number.isInteger(e)||e<0)throw new Error("invalid interval");this.#e=e,this._forEachSubscriber(n=>{Ny(n)&&(n.pollingInterval=this.#e)})}}class WF extends sF{#e;constructor(e,n,r){e==null&&(e="http://localhost:8545"),super(n,r),typeof e=="string"?this.#e=new er(e):this.#e=e.clone()}_getConnection(){return this.#e.clone()}async send(e,n){return await this._start(),await super.send(e,n)}async _send(e){const n=this._getConnection();n.body=JSON.stringify(e),n.setHeader("content-type","application/json");const r=await n.send();r.assertOk();let i=r.bodyJson;return Array.isArray(i)||(i=[i]),i}}function fd(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&nt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=fd(t[e]);if(n)return n}return null}if(typeof t=="string")try{return fd(JSON.parse(t))}catch{}return null}function hd(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)hd(t[n],e);if(typeof t=="string")try{return hd(JSON.parse(t),e)}catch{}}}function oF(t){const e=[];return hd(t,e),e}class eu extends x0{address;#e;constructor(e,n){super(n),F(e&&typeof e.sign=="function","invalid private key","privateKey","[ REDACTED ]"),this.#e=e;const r=Qo(this.signingKey.publicKey);Oe(this,{address:r})}get signingKey(){return this.#e}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new eu(this.#e,e)}async signTransaction(e){e=Co(e);const{to:n,from:r}=await Gt({to:e.to?_t(e.to,this):void 0,from:e.from?_t(e.from,this):void 0});n!=null&&(e.to=n),r!=null&&(e.from=r),e.from!=null&&(F($e(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const i=Bn.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(M_(e)).serialized}authorizeSync(e){F(typeof e.address=="string","invalid address for authorizeSync","auth.address",e);const n=this.signingKey.sign(n_(e));return Object.assign({},{address:$e(e.address),nonce:Ae(e.nonce||0),chainId:Ae(e.chainId||0)},{signature:n})}async authorize(e){return e=Object.assign({},e,{address:await _t(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,n,r){const i=await Jt.resolveNames(e,n,r,async s=>{fe(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:s}});const a=await this.provider.resolveName(s);return fe(a!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:s}),a});return this.signingKey.sign(Jt.hash(i.domain,n,i.value)).serialized}}const Ac=" !#$%&'()*+,-./<=>?@[]^_`{|}~",aF=/^[a-z]*$/i;function Cy(t,e){let n=97;return t.reduce((r,i)=>(i===e?n++:i.match(aF)?r.push(String.fromCharCode(n)+i):(n=97,r.push(i)),r),[])}function cF(t,e){for(let i=Ac.length-1;i>=0;i--)t=t.split(Ac[i]).join(e.substring(2*i,2*i+2));const n=[],r=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(i,s,a,c)=>{if(a)for(let l=parseInt(a);l>=0;l--)n.push(";");else n.push(s.toLowerCase());return""});if(r)throw new Error(`leftovers: ${JSON.stringify(r)}`);return Cy(Cy(n,";"),":")}function uF(t){return F(t[0]==="0","unsupported auwl data","data",t),cF(t.substring(1+2*Ac.length),t.substring(1,1+2*Ac.length))}class lF{locale;constructor(e){Oe(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class fF extends lF{#e;#t;constructor(e,n,r){super(e),this.#e=n,this.#t=r,this.#n=null}get _data(){return this.#e}_decodeWords(){return uF(this.#e)}#n;#r(){if(this.#n==null){const e=this._decodeWords();if(Sr(e.join(`
|
|
86
|
+
`)+`
|
|
87
|
+
`)!==this.#t)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#n=e}return this.#n}getWord(e){const n=this.#r();return F(e>=0&&e<n.length,`invalid word index: ${e}`,"index",e),n[e]}getWordIndex(e){return this.#r().indexOf(e)}}const hF="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",dF="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let vh=null;class Pi extends fF{constructor(){super("en",hF,dF)}static wordlist(){return vh==null&&(vh=new Pi),vh}}function S3(t){return(1<<t)-1<<8-t&255}function pF(t){return(1<<t)-1&255}function Bh(t,e){yw("NFKD"),e==null&&(e=Pi.wordlist());const n=e.split(t);F(n.length%3===0&&n.length>=12&&n.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const r=new Uint8Array(Math.ceil(11*n.length/8));let i=0;for(let h=0;h<n.length;h++){let d=e.getWordIndex(n[h].normalize("NFKD"));F(d>=0,`invalid mnemonic word at index ${h}`,"mnemonic","[ REDACTED ]");for(let g=0;g<11;g++)d&1<<10-g&&(r[i>>3]|=1<<7-i%8),i++}const s=32*n.length/3,a=n.length/3,c=S3(a),l=we(Sn(r.slice(0,s/8)))[0]&c;return F(l===(r[r.length-1]&c),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),pe(r.slice(0,s/8))}function Rh(t,e){F(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=Pi.wordlist());const n=[0];let r=11;for(let a=0;a<t.length;a++)r>8?(n[n.length-1]<<=8,n[n.length-1]|=t[a],r-=8):(n[n.length-1]<<=r,n[n.length-1]|=t[a]>>8-r,n.push(t[a]&pF(8-r)),r+=3);const i=t.length/4,s=parseInt(Sn(t).substring(2,4),16)&S3(i);return n[n.length-1]<<=i,n[n.length-1]|=s>>8-i,e.join(n.map(a=>e.getWord(a)))}const Th={};class Is{phrase;password;wordlist;entropy;constructor(e,n,r,i,s){i==null&&(i=""),s==null&&(s=Pi.wordlist()),Fi(e,Th,"Mnemonic"),Oe(this,{phrase:r,password:i,wordlist:s,entropy:n})}computeSeed(){const e=Xt("mnemonic"+this.password,"NFKD");return ni(Xt(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,n,r){const i=Bh(e,r);return e=Rh(we(i),r),new Is(Th,i,e,n,r)}static fromEntropy(e,n,r){const i=we(e,"entropy"),s=Rh(i,r);return new Is(Th,pe(i),s,n,r)}static entropyToPhrase(e,n){const r=we(e,"entropy");return Rh(r,n)}static phraseToEntropy(e,n){return Bh(e,n)}static isValidMnemonic(e,n){try{return Bh(e,n),!0}catch{}return!1}}var Ft=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Sh=function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="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 r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},Wa,wn,Zn;const gF={16:10,24:12,32:14},mF=[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],yn=[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],Ma=[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],bF=[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],yF=[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],xF=[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],wF=[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],AF=[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],EF=[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],vF=[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],BF=[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],RF=[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],TF=[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],SF=[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],IF=[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 Ih(t){const e=[];for(let n=0;n<t.length;n+=4)e.push(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]);return e}class A0{get key(){return Ft(this,Wa,"f").slice()}constructor(e){if(Wa.set(this,void 0),wn.set(this,void 0),Zn.set(this,void 0),!(this instanceof A0))throw Error("AES must be instanitated with `new`");Sh(this,Wa,new Uint8Array(e),"f");const n=gF[this.key.length];if(n==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");Sh(this,Zn,[],"f"),Sh(this,wn,[],"f");for(let d=0;d<=n;d++)Ft(this,Zn,"f").push([0,0,0,0]),Ft(this,wn,"f").push([0,0,0,0]);const r=(n+1)*4,i=this.key.length/4,s=Ih(this.key);let a;for(let d=0;d<i;d++)a=d>>2,Ft(this,Zn,"f")[a][d%4]=s[d],Ft(this,wn,"f")[n-a][d%4]=s[d];let c=0,l=i,h;for(;l<r;){if(h=s[i-1],s[0]^=yn[h>>16&255]<<24^yn[h>>8&255]<<16^yn[h&255]<<8^yn[h>>24&255]^mF[c]<<24,c+=1,i!=8)for(let w=1;w<i;w++)s[w]^=s[w-1];else{for(let w=1;w<i/2;w++)s[w]^=s[w-1];h=s[i/2-1],s[i/2]^=yn[h&255]^yn[h>>8&255]<<8^yn[h>>16&255]<<16^yn[h>>24&255]<<24;for(let w=i/2+1;w<i;w++)s[w]^=s[w-1]}let d=0,g,m;for(;d<i&&l<r;)g=l>>2,m=l%4,Ft(this,Zn,"f")[g][m]=s[d],Ft(this,wn,"f")[n-g][m]=s[d++],l++}for(let d=1;d<n;d++)for(let g=0;g<4;g++)h=Ft(this,wn,"f")[d][g],Ft(this,wn,"f")[d][g]=RF[h>>24&255]^TF[h>>16&255]^SF[h>>8&255]^IF[h&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const n=Ft(this,Zn,"f").length-1,r=[0,0,0,0];let i=Ih(e);for(let c=0;c<4;c++)i[c]^=Ft(this,Zn,"f")[0][c];for(let c=1;c<n;c++){for(let l=0;l<4;l++)r[l]=bF[i[l]>>24&255]^yF[i[(l+1)%4]>>16&255]^xF[i[(l+2)%4]>>8&255]^wF[i[(l+3)%4]&255]^Ft(this,Zn,"f")[c][l];i=r.slice()}const s=new Uint8Array(16);let a=0;for(let c=0;c<4;c++)a=Ft(this,Zn,"f")[n][c],s[4*c]=(yn[i[c]>>24&255]^a>>24)&255,s[4*c+1]=(yn[i[(c+1)%4]>>16&255]^a>>16)&255,s[4*c+2]=(yn[i[(c+2)%4]>>8&255]^a>>8)&255,s[4*c+3]=(yn[i[(c+3)%4]&255]^a)&255;return s}decrypt(e){if(e.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const n=Ft(this,wn,"f").length-1,r=[0,0,0,0];let i=Ih(e);for(let c=0;c<4;c++)i[c]^=Ft(this,wn,"f")[0][c];for(let c=1;c<n;c++){for(let l=0;l<4;l++)r[l]=AF[i[l]>>24&255]^EF[i[(l+3)%4]>>16&255]^vF[i[(l+2)%4]>>8&255]^BF[i[(l+1)%4]&255]^Ft(this,wn,"f")[c][l];i=r.slice()}const s=new Uint8Array(16);let a=0;for(let c=0;c<4;c++)a=Ft(this,wn,"f")[n][c],s[4*c]=(Ma[i[c]>>24&255]^a>>24)&255,s[4*c+1]=(Ma[i[(c+3)%4]>>16&255]^a>>16)&255,s[4*c+2]=(Ma[i[(c+2)%4]>>8&255]^a>>8)&255,s[4*c+3]=(Ma[i[(c+1)%4]&255]^a)&255;return s}}Wa=new WeakMap,wn=new WeakMap,Zn=new WeakMap;class I3{constructor(e,n,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new A0(n)},name:{enumerable:!0,value:e}})}}var $a=function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="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 r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},Ki=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},po,ur;class E0 extends I3{constructor(e,n){if(super("ECC",e,E0),po.set(this,void 0),ur.set(this,void 0),n){if(n.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");$a(this,po,new Uint8Array(n),"f")}else $a(this,po,new Uint8Array(16),"f");$a(this,ur,this.iv,"f")}get iv(){return new Uint8Array(Ki(this,po,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let i=0;i<16;i++)Ki(this,ur,"f")[i]^=e[r+i];$a(this,ur,this.aes.encrypt(Ki(this,ur,"f")),"f"),n.set(Ki(this,ur,"f"),r)}return n}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const i=this.aes.decrypt(e.subarray(r,r+16));for(let s=0;s<16;s++)n[r+s]=i[s]^Ki(this,ur,"f")[s],Ki(this,ur,"f")[s]=e[r+s]}return n}}po=new WeakMap,ur=new WeakMap;var Ji=function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="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 r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},xn=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},go,di,An;class Os extends I3{constructor(e,n){super("CTR",e,Os),go.set(this,void 0),di.set(this,void 0),An.set(this,void 0),Ji(this,An,new Uint8Array(16),"f"),xn(this,An,"f").fill(0),Ji(this,go,xn(this,An,"f"),"f"),Ji(this,di,16,"f"),n==null&&(n=1),typeof n=="number"?this.setCounterValue(n):this.setCounterBytes(n)}get counter(){return new Uint8Array(xn(this,An,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let n=15;n>=0;--n)xn(this,An,"f")[n]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(e.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");xn(this,An,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(xn(this,An,"f")[e]===255)xn(this,An,"f")[e]=0;else{xn(this,An,"f")[e]++;break}}encrypt(e){var n,r;const i=new Uint8Array(e);for(let s=0;s<i.length;s++)xn(this,di,"f")===16&&(Ji(this,go,this.aes.encrypt(xn(this,An,"f")),"f"),Ji(this,di,0,"f"),this.increment()),i[s]^=xn(this,go,"f")[Ji(this,di,(r=xn(this,di,"f"),n=r++,r),"f"),n];return i}decrypt(e){return this.encrypt(e)}}go=new WeakMap,di=new WeakMap,An=new WeakMap;function OF(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 n=t.length-e;for(let r=0;r<e;r++)if(t[n+r]!==e)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(t.subarray(0,n))}function O3(t){return typeof t=="string"&&!t.startsWith("0x")&&(t="0x"+t),Ut(t)}function io(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function na(t){return typeof t=="string"?Xt(t,"NFKC"):Ut(t)}function Et(t,e){const n=e.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);F(n!=null,"invalid path","path",e);const r=n[1],i=n[3],s=n[4]==="!";let a=t;for(const c of r.toLowerCase().split(".")){if(Array.isArray(a)){if(!c.match(/^[0-9]+$/))break;a=a[parseInt(c)]}else if(typeof a=="object"){let l=null;for(const h in a)if(h.toLowerCase()===c){l=a[h];break}a=l}else a=null;if(a==null)break}if(F(!s||a!=null,"missing required value","path",r),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 O3(a);if(i==="array"&&Array.isArray(a)||i===typeof a)return a;F(!1,`wrong type found for ${i} `,"path",r)}return a}const P3="m/44'/60'/0'/0/0";function _y(t){try{const e=JSON.parse(t);if((e.version!=null?parseInt(e.version):0)===3)return!0}catch{}return!1}function PF(t,e,n){if(Et(t,"crypto.cipher:string")==="aes-128-ctr"){const i=Et(t,"crypto.cipherparams.iv:data!"),s=new Os(e,i);return pe(s.decrypt(n))}fe(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function Ec(t,e){const n=we(e),r=Et(t,"crypto.ciphertext:data!"),i=pe(ht(He([n.slice(16,32),r]))).substring(2);F(i===Et(t,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const s=PF(t,n.slice(0,16),r),a=Qo(s);if(t.address){let h=t.address.toLowerCase();h.startsWith("0x")||(h="0x"+h),F($e(h)===a,"keystore address/privateKey mismatch","address",t.address)}const c={address:a,privateKey:s};if(Et(t,"x-ethers.version:string")==="0.1"){const h=n.slice(32,64),d=Et(t,"x-ethers.mnemonicCiphertext:data!"),g=Et(t,"x-ethers.mnemonicCounter:data!"),m=new Os(h,g);c.mnemonic={path:Et(t,"x-ethers.path:string")||P3,locale:Et(t,"x-ethers.locale:string")||"en",entropy:pe(we(m.decrypt(d)))}}return c}function k3(t){const e=Et(t,"crypto.kdf:string");if(e&&typeof e=="string"){if(e.toLowerCase()==="scrypt"){const n=Et(t,"crypto.kdfparams.salt:data!"),r=Et(t,"crypto.kdfparams.n:int!"),i=Et(t,"crypto.kdfparams.r:int!"),s=Et(t,"crypto.kdfparams.p:int!");F(r>0&&(r&r-1)===0,"invalid kdf.N","kdf.N",r),F(i>0&&s>0,"invalid kdf","kdf",e);const a=Et(t,"crypto.kdfparams.dklen:int!");return F(a===32,"invalid kdf.dklen","kdf.dflen",a),{name:"scrypt",salt:n,N:r,r:i,p:s,dkLen:64}}else if(e.toLowerCase()==="pbkdf2"){const n=Et(t,"crypto.kdfparams.salt:data!"),r=Et(t,"crypto.kdfparams.prf:string!"),i=r.split("-").pop();F(i==="sha256"||i==="sha512","invalid kdf.pdf","kdf.pdf",r);const s=Et(t,"crypto.kdfparams.c:int!"),a=Et(t,"crypto.kdfparams.dklen:int!");return F(a===32,"invalid kdf.dklen","kdf.dklen",a),{name:"pbkdf2",salt:n,count:s,dkLen:a,algorithm:i}}}F(!1,"unsupported key-derivation function","kdf",e)}function kF(t,e){const n=JSON.parse(t),r=na(e),i=k3(n);if(i.name==="pbkdf2"){const{salt:g,count:m,dkLen:w,algorithm:v}=i,E=ni(r,g,m,w,v);return Ec(n,E)}fe(i.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:l,dkLen:h}=i,d=Us(r,s,a,c,l,h);return Ec(n,d)}function Dy(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function NF(t,e,n){const r=JSON.parse(t),i=na(e),s=k3(r);if(s.name==="pbkdf2"){n&&(n(0),await Dy(0));const{salt:m,count:w,dkLen:v,algorithm:E}=s,S=ni(i,m,w,v,E);return n&&(n(1),await Dy(0)),Ec(r,S)}fe(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:a,N:c,r:l,p:h,dkLen:d}=s,g=await Fs(i,a,c,l,h,d,n);return Ec(r,g)}function N3(t){const e=t.salt!=null?we(t.salt,"options.salt"):xr(32);let n=1<<17,r=8,i=1;return t.scrypt&&(t.scrypt.N&&(n=t.scrypt.N),t.scrypt.r&&(r=t.scrypt.r),t.scrypt.p&&(i=t.scrypt.p)),F(typeof n=="number"&&n>0&&Number.isSafeInteger(n)&&(BigInt(n)&BigInt(n-1))===BigInt(0),"invalid scrypt N parameter","options.N",n),F(typeof r=="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r),F(typeof i=="number"&&i>0&&Number.isSafeInteger(i),"invalid scrypt p parameter","options.p",i),{name:"scrypt",dkLen:32,salt:e,N:n,r,p:i}}function C3(t,e,n,r){const i=we(n.privateKey,"privateKey"),s=r.iv!=null?we(r.iv,"options.iv"):xr(16);F(s.length===16,"invalid options.iv length","options.iv",r.iv);const a=r.uuid!=null?we(r.uuid,"options.uuid"):xr(16);F(a.length===16,"invalid options.uuid length","options.uuid",r.iv);const c=t.slice(0,16),l=t.slice(16,32),h=new Os(c,s),d=we(h.encrypt(i)),g=ht(He([l,d])),m={address:n.address.substring(2).toLowerCase(),id:Dk(a),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:pe(s).substring(2)},ciphertext:pe(d).substring(2),kdf:"scrypt",kdfparams:{salt:pe(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:g.substring(2)}};if(n.mnemonic){const w=r.client!=null?r.client:`ethers/${mw}`,v=n.mnemonic.path||P3,E=n.mnemonic.locale||"en",S=t.slice(32,64),A=we(n.mnemonic.entropy,"account.mnemonic.entropy"),I=xr(16),T=new Os(S,I),O=we(T.encrypt(A)),k=new Date,D="UTC--"+(k.getUTCFullYear()+"-"+io(k.getUTCMonth()+1,2)+"-"+io(k.getUTCDate(),2)+"T"+io(k.getUTCHours(),2)+"-"+io(k.getUTCMinutes(),2)+"-"+io(k.getUTCSeconds(),2)+".0Z")+"--"+m.address;m["x-ethers"]={client:w,gethFilename:D,path:v,locale:E,mnemonicCounter:pe(I).substring(2),mnemonicCiphertext:pe(O).substring(2),version:"0.1"}}return JSON.stringify(m)}function _3(t,e,n){n==null&&(n={});const r=na(e),i=N3(n),s=Us(r,i.salt,i.N,i.r,i.p,64);return C3(we(s),i,t,n)}async function D3(t,e,n){n==null&&(n={});const r=na(e),i=N3(n),s=await Fs(r,i.salt,i.N,i.r,i.p,64,n.progressCallback);return C3(we(s),i,t,n)}const Oh="m/44'/60'/0'/0/0",CF=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Wr=2147483648,_F=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),DF="0123456789abcdef";function vc(t,e){let n="";for(;t;)n=DF[t%16]+n,t=Math.trunc(t/16);for(;n.length<e*2;)n="0"+n;return"0x"+n}function dd(t){const e=we(t),n=ut(Sn(Sn(e)),0,4),r=He([e,n]);return Ew(r)}const Kn={};function F3(t,e,n,r){const i=new Uint8Array(37);t&Wr?(fe(r!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),i.set(we(r),1)):i.set(we(n));for(let a=24;a>=0;a-=8)i[33+(a>>3)]=t>>24-a&255;const s=we(_s("sha512",e,i));return{IL:s.slice(0,32),IR:s.slice(32)}}function U3(t,e){const n=e.split("/");F(n.length>0,"invalid path","path",e),n[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),n.shift());let r=t;for(let i=0;i<n.length;i++){const s=n[i];if(s.match(/^[0-9]+'$/)){const a=parseInt(s.substring(0,s.length-1));F(a<Wr,"invalid path index",`path[${i}]`,s),r=r.deriveChild(Wr+a)}else if(s.match(/^[0-9]+$/)){const a=parseInt(s);F(a<Wr,"invalid path index",`path[${i}]`,s),r=r.deriveChild(a)}else F(!1,"invalid path component",`path[${i}]`,s)}return r}class Rn extends eu{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,n,r,i,s,a,c,l,h){super(n,h),Fi(e,Kn,"HDNodeWallet"),Oe(this,{publicKey:n.compressedPublicKey});const d=ut(Ds(Sn(this.publicKey)),0,4);Oe(this,{parentFingerprint:r,fingerprint:d,chainCode:i,path:s,index:a,depth:c}),Oe(this,{mnemonic:l})}connect(e){return new Rn(Kn,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#e(){const e={address:this.address,privateKey:this.privateKey},n=this.mnemonic;return this.path&&n&&n.wordlist.locale==="en"&&n.password===""&&(e.mnemonic={path:this.path,locale:"en",entropy:n.entropy}),e}async encrypt(e,n){return await D3(this.#e(),e,{progressCallback:n})}encryptSync(e){return _3(this.#e(),e)}get extendedKey(){return fe(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),dd(He(["0x0488ADE4",vc(this.depth,1),this.parentFingerprint,vc(this.index,4),this.chainCode,He(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new Do(Kn,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const n=Ne(e,"index");F(n<=4294967295,"invalid index","index",n);let r=this.path;r&&(r+="/"+(n&~Wr),n&Wr&&(r+="'"));const{IR:i,IL:s}=F3(n,this.chainCode,this.publicKey,this.privateKey),a=new rn(Tr((zc(s)+BigInt(this.privateKey))%_F,32));return new Rn(Kn,a,this.fingerprint,pe(i),r,n,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return U3(this,e)}static#t(e,n){F(Mc(e),"invalid seed","seed","[REDACTED]");const r=we(e,"seed");F(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const i=we(_s("sha512",CF,r)),s=new rn(pe(i.slice(0,32)));return new Rn(Kn,s,"0x00000000",pe(i.slice(32)),"m",0,0,n,null)}static fromExtendedKey(e){const n=bt(xk(e));F(n.length===82||dd(n.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=n[4],i=pe(n.slice(5,9)),s=parseInt(pe(n.slice(9,13)).substring(2),16),a=pe(n.slice(13,45)),c=n.slice(45,78);switch(pe(n.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const l=pe(c);return new Do(Kn,Qo(l),l,i,a,null,s,r,null)}case"0x0488ade4":case"0x04358394 ":if(c[0]!==0)break;return new Rn(Kn,new rn(c.slice(1)),i,a,null,s,r,null,null)}F(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,n,r){e==null&&(e=""),n==null&&(n=Oh),r==null&&(r=Pi.wordlist());const i=Is.fromEntropy(xr(16),e,r);return Rn.#t(i.computeSeed(),i).derivePath(n)}static fromMnemonic(e,n){return n||(n=Oh),Rn.#t(e.computeSeed(),e).derivePath(n)}static fromPhrase(e,n,r,i){n==null&&(n=""),r==null&&(r=Oh),i==null&&(i=Pi.wordlist());const s=Is.fromPhrase(e,n,i);return Rn.#t(s.computeSeed(),s).derivePath(r)}static fromSeed(e){return Rn.#t(e,null)}}class Do extends w0{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,n,r,i,s,a,c,l,h){super(n,h),Fi(e,Kn,"HDNodeVoidWallet"),Oe(this,{publicKey:r});const d=ut(Ds(Sn(r)),0,4);Oe(this,{publicKey:r,fingerprint:d,parentFingerprint:i,chainCode:s,path:a,index:c,depth:l})}connect(e){return new Do(Kn,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return fe(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),dd(He(["0x0488B21E",vc(this.depth,1),this.parentFingerprint,vc(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(e){const n=Ne(e,"index");F(n<=4294967295,"invalid index","index",n);let r=this.path;r&&(r+="/"+(n&~Wr),n&Wr&&(r+="'"));const{IR:i,IL:s}=F3(n,this.chainCode,this.publicKey,null),a=rn.addPoints(s,this.publicKey,!0),c=Qo(a);return new Do(Kn,c,a,this.fingerprint,pe(i),r,n,this.depth+1,this.provider)}derivePath(e){return U3(this,e)}}function Fy(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function Uy(t,e){const n=JSON.parse(t),r=na(e),i=$e(Et(n,"ethaddr:string!")),s=O3(Et(n,"encseed:string!"));F(s&&s.length%16===0,"invalid encseed","json",t);const a=we(ni(r,r,2e3,32,"sha256")).slice(0,16),c=s.slice(0,16),l=s.slice(16),h=new E0(a,c),d=OF(we(h.decrypt(l)));let g="";for(let m=0;m<d.length;m++)g+=String.fromCharCode(d[m]);return{address:i,privateKey:Sr(g)}}function Ly(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}class mo extends eu{constructor(e,n){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let r=typeof e=="string"?new rn(e):e;super(r,n)}connect(e){return new mo(this.signingKey,e)}async encrypt(e,n){const r={address:this.address,privateKey:this.privateKey};return await D3(r,e,{progressCallback:n})}encryptSync(e){const n={address:this.address,privateKey:this.privateKey};return _3(n,e)}static#e(e){if(F(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const r=Is.fromEntropy(e.mnemonic.entropy),i=Rn.fromMnemonic(r,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 n=new mo(e.privateKey);return F(n.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),n}static async fromEncryptedJson(e,n,r){let i=null;return _y(e)?i=await NF(e,n,r):Fy(e)&&(r&&(r(0),await Ly(0)),i=Uy(e,n),r&&(r(1),await Ly(0))),mo.#e(i)}static fromEncryptedJsonSync(e,n){let r=null;return _y(e)?r=kF(e,n):Fy(e)?r=Uy(e,n):F(!1,"invalid JSON wallet","json","[ REDACTED ]"),mo.#e(r)}static createRandom(e){const n=Rn.createRandom();return e?n.connect(e):n}static fromPhrase(e,n){const r=Rn.fromPhrase(e);return n?r.connect(n):r}}export{ZF as B,Za as C,ft as D,It as E,Ar as F,Vt as I,WF as J,Md as M,KF as N,Un as P,Ue as R,Dn as S,Wi as T,mo as W,ts as a,Bo as b,Le as c,Se as d,Er as e,ln as f,$e as g,Ga as h,En as i,VF as j,ot as k,fk as l,zF as m,Cx as n,FS as o,Hi as p,qi as q,xr as r,Hn as s};
|